mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 10:46:06 +10:00
Initial commit
moved from private version control
This commit is contained in:
35
scripts/nodes/library/devkit/devkitConfig.js
Normal file
35
scripts/nodes/library/devkit/devkitConfig.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Applies host configuration flags via devkit_config().
|
||||
*/
|
||||
export const devkitConfigNode = createNodeModule(
|
||||
{
|
||||
id: "devkit_config",
|
||||
title: "Devkit Config",
|
||||
category: "Devkit",
|
||||
description: "Send a configuration string to devkit_config().",
|
||||
searchTags: ["devkit", "config", "host"],
|
||||
inputs: [
|
||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||
{
|
||||
id: "config",
|
||||
name: "Config",
|
||||
direction: "input",
|
||||
kind: "string",
|
||||
defaultValue: "",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
emitExec: ({ indent, indentLevel, resolveValueInput, emitNextExec }) => {
|
||||
const config = resolveValueInput("config", '""');
|
||||
const line = `${indent(indentLevel)}devkit_config(${config})`;
|
||||
return [line, ...emitNextExec("exec_out")];
|
||||
},
|
||||
}
|
||||
);
|
||||
33
scripts/nodes/library/devkit/devkitInputRead.js
Normal file
33
scripts/nodes/library/devkit/devkitInputRead.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Reads values from devkit-provided inputs via devkit_input().
|
||||
*/
|
||||
export const devkitInputReadNode = createNodeModule(
|
||||
{
|
||||
id: "devkit_input_read",
|
||||
title: "Devkit Input Read",
|
||||
category: "Devkit",
|
||||
description: "Fetch the value of a devkit input index.",
|
||||
searchTags: ["devkit", "input", "read"],
|
||||
inputs: [
|
||||
{
|
||||
id: "index",
|
||||
name: "Index",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{ id: "value", name: "Value", direction: "output", kind: "any" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
evaluateValue: ({ resolveValueInput }) => {
|
||||
const index = resolveValueInput("index", "0");
|
||||
return `devkit_input(${index})`;
|
||||
},
|
||||
}
|
||||
);
|
||||
43
scripts/nodes/library/devkit/devkitInputWrite.js
Normal file
43
scripts/nodes/library/devkit/devkitInputWrite.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Sends values to devkit inputs via devkit_input().
|
||||
*/
|
||||
export const devkitInputWriteNode = createNodeModule(
|
||||
{
|
||||
id: "devkit_input_write",
|
||||
title: "Devkit Input Write",
|
||||
category: "Devkit",
|
||||
description: "Push a value to a devkit input index.",
|
||||
searchTags: ["devkit", "input", "write"],
|
||||
inputs: [
|
||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||
{
|
||||
id: "index",
|
||||
name: "Index",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
id: "value",
|
||||
name: "Value",
|
||||
direction: "input",
|
||||
kind: "number",
|
||||
defaultValue: 0,
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
emitExec: ({ indent, indentLevel, resolveValueInput, emitNextExec }) => {
|
||||
const index = resolveValueInput("index", "0");
|
||||
const value = resolveValueInput("value", "0");
|
||||
const line = `${indent(indentLevel)}devkit_input(${index}, ${value})`;
|
||||
return [line, ...emitNextExec("exec_out")];
|
||||
},
|
||||
}
|
||||
);
|
||||
22
scripts/nodes/library/devkit/index.js
Normal file
22
scripts/nodes/library/devkit/index.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import { devkitConfigNode } from "./devkitConfig.js";
|
||||
import { devkitInputReadNode } from "./devkitInputRead.js";
|
||||
import { devkitInputWriteNode } from "./devkitInputWrite.js";
|
||||
|
||||
/**
|
||||
* Node modules covering devkit helpers.
|
||||
*/
|
||||
export const devkitNodes = [
|
||||
devkitConfigNode,
|
||||
devkitInputReadNode,
|
||||
devkitInputWriteNode,
|
||||
];
|
||||
|
||||
/**
|
||||
* Checklist tracking coverage of devkit helpers.
|
||||
* @type {Array<{ function: string, nodeId: string, implemented: boolean }>}
|
||||
*/
|
||||
export const devkitFunctionChecklist = [
|
||||
{ function: "DEVKIT_CONFIG", nodeId: "devkit_config", implemented: true },
|
||||
{ function: "DEVKIT_INPUT (read)", nodeId: "devkit_input_read", implemented: true },
|
||||
{ function: "DEVKIT_INPUT (write)", nodeId: "devkit_input_write", implemented: true },
|
||||
];
|
||||
Reference in New Issue
Block a user