@rasamjs/connectors 0.0.0-stage → 0.2.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 +143 -0
  2. package/CHANGELOG.md +40 -0
  3. package/LICENSE +21 -0
  4. package/README.md +54 -2
  5. package/RELEASING.md +27 -0
  6. package/dist/connectors.d.ts +38 -0
  7. package/dist/connectors.d.ts.map +1 -0
  8. package/dist/connectors.js +291 -0
  9. package/dist/connectors.js.map +1 -0
  10. package/dist/editor.d.ts +56 -0
  11. package/dist/editor.d.ts.map +1 -0
  12. package/dist/editor.js +67 -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 +12 -0
  19. package/dist/metadata.d.ts.map +1 -0
  20. package/dist/metadata.js +72 -0
  21. package/dist/metadata.js.map +1 -0
  22. package/dist/routing.d.ts +14 -0
  23. package/dist/routing.d.ts.map +1 -0
  24. package/dist/routing.js +130 -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 +47 -0
  31. package/dist/tool.d.ts.map +1 -0
  32. package/dist/tool.js +326 -0
  33. package/dist/tool.js.map +1 -0
  34. package/dist/types.d.ts +43 -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 +64 -6
  39. package/src/connectors.ts +324 -0
  40. package/src/editor.ts +105 -0
  41. package/src/index.ts +14 -0
  42. package/src/metadata.ts +88 -0
  43. package/src/routing.ts +153 -0
  44. package/src/tool-surface.ts +96 -0
  45. package/src/tool.ts +367 -0
  46. package/src/types.ts +38 -0
package/dist/tool.js ADDED
@@ -0,0 +1,326 @@
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, portsOf, routeConnector } from './routing.js';
5
+ import { ToolSurface, svg } from './tool-surface.js';
6
+ const sides = ['top', 'right', 'bottom', 'left'];
7
+ /** A target's ports replace its four side hints. */
8
+ const hints = (target) => {
9
+ const ports = portsOf(target);
10
+ return ports.length
11
+ ? ports.map((port) => ({ target, port: port.name }))
12
+ : sides.map((anchor) => ({ target, anchor }));
13
+ };
14
+ const same = (hint, endpoint) => 'port' in hint
15
+ ? 'port' in endpoint && endpoint.port === hint.port
16
+ : 'anchor' in hint && 'anchor' in endpoint && endpoint.anchor === hint.anchor;
17
+ /**
18
+ * Drag from a hinted anchor, port or free point. Within twelve client pixels of a hint,
19
+ * the end snaps to it. The document is written only on release.
20
+ */
21
+ export class ConnectorTool {
22
+ connectors;
23
+ surface;
24
+ active = false;
25
+ press = null;
26
+ hover = null;
27
+ options;
28
+ constructor(connectors, options = {}) {
29
+ this.connectors = connectors;
30
+ if (connectors.isDestroyed)
31
+ throw new Error('Connectors is destroyed');
32
+ for (const name of ['selectable', 'onCreate', 'onGesture', 'onError', 'onExit'])
33
+ if (options[name] !== undefined && typeof options[name] !== 'function')
34
+ throw new TypeError(`${name} must be a function`);
35
+ if (options.routing !== undefined && !['straight', 'elbow'].includes(options.routing))
36
+ throw new TypeError('Unknown connector routing');
37
+ if (options.arrows !== undefined && !['none', 'end', 'both'].includes(options.arrows))
38
+ throw new TypeError('Unknown connector arrows');
39
+ if (options.stroke !== undefined &&
40
+ (typeof options.stroke !== 'string' || !options.stroke.trim()))
41
+ throw new TypeError('Connector stroke must be nonempty');
42
+ if (options.strokeWidth !== undefined &&
43
+ (!Number.isFinite(options.strokeWidth) || options.strokeWidth < 0))
44
+ throw new TypeError('Connector stroke width must be nonnegative');
45
+ this.options = { ...options };
46
+ this.surface = new ToolSurface(connectors.drawing, () => this.render());
47
+ this.surface.cleanup(connectors.onDispose(() => this.destroy()));
48
+ this.surface.cleanup(observeChanges(connectors.drawing, () => {
49
+ const attached = (endpoint) => 'point' in endpoint ||
50
+ (!endpoint.target.isDestroyed && connectors.drawing.el.contains(endpoint.target.el));
51
+ if (this.press && (!attached(this.press.start) || !attached(this.press.end)))
52
+ this.cancel();
53
+ if (this.hover && !attached(this.hover.endpoint))
54
+ this.hover = null;
55
+ this.surface.schedule();
56
+ }));
57
+ this.surface.listen(this.surface.element, 'pointerdown', this.down);
58
+ this.surface.listen(this.surface.element, 'pointermove', this.over);
59
+ this.surface.listen(this.surface.element, 'pointerleave', () => {
60
+ if (!this.press) {
61
+ this.hover = null;
62
+ this.update();
63
+ }
64
+ });
65
+ this.surface.listen(this.surface.view, 'pointermove', this.move);
66
+ this.surface.listen(this.surface.view, 'pointerup', this.up);
67
+ this.surface.listen(this.surface.view, 'pointercancel', this.lost);
68
+ this.surface.listen(this.surface.element, 'lostpointercapture', this.lost);
69
+ this.surface.listen(this.surface.view, 'blur', () => this.cancel());
70
+ this.surface.listen(this.surface.view, 'keydown', ((event) => {
71
+ if (!this.enabled ||
72
+ event.key !== 'Escape' ||
73
+ event.defaultPrevented ||
74
+ !this.acceptsKeyboard(event))
75
+ return;
76
+ event.preventDefault();
77
+ event.stopPropagation();
78
+ if (this.press)
79
+ this.cancel();
80
+ else {
81
+ this.enabled = false;
82
+ this.options.onExit?.();
83
+ }
84
+ }), true);
85
+ this.surface.cleanup(() => {
86
+ this.active = false;
87
+ this.cancel();
88
+ });
89
+ }
90
+ get isDestroyed() {
91
+ return this.surface.isDestroyed;
92
+ }
93
+ get enabled() {
94
+ return this.active;
95
+ }
96
+ get paint() {
97
+ return Object.freeze({
98
+ stroke: this.options.stroke ?? '#334155',
99
+ strokeWidth: this.options.strokeWidth ?? 2,
100
+ });
101
+ }
102
+ set paint(paint) {
103
+ if (this.isDestroyed)
104
+ throw new Error('Connector tool is destroyed');
105
+ if (!paint ||
106
+ typeof paint.stroke !== 'string' ||
107
+ !paint.stroke.trim() ||
108
+ !Number.isFinite(paint.strokeWidth) ||
109
+ paint.strokeWidth < 0)
110
+ throw new TypeError('Invalid connector paint');
111
+ this.options = { ...this.options, stroke: paint.stroke, strokeWidth: paint.strokeWidth };
112
+ this.update();
113
+ }
114
+ set enabled(value) {
115
+ if (this.isDestroyed || this.connectors.isDestroyed)
116
+ throw new Error('Connector tool is destroyed');
117
+ if (typeof value !== 'boolean')
118
+ throw new TypeError('Connector tool enabled must be boolean');
119
+ if (this.active === value)
120
+ return;
121
+ this.cancel();
122
+ this.active = value;
123
+ this.hover = null;
124
+ this.surface.element.style.pointerEvents = value ? 'all' : 'none';
125
+ this.surface.element.style.cursor = value ? 'crosshair' : '';
126
+ this.update();
127
+ }
128
+ update() {
129
+ this.surface.update();
130
+ return this;
131
+ }
132
+ destroy() {
133
+ this.surface.destroy();
134
+ }
135
+ cancel() {
136
+ const press = this.press;
137
+ this.press = null;
138
+ if (press) {
139
+ if (this.surface.element.hasPointerCapture(press.id))
140
+ this.surface.element.releasePointerCapture(press.id);
141
+ this.options.onGesture?.(false);
142
+ }
143
+ this.update();
144
+ }
145
+ acceptsKeyboard(event) {
146
+ const document = this.surface.element.ownerDocument, active = document.activeElement;
147
+ return (!document.querySelector('dialog[open],[role="dialog"][aria-modal="true"]') &&
148
+ !event.target?.closest?.('input,textarea,select,[contenteditable]:not([contenteditable="false"])') &&
149
+ (active === document.body ||
150
+ (!!active && this.surface.element.parentElement.contains(active))));
151
+ }
152
+ attempt(run) {
153
+ try {
154
+ run();
155
+ }
156
+ catch (error) {
157
+ try {
158
+ this.cancel();
159
+ }
160
+ catch (cleanup) {
161
+ error = new AggregateError([error, cleanup], 'Connector tool and cleanup failed');
162
+ }
163
+ if (this.options.onError)
164
+ this.options.onError(error);
165
+ else
166
+ throw error;
167
+ }
168
+ }
169
+ pick(event) {
170
+ const drawing = this.connectors.drawing;
171
+ const point = drawing.fromClient({ x: event.clientX, y: event.clientY });
172
+ if (!point)
173
+ return null;
174
+ const accepts = (node) => Guards.isTransformable(node) &&
175
+ node !== drawing &&
176
+ drawing.el.contains(node.el) &&
177
+ !isConnector(node) &&
178
+ !node.descendants().some(isConnector) &&
179
+ this.options.selectable?.(node) !== false;
180
+ let target;
181
+ // Hit testing never reports groups, so a rejected hit such as a component's rendered
182
+ // child resolves to its nearest accepted ancestor.
183
+ for (const element of drawing.el.ownerDocument.elementsFromPoint(event.clientX, event.clientY))
184
+ for (let node = Registry.wrapper(element); node && !target; node = node.parent)
185
+ if (accepts(node))
186
+ target = node;
187
+ // The outer half of an anchor hint can lie just outside its shape's hit area.
188
+ const previous = this.hover?.target;
189
+ if (!target &&
190
+ previous &&
191
+ !previous.isDestroyed &&
192
+ drawing.el.contains(previous.el) &&
193
+ this.options.selectable?.(previous) !== false) {
194
+ const nearHint = hints(previous).some((hint) => {
195
+ const port = connectorPort(hint, point);
196
+ const client = port && drawing.toClient(port.point);
197
+ return client && Math.hypot(client.x - event.clientX, client.y - event.clientY) < 12;
198
+ });
199
+ if (nearHint)
200
+ target = previous;
201
+ }
202
+ this.hover = null;
203
+ if (!target)
204
+ return { point };
205
+ let endpoint = { target, anchor: 'auto' };
206
+ let nearest = 12;
207
+ for (const hint of hints(target)) {
208
+ const port = connectorPort(hint, point);
209
+ const client = port && drawing.toClient(port.point);
210
+ if (!client)
211
+ continue;
212
+ const distance = Math.hypot(client.x - event.clientX, client.y - event.clientY);
213
+ if (distance < nearest) {
214
+ nearest = distance;
215
+ endpoint = hint;
216
+ }
217
+ }
218
+ this.hover = { target, endpoint };
219
+ return endpoint;
220
+ }
221
+ over = (event) => {
222
+ if (!this.enabled || this.press || !event.isPrimary || event.buttons)
223
+ return;
224
+ this.attempt(() => {
225
+ this.pick(event);
226
+ this.update();
227
+ });
228
+ };
229
+ down = (event) => {
230
+ if (!this.enabled ||
231
+ this.press ||
232
+ !event.isPrimary ||
233
+ event.button !== 0 ||
234
+ event.defaultPrevented)
235
+ return;
236
+ this.attempt(() => {
237
+ const endpoint = this.pick(event);
238
+ if (!endpoint)
239
+ return;
240
+ this.surface.element.setPointerCapture(event.pointerId);
241
+ this.press = { id: event.pointerId, start: endpoint, end: endpoint };
242
+ event.preventDefault();
243
+ event.stopPropagation();
244
+ this.options.onGesture?.(true);
245
+ this.update();
246
+ });
247
+ };
248
+ move = (event) => {
249
+ if (event.pointerId !== this.press?.id)
250
+ return;
251
+ this.attempt(() => {
252
+ const endpoint = this.pick(event);
253
+ if (endpoint && this.press)
254
+ this.press.end = endpoint;
255
+ this.update();
256
+ });
257
+ };
258
+ up = (event) => {
259
+ if (event.pointerId !== this.press?.id)
260
+ return;
261
+ this.attempt(() => {
262
+ const press = this.press, end = this.pick(event) ?? press.end;
263
+ this.cancel();
264
+ const a = endpointCenter(press.start), b = endpointCenter(end);
265
+ if (!a || !b || Math.hypot(a.x - b.x, a.y - b.y) < 1e-6)
266
+ return;
267
+ const path = this.connectors.create({ ...this.options, start: press.start, end });
268
+ this.options.onCreate?.(path);
269
+ });
270
+ };
271
+ lost = (event) => {
272
+ if (event.pointerId === this.press?.id)
273
+ this.cancel();
274
+ };
275
+ render() {
276
+ const overlay = this.surface.element;
277
+ overlay.replaceChildren();
278
+ if (!this.enabled)
279
+ return;
280
+ const document = overlay.ownerDocument;
281
+ if (this.hover)
282
+ for (const hint of hints(this.hover.target)) {
283
+ const port = connectorPort(hint, { x: 0, y: 0 });
284
+ const point = port && this.surface.fromRoot(port.point);
285
+ const active = same(hint, this.hover.endpoint);
286
+ if (point)
287
+ overlay.append(svg(document, 'circle', {
288
+ cx: point.x,
289
+ cy: point.y,
290
+ r: 5,
291
+ fill: active ? '#2563eb' : 'white',
292
+ stroke: '#2563eb',
293
+ 'stroke-width': 1.5,
294
+ 'pointer-events': 'none',
295
+ ...('port' in hint
296
+ ? { 'data-connector-port': hint.port }
297
+ : { 'data-connector-anchor': hint.anchor }),
298
+ ...(active ? { 'data-connector-active': '' } : {}),
299
+ }));
300
+ }
301
+ if (!this.press)
302
+ return;
303
+ const { start, end } = this.press;
304
+ const a = endpointCenter(start), b = endpointCenter(end);
305
+ const from = a && b ? connectorPort(start, b) : null, to = a && b ? connectorPort(end, a) : null;
306
+ if (!from || !to)
307
+ return;
308
+ const points = routeConnector({
309
+ start: from,
310
+ end: to,
311
+ routing: this.options.routing ?? 'straight',
312
+ }).map((point) => this.surface.fromRoot(point));
313
+ if (points.some((point) => !point))
314
+ return;
315
+ overlay.append(svg(document, 'path', {
316
+ d: pathData(points),
317
+ fill: 'none',
318
+ stroke: this.options.stroke ?? '#334155',
319
+ 'stroke-width': this.options.strokeWidth ?? 2,
320
+ 'stroke-dasharray': '5 4',
321
+ 'pointer-events': 'none',
322
+ 'data-connector-preview': '',
323
+ }));
324
+ }
325
+ }
326
+ //# sourceMappingURL=tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AA2BrD,MAAM,KAAK,GAA6B,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC3E,oDAAoD;AACpD,MAAM,KAAK,GAAG,CAAC,MAAuB,EAAuB,EAAE;IAC7D,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,KAAK,CAAC,MAAM;QACjB,CAAC,CAAC,KAAK,CAAC,GAAG,CA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C,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAClD,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7C,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE;YAAE,OAAO;QACzB,MAAM,MAAM,GAAG,cAAc,CAAC;YAC5B,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,EAAE;YACP,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,UAAU;SAC5C,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,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,43 @@
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
+ /**
7
+ * A target with an anchor on its bounds, a target with a named port from its
8
+ * `portDefinitions` (for example a component's), or a loose point in drawing units.
9
+ */
10
+ export type ConnectorEndpoint = {
11
+ readonly target: ConnectorTarget;
12
+ readonly anchor?: ConnectorAnchor;
13
+ } | {
14
+ readonly target: ConnectorTarget;
15
+ readonly port: string;
16
+ } | {
17
+ readonly point: Point;
18
+ };
19
+ export type ConnectorRouting = 'straight' | 'elbow';
20
+ export interface ConnectorOptions {
21
+ readonly start: ConnectorEndpoint;
22
+ readonly end: ConnectorEndpoint;
23
+ readonly routing?: ConnectorRouting;
24
+ readonly arrows?: 'none' | 'end' | 'both';
25
+ readonly stroke?: string;
26
+ readonly strokeWidth?: number;
27
+ }
28
+ export interface ConnectorState {
29
+ readonly path: Path;
30
+ readonly start: ConnectorEndpoint;
31
+ readonly end: ConnectorEndpoint;
32
+ readonly routing: ConnectorRouting;
33
+ }
34
+ export interface ConnectorPort {
35
+ readonly point: Point;
36
+ readonly direction: Point;
37
+ }
38
+ export interface ConnectorRoute {
39
+ readonly start: ConnectorPort;
40
+ readonly end: ConnectorPort;
41
+ readonly routing: ConnectorRouting;
42
+ }
43
+ //# 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;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,MAAM,EAAE,eAA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"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
- {
2
- "name": "@rasamjs/connectors",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@rasamjs/connectors",
3
+ "version": "0.2.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.3.0"
37
+ },
38
+ "devDependencies": {
39
+ "@rasamjs/core": "0.3.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
+ "bench": "node scripts/benchmark.mjs"
58
+ },
59
+ "repository": {
60
+ "type": "git",
61
+ "url": "git+https://github.com/hdevlop/rasam.git",
62
+ "directory": "packages/connectors"
63
+ }
64
+ }