Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallo-10 committed Nov 6, 2024
1 parent 0d6025e commit 87c32c8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 115 deletions.
2 changes: 1 addition & 1 deletion src/Flow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
type NodeTypes,
} from "@xyflow/svelte";
import Sidebar from "./components/sidebar/Sidebar.svelte";
import paletteNodes from "../src/nodes.json";
import paletteNodes from "./nodes.json";
import ModalNode from "./components/nodes/ModalNode.svelte";
import CustomNode from "./components/nodes/CustomNode.svelte";
import ResultNode from "./components/nodes/ResultNode.svelte";
Expand Down
19 changes: 9 additions & 10 deletions src/components/edges/CustomEdge.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
export let targetPosition: $$Props["targetPosition"];
export let data: $$Props["data"] = {
label: "test",
};
$: [edgePath, labelX, labelY] = getBezierPath({
Expand All @@ -35,7 +34,7 @@
style:transform="translate(-50%, -50%) translate({labelX}px,{labelY}px)"
class="edge-label nodrag nopan"
>
<button class="close-button" >
<button class="close-button">
<i class="fas fa-cog"></i>
</button>
</div>
Expand All @@ -48,23 +47,23 @@
.close-button {
width: 12px;
height: 12px;
background-color: red;
border-radius: 50%;
color: white;
background-color: red;
border-radius: 50%;
color: white;
font-size: 8px;
cursor: pointer;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
transition: background-color 0.3s;
cursor: pointer;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
transition: background-color 0.3s;
display: flex;
justify-content: center;
align-items: center;
}
.close-button:hover {
background-color: #a19d9d;
background-color: #a19d9d;
}
.close-button:focus {
outline: none;
outline: none;
}
</style>
3 changes: 1 addition & 2 deletions src/components/nodes/ModalNode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
} from "@xyflow/svelte";
import { writable } from "svelte/store";
import { edges } from "../code/store";
//Defining the props
type $$Props = NodeProps;
Expand All @@ -24,7 +23,7 @@
let methodsEnd = data.methodsEnd || [];
const arduinoCode = writable(generateArduinoCode());
let parametersInput = data?.parametersInput || "";
let parametersInput = data?.inputParameterName || "";
function generateArduinoCode() {
let code = "";
Expand Down
12 changes: 3 additions & 9 deletions src/components/nodes/NodeModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@
if (typeOfDeclaration == "variables") {
if (declarationLocation == "global") {
codev += `${selectedType} ${inputParameterName} = ${inputParameterContent};\n`;
} else {
codev += `${selectedType} ${inputParameterName} = ${inputParameterContent};\n`;
}
}
if (typeOfDeclaration == "methods") {
Expand All @@ -91,10 +89,7 @@
methodDeclarationLocation,
);
if (methodDeclarationLocation == "global") {
codev += `${selectedRetunType} ${inputMethodName}();\n\n`;
}
if (methodDeclarationLocation != "global") {
codev += `${selectedRetunType} ${inputMethodName}();\n\n`;
codev += `${selectedRetunType} ${inputMethodName}();\n`;
}
}
return codev;
Expand All @@ -106,7 +101,6 @@
if (Array.isArray(methods)) {
methods.forEach((method) => {
if (!methodExists(method, code)) {
console.log(method);
code += `${method} {\n ${declarationLocation == method ? `${selectedType} ${inputParameterName} = ${inputParameterContent} ;\n` : ""}`;
code += `}\n`;
}
Expand All @@ -117,8 +111,7 @@
// Função para atualizar dados e código do node
function updateNodeDataAndCode() {
const precode = generateArduinoPreCode();
const newCode = generateArduinoCode(precode);
const newCode = generateArduinoCode(generateArduinoPreCode());
updateGlobalCode(newCode);
arduinoCode.set(newCode);
Expand Down Expand Up @@ -228,6 +221,7 @@
</div>
</div>
{/if}

{#if typeOfDeclaration === "methods"}
<div class="custom">
<button class="close-button" on:click={handleMinimize}> - </button>
Expand Down
93 changes: 0 additions & 93 deletions src/nodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,6 @@
"Error error()"
]
},
{
"name": "Arduino Uno",
"color": "green",
"highlighted": true,
"extras": {
"type": "controller",
"analogPorts": 6,
"digitalPorts": 14
},
"outs": [
"setup()",
"loop()"
]
},
{
"name": "Arduino Nano",
"color": "green",
Expand Down Expand Up @@ -262,38 +248,6 @@
"loop()"
]
},
{
"name": "Port",
"color": "pink",
"extras": {
"value": "0",
"group": "value",
"type": "port",
"hasUsages": true,
"hasPortType": true,
"portType": "Digital",
"returnType": "int",
"selectableOptions": [
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9"
],
"hasValue": true
},
"ins": [
"in"
],
"outs": [
"out"
]
},
{
"name": "Parameter(s)",
"color": "pink",
Expand Down Expand Up @@ -354,24 +308,6 @@
"out"
]
},
{
"name": "Function",
"extras": {
"type": "logic",
"returnType": "void",
"value": "foo",
"hasUsages": true,
"hasValue": true
},
"color": "grey",
"outs": [
"body"
],
"ins": [
"declare",
"in"
]
},
{
"name": "Condition",
"extras": {
Expand Down Expand Up @@ -424,19 +360,6 @@
"stopValue"
]
},
{
"name": "Digital I/O",
"color": "cyan",
"highlighted": true,
"extras": {
"type": "built-in"
},
"methods": [
"void digitalWrite(int pin, int value)",
"void pinMode(int pin, int mode)",
"int digitalRead(int pin)"
]
},
{
"name": "Analog I/O",
"color": "cyan",
Expand Down Expand Up @@ -563,22 +486,6 @@
"void serialEvent()"
]
},
{
"name": "true",
"color": "cyan",
"extras": {
"type": "built-in-constant",
"returnType": "int",
"hasUsages": true,
"link": "https: //www.arduino.cc/reference/en/language/variables/constants/constants/"
},
"ins": [
"in"
],
"outs": [
"out"
]
},
{
"name": "false",
"color": "cyan",
Expand Down

0 comments on commit 87c32c8

Please sign in to comment.