@rasamjs/connectors 0.1.0 → 0.3.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.
package/API.md CHANGED
@@ -6,19 +6,23 @@ connector option/state/geometry types. Optional `./tool` exports `ConnectorTool`
6
6
 
7
7
  ## Model and history
8
8
 
9
- `new Connectors(drawing)` attaches one service to an owning SVG root. Existing saved
9
+ `new Connectors(drawing, options?)` attaches one service to an owning SVG root. Existing saved
10
10
  connectors are validated without rewriting their stored geometry. No history recorder
11
11
  is created; supply your own if needed.
12
12
 
13
13
  `create(options)` returns an ordinary `Path` in one labelled core change group:
14
14
 
15
- - `start`, `end`: `{ target, anchor? }` or `{ point: { x, y } }`. Free points use drawing
16
- units. Targets are transformable shapes/groups/viewports in the same drawing,
15
+ - `start`, `end`: `{ target, anchor? }`, `{ target, port }` or `{ point: { x, y } }`.
16
+ Free points use drawing units. Targets are transformable shapes/groups/viewports in the same drawing,
17
17
  excluding the root, connectors and groups containing connectors.
18
18
  - `anchor`: `auto` (default), `top`, `right`, `bottom`, `left`, or `{ x, y }` normalized
19
19
  between 0 and 1 within the target's local geometric bounds. `{ x: 1, y: 0.5 }` is
20
20
  right-center and follows resizing. Sides rotate with the target. Auto intersects the
21
21
  ray toward the other endpoint with the local bounds rectangle.
22
+ - `port`: the name of one of the target's ports, read structurally from its
23
+ `portDefinitions` (core's `PortDefinition`), such as a component's `ports()`. The end
24
+ sits exactly on the port and leaves along the port's side, transformed with the
25
+ target; a port without a side has no lead. An unknown port rejects the edit.
22
26
  - `routing`: `straight` (default) or `elbow`. Elbows use orthogonal drawing-space
23
27
  segments with 16-unit outward leads. They do not avoid obstacles; close/opposing
24
28
  anchors can produce backtracking. Curved routing and connector labels are deferred.
@@ -27,8 +31,9 @@ is created; supply your own if needed.
27
31
  - `stroke`: nonempty SVG paint, default `#334155`; `strokeWidth`: finite nonnegative
28
32
  number, default 2. Edit subsequent appearance through ordinary path APIs.
29
33
 
30
- `nodes` is a frozen snapshot of current paths in document order. `read(path)` returns
31
- `{ path, start, end, routing }`. `update(path, { start?, end?, routing? })` changes a
34
+ `nodes` is a frozen snapshot of current paths in document order. `links(target, port?)`
35
+ lists the connectors with an end on `target`, or only on its port named `port`, in
36
+ the same order. `read(path)` returns `{ path, start, end, routing }`. `update(path, { start?, end?, routing? })` changes a
32
37
  connection in one labelled edit. `remove(path)` detaches it reversibly in one edit;
33
38
  its marker resources remain available. Undoing creation also removes newly created
34
39
  endpoint IDs and markers. Undo/redo retain path and endpoint identities.
@@ -39,10 +44,21 @@ operation/group, including ordinary setters, transformer gestures and transactio
39
44
  Getter-only operations do not route. Replay and rollback restore saved path data
40
45
  without recomputing it. Camera changes with source `viewport` do not route.
41
46
 
47
+ Only the connectors a change reaches are routed: those inside a changed subtree and
48
+ those attached to a changed node, its descendants or its ancestors. Attachments are
49
+ found through core's typed-reference index (`context.defs.consumersOf(target)`), so a
50
+ move costs about the same with 10 or 1,000 connectors in the drawing. `links()` uses the
51
+ same index. `bun run bench` measures 500 parts with 10 and 1,000 links
52
+ (`reports/benchmark.json`; `--revision=<commit>` measures older connector sources).
53
+
42
54
  Geometry uses fill bounds, excluding strokes and clipping. Curved/irregular targets
43
55
  use their bounds rectangle for automatic anchors. Empty/unavailable geometry or an
44
- unmappable automatic anchor/path rejects creation/update. Existing paths retain their last geometry
45
- while targets are detached or unmappable; undo and later changes restore tracking.
56
+ unmappable automatic anchor/path rejects creation/update. When a target leaves the
57
+ drawing (removal, Delete, Cut, or removing a parent) or its port disappears (for
58
+ example after a prop change), that end becomes a loose point where the path ends now,
59
+ in the same operation and undo step, and the target is no longer referenced. Undo
60
+ restores the attachment. Existing paths retain their last geometry while targets are
61
+ unmappable.
46
62
  A connector cannot be placed inside its own endpoint target, which would make routing
47
63
  cyclic. Failed connector commands cancel partial edits. Caller setters follow core's
48
64
  failure semantics; use a history transaction for rollback when dependent writes fail.
@@ -52,19 +68,47 @@ The service discovers imported/cloned paths at operation boundaries without regi
52
68
  removing document paths. `onDispose(callback)` returns an unsubscribe function.
53
69
  Drawing disposal destroys the service and its tools. Recreate for a replacement drawing.
54
70
 
71
+ ## Custom routing
72
+
73
+ Since 0.3.0, `ConnectorsOptions.route?: ConnectorRouter` replaces built-in model routing for that
74
+ service. A `ConnectorRouter` receives `{ path, start, end, routing }` and returns at
75
+ least two finite `Point`s in drawing units, or `null`. Connectors converts the points
76
+ to path-local coordinates and writes the line segments in the triggering edit. The
77
+ callback can read application metadata on `path`; it must not mutate the drawing or
78
+ call connector commands. It receives loose endpoints after a target/port disappears.
79
+
80
+ Returning `null` retains an existing path's geometry during derived edits, without
81
+ falling back to built-in routing. It rejects explicit `create`/`update` commands and
82
+ cancels those commands' edits. Invalid results and callback exceptions propagate;
83
+ caller setters follow the core failure semantics described above. Custom routing
84
+ does not require endpoint bounds, though referenced targets must still be live.
85
+
86
+ The callback is not saved in SVG. Supply it again when creating a service after
87
+ loading; attachment and undo/redo preserve saved geometry without calling it.
88
+ `connectorEditing({ route, tools? })` passes the same policy to its service. The
89
+ optional `ConnectorTool`'s dashed gesture preview retains its built-in straight/elbow
90
+ appearance; applications can own their preview, as the circuit app does. Custom SVG
91
+ commands, obstacle avoidance and link-rendering classes are outside this API.
92
+
55
93
  ## Persistence
56
94
 
57
- Versioned routing, anchors and free points live in `data-rasam-connector`. Attached
95
+ Versioned routing, anchors, ports and free points live in `data-rasam-connector`
96
+ (version 1). A port end is saved as `{ "port": "b" }`; readers without port support
97
+ treat it as an automatic anchor on the same target. Attached
58
98
  targets use typed href fragments in the reserved `data-rasam-connector-start` and
59
99
  `data-rasam-connector-end` attributes. Core recognizes them during clone, export/import
60
100
  and ID remapping. Markers use normal typed URL references. No custom catalog is needed.
61
101
 
62
102
  Cloning a whole group rebinds copied connectors to copied endpoints. Cloning a path
63
- alone shares its external endpoints/markers by default. Exporting a connector alone
64
- includes referenced shapes as dependencies in defs; a whole drawing retains visible
65
- shapes and attachments. Permanently destroying a referenced target requires unbinding
66
- its consumers first; editor deletion uses reversible removal. Use the matching current
67
- core build while these APIs remain unreleased.
103
+ alone shares its external endpoints/markers by default. Targets are links, not
104
+ resources: exporting, copying or duplicating a connector never copies the shapes it
105
+ joins into defs. Importing or pasting one whose target was left out turns that end into
106
+ a loose point where it was, and ends whose targets were copied along rebind to the
107
+ copies. A whole drawing retains visible shapes and attachments. Permanently destroying
108
+ a target that a connector still references is refused, as for any referenced node;
109
+ editor deletion uses reversible removal, which loosens those ends first. Connectors
110
+ 0.2.0 requires core 0.3.0 or a compatible newer 0.3.x release. Earlier connector
111
+ versions do not provide the named-port or partial-copy behavior above.
68
112
 
69
113
  ## Geometry helpers
70
114
 
@@ -85,8 +129,13 @@ same routing/arrows/stroke/strokeWidth settings, plus:
85
129
  - `onError(error)`: receives pointer/callback errors; otherwise errors propagate.
86
130
  - `onExit()`: runs after Escape exits an idle enabled tool.
87
131
 
88
- Hover shows four side hints, five overlay pixels in radius at every zoom. Press within
89
- twelve client pixels of a side to choose it; body presses use auto anchors. Empty-space
132
+ Hover shows four side hints, five overlay pixels in radius at every zoom. A target with
133
+ ports, such as a component, shows its ports instead (`data-connector-port`). Press or
134
+ release within twelve client pixels of a hint to choose it, a side anchor or a
135
+ `{ target, port }` end; the chosen hint is filled (`data-connector-active`). Other
136
+ body presses use auto anchors. Hit testing never reports groups, so a hit that
137
+ `selectable` rejects, such as a component's rendered child, resolves to its nearest
138
+ accepted ancestor. Empty-space
90
139
  presses/releases use free points. Previews never edit the document. Release creates one
91
140
  labelled edit; coincident endpoints create nothing. The tool stays enabled so the app
92
141
  can choose keep-tool behavior.
@@ -100,13 +149,15 @@ switching other application modes.
100
149
 
101
150
  ## Editor integration entry
102
151
 
103
- `@rasamjs/connectors/editor` exports `connectorEditing()`, a structural extension
152
+ `@rasamjs/connectors/editor` exports `connectorEditing(options?)`, a structural extension
104
153
  factory. Its value is the current `Connectors` service. It registers
105
- `connector-straight` (C) and `connector-elbow` (Shift+C), with matching command IDs,
106
- active-tool metadata, current selection/layer restrictions, paint, keep-tool and
107
- camera/capture cleanup. Escape cancels a drag first and exits an idle tool;
108
- document replacement, editing/dialog actions, tool changes and disposal interrupt
109
- sessions. Read-only camera commands retain an idle connector mode.
154
+ `connector-straight` (C) and `connector-elbow` (Shift+C), or the `tools` you pass:
155
+ `ConnectorEditingTool` entries `{ id, label, key, routing?, arrows?, hint? }`, for
156
+ example `{ id: 'wire', label: 'Wire', key: 'W', routing: 'elbow', arrows: 'none' }`.
157
+ Each tool has a matching command ID and active-tool metadata, current selection/layer
158
+ restrictions, paint, keep-tool and camera/capture cleanup. Escape cancels a drag first
159
+ and exits an idle tool; document replacement, editing/dialog actions, tool changes and
160
+ disposal interrupt sessions. Read-only camera commands retain an idle connector mode.
110
161
 
111
162
  `ConnectorTool.paint` reads an immutable `{ stroke, strokeWidth }` snapshot and
112
163
  accepts a validated replacement. Updates repaint an active preview and apply to
package/CHANGELOG.md CHANGED
@@ -2,6 +2,42 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.3.0 — 2026-11-07
6
+
7
+ - Add `new Connectors(drawing, { route })` and `connectorEditing({ route })` for an
8
+ application-owned polyline router. Returned drawing-space points replace the
9
+ built-in route; null retains imported geometry for diagnostics. The callback is
10
+ not serialized or called on service attachment, replay or viewport changes.
11
+ - Circuit app now supplies its grid router directly, removing the second routing
12
+ pass during edits and live component paints.
13
+
14
+ ## 0.2.0 — 2026-11-07
15
+
16
+ - Ignore disposed derived children when finding affected links during component
17
+ hydration, so copying and pasting rendered components keeps its undo step.
18
+ - Attach ends to named ports with `{ target, port }`, read structurally from
19
+ `portDefinitions` such as a component's `ports()`. Port ends sit exactly on the port,
20
+ lead out along its side and save as `{ "port": "b" }` in version 1 metadata.
21
+ - When a target leaves the drawing or its port disappears, that end becomes a loose
22
+ point where it was, in the same undo step; undo reattaches it. Deleted targets are no
23
+ longer saved as hidden dependencies in `<defs>`.
24
+ - Copying or pasting a connector without its targets pastes loose ends instead of
25
+ hidden copies of the targets.
26
+ - Add `links(target, port?)`.
27
+ - Route only the connectors a change reaches, found through core's reference index:
28
+ with 500 parts, moving one part 100 times takes 20 ms with 1,000 links (1,726 ms
29
+ before) and 15 ms with 10 links. Creating 1,000 links takes 1.1 s instead of 11.2 s.
30
+ Add `bun run bench`.
31
+ - The tool shows a target's ports instead of its side hints, snaps to the nearest one
32
+ within twelve client pixels, fills the chosen hint, and resolves a rejected hit (such
33
+ as a component's rendered child) to its nearest accepted ancestor.
34
+ - `connectorEditing({ tools })` registers custom tools, such as a Wire tool with elbow
35
+ routing and no arrows, in place of Connector and Elbow connector.
36
+ - TypeScript: `ConnectorEndpoint` has a third, port variant. Narrow with
37
+ `'anchor' in endpoint` before reading `anchor`.
38
+
39
+ ## 0.1.0 — 2026-11-06
40
+
5
41
  - Add `./editor` connector integration with registered tool metadata, live paint,
6
42
  keep-tool and scoped camera/input cleanup. Add `ConnectorTool.paint` for preview updates.
7
43
 
package/README.md CHANGED
@@ -4,7 +4,15 @@ The optional [editor adapter](API.md#editor-integration-entry) packages connecto
4
4
  services and registered straight/elbow tools, including live paint and input cleanup.
5
5
 
6
6
  Attached straight and elbow lines and marker arrows for rasam SVG drawings. Core is
7
- the only runtime peer. This package is unreleased and remains private.
7
+ the only runtime peer. Version 0.3.0 requires `@rasamjs/core@^0.3.0` for named ports,
8
+ loose-end persistence and indexed routing. Source manifests stay private between releases.
9
+
10
+ ```sh
11
+ npm install @rasamjs/core@^0.3.0 @rasamjs/connectors@^0.3.0
12
+ ```
13
+
14
+ The [custom routing option](API.md#custom-routing), added in 0.3.0,
15
+ lets an app supply its own polyline routing without a second path write.
8
16
 
9
17
  ```ts
10
18
  import { SVG } from '@rasamjs/core';
@@ -24,6 +32,10 @@ const tool = new ConnectorTool(connectors, { routing: 'straight' });
24
32
  tool.enabled = true;
25
33
  ```
26
34
 
35
+ Ends can also attach to a component's named ports, `{ target: chip, port: 'p3' }`, and
36
+ `connectors.links(chip)` lists the connectors on it. Deleting a target keeps its
37
+ connectors, with a loose end where it was.
38
+
27
39
  Moving or resizing an endpoint, or its parent, updates the connector inside the same
28
40
  model operation and change group. History records one undo step for a move and all
29
41
  its attached lines. Replay restores stored geometry without routing again.
@@ -42,4 +54,5 @@ bun run --cwd packages/connectors test
42
54
  bun run --cwd packages/connectors test:browser
43
55
  bun run --cwd packages/connectors typecheck
44
56
  bun run --cwd packages/connectors build
57
+ bun run --cwd packages/connectors bench
45
58
  ```
package/RELEASING.md CHANGED
@@ -1,7 +1,17 @@
1
1
  # Releasing connectors
2
2
 
3
- The package remains private and unreleased. Phase 10 does not authorize publishing,
4
- pushing or changing an existing approved size cap.
3
+ The source manifest stays private between releases. Version 0.3.0 is paired with
4
+ core 0.3.0 and adds the custom-routing callback used by the circuit app.
5
+ The owner authorized release preparation, publication and pushing on 2026-11-07.
6
+ Existing approved size caps stay unchanged.
7
+
8
+ Core 0.3.0 and connectors 0.2.0 were published from `917c9df`; their registry
9
+ integrities and exact-tarball consumer validation are recorded in
10
+ [`reports/publication-0.2.0.json`](reports/publication-0.2.0.json). The 0.2.0
11
+ readiness report describes that published baseline. The owner requested
12
+ continuation of the custom-routing release on 2026-11-07. Validate 0.3.0 with a fresh
13
+ release gate and test its exact public tarball against published core 0.3.0 before
14
+ publication. Keep the existing source publication guard.
5
15
 
6
16
  Run scoped format, typecheck, unit, build, API, docs, browser, consumer and size checks.
7
17
  Run `api:update` only after reviewing the API diff. The root's 5 KiB gzip and optional
@@ -1,16 +1,19 @@
1
1
  import { Path } from '@rasamjs/core';
2
2
  import type { Svg } from '@rasamjs/core';
3
- import type { ConnectorOptions, ConnectorState } from './types.js';
3
+ import type { ConnectorOptions, ConnectorState, ConnectorTarget, ConnectorsOptions } from './types.js';
4
4
  export declare class Connectors {
5
5
  readonly drawing: Svg;
6
6
  private disposed;
7
7
  private readonly cleanups;
8
8
  private readonly disposals;
9
- constructor(drawing: Svg);
9
+ private router?;
10
+ constructor(drawing: Svg, options?: ConnectorsOptions);
10
11
  get isDestroyed(): boolean;
11
12
  onDispose(listener: () => void): () => void;
12
13
  get nodes(): readonly Path[];
13
14
  read(path: Path): ConnectorState;
15
+ /** Connectors with an end on `target`, or only on its port named `port`. */
16
+ links(target: ConnectorTarget, port?: string): readonly Path[];
14
17
  create(options: ConnectorOptions): Path;
15
18
  update(path: Path, patch: Partial<Pick<ConnectorOptions, 'start' | 'end' | 'routing'>>): void;
16
19
  remove(path: Path): void;
@@ -19,8 +22,19 @@ export declare class Connectors {
19
22
  private assertPath;
20
23
  private validate;
21
24
  private validateEndpoint;
22
- private affects;
25
+ /** An end whose target left the drawing, or whose port is gone, stays where it is. */
26
+ private loosen;
27
+ /** Connectors in this drawing with an end on `target`, from core's reference index. */
28
+ private attached;
29
+ /**
30
+ * Connectors to route after a change: those inside a changed subtree, and those attached
31
+ * to a changed node, its descendants or its ancestors, since parents move, resize or
32
+ * reparent targets and a descendant changes a group's bounds. The work follows the
33
+ * size of the change, not the number of connectors.
34
+ */
35
+ private affected;
23
36
  private route;
37
+ private defaultRoute;
24
38
  private edit;
25
39
  }
26
40
  //# sourceMappingURL=connectors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectors.d.ts","sourceRoot":"","sources":["../src/connectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,KAAK,EAAE,GAAG,EAAW,MAAM,eAAe,CAAC;AAYlD,OAAO,KAAK,EAAqB,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAkBtF,qBAAa,UAAU;IAIT,QAAQ,CAAC,OAAO,EAAE,GAAG;IAHjC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IACnD,YAAqB,OAAO,EAAE,GAAG,EAuBhC;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IACD,SAAS,CAAC,QAAQ,E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QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAO1C;IACD,IAAI,KAAK,IAAI,SAAS,IAAI,EAAE,CAG3B;IACD,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,CAG/B;IACD,4EAA4E;IAC5E,KAAK,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,IAAI,EAAE,CAiB7D;IACD,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAgCtC;IACD,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC,CAAC,GAAG,IAAI,CAS5F;IACD,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAGvB;IACD,OAAO,IAAI,IAAI,CAed;IACD,OAAO,CAAC,UAAU;IAGlB,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,QAAQ;IAmBhB,OAAO,CAAC,gBAAgB;IA2BxB,sFAAsF;IACtF,OAAO,CAAC,MAAM;IAgBd,uFAAuF;IACvF,OAAO,CAAC,QAAQ;IAYhB;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAehB,OAAO,CAAC,KAAK;IAsBb,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,IAAI;CAgBb"}
@@ -1,8 +1,8 @@
1
1
  import { Path } from '@rasamjs/core';
2
2
  import { Guards } from '@rasamjs/core/advanced';
3
3
  import { beginChangeGroup, deriveChanges } from '@rasamjs/core/changes';
4
- import { isConnector, readConnector, writeConnector } from './metadata.js';
5
- import { connectorPort, endpointCenter, pathData, routeConnector, validateAnchor, validatePoint, } from './routing.js';
4
+ import { endpointAttribute, isConnector, pathEnd, readConnector, unbound, writeConnector, } from './metadata.js';
5
+ import { connectorPort, endpointCenter, findPort, pathData, routeConnector, validateAnchor, validatePoint, } from './routing.js';
6
6
  const owners = new WeakMap();
7
7
  const drawableTags = new Set([
8
8
  'rect',
@@ -24,7 +24,8 @@ export class Connectors {
24
24
  disposed = false;
25
25
  cleanups = [];
26
26
  disposals = new Set();
27
- constructor(drawing) {
27
+ router;
28
+ constructor(drawing, options = {}) {
28
29
  this.drawing = drawing;
29
30
  if (!Guards.isTransformable(drawing) ||
30
31
  drawing.isDestroyed ||
@@ -33,16 +34,23 @@ export class Connectors {
33
34
  throw new TypeError('Connectors needs a live SVG drawing root');
34
35
  if (owners.has(drawing))
35
36
  throw new Error('Connectors is already attached to this drawing');
37
+ if (!options ||
38
+ typeof options !== 'object' ||
39
+ (options.route !== undefined && typeof options.route !== 'function'))
40
+ throw new TypeError('Connector route must be a function');
41
+ this.router = options.route;
36
42
  // Validate saved attachments without changing stored routing during attachment or replay.
37
43
  this.nodes.forEach(readConnector);
38
44
  owners.set(drawing, this);
39
45
  this.cleanups.push(deriveChanges(drawing, (event) => {
40
46
  if (event.source === 'viewport')
41
47
  return;
42
- for (const path of this.nodes) {
43
- const state = readConnector(path);
44
- if (event.nodes.some((changed) => changed === path || this.affects(changed, state)))
45
- this.route(state);
48
+ for (const path of this.affected(event.nodes)) {
49
+ let state = readConnector(path);
50
+ const loose = this.loosen(state);
51
+ if (loose !== state || unbound.has(state.start) || unbound.has(state.end))
52
+ writeConnector(path, (state = loose));
53
+ this.route(state);
46
54
  }
47
55
  }), drawing.onDispose(() => this.destroy()));
48
56
  }
@@ -66,6 +74,20 @@ export class Connectors {
66
74
  this.assertPath(path);
67
75
  return readConnector(path);
68
76
  }
77
+ /** Connectors with an end on `target`, or only on its port named `port`. */
78
+ links(target, port) {
79
+ this.assertLive();
80
+ if (port !== undefined && (typeof port !== 'string' || !port))
81
+ throw new TypeError('Port names must be non-empty strings');
82
+ return Object.freeze(this.attached(target)
83
+ .filter((path) => {
84
+ const { start, end } = readConnector(path);
85
+ return [start, end].some((endpoint) => 'target' in endpoint &&
86
+ endpoint.target === target &&
87
+ (port === undefined || ('port' in endpoint && endpoint.port === port)));
88
+ })
89
+ .sort((a, b) => (a.el.compareDocumentPosition(b.el) & 4 ? -1 : 1)));
90
+ }
69
91
  create(options) {
70
92
  this.assertLive();
71
93
  this.validate(options);
@@ -96,7 +118,7 @@ export class Connectors {
96
118
  path.marker('start', marker);
97
119
  }
98
120
  if (!this.route(readConnector(path)))
99
- throw new Error('Connector needs available bounds and invertible transforms');
121
+ throw new Error('Connector route is unavailable or its transform is not invertible');
100
122
  return path;
101
123
  });
102
124
  }
@@ -107,7 +129,7 @@ export class Connectors {
107
129
  this.edit('Edit connector', () => {
108
130
  writeConnector(path, state);
109
131
  if (!this.route(state))
110
- throw new Error('Connector needs available bounds and invertible transforms');
132
+ throw new Error('Connector route is unavailable or its transform is not invertible');
111
133
  });
112
134
  }
113
135
  remove(path) {
@@ -118,6 +140,7 @@ export class Connectors {
118
140
  if (this.disposed)
119
141
  return;
120
142
  this.disposed = true;
143
+ this.router = undefined;
121
144
  owners.delete(this.drawing);
122
145
  const failures = [];
123
146
  for (const stop of [...this.cleanups.splice(0).reverse(), ...this.disposals]) {
@@ -141,7 +164,7 @@ export class Connectors {
141
164
  if (!isConnector(path) ||
142
165
  path.isDestroyed ||
143
166
  path.context !== this.drawing.context ||
144
- !this.drawing.descendants().includes(path))
167
+ !this.drawing.el.contains(path.el))
145
168
  throw new TypeError('Expected a connector in this drawing');
146
169
  }
147
170
  validate(options) {
@@ -172,43 +195,99 @@ export class Connectors {
172
195
  target.isDestroyed ||
173
196
  target === this.drawing ||
174
197
  target.context !== this.drawing.context ||
175
- !this.drawing.descendants().includes(target) ||
198
+ !this.drawing.el.contains(target.el) ||
176
199
  target.descendants().some(isConnector))
177
200
  throw new TypeError('Endpoint target must be a drawable shape without connectors in this drawing');
178
201
  for (let node = target; node && node !== this.drawing; node = node.parent)
179
202
  if (!drawableTags.has(node.el.localName))
180
203
  throw new TypeError('Connector targets cannot be inside definitions');
181
- validateAnchor(endpoint.anchor ?? 'auto');
204
+ if (!('port' in endpoint))
205
+ return validateAnchor(endpoint.anchor ?? 'auto');
206
+ if ('anchor' in endpoint)
207
+ throw new TypeError('Endpoint needs either a port or an anchor');
208
+ if (typeof endpoint.port !== 'string' || !findPort(target, endpoint.port))
209
+ throw new TypeError(`Unknown connector port: ${String(endpoint.port)}`);
210
+ }
211
+ /** An end whose target left the drawing, or whose port is gone, stays where it is. */
212
+ loosen(state) {
213
+ const loose = (end) => {
214
+ const endpoint = state[end];
215
+ if ('point' in endpoint)
216
+ return endpoint;
217
+ const { target } = endpoint;
218
+ const gone = target.isDestroyed ||
219
+ !this.drawing.el.contains(target.el) ||
220
+ ('port' in endpoint && !findPort(target, endpoint.port));
221
+ const point = gone && pathEnd(state.path, end);
222
+ return point ? { point } : endpoint;
223
+ };
224
+ const start = loose('start'), end = loose('end');
225
+ return start === state.start && end === state.end ? state : { ...state, start, end };
182
226
  }
183
- affects(changed, { path, start, end }) {
184
- // Parents can move, resize, reparent or change a group's local bounds through a descendant.
185
- return [
186
- path,
187
- ...[start, end].flatMap((endpoint) => ('target' in endpoint ? [endpoint.target] : [])),
188
- ].some((node) => node === changed ||
189
- node.descendants().includes(changed) ||
190
- changed.descendants().includes(node));
227
+ /** Connectors in this drawing with an end on `target`, from core's reference index. */
228
+ attached(target) {
229
+ return this.drawing.context.defs
230
+ .consumersOf(target)
231
+ .filter((node) => isConnector(node) &&
232
+ this.drawing.el.contains(node.el) &&
233
+ ['start', 'end'].some((end) => node.references.get(endpointAttribute(end)) === target));
234
+ }
235
+ /**
236
+ * Connectors to route after a change: those inside a changed subtree, and those attached
237
+ * to a changed node, its descendants or its ancestors, since parents move, resize or
238
+ * reparent targets and a descendant changes a group's bounds. The work follows the
239
+ * size of the change, not the number of connectors.
240
+ */
241
+ affected(changed) {
242
+ const paths = new Set(), seen = new Set();
243
+ const visit = (node) => {
244
+ if (node.isDestroyed || seen.has(node))
245
+ return;
246
+ seen.add(node);
247
+ if (isConnector(node) && this.drawing.el.contains(node.el))
248
+ paths.add(node);
249
+ for (const path of this.attached(node))
250
+ paths.add(path);
251
+ };
252
+ for (const node of changed) {
253
+ node.descendants().forEach(visit);
254
+ for (let parent = node.parent; parent; parent = parent.parent)
255
+ visit(parent);
256
+ }
257
+ return paths;
191
258
  }
192
259
  route(state) {
193
260
  const { path, start, end } = state;
194
261
  for (const endpoint of [start, end])
195
262
  if ('target' in endpoint) {
196
- if (endpoint.target.isDestroyed || !this.drawing.descendants().includes(endpoint.target))
263
+ if (endpoint.target.isDestroyed || !this.drawing.el.contains(endpoint.target.el))
197
264
  return false;
198
- if (endpoint.target.descendants().includes(path))
265
+ if (endpoint.target.el.contains(path.el))
199
266
  throw new TypeError('A connector cannot be inside its endpoint target');
200
267
  }
201
- const a = endpointCenter(start), b = endpointCenter(end);
202
- const from = a && b ? connectorPort(start, b) : null;
203
- const to = a && b ? connectorPort(end, a) : null;
204
268
  const inverse = path.worldMatrix().inverse();
205
- if (!from || !to || !inverse)
269
+ if (!inverse)
270
+ return false;
271
+ const points = this.router ? this.router(state) : this.defaultRoute(state);
272
+ if (points === null)
206
273
  return false;
207
- const d = pathData(routeConnector({ start: from, end: to, routing: state.routing }).map((point) => inverse.apply(point)));
274
+ if (!Array.isArray(points) || points.length < 2)
275
+ throw new TypeError('Connector route must return at least two finite points or null');
276
+ for (const point of points)
277
+ validatePoint(point);
278
+ const local = points.map((point) => inverse.apply(point));
279
+ local.forEach((point) => validatePoint(point));
280
+ const d = pathData(local);
208
281
  if (path.getAttributeValue('d') !== d)
209
282
  path.attrs({ d });
210
283
  return true;
211
284
  }
285
+ defaultRoute({ start, end, routing }) {
286
+ const a = endpointCenter(start), b = endpointCenter(end);
287
+ const from = a && b ? connectorPort(start, b) : null;
288
+ const to = a && b ? connectorPort(end, a) : null;
289
+ return from && to ? routeConnector({ start: from, end: to, routing }) : null;
290
+ }
212
291
  edit(label, run) {
213
292
  const group = beginChangeGroup(this.drawing, { source: 'connectors', label });
214
293
  let result;
@@ -1 +1 @@
1
- {"version":3,"file":"connect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C;YACH,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC;gBACH,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,CAAC;YAAC,OAAO,OAAO,EAAE,CAAC;gBACjB,MAAM,IAAI,cAAc,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,oCAAoC,CAAC,CAAC;YACnF,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QACD,KAAK,CAAC,GAAG,EAAE,CAAC;QACZ,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
package/dist/editor.d.ts CHANGED
@@ -1,5 +1,13 @@
1
1
  import type { AnyNode, Svg } from '@rasamjs/core';
2
2
  import { Connectors } from './connectors.js';
3
+ import type { ConnectorOptions, ConnectorsOptions } from './types.js';
4
+ /** One registered connector tool; its id is also its command id. */
5
+ export interface ConnectorEditingTool extends Pick<ConnectorOptions, 'routing' | 'arrows'> {
6
+ readonly id: string;
7
+ readonly label: string;
8
+ readonly key: string;
9
+ readonly hint?: string;
10
+ }
3
11
  export interface ConnectorScope {
4
12
  readonly drawing: Svg;
5
13
  readonly editor: {
@@ -35,7 +43,13 @@ export interface ConnectorScope {
35
43
  created(node: AnyNode): void;
36
44
  exit(): void;
37
45
  }
38
- export declare function connectorEditing(): {
46
+ /**
47
+ * The connectors service and its tools. `tools` replaces the default Connector (`C`)
48
+ * and Elbow connector (`Shift+C`), for example with a Wire tool without arrows.
49
+ */
50
+ export declare function connectorEditing(options?: ConnectorsOptions & {
51
+ readonly tools?: readonly ConnectorEditingTool[];
52
+ }): {
39
53
  id: string;
40
54
  create(scope: ConnectorScope): Connectors;
41
55
  };
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAA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