${this.branching !== undefined
- ? branch_x.map((x) => {
- return svg`
-
- `;
- })
- : svg`
-
- `}
-
-
-
[slot='head']") ? "" : "no-head"}"
- >
+ ? svg`
+
+ `
+ : ""}
+
+ ${this.branching !== undefined
+ ? svg`
+
+ `
+ : ""}
`;
}
@@ -134,47 +134,38 @@ export class HatGraph extends LitElement {
:host {
position: relative;
display: flex;
+ flex-direction: column;
+ align-items: center;
--stroke-clr: var(--stroke-color, rgb(3, 169, 244));
- --hover-clr: var(--hover-color, rgb(255, 152, 0));
+ --marked-clr: var(--marked-color, green);
+ --disabled-clr: var(--disabled-color, gray);
}
#branches {
- position: absolute;
- left: 0;
+ position: relative;
display: flex;
- flex-direction: row;
+ flex-direction: column;
align-items: center;
}
:host([branching]) #branches {
- top: ${BRANCH_HEIGHT}px;
flex-direction: row;
align-items: start;
}
- :host(:not([branching])) #branches {
- top: ${VERTICAL_SPACING + NODE_SIZE}px; /* SHould be something else*/
- flex-direction: column;
- }
- :host(:not([branching])) #branches.no-head {
- top: 0;
+
+ #lines {
+ position: absolute;
+ z-index: -1;
}
+
path.line {
stroke: var(--stroke-clr);
stroke-width: 2;
fill: none;
}
- :host(:not([branching])) ::slotted(*) {
- margin-bottom: 10px;
+ path.line.marked {
+ stroke: var(--marked-clr);
}
- ::slotted(:last-child) {
- margin-bottom: 0;
- }
- ::slotted([slot="head"]) {
- position: absolute;
- top: ${BRANCH_HEIGHT / 2}px;
- left: 50%;
- transform: translate(-50%, -50%);
- }
- :host(:focus-within) ::slotted([slot="head"]) {
- --stroke-color: green;
+ :host([disabled]) path.line {
+ stroke: var(--disabled-clr);
}
`;
}
diff --git a/src/hat-graph/make-graph.ts b/src/hat-graph/make-graph.ts
index b1057fa..2e29f34 100644
--- a/src/hat-graph/make-graph.ts
+++ b/src/hat-graph/make-graph.ts
@@ -49,6 +49,7 @@ const ICONS = {
chooseChoice: mdiCheckBoxOutline,
chooseDefault: mdiCheckboxBlankOutline,
YAML: mdiCodeJson,
+ trigger: mdiAsterisk,
};
const SPECIAL_NODES = {
@@ -69,8 +70,13 @@ function makeConditionNode(config) {
html`
+
-
+
`,
graph
);
@@ -79,7 +85,6 @@ function makeConditionNode(config) {
function makeChooseNode(config) {
const graph = document.createElement("hat-graph") as HatGraph;
- graph.config = config;
graph.branching = true;
const focused = () =>
@@ -143,8 +148,6 @@ function makeNode(config) {
node.iconPath = ICONS[type];
- node.config = config;
-
node.addEventListener("focus", (ev) => {
node.dispatchEvent(
new CustomEvent("node-selected", { detail: { config }, bubbles: true })