@rasamjs/connectors 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/API.md +114 -0
  2. package/CHANGELOG.md +13 -0
  3. package/LICENSE +21 -0
  4. package/README.md +44 -2
  5. package/RELEASING.md +25 -0
  6. package/dist/connectors.d.ts +26 -0
  7. package/dist/connectors.d.ts.map +1 -0
  8. package/dist/connectors.js +231 -0
  9. package/dist/connectors.js.map +1 -0
  10. package/dist/editor.d.ts +42 -0
  11. package/dist/editor.d.ts.map +1 -0
  12. package/dist/editor.js +55 -0
  13. package/dist/editor.js.map +1 -0
  14. package/dist/index.d.ts +5 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +4 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/metadata.d.ts +8 -0
  19. package/dist/metadata.d.ts.map +1 -0
  20. package/dist/metadata.js +47 -0
  21. package/dist/metadata.js.map +1 -0
  22. package/dist/routing.d.ts +11 -0
  23. package/dist/routing.d.ts.map +1 -0
  24. package/dist/routing.js +110 -0
  25. package/dist/routing.js.map +1 -0
  26. package/dist/tool-surface.d.ts +21 -0
  27. package/dist/tool-surface.d.ts.map +1 -0
  28. package/dist/tool-surface.js +98 -0
  29. package/dist/tool-surface.js.map +1 -0
  30. package/dist/tool.d.ts +44 -0
  31. package/dist/tool.d.ts.map +1 -0
  32. package/dist/tool.js +305 -0
  33. package/dist/tool.js.map +1 -0
  34. package/dist/types.d.ts +36 -0
  35. package/dist/types.d.ts.map +1 -0
  36. package/dist/types.js +2 -0
  37. package/dist/types.js.map +1 -0
  38. package/package.json +61 -4
  39. package/src/connectors.ts +248 -0
  40. package/src/editor.ts +82 -0
  41. package/src/index.ts +14 -0
  42. package/src/metadata.ts +63 -0
  43. package/src/routing.ts +127 -0
  44. package/src/tool-surface.ts +96 -0
  45. package/src/tool.ts +344 -0
  46. package/src/types.ts +33 -0
package/dist/tool.js ADDED
@@ -0,0 +1,305 @@
1
+ import { Guards, Registry } from '@rasamjs/core/advanced';
2
+ import { observeChanges } from '@rasamjs/core/changes';
3
+ import { isConnector } from './metadata.js';
4
+ import { connectorPort, endpointCenter, pathData, routeConnector } from './routing.js';
5
+ import { ToolSurface, svg } from './tool-surface.js';
6
+ const sides = ['top', 'right', 'bottom', 'left'];
7
+ /** Drag from a hinted anchor or free point. The document is written only on release. */
8
+ export class ConnectorTool {
9
+ connectors;
10
+ surface;
11
+ active = false;
12
+ press = null;
13
+ hover = null;
14
+ options;
15
+ constructor(connectors, options = {}) {
16
+ this.connectors = connectors;
17
+ if (connectors.isDestroyed)
18
+ throw new Error('Connectors is destroyed');
19
+ for (const name of ['selectable', 'onCreate', 'onGesture', 'onError', 'onExit'])
20
+ if (options[name] !== undefined && typeof options[name] !== 'function')
21
+ throw new TypeError(`${name} must be a function`);
22
+ if (options.routing !== undefined && !['straight', 'elbow'].includes(options.routing))
23
+ throw new TypeError('Unknown connector routing');
24
+ if (options.arrows !== undefined && !['none', 'end', 'both'].includes(options.arrows))
25
+ throw new TypeError('Unknown connector arrows');
26
+ if (options.stroke !== undefined &&
27
+ (typeof options.stroke !== 'string' || !options.stroke.trim()))
28
+ throw new TypeError('Connector stroke must be nonempty');
29
+ if (options.strokeWidth !== undefined &&
30
+ (!Number.isFinite(options.strokeWidth) || options.strokeWidth < 0))
31
+ throw new TypeError('Connector stroke width must be nonnegative');
32
+ this.options = { ...options };
33
+ this.surface = new ToolSurface(connectors.drawing, () => this.render());
34
+ this.surface.cleanup(connectors.onDispose(() => this.destroy()));
35
+ this.surface.cleanup(observeChanges(connectors.drawing, () => {
36
+ const attached = (endpoint) => 'point' in endpoint ||
37
+ (!endpoint.target.isDestroyed && connectors.drawing.el.contains(endpoint.target.el));
38
+ if (this.press && (!attached(this.press.start) || !attached(this.press.end)))
39
+ this.cancel();
40
+ if (this.hover && !attached(this.hover.endpoint))
41
+ this.hover = null;
42
+ this.surface.schedule();
43
+ }));
44
+ this.surface.listen(this.surface.element, 'pointerdown', this.down);
45
+ this.surface.listen(this.surface.element, 'pointermove', this.over);
46
+ this.surface.listen(this.surface.element, 'pointerleave', () => {
47
+ if (!this.press) {
48
+ this.hover = null;
49
+ this.update();
50
+ }
51
+ });
52
+ this.surface.listen(this.surface.view, 'pointermove', this.move);
53
+ this.surface.listen(this.surface.view, 'pointerup', this.up);
54
+ this.surface.listen(this.surface.view, 'pointercancel', this.lost);
55
+ this.surface.listen(this.surface.element, 'lostpointercapture', this.lost);
56
+ this.surface.listen(this.surface.view, 'blur', () => this.cancel());
57
+ this.surface.listen(this.surface.view, 'keydown', ((event) => {
58
+ if (!this.enabled ||
59
+ event.key !== 'Escape' ||
60
+ event.defaultPrevented ||
61
+ !this.acceptsKeyboard(event))
62
+ return;
63
+ event.preventDefault();
64
+ event.stopPropagation();
65
+ if (this.press)
66
+ this.cancel();
67
+ else {
68
+ this.enabled = false;
69
+ this.options.onExit?.();
70
+ }
71
+ }), true);
72
+ this.surface.cleanup(() => {
73
+ this.active = false;
74
+ this.cancel();
75
+ });
76
+ }
77
+ get isDestroyed() {
78
+ return this.surface.isDestroyed;
79
+ }
80
+ get enabled() {
81
+ return this.active;
82
+ }
83
+ get paint() {
84
+ return Object.freeze({
85
+ stroke: this.options.stroke ?? '#334155',
86
+ strokeWidth: this.options.strokeWidth ?? 2,
87
+ });
88
+ }
89
+ set paint(paint) {
90
+ if (this.isDestroyed)
91
+ throw new Error('Connector tool is destroyed');
92
+ if (!paint ||
93
+ typeof paint.stroke !== 'string' ||
94
+ !paint.stroke.trim() ||
95
+ !Number.isFinite(paint.strokeWidth) ||
96
+ paint.strokeWidth < 0)
97
+ throw new TypeError('Invalid connector paint');
98
+ this.options = { ...this.options, stroke: paint.stroke, strokeWidth: paint.strokeWidth };
99
+ this.update();
100
+ }
101
+ set enabled(value) {
102
+ if (this.isDestroyed || this.connectors.isDestroyed)
103
+ throw new Error('Connector tool is destroyed');
104
+ if (typeof value !== 'boolean')
105
+ throw new TypeError('Connector tool enabled must be boolean');
106
+ if (this.active === value)
107
+ return;
108
+ this.cancel();
109
+ this.active = value;
110
+ this.hover = null;
111
+ this.surface.element.style.pointerEvents = value ? 'all' : 'none';
112
+ this.surface.element.style.cursor = value ? 'crosshair' : '';
113
+ this.update();
114
+ }
115
+ update() {
116
+ this.surface.update();
117
+ return this;
118
+ }
119
+ destroy() {
120
+ this.surface.destroy();
121
+ }
122
+ cancel() {
123
+ const press = this.press;
124
+ this.press = null;
125
+ if (press) {
126
+ if (this.surface.element.hasPointerCapture(press.id))
127
+ this.surface.element.releasePointerCapture(press.id);
128
+ this.options.onGesture?.(false);
129
+ }
130
+ this.update();
131
+ }
132
+ acceptsKeyboard(event) {
133
+ const document = this.surface.element.ownerDocument, active = document.activeElement;
134
+ return (!document.querySelector('dialog[open],[role="dialog"][aria-modal="true"]') &&
135
+ !event.target?.closest?.('input,textarea,select,[contenteditable]:not([contenteditable="false"])') &&
136
+ (active === document.body ||
137
+ (!!active && this.surface.element.parentElement.contains(active))));
138
+ }
139
+ attempt(run) {
140
+ try {
141
+ run();
142
+ }
143
+ catch (error) {
144
+ try {
145
+ this.cancel();
146
+ }
147
+ catch (cleanup) {
148
+ error = new AggregateError([error, cleanup], 'Connector tool and cleanup failed');
149
+ }
150
+ if (this.options.onError)
151
+ this.options.onError(error);
152
+ else
153
+ throw error;
154
+ }
155
+ }
156
+ pick(event) {
157
+ const drawing = this.connectors.drawing;
158
+ const point = drawing.fromClient({ x: event.clientX, y: event.clientY });
159
+ if (!point)
160
+ return null;
161
+ const targets = drawing.el.ownerDocument
162
+ .elementsFromPoint(event.clientX, event.clientY)
163
+ .map((element) => Registry.wrapper(element));
164
+ let target = targets.find((node) => Guards.isTransformable(node) &&
165
+ node !== drawing &&
166
+ drawing.el.contains(node.el) &&
167
+ !isConnector(node) &&
168
+ !node.descendants().some(isConnector) &&
169
+ this.options.selectable?.(node) !== false);
170
+ // The outer half of an anchor hint can lie just outside its shape's hit area.
171
+ const previous = this.hover?.target;
172
+ if (!target &&
173
+ previous &&
174
+ !previous.isDestroyed &&
175
+ drawing.el.contains(previous.el) &&
176
+ this.options.selectable?.(previous) !== false) {
177
+ const nearHint = sides.some((anchor) => {
178
+ const port = connectorPort({ target: previous, anchor }, point);
179
+ const client = port && drawing.toClient(port.point);
180
+ return client && Math.hypot(client.x - event.clientX, client.y - event.clientY) < 12;
181
+ });
182
+ if (nearHint)
183
+ target = previous;
184
+ }
185
+ this.hover = null;
186
+ if (!target)
187
+ return { point };
188
+ let endpoint = { target, anchor: 'auto' };
189
+ let nearest = 12;
190
+ for (const anchor of sides) {
191
+ const port = connectorPort({ target, anchor }, point);
192
+ const client = port && drawing.toClient(port.point);
193
+ if (!client)
194
+ continue;
195
+ const distance = Math.hypot(client.x - event.clientX, client.y - event.clientY);
196
+ if (distance < nearest) {
197
+ nearest = distance;
198
+ endpoint = { target, anchor };
199
+ }
200
+ }
201
+ this.hover = { target, endpoint };
202
+ return endpoint;
203
+ }
204
+ over = (event) => {
205
+ if (!this.enabled || this.press || !event.isPrimary || event.buttons)
206
+ return;
207
+ this.attempt(() => {
208
+ this.pick(event);
209
+ this.update();
210
+ });
211
+ };
212
+ down = (event) => {
213
+ if (!this.enabled ||
214
+ this.press ||
215
+ !event.isPrimary ||
216
+ event.button !== 0 ||
217
+ event.defaultPrevented)
218
+ return;
219
+ this.attempt(() => {
220
+ const endpoint = this.pick(event);
221
+ if (!endpoint)
222
+ return;
223
+ this.surface.element.setPointerCapture(event.pointerId);
224
+ this.press = { id: event.pointerId, start: endpoint, end: endpoint };
225
+ event.preventDefault();
226
+ event.stopPropagation();
227
+ this.options.onGesture?.(true);
228
+ this.update();
229
+ });
230
+ };
231
+ move = (event) => {
232
+ if (event.pointerId !== this.press?.id)
233
+ return;
234
+ this.attempt(() => {
235
+ const endpoint = this.pick(event);
236
+ if (endpoint && this.press)
237
+ this.press.end = endpoint;
238
+ this.update();
239
+ });
240
+ };
241
+ up = (event) => {
242
+ if (event.pointerId !== this.press?.id)
243
+ return;
244
+ this.attempt(() => {
245
+ const press = this.press, end = this.pick(event) ?? press.end;
246
+ this.cancel();
247
+ const a = endpointCenter(press.start), b = endpointCenter(end);
248
+ if (!a || !b || Math.hypot(a.x - b.x, a.y - b.y) < 1e-6)
249
+ return;
250
+ const path = this.connectors.create({ ...this.options, start: press.start, end });
251
+ this.options.onCreate?.(path);
252
+ });
253
+ };
254
+ lost = (event) => {
255
+ if (event.pointerId === this.press?.id)
256
+ this.cancel();
257
+ };
258
+ render() {
259
+ const overlay = this.surface.element;
260
+ overlay.replaceChildren();
261
+ if (!this.enabled)
262
+ return;
263
+ const document = overlay.ownerDocument;
264
+ if (this.hover)
265
+ for (const anchor of sides) {
266
+ const port = connectorPort({ target: this.hover.target, anchor }, { x: 0, y: 0 });
267
+ const point = port && this.surface.fromRoot(port.point);
268
+ if (point)
269
+ overlay.append(svg(document, 'circle', {
270
+ cx: point.x,
271
+ cy: point.y,
272
+ r: 5,
273
+ fill: 'white',
274
+ stroke: '#2563eb',
275
+ 'stroke-width': 1.5,
276
+ 'pointer-events': 'none',
277
+ 'data-connector-anchor': anchor,
278
+ }));
279
+ }
280
+ if (!this.press)
281
+ return;
282
+ const { start, end } = this.press;
283
+ const a = endpointCenter(start), b = endpointCenter(end);
284
+ const from = a && b ? connectorPort(start, b) : null, to = a && b ? connectorPort(end, a) : null;
285
+ if (!from || !to)
286
+ return;
287
+ const points = routeConnector({
288
+ start: from,
289
+ end: to,
290
+ routing: this.options.routing ?? 'straight',
291
+ }).map((point) => this.surface.fromRoot(point));
292
+ if (points.some((point) => !point))
293
+ return;
294
+ overlay.append(svg(document, 'path', {
295
+ d: pathData(points),
296
+ fill: 'none',
297
+ stroke: this.options.stroke ?? '#334155',
298
+ 'stroke-width': this.options.strokeWidth ?? 2,
299
+ 'stroke-dasharray': '5 4',
300
+ 'pointer-events': 'none',
301
+ 'data-connector-preview': '',
302
+ }));
303
+ }
304
+ }
305
+ //#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,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC;YAAE,OAAO;QAC3C,OAAO,CAAC,MAAM,CACZ,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE;YACpB,CAAC,EAAE,QAAQ,CAAC,MAAiB,CAAC;YAC9B,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,SAAS;YACxC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC;YAC7C,kBAAkB,EAAE,KAAK;YACzB,gBAAgB,EAAE,MAAM;YACxB,wBAAwB,EAAE,EAAE;SAC7B,CAAC,CACH,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ import type { Point, Shape, Group, Svg, Path } from '@rasamjs/core';
2
+ export type ConnectorTarget = Shape | Group | Svg;
3
+ export type ConnectorSide = 'top' | 'right' | 'bottom' | 'left';
4
+ /** A point is normalized within the target's local geometric bounds. */
5
+ export type ConnectorAnchor = 'auto' | ConnectorSide | Point;
6
+ export type ConnectorEndpoint = {
7
+ readonly target: ConnectorTarget;
8
+ readonly anchor?: ConnectorAnchor;
9
+ } | {
10
+ readonly point: Point;
11
+ };
12
+ export type ConnectorRouting = 'straight' | 'elbow';
13
+ export interface ConnectorOptions {
14
+ readonly start: ConnectorEndpoint;
15
+ readonly end: ConnectorEndpoint;
16
+ readonly routing?: ConnectorRouting;
17
+ readonly arrows?: 'none' | 'end' | 'both';
18
+ readonly stroke?: string;
19
+ readonly strokeWidth?: number;
20
+ }
21
+ export interface ConnectorState {
22
+ readonly path: Path;
23
+ readonly start: ConnectorEndpoint;
24
+ readonly end: ConnectorEndpoint;
25
+ readonly routing: ConnectorRouting;
26
+ }
27
+ export interface ConnectorPort {
28
+ readonly point: Point;
29
+ readonly direction: Point;
30
+ }
31
+ export interface ConnectorRoute {
32
+ readonly start: ConnectorPort;
33
+ readonly end: ConnectorPort;
34
+ readonly routing: ConnectorRouting;
35
+ }
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEpE,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,GAAG,CAAC;AAClD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAChE,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,aAAa,GAAG,KAAK,CAAC;AAC7D,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,CAAA;CAAE,GACvE;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAC9B,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,OAAO,CAAC;AACpD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AACD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;CACpC;AACD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC;CAC3B;AACD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC;CACpC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "@rasamjs/connectors",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "description": "Attached straight and elbow connectors for rasam SVG drawings.",
7
+ "files": [
8
+ "dist",
9
+ "src",
10
+ "README.md",
11
+ "API.md",
12
+ "CHANGELOG.md",
13
+ "RELEASING.md",
14
+ "LICENSE"
15
+ ],
16
+ "types": "./dist/index.d.ts",
17
+ "exports": {
18
+ ".": {
19
+ "rasam-source": "./src/index.ts",
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ },
23
+ "./tool": {
24
+ "rasam-source": "./src/tool.ts",
25
+ "types": "./dist/tool.d.ts",
26
+ "import": "./dist/tool.js"
27
+ },
28
+ "./editor": {
29
+ "rasam-source": "./src/editor.ts",
30
+ "types": "./dist/editor.d.ts",
31
+ "import": "./dist/editor.js"
32
+ }
33
+ },
34
+ "sideEffects": false,
35
+ "peerDependencies": {
36
+ "@rasamjs/core": "^0.2.0"
37
+ },
38
+ "devDependencies": {
39
+ "@rasamjs/core": "0.2.0",
40
+ "@rasamjs/history": "0.2.0",
41
+ "@rasamjs/transformer": "0.5.0"
42
+ },
43
+ "scripts": {
44
+ "build": "node scripts/build.mjs",
45
+ "typecheck": "tsc -p tsconfig.check.json",
46
+ "test": "vitest run",
47
+ "test:browser": "playwright test",
48
+ "dev": "vite --host 127.0.0.1",
49
+ "format": "prettier --write src tests scripts fixtures *.json *.ts *.md",
50
+ "format:check": "prettier --check src tests scripts fixtures *.json *.ts *.md",
51
+ "check:consumer": "node scripts/check-consumer.mjs",
52
+ "check:docs": "node scripts/check-docs.mjs",
53
+ "check:size": "node scripts/check-size.mjs",
54
+ "api:check": "node scripts/check-api.mjs",
55
+ "api:update": "node scripts/check-api.mjs --update",
56
+ "release:check": "node scripts/check-release.mjs"
57
+ },
58
+ "repository": {
59
+ "type": "git",
60
+ "url": "git+https://github.com/hdevlop/rasam.git",
61
+ "directory": "packages/connectors"
62
+ }
63
+ }