@vielzeug/codex 26.11.23 → 26.11.24

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.
@@ -1,12 +1,17 @@
1
1
  {
2
- "apiSource": "// Public root surface of @vielzeug/wire. Every public export goes through this file.\nexport { type BezierRouteOptions, bezierRoute } from './bezier.js';\nexport { WireConfigError, WireError, WireGraphError } from './errors.js';\nexport { findCyclicGroups, topologicalOrder } from './graph.js';\nexport { type OrthogonalRouteOptions, orthogonalRoute } from './orthogonal.js';\nexport { bezierToSvgPath, polylineToSvgPath } from './path.js';\nexport { portAnchor } from './ports.js';\nexport type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';\n",
2
+ "apiSource": "// Public root surface of @vielzeug/wire. Every public export goes through this file.\nexport { type BezierRouteOptions, bezierRoute } from './bezier.js';\nexport {\n type ArrowheadOptions,\n arrowhead,\n type HitOptions,\n type HitResult,\n hitBezier,\n hitPolyline,\n pointOnBezier,\n pointOnPolyline,\n} from './edit.js';\nexport { WireConfigError, WireError, WireGraphError } from './errors.js';\nexport { findCyclicGroups, topologicalOrder } from './graph.js';\nexport { type OrthogonalRouteOptions, orthogonalRoute } from './orthogonal.js';\nexport { bezierToSvgPath, type PolylinePathOptions, polylineToSvgPath } from './path.js';\nexport { floatingSide, portAnchor } from './ports.js';\nexport type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';\n",
3
3
  "docs": {
4
4
  "index": "---\ntitle: 'Wire: Edge Routing for Node Editors'\ndescription: Deterministic bezier and orthogonal edge routing over obstacles, plus topological ordering and cycle detection for node graphs.\npackage: wire\ncategory: utilities\nkeywords:\n [\n edge-routing,\n node-editor,\n flowchart,\n bezier,\n orthogonal,\n manhattan,\n a-star,\n topological-sort,\n cycles,\n tarjan,\n graph,\n svg,\n path,\n dag,\n ]\nexports: [bezierRoute, orthogonalRoute, topologicalOrder, findCyclicGroups]\nrelated: [atlas]\nenvironments: [browser, node, ssr, deno]\n---\n\n<!-- markdownlint-disable MD025 MD033 MD060 -->\n\n<PackageHero package=\"wire\" />\n\n## Why Wire?\n\nNode editors always rediscover the same hard parts: wires that route _around_ nodes instead of through them, bend counts that change every frame, and ordering or cycle checks that recurse until the stack dies on a big graph. Wire computes all of it as pure functions: cubic bezier geometry anchored to port sides, A\\* Manhattan routes over a padded-obstacle visibility graph with a per-bend penalty, input-order-stable topological sorting, and Tarjan SCC cycle detection — iterative, so 50,000-node chains are fine.\n\n```ts\n// Before\n// Straight lines through nodes, hand-rolled A* with nondeterministic tie\n// breaks, and recursive DFS that stack-overflows on deep graphs.\n\n// After\nimport { bezierRoute, findCyclicGroups, orthogonalRoute, topologicalOrder } from '@vielzeug/wire';\n\nconst curve = bezierRoute({ side: 'right', x: 100, y: 40 }, { side: 'left', x: 320, y: 120 });\n\n// Pass every node bound; the router exempts each port's own node for its exit.\nconst waypoints = orthogonalRoute(fromPort, toPort, { obstacles: nodeBounds });\n// waypoints is null when every route is blocked — render a dashed fallback.\n```\n\n| Feature | Wire | Ad-hoc routing | Graph libraries |\n| ---------------------------- | -------------------------------------------- | -------------- | ------------------ |\n| Bundle size | <PackageInfo package=\"wire\" type=\"size\" /> | n/a | Typically 10–80 kB |\n| External dependencies | <ore-icon name=\"check\" size=\"16\"></ore-icon> | n/a | Varies |\n| Obstacle-avoiding orthogonal | Built in (A\\* + bend penalty) | Rare | Sometimes |\n| Deterministic output | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Rare | Varies |\n| Iterative cycle detection | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Recursive DFS | Varies |\n| Headless: no DOM or renderer | <ore-icon name=\"check\" size=\"16\"></ore-icon> | Varies | Usually coupled |\n\n<div class=\"decision-callout\">\n\n**Use Wire when** you own the node layout and rendering but want production-grade edge geometry and graph ordering as pure functions.\n\n**Consider a graph-drawing library when** you also want automatic layout (dagre-style ranking, force simulation) — Wire routes the edges you place, it does not place the nodes.\n\n</div>\n\n## Installation\n\n::: code-group\n\n```sh [pnpm]\npnpm add @vielzeug/wire\n```\n\n```sh [npm]\nnpm install @vielzeug/wire\n```\n\n```sh [yarn]\nyarn add @vielzeug/wire\n```\n\n:::\n\n## Quick Start\n\n```ts\nimport { bezierRoute, bezierToSvgPath, findCyclicGroups, orthogonalRoute, topologicalOrder } from '@vielzeug/wire';\n\n// Curved wire from a right-facing port to a left-facing port.\nconst curve = bezierRoute({ side: 'right', x: 100, y: 40 }, { side: 'left', x: 320, y: 120 });\nconst d = bezierToSvgPath(curve); // or draw curve.c1/curve.c2 on a canvas\n\n// Manhattan wire that avoids the node boxes.\nconst points = orthogonalRoute(\n { side: 'right', x: 100, y: 40 },\n { side: 'left', x: 320, y: 120 },\n { obstacles: nodeBounds },\n);\n\n// Execution order and cycles for a validation pass.\nconst order = topologicalOrder(\n ['b', 'a', 'c'],\n [\n { from: 'a', to: 'b' },\n { from: 'b', to: 'c' },\n ],\n);\nconst groups = findCyclicGroups(\n ['a', 'b'],\n [\n { from: 'a', to: 'b' },\n { from: 'b', to: 'a' },\n ],\n); // [['a', 'b']]\n```\n\n## Features\n\n<div class=\"features-grid\">\n\n- `bezierRoute()`: cubic bezier geometry with control points anchored to port sides\n- `orthogonalRoute()`: A\\* Manhattan polyline over a visibility graph built from obstacle corners, with a per-bend penalty, owner-obstacle exemption, and deterministic expansion order\n- `bezierToSvgPath()` / `polylineToSvgPath()`: SVG `d` serialization with micro-precision formatting\n- `topologicalOrder()`: Kahn ordering with stable input-order tie breaks; throws `WireGraphError` on cycles\n- `findCyclicGroups()`: iterative Tarjan SCCs — each cyclic group reported once, ordered deterministically\n- `WireError` / `WireGraphError` / `WireConfigError`: typed errors\n- Zero runtime dependencies, no DOM requirement: routes and orders are pure computations\n\n</div>\n\n## Documentation\n\n<div class=\"doc-links\">\n\n- [Usage Guide](./usage.md)\n- [API Reference](./api.md)\n- [Examples](./examples.md)\n- [Migration Guide](./migration.md)\n\n</div>\n\n## See Also\n\n<div class=\"see-also\">\n\n- [Atlas](/atlas/): the camera and rect shapes Wire's obstacles reuse.\n\n</div>\n\n<!-- markdownlint-enable MD025 MD033 MD060 -->\n",
5
- "api": "---\ntitle: 'Wire: API Reference'\ndescription: API reference for Wire's bezier and orthogonal routing, SVG path serialization, and graph ordering helpers.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution | Common gotcha |\n| --------------------------------------------------------------------- | ------------------------------------------------- | --------- | -------------------------------------------------------------------------- |\n| `bezierRoute()` | Cubic bezier geometry between two ports | Sync | Returns a `CubicBezier`, not a string — serialize with `bezierToSvgPath()` |\n| `orthogonalRoute()` | A\\* Manhattan polyline avoiding padded obstacles | Sync | Returns `null` when blocked; waypoints appear only at bends |\n| `portAnchor()` | World position of a port on a node rect | Sync | `offset` is a 0..1 fraction along the side, not a distance |\n| `bezierToSvgPath()` | SVG `d` string from a `CubicBezier` | Sync | Emits one absolute `M`/`C` pair |\n| `polylineToSvgPath()` | SVG `d` string from a polyline | Sync | Empty input returns `''`, not an error |\n| `topologicalOrder()` | Kahn ordering with input-order tie breaks | Sync | Throws `WireGraphError` on any cycle |\n| `findCyclicGroups()` | Cyclic SCCs via iterative Tarjan | Sync | Reports components (sets), not every elementary cycle |\n| `WireError` | Base class for all wire errors | Sync | Narrow with `instanceof WireError` |\n| `WireGraphError` | Unknown endpoints, duplicate ids, cyclic ordering | Sync | Thrown at call time |\n| `WireConfigError` | Invalid routing options | Sync | Thrown at call time |\n| `Point` / `Rect` / `PortAnchor` / `PortSide` / `CubicBezier` / `Edge` | Structural graph shapes | Sync | All readonly; treat as values |\n\n## Package Entry Point\n\n| Import | Purpose |\n| ---------------- | ---------------------------------------------------------------------------------- |\n| `@vielzeug/wire` | Bezier and orthogonal routing, path serialization, ordering, cycles, types, errors |\n\n---\n\n## Core Types\n\n```ts\ntype Point = Readonly<{ x: number; y: number }>;\ntype Rect = Readonly<{ x: number; y: number; width: number; height: number }>;\ntype PortSide = 'top' | 'right' | 'bottom' | 'left';\ntype PortAnchor = Point & Readonly<{ side: PortSide }>;\ntype CubicBezier = Readonly<{ from: Point; c1: Point; c2: Point; to: Point }>;\ntype Edge = Readonly<{ from: string; to: string }>;\n```\n\nCoordinates are screen convention: `top` is smaller y.\n\n---\n\n## Routing Functions\n\n### `portAnchor()`\n\n```ts\nfunction portAnchor(rect: Rect, side: PortSide, offset?: number): PortAnchor;\n```\n\nPlaces a port on `side` of `rect` and returns its world position together with the side it faces, ready to pass to `bezierRoute()` or `orthogonalRoute()`.\n\n| Parameter | Type | Description |\n| --------- | ---------- | ------------------------------------------------------ |\n| `rect` | `Rect` | Node bounding box the port sits on |\n| `side` | `PortSide` | Node edge the port faces |\n| `offset` | `number` | 0..1 fraction along the side (default 0.5, the middle) |\n\n**Returns:** a `PortAnchor` — the point plus its `side`. Throws `WireConfigError` for an `offset` outside 0..1 or non-finite.\n\n### `bezierRoute()`\n\n```ts\nfunction bezierRoute(from: PortAnchor, to: PortAnchor, options?: BezierRouteOptions): CubicBezier;\n```\n\nBuilds a cubic bezier segment whose control points extend `handleLength` units outward from each port along its side, so the curve leaves and enters ports perpendicular to the node edge.\n\n| Parameter | Type | Description |\n| --------- | -------------------- | ----------------------------------------------- |\n| `from` | `PortAnchor` | Source port with its side |\n| `to` | `PortAnchor` | Target port with its side |\n| `options` | `BezierRouteOptions` | `handleLength` (default 40) control-point reach |\n\n**Returns:** a `CubicBezier` (`from`, `c1`, `c2`, `to`) for canvas or SVG rendering; use `bezierToSvgPath()` for an SVG `d` string. Throws `WireConfigError` for a negative or non-finite `handleLength`.\n\n### `orthogonalRoute()`\n\n```ts\nfunction orthogonalRoute(from: PortAnchor, to: PortAnchor, options?: OrthogonalRouteOptions): Point[] | null;\n```\n\nRoutes an axis-aligned polyline over a visibility graph of obstacle corners and exit-tip rows/columns using A\\*. Cost is length plus `bendPenalty` per bend; expansion order is deterministic. The route runs `stub` units straight out of each port before bending, so wires never peel off a port sideways.\n\nPass every node's raw rect as `obstacles`. The obstacles whose padded interior contains a port are exempted for that port's straight exit segment only — the searched route never enters any padded obstacle interior, including its own nodes.\n\n| Parameter | Type | Description |\n| --------- | ------------------------ | ------------------------------------------------------------------------------------------------- |\n| `from` | `PortAnchor` | Start port; its `side` fixes the direction the route leaves it |\n| `to` | `PortAnchor` | Goal port; its `side` fixes the direction the route enters it |\n| `options` | `OrthogonalRouteOptions` | `obstacles`, `padding` (default 8), `bendPenalty` (default 12), `stub` (default 16, `0` disables) |\n\n**Returns:** waypoints (`from` first, `to` last, bends only) or `null` when a port's exit is blocked by a non-owner obstacle or every route is sealed off. Points exactly on a padded boundary are free: routes may hug obstacle margins.\n\n### `bezierToSvgPath()`\n\n```ts\nfunction bezierToSvgPath(curve: CubicBezier): string;\n```\n\nSerializes as an absolute `M`/`C` command, rounded to six decimals with no `-0` or exponent noise.\n\n### `polylineToSvgPath()`\n\n```ts\nfunction polylineToSvgPath(points: readonly Point[]): string;\n```\n\nSerializes as absolute `M`/`L` commands, rounded to six decimals with no `-0` or exponent noise.\n\n---\n\n## Graph Functions\n\n### `topologicalOrder()`\n\n```ts\nfunction topologicalOrder(nodeIds: readonly string[], edges: readonly Edge[]): string[];\n```\n\nKahn's algorithm with a heap keyed by input index; ready nodes are always consumed in input order. Parallel edges are tolerated. Throws `WireGraphError` on duplicate node ids, edges referencing unknown nodes, or cycles.\n\n### `findCyclicGroups()`\n\n```ts\nfunction findCyclicGroups(nodeIds: readonly string[], edges: readonly Edge[]): string[][];\n```\n\nIterative Tarjan SCCs. Each returned group is an SCC with more than one node, or a single node with a self-loop. A group is a set of mutually reachable nodes, not a path through them. Members are sorted by input position; groups are ordered by their first member. Same validation errors as `topologicalOrder()`.\n\n---\n\n## Errors\n\n| Class | Thrown when |\n| ----------------- | ------------------------------------------------------------------------------------------- |\n| `WireError` | Base class; catch-all via `instanceof WireError` |\n| `WireGraphError` | Unknown edge endpoints, duplicate node ids, cyclic `topologicalOrder()` |\n| `WireConfigError` | Negative or non-finite `handleLength`, `padding`, `stub`, or `bendPenalty`; bad port offset |\n",
6
- "usage": "---\ntitle: 'Wire: Usage Guide'\ndescription: Route bezier and orthogonal edges around nodes, serialize them as SVG paths, and order or validate node graphs with Wire.\n---\n\n[[toc]]\n\n## Basic Usage\n\nWire is headless: it turns port positions, node bounds, and edge lists into path data and orderings. You own the rendering.\n\n```ts\nimport { bezierRoute, bezierToSvgPath, orthogonalRoute, polylineToSvgPath, topologicalOrder } from '@vielzeug/wire';\n\n// A curved wire from a right-facing port to a left-facing port.\nconst curve = bezierRoute({ side: 'right', x: 100, y: 40 }, { side: 'left', x: 320, y: 120 });\npathElement.setAttribute('d', bezierToSvgPath(curve));\n\n// A Manhattan wire that routes around the node boxes.\nconst points = orthogonalRoute(\n { side: 'right', x: 100, y: 40 },\n { side: 'left', x: 320, y: 120 },\n { obstacles: nodeBounds },\n);\nif (points) pathElement.setAttribute('d', polylineToSvgPath(points));\n```\n\nBoth routers return geometry — a `CubicBezier` and a waypoint array — and the two serializers in `path.ts` turn them into SVG `d` strings. Canvas renderers consume the geometry directly (`ctx.bezierCurveTo(curve.c1.x, ...)`).\n\n## Port Sides\n\nA port is a `Point` plus a required `side` naming the node edge it faces. `portAnchor()` computes that point from a node rect, so you never hand-derive \"right side means `x + width`\":\n\n```ts\nimport { portAnchor } from '@vielzeug/wire';\n\n// Middle of the node's right edge, facing right.\nconst out = portAnchor(nodeBounds, 'right'); // { side: 'right', x, y }\n// Quarter along the top edge.\nconst top = portAnchor(nodeBounds, 'top', 0.25);\n```\n\n`bezierRoute()` extends each control point outward along its port's side, so wires leave and enter nodes perpendicular to the edge:\n\n```ts\n// Bottom port of A into top port of B (top-to-bottom flow).\nbezierRoute({ side: 'bottom', x: 60, y: 100 }, { side: 'top', x: 60, y: 220 });\n```\n\nA free endpoint that is not on a node — the cursor while dragging a wire, say — picks a side explicitly: `{ ...cursor, side: 'left' }`.\n\n## Routing Around Obstacles\n\n`orthogonalRoute()` searches a visibility graph built from the obstacle corners with A\\*, costing path length plus `bendPenalty` per bend — so among equally long routes, the one with fewer bends wins:\n\nPass every node's raw bounding box as `obstacles` — the same list for every edge. `padding` supplies the clearance, so do not inflate the rects yourself:\n\n```ts\nconst points = orthogonalRoute(outPort, inPort, {\n bendPenalty: 12, // cost of one extra bend, in the same units as distance\n obstacles: nodes.map((node) => node.bounds),\n padding: 8, // keep routes this far from obstacle edges\n});\n```\n\nFour contracts matter for editors:\n\n- **Your own nodes are exempted for the exit only.** A port sits on its node's boundary, inside that node's padded obstacle. The router exempts the obstacles that contain a port for that port's straight exit segment; the rest of the route never enters any padded obstacle interior, including its own nodes. No per-edge filtering.\n- **Unreachable returns `null`.** When a port's exit is blocked by another obstacle, or every route around the obstacles is sealed off, you get `null` — never a path through a wall. Show a dashed straight-line fallback while the user drags.\n- **Port sides add stubs.** The route runs `stub` units (default 16) straight out of each port before bending, and straight into the target port, so wires leave and enter ports perpendicular to the node edge. Pass `stub: 0` to opt out; a port inside an obstacle still exits straight far enough to clear it.\n- **Output is deterministic.** The same inputs always produce the same polyline, so edges don't shimmer between frames. The returned polyline carries waypoints only at bends.\n\nRoutes may hug the padded boundary exactly; raise `padding` if you want more clearance.\n\n## Ordering the Graph\n\n`topologicalOrder()` returns node ids in dependency order. Ties break by position in the input array, so the same editor state always produces the same order:\n\n```ts\nconst order = topologicalOrder(\n ['render', 'layout', 'parse'],\n [\n { from: 'parse', to: 'layout' },\n { from: 'layout', to: 'render' },\n ],\n); // ['parse', 'layout', 'render']\n```\n\nA cyclic graph has no topological order and throws `WireGraphError`. For validation UI, use `findCyclicGroups()` instead — it returns each cyclic part once as a strongly connected component:\n\n```ts\nimport { findCyclicGroups } from '@vielzeug/wire';\n\nconst groups = findCyclicGroups(nodeIds, edges);\n// [['a', 'b']] — a two-node loop; a self-loop appears as [['a']].\n```\n\nA group is a _set_ of mutually reachable nodes, not a path through them — display it as `a, b`, not `a → b`. Highlight every node in a returned group; edges inside the group are the ones to flag.\n\n## Best Practices\n\n- Route during drag with cheap settings (or a straight dashed line) and run the full `orthogonalRoute()` on drop; A\\* over a few hundred obstacles is fast, but not free at 60 fps for every edge.\n- Feed only the obstacles near the edge's corridor, not the whole document — cull with an atlas spatial index for large graphs.\n- Treat `topologicalOrder()` as the execution-order oracle for dataflow editors, and `findCyclicGroups()` as the validator that explains _why_ it threw.\n- Round-trip path strings through `polylineToSvgPath()` and `bezierToSvgPath()` rather than assembling `d` strings by hand; they keep precision stable for diffing and serialization.\n",
5
+ "api": "---\ntitle: 'Wire: API Reference'\ndescription: API reference for Wire's bezier and orthogonal routing, SVG path serialization, and graph ordering helpers.\n---\n\n[[toc]]\n\n## API Overview\n\n| Symbol | Purpose | Execution | Common gotcha |\n| --------------------------------------------------------------------- | ------------------------------------------------- | --------- | -------------------------------------------------------------------------- |\n| `bezierRoute()` | Cubic bezier geometry between two ports | Sync | Returns a `CubicBezier`, not a string — serialize with `bezierToSvgPath()` |\n| `orthogonalRoute()` | A\\* Manhattan polyline avoiding padded obstacles | Sync | Returns `null` when blocked; waypoints appear only at bends |\n| `portAnchor()` | World position of a port on a node rect | Sync | `offset` is a 0..1 fraction along the side, not a distance |\n| `floatingSide()` | Rect side facing a world point | Sync | Dominant axis from the rect center; ties go horizontal |\n| `bezierToSvgPath()` | SVG `d` string from a `CubicBezier` | Sync | Emits one absolute `M`/`C` pair |\n| `polylineToSvgPath()` | SVG `d` string from a polyline | Sync | Empty input returns `''`, not an error; `cornerRadius` adds `Q` arcs |\n| `arrowhead()` | Triangle points capping a line at its tip | Sync | `direction` is normalized; returns points, not an SVG path |\n| `pointOnBezier()` / `pointOnPolyline()` | Point at a length-normalized `t` on a shape | Sync | `t` is arc length, not the raw bezier parameter |\n| `hitBezier()` / `hitPolyline()` | Closest point within a threshold | Sync | Returns `null` past the threshold; bezier `t` is sampled |\n| `topologicalOrder()` | Kahn ordering with input-order tie breaks | Sync | Throws `WireGraphError` on any cycle |\n| `findCyclicGroups()` | Cyclic SCCs via iterative Tarjan | Sync | Reports components (sets), not every elementary cycle |\n| `WireError` | Base class for all wire errors | Sync | Narrow with `instanceof WireError` |\n| `WireGraphError` | Unknown endpoints, duplicate ids, cyclic ordering | Sync | Thrown at call time |\n| `WireConfigError` | Invalid routing options | Sync | Thrown at call time |\n| `Point` / `Rect` / `PortAnchor` / `PortSide` / `CubicBezier` / `Edge` | Structural graph shapes | Sync | All readonly; treat as values |\n\n## Package Entry Point\n\n| Import | Purpose |\n| ---------------- | ---------------------------------------------------------------------------------- |\n| `@vielzeug/wire` | Bezier and orthogonal routing, path serialization, ordering, cycles, types, errors |\n\n---\n\n## Core Types\n\n```ts\ntype Point = Readonly<{ x: number; y: number }>;\ntype Rect = Readonly<{ x: number; y: number; width: number; height: number }>;\ntype PortSide = 'top' | 'right' | 'bottom' | 'left';\ntype PortAnchor = Point & Readonly<{ side: PortSide }>;\ntype CubicBezier = Readonly<{ from: Point; c1: Point; c2: Point; to: Point }>;\ntype Edge = Readonly<{ from: string; to: string }>;\n```\n\nCoordinates are screen convention: `top` is smaller y.\n\n---\n\n## Routing Functions\n\n### `portAnchor()`\n\n```ts\nfunction portAnchor(rect: Rect, side: PortSide, offset?: number): PortAnchor;\n```\n\nPlaces a port on `side` of `rect` and returns its world position together with the side it faces, ready to pass to `bezierRoute()` or `orthogonalRoute()`.\n\n| Parameter | Type | Description |\n| --------- | ---------- | ------------------------------------------------------ |\n| `rect` | `Rect` | Node bounding box the port sits on |\n| `side` | `PortSide` | Node edge the port faces |\n| `offset` | `number` | 0..1 fraction along the side (default 0.5, the middle) |\n\n**Returns:** a `PortAnchor` — the point plus its `side`. Throws `WireConfigError` for an `offset` outside 0..1 or non-finite.\n\n### `bezierRoute()`\n\n```ts\nfunction bezierRoute(from: PortAnchor, to: PortAnchor, options?: BezierRouteOptions): CubicBezier;\n```\n\nBuilds a cubic bezier segment whose control points extend `handleLength` units outward from each port along its side, so the curve leaves and enters ports perpendicular to the node edge.\n\n| Parameter | Type | Description |\n| --------- | -------------------- | --------------------------------------------------------------------------- |\n| `from` | `PortAnchor` | Source port with its side |\n| `to` | `PortAnchor` | Target port with its side |\n| `options` | `BezierRouteOptions` | `handleLength` (default 40) control-point reach; `selfLoop` (default false) |\n\n**Returns:** a `CubicBezier` (`from`, `c1`, `c2`, `to`) for canvas or SVG rendering; use `bezierToSvgPath()` for an SVG `d` string. Throws `WireConfigError` for a negative or non-finite `handleLength`.\n\nWith `selfLoop: true` and both ports on the same side, each handle grows to `1.5 ×` the distance between the ports (never below `handleLength`), so a from→to pair on one node bulges outward into a visible loop instead of collapsing onto the node edge. The shape is deterministic: both handles use the same widened length, keeping the loop symmetric about the port midpoint. The option is ignored when the ports face different sides.\n\n### `floatingSide()`\n\n```ts\nfunction floatingSide(rect: Rect, toward: Point): PortSide;\n```\n\nReturns the side of `rect` facing the point `toward`, chosen by the dominant axis from the rect's center — the larger of `|dx|` and `|dy|` wins. Useful for ports that follow the pointer (\"floating\" edges) without storing a fixed side.\n\n| Parameter | Type | Description |\n| --------- | ------- | -------------------------------- |\n| `rect` | `Rect` | Node bounding box |\n| `toward` | `Point` | World point the side should face |\n\n**Returns:** the facing `PortSide`. Ties (`|dx| === |dy|`, including a target exactly on the center) resolve to the horizontal side, with `right` for a zero offset. Throws `WireConfigError` for non-finite rect or point coordinates.\n\n### `orthogonalRoute()`\n\n```ts\nfunction orthogonalRoute(from: PortAnchor, to: PortAnchor, options?: OrthogonalRouteOptions): Point[] | null;\n```\n\nRoutes an axis-aligned polyline over a visibility graph of obstacle corners and exit-tip rows/columns using A\\*. Cost is length plus `bendPenalty` per bend; expansion order is deterministic. The route runs `stub` units straight out of each port before bending, so wires never peel off a port sideways.\n\nPass every node's raw rect as `obstacles`. The obstacles whose padded interior contains a port are exempted for that port's straight exit segment only — the searched route never enters any padded obstacle interior, including its own nodes.\n\n| Parameter | Type | Description |\n| --------- | ------------------------ | ------------------------------------------------------------------------------------------------- |\n| `from` | `PortAnchor` | Start port; its `side` fixes the direction the route leaves it |\n| `to` | `PortAnchor` | Goal port; its `side` fixes the direction the route enters it |\n| `options` | `OrthogonalRouteOptions` | `obstacles`, `padding` (default 8), `bendPenalty` (default 12), `stub` (default 16, `0` disables) |\n\n**Returns:** waypoints (`from` first, `to` last, bends only) or `null` when a port's exit is blocked by a non-owner obstacle or every route is sealed off. Points exactly on a padded boundary are free: routes may hug obstacle margins.\n\n### `bezierToSvgPath()`\n\n```ts\nfunction bezierToSvgPath(curve: CubicBezier): string;\n```\n\nSerializes as an absolute `M`/`C` command, rounded to six decimals with no `-0` or exponent noise.\n\n### `polylineToSvgPath()`\n\n```ts\nfunction polylineToSvgPath(points: readonly Point[], options?: PolylinePathOptions): string;\n```\n\nSerializes as absolute `M`/`L` commands, rounded to six decimals with no `-0` or exponent noise.\n\n| Parameter | Type | Description |\n| --------- | --------------------- | ---------------------------------------------------------------- |\n| `points` | `readonly Point[]` | Waypoints, bends included |\n| `options` | `PolylinePathOptions` | `cornerRadius` (default 0) rounds interior corners with `Q` arcs |\n\nWith `cornerRadius > 0`, each interior corner is replaced by a straight run into the corner, a quadratic `Q` arc through it, and a run out — the corner point itself is not emitted. The radius is clamped per corner to half of its shortest adjacent run, so tight bends never overlap; collinear waypoints and zero-length runs are skipped, keeping the path continuous. `orthogonalRoute()` output stays a raw waypoint polyline — rounding is a rendering decision applied here at serialization time. Throws `WireConfigError` for a negative or non-finite `cornerRadius`.\n\n---\n\n## Editing Geometry\n\nThese helpers are DOM-free and node-model-free: they work on the raw geometry `bezierRoute()` and `orthogonalRoute()` produce, for editors that need hit-testing, markers, and drag feedback.\n\n### `arrowhead()`\n\n```ts\nfunction arrowhead(tip: Point, direction: Point, options?: ArrowheadOptions): Point[];\n```\n\nBuilds a filled triangle capping a line at `tip`. The apex sits at `tip`; the base sits `length` behind it along `-direction`, `width` apart. `direction` may be any non-zero vector — it is normalized internally — and points the way the line arrives at the tip.\n\n| Parameter | Type | Description |\n| ----------- | ------------------ | ----------------------------------------------------------------- |\n| `tip` | `Point` | Apex of the arrowhead |\n| `direction` | `Point` | Arrival direction toward the tip (normalized) |\n| `options` | `ArrowheadOptions` | `length` (default 10) shaft reach; `width` (default 6) base width |\n\n**Returns:** `[tip, baseLeft, baseRight]` — three points to fill as a polygon. Throws `WireConfigError` for non-finite points, a zero `direction`, or non-positive/non-finite `length`/`width`.\n\n### `pointOnBezier()` / `pointOnPolyline()`\n\n```ts\nfunction pointOnBezier(curve: CubicBezier, t: number): Point;\nfunction pointOnPolyline(points: readonly Point[], t: number): Point;\n```\n\nPoint at parameter `t` where `t` is normalized by total arc length, not by the raw bezier parameter or segment index: `t = 0.5` is the point halfway along the drawn wire. Polyline results are exact; the bezier mapping uses a fixed 64-sample arc-length lookup table, so `t` lands within roughly one sample cell of the true length fraction — sub-pixel for typical wire sizes.\n\n**Returns:** the point at that length. Degenerate zero-length shapes return their start for every `t`. Throws `WireConfigError` for non-finite inputs, fewer than two polyline points, or `t` outside `[0, 1]`.\n\n### `hitBezier()` / `hitPolyline()`\n\n```ts\nfunction hitBezier(curve: CubicBezier, point: Point, options?: HitOptions): HitResult | null;\nfunction hitPolyline(points: readonly Point[], point: Point, options?: HitOptions): HitResult | null;\n```\n\nClosest point on the shape to `point`, for click selection without invisible DOM hit targets. `hitPolyline` tests every segment analytically (exact); `hitBezier` finds the nearest of 64 samples, then refines with a ternary search on the true curve, so the reported `distance` is accurate while `t` carries the table's arc-length tolerance.\n\n| Parameter | Type | Description |\n| ------------------ | ---------------------------------- | -------------------------------------------------- |\n| `curve` / `points` | `CubicBezier` / `readonly Point[]` | The shape to test |\n| `point` | `Point` | Query point |\n| `options` | `HitOptions` | `threshold` (default 4) maximum distance for a hit |\n\n**Returns:** a `HitResult` (`t` length-normalized in `[0, 1]`, `distance` Euclidean) or `null` when the closest point is farther than `threshold`. For zoom-independent screen picking, divide a screen-pixel threshold by the camera zoom before calling. Same validation errors as the `pointOn*` helpers.\n\n---\n\n## Graph Functions\n\n### `topologicalOrder()`\n\n```ts\nfunction topologicalOrder(nodeIds: readonly string[], edges: readonly Edge[]): string[];\n```\n\nKahn's algorithm with a heap keyed by input index; ready nodes are always consumed in input order. Parallel edges are tolerated. Throws `WireGraphError` on duplicate node ids, edges referencing unknown nodes, or cycles.\n\n### `findCyclicGroups()`\n\n```ts\nfunction findCyclicGroups(nodeIds: readonly string[], edges: readonly Edge[]): string[][];\n```\n\nIterative Tarjan SCCs. Each returned group is an SCC with more than one node, or a single node with a self-loop. A group is a set of mutually reachable nodes, not a path through them. Members are sorted by input position; groups are ordered by their first member. Same validation errors as `topologicalOrder()`.\n\n---\n\n## Errors\n\n| Class | Thrown when |\n| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |\n| `WireError` | Base class; catch-all via `instanceof WireError` |\n| `WireGraphError` | Unknown edge endpoints, duplicate node ids, cyclic `topologicalOrder()` |\n| `WireConfigError` | Negative or non-finite `handleLength`, `padding`, `stub`, `bendPenalty`, `cornerRadius`, edit sizes, thresholds, or `t`; bad port offset |\n",
6
+ "usage": "---\ntitle: 'Wire: Usage Guide'\ndescription: Route bezier and orthogonal edges around nodes, serialize them as SVG paths, and order or validate node graphs with Wire.\n---\n\n[[toc]]\n\n## Basic Usage\n\nWire is headless: it turns port positions, node bounds, and edge lists into path data and orderings. You own the rendering.\n\n```ts\nimport { bezierRoute, bezierToSvgPath, orthogonalRoute, polylineToSvgPath, topologicalOrder } from '@vielzeug/wire';\n\n// A curved wire from a right-facing port to a left-facing port.\nconst curve = bezierRoute({ side: 'right', x: 100, y: 40 }, { side: 'left', x: 320, y: 120 });\npathElement.setAttribute('d', bezierToSvgPath(curve));\n\n// A Manhattan wire that routes around the node boxes.\nconst points = orthogonalRoute(\n { side: 'right', x: 100, y: 40 },\n { side: 'left', x: 320, y: 120 },\n { obstacles: nodeBounds },\n);\nif (points) pathElement.setAttribute('d', polylineToSvgPath(points));\n```\n\nBoth routers return geometry — a `CubicBezier` and a waypoint array — and the two serializers in `path.ts` turn them into SVG `d` strings. Canvas renderers consume the geometry directly (`ctx.bezierCurveTo(curve.c1.x, ...)`).\n\n## Port Sides\n\nA port is a `Point` plus a required `side` naming the node edge it faces. `portAnchor()` computes that point from a node rect, so you never hand-derive \"right side means `x + width`\":\n\n```ts\nimport { portAnchor } from '@vielzeug/wire';\n\n// Middle of the node's right edge, facing right.\nconst out = portAnchor(nodeBounds, 'right'); // { side: 'right', x, y }\n// Quarter along the top edge.\nconst top = portAnchor(nodeBounds, 'top', 0.25);\n```\n\n`bezierRoute()` extends each control point outward along its port's side, so wires leave and enter nodes perpendicular to the edge:\n\n```ts\n// Bottom port of A into top port of B (top-to-bottom flow).\nbezierRoute({ side: 'bottom', x: 60, y: 100 }, { side: 'top', x: 60, y: 220 });\n```\n\nA free endpoint that is not on a node — the cursor while dragging a wire, say — picks a side explicitly: `{ ...cursor, side: 'left' }`, or computes the facing side with `floatingSide(nodeBounds, cursor)`.\n\n## Routing Around Obstacles\n\n`orthogonalRoute()` searches a visibility graph built from the obstacle corners with A\\*, costing path length plus `bendPenalty` per bend — so among equally long routes, the one with fewer bends wins:\n\nPass every node's raw bounding box as `obstacles` — the same list for every edge. `padding` supplies the clearance, so do not inflate the rects yourself:\n\n```ts\nconst points = orthogonalRoute(outPort, inPort, {\n bendPenalty: 12, // cost of one extra bend, in the same units as distance\n obstacles: nodes.map((node) => node.bounds),\n padding: 8, // keep routes this far from obstacle edges\n});\n```\n\nFour contracts matter for editors:\n\n- **Your own nodes are exempted for the exit only.** A port sits on its node's boundary, inside that node's padded obstacle. The router exempts the obstacles that contain a port for that port's straight exit segment; the rest of the route never enters any padded obstacle interior, including its own nodes. No per-edge filtering.\n- **Unreachable returns `null`.** When a port's exit is blocked by another obstacle, or every route around the obstacles is sealed off, you get `null` — never a path through a wall. Show a dashed straight-line fallback while the user drags.\n- **Port sides add stubs.** The route runs `stub` units (default 16) straight out of each port before bending, and straight into the target port, so wires leave and enter ports perpendicular to the node edge. Pass `stub: 0` to opt out; a port inside an obstacle still exits straight far enough to clear it.\n- **Output is deterministic.** The same inputs always produce the same polyline, so edges don't shimmer between frames. The returned polyline carries waypoints only at bends.\n\nRoutes may hug the padded boundary exactly; raise `padding` if you want more clearance.\n\n## Rounded Corners\n\n`polylineToSvgPath()` accepts a `cornerRadius` that replaces each interior bend with a quadratic arc — orthogonal wires stop looking like pipe fittings with one option:\n\n```ts\nconst points = orthogonalRoute(outPort, inPort, { obstacles: nodeBounds });\nif (points) pathElement.setAttribute('d', polylineToSvgPath(points, { cornerRadius: 8 }));\n```\n\nThe radius is clamped per corner to half of its shortest adjacent run, so a bend between two short runs simply rounds as much as fits instead of self-overlapping. The router itself never rounds: `orthogonalRoute()` keeps returning raw waypoints, and rounding stays a rendering decision you can toggle per zoom level or theme.\n\n## Editing Geometry\n\nEditors need to answer \"what did the user click?\" without invisible DOM hit targets. The edit helpers work on the geometry the routers already produce:\n\n```ts\nimport { hitBezier, hitPolyline } from '@vielzeug/wire';\n\n// World-space click, threshold scaled so the pick area is zoom-independent.\nconst threshold = 8 / camera.zoom;\nconst hit =\n edge.geometry.kind === 'bezier'\n ? hitBezier(edge.geometry.curve, worldPoint, { threshold })\n : hitPolyline(edge.geometry.points, worldPoint, { threshold });\nif (hit) selectEdge(edge.id, hit.t); // t is normalized by arc length\n```\n\n`hit.t` and the matching `pointOnBezier()` / `pointOnPolyline()` are parameterized by arc length, so `t = 0.5` is always the midpoint of the drawn wire — useful for labels and drag handles regardless of how lopsided the underlying bezier handles are.\n\nFor arrowheads, `arrowhead()` returns the three triangle points capping a line at its tip; pass the arrival direction (any non-zero vector — it is normalized):\n\n```ts\nimport { arrowhead, pointOnBezier } from '@vielzeug/wire';\n\nconst tip = curve.to;\nconst arriving = { x: tip.x - curve.c2.x, y: tip.y - curve.c2.y };\nconst [apex, left, right] = arrowhead(tip, arriving, { length: 8, width: 5 });\n```\n\nTwo more routing-polish pieces round out editors:\n\n- **`floatingSide(rect, toward)`** returns the rect side facing a point — the dominant axis from the rect center — so an edge can track the cursor across node sides without storing a fixed port side.\n- **`selfLoop: true` on `bezierRoute()`** widens both handles to `1.5 ×` the port spacing when the endpoints share a side, so an edge from a node's `out` port back to its own `in` port bulges into a visible loop instead of collapsing onto the node edge.\n\n## Ordering the Graph\n\n`topologicalOrder()` returns node ids in dependency order. Ties break by position in the input array, so the same editor state always produces the same order:\n\n```ts\nconst order = topologicalOrder(\n ['render', 'layout', 'parse'],\n [\n { from: 'parse', to: 'layout' },\n { from: 'layout', to: 'render' },\n ],\n); // ['parse', 'layout', 'render']\n```\n\nA cyclic graph has no topological order and throws `WireGraphError`. For validation UI, use `findCyclicGroups()` instead — it returns each cyclic part once as a strongly connected component:\n\n```ts\nimport { findCyclicGroups } from '@vielzeug/wire';\n\nconst groups = findCyclicGroups(nodeIds, edges);\n// [['a', 'b']] — a two-node loop; a self-loop appears as [['a']].\n```\n\nA group is a _set_ of mutually reachable nodes, not a path through them — display it as `a, b`, not `a → b`. Highlight every node in a returned group; edges inside the group are the ones to flag.\n\n## Best Practices\n\n- Route during drag with cheap settings (or a straight dashed line) and run the full `orthogonalRoute()` on drop; A\\* over a few hundred obstacles is fast, but not free at 60 fps for every edge.\n- Feed only the obstacles near the edge's corridor, not the whole document — cull with an atlas spatial index for large graphs.\n- Treat `topologicalOrder()` as the execution-order oracle for dataflow editors, and `findCyclicGroups()` as the validator that explains _why_ it threw.\n- Round-trip path strings through `polylineToSvgPath()` and `bezierToSvgPath()` rather than assembling `d` strings by hand; they keep precision stable for diffing and serialization.\n",
7
7
  "examples": "---\ntitle: 'Wire: Examples'\ndescription: Practical examples and recipes for @vielzeug/wire.\n---\n\n## Examples\n\n- [Edges Around Nodes](./examples/edges-around-nodes.md)\n"
8
8
  },
9
9
  "examples": [
10
+ {
11
+ "id": "wire-edit",
12
+ "code": "import {\n arrowhead,\n bezierRoute,\n bezierToSvgPath,\n hitBezier,\n hitPolyline,\n orthogonalRoute,\n pointOnBezier,\n polylineToSvgPath,\n} from '@vielzeug/wire'\n\nconst svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')\nsvg.setAttribute('viewBox', '0 0 380 200')\nsvg.style.cssText = 'width:100%;max-width:520px;background:#0f172a;border-radius:12px'\n\nfunction addPath(d, color, dashed) {\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path')\n path.setAttribute('d', d)\n path.setAttribute('fill', 'none')\n path.setAttribute('stroke', color)\n path.setAttribute('stroke-width', '2')\n if (dashed) path.setAttribute('stroke-dasharray', '5 5')\n svg.appendChild(path)\n return path\n}\n\n// Rounded orthogonal corners: one option at serialization time.\nconst points = orthogonalRoute(\n { side: 'right', x: 60, y: 40 },\n { side: 'left', x: 320, y: 150 },\n { obstacles: [{ x: 150, y: 60, width: 80, height: 50 }], padding: 10 },\n)\nif (points) addPath(polylineToSvgPath(points, { cornerRadius: 10 }), '#a78bfa')\n\n// A bezier wire with an arrowhead at the tip and a marker at its length midpoint.\nconst curve = bezierRoute({ side: 'right', x: 60, y: 60 }, { side: 'left', x: 320, y: 110 })\naddPath(bezierToSvgPath(curve), '#38bdf8')\n\nconst tip = curve.to\nconst arriving = { x: tip.x - curve.c2.x, y: tip.y - curve.c2.y }\nconst [apex, left, right] = arrowhead(tip, arriving, { length: 10, width: 6 })\nconst head = document.createElementNS('http://www.w3.org/2000/svg', 'polygon')\nhead.setAttribute('points', [apex, left, right].map((p) => p.x + ',' + p.y).join(' '))\nhead.setAttribute('fill', '#38bdf8')\nsvg.appendChild(head)\n\nconst mid = pointOnBezier(curve, 0.5) // halfway along the drawn length\nconst dot = document.createElementNS('http://www.w3.org/2000/svg', 'circle')\ndot.setAttribute('cx', String(mid.x)); dot.setAttribute('cy', String(mid.y))\ndot.setAttribute('r', '4'); dot.setAttribute('fill', '#fbbf24')\nsvg.appendChild(dot)\n\n// Math hit-testing: a point near the curve hits, a far point misses.\nconst near = hitBezier(curve, { x: 190, y: 88 }, { threshold: 8 })\nconst far = hitBezier(curve, { x: 190, y: 160 }, { threshold: 8 })\nconst polyHit = points ? hitPolyline(points, { x: 100, y: 40 }, { threshold: 8 }) : null\n\ndocument.body.appendChild(svg)\nconsole.log('near hit:', near ? 't=' + near.t.toFixed(2) + ' d=' + near.distance.toFixed(1) : 'null')\nconsole.log('far hit:', far === null ? 'null (past threshold)' : 'unexpected')\nconsole.log('polyline hit:', polyHit ? 't=' + polyHit.t.toFixed(2) : 'null')",
13
+ "name": "edit - Arrowheads, arc-length t, hit testing"
14
+ },
10
15
  {
11
16
  "id": "wire-routing",
12
17
  "code": "import { bezierRoute, bezierToSvgPath, orthogonalRoute, polylineToSvgPath } from '@vielzeug/wire'\n\n// Three node boxes; edges must route around them.\nconst nodes = [\n { h: 46, w: 96, x: 20, y: 24 },\n { h: 46, w: 96, x: 20, y: 150 },\n { h: 46, w: 96, x: 260, y: 88 },\n]\nconst obstacles = nodes.map((n) => ({ x: n.x, y: n.y, width: n.w, height: n.h }))\n\nconst svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg')\nsvg.setAttribute('viewBox', '0 0 380 220')\nsvg.style.cssText = 'width:100%;max-width:520px;background:#0f172a;border-radius:12px'\n\nfor (const n of nodes) {\n const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect')\n rect.setAttribute('x', String(n.x)); rect.setAttribute('y', String(n.y))\n rect.setAttribute('width', String(n.w)); rect.setAttribute('height', String(n.h))\n rect.setAttribute('rx', '8'); rect.setAttribute('fill', '#1e293b')\n rect.setAttribute('stroke', '#475569')\n svg.appendChild(rect)\n}\n\nfunction addPath(d, color, dashed) {\n const path = document.createElementNS('http://www.w3.org/2000/svg', 'path')\n path.setAttribute('d', d)\n path.setAttribute('fill', 'none')\n path.setAttribute('stroke', color)\n path.setAttribute('stroke-width', '2')\n if (dashed) path.setAttribute('stroke-dasharray', '5 5')\n svg.appendChild(path)\n}\n\n// Curved wire from node 1's right port to node 3's left port.\naddPath(bezierToSvgPath(bezierRoute({ side: 'right', x: 116, y: 47 }, { side: 'left', x: 260, y: 111 })), '#38bdf8')\n\n// Manhattan wire from node 2 to node 3, routed around node 1's column.\n// Every node is an obstacle; the router exempts each port's own node for its exit.\nconst points = orthogonalRoute(\n { side: 'right', x: 116, y: 173 },\n { side: 'left', x: 260, y: 111 },\n { obstacles, padding: 10 },\n)\nif (points) addPath(polylineToSvgPath(points), '#a78bfa')\n\ndocument.body.appendChild(svg)\nconsole.log('orthogonal waypoints:', points ? points.length : 'unreachable')",
@@ -16,6 +21,14 @@
16
21
  "typeSignatures": {
17
22
  "BezierRouteOptions": "export { type BezierRouteOptions, bezierRoute } from './bezier.js';",
18
23
  "bezierRoute": "export { type BezierRouteOptions, bezierRoute } from './bezier.js';",
24
+ "ArrowheadOptions": "export {\n type ArrowheadOptions,\n arrowhead,\n type HitOptions,\n type HitResult,\n hitBezier,\n hitPolyline,\n pointOnBezier,\n pointOnPolyline,\n} from './edit.js';",
25
+ "arrowhead": "export {\n type ArrowheadOptions,\n arrowhead,\n type HitOptions,\n type HitResult,\n hitBezier,\n hitPolyline,\n pointOnBezier,\n pointOnPolyline,\n} from './edit.js';",
26
+ "HitOptions": "export {\n type ArrowheadOptions,\n arrowhead,\n type HitOptions,\n type HitResult,\n hitBezier,\n hitPolyline,\n pointOnBezier,\n pointOnPolyline,\n} from './edit.js';",
27
+ "HitResult": "export {\n type ArrowheadOptions,\n arrowhead,\n type HitOptions,\n type HitResult,\n hitBezier,\n hitPolyline,\n pointOnBezier,\n pointOnPolyline,\n} from './edit.js';",
28
+ "hitBezier": "export {\n type ArrowheadOptions,\n arrowhead,\n type HitOptions,\n type HitResult,\n hitBezier,\n hitPolyline,\n pointOnBezier,\n pointOnPolyline,\n} from './edit.js';",
29
+ "hitPolyline": "export {\n type ArrowheadOptions,\n arrowhead,\n type HitOptions,\n type HitResult,\n hitBezier,\n hitPolyline,\n pointOnBezier,\n pointOnPolyline,\n} from './edit.js';",
30
+ "pointOnBezier": "export {\n type ArrowheadOptions,\n arrowhead,\n type HitOptions,\n type HitResult,\n hitBezier,\n hitPolyline,\n pointOnBezier,\n pointOnPolyline,\n} from './edit.js';",
31
+ "pointOnPolyline": "export {\n type ArrowheadOptions,\n arrowhead,\n type HitOptions,\n type HitResult,\n hitBezier,\n hitPolyline,\n pointOnBezier,\n pointOnPolyline,\n} from './edit.js';",
19
32
  "WireConfigError": "export { WireConfigError, WireError, WireGraphError } from './errors.js';",
20
33
  "WireError": "export { WireConfigError, WireError, WireGraphError } from './errors.js';",
21
34
  "WireGraphError": "export { WireConfigError, WireError, WireGraphError } from './errors.js';",
@@ -23,9 +36,11 @@
23
36
  "topologicalOrder": "export { findCyclicGroups, topologicalOrder } from './graph.js';",
24
37
  "OrthogonalRouteOptions": "export { type OrthogonalRouteOptions, orthogonalRoute } from './orthogonal.js';",
25
38
  "orthogonalRoute": "export { type OrthogonalRouteOptions, orthogonalRoute } from './orthogonal.js';",
26
- "bezierToSvgPath": "export { bezierToSvgPath, polylineToSvgPath } from './path.js';",
27
- "polylineToSvgPath": "export { bezierToSvgPath, polylineToSvgPath } from './path.js';",
28
- "portAnchor": "export { portAnchor } from './ports.js';",
39
+ "bezierToSvgPath": "export { bezierToSvgPath, type PolylinePathOptions, polylineToSvgPath } from './path.js';",
40
+ "PolylinePathOptions": "export { bezierToSvgPath, type PolylinePathOptions, polylineToSvgPath } from './path.js';",
41
+ "polylineToSvgPath": "export { bezierToSvgPath, type PolylinePathOptions, polylineToSvgPath } from './path.js';",
42
+ "floatingSide": "export { floatingSide, portAnchor } from './ports.js';",
43
+ "portAnchor": "export { floatingSide, portAnchor } from './ports.js';",
29
44
  "CubicBezier": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
30
45
  "Edge": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
31
46
  "Point": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
package/data/refine.json CHANGED
@@ -11403,6 +11403,214 @@
11403
11403
  }
11404
11404
  ]
11405
11405
  },
11406
+ {
11407
+ "kind": "variable",
11408
+ "name": "SLIDER_TAG",
11409
+ "type": {
11410
+ "text": "'ore-slider'"
11411
+ },
11412
+ "default": "'ore-slider'",
11413
+ "description": "A slider for selecting a single numeric value or a numeric range.\n\nAdd the boolean `range` attribute to activate two-thumb range mode."
11414
+ },
11415
+ {
11416
+ "kind": "class",
11417
+ "name": "OreSliderElement",
11418
+ "tagName": "ore-slider",
11419
+ "customElement": true,
11420
+ "description": "A slider for selecting a single numeric value or a numeric range.\nAdd the boolean `range` attribute to activate two-thumb range mode.",
11421
+ "summary": "",
11422
+ "attributes": [
11423
+ {
11424
+ "name": "min",
11425
+ "type": {
11426
+ "text": "number"
11427
+ },
11428
+ "description": "Minimum value (default: 0)",
11429
+ "default": "0"
11430
+ },
11431
+ {
11432
+ "name": "max",
11433
+ "type": {
11434
+ "text": "number"
11435
+ },
11436
+ "description": "Maximum value (default: 100)",
11437
+ "default": "100"
11438
+ },
11439
+ {
11440
+ "name": "step",
11441
+ "type": {
11442
+ "text": "number"
11443
+ },
11444
+ "description": "Step increment (default: 1)",
11445
+ "default": "1"
11446
+ },
11447
+ {
11448
+ "name": "value",
11449
+ "type": {
11450
+ "text": "number"
11451
+ },
11452
+ "description": "Current value (single mode)"
11453
+ },
11454
+ {
11455
+ "name": "from",
11456
+ "type": {
11457
+ "text": "number"
11458
+ },
11459
+ "description": "Lower bound (range mode)"
11460
+ },
11461
+ {
11462
+ "name": "to",
11463
+ "type": {
11464
+ "text": "number"
11465
+ },
11466
+ "description": "Upper bound (range mode)"
11467
+ },
11468
+ {
11469
+ "name": "range",
11470
+ "type": {
11471
+ "text": "boolean"
11472
+ },
11473
+ "description": "Activate range mode"
11474
+ },
11475
+ {
11476
+ "name": "disabled",
11477
+ "type": {
11478
+ "text": "boolean"
11479
+ },
11480
+ "description": "Disable interaction"
11481
+ },
11482
+ {
11483
+ "name": "name",
11484
+ "type": {
11485
+ "text": "string"
11486
+ },
11487
+ "description": "Form field name (single mode)"
11488
+ },
11489
+ {
11490
+ "name": "color",
11491
+ "type": {
11492
+ "text": "'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'"
11493
+ },
11494
+ "description": "Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'"
11495
+ },
11496
+ {
11497
+ "name": "size",
11498
+ "type": {
11499
+ "text": "'sm' | 'md' | 'lg'"
11500
+ },
11501
+ "description": "'sm' | 'md' | 'lg'"
11502
+ },
11503
+ {
11504
+ "name": "helper",
11505
+ "type": {
11506
+ "text": "string"
11507
+ },
11508
+ "description": "Helper text below the slider"
11509
+ },
11510
+ {
11511
+ "name": "error",
11512
+ "type": {
11513
+ "text": "string"
11514
+ },
11515
+ "description": "Error message below the slider"
11516
+ },
11517
+ {
11518
+ "name": "fullwidth",
11519
+ "type": {
11520
+ "text": "boolean"
11521
+ },
11522
+ "description": "Stretch to full width of container"
11523
+ }
11524
+ ],
11525
+ "events": [
11526
+ {
11527
+ "name": "input",
11528
+ "description": "Emitted when the slider value changes.",
11529
+ "type": {
11530
+ "text": "CustomEvent"
11531
+ }
11532
+ },
11533
+ {
11534
+ "name": "change",
11535
+ "description": "Emitted when the slider value changes.",
11536
+ "type": {
11537
+ "text": "CustomEvent"
11538
+ }
11539
+ }
11540
+ ],
11541
+ "slots": [
11542
+ {
11543
+ "name": "",
11544
+ "description": "Slider label text"
11545
+ }
11546
+ ],
11547
+ "cssParts": [
11548
+ {
11549
+ "name": "slider",
11550
+ "description": "Slider container"
11551
+ },
11552
+ {
11553
+ "name": "track",
11554
+ "description": "Track element"
11555
+ },
11556
+ {
11557
+ "name": "fill",
11558
+ "description": "Fill element"
11559
+ },
11560
+ {
11561
+ "name": "thumb",
11562
+ "description": "Single-value thumb"
11563
+ },
11564
+ {
11565
+ "name": "thumb-start",
11566
+ "description": "Range start thumb"
11567
+ },
11568
+ {
11569
+ "name": "thumb-end",
11570
+ "description": "Range end thumb"
11571
+ },
11572
+ {
11573
+ "name": "label",
11574
+ "description": "Label element"
11575
+ },
11576
+ {
11577
+ "name": "helper-text",
11578
+ "description": "The helper/error text element"
11579
+ }
11580
+ ],
11581
+ "cssProperties": [
11582
+ {
11583
+ "name": "--slider-height",
11584
+ "description": "Track height"
11585
+ },
11586
+ {
11587
+ "name": "--slider-size",
11588
+ "description": "Thumb dimensions"
11589
+ },
11590
+ {
11591
+ "name": "--slider-track-bg",
11592
+ "description": "Track background color"
11593
+ },
11594
+ {
11595
+ "name": "--slider-fill",
11596
+ "description": "Active fill color"
11597
+ },
11598
+ {
11599
+ "name": "--slider-thumb-bg",
11600
+ "description": "Thumb background color"
11601
+ },
11602
+ {
11603
+ "name": "--slider-touch-target",
11604
+ "description": "Minimum height of the pointer interaction surface (default 2.75rem)"
11605
+ }
11606
+ ],
11607
+ "demos": [
11608
+ {
11609
+ "url": "",
11610
+ "description": "```html\n<ore-slider value=\"50\" name=\"volume\">Volume</ore-slider>\n<ore-slider range from=\"20\" to=\"80\" color=\"primary\">Price range</ore-slider>\n```"
11611
+ }
11612
+ ]
11613
+ },
11406
11614
  {
11407
11615
  "kind": "function",
11408
11616
  "name": "errorAttr",
@@ -11719,210 +11927,6 @@
11719
11927
  ],
11720
11928
  "description": "Handles form submission relay for form-associated button-like components.\n\nThe inner `<button>` always has `type=\"button\"` so the shadow DOM never\ndrives native form actions directly. This composable intercepts clicks and\nforwards submit/reset to the associated form via `ElementInternals`."
11721
11929
  },
11722
- {
11723
- "kind": "variable",
11724
- "name": "SLIDER_TAG",
11725
- "type": {
11726
- "text": "'ore-slider'"
11727
- },
11728
- "default": "'ore-slider'",
11729
- "description": "A slider for selecting a single numeric value or a numeric range.\n\nAdd the boolean `range` attribute to activate two-thumb range mode."
11730
- },
11731
- {
11732
- "kind": "class",
11733
- "name": "OreSliderElement",
11734
- "tagName": "ore-slider",
11735
- "customElement": true,
11736
- "description": "A slider for selecting a single numeric value or a numeric range.\nAdd the boolean `range` attribute to activate two-thumb range mode.",
11737
- "summary": "",
11738
- "attributes": [
11739
- {
11740
- "name": "min",
11741
- "type": {
11742
- "text": "number"
11743
- },
11744
- "description": "Minimum value (default: 0)",
11745
- "default": "0"
11746
- },
11747
- {
11748
- "name": "max",
11749
- "type": {
11750
- "text": "number"
11751
- },
11752
- "description": "Maximum value (default: 100)",
11753
- "default": "100"
11754
- },
11755
- {
11756
- "name": "step",
11757
- "type": {
11758
- "text": "number"
11759
- },
11760
- "description": "Step increment (default: 1)",
11761
- "default": "1"
11762
- },
11763
- {
11764
- "name": "value",
11765
- "type": {
11766
- "text": "number"
11767
- },
11768
- "description": "Current value (single mode)"
11769
- },
11770
- {
11771
- "name": "from",
11772
- "type": {
11773
- "text": "number"
11774
- },
11775
- "description": "Lower bound (range mode)"
11776
- },
11777
- {
11778
- "name": "to",
11779
- "type": {
11780
- "text": "number"
11781
- },
11782
- "description": "Upper bound (range mode)"
11783
- },
11784
- {
11785
- "name": "range",
11786
- "type": {
11787
- "text": "boolean"
11788
- },
11789
- "description": "Activate range mode"
11790
- },
11791
- {
11792
- "name": "disabled",
11793
- "type": {
11794
- "text": "boolean"
11795
- },
11796
- "description": "Disable interaction"
11797
- },
11798
- {
11799
- "name": "name",
11800
- "type": {
11801
- "text": "string"
11802
- },
11803
- "description": "Form field name (single mode)"
11804
- },
11805
- {
11806
- "name": "color",
11807
- "type": {
11808
- "text": "'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'"
11809
- },
11810
- "description": "Theme color: 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error'"
11811
- },
11812
- {
11813
- "name": "size",
11814
- "type": {
11815
- "text": "'sm' | 'md' | 'lg'"
11816
- },
11817
- "description": "'sm' | 'md' | 'lg'"
11818
- },
11819
- {
11820
- "name": "helper",
11821
- "type": {
11822
- "text": "string"
11823
- },
11824
- "description": "Helper text below the slider"
11825
- },
11826
- {
11827
- "name": "error",
11828
- "type": {
11829
- "text": "string"
11830
- },
11831
- "description": "Error message below the slider"
11832
- },
11833
- {
11834
- "name": "fullwidth",
11835
- "type": {
11836
- "text": "boolean"
11837
- },
11838
- "description": "Stretch to full width of container"
11839
- }
11840
- ],
11841
- "events": [
11842
- {
11843
- "name": "input",
11844
- "description": "Emitted when the slider value changes.",
11845
- "type": {
11846
- "text": "CustomEvent"
11847
- }
11848
- },
11849
- {
11850
- "name": "change",
11851
- "description": "Emitted when the slider value changes.",
11852
- "type": {
11853
- "text": "CustomEvent"
11854
- }
11855
- }
11856
- ],
11857
- "slots": [
11858
- {
11859
- "name": "",
11860
- "description": "Slider label text"
11861
- }
11862
- ],
11863
- "cssParts": [
11864
- {
11865
- "name": "slider",
11866
- "description": "Slider container"
11867
- },
11868
- {
11869
- "name": "track",
11870
- "description": "Track element"
11871
- },
11872
- {
11873
- "name": "fill",
11874
- "description": "Fill element"
11875
- },
11876
- {
11877
- "name": "thumb",
11878
- "description": "Single-value thumb"
11879
- },
11880
- {
11881
- "name": "thumb-start",
11882
- "description": "Range start thumb"
11883
- },
11884
- {
11885
- "name": "thumb-end",
11886
- "description": "Range end thumb"
11887
- },
11888
- {
11889
- "name": "label",
11890
- "description": "Label element"
11891
- },
11892
- {
11893
- "name": "helper-text",
11894
- "description": "The helper/error text element"
11895
- }
11896
- ],
11897
- "cssProperties": [
11898
- {
11899
- "name": "--slider-height",
11900
- "description": "Track height"
11901
- },
11902
- {
11903
- "name": "--slider-size",
11904
- "description": "Thumb dimensions"
11905
- },
11906
- {
11907
- "name": "--slider-track-bg",
11908
- "description": "Track background color"
11909
- },
11910
- {
11911
- "name": "--slider-fill",
11912
- "description": "Active fill color"
11913
- },
11914
- {
11915
- "name": "--slider-thumb-bg",
11916
- "description": "Thumb background color"
11917
- }
11918
- ],
11919
- "demos": [
11920
- {
11921
- "url": "",
11922
- "description": "```html\n<ore-slider value=\"50\" name=\"volume\">Volume</ore-slider>\n<ore-slider range from=\"20\" to=\"80\" color=\"primary\">Price range</ore-slider>\n```"
11923
- }
11924
- ]
11925
- },
11926
11930
  {
11927
11931
  "kind": "variable",
11928
11932
  "name": "SWITCH_TAG",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vielzeug/codex",
3
- "version": "26.11.23",
3
+ "version": "26.11.24",
4
4
  "description": "MCP server exposing all Vielzeug docs to AI clients",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^26.6.6",
55
- "@vielzeug/refine": "26.11.23",
55
+ "@vielzeug/refine": "26.11.24",
56
56
  "typescript": "^6.0.3",
57
57
  "vitest": "^5.1.0"
58
58
  }