@bemedev/mind-flow 0.0.1 → 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.
- package/README.md +95 -0
- package/lib/helpers/createContext.d.ts +5 -8
- package/lib/helpers/createContext.d.ts.map +1 -1
- package/lib/index.cjs.js +1 -1
- package/lib/index.es.js +240 -235
- package/lib/server.cjs.js +148 -117
- package/lib/server.es.js +148 -117
- package/lib/services/main.machine.d.ts +7 -9
- package/lib/services/main.machine.d.ts.map +1 -1
- package/lib/services/main.typings.d.ts +2 -2
- package/lib/ui/Flow.d.ts +2 -2
- package/lib/ui/Flow.d.ts.map +1 -1
- package/lib/ui/components/Bounds.d.ts +4 -4
- package/lib/ui/components/Bounds.d.ts.map +1 -1
- package/lib/ui/components/EdgeComponent.d.ts +2 -2
- package/lib/ui/components/EdgeComponent.d.ts.map +1 -1
- package/lib/ui/components/EdgesBoard.d.ts +2 -2
- package/lib/ui/components/EdgesBoard.d.ts.map +1 -1
- package/lib/ui/components/FlowChart.context.d.ts +10 -18
- package/lib/ui/components/FlowChart.context.d.ts.map +1 -1
- package/lib/ui/components/FlowChart.d.ts +4 -10
- package/lib/ui/components/FlowChart.d.ts.map +1 -1
- package/lib/ui/components/FlowChart.data.d.ts +6 -10
- package/lib/ui/components/FlowChart.data.d.ts.map +1 -1
- package/lib/ui/components/NodeComponent.d.ts +2 -2
- package/lib/ui/components/NodeComponent.d.ts.map +1 -1
- package/lib/ui/components/NodesBoard.d.ts +2 -2
- package/lib/ui/components/NodesBoard.d.ts.map +1 -1
- package/lib/ui/components/classes.d.ts +2 -2
- package/package.json +2 -2
- package/src/README.md +2 -2
- package/src/helpers/createContext.ts +5 -8
- package/src/services/main.machine.ts +18 -46
- package/src/services/main.typings.ts +2 -2
- package/src/ui/Flow.tsx +3 -2
- package/src/ui/components/Bounds.tsx +35 -44
- package/src/ui/components/EdgeComponent.tsx +7 -8
- package/src/ui/components/EdgesBoard.tsx +3 -2
- package/src/ui/components/FlowChart.context.ts +56 -82
- package/src/ui/components/FlowChart.data.ts +8 -14
- package/src/ui/components/FlowChart.tsx +6 -11
- package/src/ui/components/NodeComponent.tsx +13 -25
- package/src/ui/components/NodesBoard.tsx +109 -111
- package/src/ui/components/classes.ts +2 -2
package/lib/index.es.js
CHANGED
|
@@ -73,7 +73,7 @@ T(({ optional: e, use: t }) => ({
|
|
|
73
73
|
});
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region src/services/main.machine.ts
|
|
76
|
-
var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`,
|
|
76
|
+
var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, ee = S({
|
|
77
77
|
initial: "idle",
|
|
78
78
|
states: {
|
|
79
79
|
idle: { on: {
|
|
@@ -88,15 +88,10 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
88
88
|
target: "/working"
|
|
89
89
|
} },
|
|
90
90
|
working: { on: {
|
|
91
|
-
MOVE: {
|
|
92
|
-
actions: ["moveNode", "buildUI"],
|
|
93
|
-
target: "/construction"
|
|
94
|
-
},
|
|
95
91
|
MOVE_IMMEDIATE: { actions: [{
|
|
96
92
|
name: "buildImmediateUI",
|
|
97
93
|
description: "Must be in the ui"
|
|
98
94
|
}] },
|
|
99
|
-
UPDATE_UI: "/construction",
|
|
100
95
|
ADD_CHILD: {
|
|
101
96
|
actions: [
|
|
102
97
|
"generateID",
|
|
@@ -130,6 +125,10 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
130
125
|
],
|
|
131
126
|
target: "/construction"
|
|
132
127
|
},
|
|
128
|
+
MOVE: {
|
|
129
|
+
actions: ["moveNode", "buildUI"],
|
|
130
|
+
target: "/construction"
|
|
131
|
+
},
|
|
133
132
|
ADD_EDGE: {
|
|
134
133
|
actions: ["addEdge"],
|
|
135
134
|
target: "/construction"
|
|
@@ -167,6 +166,7 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
167
166
|
DESELECT: "never",
|
|
168
167
|
ADD_EDGE: t(z)
|
|
169
168
|
})),
|
|
169
|
+
sync: !0,
|
|
170
170
|
pContext: T(({ union: e }) => ({ generatedId: e("string", "null") })),
|
|
171
171
|
context: T(({ optional: e, use: t, array: n }) => ({
|
|
172
172
|
data: e({
|
|
@@ -181,8 +181,7 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
181
181
|
}),
|
|
182
182
|
selected: e("string"),
|
|
183
183
|
updatingUI: e("boolean")
|
|
184
|
-
}))
|
|
185
|
-
sync: !0
|
|
184
|
+
}))
|
|
186
185
|
}).provideOptions(({ assign: e, batch: t, erase: n }) => ({ actions: {
|
|
187
186
|
configure: t(e("context.data", () => ({
|
|
188
187
|
nodes: [],
|
|
@@ -229,16 +228,16 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
229
228
|
}];
|
|
230
229
|
} }),
|
|
231
230
|
deselect: n("context.selected")
|
|
232
|
-
} })),
|
|
233
|
-
x:
|
|
231
|
+
} })), te = 10.5, W = -10.5, G = {
|
|
232
|
+
x: W,
|
|
234
233
|
y: 18
|
|
235
|
-
},
|
|
236
|
-
x: e +
|
|
234
|
+
}, K = (e = 0) => ({
|
|
235
|
+
x: e + te,
|
|
237
236
|
y: 18
|
|
238
|
-
}),
|
|
239
|
-
horizontal:
|
|
240
|
-
vertical:
|
|
241
|
-
},
|
|
237
|
+
}), q = {
|
|
238
|
+
horizontal: 55,
|
|
239
|
+
vertical: 40
|
|
240
|
+
}, ne = [{
|
|
242
241
|
id: "node-0",
|
|
243
242
|
data: {
|
|
244
243
|
content: "Some text",
|
|
@@ -249,40 +248,40 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
249
248
|
x: 350,
|
|
250
249
|
y: 100
|
|
251
250
|
}
|
|
252
|
-
}],
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
let i =
|
|
251
|
+
}], [re, J] = F(() => {
|
|
252
|
+
let e = C(ee, {
|
|
253
|
+
context: {},
|
|
254
|
+
pContext: { generatedId: null }
|
|
255
|
+
}), t = _(1), n = _(), [r, i] = _(), [a, o] = _({}, { equals: P }), s = (e, n) => {
|
|
256
|
+
let i = r();
|
|
258
257
|
if (!i) return {
|
|
259
|
-
x:
|
|
260
|
-
y:
|
|
258
|
+
x: e,
|
|
259
|
+
y: n
|
|
261
260
|
};
|
|
262
|
-
let a = i.getBoundingClientRect(), o =
|
|
261
|
+
let a = i.getBoundingClientRect(), o = t[0]();
|
|
263
262
|
return {
|
|
264
|
-
x:
|
|
265
|
-
y:
|
|
263
|
+
x: e - a.left / o,
|
|
264
|
+
y: n - a.top / o
|
|
266
265
|
};
|
|
267
|
-
}, [
|
|
268
|
-
let o =
|
|
266
|
+
}, [c, l] = _({}, { equals: !1 }), u = (e, n, i = 192, a = 50) => {
|
|
267
|
+
let o = r()?.parentElement;
|
|
269
268
|
if (!o) return {
|
|
270
|
-
x:
|
|
271
|
-
y:
|
|
269
|
+
x: e,
|
|
270
|
+
y: n
|
|
272
271
|
};
|
|
273
|
-
let s =
|
|
272
|
+
let s = t[0](), c = o.scrollLeft / s + q.horizontal, l = Math.max(c, (o.scrollLeft + o.clientWidth) / s - q.horizontal - i), u = o.scrollTop / s + q.vertical, d = Math.max(u, (o.scrollTop + o.clientHeight) / s - q.vertical - a);
|
|
274
273
|
return {
|
|
275
|
-
x: Math.min(Math.max(
|
|
276
|
-
y: Math.min(Math.max(
|
|
274
|
+
x: Math.min(Math.max(e, c), l),
|
|
275
|
+
y: Math.min(Math.max(n, u), d)
|
|
277
276
|
};
|
|
278
277
|
};
|
|
279
|
-
return
|
|
280
|
-
placeChild:
|
|
278
|
+
return e.addOptions(({ voidAction: e, batch: n, assign: i }) => ({ actions: {
|
|
279
|
+
placeChild: i("context.data.nodes", { ADD_CHILD: ({ payload: e, context: { data: t }, pContext: { generatedId: n } }) => {
|
|
281
280
|
let r = t?.nodes ?? [];
|
|
282
281
|
if (!e) return r;
|
|
283
|
-
let
|
|
284
|
-
if (!
|
|
285
|
-
let o = `node-${n}`, s =
|
|
282
|
+
let i = r.find((t) => t.id === e);
|
|
283
|
+
if (!i) return r;
|
|
284
|
+
let o = `node-${n}`, s = a()[e]?.width ?? 0, c = a()[e]?.height ?? 0, l = i.position.x + s + 100, d = i.position.y, f = u(l, d, s, c);
|
|
286
285
|
return [...r, {
|
|
287
286
|
id: o,
|
|
288
287
|
data: { content: "<Nouveau nœud>" },
|
|
@@ -290,8 +289,8 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
290
289
|
position: f
|
|
291
290
|
}];
|
|
292
291
|
} }),
|
|
293
|
-
placeParent:
|
|
294
|
-
let i =
|
|
292
|
+
placeParent: i("context.data.nodes", { ADD_PARENT: ({ context: { data: e }, pContext: { generatedId: n } }) => {
|
|
293
|
+
let i = e?.nodes ?? [], a = `node-${n}`, o = r()?.parentElement, s = o?.scrollLeft ?? 0, c = o?.scrollTop ?? 0, l = o?.clientWidth ?? 0, u = o?.clientHeight ?? 0, d = t[0](), f = (s + l / 2) / d, p = (c + u / 2) / d;
|
|
295
294
|
return [...i, {
|
|
296
295
|
id: a,
|
|
297
296
|
data: { content: "<Nouveau nœud>" },
|
|
@@ -302,34 +301,34 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
302
301
|
}
|
|
303
302
|
}];
|
|
304
303
|
} }),
|
|
305
|
-
placeSibling:
|
|
306
|
-
let r = t?.edges ?? [],
|
|
307
|
-
if (!o) return
|
|
308
|
-
let s =
|
|
309
|
-
if (!s) return
|
|
310
|
-
let c = `node-${n}`,
|
|
311
|
-
return [...
|
|
304
|
+
placeSibling: i("context.data.nodes", { ADD_SIBLING: ({ payload: e, context: { data: t }, pContext: { generatedId: n } }) => {
|
|
305
|
+
let r = t?.edges ?? [], i = t?.nodes ?? [], o = r.find((t) => t.to === e)?.from;
|
|
306
|
+
if (!o) return i;
|
|
307
|
+
let s = i.find((e) => e.id === o);
|
|
308
|
+
if (!s) return i;
|
|
309
|
+
let c = `node-${n}`, l = a()[o]?.width ?? 0, d = a()[o]?.height ?? 0, f = s.position.x + l + 100, p = s.position.y + 100, m = u(f, p, l, d);
|
|
310
|
+
return [...i, {
|
|
312
311
|
id: c,
|
|
313
312
|
data: { content: "<Nouveau nœud>" },
|
|
314
313
|
input: !0,
|
|
315
314
|
position: m
|
|
316
315
|
}];
|
|
317
316
|
} }),
|
|
318
|
-
buildUI:
|
|
317
|
+
buildUI: n(e(({ context: { data: e } }) => {
|
|
319
318
|
let t = e?.edges ?? [];
|
|
320
|
-
|
|
321
|
-
let n = Object.entries({ ...e }).filter(([e]) => t
|
|
319
|
+
l((e) => {
|
|
320
|
+
let n = Object.entries({ ...e }).filter(([e]) => t.some((t) => t.id === e));
|
|
322
321
|
return Object.fromEntries(n);
|
|
323
322
|
});
|
|
324
|
-
}),
|
|
323
|
+
}), e({
|
|
325
324
|
else: ({ context: { data: e } }) => {
|
|
326
325
|
let t = e?.edges ?? [];
|
|
327
|
-
|
|
326
|
+
l(w((e) => {
|
|
328
327
|
t?.forEach(({ from: t, id: n, to: r }) => {
|
|
329
|
-
let
|
|
330
|
-
|
|
331
|
-
x0:
|
|
332
|
-
y0:
|
|
328
|
+
let i = a()[t]?.output, o = a()[r]?.input;
|
|
329
|
+
i && o && (e[n] = {
|
|
330
|
+
x0: i.x,
|
|
331
|
+
y0: i.y,
|
|
333
332
|
x1: o.x,
|
|
334
333
|
y1: o.y
|
|
335
334
|
});
|
|
@@ -338,15 +337,15 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
338
337
|
},
|
|
339
338
|
MOVE: ({ context: { data: e }, payload: t }) => {
|
|
340
339
|
let n = e?.edges ?? [];
|
|
341
|
-
|
|
342
|
-
n?.forEach(({ from: n, to: r, id:
|
|
340
|
+
l(w((e) => {
|
|
341
|
+
n?.forEach(({ from: n, to: r, id: i }) => {
|
|
343
342
|
if (n === t.id) {
|
|
344
|
-
let n =
|
|
345
|
-
e[
|
|
346
|
-
...e[
|
|
343
|
+
let n = a()[t.id]?.outputOffset ?? K(a()[t.id]?.width), r = t.x + n.x, s = t.y + n.y;
|
|
344
|
+
e[i] = {
|
|
345
|
+
...e[i],
|
|
347
346
|
x0: r,
|
|
348
347
|
y0: s
|
|
349
|
-
},
|
|
348
|
+
}, o(w((e) => {
|
|
350
349
|
e[t.id] && (e[t.id] = {
|
|
351
350
|
...e[t.id],
|
|
352
351
|
output: {
|
|
@@ -357,12 +356,12 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
357
356
|
}));
|
|
358
357
|
}
|
|
359
358
|
if (r === t.id) {
|
|
360
|
-
let n =
|
|
361
|
-
e[
|
|
362
|
-
...e[
|
|
359
|
+
let n = a()[t.id]?.inputOffset ?? G, r = t.x + n.x, s = t.y + n.y;
|
|
360
|
+
e[i] = {
|
|
361
|
+
...e[i],
|
|
363
362
|
x1: r,
|
|
364
363
|
y1: s
|
|
365
|
-
},
|
|
364
|
+
}, o(w((e) => {
|
|
366
365
|
e[t.id] && (e[t.id] = {
|
|
367
366
|
...e[t.id],
|
|
368
367
|
input: {
|
|
@@ -375,18 +374,18 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
375
374
|
});
|
|
376
375
|
}));
|
|
377
376
|
}
|
|
378
|
-
}),
|
|
379
|
-
buildImmediateUI:
|
|
377
|
+
}), i("context.updatingUI", () => !0)),
|
|
378
|
+
buildImmediateUI: e({ MOVE_IMMEDIATE: ({ context: { data: e }, payload: t }) => {
|
|
380
379
|
let n = e?.edges ?? [];
|
|
381
|
-
|
|
382
|
-
n?.forEach(({ from: n, to: r, id:
|
|
380
|
+
l(w((e) => {
|
|
381
|
+
n?.forEach(({ from: n, to: r, id: i }) => {
|
|
383
382
|
if (n === t.id) {
|
|
384
|
-
let n =
|
|
385
|
-
e[
|
|
386
|
-
...e[
|
|
383
|
+
let n = a()[t.id]?.outputOffset ?? K(a()[t.id]?.width), r = t.x + n.x, s = t.y + n.y;
|
|
384
|
+
e[i] = {
|
|
385
|
+
...e[i],
|
|
387
386
|
x0: r,
|
|
388
387
|
y0: s
|
|
389
|
-
},
|
|
388
|
+
}, o(w((e) => {
|
|
390
389
|
e[t.id] && (e[t.id] = {
|
|
391
390
|
...e[t.id],
|
|
392
391
|
output: {
|
|
@@ -397,12 +396,12 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
397
396
|
}));
|
|
398
397
|
}
|
|
399
398
|
if (r === t.id) {
|
|
400
|
-
let n =
|
|
401
|
-
e[
|
|
402
|
-
...e[
|
|
399
|
+
let n = a()[t.id]?.inputOffset ?? G, r = t.x + n.x, s = t.y + n.y;
|
|
400
|
+
e[i] = {
|
|
401
|
+
...e[i],
|
|
403
402
|
x1: r,
|
|
404
403
|
y1: s
|
|
405
|
-
},
|
|
404
|
+
}, o(w((e) => {
|
|
406
405
|
e[t.id] && (e[t.id] = {
|
|
407
406
|
...e[t.id],
|
|
408
407
|
input: {
|
|
@@ -415,37 +414,38 @@ var H = (e, t) => `edge = ${e} => ${t}`, U = (e) => `node-${e}`, W = S({
|
|
|
415
414
|
});
|
|
416
415
|
}));
|
|
417
416
|
} })
|
|
418
|
-
} })),
|
|
419
|
-
dimensions: [
|
|
420
|
-
newEdge:
|
|
421
|
-
board: [
|
|
422
|
-
getBoardPoint:
|
|
423
|
-
edgesPositions: [
|
|
424
|
-
service:
|
|
425
|
-
zoom:
|
|
417
|
+
} })), e.start(), {
|
|
418
|
+
dimensions: [a, o],
|
|
419
|
+
newEdge: n,
|
|
420
|
+
board: [r, i],
|
|
421
|
+
getBoardPoint: s,
|
|
422
|
+
edgesPositions: [c, l],
|
|
423
|
+
service: e,
|
|
424
|
+
zoom: t,
|
|
425
|
+
clampPosition: u
|
|
426
426
|
};
|
|
427
|
-
}, { name: "FlowContext" }),
|
|
428
|
-
function
|
|
429
|
-
for (n of e.keys()) if (
|
|
427
|
+
}, { name: "FlowContext" }), Y = Object.prototype.hasOwnProperty;
|
|
428
|
+
function X(e, t, n) {
|
|
429
|
+
for (n of e.keys()) if (Z(n, t)) return n;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function Z(e, t) {
|
|
432
432
|
var n, r, i;
|
|
433
433
|
if (e === t) return !0;
|
|
434
434
|
if (e && t && (n = e.constructor) === t.constructor) {
|
|
435
435
|
if (n === Date) return e.getTime() === t.getTime();
|
|
436
436
|
if (n === RegExp) return e.toString() === t.toString();
|
|
437
437
|
if (n === Array) {
|
|
438
|
-
if ((r = e.length) === t.length) for (; r-- &&
|
|
438
|
+
if ((r = e.length) === t.length) for (; r-- && Z(e[r], t[r]););
|
|
439
439
|
return r === -1;
|
|
440
440
|
}
|
|
441
441
|
if (n === Set) {
|
|
442
442
|
if (e.size !== t.size) return !1;
|
|
443
|
-
for (r of e) if (i = r, i && typeof i == "object" && (i =
|
|
443
|
+
for (r of e) if (i = r, i && typeof i == "object" && (i = X(t, i), !i) || !t.has(i)) return !1;
|
|
444
444
|
return !0;
|
|
445
445
|
}
|
|
446
446
|
if (n === Map) {
|
|
447
447
|
if (e.size !== t.size) return !1;
|
|
448
|
-
for (r of e) if (i = r[0], i && typeof i == "object" && (i =
|
|
448
|
+
for (r of e) if (i = r[0], i && typeof i == "object" && (i = X(t, i), !i) || !Z(r[1], t.get(i))) return !1;
|
|
449
449
|
return !0;
|
|
450
450
|
}
|
|
451
451
|
if (n === ArrayBuffer) e = new Uint8Array(e), t = new Uint8Array(t);
|
|
@@ -458,7 +458,7 @@ function $(e, t) {
|
|
|
458
458
|
return r === -1;
|
|
459
459
|
}
|
|
460
460
|
if (!n || typeof e == "object") {
|
|
461
|
-
for (n in r = 0, e) if (
|
|
461
|
+
for (n in r = 0, e) if (Y.call(e, n) && ++r && !Y.call(t, n) || !(n in t) || !Z(e[n], t[n])) return !1;
|
|
462
462
|
return Object.keys(t).length === r;
|
|
463
463
|
}
|
|
464
464
|
}
|
|
@@ -466,17 +466,19 @@ function $(e, t) {
|
|
|
466
466
|
}
|
|
467
467
|
//#endregion
|
|
468
468
|
//#region src/ui/components/Bounds.tsx
|
|
469
|
-
var
|
|
470
|
-
let { board: [e], zoom: [t] } =
|
|
469
|
+
var ie = () => {
|
|
470
|
+
let { board: [e], zoom: [t] } = J(), [n, { addTransformer: r, removeTransformer: i, onDragStart: a, onDragEnd: o }] = j(), s = {
|
|
471
471
|
id: "clamp-to-container",
|
|
472
472
|
order: 100,
|
|
473
473
|
callback: (r) => {
|
|
474
|
-
let i = e()
|
|
474
|
+
let i = e(), a = n.active.draggable;
|
|
475
475
|
if (!i || !a) return r;
|
|
476
|
-
let o = a.
|
|
476
|
+
let o = a.node;
|
|
477
|
+
if (!o) return r;
|
|
478
|
+
let s = t(), c = q.horizontal, l = Math.max(c, i.clientWidth / s - o.offsetWidth - q.horizontal), u = q.vertical, d = Math.max(u, i.clientHeight / s - o.offsetHeight - q.vertical), f = (c - o.offsetLeft) * s, p = (l - o.offsetLeft) * s, m = (u - o.offsetTop) * s, h = (d - o.offsetTop) * s;
|
|
477
479
|
return {
|
|
478
|
-
x: Math.min(Math.max(r.x,
|
|
479
|
-
y: Math.min(Math.max(r.y,
|
|
480
|
+
x: Math.min(Math.max(r.x, f), p),
|
|
481
|
+
y: Math.min(Math.max(r.y, m), h)
|
|
480
482
|
};
|
|
481
483
|
}
|
|
482
484
|
};
|
|
@@ -485,11 +487,11 @@ var re = () => {
|
|
|
485
487
|
}), o(({ draggable: e }) => {
|
|
486
488
|
i("draggables", e.id, s.id);
|
|
487
489
|
}), null;
|
|
488
|
-
},
|
|
490
|
+
}, ae = /*#__PURE__*/ u("<svg><path class=\"relative cursor-pointer fill-transparent\"></svg>", !1, !0, !1), oe = /*#__PURE__*/ u("<svg><g cursor=pointer style=pointer-events:all;z-index:30><circle cx=0 cy=0 r=12 fill=\"rgba(168, 168, 168, 1)\"></circle><svg fill=currentColor stroke-width=0 xmlns=http://www.w3.org/2000/svg class=\"h-25 w-25 bg-white fill-white\"width=20 height=20 viewBox=\"0 0 20 20\"color=white x=-10 y=-10><path d=\"M10.185,1.417c-4.741,0-8.583,3.842-8.583,8.583c0,4.74,3.842,8.582,8.583,8.582S18.768,14.74,18.768,10C18.768,5.259,14.926,1.417,10.185,1.417 M10.185,17.68c-4.235,0-7.679-3.445-7.679-7.68c0-4.235,3.444-7.679,7.679-7.679S17.864,5.765,17.864,10C17.864,14.234,14.42,17.68,10.185,17.68 M10.824,10l2.842-2.844c0.178-0.176,0.178-0.46,0-0.637c-0.177-0.178-0.461-0.178-0.637,0l-2.844,2.841L7.341,6.52c-0.176-0.178-0.46-0.178-0.637,0c-0.178,0.176-0.178,0.461,0,0.637L9.546,10l-2.841,2.844c-0.178,0.176-0.178,0.461,0,0.637c0.178,0.178,0.459,0.178,0.637,0l2.844-2.841l2.844,2.841c0.178,0.178,0.459,0.178,0.637,0c0.178-0.176,0.178-0.461,0-0.637L10.824,10z\"></svg>", !1, !0, !1), Q = (e) => e * 100 / 200, se = ({ x0: e, y0: t, x1: n, y1: r }) => `M ${e} ${t} C ${e + Q(Math.abs(n - e))} ${t}, ${n - Q(Math.abs(n - e))} ${r}, ${n} ${r}`, $ = (n) => {
|
|
489
491
|
let [a, o] = _({
|
|
490
492
|
x: n.x0 + (n.x1 - n.x0) / 2,
|
|
491
493
|
y: n.y0 + (n.y1 - n.y0) / 2
|
|
492
|
-
}), { service: u } =
|
|
494
|
+
}), { service: u } = J();
|
|
493
495
|
h(() => {
|
|
494
496
|
let e = n.x0 + (n.x1 - n.x0) / 2, t = n.y0 + (n.y1 - n.y0) / 2;
|
|
495
497
|
o({
|
|
@@ -499,7 +501,7 @@ var re = () => {
|
|
|
499
501
|
});
|
|
500
502
|
let d = E(u, { selector: (e) => e.context.selected === n.id });
|
|
501
503
|
return [(() => {
|
|
502
|
-
var t = i(
|
|
504
|
+
var t = i(ae);
|
|
503
505
|
return t.$$click = () => u.send({
|
|
504
506
|
type: "SELECT",
|
|
505
507
|
payload: n.id
|
|
@@ -520,7 +522,7 @@ var re = () => {
|
|
|
520
522
|
return d();
|
|
521
523
|
},
|
|
522
524
|
get children() {
|
|
523
|
-
var e = i(
|
|
525
|
+
var e = i(oe);
|
|
524
526
|
return e.$$mousedown = (e) => {
|
|
525
527
|
e.stopPropagation(), u.send({
|
|
526
528
|
type: "DELETE",
|
|
@@ -533,20 +535,20 @@ var re = () => {
|
|
|
533
535
|
n(["mousedown", "click"]);
|
|
534
536
|
//#endregion
|
|
535
537
|
//#region src/ui/components/EdgesBoard.tsx
|
|
536
|
-
var
|
|
537
|
-
let [e, n] = _(), { newEdge: [r], edgesPositions: [s] } =
|
|
538
|
+
var ce = /*#__PURE__*/ u("<svg class=\"pointer-events-none h-full w-full overflow-visible\"><!$><!/><!$><!/>"), le = () => {
|
|
539
|
+
let [e, n] = _(), { newEdge: [r], edgesPositions: [s] } = J(), c = g(() => Object.entries(s()).map(([e, t]) => ({
|
|
538
540
|
id: e,
|
|
539
541
|
...t
|
|
540
542
|
})));
|
|
541
543
|
return h(() => {
|
|
542
544
|
e() && r() && n();
|
|
543
545
|
}), (() => {
|
|
544
|
-
var e = i(
|
|
546
|
+
var e = i(ce), n = e.firstChild, [s, l] = a(n.nextSibling), u = s.nextSibling, [d, m] = a(u.nextSibling);
|
|
545
547
|
return o(e, t(p, {
|
|
546
548
|
get when() {
|
|
547
549
|
return r();
|
|
548
550
|
},
|
|
549
|
-
children: (e) => t(
|
|
551
|
+
children: (e) => t($, {
|
|
550
552
|
id: "__#new-edge#__TEMP",
|
|
551
553
|
isNew: !0,
|
|
552
554
|
get x0() {
|
|
@@ -566,27 +568,27 @@ var le = /*#__PURE__*/ u("<svg class=\"pointer-events-none h-full w-full overflo
|
|
|
566
568
|
get each() {
|
|
567
569
|
return c();
|
|
568
570
|
},
|
|
569
|
-
children:
|
|
571
|
+
children: $
|
|
570
572
|
}), d, m), e;
|
|
571
573
|
})();
|
|
572
|
-
},
|
|
573
|
-
let u, f, [m,
|
|
574
|
-
|
|
574
|
+
}, ue = /*#__PURE__*/ u("<svg class=\"cursor-pointer overflow-visible rounded-full bg-green-500 p-0.5 text-center font-bold hover:bg-green-600\"viewBox=\"0 0 1024 1024\"preserveAspectRatio=xMaxYMax xmlns=http://www.w3.org/2000/svg fill=white style=pointer-events:all;fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2><g id=background><path d=\"M467.40667,277.66696c-0.05948,-14.53055 5.75527,-22.95613 -8.62044,-20.90487c-112.55699,16.0607 -222.1609,112.14558 -245.06161,239.85765c-46.52056,259.43466 231.33083,443.06705 449.51209,316.97506c117.31668,-67.80002 160.95215,-190.43324 151.34416,-288.29849c-5.92276,-60.32819 -27.80273,-107.95668 -53.44246,-144.25469l59.39269,-42.05363c111.72214,156.309 73.11535,351.55635 -25.06953,459.45565c-184.18877,202.4124 -470.46624,145.52064 -592.95027,-32.92123c-156.18269,-227.53604 -27.15324,-543.64371 261.18883,-582.44416c5.0579,-0.68061 3.56556,-7.04079 3.56442,-8.58985c-0.05594,-76.3354 -0.11021,-76.7687 1.10909,-77.24589c2.06886,-0.80969 151.41433,118.4561 151.92482,118.95524c4.65592,4.55233 -0.99548,7.829 -29.07828,30.50907c-120.49369,97.31245 -120.4977,98.55675 -123.0691,97.87586c-0.43639,-0.11555 -0.80698,-0.31322 -0.74442,-66.91571Z\"></path><path d=\"M316.61562,611.03414c0.11517,-90.16257 -0.25516,-99.92912 0.64739,-101.78856c1.56486,-3.22393 131.99102,0.91032 134.6959,-1.89763c2.21336,-2.2977 -0.59362,-129.97807 1.1376,-132.37034c0.7253,-1.00225 11.10552,-0.99175 12.07474,-0.99077c104.50336,0.10564 104.90098,-0.37811 105.967,0.85765c1.56461,1.81373 0.25596,114.18436 0.67852,129.81412c0.1322,4.88975 3.22386,3.28152 99.72028,3.4563c33.0841,0.05992 36.14259,-1.40368 36.21852,4.50462c0.11713,9.11348 1.41954,110.45369 -0.40274,113.92715c-1.81106,3.45208 -130.39967,-0.42618 -134.48289,1.62075c-2.29035,1.14816 -0.36989,101.12392 -1.11542,130.51904c-0.09548,3.76459 -2.13506,3.20617 -47.84854,3.17365c-69.30253,-0.0493 -69.31099,-0.25627 -69.65762,-0.42191c-3.77927,-1.80595 0.16287,-129.33555 -2.24266,-132.58994c-1.79931,-2.43424 -124.06108,-0.29118 -132.80252,-0.97392c-3.81102,-0.29766 -2.58229,-14.8847 -2.58758,-16.8402Z\">"), de = /*#__PURE__*/ u("<div id=outputs class=\"pointer-events-none absolute top-0 z-10 flex cursor-default flex-col\"><div class=\"cursor-default rounded-full bg-[#e38b29] shadow-md\"style=pointer-events:all>"), fe = /*#__PURE__*/ u("<div class=min-w-48><div><svg class=\"cursor-pointer rounded-full fill-[#a11111] opacity-100 transition-all duration-200 ease-in-out\"fill=currentColor stroke-width=2 viewBox=\"4 4 16 16\"style=overflow:visible;pointer-events:all><path d=\"M12 4c-4.419 0-8 3.582-8 8s3.581 8 8 8 8-3.582 8-8-3.581-8-8-8zm3.707 10.293a.999.999 0 11-1.414 1.414L12 13.414l-2.293 2.293a.997.997 0 01-1.414 0 .999.999 0 010-1.414L10.586 12 8.293 9.707a.999.999 0 111.414-1.414L12 10.586l2.293-2.293a.999.999 0 111.414 1.414L13.414 12l2.293 2.293z\"></path></svg><!$><!/><svg class=\"flex cursor-pointer items-center justify-center rounded-lg bg-blue-500 p-0.5 text-center font-bold text-white hover:bg-blue-600\"viewBox=\"0 0 24 24\"stroke=currentColor stroke-width=2 style=pointer-events:all><path d=\"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\"></path></svg></div><!$><!/><!$><!/><!$><!/><div id=inputs class=\"pointer-events-none absolute top-0 z-10 flex flex-col\"><div class=\"cursor-crosshair rounded-full bg-[#e38b29] shadow-md\"style=pointer-events:all>"), pe = /*#__PURE__*/ u("<span class=\"min-w-max border-b border-[#f0f0f0] p-3 whitespace-nowrap text-red-600 select-none\">"), me = /*#__PURE__*/ u("<div class=\"p-3 select-none\">"), he = (n) => {
|
|
575
|
+
let u, f, [m, h] = _(), { dimensions: [g, v], newEdge: [y, x], getBoardPoint: S, service: C, zoom: [T] } = J(), D = E(C, { selector: (e) => e.context.selected === n.id });
|
|
576
|
+
b(() => {
|
|
575
577
|
let e = u, t = f, r = m(), i = T();
|
|
576
578
|
if (!t || !r) return;
|
|
577
|
-
let a = r.getBoundingClientRect(), o = t.getBoundingClientRect(), s = e?.getBoundingClientRect(), c = (o.left - a.left + o.width / 2) / i, l = (o.top - a.top + o.height / 2) / i, d = s ? (s.left - a.left + s.width / 2) / i :
|
|
579
|
+
let a = r.getBoundingClientRect(), o = t.getBoundingClientRect(), s = e?.getBoundingClientRect(), c = (o.left - a.left + o.width / 2) / i, l = (o.top - a.top + o.height / 2) / i, d = s ? (s.left - a.left + s.width / 2) / i : W, p = s ? (s.top - a.top + s.height / 2) / i : 18, h = a.width / i, g = a.height / i, _ = {
|
|
578
580
|
x: n.x + c,
|
|
579
581
|
y: n.y + l
|
|
580
|
-
},
|
|
582
|
+
}, y = {
|
|
581
583
|
x: n.x + d,
|
|
582
584
|
y: n.y + p
|
|
583
585
|
};
|
|
584
|
-
|
|
586
|
+
v(w((e) => {
|
|
585
587
|
e[n.id] = {
|
|
586
588
|
width: h,
|
|
587
589
|
height: g,
|
|
588
590
|
output: _,
|
|
589
|
-
input:
|
|
591
|
+
input: y,
|
|
590
592
|
outputOffset: {
|
|
591
593
|
x: c,
|
|
592
594
|
y: l
|
|
@@ -600,26 +602,26 @@ var le = /*#__PURE__*/ u("<svg class=\"pointer-events-none h-full w-full overflo
|
|
|
600
602
|
});
|
|
601
603
|
let O = E(C, { selector: ({ context: { data: e } }) => {
|
|
602
604
|
let t = e?.edges;
|
|
603
|
-
return t ?
|
|
605
|
+
return t ? t.some(({ to: e }) => e === n.id) : !1;
|
|
604
606
|
} }), k = A(n.id);
|
|
605
607
|
return (() => {
|
|
606
|
-
var m = i(
|
|
608
|
+
var m = i(fe), _ = m.firstChild, v = _.firstChild, b = v.nextSibling, [w, T] = a(b.nextSibling), E = w.nextSibling, A = _.nextSibling, [j, M] = a(A.nextSibling), N = j.nextSibling, [P, F] = a(N.nextSibling), I = P.nextSibling, [L, R] = a(I.nextSibling), z = L.nextSibling, B = z.firstChild;
|
|
607
609
|
return d(k, m, () => ({ skipTransform: !0 })), m.$$mousedown = (e) => {
|
|
608
610
|
e.stopPropagation(), e.stopImmediatePropagation(), C.send({
|
|
609
611
|
type: "SELECT",
|
|
610
612
|
payload: n.id
|
|
611
613
|
});
|
|
612
|
-
}, d(
|
|
614
|
+
}, d(h, m), v.$$click = (e) => {
|
|
613
615
|
e.stopPropagation(), C.send({
|
|
614
616
|
type: "DELETE",
|
|
615
617
|
payload: n.id
|
|
616
618
|
});
|
|
617
|
-
}, l(
|
|
619
|
+
}, l(v, "width", "24px"), l(v, "height", "24px"), o(_, t(p, {
|
|
618
620
|
get when() {
|
|
619
621
|
return O();
|
|
620
622
|
},
|
|
621
623
|
get children() {
|
|
622
|
-
var e = i(
|
|
624
|
+
var e = i(ue);
|
|
623
625
|
return e.$$click = () => C.send({
|
|
624
626
|
type: "ADD_SIBLING",
|
|
625
627
|
payload: n.id
|
|
@@ -634,7 +636,7 @@ var le = /*#__PURE__*/ u("<svg class=\"pointer-events-none h-full w-full overflo
|
|
|
634
636
|
},
|
|
635
637
|
keyed: !0,
|
|
636
638
|
children: (e) => (() => {
|
|
637
|
-
var t = i(
|
|
639
|
+
var t = i(pe);
|
|
638
640
|
return o(t, e), t;
|
|
639
641
|
})()
|
|
640
642
|
}), j, M), o(m, t(p, {
|
|
@@ -643,7 +645,7 @@ var le = /*#__PURE__*/ u("<svg class=\"pointer-events-none h-full w-full overflo
|
|
|
643
645
|
},
|
|
644
646
|
keyed: !0,
|
|
645
647
|
children: (e) => (() => {
|
|
646
|
-
var t = i(
|
|
648
|
+
var t = i(me);
|
|
647
649
|
return o(t, e), t;
|
|
648
650
|
})()
|
|
649
651
|
}), P, F), o(m, t(p, {
|
|
@@ -651,10 +653,10 @@ var le = /*#__PURE__*/ u("<svg class=\"pointer-events-none h-full w-full overflo
|
|
|
651
653
|
return n.input || O();
|
|
652
654
|
},
|
|
653
655
|
get children() {
|
|
654
|
-
var e = i(
|
|
656
|
+
var e = i(de), t = e.firstChild;
|
|
655
657
|
return l(e, "left", "-18px"), t.$$mouseup = (e) => {
|
|
656
658
|
e.stopPropagation();
|
|
657
|
-
let t =
|
|
659
|
+
let t = y()?.from;
|
|
658
660
|
t && C.send({
|
|
659
661
|
type: "ADD_EDGE",
|
|
660
662
|
payload: {
|
|
@@ -668,7 +670,7 @@ var le = /*#__PURE__*/ u("<svg class=\"pointer-events-none h-full w-full overflo
|
|
|
668
670
|
}
|
|
669
671
|
}), L, R), l(z, "right", "-18px"), B.$$mousedown = (e) => {
|
|
670
672
|
e.stopPropagation(), C.send("DESELECT");
|
|
671
|
-
let t =
|
|
673
|
+
let t = g()[n.id]?.output, r = S(e.clientX, e.clientY);
|
|
672
674
|
t && x({
|
|
673
675
|
x0: t.x,
|
|
674
676
|
y0: t.y,
|
|
@@ -686,7 +688,7 @@ var le = /*#__PURE__*/ u("<svg class=\"pointer-events-none h-full w-full overflo
|
|
|
686
688
|
"w-full opacity-100": D(),
|
|
687
689
|
"w-0 -right-3 opacity-0 overflow-hidden": !D()
|
|
688
690
|
};
|
|
689
|
-
return r !== t.e && c(m, "id", t.e = r), t.t = e(m, i, t.t), a !== t.a && l(m, "top", t.a = a), o !== t.o && l(m, "left", t.o = o), t.i = e(
|
|
691
|
+
return r !== t.e && c(m, "id", t.e = r), t.t = e(m, i, t.t), a !== t.a && l(m, "top", t.a = a), o !== t.o && l(m, "left", t.o = o), t.i = e(_, s, t.i), t;
|
|
690
692
|
}, {
|
|
691
693
|
e: void 0,
|
|
692
694
|
t: void 0,
|
|
@@ -703,23 +705,19 @@ n([
|
|
|
703
705
|
]);
|
|
704
706
|
//#endregion
|
|
705
707
|
//#region src/ui/components/NodesBoard.tsx
|
|
706
|
-
var
|
|
708
|
+
var ge = /*#__PURE__*/ u("<div class=\"relative h-full w-full overflow-scroll rounded-lg border-2 border-gray-600\"><!$><!/><div class=\"relative cursor-crosshair overflow-hidden\"><div class=\"relative h-full w-full\"style=\"transform-origin:top left\"><!$><!/><!$><!/><!$><!/>"), _e = /*#__PURE__*/ u("<div class=\"absolute right-4 bottom-4 z-50 flex items-center gap-2 rounded-xl border border-gray-200 bg-white/90 p-2 shadow-lg backdrop-blur-md\"><button type=button class=\"flex size-9 cursor-pointer items-center justify-center rounded-lg bg-gray-100 text-lg font-bold text-gray-700 shadow-sm transition-all duration-150 hover:bg-gray-200 active:scale-95\"title=\"Zoom out\"aria-label=\"Zoom out\">-</button><button type=button class=\"h-9 cursor-pointer rounded-lg px-2 text-xs font-semibold text-gray-700 transition-colors hover:bg-gray-100\"title=\"Reset zoom\"aria-label=\"Reset zoom\"><!$><!/>%</button><button type=button class=\"flex size-9 cursor-pointer items-center justify-center rounded-lg bg-gray-100 text-lg font-bold text-gray-700 shadow-sm transition-all duration-150 hover:bg-gray-200 active:scale-95\"title=\"Zoom in\"aria-label=\"Zoom in\">+</button><div class=\"h-5 w-px bg-gray-300\"></div><button type=button class=\"flex size-9 cursor-pointer items-center justify-center rounded-lg bg-blue-600 text-white shadow transition-all duration-150 hover:bg-blue-700 active:scale-95\"title=\"Add parent node\"aria-label=\"Add parent node\"><svg class=size-5 viewBox=\"0 0 24 24\"fill=currentColor><path d=\"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\">"), ve = /*#__PURE__*/ u("<div class=\"relative mx-auto h-[calc(100vh-64px)] w-[calc(100vw-32px)] overflow-hidden\">"), ye = () => {
|
|
707
709
|
let e, [n, c] = _(!1), [u, m] = _({
|
|
708
710
|
x: 0,
|
|
709
711
|
y: 0
|
|
710
|
-
}), [g,
|
|
711
|
-
y(C);
|
|
712
|
-
let w = 0, T = 0, { board: [, A], service: j, newEdge: [M], zoom: [N, P] } = Z(), F = () => {
|
|
713
|
-
if (!e) return;
|
|
712
|
+
}), [g, y] = _(""), [b, x] = _(), S = 0, C = 0, { board: [, w], service: T, newEdge: [A], zoom: [j, M] } = J(), N = () => {
|
|
714
713
|
let t = e.scrollWidth - e.clientWidth, n = e.scrollHeight - e.clientHeight;
|
|
715
|
-
|
|
714
|
+
S = t > 0 ? e.scrollLeft / t : 0, C = n > 0 ? e.scrollTop / n : 0;
|
|
716
715
|
};
|
|
717
|
-
h(v(
|
|
718
|
-
if (!e) return;
|
|
716
|
+
h(v(j, () => {
|
|
719
717
|
let t = e.scrollWidth - e.clientWidth, n = e.scrollHeight - e.clientHeight;
|
|
720
|
-
t > 0 && (e.scrollLeft =
|
|
718
|
+
t > 0 && (e.scrollLeft = S * t), n > 0 && (e.scrollTop = C * n);
|
|
721
719
|
}, { defer: !0 }));
|
|
722
|
-
let
|
|
720
|
+
let P = E(T, { selector: (e) => e.context?.selected }), F = (e) => P() === e, I = E(T, {
|
|
723
721
|
selector: (e) => (e.context.data?.nodes ?? []).map((e) => ({
|
|
724
722
|
id: e.id,
|
|
725
723
|
x: e.position.x,
|
|
@@ -728,104 +726,111 @@ var _e = /*#__PURE__*/ u("<div class=\"relative mx-auto h-[calc(100vh-64px)] w-[
|
|
|
728
726
|
content: e.data.content ?? "",
|
|
729
727
|
input: e.input
|
|
730
728
|
})),
|
|
731
|
-
equals:
|
|
732
|
-
}),
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
r?.node.style.setProperty("top", a * 2 + "px"), r?.node.style.setProperty("left", i * 2 + "px");
|
|
741
|
-
let o = e.x / N(), s = e.y / N();
|
|
742
|
-
t.style.setProperty("transform", `translate3d(${o}px, ${s}px, 0)`), j.send({
|
|
743
|
-
type: "MOVE_IMMEDIATE",
|
|
744
|
-
payload: {
|
|
745
|
-
id: `${n}`,
|
|
746
|
-
x: i,
|
|
747
|
-
y: a
|
|
748
|
-
}
|
|
749
|
-
}), m({ ...e });
|
|
729
|
+
equals: Z
|
|
730
|
+
}), L = () => `calc((500vw - 265px) * ${j()})`, R = () => `calc((500vh - 425px) * ${j()})`;
|
|
731
|
+
return (() => {
|
|
732
|
+
var h = i(ve);
|
|
733
|
+
return h.addEventListener("wheel", (e) => {
|
|
734
|
+
if (e.ctrlKey || e.metaKey) {
|
|
735
|
+
e.preventDefault(), N();
|
|
736
|
+
let t = e.deltaY < 0 ? .1 : -.1;
|
|
737
|
+
M((e) => Math.min(Math.max(Number((e + t).toFixed(2)), .2), 3));
|
|
750
738
|
}
|
|
751
|
-
},
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
});
|
|
767
|
-
}, 0);
|
|
768
|
-
},
|
|
769
|
-
get children() {
|
|
770
|
-
return [(() => {
|
|
771
|
-
var u = i(_e), p = u.firstChild, m = p.firstChild, [h, g] = a(m.nextSibling), _ = h.nextSibling, [v, y] = a(_.nextSibling), b = v.nextSibling, w = b.firstChild, [T, E] = a(w.nextSibling), D = T.nextSibling, [k, I] = a(D.nextSibling), L = p.nextSibling.firstChild, B = L.nextSibling, V = B.firstChild, [H, U] = a(V.nextSibling);
|
|
772
|
-
H.nextSibling;
|
|
773
|
-
var W = B.nextSibling, G = W.nextSibling.nextSibling;
|
|
774
|
-
return u.addEventListener("wheel", (e) => {
|
|
775
|
-
if (e.ctrlKey || e.metaKey) {
|
|
776
|
-
e.preventDefault(), F();
|
|
777
|
-
let t = e.deltaY < 0 ? .1 : -.1;
|
|
778
|
-
P((e) => Math.min(Math.max(Number((e + t).toFixed(2)), .2), 3));
|
|
779
|
-
}
|
|
780
|
-
}), p.addEventListener("scroll", F), d((t) => e = t, p), o(p, t(O, {}), h, g), o(p, t(re, {}), v, y), b.$$mousedown = (t) => {
|
|
781
|
-
if (M() || t.button !== 0 || !e) return;
|
|
782
|
-
j.send("DESELECT");
|
|
783
|
-
let n = t.clientX, r = t.clientY, i = e.scrollLeft, a = e.scrollTop;
|
|
784
|
-
c(!0);
|
|
785
|
-
let o = (t) => {
|
|
786
|
-
if (!e) return;
|
|
787
|
-
let o = t.clientX - n, s = t.clientY - r;
|
|
788
|
-
e.scrollLeft = i - o * 3, e.scrollTop = a - s * 3, F();
|
|
789
|
-
}, s = () => {
|
|
790
|
-
window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", s), setTimeout(() => c(!1), 200), C = void 0;
|
|
791
|
-
};
|
|
792
|
-
C = s, window.addEventListener("mousemove", o), window.addEventListener("mouseup", s);
|
|
793
|
-
}, d(A, b), o(b, t(ue, {}), T, E), o(b, t(f, {
|
|
794
|
-
get each() {
|
|
795
|
-
return R();
|
|
796
|
-
},
|
|
797
|
-
children: ge
|
|
798
|
-
}), k, I), L.$$click = () => {
|
|
799
|
-
F(), S(void 0), P((e) => Math.max(.2, Number((e - .1).toFixed(2))));
|
|
800
|
-
}, B.$$click = () => {
|
|
801
|
-
F(), x() ? (P(x()), S(void 0)) : (S(N()), P(1));
|
|
802
|
-
}, o(B, () => Math.round(N() * 100), H, U), W.$$click = () => {
|
|
803
|
-
F(), S(void 0), P((e) => Math.min(3, Number((e + .1).toFixed(2))));
|
|
804
|
-
}, G.$$click = () => j.send("ADD_PARENT"), r((e) => {
|
|
805
|
-
var t = !!n(), r = `calc(${z()}vh - 85px)`, i = `calc(${z()}vw - 53px)`, a = N();
|
|
806
|
-
return t !== e.e && b.classList.toggle("cursor-grabbing", e.e = t), r !== e.t && l(b, "height", e.t = r), i !== e.a && l(b, "width", e.a = i), a !== e.o && l(b, "scale", e.o = a), e;
|
|
807
|
-
}, {
|
|
808
|
-
e: void 0,
|
|
809
|
-
t: void 0,
|
|
810
|
-
a: void 0,
|
|
811
|
-
o: void 0
|
|
812
|
-
}), s(), u;
|
|
813
|
-
})(), t(p, {
|
|
814
|
-
get when() {
|
|
815
|
-
return !g() || !L(g());
|
|
816
|
-
},
|
|
817
|
-
get children() {
|
|
818
|
-
return t(k, { children: "" });
|
|
739
|
+
}), o(h, t(D, {
|
|
740
|
+
onDragMove: ({ draggable: { transform: e, node: t, id: n } }) => {
|
|
741
|
+
if (y(n), F(n)) {
|
|
742
|
+
let r = t.parentElement?.parentElement, i = j(), a = r ? Math.max(0, r.clientWidth / i - t.offsetWidth) : Infinity, o = r ? Math.max(0, r.clientHeight / i - t.offsetHeight) : Infinity, s = t.offsetLeft + e.x / i, c = t.offsetTop + e.y / i, l = Math.min(Math.max(s, 0), a), u = Math.min(Math.max(c, 0), o), d = l - t.offsetLeft, f = u - t.offsetTop;
|
|
743
|
+
t.style.setProperty("transform", `translate3d(${d}px, ${f}px, 0)`), T.send({
|
|
744
|
+
type: "MOVE_IMMEDIATE",
|
|
745
|
+
payload: {
|
|
746
|
+
id: `${n}`,
|
|
747
|
+
x: l,
|
|
748
|
+
y: u
|
|
749
|
+
}
|
|
750
|
+
}), m({
|
|
751
|
+
x: d * i,
|
|
752
|
+
y: f * i
|
|
753
|
+
});
|
|
819
754
|
}
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
|
|
755
|
+
},
|
|
756
|
+
onDragEnd: ({ draggable: { node: e, id: t } }) => {
|
|
757
|
+
if (!F(t)) return;
|
|
758
|
+
let n = e.parentElement?.parentElement, r = j(), i = n ? Math.max(0, n.clientWidth / r - e.offsetWidth) : Infinity, a = n ? Math.max(0, n.clientHeight / r - e.offsetHeight) : Infinity, o = e.offsetLeft + u().x / r, s = e.offsetTop + u().y / r, c = Math.min(Math.max(o, 0), i), l = Math.min(Math.max(s, 0), a);
|
|
759
|
+
e.style.setProperty("top", l + "px"), e.style.setProperty("left", c + "px"), e.style.removeProperty("transform"), setTimeout(() => {
|
|
760
|
+
T.send({
|
|
761
|
+
type: "MOVE",
|
|
762
|
+
payload: {
|
|
763
|
+
id: `${t}`,
|
|
764
|
+
x: c,
|
|
765
|
+
y: l
|
|
766
|
+
}
|
|
767
|
+
}), m({
|
|
768
|
+
x: 0,
|
|
769
|
+
y: 0
|
|
770
|
+
});
|
|
771
|
+
}, 0);
|
|
772
|
+
},
|
|
773
|
+
get children() {
|
|
774
|
+
return [
|
|
775
|
+
(() => {
|
|
776
|
+
var u = i(ge), p = u.firstChild, [m, h] = a(p.nextSibling), g = m.nextSibling, _ = g.firstChild, v = _.firstChild, [y, b] = a(v.nextSibling), x = y.nextSibling, [S, C] = a(x.nextSibling), E = S.nextSibling, [D, k] = a(E.nextSibling);
|
|
777
|
+
return u.addEventListener("scroll", N), d((t) => e = t, u), o(u, t(O, {}), m, h), g.$$mousedown = (t) => {
|
|
778
|
+
if (A() || t.button !== 0) return;
|
|
779
|
+
T.send("DESELECT");
|
|
780
|
+
let n = t.clientX, r = t.clientY, i = e.scrollLeft, a = e.scrollTop;
|
|
781
|
+
c(!0);
|
|
782
|
+
let o = (t) => {
|
|
783
|
+
let o = t.clientX - n, s = t.clientY - r;
|
|
784
|
+
e.scrollLeft = i - o * 3, e.scrollTop = a - s * 3, N();
|
|
785
|
+
}, s = () => {
|
|
786
|
+
window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", s), setTimeout(() => c(!1), 200);
|
|
787
|
+
};
|
|
788
|
+
window.addEventListener("mousemove", o), window.addEventListener("mouseup", s);
|
|
789
|
+
}, d(w, g), o(_, t(ie, {}), y, b), o(_, t(le, {}), S, C), o(_, t(f, {
|
|
790
|
+
get each() {
|
|
791
|
+
return I();
|
|
792
|
+
},
|
|
793
|
+
children: he
|
|
794
|
+
}), D, k), r((e) => {
|
|
795
|
+
var t = !!n(), r = R(), i = L(), a = j();
|
|
796
|
+
return t !== e.e && g.classList.toggle("cursor-grabbing", e.e = t), r !== e.t && l(g, "height", e.t = r), i !== e.a && l(g, "width", e.a = i), a !== e.o && l(_, "scale", e.o = a), e;
|
|
797
|
+
}, {
|
|
798
|
+
e: void 0,
|
|
799
|
+
t: void 0,
|
|
800
|
+
a: void 0,
|
|
801
|
+
o: void 0
|
|
802
|
+
}), s(), u;
|
|
803
|
+
})(),
|
|
804
|
+
(() => {
|
|
805
|
+
var e = i(_e), t = e.firstChild, n = t.nextSibling, r = n.firstChild, [c, l] = a(r.nextSibling);
|
|
806
|
+
c.nextSibling;
|
|
807
|
+
var u = n.nextSibling, d = u.nextSibling.nextSibling;
|
|
808
|
+
return t.$$click = () => {
|
|
809
|
+
N(), x(void 0), M((e) => Math.max(1 / 5, Number((e - .1).toFixed(2))));
|
|
810
|
+
}, n.$$click = () => {
|
|
811
|
+
N(), b() ? (M(b()), x(void 0)) : (x(j()), M(1));
|
|
812
|
+
}, o(n, () => Math.round(j() * 100), c, l), u.$$click = () => {
|
|
813
|
+
N(), x(void 0), M((e) => Math.min(3, Number((e + .1).toFixed(2))));
|
|
814
|
+
}, d.$$click = () => T.send("ADD_PARENT"), s(), e;
|
|
815
|
+
})(),
|
|
816
|
+
t(p, {
|
|
817
|
+
get when() {
|
|
818
|
+
return !g() || !F(g());
|
|
819
|
+
},
|
|
820
|
+
get children() {
|
|
821
|
+
return t(k, { children: "" });
|
|
822
|
+
}
|
|
823
|
+
})
|
|
824
|
+
];
|
|
825
|
+
}
|
|
826
|
+
})), h;
|
|
827
|
+
})();
|
|
823
828
|
};
|
|
824
829
|
n(["mousedown", "click"]);
|
|
825
830
|
//#endregion
|
|
826
831
|
//#region src/ui/components/FlowChart.tsx
|
|
827
|
-
var
|
|
828
|
-
let n = e.config?.nodes ??
|
|
832
|
+
var be = /*#__PURE__*/ u("<div class=\"relative h-full w-full\"><div class=\"relative h-full w-full bg-white bg-size-[30px_30px]\"style=\"background-image:radial-gradient(circle, #b8b8b8bf 1px, rgba(0, 0, 0, 0) 1px)\">"), xe = (e) => {
|
|
833
|
+
let n = e.config?.nodes ?? ne, a = e.config?.edges, { service: c, newEdge: [u, d], getBoardPoint: f } = J();
|
|
829
834
|
return b(() => {
|
|
830
835
|
c.start(), c.send({
|
|
831
836
|
type: "CONFIGURE",
|
|
@@ -835,7 +840,7 @@ var ye = /*#__PURE__*/ u("<div class=\"relative h-full w-full\"><div class=\"rel
|
|
|
835
840
|
}
|
|
836
841
|
});
|
|
837
842
|
}), y(c.stop), (() => {
|
|
838
|
-
var e = i(
|
|
843
|
+
var e = i(be), n = e.firstChild;
|
|
839
844
|
return e.$$mousemove = (e) => {
|
|
840
845
|
let t = u();
|
|
841
846
|
if (t) {
|
|
@@ -846,14 +851,14 @@ var ye = /*#__PURE__*/ u("<div class=\"relative h-full w-full\"><div class=\"rel
|
|
|
846
851
|
y1: n.y
|
|
847
852
|
});
|
|
848
853
|
}
|
|
849
|
-
}, e.$$mouseup = () => d(), o(n, t(
|
|
854
|
+
}, e.$$mouseup = () => d(), o(n, t(ye, {})), r((e) => l(n, "cursor", u() ? "inherit" : "crosshair")), s(), e;
|
|
850
855
|
})();
|
|
851
856
|
};
|
|
852
857
|
n(["mouseup", "mousemove"]);
|
|
853
858
|
//#endregion
|
|
854
859
|
//#region src/ui/Flow.tsx
|
|
855
|
-
var
|
|
856
|
-
return t(
|
|
860
|
+
var Se = (e) => t(re, { get children() {
|
|
861
|
+
return t(xe, e);
|
|
857
862
|
} });
|
|
858
863
|
//#endregion
|
|
859
|
-
export { M as CLASSES,
|
|
864
|
+
export { M as CLASSES, Se as Flow };
|