@vielzeug/codex 26.11.23 → 26.11.25
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.
- package/README.md +5 -4
- package/data/snapshot.json +1 -0
- package/dist/catalog.d.ts +35 -39
- package/dist/catalog.js +112 -139
- package/dist/catalog.js.map +1 -1
- package/dist/cli.js +25 -16
- package/dist/cli.js.map +1 -1
- package/dist/http.js +1 -1
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.js +4 -6
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +9 -7
- package/dist/server.js +14 -6
- package/dist/server.js.map +1 -1
- package/dist/snapshot.d.ts +8 -22
- package/dist/snapshot.js +41 -176
- package/dist/snapshot.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/packages.js +49 -82
- package/dist/tools/packages.js.map +1 -1
- package/dist/tools/refine.d.ts +1 -2
- package/dist/tools/refine.js +90 -82
- package/dist/tools/refine.js.map +1 -1
- package/dist/tools/schema.d.ts +2 -1
- package/dist/tools/schema.js +9 -5
- package/dist/tools/schema.js.map +1 -1
- package/dist/tools/shared.d.ts +2 -2
- package/dist/types.d.ts +77 -64
- package/dist/types.js +6 -2
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
- package/skills/vielzeug/SKILL.md +18 -20
- package/data/catalog.json +0 -2536
- package/data/llms-full.txt +0 -40710
- package/data/llms.txt +0 -60
- package/data/manifest.json +0 -4
- package/data/packages/archive.json +0 -87
- package/data/packages/arsenal.json +0 -270
- package/data/packages/assay.json +0 -52
- package/data/packages/atlas.json +0 -70
- package/data/packages/bard.json +0 -38
- package/data/packages/beacon.json +0 -51
- package/data/packages/clockwork.json +0 -69
- package/data/packages/codex.json +0 -37
- package/data/packages/coins.json +0 -99
- package/data/packages/conduit.json +0 -67
- package/data/packages/courier.json +0 -66
- package/data/packages/dnd.json +0 -60
- package/data/packages/familiar.json +0 -38
- package/data/packages/flux.json +0 -97
- package/data/packages/focus.json +0 -51
- package/data/packages/forge.json +0 -65
- package/data/packages/gesture.json +0 -65
- package/data/packages/herald.json +0 -80
- package/data/packages/illusionist.json +0 -132
- package/data/packages/ink.json +0 -32
- package/data/packages/keymap.json +0 -55
- package/data/packages/ledger.json +0 -60
- package/data/packages/lingua.json +0 -68
- package/data/packages/mesh.json +0 -52
- package/data/packages/necromancer.json +0 -55
- package/data/packages/orbit.json +0 -100
- package/data/packages/ore.json +0 -78
- package/data/packages/palette.json +0 -42
- package/data/packages/patchwork.json +0 -55
- package/data/packages/postmaster.json +0 -49
- package/data/packages/prism.json +0 -99
- package/data/packages/pulse.json +0 -71
- package/data/packages/refine.json +0 -36
- package/data/packages/ripple.json +0 -84
- package/data/packages/rune.json +0 -78
- package/data/packages/sandbox.json +0 -26
- package/data/packages/scout.json +0 -66
- package/data/packages/scribe.json +0 -57
- package/data/packages/scroll.json +0 -110
- package/data/packages/sentinel.json +0 -46
- package/data/packages/sigil.json +0 -52
- package/data/packages/sourcerer.json +0 -86
- package/data/packages/spell.json +0 -126
- package/data/packages/stage.json +0 -25
- package/data/packages/tabula.json +0 -39
- package/data/packages/tandem.json +0 -31
- package/data/packages/tavern.json +0 -34
- package/data/packages/tempo.json +0 -68
- package/data/packages/vault.json +0 -81
- package/data/packages/ward.json +0 -77
- package/data/packages/wayfinder.json +0 -126
- package/data/packages/wire.json +0 -36
- package/data/refine.json +0 -17273
- package/dist/consumer.d.ts +0 -17
- package/dist/consumer.js +0 -114
- package/dist/consumer.js.map +0 -1
- package/dist/port.d.ts +0 -2
- package/dist/port.js +0 -12
- package/dist/port.js.map +0 -1
package/data/packages/wire.json
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
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",
|
|
3
|
-
"docs": {
|
|
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",
|
|
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
|
-
},
|
|
9
|
-
"examples": [
|
|
10
|
-
{
|
|
11
|
-
"id": "wire-routing",
|
|
12
|
-
"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')",
|
|
13
|
-
"name": "orthogonalRoute - Edges around nodes"
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"typeSignatures": {
|
|
17
|
-
"BezierRouteOptions": "export { type BezierRouteOptions, bezierRoute } from './bezier.js';",
|
|
18
|
-
"bezierRoute": "export { type BezierRouteOptions, bezierRoute } from './bezier.js';",
|
|
19
|
-
"WireConfigError": "export { WireConfigError, WireError, WireGraphError } from './errors.js';",
|
|
20
|
-
"WireError": "export { WireConfigError, WireError, WireGraphError } from './errors.js';",
|
|
21
|
-
"WireGraphError": "export { WireConfigError, WireError, WireGraphError } from './errors.js';",
|
|
22
|
-
"findCyclicGroups": "export { findCyclicGroups, topologicalOrder } from './graph.js';",
|
|
23
|
-
"topologicalOrder": "export { findCyclicGroups, topologicalOrder } from './graph.js';",
|
|
24
|
-
"OrthogonalRouteOptions": "export { type OrthogonalRouteOptions, orthogonalRoute } from './orthogonal.js';",
|
|
25
|
-
"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';",
|
|
29
|
-
"CubicBezier": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
|
|
30
|
-
"Edge": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
|
|
31
|
-
"Point": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
|
|
32
|
-
"PortAnchor": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
|
|
33
|
-
"PortSide": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';",
|
|
34
|
-
"Rect": "export type { CubicBezier, Edge, Point, PortAnchor, PortSide, Rect } from './types.js';"
|
|
35
|
-
}
|
|
36
|
-
}
|