@pb33f/cowboy-components 0.2.0 → 0.2.2
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/dist/components/manage-ruleset/manage-ruleset.d.ts +5 -1
- package/dist/components/manage-ruleset/manage-ruleset.js +27 -5
- package/dist/components/model-renderer/rendered-node.css.d.ts +2 -0
- package/dist/components/model-renderer/rendered-node.css.js +96 -0
- package/dist/components/model-renderer/rendered-node.d.ts +8 -0
- package/dist/components/model-renderer/rendered-node.js +117 -0
- package/dist/components/model-renderer/rendered-property.css.d.ts +2 -0
- package/dist/components/model-renderer/rendered-property.css.js +118 -0
- package/dist/components/model-renderer/rendered-property.d.ts +14 -0
- package/dist/components/model-renderer/rendered-property.js +204 -0
- package/dist/components/model-tree/tree-item.d.ts +10 -0
- package/dist/components/model-tree/tree-item.js +37 -0
- package/dist/components/model-tree/tree.css.d.ts +2 -0
- package/dist/components/model-tree/tree.css.js +20 -0
- package/dist/components/model-tree/tree.d.ts +16 -0
- package/dist/components/model-tree/tree.js +103 -0
- package/dist/components/the-doctor/the-doctor.css.js +2 -2
- package/dist/components/the-doctor/the-doctor.d.ts +4 -2
- package/dist/components/the-doctor/the-doctor.js +42 -18
- package/dist/components/visualizer/explorer.d.ts +52 -0
- package/dist/components/visualizer/explorer.js +296 -0
- package/dist/components/visualizer/node.d.ts +11 -0
- package/dist/components/visualizer/node.js +27 -0
- package/dist/components/visualizer/operation.css.d.ts +2 -0
- package/dist/components/visualizer/operation.css.js +53 -0
- package/dist/components/visualizer/operation.d.ts +12 -0
- package/dist/components/visualizer/operation.js +52 -0
- package/dist/components/visualizer/visualizer.css.d.ts +2 -0
- package/dist/components/visualizer/visualizer.css.js +157 -0
- package/dist/components/visualizer/visualizer.d.ts +60 -0
- package/dist/components/visualizer/visualizer.js +137 -0
- package/dist/cowboy-components.d.ts +1 -0
- package/dist/cowboy-components.js +2 -0
- package/dist/cowboy-components.umd.cjs +950 -324
- package/dist/css/pb33f-theme.css +1 -1
- package/dist/events/doctor.d.ts +9 -0
- package/dist/events/doctor.js +3 -0
- package/dist/model/graph.d.ts +6 -0
- package/dist/model/graph.js +1 -0
- package/dist/services/model-service.d.ts +5 -0
- package/dist/services/model-service.js +30 -0
- package/dist/style.css +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { customElement, query, state } from "lit/decorators.js";
|
|
8
|
+
import { html, LitElement, svg } from "lit";
|
|
9
|
+
import visualizerCss from "./visualizer.css";
|
|
10
|
+
import { Direction } from "./visualizer";
|
|
11
|
+
import { NodeComponent } from "./node";
|
|
12
|
+
import { OperationGraphNode } from "./operation";
|
|
13
|
+
import { curveBundle, line } from "d3-shape";
|
|
14
|
+
import ELK from "elkjs/lib/elk.bundled";
|
|
15
|
+
let ExplorerComponent = class ExplorerComponent extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
this.nodeComponents = [];
|
|
19
|
+
this.scale = 1;
|
|
20
|
+
this.translateX = 0;
|
|
21
|
+
this.translateY = 0;
|
|
22
|
+
this.elk = new ELK();
|
|
23
|
+
this.ready = false;
|
|
24
|
+
this.direction = Direction.RIGHT;
|
|
25
|
+
this.nodeMap = new Map();
|
|
26
|
+
const targets = new Map();
|
|
27
|
+
}
|
|
28
|
+
mouseMove(evt) {
|
|
29
|
+
if (this.grabbed) {
|
|
30
|
+
this.translateX = evt.clientX - this.startX;
|
|
31
|
+
this.translateY = evt.clientY - this.startY;
|
|
32
|
+
this.svgGroup.style.transform = `scale(${this.scale}) translate(${this.translateX / this.scale}px, ${this.translateY / this.scale}px)`;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
mouseDown(evt) {
|
|
36
|
+
this.grabbed = true;
|
|
37
|
+
this.startX = evt.clientX - this.translateX;
|
|
38
|
+
this.startY = evt.clientY - this.translateY;
|
|
39
|
+
}
|
|
40
|
+
mouseUp() {
|
|
41
|
+
this.grabbed = false;
|
|
42
|
+
}
|
|
43
|
+
onWheel(evt) {
|
|
44
|
+
evt.preventDefault();
|
|
45
|
+
//@ts-ignore
|
|
46
|
+
const delta = evt.deltaY || evt.deltaX;
|
|
47
|
+
const scaleStep = Math.abs(delta) < 50
|
|
48
|
+
? 0.05 // touchpad pitch
|
|
49
|
+
: 0.25; // mouse wheel
|
|
50
|
+
const scaleDelta = delta < 0 ? scaleStep : -scaleStep;
|
|
51
|
+
const nextScale = this.scale + scaleDelta; // 'scale' is prev scale
|
|
52
|
+
// calc fixedPoint
|
|
53
|
+
const fixedPoint = { x: evt.clientX, y: evt.clientY };
|
|
54
|
+
this.scale = nextScale;
|
|
55
|
+
if (nextScale < 0.25) {
|
|
56
|
+
this.scale = 0.25;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// if (nextScale > 5) {
|
|
60
|
+
// this.scale = 5;
|
|
61
|
+
// return
|
|
62
|
+
// }
|
|
63
|
+
const mouseX = evt.clientX;
|
|
64
|
+
const mouseY = evt.clientY;
|
|
65
|
+
const svgRect = this.svgItem.getBoundingClientRect();
|
|
66
|
+
const offsetX = mouseX - svgRect.left;
|
|
67
|
+
const offsetY = mouseY - svgRect.top;
|
|
68
|
+
this.svgGroup.style.transformOrigin = `${offsetX}px ${offsetY}px`;
|
|
69
|
+
this.svgGroup.style.transform = `scale(${nextScale}) translate(${this.translateX / this.scale}px, ${this.translateY / this.scale}px)`;
|
|
70
|
+
}
|
|
71
|
+
buildLayout() {
|
|
72
|
+
this.elk.layout(this.graph, {
|
|
73
|
+
layoutOptions: {
|
|
74
|
+
'algorithm': 'layered'
|
|
75
|
+
},
|
|
76
|
+
logging: true,
|
|
77
|
+
measureExecutionTime: true
|
|
78
|
+
}).then(this.readyGo.bind(this));
|
|
79
|
+
}
|
|
80
|
+
buildGraph() {
|
|
81
|
+
const graph = {
|
|
82
|
+
id: "root",
|
|
83
|
+
layoutOptions: this.generateOptions(),
|
|
84
|
+
children: this.nodes,
|
|
85
|
+
edges: this.edges
|
|
86
|
+
};
|
|
87
|
+
this.graph = graph;
|
|
88
|
+
// build node map
|
|
89
|
+
this.nodeMap.clear();
|
|
90
|
+
this.nodes.forEach((node) => {
|
|
91
|
+
this.nodeMap.set(node.nodePath, node);
|
|
92
|
+
});
|
|
93
|
+
this.buildLayout();
|
|
94
|
+
return graph;
|
|
95
|
+
}
|
|
96
|
+
readyGo() {
|
|
97
|
+
this.ready = true;
|
|
98
|
+
this.requestUpdate();
|
|
99
|
+
}
|
|
100
|
+
reset() {
|
|
101
|
+
this.scale = 1;
|
|
102
|
+
this.translateX = 0;
|
|
103
|
+
this.translateY = 0;
|
|
104
|
+
this.svgGroup.style.transform = `scale(${this.scale}) translate(${this.translateX}px, ${this.translateY}px)`;
|
|
105
|
+
}
|
|
106
|
+
zoomIn() {
|
|
107
|
+
const nextScale = this.scale + 0.25; // 'scale' is prev scale
|
|
108
|
+
this.scale = nextScale;
|
|
109
|
+
this.svgGroup.style.transform = `scale(${nextScale}) translate(${this.translateX / this.scale}px, ${this.translateY / this.scale}px)`;
|
|
110
|
+
}
|
|
111
|
+
zoomOut() {
|
|
112
|
+
const nextScale = this.scale - 0.25; // 'scale' is prev scale
|
|
113
|
+
this.scale = nextScale;
|
|
114
|
+
this.svgGroup.style.transform = `scale(${nextScale}) translate(${this.translateX / this.scale}px, ${this.translateY / this.scale}px)`;
|
|
115
|
+
}
|
|
116
|
+
generateOptions() {
|
|
117
|
+
return {
|
|
118
|
+
'spacing.nodeNodeBetweenLayers': 40,
|
|
119
|
+
'spacing.nodeNode': 40,
|
|
120
|
+
'elk.nodeLabels.placement': 'INSIDE V_CENTER H_RIGHT',
|
|
121
|
+
'elk.algorithm': 'org.eclipse.elk.layered',
|
|
122
|
+
'elk.direction': this.direction,
|
|
123
|
+
'org.eclipse.elk.edgeRouting': 'ORTHOGONAL',
|
|
124
|
+
'elk.layered.unnecessaryBendpoints': 'true',
|
|
125
|
+
'elk.layered.spacing.edgeNodeBetweenLayers': 30,
|
|
126
|
+
'org.eclipse.elk.layered.nodePlacement.bk.fixedAlignment': 'BALANCED',
|
|
127
|
+
'org.eclipse.elk.layered.cycleBreaking.strategy': 'DEPTH_FIRST',
|
|
128
|
+
'nodePlacement.strategy': 'BRANDES_KOEPF',
|
|
129
|
+
'org.eclipse.elk.spacing.edgeLabel': '0',
|
|
130
|
+
'org.eclipse.elk.spacing.edgeNode': '24',
|
|
131
|
+
'org.eclipse.elk.layered.edgeLabels.sideSelection': 'ALWAYS_UP',
|
|
132
|
+
'org.eclipse.elk.spacing.portPort': '10',
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
render() {
|
|
136
|
+
if (!this.ready) {
|
|
137
|
+
return html ``;
|
|
138
|
+
}
|
|
139
|
+
const nodes = this.graph.children?.map((child) => {
|
|
140
|
+
const nc = new NodeComponent();
|
|
141
|
+
nc.id = child.idHash;
|
|
142
|
+
if (child.x && child.y) {
|
|
143
|
+
nc.x = child.x;
|
|
144
|
+
nc.y = child.y;
|
|
145
|
+
}
|
|
146
|
+
nc.width = child.width;
|
|
147
|
+
nc.height = child.height;
|
|
148
|
+
// if (child.expanded) {
|
|
149
|
+
// nc.visible = child.expanded;
|
|
150
|
+
// } else {
|
|
151
|
+
//debugger
|
|
152
|
+
let expanded = false;
|
|
153
|
+
// check if any of the edges have a target of this node, and then check
|
|
154
|
+
// if any of the source nodes are expanded
|
|
155
|
+
this.edges?.forEach((edge) => {
|
|
156
|
+
if (edge.targets.includes(child.id)) {
|
|
157
|
+
edge.sources.forEach((source) => {
|
|
158
|
+
const node = this.nodes.find((n) => n.id === source);
|
|
159
|
+
if (node?.expanded) {
|
|
160
|
+
expanded = true;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
nc.visible = expanded;
|
|
166
|
+
// }
|
|
167
|
+
const op = new OperationGraphNode();
|
|
168
|
+
op.height = child.height - 2;
|
|
169
|
+
op.width = child.width - 2;
|
|
170
|
+
op.id = child.idHash;
|
|
171
|
+
op.label = child.label;
|
|
172
|
+
if (child.active) {
|
|
173
|
+
op.active = child.active;
|
|
174
|
+
nc.active = child.active;
|
|
175
|
+
}
|
|
176
|
+
nc.body = op;
|
|
177
|
+
this.nodeComponents.push(nc);
|
|
178
|
+
return nc.render();
|
|
179
|
+
});
|
|
180
|
+
const edges = this.graph.edges?.map((edge) => {
|
|
181
|
+
let x = 0;
|
|
182
|
+
const sections = edge.sections?.map((section) => {
|
|
183
|
+
// check if any of the targets for the edge are visible, if not, don't render the edge
|
|
184
|
+
let visible = false;
|
|
185
|
+
edge.targets.forEach((target) => {
|
|
186
|
+
const node = this.nodes.find((n) => n.id === target);
|
|
187
|
+
if (node?.expanded) {
|
|
188
|
+
visible = true;
|
|
189
|
+
}
|
|
190
|
+
this.nodeComponents.forEach((nc) => {
|
|
191
|
+
if (nc.visible && nc.id === target) {
|
|
192
|
+
console.log(nc.id);
|
|
193
|
+
visible = true;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
// if (!visible) {
|
|
198
|
+
// return svg``
|
|
199
|
+
// }
|
|
200
|
+
const points = section ? [section.startPoint, ...(section.bendPoints || []), section.endPoint] : [];
|
|
201
|
+
let pathFn = line().x((d) => d.x).y((d) => d.y);
|
|
202
|
+
pathFn = pathFn.curve(curveBundle.beta(1));
|
|
203
|
+
const lines = svg `
|
|
204
|
+
<path id="edge-${edge.id}-${x}"
|
|
205
|
+
d="${pathFn(points)}"
|
|
206
|
+
class="edge ${edge.ref.length > 0 ? 'ref' : ''} ${edge.poly && edge.poly != '' ? edge.poly : ''}"
|
|
207
|
+
marker-end="url(#${edge.ref.length > 0 ? edge.poly ? 'arrow-poly' : 'arrow-ref' : 'arrow'})"/>`;
|
|
208
|
+
x++;
|
|
209
|
+
return lines;
|
|
210
|
+
});
|
|
211
|
+
return sections;
|
|
212
|
+
});
|
|
213
|
+
let base = 600;
|
|
214
|
+
let offset = 0;
|
|
215
|
+
this.graph.children.forEach(() => {
|
|
216
|
+
base += 5;
|
|
217
|
+
offset += 20;
|
|
218
|
+
});
|
|
219
|
+
if (offset > 900) {
|
|
220
|
+
offset = 900;
|
|
221
|
+
}
|
|
222
|
+
return svg `
|
|
223
|
+
<svg width="100%" height="100%" viewBox="${offset} 80 ${base} ${base}"
|
|
224
|
+
@wheel="${this.onWheel}"
|
|
225
|
+
@mousedown="${this.mouseDown}"
|
|
226
|
+
@mouseup="${this.mouseUp}"
|
|
227
|
+
@mousemove="${this.mouseMove}"
|
|
228
|
+
@mouseout="${this.mouseUp}"
|
|
229
|
+
>
|
|
230
|
+
<defs>
|
|
231
|
+
<filter id="glow">
|
|
232
|
+
<!-- First, apply a Gaussian blur -->
|
|
233
|
+
<feGaussianBlur stdDeviation="4.5" result="coloredBlur"/>
|
|
234
|
+
<!-- Then, apply a merge filter to add the blur effect back with the original graphic -->
|
|
235
|
+
<feMerge>
|
|
236
|
+
<feMergeNode in="coloredBlur"/>
|
|
237
|
+
<feMergeNode in="SourceGraphic"/>
|
|
238
|
+
</feMerge>
|
|
239
|
+
</filter>
|
|
240
|
+
<marker
|
|
241
|
+
id="arrow"
|
|
242
|
+
viewBox="0 0 12 12"
|
|
243
|
+
refX="8"
|
|
244
|
+
refY="5"
|
|
245
|
+
markerWidth="5"
|
|
246
|
+
markerHeight="5"
|
|
247
|
+
fill="var(--secondary-color)"
|
|
248
|
+
orient="auto-start-reverse">
|
|
249
|
+
<path d="M 0 0 L 10 5 L 0 10 z" class="glow"/>
|
|
250
|
+
</marker>
|
|
251
|
+
<marker
|
|
252
|
+
id="arrow-ref"
|
|
253
|
+
viewBox="0 0 12 12"
|
|
254
|
+
refX="8"
|
|
255
|
+
refY="5"
|
|
256
|
+
markerWidth="5"
|
|
257
|
+
markerHeight="5"
|
|
258
|
+
fill="var(--terminal-text)"
|
|
259
|
+
orient="auto-start-reverse">
|
|
260
|
+
<path d="M 0 0 L 10 5 L 0 10 z" class="glow"/>
|
|
261
|
+
</marker>
|
|
262
|
+
<marker
|
|
263
|
+
id="arrow-poly"
|
|
264
|
+
viewBox="0 0 12 12"
|
|
265
|
+
refX="8"
|
|
266
|
+
refY="5"
|
|
267
|
+
markerWidth="5"
|
|
268
|
+
markerHeight="5"
|
|
269
|
+
fill="var(--terminal-yellow)"
|
|
270
|
+
orient="auto-start-reverse">
|
|
271
|
+
<path d="M 0 0 L 10 5 L 0 10 z" class="glow"/>
|
|
272
|
+
</marker>
|
|
273
|
+
|
|
274
|
+
</defs>
|
|
275
|
+
<g id="#svgGroup">
|
|
276
|
+
${nodes}
|
|
277
|
+
${edges}
|
|
278
|
+
</g>
|
|
279
|
+
</svg>
|
|
280
|
+
`;
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
ExplorerComponent.styles = [visualizerCss];
|
|
284
|
+
__decorate([
|
|
285
|
+
query('svg')
|
|
286
|
+
], ExplorerComponent.prototype, "svgItem", void 0);
|
|
287
|
+
__decorate([
|
|
288
|
+
query('svg > g')
|
|
289
|
+
], ExplorerComponent.prototype, "svgGroup", void 0);
|
|
290
|
+
__decorate([
|
|
291
|
+
state()
|
|
292
|
+
], ExplorerComponent.prototype, "ready", void 0);
|
|
293
|
+
ExplorerComponent = __decorate([
|
|
294
|
+
customElement('pb33f-explorer')
|
|
295
|
+
], ExplorerComponent);
|
|
296
|
+
export { ExplorerComponent };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { svg } from "lit";
|
|
2
|
+
export class NodeComponent {
|
|
3
|
+
render() {
|
|
4
|
+
// if (!this.visible) {
|
|
5
|
+
// return svg``;
|
|
6
|
+
// }
|
|
7
|
+
let body = "";
|
|
8
|
+
if (this.body) {
|
|
9
|
+
body = this.body;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
body = "Object Node";
|
|
13
|
+
}
|
|
14
|
+
// <!--<text x="${this.x + 6}" y="${this.y + 26}" class="text">${body}</text> -->
|
|
15
|
+
return svg `
|
|
16
|
+
<rect id="node-${this.id}" x="${this.x}" y="${this.y}" width="${this.width}" height="${this.height}" class="node"/>
|
|
17
|
+
|
|
18
|
+
<foreignObject x="${this.x}" y="${this.y}" width="${this.width}" height="${this.height + 20}" class="fo">
|
|
19
|
+
<div xmlns="http://www.w3.org/1999/xhtml" class="node-body" style="height: ${this.height}px; width: ${this.width}px;">
|
|
20
|
+
${body}
|
|
21
|
+
</div>
|
|
22
|
+
</foreignObject>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export default css `
|
|
3
|
+
|
|
4
|
+
.operation-node {
|
|
5
|
+
border: 1px solid var(--primary-color);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.operation-node:hover {
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
border: 1px solid var(--secondary-color);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.operation-node:active {
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
border: 1px solid var(--warn-color);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.active {
|
|
19
|
+
border: 2px solid var(--error-color);
|
|
20
|
+
animation: pulse-animation 2.5s infinite
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.operation-node.active:hover {
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
border: 2px solid var(--error-color);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@keyframes pulse-animation {
|
|
29
|
+
0% {
|
|
30
|
+
box-shadow: 0 0 0 0 var(--error-color);
|
|
31
|
+
}
|
|
32
|
+
100% {
|
|
33
|
+
box-shadow: 0 0 30px 30px rgb(0, 0, 0, 0);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@keyframes dashdraw {
|
|
38
|
+
0% {
|
|
39
|
+
stroke-dashoffset: 10;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.active-icon {
|
|
44
|
+
position: absolute;
|
|
45
|
+
right: calc(50% - 10px);
|
|
46
|
+
bottom: -8px;
|
|
47
|
+
font-size: 1.5rem;
|
|
48
|
+
color: var(--error-color);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export declare class OperationGraphNode extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult[];
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
active: boolean;
|
|
9
|
+
constructor();
|
|
10
|
+
clicked(): void;
|
|
11
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { customElement, property } from "lit/decorators.js";
|
|
8
|
+
import { html, LitElement } from "lit";
|
|
9
|
+
import operationCss from "./operation.css.js";
|
|
10
|
+
import { ExplorerNodeClicked } from "../../events/doctor";
|
|
11
|
+
let OperationGraphNode = class OperationGraphNode extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
}
|
|
15
|
+
clicked() {
|
|
16
|
+
this.dispatchEvent(new CustomEvent(ExplorerNodeClicked, {
|
|
17
|
+
bubbles: true,
|
|
18
|
+
composed: true,
|
|
19
|
+
detail: {
|
|
20
|
+
nodeHashId: this.id
|
|
21
|
+
}
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html `
|
|
26
|
+
<div class="operation-node ${this.active ? 'active' : ''}" style="height: ${this.height}px; width: ${this.width - 2}px" @click="${this.clicked}">
|
|
27
|
+
<sl-icon name="code-slash"></sl-icon> ${this.label}
|
|
28
|
+
${this.active ? html `<sl-icon name="arrow-up" class="active-icon"></sl-icon>` : html ``}
|
|
29
|
+
</div>
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
OperationGraphNode.styles = [operationCss];
|
|
34
|
+
__decorate([
|
|
35
|
+
property({ type: Number })
|
|
36
|
+
], OperationGraphNode.prototype, "width", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
property({ type: Number })
|
|
39
|
+
], OperationGraphNode.prototype, "height", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
property()
|
|
42
|
+
], OperationGraphNode.prototype, "id", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
property()
|
|
45
|
+
], OperationGraphNode.prototype, "label", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
property({ type: Boolean })
|
|
48
|
+
], OperationGraphNode.prototype, "active", void 0);
|
|
49
|
+
OperationGraphNode = __decorate([
|
|
50
|
+
customElement('pb33f-operation-graphnode')
|
|
51
|
+
], OperationGraphNode);
|
|
52
|
+
export { OperationGraphNode };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export default css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.visualizer {
|
|
11
|
+
display: flex;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.explorer {
|
|
15
|
+
width: 75%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.model {
|
|
20
|
+
width: 25%;
|
|
21
|
+
height: 814px;
|
|
22
|
+
overflow: auto;
|
|
23
|
+
margin-top: 20px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.model > .tree {
|
|
27
|
+
height: 300px;
|
|
28
|
+
overflow-y: auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.model > .renderer {
|
|
32
|
+
height: 492px;
|
|
33
|
+
margin-left: 10px;
|
|
34
|
+
border: 1px solid var(--primary-color);
|
|
35
|
+
padding: 10px;
|
|
36
|
+
overflow-y: auto;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
svg {
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.svg-container {
|
|
46
|
+
border: 1px solid var(--primary-color);
|
|
47
|
+
width: 100%;
|
|
48
|
+
height: 800px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.svg-container:active {
|
|
52
|
+
cursor: move;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.node {
|
|
56
|
+
fill: var(--background-color);
|
|
57
|
+
transition: opacity 0.3s;
|
|
58
|
+
animation: fadeIn 1s;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.node:hover {
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
stroke: var(--warn-color);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.node:active {
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
stroke: var(--secondary-color);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.fo {
|
|
72
|
+
transition: opacity 0.3s;
|
|
73
|
+
animation: fadeIn 1s;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.text {
|
|
77
|
+
font-size: 1.3rem;
|
|
78
|
+
fill: var(--primary-color);
|
|
79
|
+
font-family: var(--font-stack), monospace;
|
|
80
|
+
animation: fadeIn 1.5s;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.text:hover {
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
fill: var(--warn-color);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.text:active {
|
|
89
|
+
cursor: pointer;
|
|
90
|
+
stroke: var(--secondary-color);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.glow {
|
|
94
|
+
filter: url(#glow);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.node-body {
|
|
98
|
+
font-size: 0.9rem;
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//.arrow {
|
|
103
|
+
// stroke: var(--primary-color);
|
|
104
|
+
// stroke-width: 2;
|
|
105
|
+
// fill: none;
|
|
106
|
+
// animation: fadeIn 1s;
|
|
107
|
+
//}
|
|
108
|
+
|
|
109
|
+
.edge {
|
|
110
|
+
stroke-dasharray: 5;
|
|
111
|
+
stroke-width: 2;
|
|
112
|
+
stroke: var(--secondary-color);
|
|
113
|
+
animation: fadeIn 3s, dashdraw 1500ms linear infinite;
|
|
114
|
+
fill: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ref {
|
|
118
|
+
stroke-dasharray: 1 5;
|
|
119
|
+
stroke-width: 2;
|
|
120
|
+
stroke-miterlimit: 1;
|
|
121
|
+
stroke-linejoin: round;
|
|
122
|
+
stroke-linecap: round;
|
|
123
|
+
stroke: var(--terminal-text);
|
|
124
|
+
animation: dashdraw-fast 1200ms linear infinite;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.allOf, .oneOf, .anyOf {
|
|
128
|
+
stroke: var(--terminal-yellow);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@keyframes dashdraw {
|
|
133
|
+
from {
|
|
134
|
+
stroke-dashoffset: 10;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@keyframes dashdraw-fast {
|
|
139
|
+
from {
|
|
140
|
+
stroke-dashoffset: 30;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@keyframes fadeIn {
|
|
146
|
+
0% {
|
|
147
|
+
opacity: 0;
|
|
148
|
+
}
|
|
149
|
+
100% {
|
|
150
|
+
opacity: 1;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
`;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
import { NodeComponent } from "./node";
|
|
3
|
+
import { ModelTree } from "../model-tree/tree";
|
|
4
|
+
import { NodeClickedEvent } from "../../events/doctor";
|
|
5
|
+
import { RenderedNodeComponent } from "../model-renderer/rendered-node";
|
|
6
|
+
import { ExplorerComponent } from "./explorer";
|
|
7
|
+
export declare enum Direction {
|
|
8
|
+
UP = "UP",
|
|
9
|
+
DOWN = "DOWN",
|
|
10
|
+
LEFT = "LEFT",
|
|
11
|
+
RIGHT = "RIGHT"
|
|
12
|
+
}
|
|
13
|
+
export declare class Node {
|
|
14
|
+
id: string;
|
|
15
|
+
idHash: string;
|
|
16
|
+
nodePath: string;
|
|
17
|
+
parentId: string;
|
|
18
|
+
hash?: string;
|
|
19
|
+
x?: number;
|
|
20
|
+
y?: number;
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
expanded?: boolean;
|
|
24
|
+
treeExpanded?: boolean;
|
|
25
|
+
active?: boolean;
|
|
26
|
+
instance: any;
|
|
27
|
+
label: string;
|
|
28
|
+
nodes: Node[];
|
|
29
|
+
line: number;
|
|
30
|
+
type: string;
|
|
31
|
+
}
|
|
32
|
+
export declare class Edge {
|
|
33
|
+
id: string;
|
|
34
|
+
sources: string[];
|
|
35
|
+
targets: string[];
|
|
36
|
+
sections?: any[];
|
|
37
|
+
visible?: boolean;
|
|
38
|
+
ref: string;
|
|
39
|
+
poly?: string;
|
|
40
|
+
}
|
|
41
|
+
export declare class Visualizer extends LitElement {
|
|
42
|
+
static styles: import("lit").CSSResult[];
|
|
43
|
+
ready: boolean;
|
|
44
|
+
svgContainer: HTMLElement;
|
|
45
|
+
direction: Direction;
|
|
46
|
+
private grabbed;
|
|
47
|
+
private grabbedNode;
|
|
48
|
+
nodeComponents: NodeComponent[];
|
|
49
|
+
scale: number;
|
|
50
|
+
renderedNode: RenderedNodeComponent;
|
|
51
|
+
nodeMap: Map<string, Node>;
|
|
52
|
+
renderedNodeMap: Map<string, Node>;
|
|
53
|
+
modelTree: ModelTree;
|
|
54
|
+
explorer: ExplorerComponent;
|
|
55
|
+
constructor();
|
|
56
|
+
explorerNodeClicked(evt: CustomEvent<NodeClickedEvent>): void;
|
|
57
|
+
rotate(): void;
|
|
58
|
+
modelTreeNodeClicked(evt: CustomEvent<NodeClickedEvent>): void;
|
|
59
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
60
|
+
}
|