Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
942 changes: 0 additions & 942 deletions .yarn/releases/yarn-berry.js

This file was deleted.

1 change: 0 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
yarnPath: ".yarn/releases/yarn-berry.js"
nodeLinker: node-modules
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ export class Text extends BaseNode {
}

nodeToCode(): string {
return `"${this.properties.txt || "Your Text"}"`
return JSON.stringify(this.properties.txt ?? "Your Text");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { BaseGenerator, BaseNode, FlowIOTypes } from "@disflow-team/code-gen";
import { NodeCategoryColor } from "../Colors";

const controls = {
"let": "let",
"const": "const",
"var": "var",
}

export class CreateVariable extends BaseNode {
static title: string = "Create Variable";
static category: string = "Variables";

protected onBuild(): void {
this.setNodeColor(NodeCategoryColor.Variables);
this.addProperty("name", "Name", FlowIOTypes.String);
this.addProperty("keyword", "let", FlowIOTypes.String);
this.addWidget('combo', "Keyword", "let", (value) => {
this.properties.keyword = value;
}, {
values: Object.keys(controls),
property: "keyword"
})
this.addWidget("text", "Name", "myVariable", (v: string) => {
if(v.trim() === "") this.addInput("name", FlowIOTypes.String);

this.properties.name = v;
}, {
property: "name"
})
this.addInput("value", FlowIOTypes.Any);
}

nodeToCode(generator: BaseGenerator): string {
const keyword = controls[this.properties.keyword as keyof typeof controls];
const valueInput = this.inputs.find(i => i.name === "value");
const hasValue = valueInput?.link != null;

if (keyword === "const" && !hasValue) {
return `const ${this.properties.name} = undefined;`;
}

if (hasValue) {
return `${keyword} ${this.properties.name} = ${generator.valueToCode(this, 1)};`;
}

return `${keyword} ${this.properties.name};`;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { BaseGenerator, BaseNode, FlowIOTypes } from "@disflow-team/code-gen";
import { NodeCategoryColor } from "../Colors";

export class SetVariable extends BaseNode {
static title: string = "Set Variable";
static category: string = "Variables";

protected onBuild(): void {
this.setNodeColor(NodeCategoryColor.Variables);
this.addProperty("name", "Name", FlowIOTypes.String);
this.addWidget("text", "Name", "myVariable", (v: string) => {
if(v.trim() === "") this.addInput("name", FlowIOTypes.String);

this.properties.name = v;
}, {
property: "name"
})
this.addInput("value", FlowIOTypes.Any);
}

nodeToCode(generator: BaseGenerator): string {
return `${this.properties.name} = ${generator.valueToCode(this, 1)};`;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./CreateVariable";
export * from "./SetVariable";
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export * from "./Control";
export * from "./Math";
export * from "./Comparison";
export * from "./Console";
export * from "./Strings";
export * from "./Strings";
export * from "./Variables";
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"typescript": "^5.9.3",
"typescript-eslint": "^8.50.0"
},
"private": true,
"workspaces": [
"apps/*",
"packages/*"
Expand Down
Binary file added packages/.DS_Store
Binary file not shown.