@weasel-js/core 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +160 -0
  2. package/dist/{DrawCommand-CJtqqt8H.d.ts → DrawCommand-BKJ5JPkC.d.ts} +24 -1
  3. package/dist/{chunk-SYM6RAM4.js → chunk-6DAUIMTO.js} +3 -2
  4. package/dist/chunk-6DAUIMTO.js.map +1 -0
  5. package/dist/{chunk-VOVKONXA.js → chunk-BPRHGTLQ.js} +3 -3
  6. package/dist/{chunk-VOVKONXA.js.map → chunk-BPRHGTLQ.js.map} +1 -1
  7. package/dist/{chunk-BGGZ4CVF.js → chunk-CMBE45MT.js} +3 -3
  8. package/dist/{chunk-BGGZ4CVF.js.map → chunk-CMBE45MT.js.map} +1 -1
  9. package/dist/{chunk-2J6V527H.js → chunk-DLV5F4NY.js} +520 -120
  10. package/dist/chunk-DLV5F4NY.js.map +1 -0
  11. package/dist/{chunk-CQNKCG34.js → chunk-GLZLSPGJ.js} +3 -3
  12. package/dist/chunk-GLZLSPGJ.js.map +1 -0
  13. package/dist/clipboard.d.ts +2 -2
  14. package/dist/clone.d.ts +1 -1
  15. package/dist/{geometry-D9BDMiQi.d.ts → geometry-DVeZ2i-c.d.ts} +1 -1
  16. package/dist/{grid-CaSK9bHV.d.ts → grid-XcFQVS0f.d.ts} +1 -1
  17. package/dist/{index-DOYRTfP0.d.ts → index-Clf_koyR.d.ts} +178 -6
  18. package/dist/index.d.ts +135 -31
  19. package/dist/index.js +5 -5
  20. package/dist/insert.d.ts +2 -2
  21. package/dist/insert.js +1 -1
  22. package/dist/move.d.ts +3 -3
  23. package/dist/move.js +2 -2
  24. package/dist/{options-DMWeTELe.d.ts → options-wAvCnOZd.d.ts} +1 -1
  25. package/dist/{pointSnapToGrid-C3EruUwt.d.ts → pointSnapToGrid-BuDZWBrL.d.ts} +2 -2
  26. package/dist/renderer.d.ts +5 -5
  27. package/dist/renderer.js +5 -5
  28. package/dist/resize.d.ts +3 -3
  29. package/dist/resize.js +2 -2
  30. package/dist/routing.d.ts +6 -6
  31. package/dist/routing.js +1 -1
  32. package/dist/{types-Dcaa0tPq.d.ts → types-BhJJ2OCM.d.ts} +9 -1
  33. package/dist/{types-Cpb4hii1.d.ts → types-DUpI7Apc.d.ts} +3 -95
  34. package/dist/{viewToMat3-D4lrBigW.d.ts → viewToMat3-DFMdZvVl.d.ts} +1 -1
  35. package/package.json +15 -14
  36. package/dist/chunk-2J6V527H.js.map +0 -1
  37. package/dist/chunk-CQNKCG34.js.map +0 -1
  38. package/dist/chunk-SYM6RAM4.js.map +0 -1
  39. /package/dist/{types-B6MMiodD.d.ts → path-B6MMiodD.d.ts} +0 -0
@@ -47,7 +47,7 @@ var PIXELS = {
47
47
  units: { px: 1 }
48
48
  };
49
49
 
50
- // src/features/paths/types.ts
50
+ // src/core/geometry/path.ts
51
51
  var PATH_M = 0;
52
52
  var PATH_L = 1;
53
53
  var PATH_C = 2;
@@ -827,5 +827,5 @@ function guideSnapStrategy(getGuides, options = {}) {
827
827
  }
828
828
 
829
829
  export { AUTO_POSE_DESCRIPTOR, DEFAULT_FLATTEN_TOLERANCE, DEFAULT_GUIDE_TOLERANCE_PX, IMPERIAL_INCHES, METRIC_MM, PATH_C, PATH_CMD_LENGTHS, PATH_L, PATH_M, PATH_Q, PATH_Z, PIXELS, PathBuilder, RECT_ORIGIN_PROJECTION, RECT_POSE_DESCRIPTOR, ROTATED_POSE_DESCRIPTOR, boundsOfPath, ellipsePath, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, formatUnit, gridSnapStrategy, guideSnapStrategy, linePath, meanScale, pathPoseDescriptor, pointInPath, pointToGridCell, polygonFromPoints, rectPath, regularPolygonPath, resolveUnit, scalePathToBounds, starPath, strokeHitTest, transformPath, translatePath, translatePolygonInPlace };
830
- //# sourceMappingURL=chunk-CQNKCG34.js.map
831
- //# sourceMappingURL=chunk-CQNKCG34.js.map
830
+ //# sourceMappingURL=chunk-GLZLSPGJ.js.map
831
+ //# sourceMappingURL=chunk-GLZLSPGJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/units.ts","../src/core/geometry/path.ts","../src/features/paths/bounds.ts","../src/features/paths/flatten.ts","../src/features/paths/hitTest.ts","../src/features/paths/builder.ts","../src/features/paths/transformPath.ts","../src/features/paths/transform.ts","../src/interactions/actions/resize/geometry.ts","../src/features/paths/poseDescriptor.ts","../src/interactions/actions/resize/autoPoseDescriptor.ts","../src/interactions/gestures/shared/strategies/grid.ts","../src/core/viewport/meanScale.ts","../src/interactions/gestures/shared/strategies/guides.ts"],"names":["ex","ey","COORD_COUNT"],"mappings":";;;AA+BO,SAAS,WAAA,CAAY,GAAc,UAAA,EAAiC;AACzE,EAAA,IAAI,OAAO,CAAA,KAAM,QAAA,EAAU,OAAO,CAAA;AAClC,EAAA,IAAI,CAAC,UAAA,EAAY;AACf,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,mCAAA,EAAsC,CAAA,CAAE,KAAK,CAAA,SAAA,EAAY,EAAE,IAAI,CAAA,yBAAA;AAAA,KACjE;AAAA,EACF;AACA,EAAA,MAAM,MAAA,GAAS,UAAA,CAAW,KAAA,CAAM,CAAA,CAAE,IAAI,CAAA;AACtC,EAAA,IAAI,WAAW,MAAA,EAAW;AACxB,IAAA,MAAM,KAAA,GAAQ,OAAO,IAAA,CAAK,UAAA,CAAW,KAAK,CAAA,CAAE,IAAA,CAAK,IAAI,CAAA,IAAK,QAAA;AAC1D,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,8BAA8B,CAAA,CAAE,IAAI,oBAAoB,UAAA,CAAW,IAAI,mBAAmB,KAAK,CAAA,CAAA;AAAA,KACjG;AAAA,EACF;AACA,EAAA,OAAO,EAAE,KAAA,GAAQ,MAAA;AACnB;AAOO,SAAS,UAAA,CACd,SAAA,EACA,WAAA,EACA,UAAA,EACA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A,CAAE,MAAA,GAAS,CAAA,CAAE,CAAA;AACvB,UAAA,MAAM,EAAA,GAAK,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA;AACrB,UAAA,IAAI,EAAA,IAAM,cAAA,IAAkB,EAAA,GAAK,SAAA,EAAW;AAC1C,YAAA,SAAA,GAAY,EAAA;AACZ,YAAA,MAAA,GAAS,CAAA;AAAA,UACX;AAAA,QACF,CAAA,MAAO;AACL,UAAA,MAAM,CAAA,GAAI,CAAA,CAAE,MAAA,GAAS,CAAA,CAAE,CAAA;AACvB,UAAA,MAAM,EAAA,GAAK,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA;AACrB,UAAA,IAAI,EAAA,IAAM,cAAA,IAAkB,EAAA,GAAK,SAAA,EAAW;AAC1C,YAAA,SAAA,GAAY,EAAA;AACZ,YAAA,MAAA,GAAS,CAAA;AAAA,UACX;AAAA,QACF;AAAA,MACF;AAEA,MAAA,IAAI,SAAA,KAAc,QAAA,IAAY,SAAA,KAAc,QAAA,EAAU,OAAO,IAAA;AAC7D,MAAA,MAAM,EAAA,GAAK,SAAA,KAAc,QAAA,GAAW,CAAA,GAAI,MAAA;AACxC,MAAA,MAAM,EAAA,GAAK,SAAA,KAAc,QAAA,GAAW,CAAA,GAAI,MAAA;AACxC,MAAA,IAAI,EAAA,KAAO,CAAA,IAAK,EAAA,KAAO,CAAA,EAAG,OAAO,IAAA;AACjC,MAAA,OAAO,IAAA,CAAK,SAAA,CAAU,IAAA,EAAM,EAAA,EAAI,EAAE,CAAA;AAAA,IACpC;AAAA,GACF;AACF","file":"chunk-GLZLSPGJ.js","sourcesContent":["/**\n * Units — a tiny customizable unit system for canvas-kit APIs.\n *\n * The kit stores all coordinates as bare numbers in a single base unit\n * chosen by the consumer app. To make API call sites self-documenting,\n * the public surface accepts `UnitValue` — either a bare number (interpreted\n * as base units) or a `{ value, unit }` tag that's resolved against a\n * `UnitSystem` at the API boundary. Internals never see units.\n *\n * Linear factors only. No per-axis units. No mixed-unit arithmetic.\n */\n\n/** A unit name (e.g. `'in'`, `'ft'`, `'mm'`). Looked up in a `UnitSystem`. */\nexport type Unit = string;\n\n/** Conversion table mapping unit names to factors against a base unit. */\nexport interface UnitSystem {\n /** Name of the base unit, e.g. 'in'. All conversions resolve to this. */\n base: Unit;\n /** Factor to multiply a value in `unit` by to get base units. base unit's factor is 1. */\n units: Record<Unit, number>;\n}\n\n/** Value at a unit-aware API boundary: bare number (in base units) or `{ value, unit }` tag. */\nexport type UnitValue = number | { value: number; unit: Unit };\n\n/**\n * Resolve a UnitValue to a number in base units.\n * - bare number: returned as-is (assumed base)\n * - tagged: looks up factor; throws if unit not in unit system\n */\nexport function resolveUnit(v: UnitValue, unitSystem?: UnitSystem): number {\n if (typeof v === 'number') return v;\n if (!unitSystem) {\n throw new Error(\n `resolveUnit: tagged value { value: ${v.value}, unit: '${v.unit}' } requires a UnitSystem`,\n );\n }\n const factor = unitSystem.units[v.unit];\n if (factor === undefined) {\n const known = Object.keys(unitSystem.units).join(', ') || '(none)';\n throw new Error(\n `resolveUnit: unknown unit '${v.unit}' (system base: '${unitSystem.base}', known units: ${known})`,\n );\n }\n return v.value * factor;\n}\n\n/**\n * Format a base-unit number as a string in the named display unit.\n * e.g. formatUnit(36, 'ft', IMPERIAL_INCHES) => '3ft'\n * Default precision: 2. Trailing zeros trimmed.\n */\nexport function formatUnit(\n baseValue: number,\n displayUnit: Unit,\n unitSystem: UnitSystem,\n opts?: { precision?: number; suffix?: boolean },\n): string {\n const factor = unitSystem.units[displayUnit];\n if (factor === undefined) {\n const known = Object.keys(unitSystem.units).join(', ') || '(none)';\n throw new Error(\n `formatUnit: unknown unit '${displayUnit}' (system base: '${unitSystem.base}', known units: ${known})`,\n );\n }\n const precision = opts?.precision ?? 2;\n const suffix = opts?.suffix ?? true;\n const display = baseValue / factor;\n // Trim trailing zeros (and a dangling decimal point) without losing precision.\n let s = display.toFixed(precision);\n if (s.includes('.')) {\n s = s.replace(/0+$/, '').replace(/\\.$/, '');\n }\n return suffix ? `${s}${displayUnit}` : s;\n}\n\n/** Imperial unit system with base 'in'. */\nexport const IMPERIAL_INCHES: UnitSystem = {\n base: 'in',\n units: { in: 1, ft: 12, yd: 36, mi: 63360 },\n};\n\n/** Metric unit system with base 'mm'. */\nexport const METRIC_MM: UnitSystem = {\n base: 'mm',\n units: { mm: 1, cm: 10, m: 1000, km: 1_000_000 },\n};\n\n/** Pixel unit system — sole unit is the base. */\nexport const PIXELS: UnitSystem = {\n base: 'px',\n units: { px: 1 },\n};\n","/**\n * Path data model. Vector-graphics primitive used kit-wide as the canonical\n * shape (replacing per-shape ad-hoc poses). SVG-style command stream so we\n * cover lines, polygons, beziers, and multi-contour shapes (think the inner\n * hole of an \"O\") under one type.\n *\n * Storage: command codes in a `Uint8Array`, parameters in a `Float32Array`.\n * Each command consumes a fixed number of float coords from the parameter\n * array; the parser walks both arrays in lockstep. This keeps interaction\n * hot loops monomorphic and keeps GC pressure low under heavy edits.\n *\n * Two path subtypes are distinguished at the type level so common-case\n * machinery (selection AABBs, area-select intersection, hit-testing rect\n * silhouettes) can short-circuit on `RectPath` without paying the polygon\n * kernel cost. Polymorphic kernels accept either via the `Path` union and\n * dispatch on `kind`.\n */\n\n/** Command code: moveTo. */\nexport const PATH_M = 0;\n/** Command code: lineTo. */\nexport const PATH_L = 1;\n/** Command code: cubic bezier (`bezierCurveTo`). */\nexport const PATH_C = 2;\n/** Command code: quadratic bezier (`quadraticCurveTo`). */\nexport const PATH_Q = 3;\n/** Command code: close subpath. */\nexport const PATH_Z = 4;\n\n/** Float coords consumed by each command, indexed by command code. */\nexport const PATH_CMD_LENGTHS: readonly number[] = [2, 2, 6, 4, 0];\n\n/** Fill rule used by polygon path hit-testing and `ctx.fill()`. */\nexport type PathFillRule = 'nonzero' | 'evenodd';\n\n/**\n * Polygon path with arbitrary contours and optional bezier segments.\n * Multi-contour: each `M` opens a new subpath; `Z` closes the current one.\n * Open subpaths (no `Z`) render as polylines and don't contribute to fills.\n */\nexport interface PolygonPath {\n kind: 'polygon';\n commands: Uint8Array;\n coords: Float32Array;\n fillRule: PathFillRule;\n}\n\n/**\n * Axis-aligned rectangle. Fast path for the (very common) case where the\n * shape is just a rect — preserves O(1) bounds and hit-test, avoids the\n * polygon kernel entirely. Promote to `PolygonPath` only when the shape\n * grows beyond what a rect can express.\n */\nexport interface RectPath {\n kind: 'rect';\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** Canonical path shape — either an axis-aligned rect (fast path) or a polygon command stream. */\nexport type Path = PolygonPath | RectPath;\n","/**\n * AABB bounds of a `Path`. Returned as `RectPath` for direct reuse with the\n * rect fast path machinery (selection AABB, area-select intersection).\n *\n * `RectPath` is its own bounds — O(1). For `PolygonPath`, walk segment by\n * segment, computing the tight bound per segment:\n *\n * - `M` / `L`: just the endpoint.\n * - `Q`: quadratic Bezier — endpoints plus axis-aligned extrema (one\n * possible inflection per axis).\n * - `C`: cubic Bezier — endpoints plus axis-aligned extrema (up to two\n * possible inflections per axis, found via the quadratic formula on\n * the derivative).\n *\n * Control points are NOT included directly; they're used only to compute\n * extrema that actually lie on the curve. This avoids the classic \"AABB\n * extends past where the curve visibly reaches\" bug for curved paths whose\n * control points poke outside the visible extent.\n *\n * Empty paths (no commands) return a zero-size rect anchored at the\n * origin — the convention used elsewhere in the kit for missing geometry.\n */\n\nimport { cubicBounds, elevateQuadraticToCubic } from '@weasel-js/geom';\nimport {\n PATH_C,\n PATH_L,\n PATH_M,\n PATH_Q,\n PATH_Z,\n type Path,\n type RectPath,\n} from './types';\n\n/** AABB of a `Path`, returned as a `RectPath` for direct reuse with rect-fast-path machinery. */\nexport function boundsOfPath(path: Path): RectPath {\n if (path.kind === 'rect') return path;\n\n const { commands, coords } = path;\n if (commands.length === 0) {\n return { kind: 'rect', x: 0, y: 0, width: 0, height: 0 };\n }\n\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n let ci = 0;\n let seen = false;\n // Pen position carried across segments — needed because curves are\n // defined relative to the previous endpoint, which is itself the start\n // of the next segment but not re-encoded in `coords`.\n let px = 0, py = 0;\n\n const include = (x: number, y: number) => {\n if (x < minX) minX = x;\n if (x > maxX) maxX = x;\n if (y < minY) minY = y;\n if (y > maxY) maxY = y;\n seen = true;\n };\n\n for (let i = 0; i < commands.length; i++) {\n const cmd = commands[i];\n switch (cmd) {\n case PATH_M:\n case PATH_L: {\n const x = coords[ci], y = coords[ci + 1];\n include(x, y);\n px = x; py = y;\n ci += 2;\n break;\n }\n case PATH_C: {\n const x1 = coords[ci], y1 = coords[ci + 1];\n const x2 = coords[ci + 2], y2 = coords[ci + 3];\n const x3 = coords[ci + 4], y3 = coords[ci + 5];\n const [bMinX, bMinY, bMaxX, bMaxY] = cubicBounds(px, py, x1, y1, x2, y2, x3, y3);\n include(bMinX, bMinY);\n include(bMaxX, bMaxY);\n px = x3; py = y3;\n ci += 6;\n break;\n }\n case PATH_Q: {\n const qx1 = coords[ci], qy1 = coords[ci + 1];\n const qx2 = coords[ci + 2], qy2 = coords[ci + 3];\n const [c1x, c1y, c2x, c2y] = elevateQuadraticToCubic(px, py, qx1, qy1, qx2, qy2);\n const [bMinX, bMinY, bMaxX, bMaxY] = cubicBounds(px, py, c1x, c1y, c2x, c2y, qx2, qy2);\n include(bMinX, bMinY);\n include(bMaxX, bMaxY);\n px = qx2; py = qy2;\n ci += 4;\n break;\n }\n case PATH_Z:\n break;\n default:\n throw new Error(`boundsOfPath: unknown command ${cmd}`);\n }\n }\n\n if (!seen) return { kind: 'rect', x: 0, y: 0, width: 0, height: 0 };\n return { kind: 'rect', x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n\n","/**\n * Bezier flattening — subdivide cubic and quadratic segments into polyline\n * approximations within a flatness tolerance. Used by hit-testing and\n * (eventually) any kernel that doesn't want to special-case curves.\n *\n * The flatness metric is the maximum perpendicular distance from any\n * control point to the chord between endpoints. When that distance falls\n * below `tolerance`, the segment is \"flat enough\" and emitted as a single\n * line segment.\n *\n * Tolerance is in world units. 0.5 is a sensible default for screen-rate\n * rendering at 1× zoom; consumers that zoom in heavily should pass a\n * tighter tolerance.\n */\n\nexport const DEFAULT_FLATTEN_TOLERANCE = 0.5;\n\n/** Distance from point P to line AB (perpendicular). */\nfunction distPointToLine(px: number, py: number, ax: number, ay: number, bx: number, by: number): number {\n const dx = bx - ax;\n const dy = by - ay;\n const len2 = dx * dx + dy * dy;\n if (len2 === 0) {\n const ex = px - ax;\n const ey = py - ay;\n return Math.sqrt(ex * ex + ey * ey);\n }\n const cross = (px - ax) * dy - (py - ay) * dx;\n return Math.abs(cross) / Math.sqrt(len2);\n}\n\n/**\n * Recursively subdivide a cubic bezier (P0..P3) and append `lineTo`-style\n * vertices to `out` (interleaved x,y). The starting endpoint is *not*\n * appended — callers usually emitted it as the segment's previous vertex.\n */\nexport function flattenCubic(\n x0: number, y0: number,\n x1: number, y1: number,\n x2: number, y2: number,\n x3: number, y3: number,\n tolerance: number,\n out: number[],\n): void {\n const d1 = distPointToLine(x1, y1, x0, y0, x3, y3);\n const d2 = distPointToLine(x2, y2, x0, y0, x3, y3);\n if (Math.max(d1, d2) <= tolerance) {\n out.push(x3, y3);\n return;\n }\n // De Casteljau split at t=0.5\n const x01 = (x0 + x1) * 0.5, y01 = (y0 + y1) * 0.5;\n const x12 = (x1 + x2) * 0.5, y12 = (y1 + y2) * 0.5;\n const x23 = (x2 + x3) * 0.5, y23 = (y2 + y3) * 0.5;\n const x012 = (x01 + x12) * 0.5, y012 = (y01 + y12) * 0.5;\n const x123 = (x12 + x23) * 0.5, y123 = (y12 + y23) * 0.5;\n const x0123 = (x012 + x123) * 0.5, y0123 = (y012 + y123) * 0.5;\n flattenCubic(x0, y0, x01, y01, x012, y012, x0123, y0123, tolerance, out);\n flattenCubic(x0123, y0123, x123, y123, x23, y23, x3, y3, tolerance, out);\n}\n\n/** Recursively subdivide a quadratic bezier (P0, P1, P2). */\nexport function flattenQuadratic(\n x0: number, y0: number,\n x1: number, y1: number,\n x2: number, y2: number,\n tolerance: number,\n out: number[],\n): void {\n const d = distPointToLine(x1, y1, x0, y0, x2, y2);\n if (d <= tolerance) {\n out.push(x2, y2);\n return;\n }\n const x01 = (x0 + x1) * 0.5, y01 = (y0 + y1) * 0.5;\n const x12 = (x1 + x2) * 0.5, y12 = (y1 + y2) * 0.5;\n const x012 = (x01 + x12) * 0.5, y012 = (y01 + y12) * 0.5;\n flattenQuadratic(x0, y0, x01, y01, x012, y012, tolerance, out);\n flattenQuadratic(x012, y012, x12, y12, x2, y2, tolerance, out);\n}\n\n/**\n * Like `flattenCubic` but also appends, for each new flattened point, its\n * arc-length fraction `t` (relative to the polyline distance accumulated so\n * far inside this curve) to `arcOut`. Caller then post-processes the segment's\n * `arcOut` range by dividing each by the segment's total flattened arc length\n * to yield t ∈ (0, 1].\n *\n * The returned values are *cumulative distance from the segment start*, not\n * normalized fractions. Two-pass design (accumulate, then divide) keeps the\n * recursive splitter simple — it doesn't need to know the total length up\n * front.\n */\nexport function flattenCubicWithArcLen(\n x0: number, y0: number,\n x1: number, y1: number,\n x2: number, y2: number,\n x3: number, y3: number,\n tolerance: number,\n out: number[],\n arcOut: number[],\n): number {\n return flattenCubicArcRec(x0, y0, x1, y1, x2, y2, x3, y3, tolerance, out, arcOut, 0);\n}\n\nfunction flattenCubicArcRec(\n x0: number, y0: number,\n x1: number, y1: number,\n x2: number, y2: number,\n x3: number, y3: number,\n tolerance: number,\n out: number[],\n arcOut: number[],\n accum: number,\n): number {\n const d1 = distPointToLine(x1, y1, x0, y0, x3, y3);\n const d2 = distPointToLine(x2, y2, x0, y0, x3, y3);\n if (Math.max(d1, d2) <= tolerance) {\n const lastX = out.length >= 2 ? out[out.length - 2] : x0;\n const lastY = out.length >= 2 ? out[out.length - 1] : y0;\n const seg = Math.hypot(x3 - lastX, y3 - lastY);\n accum += seg;\n out.push(x3, y3);\n arcOut.push(accum);\n return accum;\n }\n const x01 = (x0 + x1) * 0.5, y01 = (y0 + y1) * 0.5;\n const x12 = (x1 + x2) * 0.5, y12 = (y1 + y2) * 0.5;\n const x23 = (x2 + x3) * 0.5, y23 = (y2 + y3) * 0.5;\n const x012 = (x01 + x12) * 0.5, y012 = (y01 + y12) * 0.5;\n const x123 = (x12 + x23) * 0.5, y123 = (y12 + y23) * 0.5;\n const x0123 = (x012 + x123) * 0.5, y0123 = (y012 + y123) * 0.5;\n accum = flattenCubicArcRec(x0, y0, x01, y01, x012, y012, x0123, y0123, tolerance, out, arcOut, accum);\n accum = flattenCubicArcRec(x0123, y0123, x123, y123, x23, y23, x3, y3, tolerance, out, arcOut, accum);\n return accum;\n}\n\nexport function flattenQuadraticWithArcLen(\n x0: number, y0: number,\n x1: number, y1: number,\n x2: number, y2: number,\n tolerance: number,\n out: number[],\n arcOut: number[],\n): number {\n return flattenQuadraticArcRec(x0, y0, x1, y1, x2, y2, tolerance, out, arcOut, 0);\n}\n\nfunction flattenQuadraticArcRec(\n x0: number, y0: number,\n x1: number, y1: number,\n x2: number, y2: number,\n tolerance: number,\n out: number[],\n arcOut: number[],\n accum: number,\n): number {\n const d = distPointToLine(x1, y1, x0, y0, x2, y2);\n if (d <= tolerance) {\n const lastX = out.length >= 2 ? out[out.length - 2] : x0;\n const lastY = out.length >= 2 ? out[out.length - 1] : y0;\n const seg = Math.hypot(x2 - lastX, y2 - lastY);\n accum += seg;\n out.push(x2, y2);\n arcOut.push(accum);\n return accum;\n }\n const x01 = (x0 + x1) * 0.5, y01 = (y0 + y1) * 0.5;\n const x12 = (x1 + x2) * 0.5, y12 = (y1 + y2) * 0.5;\n const x012 = (x01 + x12) * 0.5, y012 = (y01 + y12) * 0.5;\n accum = flattenQuadraticArcRec(x0, y0, x01, y01, x012, y012, tolerance, out, arcOut, accum);\n accum = flattenQuadraticArcRec(x012, y012, x12, y12, x2, y2, tolerance, out, arcOut, accum);\n return accum;\n}\n\n","/**\n * Point-in-path hit-testing. `RectPath` short-circuits to AABB compare\n * (O(1)). `PolygonPath` walks the command stream, flattening any bezier\n * segments to line segments, then runs ray-casting (even-odd) or\n * winding-number (non-zero) per the path's `fillRule`.\n *\n * Open subpaths (no `Z`) are skipped for filled hit-testing — they have\n * no enclosed area. For open polylines (strokes), use `strokeHitTest`\n * which computes point-to-segment distance against the flattened\n * polyline and returns true within a configurable threshold.\n */\n\nimport { flattenCubic, flattenQuadratic, DEFAULT_FLATTEN_TOLERANCE } from './flatten';\nimport {\n PATH_C,\n PATH_L,\n PATH_M,\n PATH_Q,\n PATH_Z,\n type Path,\n type PolygonPath,\n} from './types';\n\n/** Options for `pointInPath`. */\nexport interface PointInPathOptions {\n /** Bezier flattening tolerance in world units. Default 0.5. */\n tolerance?: number;\n}\n\n/** Filled-region hit-test for a `Path`. Rect short-circuits to AABB; polygons run ray-cast / winding per `fillRule`. */\nexport function pointInPath(\n path: Path,\n x: number,\n y: number,\n opts: PointInPathOptions = {},\n): boolean {\n if (path.kind === 'rect') {\n return x >= path.x && x <= path.x + path.width && y >= path.y && y <= path.y + path.height;\n }\n return pointInPolygonPath(path, x, y, opts.tolerance ?? DEFAULT_FLATTEN_TOLERANCE);\n}\n\nfunction pointInPolygonPath(path: PolygonPath, x: number, y: number, tolerance: number): boolean {\n const { commands, coords, fillRule } = path;\n if (commands.length === 0) return false;\n\n // Walk the command stream; flatten beziers into per-subpath vertex arrays.\n // For each closed subpath, accumulate winding/crossings against (x, y).\n let crossings = 0;\n let winding = 0;\n\n let subStartX = 0, subStartY = 0;\n let curX = 0, curY = 0;\n let subVerts: number[] = []; // flat [x, y, x, y, ...] for current subpath\n let subOpen = false;\n\n const flushSubpath = (closed: boolean) => {\n if (closed && subVerts.length >= 4) {\n // Close the subpath back to its start.\n subVerts.push(subStartX, subStartY);\n // Now subVerts is a closed polyline; tally crossings/winding.\n for (let i = 0; i < subVerts.length - 2; i += 2) {\n const ax = subVerts[i], ay = subVerts[i + 1];\n const bx = subVerts[i + 2], by = subVerts[i + 3];\n if (segmentCrossesRayRight(x, y, ax, ay, bx, by)) {\n crossings++;\n if (ay <= y && by > y) winding++;\n else if (by <= y && ay > y) winding--;\n }\n }\n }\n subVerts = [];\n subOpen = false;\n };\n\n let ci = 0;\n for (let i = 0; i < commands.length; i++) {\n const cmd = commands[i];\n switch (cmd) {\n case PATH_M: {\n if (subOpen) flushSubpath(false);\n subStartX = coords[ci]; subStartY = coords[ci + 1];\n curX = subStartX; curY = subStartY;\n subVerts.push(curX, curY);\n subOpen = true;\n ci += 2;\n break;\n }\n case PATH_L: {\n curX = coords[ci]; curY = coords[ci + 1];\n subVerts.push(curX, curY);\n ci += 2;\n break;\n }\n case PATH_C: {\n const x1 = coords[ci], y1 = coords[ci + 1];\n const x2 = coords[ci + 2], y2 = coords[ci + 3];\n const x3 = coords[ci + 4], y3 = coords[ci + 5];\n flattenCubic(curX, curY, x1, y1, x2, y2, x3, y3, tolerance, subVerts);\n curX = x3; curY = y3;\n ci += 6;\n break;\n }\n case PATH_Q: {\n const x1 = coords[ci], y1 = coords[ci + 1];\n const x2 = coords[ci + 2], y2 = coords[ci + 3];\n flattenQuadratic(curX, curY, x1, y1, x2, y2, tolerance, subVerts);\n curX = x2; curY = y2;\n ci += 4;\n break;\n }\n case PATH_Z: {\n flushSubpath(true);\n curX = subStartX; curY = subStartY;\n break;\n }\n default:\n throw new Error(`pointInPath: unknown command ${cmd}`);\n }\n }\n if (subOpen) flushSubpath(false);\n\n return fillRule === 'evenodd' ? (crossings & 1) === 1 : winding !== 0;\n}\n\n/**\n * Does the rightward horizontal ray from (x, y) cross segment (ax,ay)→(bx,by)?\n * Standard half-open rule (segments touching from above count, from below\n * don't) — avoids double-counting at shared vertices.\n */\nfunction segmentCrossesRayRight(\n x: number, y: number,\n ax: number, ay: number,\n bx: number, by: number,\n): boolean {\n if ((ay > y) === (by > y)) return false;\n const xCross = ax + ((y - ay) / (by - ay)) * (bx - ax);\n return x < xCross;\n}\n\n/** Options for {@link strokeHitTest}. */\nexport interface StrokeHitTestOptions {\n /** Bezier flattening tolerance in world units. Default 0.5. */\n tolerance?: number;\n}\n\n/**\n * Stroke-distance hit-test. Returns true when (x, y) lies within\n * `threshold` world units of the path's outline — i.e. when a stroke\n * of total width `2 * threshold` drawn along the path would cover the\n * point.\n *\n * Works for both closed and open subpaths — unlike {@link pointInPath},\n * which only tests filled regions. Use this for picking on open\n * polylines / curves and for adding stroke-clickability to closed\n * shapes (logical OR with `pointInPath` when both behaviors are\n * desired).\n *\n * `threshold` is typically the stroke's half-width plus a small slop\n * (e.g. `strokeWidth / 2 + 4`). Cap segments are approximated by the\n * threshold radius around each anchor — the test treats every flattened\n * segment as a capsule of width `2 * threshold`.\n */\nexport function strokeHitTest(\n path: Path,\n x: number,\n y: number,\n threshold: number,\n opts: StrokeHitTestOptions = {},\n): boolean {\n const t2 = threshold * threshold;\n if (path.kind === 'rect') {\n const { x: rx, y: ry, width: w, height: h } = path;\n return (\n pointSegmentDist2(x, y, rx, ry, rx + w, ry) <= t2\n || pointSegmentDist2(x, y, rx + w, ry, rx + w, ry + h) <= t2\n || pointSegmentDist2(x, y, rx + w, ry + h, rx, ry + h) <= t2\n || pointSegmentDist2(x, y, rx, ry + h, rx, ry) <= t2\n );\n }\n return polylineWithinThreshold(path, x, y, t2, opts.tolerance ?? DEFAULT_FLATTEN_TOLERANCE);\n}\n\nfunction polylineWithinThreshold(\n path: PolygonPath,\n px: number, py: number,\n t2: number,\n tolerance: number,\n): boolean {\n const { commands, coords } = path;\n if (commands.length === 0) return false;\n\n // Reuse pointInPath's command-stream + flatten walk; check distance from\n // (px, py) to each emitted segment instead of accumulating crossings.\n let subStartX = 0, subStartY = 0;\n let curX = 0, curY = 0;\n let subVerts: number[] = [];\n let subOpen = false;\n\n const checkSegments = (closed: boolean): boolean => {\n if (closed && subVerts.length >= 4) subVerts.push(subStartX, subStartY);\n for (let i = 0; i < subVerts.length - 2; i += 2) {\n if (pointSegmentDist2(px, py, subVerts[i], subVerts[i + 1], subVerts[i + 2], subVerts[i + 3]) <= t2) {\n return true;\n }\n }\n return false;\n };\n\n let ci = 0;\n for (let i = 0; i < commands.length; i++) {\n const cmd = commands[i];\n switch (cmd) {\n case PATH_M: {\n if (subOpen) {\n if (checkSegments(false)) return true;\n subVerts = [];\n }\n subStartX = coords[ci]; subStartY = coords[ci + 1];\n curX = subStartX; curY = subStartY;\n subVerts.push(curX, curY);\n subOpen = true;\n ci += 2;\n break;\n }\n case PATH_L: {\n curX = coords[ci]; curY = coords[ci + 1];\n subVerts.push(curX, curY);\n ci += 2;\n break;\n }\n case PATH_C: {\n const x1 = coords[ci], y1 = coords[ci + 1];\n const x2 = coords[ci + 2], y2 = coords[ci + 3];\n const x3 = coords[ci + 4], y3 = coords[ci + 5];\n flattenCubic(curX, curY, x1, y1, x2, y2, x3, y3, tolerance, subVerts);\n curX = x3; curY = y3;\n ci += 6;\n break;\n }\n case PATH_Q: {\n const x1 = coords[ci], y1 = coords[ci + 1];\n const x2 = coords[ci + 2], y2 = coords[ci + 3];\n flattenQuadratic(curX, curY, x1, y1, x2, y2, tolerance, subVerts);\n curX = x2; curY = y2;\n ci += 4;\n break;\n }\n case PATH_Z: {\n if (checkSegments(true)) return true;\n subVerts = [];\n subOpen = false;\n curX = subStartX; curY = subStartY;\n break;\n }\n default:\n throw new Error(`strokeHitTest: unknown command ${cmd}`);\n }\n }\n if (subOpen && checkSegments(false)) return true;\n return false;\n}\n\n/** Squared distance from (px, py) to the closest point on segment (ax,ay)→(bx,by). */\nfunction pointSegmentDist2(\n px: number, py: number,\n ax: number, ay: number,\n bx: number, by: number,\n): number {\n const dx = bx - ax;\n const dy = by - ay;\n const len2 = dx * dx + dy * dy;\n if (len2 === 0) {\n const ex = px - ax, ey = py - ay;\n return ex * ex + ey * ey;\n }\n let t = ((px - ax) * dx + (py - ay) * dy) / len2;\n if (t < 0) t = 0; else if (t > 1) t = 1;\n const cx = ax + t * dx;\n const cy = ay + t * dy;\n const ex = px - cx, ey = py - cy;\n return ex * ex + ey * ey;\n}\n","/**\n * Fluent builder for `PolygonPath`. Hides the `Uint8Array` / `Float32Array`\n * encoding behind move/line/curve/close calls and a final `build()`. Use\n * this to construct paths in tests and demos; production callers that need\n * to mutate large paths in place should reach for the raw arrays directly.\n *\n * Numeric capacity grows by doubling — typical for amortized O(1) push.\n *\n * Also exposes `rectPath` / `polygonFromPoints` shortcuts for the common\n * cases. `rectPath` returns the lighter `RectPath` subtype, not a polygon.\n */\n\nimport {\n PATH_C,\n PATH_L,\n PATH_M,\n PATH_Q,\n PATH_Z,\n type PathFillRule,\n type PolygonPath,\n type RectPath,\n} from './types';\n\n/** Fluent builder for `PolygonPath`; hides the `Uint8Array`/`Float32Array` encoding behind move/line/curve/close calls. */\nexport class PathBuilder {\n private cmds: number[] = [];\n private xs: number[] = [];\n private fillRule: PathFillRule = 'nonzero';\n\n /** Seed a builder with an existing `PolygonPath`. Useful for extending\n * an in-flight path with another segment (e.g. appending a cubic to\n * the end of a curve in response to a user action) without hand-\n * reaching into the `commands` / `coords` typed arrays.\n *\n * ```ts\n * const next = PathBuilder.fromPath(current).curveTo(...).build();\n * ```\n */\n static fromPath(path: PolygonPath): PathBuilder {\n const b = new PathBuilder();\n b.cmds = Array.from(path.commands);\n b.xs = Array.from(path.coords);\n b.fillRule = path.fillRule;\n return b;\n }\n\n setFillRule(rule: PathFillRule): this {\n this.fillRule = rule;\n return this;\n }\n\n moveTo(x: number, y: number): this {\n this.cmds.push(PATH_M);\n this.xs.push(x, y);\n return this;\n }\n\n lineTo(x: number, y: number): this {\n this.cmds.push(PATH_L);\n this.xs.push(x, y);\n return this;\n }\n\n /** Cubic bezier to (x, y) with control points (x1, y1) and (x2, y2). */\n curveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): this {\n this.cmds.push(PATH_C);\n this.xs.push(x1, y1, x2, y2, x, y);\n return this;\n }\n\n /** Quadratic bezier to (x, y) with control point (x1, y1). */\n quadTo(x1: number, y1: number, x: number, y: number): this {\n this.cmds.push(PATH_Q);\n this.xs.push(x1, y1, x, y);\n return this;\n }\n\n close(): this {\n this.cmds.push(PATH_Z);\n return this;\n }\n\n build(): PolygonPath {\n return {\n kind: 'polygon',\n commands: new Uint8Array(this.cmds),\n coords: new Float32Array(this.xs),\n fillRule: this.fillRule,\n };\n }\n}\n\n/** Construct a `RectPath` (the fast-path subtype). */\nexport function rectPath(x: number, y: number, width: number, height: number): RectPath {\n return { kind: 'rect', x, y, width, height };\n}\n\n/** Build a closed polygon from a flat list of points. */\nexport function polygonFromPoints(\n points: readonly { x: number; y: number }[],\n opts: { fillRule?: PathFillRule } = {},\n): PolygonPath {\n if (points.length === 0) {\n return {\n kind: 'polygon',\n commands: new Uint8Array(),\n coords: new Float32Array(),\n fillRule: opts.fillRule ?? 'nonzero',\n };\n }\n const b = new PathBuilder();\n if (opts.fillRule) b.setFillRule(opts.fillRule);\n b.moveTo(points[0].x, points[0].y);\n for (let i = 1; i < points.length; i++) b.lineTo(points[i].x, points[i].y);\n b.close();\n return b.build();\n}\n\n/** Cubic-Bezier kappa for circular-quadrant approximation (<1% max error). */\nconst ELLIPSE_KAPPA = 0.5522847498307936;\n\n/** Closed ellipse inscribed in `bounds`, as a 4-cubic-Bezier `PolygonPath`.\n * Matches the geometry `useEllipseTool`'s overlay paints. */\nexport function ellipsePath(\n bounds: { x: number; y: number; width: number; height: number },\n): PolygonPath {\n const cx = bounds.x + bounds.width / 2;\n const cy = bounds.y + bounds.height / 2;\n const rx = bounds.width / 2;\n const ry = bounds.height / 2;\n const ox = rx * ELLIPSE_KAPPA;\n const oy = ry * ELLIPSE_KAPPA;\n const b = new PathBuilder();\n b.moveTo(cx + rx, cy);\n b.curveTo(cx + rx, cy + oy, cx + ox, cy + ry, cx, cy + ry);\n b.curveTo(cx - ox, cy + ry, cx - rx, cy + oy, cx - rx, cy);\n b.curveTo(cx - rx, cy - oy, cx - ox, cy - ry, cx, cy - ry);\n b.curveTo(cx + ox, cy - ry, cx + rx, cy - oy, cx + rx, cy);\n b.close();\n return b.build();\n}\n\n/** Closed regular n-gon centered at `center`, circumscribed by `radius`.\n * `rotation` is in radians; default 0 puts the first vertex on the +x axis. */\nexport function regularPolygonPath(\n center: { x: number; y: number },\n radius: number,\n sides: number,\n rotation = 0,\n): PolygonPath {\n const b = new PathBuilder();\n for (let i = 0; i < sides; i++) {\n const a = rotation + (i / sides) * Math.PI * 2;\n const x = center.x + radius * Math.cos(a);\n const y = center.y + radius * Math.sin(a);\n if (i === 0) b.moveTo(x, y); else b.lineTo(x, y);\n }\n b.close();\n return b.build();\n}\n\n/** Closed n-pointed star centered at `center`, alternating `outerRadius` and\n * `innerRadius` (default `outerRadius / 2`). `rotation` is in radians. */\nexport function starPath(\n center: { x: number; y: number },\n outerRadius: number,\n points = 5,\n innerRadius: number = outerRadius / 2,\n rotation = 0,\n): PolygonPath {\n const b = new PathBuilder();\n const n = points * 2;\n for (let i = 0; i < n; i++) {\n const a = rotation + (i / n) * Math.PI * 2;\n const r = i % 2 === 0 ? outerRadius : innerRadius;\n const x = center.x + r * Math.cos(a);\n const y = center.y + r * Math.sin(a);\n if (i === 0) b.moveTo(x, y); else b.lineTo(x, y);\n }\n b.close();\n return b.build();\n}\n\n/** Open 2-vertex polyline from `a` to `b` — strokeable, not fillable. */\nexport function linePath(\n a: { x: number; y: number },\n b: { x: number; y: number },\n): PolygonPath {\n const pb = new PathBuilder();\n pb.moveTo(a.x, a.y);\n pb.lineTo(b.x, b.y);\n return pb.build();\n}\n","import { type Mat3, transformCoords } from '@weasel-js/geom';\nimport { PathBuilder } from './builder';\nimport { type Path, type PolygonPath } from './types';\n\n/** Apply an affine `Mat3` to a path's geometry.\n *\n * Axis-aligned maps (no rotation/shear, i.e. `m[1] === 0 && m[2] === 0`) keep a\n * `RectPath` a rect — the four corners stay axis-aligned, so we transform the\n * two diagonal corners and normalize negative extent (mirror). Rotation or\n * shear promotes the rect's four corners to a `PolygonPath`. Polygon paths map\n * every coord via the kernel's `transformCoords`, preserving the command stream\n * and `fillRule`. Never mutates the input.\n *\n * `Mat3` here is the 6-tuple `number[]` from `@weasel-js/geom` (DOMMatrix order:\n * `[a, b, c, d, e, f]` where `x' = a·x + c·y + e`, `y' = b·x + d·y + f`),\n * not the renderer's 9-element `Float32Array`. */\nexport function transformPath(path: Path, m: Mat3): Path {\n const [a, b, c, d, e, f] = m;\n if (path.kind === 'rect') {\n if (b === 0 && c === 0) {\n // Pure scale + translate — corners remain axis-aligned.\n const x0 = a * path.x + e;\n const y0 = d * path.y + f;\n const x1 = a * (path.x + path.width) + e;\n const y1 = d * (path.y + path.height) + f;\n return {\n kind: 'rect',\n x: Math.min(x0, x1),\n y: Math.min(y0, y1),\n width: Math.abs(x1 - x0),\n height: Math.abs(y1 - y0),\n };\n }\n // Rotation / shear — promote to polygon with the four rect corners.\n const poly = new PathBuilder()\n .moveTo(path.x, path.y)\n .lineTo(path.x + path.width, path.y)\n .lineTo(path.x + path.width, path.y + path.height)\n .lineTo(path.x, path.y + path.height)\n .close()\n .build();\n return transformPolygon(poly, m);\n }\n return transformPolygon(path, m);\n}\n\nfunction transformPolygon(path: PolygonPath, m: Mat3): PolygonPath {\n // transformCoords returns Float64Array; PolygonPath.coords is Float32Array.\n const mapped = transformCoords(path.coords, m);\n return { ...path, coords: Float32Array.from(mapped) };\n}\n","/**\n * In-place and copy-out path transforms. Translation is the most common —\n * called every pointermove during a drag — so the polygon variant mutates\n * the float buffer directly to keep allocation pressure off the GC.\n *\n * `scalePathToBounds` is for the resize interaction: given the path's\n * current AABB and the desired new AABB, scales every coordinate\n * proportionally. Degenerate source bounds (zero width/height) collapse\n * the corresponding axis to the new origin — preferable to dividing by\n * zero or refusing to resize.\n */\n\nimport { boxToBox } from '@weasel-js/geom';\nimport { boundsOfPath } from './bounds';\nimport { transformPath } from './transformPath';\nimport { PATH_C, PATH_L, PATH_M, PATH_Q, PATH_Z, type Path, type PolygonPath, type RectPath } from './types';\n\n/**\n * Translate a path by (dx, dy). Returns a new instance — the kit's pose\n * model treats poses as immutable to keep React state-update semantics\n * predictable. Polygon coords are copied into a fresh `Float32Array`.\n */\nexport function translatePath(path: Path, dx: number, dy: number): Path {\n if (path.kind === 'rect') {\n return { kind: 'rect', x: path.x + dx, y: path.y + dy, width: path.width, height: path.height };\n }\n return translatePolygonCopy(path, dx, dy);\n}\n\nfunction translatePolygonCopy(path: PolygonPath, dx: number, dy: number): PolygonPath {\n const next = new Float32Array(path.coords.length);\n const { commands, coords } = path;\n let ci = 0;\n for (let i = 0; i < commands.length; i++) {\n const len = COORD_COUNT[commands[i]];\n for (let k = 0; k < len; k += 2) {\n next[ci + k] = coords[ci + k] + dx;\n next[ci + k + 1] = coords[ci + k + 1] + dy;\n }\n ci += len;\n }\n return { kind: 'polygon', commands: path.commands, coords: next, fillRule: path.fillRule };\n}\n\n/**\n * Translate a polygon path's coords *in place*. Returns the same\n * `PolygonPath` reference. Use only for transient overlay buffers — never\n * for committed scene state, which must remain immutable for React.\n */\nexport function translatePolygonInPlace(path: PolygonPath, dx: number, dy: number): PolygonPath {\n const { commands, coords } = path;\n let ci = 0;\n for (let i = 0; i < commands.length; i++) {\n const len = COORD_COUNT[commands[i]];\n for (let k = 0; k < len; k += 2) {\n coords[ci + k] += dx;\n coords[ci + k + 1] += dy;\n }\n ci += len;\n }\n return path;\n}\n\n/**\n * Scale a path's coords so its current AABB maps to `target`. Resize\n * interactions use this to make a polygon follow a corner-handle drag.\n *\n * Degenerate source axes (width or height == 0) collapse to `target.x` /\n * `target.y` — every coord on that axis becomes the new origin. Avoids\n * division by zero without throwing.\n */\nexport function scalePathToBounds(path: Path, target: RectPath): Path {\n if (path.kind === 'rect') {\n return { kind: 'rect', x: target.x, y: target.y, width: target.width, height: target.height };\n }\n const src = boundsOfPath(path);\n return scalePolygon(path, src, target);\n}\n\nfunction scalePolygon(path: PolygonPath, src: RectPath, dst: RectPath): PolygonPath {\n const m = boxToBox(src.x, src.y, src.width, src.height, dst.x, dst.y, dst.width, dst.height);\n // src/dst are axis-aligned, so the polygon stays a polygon after this pure scale+translate.\n return transformPath(path, m) as PolygonPath;\n}\n\nconst COORD_COUNT: Readonly<Record<number, number>> = {\n [PATH_M]: 2,\n [PATH_L]: 2,\n [PATH_C]: 6,\n [PATH_Q]: 4,\n [PATH_Z]: 0,\n};\n","import type { ResizePose, RotatedPose } from '../../gestures/types';\n\n/**\n * Bridges arbitrary `TPose` shapes into the resize hook's bounds-driven math.\n * The hook reads bounds via `getBounds`, runs anchor-relative math on those\n * bounds, then asks `remapBounds` to project the result back into TPose.\n *\n * `remapBounds(pose, src, dst)` is a single operation that subsumes both\n * \"set my own AABB to dst\" (single-leaf resize) and \"scale me as a leaf\n * inside parent's src→dst rect\" (group resize) — they're the same affine\n * map. For rect-shaped poses the default geometry interprets the pose as\n * its own bounds; for Path or polygon poses the consumer supplies a\n * projection that knows how to read and rewrite the underlying geometry.\n */\nexport interface PoseProjection<TPose> {\n getBounds(pose: TPose): ResizePose;\n remapBounds(pose: TPose, src: ResizePose, dst: ResizePose): TPose;\n /** Translate the pose by (dx, dy). Optional — when omitted, callers fall\n * back to a translation derived from `remapBounds` (origin shifted, no\n * scale). Path-shaped poses should provide this for performance. */\n translate?(pose: TPose, dx: number, dy: number): TPose;\n /** True iff any portion of the pose's geometry intersects `rect`. Optional\n * — when omitted, area-select and similar callers test against `getBounds`\n * AABB (looser, but correct for axis-aligned rect poses). */\n intersectsRect?(pose: TPose, rect: ResizePose): boolean;\n /** Interpolate between two poses. Optional — animation helpers fall back to\n * rect-shape lerp when omitted (which fails for non-rect poses). */\n lerp?(a: TPose, b: TPose, t: number): TPose;\n /** Read the pose's rotation in radians. Pivot is the AABB center\n * (`getBounds(pose)` center). Default 0 when omitted — descriptor\n * declares \"this pose has no rotation.\" When supplied and non-zero,\n * `useResize` projects the drag delta into the leaf's local frame,\n * runs anchor math there, and translates the resulting pose so the\n * diagonally opposite world-space corner is pinned. */\n getRotation?(pose: TPose): number;\n /** True iff this pose shape can carry a rotation. Consulted by the\n * rotation affordance to decide whether to render the rotate cursor /\n * drag-band over a selection. When omitted, the kit assumes `true` for\n * back-compat — descriptors whose poses lack `x/y/width/height/rotation`\n * fields (e.g. polygon Paths) should return `false` so the affordance\n * hides instead of exposing a non-functional rotate cursor. */\n supportsRotation?(pose: TPose): boolean;\n}\n\n/** AABB-vs-AABB overlap. Exported for callers building a default\n * `intersectsRect` from `getBounds`. */\nexport function aabbIntersectsRect(b: ResizePose, r: ResizePose): boolean {\n return b.x < r.x + r.width && b.x + b.width > r.x && b.y < r.y + r.height && b.y + b.height > r.y;\n}\n\n/** Identity geometry for `TPose extends ResizePose`. Treats the pose as its\n * own bounds and remaps via affine scale against `src`/`dst`. */\nexport const RECT_POSE_DESCRIPTOR: PoseProjection<ResizePose> = {\n getBounds: (p) => p,\n remapBounds: (p, src, dst) => {\n const sx = src.width === 0 ? 1 : dst.width / src.width;\n const sy = src.height === 0 ? 1 : dst.height / src.height;\n return {\n ...p,\n x: dst.x + (p.x - src.x) * sx,\n y: dst.y + (p.y - src.y) * sy,\n width: p.width * sx,\n height: p.height * sy,\n };\n },\n translate: (p, dx, dy) => ({ ...p, x: p.x + dx, y: p.y + dy }),\n intersectsRect: (p, r) => aabbIntersectsRect(p, r),\n lerp: (a, b, t) => ({\n ...a,\n x: a.x + (b.x - a.x) * t,\n y: a.y + (b.y - a.y) * t,\n width: a.width + (b.width - a.width) * t,\n height: a.height + (b.height - a.height) * t,\n }),\n};\n\n/** Identity geometry for `RotatedPose`. Inherits rect-shape projection\n * from `RECT_POSE_DESCRIPTOR` (the `RotatedPose extends ResizePose`\n * subtype lets the rect descriptor's methods apply directly; `remapBounds`\n * preserves the `rotation` field via `...p` spread). Adds `getRotation` so\n * `useResize` knows to take the rotation-aware math path. */\nexport const ROTATED_POSE_DESCRIPTOR: PoseProjection<RotatedPose> = {\n getBounds: RECT_POSE_DESCRIPTOR.getBounds as PoseProjection<RotatedPose>['getBounds'],\n remapBounds: RECT_POSE_DESCRIPTOR.remapBounds as PoseProjection<RotatedPose>['remapBounds'],\n translate: RECT_POSE_DESCRIPTOR.translate as PoseProjection<RotatedPose>['translate'],\n intersectsRect: RECT_POSE_DESCRIPTOR.intersectsRect as PoseProjection<RotatedPose>['intersectsRect'],\n lerp: RECT_POSE_DESCRIPTOR.lerp as PoseProjection<RotatedPose>['lerp'],\n getRotation: (p) => p.rotation,\n};\n","import { boundsOfPath } from './bounds';\nimport { pointInPath } from './hitTest';\nimport { translatePath } from './transform';\nimport { PATH_C, PATH_L, PATH_M, PATH_Q, PATH_Z, type Path, type PolygonPath } from './types';\nimport { aabbIntersectsRect, type PoseProjection } from 'interactions/actions/resize/geometry';\nimport type { ResizePose } from 'interactions/gestures/types';\n\n/**\n * `PoseProjection` for `Path` poses — wires `useResize` to operate\n * on `Path` directly. `getBounds` defers to the same `boundsOfPath` kernel\n * the rest of the kit uses; `remapBounds` does an affine scale of every\n * coord against `src`/`dst`. Degenerate axes (zero src extent) collapse to\n * the new origin so resize from a flat edge doesn't produce NaN.\n *\n * Mirrors `scalePathToBounds` but takes `src` explicitly: the resize hook\n * knows the group's origin AABB and uses it for every leaf, instead of\n * each leaf scaling against its own AABB (which would ignore group context).\n */\nexport const pathPoseDescriptor: PoseProjection<Path> = {\n getBounds: (path) => boundsOfPath(path),\n remapBounds: (path, src, dst) => {\n const sx = src.width === 0 ? 0 : dst.width / src.width;\n const sy = src.height === 0 ? 0 : dst.height / src.height;\n if (path.kind === 'rect') {\n return {\n kind: 'rect',\n x: dst.x + (path.x - src.x) * sx,\n y: dst.y + (path.y - src.y) * sy,\n width: path.width * sx,\n height: path.height * sy,\n };\n }\n return remapPolygon(path, src, dst, sx, sy);\n },\n translate: (path, dx, dy) => translatePath(path, dx, dy),\n // WHY: AABB pre-test is cheap; only fall through to per-corner pointInPath\n // when the rect is fully inside the AABB (silhouette test).\n intersectsRect: (path, rect) => {\n const b = boundsOfPath(path);\n if (!aabbIntersectsRect(b, rect)) return false;\n if (path.kind === 'rect') return true;\n // Sample the rect's four corners; any inside the polygon ⇒ overlap.\n if (\n pointInPath(path, rect.x, rect.y) ||\n pointInPath(path, rect.x + rect.width, rect.y) ||\n pointInPath(path, rect.x, rect.y + rect.height) ||\n pointInPath(path, rect.x + rect.width, rect.y + rect.height)\n ) return true;\n // Conservative fallback: AABB overlap counts. Tighter edge-vs-edge test\n // would be the next step; defer until a demo demands it.\n return true;\n },\n lerp: (a, b, t) => {\n if (a.kind === 'rect' && b.kind === 'rect') {\n return {\n kind: 'rect',\n x: a.x + (b.x - a.x) * t,\n y: a.y + (b.y - a.y) * t,\n width: a.width + (b.width - a.width) * t,\n height: a.height + (b.height - a.height) * t,\n };\n }\n if (a.kind === 'polygon' && b.kind === 'polygon' && a.coords.length === b.coords.length) {\n const next = new Float32Array(a.coords.length);\n for (let i = 0; i < a.coords.length; i++) {\n next[i] = a.coords[i] + (b.coords[i] - a.coords[i]) * t;\n }\n return { kind: 'polygon', commands: a.commands, coords: next, fillRule: a.fillRule };\n }\n throw new Error('pathPoseDescriptor.lerp: incompatible path shapes');\n },\n // Path poses carry no x/y/width/height/rotation fields — the kit's\n // `wrapWithPoseRotation` helper has nothing to bind a rotation to, and\n // `remapBounds` would drop a synthetic rotation field on every commit.\n // Returning false here hides the rotation affordance for Path consumers\n // so the rotate cursor doesn't appear without a working interaction.\n supportsRotation: () => false,\n};\n\nfunction remapPolygon(path: PolygonPath, src: ResizePose, dst: ResizePose, sx: number, sy: number): PolygonPath {\n const next = new Float32Array(path.coords.length);\n const { commands, coords } = path;\n let ci = 0;\n for (let i = 0; i < commands.length; i++) {\n const len = COORD_COUNT[commands[i]];\n for (let k = 0; k < len; k += 2) {\n next[ci + k] = dst.x + (coords[ci + k] - src.x) * sx;\n next[ci + k + 1] = dst.y + (coords[ci + k + 1] - src.y) * sy;\n }\n ci += len;\n }\n return { kind: 'polygon', commands: path.commands, coords: next, fillRule: path.fillRule };\n}\n\nconst COORD_COUNT: Readonly<Record<number, number>> = {\n [PATH_M]: 2,\n [PATH_L]: 2,\n [PATH_C]: 6,\n [PATH_Q]: 4,\n [PATH_Z]: 0,\n};\n","import type { Path } from 'features/paths/types';\nimport { pathPoseDescriptor } from 'features/paths/poseDescriptor';\nimport { RECT_POSE_DESCRIPTOR, type PoseProjection } from './geometry';\n\n/** True for Path-shaped poses (`{kind: 'polygon' | 'rect'}`). Useful for\n * callers that need to fork between `pathPoseDescriptor` and\n * `RECT_POSE_DESCRIPTOR` without forcing the consumer to wire `geometry`\n * explicitly. */\nexport function isPathLike(p: unknown): p is Path {\n return !!p && typeof p === 'object' && 'kind' in p\n && ((p as { kind: unknown }).kind === 'polygon' || (p as { kind: unknown }).kind === 'rect');\n}\n\n/** Per-call dispatch: if the pose looks like a Path, route to\n * `pathPoseDescriptor`; otherwise treat as a plain rect pose. Avoids forcing\n * demos with Path TPose to wire `geometry={pathPoseDescriptor}` explicitly.\n * `getRotation` surfaces a `pose.rotation` field on non-Path poses so demos\n * using rect-with-rotation shapes (e.g. `RotatedPose`) don't have to wire\n * `geometry={ROTATED_POSE_DESCRIPTOR}` just to get rotated selection chrome\n * and rotation-aware corner hit-tests. */\nexport const AUTO_POSE_DESCRIPTOR: PoseProjection<unknown> = {\n getBounds: (p) => isPathLike(p)\n ? pathPoseDescriptor.getBounds(p)\n : RECT_POSE_DESCRIPTOR.getBounds(p as { x: number; y: number; width: number; height: number }),\n remapBounds: (p, src, dst) => isPathLike(p)\n ? pathPoseDescriptor.remapBounds(p, src, dst)\n : RECT_POSE_DESCRIPTOR.remapBounds(p as { x: number; y: number; width: number; height: number }, src, dst),\n translate: (p, dx, dy) => isPathLike(p)\n ? pathPoseDescriptor.translate!(p, dx, dy)\n : RECT_POSE_DESCRIPTOR.translate!(p as { x: number; y: number; width: number; height: number }, dx, dy),\n intersectsRect: (p, rect) => isPathLike(p)\n ? pathPoseDescriptor.intersectsRect!(p, rect)\n : RECT_POSE_DESCRIPTOR.intersectsRect!(p as { x: number; y: number; width: number; height: number }, rect),\n getRotation: (p) => {\n if (isPathLike(p)) return 0;\n const r = (p as { rotation?: unknown }).rotation;\n return typeof r === 'number' ? r : 0;\n },\n // Path-shaped poses can't carry rotation (see `pathPoseDescriptor`).\n // Everything else flows through `wrapWithPoseRotation`'s x/y/w/h gate at\n // paint time, so report `true` and let the wrapper no-op for poses\n // missing AABB fields.\n supportsRotation: (p) => !isPathLike(p),\n};\n","import type { SnapStrategy } from '../../types';\nimport { resolveUnit, type UnitSystem, type UnitValue } from 'core/units';\nimport type { DebugSink } from '../../../../debug/types';\nimport { isPathLike } from 'interactions/actions/resize/autoPoseDescriptor';\nimport { boundsOfPath } from 'features/paths/bounds';\nimport { translatePath } from 'features/paths/transform';\nimport type { Path } from 'features/paths/types';\n\n/**\n * Projection used by `gridSnapStrategy` when `TPose` doesn't expose `{x,y}`\n * directly (Path, polygon, etc.). The strategy reads the snap point via\n * `getOrigin`, rounds it to the grid, then asks `translate` to move the\n * pose by the resulting delta.\n */\nexport interface OriginProjection<TPose> {\n getOrigin(pose: TPose): { x: number; y: number };\n translate(pose: TPose, dx: number, dy: number): TPose;\n}\n\n/** Identity projection for `TPose extends { x; y }`. */\nexport const RECT_ORIGIN_PROJECTION: OriginProjection<{ x: number; y: number }> = {\n getOrigin: (p) => ({ x: p.x, y: p.y }),\n translate: (p, dx, dy) => ({ ...p, x: p.x + dx, y: p.y + dy }),\n};\n\n/** Per-call dispatch: routes Path-shaped poses to the path origin/translate\n * helpers and everything else to `RECT_ORIGIN_PROJECTION`. Default for\n * `gridSnapStrategy` so consumers with Path TPose don't have to thread\n * `pathOriginProjection` explicitly. */\nexport const AUTO_ORIGIN_PROJECTION: OriginProjection<unknown> = {\n getOrigin: (p) => {\n if (isPathLike(p)) {\n const b = boundsOfPath(p as Path);\n return { x: b.x, y: b.y };\n }\n const r = p as { x: number; y: number };\n return { x: r.x, y: r.y };\n },\n translate: (p, dx, dy) => {\n if (isPathLike(p)) return translatePath(p as Path, dx, dy);\n const r = p as { x: number; y: number };\n return { ...r, x: r.x + dx, y: r.y + dy };\n },\n};\n\n/** Snap-strategy that rounds the pose's origin to the nearest multiple of\n * `spacing` (resolved through `unitSystem`). For non-rect TPose pass an\n * `OriginProjection` so the strategy knows how to read/write the origin. */\nexport function gridSnapStrategy<TPose>(\n spacing: UnitValue,\n unitSystem?: UnitSystem,\n): SnapStrategy<TPose>;\nexport function gridSnapStrategy<TPose>(\n spacing: UnitValue,\n opts: { unitSystem?: UnitSystem; debug?: DebugSink },\n): SnapStrategy<TPose>;\nexport function gridSnapStrategy<TPose>(\n spacing: UnitValue,\n opts: { unitSystem?: UnitSystem; origin: OriginProjection<TPose>; debug?: DebugSink },\n): SnapStrategy<TPose>;\n/** Snap-strategy that rounds the pose's origin to the nearest multiple of\n * `spacing` (resolved through `unitSystem`). For non-rect TPose pass an\n * `OriginProjection` so the strategy knows how to read/write the origin. */\nexport function gridSnapStrategy<TPose>(\n spacing: UnitValue,\n arg?: UnitSystem | { unitSystem?: UnitSystem; origin?: OriginProjection<TPose>; debug?: DebugSink },\n): SnapStrategy<TPose> {\n const isOpts =\n typeof arg === 'object' &&\n arg !== null &&\n ('origin' in arg || 'debug' in arg || 'unitSystem' in arg) &&\n !('base' in arg);\n const optsArg = isOpts\n ? (arg as { unitSystem?: UnitSystem; origin?: OriginProjection<TPose>; debug?: DebugSink })\n : null;\n const unitSystem = optsArg ? optsArg.unitSystem : (arg as UnitSystem | undefined);\n const proj: OriginProjection<TPose> = optsArg && optsArg.origin\n ? optsArg.origin\n : (AUTO_ORIGIN_PROJECTION as unknown as OriginProjection<TPose>);\n const debug: DebugSink | undefined = optsArg ? optsArg.debug : undefined;\n const c = resolveUnit(spacing, unitSystem);\n return {\n snap(pose) {\n const o = proj.getOrigin(pose);\n const sx = Math.round(o.x / c) * c;\n const sy = Math.round(o.y / c) * c;\n debug?.recordSnapCandidate({ x: sx, y: sy }, true);\n return proj.translate(pose, sx - o.x, sy - o.y);\n },\n };\n}\n\n/**\n * Compute the integer cell `{col, row}` that contains `point`, given a grid\n * `spacing` and optional `origin` and `unitSystem`. Pair with\n * `createCellHighlightLayer` (its `getCell` callback) to draw a snap-target\n * preview that uses the same spacing as `gridSnapStrategy` — so the visual\n * and behavioral grids stay in lockstep:\n *\n * const SPACING = 20;\n * const snap = gridSnapStrategy(SPACING);\n * // visual grid:\n * createGridLayer({ spacing: SPACING, bounds: () => ... });\n * // hover-preview overlay:\n * createCellHighlightLayer({\n * spacing: SPACING,\n * getCell: () => hoverPoint && pointToGridCell(hoverPoint, SPACING),\n * });\n */\nexport function pointToGridCell(\n point: { x: number; y: number },\n spacing: UnitValue,\n unitSystem?: UnitSystem,\n origin: { x: number; y: number } = { x: 0, y: 0 },\n): { col: number; row: number } {\n const s = resolveUnit(spacing, unitSystem);\n return {\n col: Math.floor((point.x - origin.x) / s),\n row: Math.floor((point.y - origin.y) / s),\n };\n}\n","/**\n * Geometric mean of a per-axis scale. Used as a scalar fallback for chrome\n * hit-test radii and hairline stroke widths under non-uniform zoom.\n * Degenerates to `s.x` (or `s.y`) when the two axes are equal; otherwise\n * sits between them.\n *\n * Under non-uniform zoom a circular screen-pixel hit region projects to\n * an ellipse in world space (and vice versa). The geometric-mean\n * approximation is intentionally a v1 fallback — proper axis-aware\n * elliptical hit shapes are a future follow-up.\n */\nexport function meanScale(s: { x: number; y: number }): number {\n return Math.sqrt(s.x * s.y);\n}\n","import type { SnapStrategy } from '../../types';\nimport type { Guide } from 'features/guides/types';\nimport type { View } from 'core/viewport/view';\nimport { meanScale } from 'core/viewport/meanScale';\nimport type { OriginProjection } from './grid';\nimport { RECT_ORIGIN_PROJECTION } from './grid';\n\n/** Default snap tolerance (screen pixels). */\nexport const DEFAULT_GUIDE_TOLERANCE_PX = 6;\n\n/** Options for `guideSnapStrategy`. */\nexport interface GuideSnapOptions<TPose> {\n /**\n * Tolerance, in screen pixels (CSS px) when `getView` is provided, or in\n * world units otherwise. Defaults to `DEFAULT_GUIDE_TOLERANCE_PX`.\n */\n tolerance?: number;\n /**\n * Read the active view transform. When supplied, `tolerance` is interpreted\n * in screen pixels and divided by `view.scale` so the trigger zone stays\n * the same on screen as the user zooms in/out. Without it, `tolerance`\n * is treated as world units.\n */\n getView?: () => View;\n /**\n * Projection used when `TPose` doesn't expose `{x, y}` directly (Path,\n * polygon, etc.) — same contract as `gridSnapStrategy`. Defaults to the\n * rect-pose identity projection.\n */\n origin?: OriginProjection<TPose>;\n}\n\n/**\n * Snap-strategy that snaps the pose's origin to the nearest guide line on\n * each axis when within tolerance. Each axis is considered independently:\n * a vertical guide (`axis: 'x'`) constrains X, a horizontal guide\n * (`axis: 'y'`) constrains Y. When multiple guides are within range on the\n * same axis, the closest wins.\n *\n * Pair with `useGuides` for storage and `createGuidesLayer` for rendering.\n *\n * **Composition:** combining with `gridSnapStrategy` is left to the\n * consumer in v1 — typically by picking one based on a modifier key, or\n * by stacking two move/resize/insert behaviors in priority order.\n */\nexport function guideSnapStrategy<TPose extends { x: number; y: number }>(\n getGuides: () => readonly Guide[],\n options?: Omit<GuideSnapOptions<TPose>, 'origin'>,\n): SnapStrategy<TPose>;\nexport function guideSnapStrategy<TPose>(\n getGuides: () => readonly Guide[],\n options: GuideSnapOptions<TPose> & { origin: OriginProjection<TPose> },\n): SnapStrategy<TPose>;\nexport function guideSnapStrategy<TPose>(\n getGuides: () => readonly Guide[],\n options: GuideSnapOptions<TPose> = {},\n): SnapStrategy<TPose> {\n const tolerance = options.tolerance ?? DEFAULT_GUIDE_TOLERANCE_PX;\n const getView = options.getView;\n const proj: OriginProjection<TPose> =\n options.origin ?? (RECT_ORIGIN_PROJECTION as unknown as OriginProjection<TPose>);\n\n return {\n snap(pose) {\n const guides = getGuides();\n if (guides.length === 0) return null;\n\n // Convert tolerance to world units. With no view, treat tolerance as\n // already-world. With a view, divide by scale (px / (px/world) = world).\n const worldTolerance = getView\n ? tolerance / Math.max(1e-9, meanScale(getView().scale))\n : tolerance;\n\n const o = proj.getOrigin(pose);\n\n let bestDx = 0;\n let bestAbsDx = Infinity;\n let bestDy = 0;\n let bestAbsDy = Infinity;\n\n for (const g of guides) {\n if (g.axis === 'x') {\n const d = g.offset - o.x;\n const ad = Math.abs(d);\n if (ad <= worldTolerance && ad < bestAbsDx) {\n bestAbsDx = ad;\n bestDx = d;\n }\n } else {\n const d = g.offset - o.y;\n const ad = Math.abs(d);\n if (ad <= worldTolerance && ad < bestAbsDy) {\n bestAbsDy = ad;\n bestDy = d;\n }\n }\n }\n\n if (bestAbsDx === Infinity && bestAbsDy === Infinity) return null;\n const dx = bestAbsDx === Infinity ? 0 : bestDx;\n const dy = bestAbsDy === Infinity ? 0 : bestDy;\n if (dx === 0 && dy === 0) return null;\n return proj.translate(pose, dx, dy);\n },\n };\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { N as NodeId } from './types-Cpb4hii1.js';
1
+ import { N as NodeId } from './types-DUpI7Apc.js';
2
2
  import { C as ClipboardSnapshot, I as InsertAdapter } from './types-B_-khFM0.js';
3
3
  import '@weasel-js/history';
4
- import './types-B6MMiodD.js';
4
+ import './path-B6MMiodD.js';
5
5
 
6
6
  type Replacer$1 = (key: string, value: unknown) => unknown;
7
7
  /** Options for `useClipboardOps`. */
package/dist/clone.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as CloneBehavior } from './types-Dcaa0tPq.js';
1
+ import { C as CloneBehavior } from './types-BhJJ2OCM.js';
2
2
  import '@weasel-js/history';
3
3
  import './types-B_-khFM0.js';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { V as View } from './view-DSQgxBJB.js';
2
- import { R as ResizePose, a as RotatedPose } from './types-Dcaa0tPq.js';
2
+ import { R as ResizePose, a as RotatedPose } from './types-BhJJ2OCM.js';
3
3
 
4
4
  /**
5
5
  * Axis-aligned rectangle in world space. Kit-wide `Bounds` shape used by
@@ -1,4 +1,4 @@
1
- import { b as MoveBehavior, S as SnapStrategy } from './types-Dcaa0tPq.js';
1
+ import { b as MoveBehavior, S as SnapStrategy } from './types-BhJJ2OCM.js';
2
2
  import { D as DebugSink } from './types-BJ8_cyT7.js';
3
3
 
4
4
  /**
@@ -1,16 +1,16 @@
1
- import { N as NodeId, S as Scene, P as PoseComposition } from './types-Cpb4hii1.js';
2
- import { M as ModifierState, A as ActionBehavior, c as ResizeAnchor, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior } from './types-Dcaa0tPq.js';
1
+ import { N as NodeId, R as RectPose, S as Scene } from './types-DUpI7Apc.js';
2
+ import { M as ModifierState, A as ActionBehavior, c as ResizeAnchor, R as ResizePose, B as BoundsConstraint, P as PointSnapBehavior } from './types-BhJJ2OCM.js';
3
3
  import { V as View } from './view-DSQgxBJB.js';
4
4
  import { CapabilityTag } from '@weasel-js/modes';
5
5
  import * as React from 'react';
6
6
  import { MutableRefObject, ReactNode, ReactElement } from 'react';
7
7
  import { IngestItem, GestureSpec, InputEvent, ParsedModifiers, GestureName, ChannelRef, DescribeRouteOptions, GESTURE_DESCRIPTORS, GestureArgSpec, GestureDescriptor, ModRequirement, ModifierKey, ParsedRoute, PhaseAtom, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, RouteDescriptionPart, RouteFieldName, RouteTermLabel, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute } from '@weasel-js/gestures';
8
- import { F as FillStyle, a as Stroke, D as DrawCommand } from './DrawCommand-CJtqqt8H.js';
8
+ import { F as FillStyle, a as Stroke, D as DrawCommand } from './DrawCommand-BKJ5JPkC.js';
9
9
  import * as react_jsx_runtime from 'react/jsx-runtime';
10
- import { P as Path } from './types-B6MMiodD.js';
10
+ import { P as Path } from './path-B6MMiodD.js';
11
11
  import { Op, History } from '@weasel-js/history';
12
12
  import { L as LayoutStrategy, I as InsertAdapter } from './types-B_-khFM0.js';
13
- import { B as Bounds, P as PoseProjection } from './geometry-D9BDMiQi.js';
13
+ import { B as Bounds, P as PoseProjection } from './geometry-DVeZ2i-c.js';
14
14
  import { Mat3 } from '@weasel-js/geom';
15
15
  import { D as DebugSink } from './types-BJ8_cyT7.js';
16
16
 
@@ -348,6 +348,31 @@ interface RenderLayer<TData> {
348
348
  */
349
349
  declare function drawLayers<TData>(layers: RenderLayer<TData>[], data: TData, visibility: Record<string, boolean>, order: string[] | undefined, view: View | undefined, dims: Dims): DrawCommand[];
350
350
 
351
+ /**
352
+ * Facts about the device the canvas is running on.
353
+ *
354
+ * One object, recomputed when the underlying media queries change, read by
355
+ * two consumers: the chrome-caps rule layer (via `RuleCtx.device`) and the
356
+ * handle-sizing constants (via `targetScale`).
357
+ *
358
+ * Deliberately NOT a form-factor concept. There is no `isPhone` here and
359
+ * there should never be one: chrome layout is the consuming app's decision.
360
+ * The kit's job is to stop assuming a mouse.
361
+ */
362
+ interface DeviceProfile {
363
+ /** `matchMedia('(pointer: coarse)')` — the primary pointer is imprecise. */
364
+ readonly coarsePointer: boolean;
365
+ /** `matchMedia('(hover: hover)')` — the primary pointer can hover. */
366
+ readonly canHover: boolean;
367
+ /** Live device pixel ratio. */
368
+ readonly dpr: number;
369
+ /** Multiplier for handle sizes and hit radii. Derived from
370
+ * `coarsePointer` unless explicitly overridden. */
371
+ readonly targetScale: number;
372
+ }
373
+ /** The detected half of a profile — everything except the derived scale. */
374
+ type DetectedDeviceFacts = Omit<DeviceProfile, 'targetScale'>;
375
+
351
376
  /**
352
377
  * Live state read by rule evaluation. Built once per frame on the consuming
353
378
  * surface — chrome-caps, the affordance pipeline, the dispatcher's
@@ -389,6 +414,13 @@ interface RuleCtx {
389
414
  * with nothing being edited should draw no anchors. Absent is treated
390
415
  * as false. */
391
416
  readonly editingAnchors?: boolean;
417
+ /** Device facts — pointer coarseness, hover capability, density.
418
+ *
419
+ * Absent (legacy ctx builders) is treated as
420
+ * {@link DEFAULT_DEVICE_PROFILE}: a fine pointer that can hover, at
421
+ * density 1. That is what the kit assumed before this field existed, so
422
+ * an absent profile is behavior-preserving by construction. */
423
+ readonly device?: DeviceProfile;
392
424
  }
393
425
  interface BuildRuleCtxArgs {
394
426
  focused: boolean;
@@ -407,6 +439,8 @@ interface BuildRuleCtxArgs {
407
439
  selectionResizable?: boolean;
408
440
  /** Optional — omitted means "no path is being anchor-edited". */
409
441
  editingAnchors?: boolean;
442
+ /** Optional — omitted means {@link DEFAULT_DEVICE_PROFILE}. */
443
+ device?: DeviceProfile;
410
444
  }
411
445
  declare function buildRuleCtx(args: BuildRuleCtxArgs): RuleCtx;
412
446
 
@@ -444,6 +478,12 @@ interface Selector {
444
478
  * (resizable), so `{ resizable: true }` passes for legacy ctx builders
445
479
  * that don't compute it. */
446
480
  resizable?: boolean;
481
+ /** Matches `ctx.device.coarsePointer` — the primary pointer is imprecise
482
+ * (touch, most styluses). Absent device is treated as `false`. */
483
+ coarsePointer?: boolean;
484
+ /** Matches `ctx.device.canHover` — the primary pointer can hover. Absent
485
+ * device is treated as `true`. */
486
+ canHover?: boolean;
447
487
  }
448
488
  /**
449
489
  * Composable visibility/eligibility rule. Trees of `all`/`any`/`not` nodes
@@ -910,6 +950,100 @@ interface OngoingInvoker {
910
950
  * the `Action` type. */
911
951
  type Invoker = ImmediateInvoker | OngoingInvoker;
912
952
 
953
+ /**
954
+ * Pose composition for hierarchical scene graphs.
955
+ *
956
+ * As of the nesting change, `getPose(id)` on adapters returns the
957
+ * **local** pose — relative to the object's direct parent. Anything in the
958
+ * kit that needs to draw, hit-test, snap, or otherwise reason about world
959
+ * coordinates routes through `composeWorldPose`, which walks the parent
960
+ * chain and folds local poses together via a consumer-supplied `compose`.
961
+ *
962
+ * Pose shape is generic, so the compose strategy is too. For the common
963
+ * `{x, y, width, height}` axis-aligned rect, use `composeRectPose` —
964
+ * translation only, child dimensions preserved. Custom pose shapes (paths,
965
+ * matrix transforms) supply their own.
966
+ *
967
+ * The inverse — `rebaseLocalPose` — converts a world-space pose into a
968
+ * local pose under a target parent. Used when reparenting so the visual
969
+ * world position of a child is preserved across the parent change.
970
+ */
971
+ /** Re-exported; the declaration lives in `core/scene/types.ts`, which names
972
+ * it and may not import from features. */
973
+
974
+ /** Minimal adapter needed by `composeWorldPose` and friends — pose lookup plus parent walk. */
975
+ interface PoseAdapter<TPose> {
976
+ getPose(id: string): TPose;
977
+ getParent(id: string): string | null;
978
+ }
979
+ /** Consumer's pose-composition strategy for hierarchical scenes. `compose`
980
+ * folds a child's pose (in parent's frame) up to the next frame; `decompose`
981
+ * is its inverse. Default is IDENTITY — an absolute-pose scene where every
982
+ * node already stores world coords (parent is grouping-only, no transform). */
983
+ interface PoseComposition<TPose> {
984
+ compose: (parent: TPose, child: TPose) => TPose;
985
+ decompose: (parent: TPose, world: TPose) => TPose;
986
+ }
987
+ /** Default pose-composition strategy: IDENTITY. Both `compose` and
988
+ * `decompose` return the child/world pose unchanged, modeling an
989
+ * absolute-pose scene where every node stores world coords and parents are
990
+ * grouping-only (no transform). With this strategy `composeWorldPose`
991
+ * returns a node's own raw pose and `rebaseLocalPose` is a no-op. */
992
+ declare const IDENTITY_POSE_COMPOSITION: PoseComposition<unknown>;
993
+ /**
994
+ * Walk `id`'s parent chain (root first to id last) and fold local poses into
995
+ * a world pose via `compose`. Returns the world pose for `id`. Cycle-safe:
996
+ * a visited-set guard breaks if the chain ever loops back to itself.
997
+ *
998
+ * `compose(parent, child)` interprets `child` as expressed *in `parent`'s
999
+ * local frame* and returns the equivalent pose in the next frame up. For a
1000
+ * standard translation-only rect: `world = { x: p.x + c.x, y: p.y + c.y,
1001
+ * width: c.width, height: c.height }`.
1002
+ */
1003
+ declare function composeWorldPose<TPose>(adapter: PoseAdapter<TPose>, id: string, compose: (parent: TPose, child: TPose) => TPose): TPose;
1004
+ /**
1005
+ * Default `compose` for axis-aligned rectangles. Adds translation; preserves
1006
+ * child width/height. Treat as the canonical compose for any
1007
+ * `{x, y, width, height}` pose under a translation-only hierarchy.
1008
+ *
1009
+ * Generic over the concrete pose type so callers with a wider pose
1010
+ * (e.g. `RectPose & { rotation }`) can pass it through; the extra fields
1011
+ * are taken from the child unchanged.
1012
+ */
1013
+ declare function composeRectPose<TPose extends RectPose>(parent: TPose, child: TPose): TPose;
1014
+ /**
1015
+ * Translate a `RectPose`-shaped pose by `(dx, dy)`. Suitable as the default
1016
+ * `translatePose` for `useMove` when poses carry top-level `x`/`y`. Other
1017
+ * fields (width/height, plus any extra props on `TPose`) are preserved.
1018
+ */
1019
+ declare function translateRectPose<TPose extends RectPose>(pose: TPose, dx: number, dy: number): TPose;
1020
+ /**
1021
+ * Convert `worldPose` into a local pose expressed under `newParentId`'s
1022
+ * frame. Used when reparenting so the child's visual world position is
1023
+ * preserved despite the change of frame. Inverse of one `compose` step.
1024
+ *
1025
+ * `decompose(parent, world)` returns the local pose `child` such that
1026
+ * `compose(parent, child) === world`. For axis-aligned rects:
1027
+ * `child = { ...world, x: world.x - parent.x, y: world.y - parent.y }`.
1028
+ *
1029
+ * Pass `newParentId === null` for the root frame; the function returns
1030
+ * `worldPose` unchanged.
1031
+ */
1032
+ declare function rebaseLocalPose<TPose>(adapter: PoseAdapter<TPose>, worldPose: TPose, newParentId: string | null, compose: (parent: TPose, child: TPose) => TPose, decompose: (parent: TPose, world: TPose) => TPose): TPose;
1033
+ /** Inverse of `composeRectPose` — subtracts parent translation. */
1034
+ declare function decomposeRectPose<TPose extends RectPose>(parent: TPose, world: TPose): TPose;
1035
+ /**
1036
+ * Build a `(id) => world pose | null` callback over a `PoseAdapter`.
1037
+ * Convenience for RenderLayers that take a `getPose` callback (selection
1038
+ * overlays, debug layers, etc.) so consumers don't hand-write a
1039
+ * `composeWorldPose` call per layer.
1040
+ *
1041
+ * Returns `null` when `adapter.getPose` or `adapter.getParent` throws — the
1042
+ * common case is an id removed mid-render between selection state and the
1043
+ * next paint. Layers should treat `null` as "skip this id."
1044
+ */
1045
+ declare function worldPoseLookup<TPose>(adapter: PoseAdapter<TPose>, compose: (parent: TPose, child: TPose) => TPose): (id: string) => TPose | null;
1046
+
913
1047
  /** Boolean op identifiers — five Pathfinder primaries plus Crop. */
914
1048
  type BooleanOp = 'union' | 'intersect' | 'subtract' | 'exclude' | 'divide' | 'crop';
915
1049
  /**
@@ -1320,6 +1454,35 @@ declare const sliceAction: Action & {
1320
1454
  requires: string[];
1321
1455
  };
1322
1456
 
1457
+ /**
1458
+ * Clipboard dep — the imperative surface `useClipboardOps` returns.
1459
+ *
1460
+ * Consumers publish their live clipboard through `useDepSource('clipboard',
1461
+ * …)` from inside the `<DepRegistryProvider>` (i.e. under `<SceneCanvas>`).
1462
+ * The kit deliberately does not build one for them: `useClipboardOps` needs
1463
+ * an adapter and a selection reader that only the consumer can supply.
1464
+ */
1465
+ interface ClipboardDep {
1466
+ copy(): void;
1467
+ paste(): void;
1468
+ isEmpty(): boolean;
1469
+ }
1470
+ /**
1471
+ * @experimental
1472
+ * Static descriptor for the `clipboard.copy` Action (Cmd/Ctrl+C).
1473
+ */
1474
+ declare const clipboardCopyAction: Action & {
1475
+ requires: string[];
1476
+ };
1477
+ /**
1478
+ * @experimental
1479
+ * Static descriptor for the `clipboard.cut` Action (Cmd/Ctrl+X) — copy, then
1480
+ * the same batched delete `deleteAction` performs, as one undo entry.
1481
+ */
1482
+ declare const clipboardCutAction: Action & {
1483
+ requires: string[];
1484
+ };
1485
+
1323
1486
  /** Optional consumer seam: given a node and the affine `m` that a pose-transform
1324
1487
  * action applied to the node's POSE, return updated `data` with the node's
1325
1488
  * data-held geometry transformed by `m`, or `null` if this node has no
@@ -1832,6 +1995,15 @@ interface DepSchema {
1832
1995
  * Optional: when absent, `sliceAction` is a no-op.
1833
1996
  */
1834
1997
  slice?: SliceDep;
1998
+ /**
1999
+ * Clipboard dep — the imperative surface `useClipboardOps` returns.
2000
+ *
2001
+ * Published by the consumer (`useDepSource('clipboard', …)` from under
2002
+ * `<SceneCanvas>`), because `useClipboardOps` needs an adapter and a
2003
+ * selection reader only the consumer has. Feeds `clipboard.copy` /
2004
+ * `clipboard.cut`; both no-op when the dep is absent.
2005
+ */
2006
+ clipboard?: ClipboardDep;
1835
2007
  /**
1836
2008
  * Optional consumer commit hook. When present, `moveAction` (and other
1837
2009
  * default actions) submit their committed ops through it instead of
@@ -2983,4 +3155,4 @@ declare namespace index {
2983
3155
  export { index_ChannelRef as ChannelRef, type index_Conflict as Conflict, index_DescribeRouteOptions as DescribeRouteOptions, index_GESTURE_DESCRIPTORS as GESTURE_DESCRIPTORS, index_GestureArgSpec as GestureArgSpec, index_GestureDescriptor as GestureDescriptor, index_GestureName as GestureName, index_ModRequirement as ModRequirement, index_ModifierKey as ModifierKey, index_PREDICATE_TARGET as PREDICATE_TARGET, index_ParsedModifiers as ParsedModifiers, index_ParsedRoute as ParsedRoute, index_PhaseAtom as PhaseAtom, index_RESERVED_ID_NAMES as RESERVED_ID_NAMES, index_RESERVED_ID_PREFIXES as RESERVED_ID_PREFIXES, index_ROUTE_FIELD_DEFINITIONS as ROUTE_FIELD_DEFINITIONS, index_ROUTE_TERMS as ROUTE_TERMS, type index_RegistryEntry as RegistryEntry, index_RouteDescriptionPart as RouteDescriptionPart, index_RouteFieldName as RouteFieldName, index_RouteTermLabel as RouteTermLabel, type index_ToolDef as ToolDef, type index_ToolKeybinding as ToolKeybinding, type index_ToolScopes as ToolScopes, type index_ViewportToolDef as ViewportToolDef, index_buildRouteRegistry as buildRouteRegistry, index_canonicalModifiers as canonicalModifiers, index_collapseShiftPairs as collapseShiftPairs, index_defineTool as defineTool, index_defineViewportTool as defineViewportTool, index_describeRoute as describeRoute, index_describeRouteParts as describeRouteParts, index_findConflicts as findConflicts, index_findScopedConflicts as findScopedConflicts, index_formatConflict as formatConflict, index_formatPhaseAtom as formatPhaseAtom, index_formatRoute as formatRoute, index_getGestureDescriptor as getGestureDescriptor, index_isKnownGestureName as isKnownGestureName, index_parseRoute as parseRoute, index_reportRouteConflicts as reportRouteConflicts };
2984
3156
  }
2985
3157
 
2986
- export { DepRegistryProvider as $, type Action as A, type BooleansAdapter as B, type Condition as C, type Dims as D, ActiveToolContextProvider as E, ActiveToolContextProviderIfRoot as F, type GeometryProjection as G, type HotkeyTrigger as H, type InsertExtras as I, type ActiveToolContextProviderProps as J, type ActiveToolContextValue as K, type AreaSelectDep as L, type BindingOpts as M, type BindingScope as N, type BooleanOp as O, type BooleanOpResult as P, type BoundGesture as Q, type RenderLayer as R, type SliceDep as S, type Tool as T, type UseSelectionOptions as U, type VisibilityRules as V, type BuildRuleCtxArgs as W, type ClipboardIngestCtx as X, type CustomPaintContext as Y, type DepName as Z, type DepRegistry as _, type Rule as a, type ToolScopes as a$, type DispatcherContext as a0, type DragSample as a1, type EditAnchorsDep as a2, type GestureBinding as a3, type ImmediateInvoker as a4, type IngestCtx as a5, type IngestionDep as a6, type InsertDep as a7, type InvocationCtx as a8, type Invoker as a9, type UiOngoingControl as aA, type ViewApi as aB, applyBooleanOp as aC, buildRuleCtx as aD, createDispatcher as aE, describeRule as aF, drawLayers as aG, enterTextEditAction as aH, evaluate as aI, evaluateEnabled as aJ, registerContentHandler as aK, index as aL, sliceAction as aM, specificity as aN, useAction as aO, useActionsRegistry as aP, useActiveToolContext as aQ, useDepRegistry as aR, useDepSource as aS, useOptionalActiveToolContext as aT, useOptionalDepRegistry as aU, usePointerContext as aV, useSelection as aW, type Conflict as aX, PREDICATE_TARGET as aY, type RegistryEntry as aZ, type ToolDef as a_, type LassoSelectDep as aa, type LayoutDep as ab, type MatchResult as ac, NEVER as ad, type NodeAtPointDep as ae, type OngoingHandle as af, type OngoingInvoker as ag, type OngoingOverlay as ah, type Point2 as ai, PointerContextProvider as aj, type PointerContextValue as ak, type PointerWorldPos as al, type ResizePolicy as am, type ResolveAllOptions as an, type ResolveOnlyResult as ao, type ResolvedCandidate as ap, type ScopedBinding as aq, type SelectionExtendKey as ar, type SelectionMode as as, type Selector as at, type SnapDep as au, type SvgUnpacker as av, type TextEditDep as aw, type ToolModifiers as ax, type ToolPresentation as ay, type ToolSlot as az, type RuleCtx as b, type ViewportToolDef as b0, buildRouteRegistry as b1, defineTool as b2, defineViewportTool as b3, findConflicts as b4, findScopedConflicts as b5, formatConflict as b6, reportRouteConflicts as b7, type ChromeCtx as c, type ChromeId as d, type DepSchema as e, type ActionsRegistry as f, type AffordanceHit as g, type Dispatcher as h, type AnyTool as i, type ToolCtx as j, type ToolKeybinding as k, type AffordanceBinding as l, type ChromeState as m, type SelectionApi as n, type ContentHandlerEntry as o, type SvgIngestOptions as p, type ActionsProp as q, type Affordance as r, type AffordanceRegion as s, type CommonAffordanceScratch as t, ALWAYS as u, type ActionDeps as v, ActionDisabledReason as w, type ActionEnabledResult as x, type ActionEntry as y, ActionsProvider as z };
3158
+ export { type CustomPaintContext as $, type Action as A, type BooleansAdapter as B, type Condition as C, type Dims as D, type ActionEntry as E, ActionsProvider as F, type GeometryProjection as G, type HotkeyTrigger as H, type InsertExtras as I, ActiveToolContextProvider as J, ActiveToolContextProviderIfRoot as K, type ActiveToolContextProviderProps as L, type ActiveToolContextValue as M, type AreaSelectDep as N, type BindingOpts as O, type BindingScope as P, type BooleanOp as Q, type RenderLayer as R, type SliceDep as S, type Tool as T, type UseSelectionOptions as U, type VisibilityRules as V, type BooleanOpResult as W, type BoundGesture as X, type BuildRuleCtxArgs as Y, type ClipboardDep as Z, type ClipboardIngestCtx as _, type DeviceProfile as a, useAction as a$, type DepName as a0, type DepRegistry as a1, DepRegistryProvider as a2, type DispatcherContext as a3, type DragSample as a4, type EditAnchorsDep as a5, type GestureBinding as a6, IDENTITY_POSE_COMPOSITION as a7, type ImmediateInvoker as a8, type IngestCtx as a9, type SnapDep as aA, type SvgUnpacker as aB, type TextEditDep as aC, type ToolModifiers as aD, type ToolPresentation as aE, type ToolSlot as aF, type UiOngoingControl as aG, type ViewApi as aH, applyBooleanOp as aI, buildRuleCtx as aJ, clipboardCopyAction as aK, clipboardCutAction as aL, composeRectPose as aM, composeWorldPose as aN, createDispatcher as aO, decomposeRectPose as aP, describeRule as aQ, drawLayers as aR, enterTextEditAction as aS, evaluate as aT, evaluateEnabled as aU, rebaseLocalPose as aV, registerContentHandler as aW, index as aX, sliceAction as aY, specificity as aZ, translateRectPose as a_, type IngestionDep as aa, type InsertDep as ab, type InvocationCtx as ac, type Invoker as ad, type LassoSelectDep as ae, type LayoutDep as af, type MatchResult as ag, NEVER as ah, type NodeAtPointDep as ai, type OngoingHandle as aj, type OngoingInvoker as ak, type OngoingOverlay as al, type Point2 as am, PointerContextProvider as an, type PointerContextValue as ao, type PointerWorldPos as ap, type PoseAdapter as aq, type PoseComposition as ar, type ResizePolicy as as, type ResolveAllOptions as at, type ResolveOnlyResult as au, type ResolvedCandidate as av, type ScopedBinding as aw, type SelectionExtendKey as ax, type SelectionMode as ay, type Selector as az, type DetectedDeviceFacts as b, useActionsRegistry as b0, useActiveToolContext as b1, useDepRegistry as b2, useDepSource as b3, useOptionalActiveToolContext as b4, useOptionalDepRegistry as b5, usePointerContext as b6, useSelection as b7, worldPoseLookup as b8, type Conflict as b9, PREDICATE_TARGET as ba, type RegistryEntry as bb, type ToolDef as bc, type ToolScopes as bd, type ViewportToolDef as be, buildRouteRegistry as bf, defineTool as bg, defineViewportTool as bh, findConflicts as bi, findScopedConflicts as bj, formatConflict as bk, reportRouteConflicts as bl, type Rule as c, type RuleCtx as d, type ChromeCtx as e, type ChromeId as f, type DepSchema as g, type ActionsRegistry as h, type AffordanceHit as i, type Dispatcher as j, type AnyTool as k, type ToolCtx as l, type ToolKeybinding as m, type AffordanceBinding as n, type ChromeState as o, type SelectionApi as p, type ContentHandlerEntry as q, type SvgIngestOptions as r, type ActionsProp as s, type Affordance as t, type AffordanceRegion as u, type CommonAffordanceScratch as v, ALWAYS as w, type ActionDeps as x, ActionDisabledReason as y, type ActionEnabledResult as z };