Skip to content

Function action block improvements#1384

Merged
SukuWc merged 13 commits into
stablefrom
SUKU-function
Jan 20, 2026
Merged

Function action block improvements#1384
SukuWc merged 13 commits into
stablefrom
SUKU-function

Conversation

@SukuWc

@SukuWc SukuWc commented Dec 13, 2025

Copy link
Copy Markdown
Member

!!! Required Firmware !!!

intechstudio/grid-fw#302

Function Block Refactoring

Summary

Refactored function blocks to use assignment-style declarations and improved the UI with better input handling
and autocomplete suggestions.

Key Changes

1. Assignment-Style Function Syntax

  • Changed from function YourFunction() to YourFunction = function()
  • Enables table member functions: self.method = function()
  • Supports parameters: myFunc(a, b) = function(a, b)

2. Improved Input Component

  • Replaced Monaco-based LineEditor with MeltCombo
  • Fixed cursor jumping during typing (isUserInput flag + async handling)
  • Added autocomplete suggestions: foo(bar), MIDI RX callbacks

3. Function Parameters as Local Definitions

  • Function parameters now exported to LocalDefinitions system
  • Available as variable suggestions in subsequent action blocks
  • Labeled as "parameter - paramName" in autocomplete

Benefits

  • Cleaner syntax for OOP patterns in Lua
  • Lighter weight input without Monaco overhead
  • Better variable scoping and autocomplete across blocks
  • Consistent with other action blocks (MIDI, Timer, etc.)

Files Changed

  • src/renderer/config-blocks/Function_Start.svelte
  • src/renderer/config-blocks/headers/FunctionStartFace.svelte
  • src/renderer/runtime/runtime.store.ts

SukuWc and others added 4 commits December 13, 2025 16:47
Changes:
- Update defaultLua to use "YourFunction = function()" syntax instead of "function YourFunction()"
- Fix blockIcon from "If" to "Function"
- Add parameter support in single field UI (e.g., "myFunc(a, b)")
- Update parsing logic to extract/reconstruct function name and parameters
- Supports table member functions (e.g., "self.onClick = function(event)")

Benefits:
- Enables creating table member functions for OOP patterns
- Cleaner syntax for function declarations
- Single field interface for name and parameters

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes:
- Replace Monaco-based LineEditor with MeltCombo for lighter input
- Fix cursor jumping issue with isUserInput flag and async handling
- Use value prop instead of bind:value with manual updates
- Add tick() and setTimeout to prevent reactive interference
- Add suggestions: foo(bar), midirx_cb, sysexrx_cb
- Add validation with NotEmpty validator

Benefits:
- No cursor jumping when typing (especially on space)
- Consistent with other action blocks (uses MeltCombo)
- Lighter weight than Monaco editor for simple text input
- Proper autocomplete suggestions for common function patterns

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes:
- Extend LocalDefinitions.getFrom() to extract function parameters
- Parse function blocks: "name = function(param1, param2)"
- Export parameters as suggestions for other action blocks
- Label as "parameter - paramName" in autocomplete

Benefits:
- Function parameters now available as variables in subsequent blocks
- Works automatically with all blocks using LocalDefinitions (MIDI, Timer, etc.)
- Enables better scoping and parameter passing patterns
- Consistent with local variable system

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 13, 2025

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 2c3dca6):

https://grid-editor-web--pr1384-suku-function-39072m01.web.app

(expires Sun, 15 Feb 2026 14:23:14 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 2b65ba6ef19c55d367eaffd04e46bcde25305d6f

@github-actions

github-actions Bot commented Dec 13, 2025

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 2c3dca6):

https://grid-playwright-result--pr1384-suku-function-6a1806g9.web.app

(expires Mon, 19 Jan 2026 14:31:13 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 0f764ceb264072188bf1a5dee10613d8f10b4ca2

Update locator from Monaco's .view-line to generic input selector
to work with MeltCombo component.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@SukuWc SukuWc changed the title Function actioln block improvements Function action block improvements Dec 13, 2025
@SukuWc SukuWc moved this from Todo to Ready for QA in Editor Roadmap Dec 17, 2025
- Add 7 new function suggestions: midi_auto_ch, midi_auto_cmd, midi_auto_p1, midi_auto_p2, color_curve, color_auto_layer, color_auto_value
- Update midirx_cb parameter order to (self, header, event)
- Provide helpful info text for each function to guide users

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@Greg-Orca Greg-Orca moved this from Ready for QA to QA in progress in Editor Roadmap Jan 8, 2026
@Greg-Orca

Copy link
Copy Markdown
Contributor

Hard to read the labels:
Screenshot 2026-01-08 at 11 05 38

sysex rx header not in the second position. Screenshot 2026-01-08 at 11 11 28

FW header and event position is not changed.

@Greg-Orca Greg-Orca moved this from QA in progress to In Progress in Editor Roadmap Jan 8, 2026
@Greg-Orca Greg-Orca moved this from In Progress to Ready for QA in Editor Roadmap Jan 16, 2026
@Greg-Orca Greg-Orca moved this from Ready for QA to QA in progress in Editor Roadmap Jan 16, 2026
@SukuWc SukuWc merged commit 76898b9 into stable Jan 20, 2026
14 checks passed
@SukuWc SukuWc mentioned this pull request Jan 26, 2026
@SukuWc SukuWc moved this from QA in progress to Done in Editor Roadmap Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants