@operato/flow 9.0.0-beta.55 → 9.0.0-beta.61
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/CHANGELOG.md +17 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -5
- package/dist/src/api/tasks.d.ts +0 -7
- package/dist/src/api/tasks.js +0 -2517
- package/dist/src/api/tasks.js.map +0 -1
- package/dist/src/base/anchor-instance.d.ts +0 -30
- package/dist/src/base/anchor-instance.js +0 -82
- package/dist/src/base/anchor-instance.js.map +0 -1
- package/dist/src/base/flow-edge-instance.d.ts +0 -31
- package/dist/src/base/flow-edge-instance.js +0 -170
- package/dist/src/base/flow-edge-instance.js.map +0 -1
- package/dist/src/base/flow-node-abstract.d.ts +0 -49
- package/dist/src/base/flow-node-abstract.js +0 -199
- package/dist/src/base/flow-node-abstract.js.map +0 -1
- package/dist/src/components/flow-debug-panel.d.ts +0 -22
- package/dist/src/components/flow-debug-panel.js +0 -156
- package/dist/src/components/flow-debug-panel.js.map +0 -1
- package/dist/src/components/flow-executor.d.ts +0 -29
- package/dist/src/components/flow-executor.js +0 -88
- package/dist/src/components/flow-executor.js.map +0 -1
- package/dist/src/components/flow-options-builder.d.ts +0 -18
- package/dist/src/components/flow-options-builder.js +0 -145
- package/dist/src/components/flow-options-builder.js.map +0 -1
- package/dist/src/components/flow-properties-panel.d.ts +0 -22
- package/dist/src/components/flow-properties-panel.js +0 -232
- package/dist/src/components/flow-properties-panel.js.map +0 -1
- package/dist/src/components/flow-side-panel.d.ts +0 -9
- package/dist/src/components/flow-side-panel.js +0 -83
- package/dist/src/components/flow-side-panel.js.map +0 -1
- package/dist/src/components/flow-sidebar.d.ts +0 -7
- package/dist/src/components/flow-sidebar.js +0 -84
- package/dist/src/components/flow-sidebar.js.map +0 -1
- package/dist/src/components/flow-toolbar.d.ts +0 -15
- package/dist/src/components/flow-toolbar.js +0 -161
- package/dist/src/components/flow-toolbar.js.map +0 -1
- package/dist/src/components/property-editor.d.ts +0 -34
- package/dist/src/components/property-editor.js +0 -76
- package/dist/src/components/property-editor.js.map +0 -1
- package/dist/src/components/property-panel/data-mapper-popup.d.ts +0 -11
- package/dist/src/components/property-panel/data-mapper-popup.js +0 -86
- package/dist/src/components/property-panel/data-mapper-popup.js.map +0 -1
- package/dist/src/components/property-panel/task-selection-popup.d.ts +0 -10
- package/dist/src/components/property-panel/task-selection-popup.js +0 -106
- package/dist/src/components/property-panel/task-selection-popup.js.map +0 -1
- package/dist/src/context/flow-context.d.ts +0 -21
- package/dist/src/context/flow-context.js +0 -3
- package/dist/src/context/flow-context.js.map +0 -1
- package/dist/src/context/flow-debug-context.d.ts +0 -16
- package/dist/src/context/flow-debug-context.js +0 -3
- package/dist/src/context/flow-debug-context.js.map +0 -1
- package/dist/src/context/flow-edit-context.d.ts +0 -11
- package/dist/src/context/flow-edit-context.js +0 -3
- package/dist/src/context/flow-edit-context.js.map +0 -1
- package/dist/src/handlers/dnd-event-handler.d.ts +0 -9
- package/dist/src/handlers/dnd-event-handler.js +0 -41
- package/dist/src/handlers/dnd-event-handler.js.map +0 -1
- package/dist/src/handlers/flow-event-handler.d.ts +0 -20
- package/dist/src/handlers/flow-event-handler.js +0 -75
- package/dist/src/handlers/flow-event-handler.js.map +0 -1
- package/dist/src/handlers/keydown-event-handler.d.ts +0 -6
- package/dist/src/handlers/keydown-event-handler.js +0 -24
- package/dist/src/handlers/keydown-event-handler.js.map +0 -1
- package/dist/src/handlers/pointer-event-handler.d.ts +0 -9
- package/dist/src/handlers/pointer-event-handler.js +0 -118
- package/dist/src/handlers/pointer-event-handler.js.map +0 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +0 -1
- package/dist/src/nodes/decision.d.ts +0 -16
- package/dist/src/nodes/decision.js +0 -43
- package/dist/src/nodes/decision.js.map +0 -1
- package/dist/src/nodes/end-event.d.ts +0 -14
- package/dist/src/nodes/end-event.js +0 -47
- package/dist/src/nodes/end-event.js.map +0 -1
- package/dist/src/nodes/index.d.ts +0 -5
- package/dist/src/nodes/index.js +0 -19
- package/dist/src/nodes/index.js.map +0 -1
- package/dist/src/nodes/intermediate-event.d.ts +0 -14
- package/dist/src/nodes/intermediate-event.js +0 -52
- package/dist/src/nodes/intermediate-event.js.map +0 -1
- package/dist/src/nodes/iterator.d.ts +0 -12
- package/dist/src/nodes/iterator.js +0 -29
- package/dist/src/nodes/iterator.js.map +0 -1
- package/dist/src/nodes/select.d.ts +0 -17
- package/dist/src/nodes/select.js +0 -71
- package/dist/src/nodes/select.js.map +0 -1
- package/dist/src/nodes/start-event.d.ts +0 -15
- package/dist/src/nodes/start-event.js +0 -46
- package/dist/src/nodes/start-event.js.map +0 -1
- package/dist/src/nodes/subflow.d.ts +0 -12
- package/dist/src/nodes/subflow.js +0 -30
- package/dist/src/nodes/subflow.js.map +0 -1
- package/dist/src/nodes/task.d.ts +0 -17
- package/dist/src/nodes/task.js +0 -60
- package/dist/src/nodes/task.js.map +0 -1
- package/dist/src/ox-flow-editor.d.ts +0 -94
- package/dist/src/ox-flow-editor.js +0 -426
- package/dist/src/ox-flow-editor.js.map +0 -1
- package/dist/src/ox-flow-monitor.d.ts +0 -24
- package/dist/src/ox-flow-monitor.js +0 -117
- package/dist/src/ox-flow-monitor.js.map +0 -1
- package/dist/src/property-editors/ox-input-anchors.d.ts +0 -12
- package/dist/src/property-editors/ox-input-anchors.js +0 -163
- package/dist/src/property-editors/ox-input-anchors.js.map +0 -1
- package/dist/src/property-editors/ox-input-nodes.d.ts +0 -0
- package/dist/src/property-editors/ox-input-nodes.js +0 -2
- package/dist/src/property-editors/ox-input-nodes.js.map +0 -1
- package/dist/src/property-editors/ox-property-editor-anchors.d.ts +0 -6
- package/dist/src/property-editors/ox-property-editor-anchors.js +0 -25
- package/dist/src/property-editors/ox-property-editor-anchors.js.map +0 -1
- package/dist/src/property-editors/ox-property-editor-nodes.d.ts +0 -6
- package/dist/src/property-editors/ox-property-editor-nodes.js +0 -25
- package/dist/src/property-editors/ox-property-editor-nodes.js.map +0 -1
- package/dist/src/types.d.ts +0 -97
- package/dist/src/types.js +0 -2
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils/generate-mapping-scheme.d.ts +0 -6
- package/dist/src/utils/generate-mapping-scheme.js +0 -50
- package/dist/src/utils/generate-mapping-scheme.js.map +0 -1
- package/dist/stories/ox-flow-editor.stories.d.ts +0 -24
- package/dist/stories/ox-flow-editor.stories.js +0 -249
- package/dist/stories/ox-flow-editor.stories.js.map +0 -1
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { OxFlowEditor } from '../ox-flow-editor';
|
|
2
|
-
import { FlowEventHandler } from './flow-event-handler';
|
|
3
|
-
export class DndEventHandler extends FlowEventHandler {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
/** 드래그 오버 허용 */
|
|
7
|
-
this.allowDrop = (e) => {
|
|
8
|
-
e.preventDefault();
|
|
9
|
-
e.dataTransfer.dropEffect = 'copy';
|
|
10
|
-
};
|
|
11
|
-
/** 노드 드롭 처리 */
|
|
12
|
-
this.onDrop = (e) => {
|
|
13
|
-
var _a, _b;
|
|
14
|
-
e.preventDefault();
|
|
15
|
-
const data = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData('application/node-type');
|
|
16
|
-
if (!data)
|
|
17
|
-
return;
|
|
18
|
-
const transferedData = JSON.parse(data);
|
|
19
|
-
const clazz = this.host.availableNodeTypes[transferedData.id];
|
|
20
|
-
const editor = (_b = this.listeningTarget) === null || _b === void 0 ? void 0 : _b.querySelector('.editor');
|
|
21
|
-
const rect = editor === null || editor === void 0 ? void 0 : editor.getBoundingClientRect();
|
|
22
|
-
const x = e.clientX - rect.left;
|
|
23
|
-
const y = e.clientY - rect.top;
|
|
24
|
-
const newNode = new clazz({
|
|
25
|
-
type: transferedData.id,
|
|
26
|
-
id: OxFlowEditor.getUniqueId(),
|
|
27
|
-
pos: { x, y }
|
|
28
|
-
});
|
|
29
|
-
this.host.addFlowNode(newNode);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
addEventListeners() {
|
|
33
|
-
this.listeningTarget.addEventListener('dragover', this.allowDrop);
|
|
34
|
-
this.listeningTarget.addEventListener('drop', this.onDrop);
|
|
35
|
-
}
|
|
36
|
-
removeEventListeners() {
|
|
37
|
-
this.listeningTarget.removeEventListener('dragover', this.allowDrop);
|
|
38
|
-
this.listeningTarget.removeEventListener('drop', this.onDrop);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=dnd-event-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dnd-event-handler.js","sourceRoot":"","sources":["../../../src/handlers/dnd-event-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,OAAO,eAAgB,SAAQ,gBAAgB;IAArD;;QAWE,gBAAgB;QACR,cAAS,GAAG,CAAC,CAAY,EAAE,EAAE;YACnC,CAAC,CAAC,cAAc,EAAE,CAAA;YAClB,CAAC,CAAC,YAAa,CAAC,UAAU,GAAG,MAAM,CAAA;QACrC,CAAC,CAAA;QAED,eAAe;QACP,WAAM,GAAG,CAAC,CAAY,EAAE,EAAE;;YAChC,CAAC,CAAC,cAAc,EAAE,CAAA;YAElB,MAAM,IAAI,GAAG,MAAA,CAAC,CAAC,YAAY,0CAAE,OAAO,CAAC,uBAAuB,CAAC,CAAA;YAC7D,IAAI,CAAC,IAAI;gBAAE,OAAM;YAEjB,MAAM,cAAc,GAAmB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACvD,MAAM,KAAK,GAA2B,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;YACrF,MAAM,MAAM,GAAG,MAAA,IAAI,CAAC,eAAe,0CAAE,aAAa,CAAC,SAAS,CAAgB,CAAA;YAC5E,MAAM,IAAI,GAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,qBAAqB,EAAE,CAAA;YAC5C,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAA;YAC/B,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAA;YAE9B,MAAM,OAAO,GAAa,IAAI,KAAK,CAAC;gBAClC,IAAI,EAAE,cAAc,CAAC,EAAE;gBACvB,EAAE,EAAE,YAAY,CAAC,WAAW,EAAE;gBAC9B,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE;aACd,CAAC,CAAA;YAEF,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAChC,CAAC,CAAA;IACH,CAAC;IAtCQ,iBAAiB;QACtB,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,UAAU,EAAE,IAAI,CAAC,SAA0B,CAAC,CAAA;QAClF,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAuB,CAAC,CAAA;IAC7E,CAAC;IAEM,oBAAoB;QACzB,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,UAAU,EAAE,IAAI,CAAC,SAA0B,CAAC,CAAA;QACrF,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAuB,CAAC,CAAA;IAChF,CAAC;CA8BF","sourcesContent":["import { OxFlowEditor } from '../ox-flow-editor'\nimport { FlowNode, FlowNodeImplementation } from '../types'\nimport { FlowEventHandler } from './flow-event-handler'\n\nexport class DndEventHandler extends FlowEventHandler {\n public addEventListeners() {\n this.listeningTarget.addEventListener('dragover', this.allowDrop as EventListener)\n this.listeningTarget.addEventListener('drop', this.onDrop as EventListener)\n }\n\n public removeEventListeners() {\n this.listeningTarget.removeEventListener('dragover', this.allowDrop as EventListener)\n this.listeningTarget.removeEventListener('drop', this.onDrop as EventListener)\n }\n\n /** 드래그 오버 허용 */\n private allowDrop = (e: DragEvent) => {\n e.preventDefault()\n e.dataTransfer!.dropEffect = 'copy'\n }\n\n /** 노드 드롭 처리 */\n private onDrop = (e: DragEvent) => {\n e.preventDefault()\n\n const data = e.dataTransfer?.getData('application/node-type')\n if (!data) return\n\n const transferedData: { id: string } = JSON.parse(data)\n const clazz: FlowNodeImplementation = this.host.availableNodeTypes[transferedData.id]\n const editor = this.listeningTarget?.querySelector('.editor') as HTMLElement\n const rect = editor?.getBoundingClientRect()\n const x = e.clientX - rect.left\n const y = e.clientY - rect.top\n\n const newNode: FlowNode = new clazz({\n type: transferedData.id,\n id: OxFlowEditor.getUniqueId(),\n pos: { x, y }\n })\n\n this.host.addFlowNode(newNode)\n }\n}\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Anchor, FlowEdge, FlowNode } from '../types.js';
|
|
2
|
-
import { OxFlowEditor } from '../ox-flow-editor.js';
|
|
3
|
-
export declare abstract class FlowEventHandler {
|
|
4
|
-
protected host: OxFlowEditor;
|
|
5
|
-
constructor(host: OxFlowEditor);
|
|
6
|
-
abstract addEventListeners(): void;
|
|
7
|
-
abstract removeEventListeners(): void;
|
|
8
|
-
get listeningTarget(): HTMLElement | DocumentFragment;
|
|
9
|
-
protected getFlowObject(e: Event): {
|
|
10
|
-
type: 'node' | 'edge' | 'anchor';
|
|
11
|
-
object: FlowNode | FlowEdge | Anchor;
|
|
12
|
-
} | undefined;
|
|
13
|
-
protected findNearestAnchor(x: number, y: number, fromAnchor: Anchor): {
|
|
14
|
-
anchor: Anchor;
|
|
15
|
-
anchorX: number;
|
|
16
|
-
anchorY: number;
|
|
17
|
-
weight?: number;
|
|
18
|
-
} | null;
|
|
19
|
-
protected getEditorOffset(): DOMRect;
|
|
20
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
export class FlowEventHandler {
|
|
2
|
-
constructor(host) {
|
|
3
|
-
this.host = host;
|
|
4
|
-
}
|
|
5
|
-
get listeningTarget() {
|
|
6
|
-
return this.host.renderRoot;
|
|
7
|
-
}
|
|
8
|
-
getFlowObject(e) {
|
|
9
|
-
const target = e.target;
|
|
10
|
-
const closest = target.closest('.node, .edge');
|
|
11
|
-
if (!closest) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
if (closest.classList.contains('edge')) {
|
|
15
|
-
const id = closest.getAttribute('data-id');
|
|
16
|
-
const edge = this.host.edges.find(edge => edge.id == id);
|
|
17
|
-
return edge && { type: 'edge', object: edge };
|
|
18
|
-
}
|
|
19
|
-
else if (closest.classList.contains('node')) {
|
|
20
|
-
const id = closest.getAttribute('data-id');
|
|
21
|
-
const node = this.host.nodes.find(node => node.id == id);
|
|
22
|
-
if (!node) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const anchorElement = target.closest('.anchor');
|
|
26
|
-
if (anchorElement) {
|
|
27
|
-
const anchorId = anchorElement.getAttribute('data-id');
|
|
28
|
-
if (anchorId) {
|
|
29
|
-
const anchor = node.findAnchor(anchorId);
|
|
30
|
-
if (anchor) {
|
|
31
|
-
return { type: 'anchor', object: anchor };
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return { type: 'node', object: node };
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
findNearestAnchor(x, y, fromAnchor) {
|
|
39
|
-
let nearestNode = null;
|
|
40
|
-
let nearestAnchor = null;
|
|
41
|
-
let minDistance = 30;
|
|
42
|
-
for (const node of this.host.nodes) {
|
|
43
|
-
if (node.id == fromAnchor.node.id) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
for (const anchor of node.anchors) {
|
|
47
|
-
if (anchor.type == 'out') {
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
const { x: nodeX, y: nodeY } = node.pos;
|
|
51
|
-
const { x: offsetX, y: offsetY } = anchor.pos;
|
|
52
|
-
const anchorX = nodeX + offsetX;
|
|
53
|
-
const anchorY = nodeY + offsetY;
|
|
54
|
-
const distance = Math.hypot(x - anchorX, y - anchorY);
|
|
55
|
-
if (distance < minDistance) {
|
|
56
|
-
nearestNode = node;
|
|
57
|
-
nearestAnchor = anchor;
|
|
58
|
-
minDistance = distance;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return nearestNode && nearestAnchor
|
|
63
|
-
? {
|
|
64
|
-
anchor: nearestAnchor,
|
|
65
|
-
anchorX: nearestNode.pos.x + nearestAnchor.pos.x,
|
|
66
|
-
anchorY: nearestNode.pos.y + nearestAnchor.pos.y
|
|
67
|
-
}
|
|
68
|
-
: null;
|
|
69
|
-
}
|
|
70
|
-
getEditorOffset() {
|
|
71
|
-
var _a;
|
|
72
|
-
return ((_a = this.host.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.editor')).getBoundingClientRect();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=flow-event-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flow-event-handler.js","sourceRoot":"","sources":["../../../src/handlers/flow-event-handler.ts"],"names":[],"mappings":"AAGA,MAAM,OAAgB,gBAAgB;IAGpC,YAAY,IAAkB;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAKD,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,CAAA;IAC7B,CAAC;IAES,aAAa,CACrB,CAAQ;QAER,MAAM,MAAM,GAAG,CAAC,CAAC,MAAqB,CAAA;QAEtC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAM;QACR,CAAC;QAED,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ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,CAAC;aACjD;YACH,CAAC,CAAC,IAAI,CAAA;IACV,CAAC;IAES,eAAe;;QACvB,OAAO,CAAC,MAAA,IAAI,CAAC,IAAI,CAAC,UAAU,0CAAE,aAAa,CAAC,SAAS,CAAiB,CAAA,CAAC,qBAAqB,EAAE,CAAA;IAChG,CAAC;CACF","sourcesContent":["import { Anchor, FlowEdge, FlowNode } from '../types.js'\nimport { OxFlowEditor } from '../ox-flow-editor.js'\n\nexport abstract class FlowEventHandler {\n protected host: OxFlowEditor\n\n constructor(host: OxFlowEditor) {\n this.host = host\n }\n\n public abstract addEventListeners(): void\n public abstract removeEventListeners(): void\n\n get listeningTarget() {\n return this.host.renderRoot\n }\n\n protected getFlowObject(\n e: Event\n ): { type: 'node' | 'edge' | 'anchor'; object: FlowNode | FlowEdge | Anchor } | undefined {\n const target = e.target as HTMLElement\n\n const closest = target.closest('.node, .edge')\n if (!closest) {\n return\n }\n\n if (closest.classList.contains('edge')) {\n const id = closest.getAttribute('data-id')\n const edge = this.host.edges.find(edge => edge.id == id)\n\n return edge && { type: 'edge', object: edge }\n } else if (closest.classList.contains('node')) {\n const id = closest.getAttribute('data-id')\n const node = this.host.nodes.find(node => node.id == id)\n\n if (!node) {\n return\n }\n\n const anchorElement = target.closest('.anchor')\n if (anchorElement) {\n const anchorId = anchorElement.getAttribute('data-id')\n if (anchorId) {\n const anchor = node.findAnchor(anchorId)\n if (anchor) {\n return { type: 'anchor', object: anchor }\n }\n }\n }\n\n return { type: 'node', object: node }\n }\n }\n\n protected findNearestAnchor(\n x: number,\n y: number,\n fromAnchor: Anchor\n ): { anchor: Anchor; anchorX: number; anchorY: number; weight?: number } | null {\n let nearestNode: FlowNode | null = null\n let nearestAnchor: Anchor | null = null\n let minDistance = 30\n\n for (const node of this.host.nodes) {\n if (node.id == fromAnchor.node.id) {\n continue\n }\n\n for (const anchor of node.anchors!) {\n if (anchor.type == 'out') {\n continue\n }\n\n const { x: nodeX, y: nodeY } = node.pos\n const { x: offsetX, y: offsetY } = anchor.pos\n\n const anchorX = nodeX + offsetX\n const anchorY = nodeY + offsetY\n const distance = Math.hypot(x - anchorX, y - anchorY)\n\n if (distance < minDistance) {\n nearestNode = node\n nearestAnchor = anchor\n minDistance = distance\n }\n }\n }\n\n return nearestNode && nearestAnchor\n ? {\n anchor: nearestAnchor,\n anchorX: nearestNode.pos.x + nearestAnchor.pos.x,\n anchorY: nearestNode.pos.y + nearestAnchor.pos.y\n }\n : null\n }\n\n protected getEditorOffset(): DOMRect {\n return (this.host.renderRoot?.querySelector('.editor') as HTMLElement).getBoundingClientRect()\n }\n}\n"]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { FlowEventHandler } from './flow-event-handler.js';
|
|
2
|
-
export class KeydownEventHandler extends FlowEventHandler {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
this.onKeydown = (e) => {
|
|
6
|
-
const isDeleteKey = e.key === 'Delete' || e.key === 'Backspace'; // MacOS 지원
|
|
7
|
-
const flowContext = this.host.context;
|
|
8
|
-
const entity = flowContext.selected;
|
|
9
|
-
if (entity && isDeleteKey) {
|
|
10
|
-
if (flowContext.selected) {
|
|
11
|
-
this.host.deleteEntity(entity);
|
|
12
|
-
}
|
|
13
|
-
e.preventDefault();
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
addEventListeners() {
|
|
18
|
-
window.addEventListener('keydown', this.onKeydown);
|
|
19
|
-
}
|
|
20
|
-
removeEventListeners() {
|
|
21
|
-
window.removeEventListener('keydown', this.onKeydown);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=keydown-event-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keydown-event-handler.js","sourceRoot":"","sources":["../../../src/handlers/keydown-event-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,MAAM,OAAO,mBAAoB,SAAQ,gBAAgB;IAAzD;;QASU,cAAS,GAAG,CAAC,CAAgB,EAAE,EAAE;YACvC,MAAM,WAAW,GAAG,CAAC,CAAC,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,GAAG,KAAK,WAAW,CAAA,CAAC,WAAW;YAC3E,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;YACrC,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAA;YAEnC,IAAI,MAAM,IAAI,WAAW,EAAE,CAAC;gBAC1B,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;oBACzB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;gBAChC,CAAC;gBAED,CAAC,CAAC,cAAc,EAAE,CAAA;YACpB,CAAC;QACH,CAAC,CAAA;IACH,CAAC;IArBQ,iBAAiB;QACtB,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,SAA0B,CAAC,CAAA;IACrE,CAAC;IAEM,oBAAoB;QACzB,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,IAAI,CAAC,SAA0B,CAAC,CAAA;IACxE,CAAC;CAeF","sourcesContent":["import { FlowEventHandler } from './flow-event-handler.js'\n\nexport class KeydownEventHandler extends FlowEventHandler {\n public addEventListeners() {\n window.addEventListener('keydown', this.onKeydown as EventListener)\n }\n\n public removeEventListeners() {\n window.removeEventListener('keydown', this.onKeydown as EventListener)\n }\n\n private onKeydown = (e: KeyboardEvent) => {\n const isDeleteKey = e.key === 'Delete' || e.key === 'Backspace' // MacOS 지원\n const flowContext = this.host.context\n const entity = flowContext.selected\n\n if (entity && isDeleteKey) {\n if (flowContext.selected) {\n this.host.deleteEntity(entity)\n }\n\n e.preventDefault()\n }\n }\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FlowEventHandler } from './flow-event-handler.js';
|
|
2
|
-
export declare class PointerEventHandler extends FlowEventHandler {
|
|
3
|
-
addEventListeners(): void;
|
|
4
|
-
removeEventListeners(): void;
|
|
5
|
-
onPointerdown: (e: Event) => void;
|
|
6
|
-
/** 노드 드래그 시작 */
|
|
7
|
-
private startNodeDrag;
|
|
8
|
-
private handleStartEdgeDrag;
|
|
9
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { FlowEdgeInstance } from '../base/flow-edge-instance.js';
|
|
2
|
-
import { FlowEventHandler } from './flow-event-handler.js';
|
|
3
|
-
export class PointerEventHandler extends FlowEventHandler {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
this.onPointerdown = (e) => {
|
|
7
|
-
const { type, object } = this.getFlowObject(e) || {};
|
|
8
|
-
switch (type) {
|
|
9
|
-
case 'node':
|
|
10
|
-
this.host.selected = object; // setSelectedNode(object as FlowNode)
|
|
11
|
-
this.startNodeDrag(e, object);
|
|
12
|
-
break;
|
|
13
|
-
case 'edge':
|
|
14
|
-
this.host.selected = object; // setSelectedEdge(object as FlowEdge)
|
|
15
|
-
break;
|
|
16
|
-
case 'anchor':
|
|
17
|
-
this.handleStartEdgeDrag(e, object);
|
|
18
|
-
break;
|
|
19
|
-
default:
|
|
20
|
-
// this.host.clearSelection()
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
/** 노드 드래그 시작 */
|
|
24
|
-
this.startNodeDrag = (e, node) => {
|
|
25
|
-
e.stopPropagation();
|
|
26
|
-
const { x, y } = node.pos || { x: 0, y: 0 };
|
|
27
|
-
var isDragging = true;
|
|
28
|
-
var offsetX = e.clientX - x;
|
|
29
|
-
var offsetY = e.clientY - y;
|
|
30
|
-
const onNodeDrag = (e) => {
|
|
31
|
-
if (!isDragging)
|
|
32
|
-
return;
|
|
33
|
-
const newX = e.clientX - offsetX;
|
|
34
|
-
const newY = e.clientY - offsetY;
|
|
35
|
-
node.pos = {
|
|
36
|
-
x: newX,
|
|
37
|
-
y: newY
|
|
38
|
-
};
|
|
39
|
-
this.host.onNodeUpdated(node);
|
|
40
|
-
};
|
|
41
|
-
const onNodeStopDrag = () => {
|
|
42
|
-
isDragging = false;
|
|
43
|
-
window.removeEventListener('pointermove', onNodeDrag);
|
|
44
|
-
window.removeEventListener('pointerup', onNodeStopDrag);
|
|
45
|
-
};
|
|
46
|
-
window.addEventListener('pointermove', onNodeDrag);
|
|
47
|
-
window.addEventListener('pointerup', onNodeStopDrag);
|
|
48
|
-
};
|
|
49
|
-
this.handleStartEdgeDrag = (e, anchor) => {
|
|
50
|
-
const fromNode = anchor.node;
|
|
51
|
-
const fromAnchor = anchor;
|
|
52
|
-
if (!fromNode || !fromAnchor)
|
|
53
|
-
return;
|
|
54
|
-
const { x, y } = fromNode.pos;
|
|
55
|
-
const { x: offsetX, y: offsetY } = fromAnchor.pos;
|
|
56
|
-
const fromX = x + offsetX;
|
|
57
|
-
const fromY = y + offsetY;
|
|
58
|
-
var edgeGuide = null;
|
|
59
|
-
var { nodes, edges, addLog } = this.host;
|
|
60
|
-
const onPointerMove = (e) => {
|
|
61
|
-
const mouseX = e.clientX - this.getEditorOffset().left;
|
|
62
|
-
const mouseY = e.clientY - this.getEditorOffset().top;
|
|
63
|
-
const nearestAnchor = this.findNearestAnchor(mouseX, mouseY, fromAnchor);
|
|
64
|
-
const toX = nearestAnchor ? nearestAnchor.anchorX : mouseX;
|
|
65
|
-
const toY = nearestAnchor ? nearestAnchor.anchorY : mouseY;
|
|
66
|
-
edgeGuide = { fromX, fromY, toX, toY, weight: fromAnchor.weight, label: fromAnchor.label };
|
|
67
|
-
this.host.drawEdgeGuide(edgeGuide);
|
|
68
|
-
};
|
|
69
|
-
const onPointerUp = (e) => {
|
|
70
|
-
const mouseX = e.clientX - this.getEditorOffset().left;
|
|
71
|
-
const mouseY = e.clientY - this.getEditorOffset().top;
|
|
72
|
-
const { anchor: nearestAnchor } = this.findNearestAnchor(mouseX, mouseY, fromAnchor) || {};
|
|
73
|
-
if (nearestAnchor) {
|
|
74
|
-
if (fromNode.id === nearestAnchor.node.id) {
|
|
75
|
-
addLog('Cannot connect a node to itself.');
|
|
76
|
-
}
|
|
77
|
-
else if (!edges.some(edge => edge.from.nodeId === fromNode.id &&
|
|
78
|
-
edge.from.anchorId === fromAnchor.id &&
|
|
79
|
-
edge.to.nodeId === nearestAnchor.node.id &&
|
|
80
|
-
edge.to.anchorId === nearestAnchor.id)) {
|
|
81
|
-
const newEdge = new FlowEdgeInstance({
|
|
82
|
-
id: `edge-${edges.length + 1}`,
|
|
83
|
-
type: 'control',
|
|
84
|
-
from: {
|
|
85
|
-
nodeId: fromNode.id,
|
|
86
|
-
anchorId: fromAnchor.id
|
|
87
|
-
},
|
|
88
|
-
to: {
|
|
89
|
-
nodeId: nearestAnchor.node.id,
|
|
90
|
-
anchorId: nearestAnchor.id
|
|
91
|
-
},
|
|
92
|
-
weight: edgeGuide === null || edgeGuide === void 0 ? void 0 : edgeGuide.weight,
|
|
93
|
-
label: edgeGuide === null || edgeGuide === void 0 ? void 0 : edgeGuide.label,
|
|
94
|
-
dataMappings: []
|
|
95
|
-
}, fromNode, nearestAnchor.node);
|
|
96
|
-
this.host.addFlowEdge(newEdge, true);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
addLog('Edge already exists.');
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
this.host.drawEdgeGuide(null);
|
|
103
|
-
this.host.requestUpdate();
|
|
104
|
-
window.removeEventListener('pointermove', onPointerMove);
|
|
105
|
-
window.removeEventListener('pointerup', onPointerUp);
|
|
106
|
-
};
|
|
107
|
-
window.addEventListener('pointermove', onPointerMove);
|
|
108
|
-
window.addEventListener('pointerup', onPointerUp);
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
addEventListeners() {
|
|
112
|
-
this.listeningTarget.addEventListener('pointerdown', this.onPointerdown);
|
|
113
|
-
}
|
|
114
|
-
removeEventListeners() {
|
|
115
|
-
this.listeningTarget.removeEventListener('pointerdown', this.onPointerdown);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=pointer-event-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pointer-event-handler.js","sourceRoot":"","sources":["../../../src/handlers/pointer-event-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAE1D,MAAM,OAAO,mBAAoB,SAAQ,gBAAgB;IAAzD;;QASE,kBAAa,GAAG,CAAC,CAAQ,EAAE,EAAE;YAC3B,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;YAEpD,QAAQ,IAAI,EAAE,CAAC;gBACb,KAAK,MAAM;oBACT,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,MAAkB,CAAA,CAAC,sCAAsC;oBAC9E,IAAI,CAAC,aAAa,CAAC,CAAiB,EAAE,MAAkB,CAAC,CAAA;oBACzD,MAAK;gBACP,KAAK,MAAM;oBACT,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,MAAkB,CAAA,CAAC,sCAAsC;oBAC9E,MAAK;gBACP,KAAK,QAAQ;oBACX,IAAI,CAAC,mBAAmB,CAAC,CAAiB,EAAE,MAAgB,CAAC,CAAA;oBAC7D,MAAK;gBACP,QAAQ;gBACR,6BAA6B;YAC/B,CAAC;QACH,CAAC,CAAA;QAED,gBAAgB;QACR,kBAAa,GAAG,CAAC,CAAe,EAAE,IAAc,EAAE,EAAE;YAC1D,CAAC,CAAC,eAAe,EAAE,CAAA;YAEnB,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;YAE3C,IAAI,UAAU,GAAG,IAAI,CAAA;YAErB,IAAI,OAA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BAAM,CAAC;wBACN,MAAM,CAAC,sBAAsB,CAAC,CAAA;oBAChC,CAAC;gBACH,CAAC;gBAED,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;gBAC7B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAA;gBAEzB,MAAM,CAAC,mBAAmB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAA;gBACxD,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;YACtD,CAAC,CAAA;YAED,MAAM,CAAC,gBAAgB,CAAC,aAAa,EAAE,aAAa,CAAC,CAAA;YACrD,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;QACnD,CAAC,CAAA;IACH,CAAC;IAhJQ,iBAAiB;QACtB,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;IAC1E,CAAC;IAEM,oBAAoB;QACzB,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAA;IAC7E,CAAC;CA0IF","sourcesContent":["import { FlowEdgeInstance } from '../base/flow-edge-instance.js'\nimport { Anchor, FlowEdge, FlowNode } from '../types.js'\nimport { FlowEventHandler } from './flow-event-handler.js'\n\nexport class PointerEventHandler extends FlowEventHandler {\n public addEventListeners() {\n this.listeningTarget.addEventListener('pointerdown', this.onPointerdown)\n }\n\n public removeEventListeners() {\n this.listeningTarget.removeEventListener('pointerdown', this.onPointerdown)\n }\n\n onPointerdown = (e: Event) => {\n const { type, object } = this.getFlowObject(e) || {}\n\n switch (type) {\n case 'node':\n this.host.selected = object as FlowNode // setSelectedNode(object as FlowNode)\n this.startNodeDrag(e as PointerEvent, object as FlowNode)\n break\n case 'edge':\n this.host.selected = object as FlowEdge // setSelectedEdge(object as FlowEdge)\n break\n case 'anchor':\n this.handleStartEdgeDrag(e as PointerEvent, object as Anchor)\n break\n default:\n // this.host.clearSelection()\n }\n }\n\n /** 노드 드래그 시작 */\n private startNodeDrag = (e: PointerEvent, node: FlowNode) => {\n e.stopPropagation()\n\n const { x, y } = node.pos || { x: 0, y: 0 }\n\n var isDragging = true\n\n var offsetX = e.clientX - x\n var offsetY = e.clientY - y\n\n const onNodeDrag = (e: MouseEvent) => {\n if (!isDragging) return\n\n const newX = e.clientX - offsetX\n const newY = e.clientY - offsetY\n\n node.pos = {\n x: newX,\n y: newY\n }\n\n this.host.onNodeUpdated(node)\n }\n\n const onNodeStopDrag = () => {\n isDragging = false\n window.removeEventListener('pointermove', onNodeDrag)\n window.removeEventListener('pointerup', onNodeStopDrag)\n }\n\n window.addEventListener('pointermove', onNodeDrag)\n window.addEventListener('pointerup', onNodeStopDrag)\n }\n\n private handleStartEdgeDrag = (e: Event, anchor: Anchor) => {\n const fromNode = anchor.node\n\n const fromAnchor = anchor\n\n if (!fromNode || !fromAnchor) return\n\n const { x, y } = fromNode.pos\n const { x: offsetX, y: offsetY } = fromAnchor.pos\n\n const fromX = x + offsetX\n const fromY = y + offsetY\n\n var edgeGuide: any = null\n var { nodes, edges, addLog } = this.host\n\n const onPointerMove = (e: MouseEvent) => {\n const mouseX = e.clientX - this.getEditorOffset().left\n const mouseY = e.clientY - this.getEditorOffset().top\n\n const nearestAnchor = this.findNearestAnchor(mouseX, mouseY, fromAnchor)\n const toX = nearestAnchor ? nearestAnchor.anchorX : mouseX\n const toY = nearestAnchor ? nearestAnchor.anchorY : mouseY\n\n edgeGuide = { fromX, fromY, toX, toY, weight: fromAnchor.weight, label: fromAnchor.label }\n this.host.drawEdgeGuide(edgeGuide)\n }\n\n const onPointerUp = (e: MouseEvent) => {\n const mouseX = e.clientX - this.getEditorOffset().left\n const mouseY = e.clientY - this.getEditorOffset().top\n\n const { anchor: nearestAnchor } = this.findNearestAnchor(mouseX, mouseY, fromAnchor) || {}\n\n if (nearestAnchor) {\n if (fromNode.id === nearestAnchor.node.id) {\n addLog('Cannot connect a node to itself.')\n } else if (\n !edges.some(\n edge =>\n edge.from.nodeId === fromNode.id &&\n edge.from.anchorId === fromAnchor.id &&\n edge.to.nodeId === nearestAnchor.node.id &&\n edge.to.anchorId === nearestAnchor.id\n )\n ) {\n const newEdge: FlowEdge = new FlowEdgeInstance(\n {\n id: `edge-${edges.length + 1}`,\n type: 'control',\n from: {\n nodeId: fromNode.id,\n anchorId: fromAnchor.id\n },\n to: {\n nodeId: nearestAnchor.node.id,\n anchorId: nearestAnchor.id\n },\n weight: edgeGuide?.weight,\n label: edgeGuide?.label,\n dataMappings: []\n },\n fromNode,\n nearestAnchor.node\n )\n\n this.host.addFlowEdge(newEdge, true)\n } else {\n addLog('Edge already exists.')\n }\n }\n\n this.host.drawEdgeGuide(null)\n this.host.requestUpdate()\n\n window.removeEventListener('pointermove', onPointerMove)\n window.removeEventListener('pointerup', onPointerUp)\n }\n\n window.addEventListener('pointermove', onPointerMove)\n window.addEventListener('pointerup', onPointerUp)\n }\n}\n"]}
|
package/dist/src/index.d.ts
DELETED
package/dist/src/index.js
DELETED
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA","sourcesContent":["export * from './ox-flow-editor.js'\nexport * from './ox-flow-monitor.js'\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SVGTemplateResult } from 'lit';
|
|
2
|
-
import { AnchorModel, FlowDataSchema } from '../types.js';
|
|
3
|
-
import { FlowNodeAbstract } from '../base/flow-node-abstract.js';
|
|
4
|
-
export declare class Decision extends FlowNodeAbstract {
|
|
5
|
-
get type(): string;
|
|
6
|
-
/** Input Data Schema */
|
|
7
|
-
get inputSchema(): FlowDataSchema;
|
|
8
|
-
/** Output Data Schema */
|
|
9
|
-
get outputSchema(): FlowDataSchema;
|
|
10
|
-
get size(): {
|
|
11
|
-
w: number;
|
|
12
|
-
h: number;
|
|
13
|
-
};
|
|
14
|
-
renderNode(): SVGTemplateResult;
|
|
15
|
-
get anchorModels(): AnchorModel[];
|
|
16
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { svg } from 'lit';
|
|
2
|
-
import { FlowNodeAbstract } from '../base/flow-node-abstract.js';
|
|
3
|
-
export class Decision extends FlowNodeAbstract {
|
|
4
|
-
get type() {
|
|
5
|
-
return 'decision';
|
|
6
|
-
}
|
|
7
|
-
/** Input Data Schema */
|
|
8
|
-
get inputSchema() {
|
|
9
|
-
return {
|
|
10
|
-
type: 'object',
|
|
11
|
-
properties: {
|
|
12
|
-
decisionValue: { type: 'boolean' }
|
|
13
|
-
},
|
|
14
|
-
required: ['decisionValue']
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/** Output Data Schema */
|
|
18
|
-
get outputSchema() {
|
|
19
|
-
return {
|
|
20
|
-
type: 'object',
|
|
21
|
-
properties: {}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
get size() {
|
|
25
|
-
return this.model.size || { w: 120, h: 60 };
|
|
26
|
-
}
|
|
27
|
-
renderNode() {
|
|
28
|
-
const { w, h } = this.size;
|
|
29
|
-
return svg `
|
|
30
|
-
<polygon points="0,-${h / 2} ${w / 2},0 0,${h / 2} -${w / 2},0" class="node-outline" fill="#fff3cd" stroke-width="1"/>
|
|
31
|
-
<text class="node-label" x="0" y="5" text-anchor="middle">${this.label}</text>
|
|
32
|
-
`;
|
|
33
|
-
}
|
|
34
|
-
get anchorModels() {
|
|
35
|
-
const { w, h } = this.size;
|
|
36
|
-
return [
|
|
37
|
-
{ id: 'in', type: 'in', pos: { x: 0, y: -h / 2 }, angle: 270 },
|
|
38
|
-
{ id: 'yes', type: 'out', label: 'Yes', pos: { x: 0, y: h / 2 }, angle: 90, weight: 2 },
|
|
39
|
-
{ id: 'no', type: 'out', label: 'No', pos: { x: w / 2, y: 0 }, angle: 0, weight: 1 }
|
|
40
|
-
].map(anchorModel => this.applyAnchorsOption(anchorModel));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=decision.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decision.js","sourceRoot":"","sources":["../../../src/nodes/decision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,KAAK,CAAA;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,MAAM,OAAO,QAAS,SAAQ,gBAAgB;IAC5C,IAAI,IAAI;QACN,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,wBAAwB;IACxB,IAAI,WAAW;QACb,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,aAAa,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;aACnC;YACD,QAAQ,EAAE,CAAC,eAAe,CAAC;SAC5B,CAAA;IACH,CAAC;IAED,yBAAyB;IACzB,IAAI,YAAY;QACd,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf,CAAA;IACH,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAM,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAA;IAC9C,CAAC;IAED,UAAU;QACR,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;QAE1B,OAAO,GAAG,CAAA;4BACc,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;kEACC,IAAI,CAAC,KAAK;KACvE,CAAA;IACH,CAAC;IAED,IAAI,YAAY;QACd,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;QAE1B,OAAO;YACL,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;YAC9D,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;YACvF,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;SACrF,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,WAA0B,CAAC,CAAC,CAAA;IAC3E,CAAC;CACF","sourcesContent":["import { svg, SVGTemplateResult } from 'lit'\nimport { AnchorModel, FlowDataSchema } from '../types.js'\nimport { FlowNodeAbstract } from '../base/flow-node-abstract.js'\n\nexport class Decision extends FlowNodeAbstract {\n get type() {\n return 'decision'\n }\n\n /** Input Data Schema */\n get inputSchema(): FlowDataSchema {\n return {\n type: 'object',\n properties: {\n decisionValue: { type: 'boolean' }\n },\n required: ['decisionValue']\n }\n }\n\n /** Output Data Schema */\n get outputSchema(): FlowDataSchema {\n return {\n type: 'object',\n properties: {}\n }\n }\n\n get size(): { w: number; h: number } {\n return this.model!.size || { w: 120, h: 60 }\n }\n\n renderNode(): SVGTemplateResult {\n const { w, h } = this.size\n\n return svg`\n <polygon points=\"0,-${h / 2} ${w / 2},0 0,${h / 2} -${w / 2},0\" class=\"node-outline\" fill=\"#fff3cd\" stroke-width=\"1\"/>\n <text class=\"node-label\" x=\"0\" y=\"5\" text-anchor=\"middle\">${this.label}</text>\n `\n }\n\n get anchorModels(): AnchorModel[] {\n const { w, h } = this.size\n\n return [\n { id: 'in', type: 'in', pos: { x: 0, y: -h / 2 }, angle: 270 },\n { id: 'yes', type: 'out', label: 'Yes', pos: { x: 0, y: h / 2 }, angle: 90, weight: 2 },\n { id: 'no', type: 'out', label: 'No', pos: { x: w / 2, y: 0 }, angle: 0, weight: 1 }\n ].map(anchorModel => this.applyAnchorsOption(anchorModel as AnchorModel))\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SVGTemplateResult } from 'lit';
|
|
2
|
-
import { AnchorModel, FlowDataSchema } from '../types.js';
|
|
3
|
-
import { FlowNodeAbstract } from '../base/flow-node-abstract.js';
|
|
4
|
-
export declare class EndEvent extends FlowNodeAbstract {
|
|
5
|
-
get type(): string;
|
|
6
|
-
get inputSchema(): FlowDataSchema;
|
|
7
|
-
get outputSchema(): FlowDataSchema;
|
|
8
|
-
get size(): {
|
|
9
|
-
w: number;
|
|
10
|
-
h: number;
|
|
11
|
-
};
|
|
12
|
-
renderNode(): SVGTemplateResult;
|
|
13
|
-
get anchorModels(): AnchorModel[];
|
|
14
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { svg } from 'lit';
|
|
2
|
-
import { FlowNodeAbstract } from '../base/flow-node-abstract.js';
|
|
3
|
-
export class EndEvent extends FlowNodeAbstract {
|
|
4
|
-
get type() {
|
|
5
|
-
return 'end';
|
|
6
|
-
}
|
|
7
|
-
get inputSchema() {
|
|
8
|
-
return {
|
|
9
|
-
type: 'object',
|
|
10
|
-
properties: {
|
|
11
|
-
result: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {}
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
required: ['result']
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
get outputSchema() {
|
|
20
|
-
return {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
result: {
|
|
24
|
-
type: 'object',
|
|
25
|
-
properties: {}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
required: ['result']
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
get size() {
|
|
32
|
-
return this.model.size || { w: 48, h: 48 };
|
|
33
|
-
}
|
|
34
|
-
renderNode() {
|
|
35
|
-
const { w, h } = this.size;
|
|
36
|
-
const radius = Math.min(w, h) / 2 - 2;
|
|
37
|
-
return svg `
|
|
38
|
-
<circle class="node-outline" cx="0" cy="0" r="${radius}" fill="#f8d7da" stroke="#000" stroke-width="4" />
|
|
39
|
-
|
|
40
|
-
<text class="node-label" x="0" y="5" text-anchor="middle">${this.label}</text>
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
get anchorModels() {
|
|
44
|
-
return [{ id: 'in', type: 'in', pos: { x: 0, y: -24 }, angle: 270 }].map(anchorModel => this.applyAnchorsOption(anchorModel));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=end-event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"end-event.js","sourceRoot":"","sources":["../../../src/nodes/end-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,KAAK,CAAA;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,MAAM,OAAO,QAAS,SAAQ,gBAAgB;IAC5C,IAAI,IAAI;QACN,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,WAAW;QACb,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,EAAE;iBACf;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB,CAAA;IACH,CAAC;IAED,IAAI,YAAY;QACd,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,EAAE;iBACf;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB,CAAA;IACH,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAM,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAA;IAC7C,CAAC;IAED,UAAU;QACR,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAA;QAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAErC,OAAO,GAAG,CAAA;sDACwC,MAAM;;kEAEM,IAAI,CAAC,KAAK;KACvE,CAAA;IACH,CAAC;IAED,IAAI,YAAY;QACd,OAAO,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CACrF,IAAI,CAAC,kBAAkB,CAAC,WAA0B,CAAC,CACpD,CAAA;IACH,CAAC;CACF","sourcesContent":["import { svg, SVGTemplateResult } from 'lit'\nimport { AnchorModel, FlowDataSchema } from '../types.js'\nimport { FlowNodeAbstract } from '../base/flow-node-abstract.js'\n\nexport class EndEvent extends FlowNodeAbstract {\n get type() {\n return 'end'\n }\n\n get inputSchema(): FlowDataSchema {\n return {\n type: 'object',\n properties: {\n result: {\n type: 'object',\n properties: {}\n }\n },\n required: ['result']\n }\n }\n\n get outputSchema(): FlowDataSchema {\n return {\n type: 'object',\n properties: {\n result: {\n type: 'object',\n properties: {}\n }\n },\n required: ['result']\n }\n }\n\n get size(): { w: number; h: number } {\n return this.model!.size || { w: 48, h: 48 }\n }\n\n renderNode(): SVGTemplateResult {\n const { w, h } = this.size\n const radius = Math.min(w, h) / 2 - 2\n\n return svg`\n <circle class=\"node-outline\" cx=\"0\" cy=\"0\" r=\"${radius}\" fill=\"#f8d7da\" stroke=\"#000\" stroke-width=\"4\" />\n \n <text class=\"node-label\" x=\"0\" y=\"5\" text-anchor=\"middle\">${this.label}</text>\n `\n }\n\n get anchorModels(): AnchorModel[] {\n return [{ id: 'in', type: 'in', pos: { x: 0, y: -24 }, angle: 270 }].map(anchorModel =>\n this.applyAnchorsOption(anchorModel as AnchorModel)\n )\n }\n}\n"]}
|
package/dist/src/nodes/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Task } from './task.js';
|
|
2
|
-
import { Subflow } from './subflow.js';
|
|
3
|
-
import { StartEvent } from './start-event.js';
|
|
4
|
-
import { IntermediateEvent } from './intermediate-event.js';
|
|
5
|
-
import { EndEvent } from './end-event.js';
|
|
6
|
-
import { Decision } from './decision.js';
|
|
7
|
-
import { Select } from './select.js';
|
|
8
|
-
import { Iterator } from './iterator.js';
|
|
9
|
-
export default {
|
|
10
|
-
start: StartEvent,
|
|
11
|
-
task: Task,
|
|
12
|
-
subflow: Subflow,
|
|
13
|
-
iterator: Iterator,
|
|
14
|
-
decision: Decision,
|
|
15
|
-
select: Select,
|
|
16
|
-
intermediate: IntermediateEvent,
|
|
17
|
-
end: EndEvent
|
|
18
|
-
};
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIxC,eAAe;IACb,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,QAAQ;IAClB,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,iBAAiB;IAC/B,GAAG,EAAE,QAAQ;CAC+B,CAAA","sourcesContent":["import { Task } from './task.js'\nimport { Subflow } from './subflow.js'\nimport { StartEvent } from './start-event.js'\nimport { IntermediateEvent } from './intermediate-event.js'\nimport { EndEvent } from './end-event.js'\nimport { Decision } from './decision.js'\nimport { Select } from './select.js'\nimport { Iterator } from './iterator.js'\n\nimport { FlowNodeImplementation } from '../types.js'\n\nexport default {\n start: StartEvent,\n task: Task,\n subflow: Subflow,\n iterator: Iterator,\n decision: Decision,\n select: Select,\n intermediate: IntermediateEvent,\n end: EndEvent\n} as { [key: string]: FlowNodeImplementation }\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SVGTemplateResult } from 'lit';
|
|
2
|
-
import { AnchorModel, FlowDataSchema } from '../types.js';
|
|
3
|
-
import { FlowNodeAbstract } from '../base/flow-node-abstract.js';
|
|
4
|
-
export declare class IntermediateEvent extends FlowNodeAbstract {
|
|
5
|
-
get type(): string;
|
|
6
|
-
get inputSchema(): FlowDataSchema;
|
|
7
|
-
get outputSchema(): FlowDataSchema;
|
|
8
|
-
get size(): {
|
|
9
|
-
w: number;
|
|
10
|
-
h: number;
|
|
11
|
-
};
|
|
12
|
-
renderNode(): SVGTemplateResult;
|
|
13
|
-
get anchorModels(): AnchorModel[];
|
|
14
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { svg } from 'lit';
|
|
2
|
-
import { FlowNodeAbstract } from '../base/flow-node-abstract.js';
|
|
3
|
-
export class IntermediateEvent extends FlowNodeAbstract {
|
|
4
|
-
get type() {
|
|
5
|
-
return 'intermediate';
|
|
6
|
-
}
|
|
7
|
-
get inputSchema() {
|
|
8
|
-
return {
|
|
9
|
-
type: 'object',
|
|
10
|
-
properties: {
|
|
11
|
-
result: {
|
|
12
|
-
type: 'object',
|
|
13
|
-
properties: {}
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
required: ['result']
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
get outputSchema() {
|
|
20
|
-
return {
|
|
21
|
-
type: 'object',
|
|
22
|
-
properties: {
|
|
23
|
-
result: {
|
|
24
|
-
type: 'object',
|
|
25
|
-
properties: {}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
required: ['result']
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
get size() {
|
|
32
|
-
return this.model.size || { w: 48, h: 48 };
|
|
33
|
-
}
|
|
34
|
-
renderNode() {
|
|
35
|
-
const { w, h } = this.size || { w: 48, h: 48 };
|
|
36
|
-
const bigR = Math.min(w, h) / 2 - 1;
|
|
37
|
-
const smallR = bigR * 0.8;
|
|
38
|
-
return svg `
|
|
39
|
-
<circle class="node-outline" cx="0" cy="0" r="${bigR}" fill="#f8d7da" stroke="#000" stroke-width="1" />
|
|
40
|
-
<circle class="node-outline" cx="0" cy="0" r="${smallR}" fill="none" stroke="#000" stroke-width="1" />
|
|
41
|
-
|
|
42
|
-
<text class="node-label" x="0" y="5" text-anchor="middle">${this.label}</text>
|
|
43
|
-
`;
|
|
44
|
-
}
|
|
45
|
-
get anchorModels() {
|
|
46
|
-
return [
|
|
47
|
-
{ id: 'in', type: 'in', pos: { x: 0, y: -24 }, angle: 270 },
|
|
48
|
-
{ id: 'out', type: 'out', pos: { x: 0, y: 24 }, angle: 90 }
|
|
49
|
-
].map(anchorModel => this.applyAnchorsOption(anchorModel));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=intermediate-event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intermediate-event.js","sourceRoot":"","sources":["../../../src/nodes/intermediate-event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAqB,MAAM,KAAK,CAAA;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,MAAM,OAAO,iBAAkB,SAAQ,gBAAgB;IACrD,IAAI,IAAI;QACN,OAAO,cAAc,CAAA;IACvB,CAAC;IAED,IAAI,WAAW;QACb,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,EAAE;iBACf;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB,CAAA;IACH,CAAC;IAED,IAAI,YAAY;QACd,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,EAAE;iBACf;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB,CAAA;IACH,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAM,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAA;IAC7C,CAAC;IAED,UAAU;QACR,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAA;QAC9C,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACnC,MAAM,MAAM,GAAG,IAAI,GAAG,GAAG,CAAA;QAEzB,OAAO,GAAG,CAAA;sDACwC,IAAI;sDACJ,MAAM;;kEAEM,IAAI,CAAC,KAAK;KACvE,CAAA;IACH,CAAC;IAED,IAAI,YAAY;QACd,OAAO;YACL,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;YAC3D,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;SAC5D,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,WAA0B,CAAC,CAAC,CAAA;IAC3E,CAAC;CACF","sourcesContent":["import { svg, SVGTemplateResult } from 'lit'\nimport { AnchorModel, FlowDataSchema } from '../types.js'\nimport { FlowNodeAbstract } from '../base/flow-node-abstract.js'\n\nexport class IntermediateEvent extends FlowNodeAbstract {\n get type() {\n return 'intermediate'\n }\n\n get inputSchema(): FlowDataSchema {\n return {\n type: 'object',\n properties: {\n result: {\n type: 'object',\n properties: {}\n }\n },\n required: ['result']\n }\n }\n\n get outputSchema(): FlowDataSchema {\n return {\n type: 'object',\n properties: {\n result: {\n type: 'object',\n properties: {}\n }\n },\n required: ['result']\n }\n }\n\n get size(): { w: number; h: number } {\n return this.model!.size || { w: 48, h: 48 }\n }\n\n renderNode(): SVGTemplateResult {\n const { w, h } = this.size || { w: 48, h: 48 }\n const bigR = Math.min(w, h) / 2 - 1\n const smallR = bigR * 0.8\n\n return svg`\n <circle class=\"node-outline\" cx=\"0\" cy=\"0\" r=\"${bigR}\" fill=\"#f8d7da\" stroke=\"#000\" stroke-width=\"1\" />\n <circle class=\"node-outline\" cx=\"0\" cy=\"0\" r=\"${smallR}\" fill=\"none\" stroke=\"#000\" stroke-width=\"1\" />\n \n <text class=\"node-label\" x=\"0\" y=\"5\" text-anchor=\"middle\">${this.label}</text>\n `\n }\n\n get anchorModels(): AnchorModel[] {\n return [\n { id: 'in', type: 'in', pos: { x: 0, y: -24 }, angle: 270 },\n { id: 'out', type: 'out', pos: { x: 0, y: 24 }, angle: 90 }\n ].map(anchorModel => this.applyAnchorsOption(anchorModel as AnchorModel))\n }\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SVGTemplateResult } from 'lit';
|
|
2
|
-
import { AnchorModel } from '../types.js';
|
|
3
|
-
import { FlowNodeAbstract } from '../base/flow-node-abstract.js';
|
|
4
|
-
export declare class Iterator extends FlowNodeAbstract {
|
|
5
|
-
get type(): string;
|
|
6
|
-
get size(): {
|
|
7
|
-
w: number;
|
|
8
|
-
h: number;
|
|
9
|
-
};
|
|
10
|
-
renderNode(): SVGTemplateResult;
|
|
11
|
-
get anchorModels(): AnchorModel[];
|
|
12
|
-
}
|