MusicBlocks-v4 PRD (Program Building) Functionalities:

1. Workspace Canvas

  • How it should be like:
    Large, flexible, grid-based space where blocks can be placed freely and linked together.
  • Placement:
    In the center of the application window.
  • Preliminary UI Interface:
    http://figma.com/proto/wRQKMeYkgG8h08dsJPidZ9/Music-Blocks?page-id=887%3A334&node-id=899-1293&p=f&viewport=174%2C45%2C0.29&t=tGSJRal1LZLmfwNv-1&scaling=contain&content-scaling=fixed
  • Functions:
    • Drag/drop block placement
    • Zoom in/out and pan
    • Snap-to-grid and alignment hints
  • Where they should work / not work:
    • Works: On PCs, tablets, and preferably mobile-responsive.
    • Does not work: Outside of the canvas (say, window frame) or on modal dialogs.
  • Parameters:
    • Grid Size: Dimensions (in px) of one grid cell to aid in equal alignment of blocks (say, 20px × 20px).
    • Zoom Level: A floating-point scale factor (e.g., 0.5x to 4x) that controls how zoomed in or out the workspace looks.
    • Background Theme: Options to select the background color or grid pattern (e.g., light, dark, custom pattern) that works best for visibility and looks.

2. Blocks Palette

  • How it should be like:
    A categorized list of available blocks with icons and short descriptions.
  • Placement:
    Normally on the left sidebar.
  • Functions:
    • Expandable/collapsible categories
    • Search/filter blocks by name or type
    • Drag blocks onto the workspace
  • Where they should work / not work:
    • Works: In full-screen mode and side-by-side with the workspace.
    • Does not work: As an overlay that blocks workspace functionality unless minimized.
  • Parameters:
    • Category Names: Descriptive titles for block groups (e.g., "Data Blocks," "Control Blocks"), customizable or localizable.
    • Search Filters: Options to configure filtering of blocks based on criteria like keyword, recent usage, or complexity.

3. Toolbar (Run, Stop, Save, etc.)

  • How it should be like:
    A slim bar with simply labeled buttons/icons for global operations.
  • Placement:
    At the top or bottom of the interface.
  • Functions:
    • Run, pause, terminate program execution
    • Undo/Redo stack management
    • Save/Load operations
  • Where they should work / not work:
    • Works: Everywhere in all screens of the application.
    • Does not work: When there are active modal dialogs or essential pop-ups.
  • Parameters:
    • Button States: Context-dependent dynamic states for every button (enabled, disabled, active) that rely on the context (e.g., "Run" disabled if there is no code).
    • Iconography and Labels: Information that defines the icon images and corresponding text for every button, so that they are consistent and understandable.
    • Shortcut Bindings: Key bindings settings for operations such as undo/redo, save, and run to enhance accessibility and workflow productivity.

4. Output Panel[NEW]

  • How it should be like:
    A dynamic panel that shows logs, visualizations, or audio feedback of the run program.
  • Placement:
    Either bottom or on a resizable right sidebar.
  • Functions:
    • Show runtime logs and errors
    • Audio/visual feedback on output
    • Clear export and output choices
  • Where they should work / not work:
    • Works: Program execution mode.
    • Does not work: No running program (show a "no output" status).
  • Parameters:
    • Log Filters: Controls for filtering the nature of messages to be displayed (info, warning, error) with toggle switches for each logging type.
    • Display Mode: Controls for toggling between various presentation views (e.g., textual logs, visual timelines, or audio waveforms) to suitably display the output.
    • Resizable Dimensions: Settings for minimum and maximum width/height values such that the user can resize the panel while upholding layout stability.

5. Block Snapping Mechanism

  • How it should be like:
    A responsive puzzle-piece type linking system that shows the correct connection of blocks in a visual format.
  • Placement:
    Built into the workspace canvas while users drag out blocks.
  • Functions:
    • Identify and auto-suggest right connection points
    • Give visual emphasis on possible connections
  • Where they should work / not work:
    • Works: Only inside the snapping areas on blocks.
    • Does not work: When blocks are dragged off the canvas or over unrelated UI components.
  • Parameters:
    • Snap Tolerance: The maximum distance (in pixels) in which a block will snap into a connection point automatically (e.g., 10–15px).
    • Connection Rules: A logical set of rules to identify valid connections (e.g., an expression block can be connected to a parameter input slot), perhaps as a JSON schema.
    • Animation Speed: The amount of time (in milliseconds) of the snapping animation, and the visual feedback that is rendered during the process of connecting.

6. Drag and Drop Capability

  • How it should be like:
    Smooth real-time dragging of blocks with transitioning animations.
  • Placement:
    Active both on the Blocks Palette and the Workspace Canvas.
  • Functions:
    • Enable the selection and drag of blocks
    • Show ghost preview upon dragging
    • Snap blocks to valid locations on drop
  • Where they will / won't work:
    • Work: Inside the canvas and from the palette into the canvas.
    • Not work: When blocks are in a locked or read-only state (for example, while running)
  • Parameters:
    • Drag Sensitivity: A scale of how sensitive the drag operation is, such as acceleration factors and threshold distances before a drag is started.
    • Animation Speed: The duration (in milliseconds) for the transition animations when blocks are moved from one location to another. It can have different colors for different states such as when it is connected, disconnected or when it is hovered over
    • Boundary Limits: Labeled limits for where blocks can be dragged, like the workspace canvas edges, in pixel coordinates.

7. Block Categorization System

  • How it should be like:
    An organized grouping of blocks by categories like Data, Expression, Statement, and Control.
  • Placement:
    Within the Blocks Palette, divided into separate areas.
  • Functions:
    • Filtering and sorting blocks by category
    • Dynamic updates in case new blocks are appended
  • Where they should work / not work:
    • Works: In palette view for speedy lookup.
    • Does not work: Outside the palette (blocks in the canvas are already visually grouped).
  • Parameters:
    • Category Identifiers: Single IDs and names per category that guarantee blocks are classified properly and can be referred to within the code.
    • Dynamic Block List: An organized list (e.g., an array or JSON object) containing the properties of every block within a category, such as metadata and sorting information.
    • Refresh Interval: An optional parameter to specify how frequently the palette must update its contents when new blocks are added dynamically.

8. In-Canvas Code Editor Overlay

  • How it should be like:
    An optional overlay for users to see and edit the generated code reflecting their block compositions.
  • Placement:
    Overlay-ed over the workspace or in split-view mode.
  • Functions:
  • Synchronized view between code and blocks
    • Error checking and syntax highlighting
  • Where they should work / not work:
    • Works: When the user explicitly toggles them on or off
    • Does not work: Automatically, only for editing or checking
  • Parameters:
    • Syntax Highlighting Rules: Comprehensive specifications of syntax patterns, keywords, and color schemes that are used to highlight the generated code.
    • Font Settings: Font family, size, and line height parameters to maintain readability (e.g., "Consolas", 14px, 1.5 line-height).
    • Synchronization Frequency: The frequency (in milliseconds) with which changes in the block layout are updated in the code view, providing near real-time feedback.

9. Debugger and Step-through Execution

  • How it should be like:
    A debugger panel that allows users to execute code step-by-step with breakpoints and variable watches.
  • Placement:
    In a separate modal or a split-view panel.
  • Functions:
    • Step, pause, resume execution
    • Show current block or line of code
    • Examine variable values
  • Where they should work / not work:
    • Works: Only during program running
    • Does not work: In design or idle mode
  • Parameters:
    • Breakpoint List: An organized list of breakpoints (by block ID or line number of code) with their status (active/inactive) and conditions if they exist.
    • Step Delay: The amount of delay (in milliseconds) between every step of execution for easy step-through visualization.
    • Watch Variables List: Variable configuration for what to observe, their type expectations, and actual values, all updated live.

10. Breakpoint Functionality

  • How it should be like:
    Feature to enable marking certain blocks or lines of code to stop executing.
  • Placement:
    Available through right-click context menus on blocks or in the overlay of the code editor.
  • Functions:
    • Toggle breakpoints
    • Visually indicate breakpoints on canvas/code
  • Where they should work / not work:
    • Works: In debug mode when running
    • Does not work: In run mode with debug features disabled
  • Parameters:
    • Block/Code Reference: An explicit pointer (e.g., unique id or line number) that specifies where the breakpoint is set.
    • Breakpoint State: A boolean or enum type to show whether the breakpoint is on, off (temporarily disabled), or conditional.
    • Trigger Conditions: Optional arguments to specify conditions where the breakpoint ought to trigger (e.g., "if variable x > 10").

11. Variable Inspector

  • How it should be like:
    An independent panel presenting current variable values at runtime.
  • Placement:
    Usually on a toggleable sidebar used during debugging sessions.
  • Functions:
    • Real-time monitoring of variable values
    • Enable inspection of data types and scopes
  • Where they should work / not work:
    • Works: While executing and during debugging sessions
    • Does not work: While there is no running program or when in static design mode
  • Parameters:
    • Variable Metadata: Comprehensive information about each variable, such as name, type, current value, and scope (local, global, etc.).
    • Refresh Rate: The rate (in milliseconds) at which the inspector refreshes its displayed values while running.
    • Display Configuration: Layout options, including sorting (alphabetical, by usage frequency), and formatting (e.g., numerical precision).

12. Real-time Execution Feedback

  • How it should be like:
    Inmediate visual or audio feedback indicating which block is running.
  • Placement:
    Built into the workspace with dynamic highlighting of active blocks.
  • Functions:
    • Highlighting of running blocks in run mode
    • Optionally playing sound feedback for certain actions
  • Where they should work / not work:
    • Works: Only during live running
    • Does not work: During paused or idle conditions
  • Parameters:
    • Highlight Style: Precise descriptions of the appearance effects (e.g., color codes, glowing effect, animation length) utilized to mark active blocks.
    • Sound Settings: Options for sound feedback such as file paths, volumes, and additional optional switches for various events (e.g., block start, error).
    • Feedback Delay: The smallest amount of time (in milliseconds) between events of execution to avoid fast flickering of highlights.

13. Error Highlighting and Reporting

  • How it should be like:
    Clean visual markings on blocks with errors, along with an error message panel in detail.
  • Placement:
    Errors highlighted on the blocks in the workspace; details displayed in a floating panel.
  • Functions:
    • Mark syntax or logic errors
    • Offer corrective recommendations
  • Where they should work / not work:
    • Works: On code execution or at user request
    • Does not work: When blocks are not checked (e.g., on initial placement)
  • Parameters:
    • Error Type Definitions: A list of error types (syntax, runtime, logical) with corresponding severity levels and display indicators (e.g., red border, flashing icon).
    • Message Templates: Standard templates for error messages that may contain placeholders for dynamic information like block ID or variable name.
    • Display Duration: The duration error messages are shown on the block or in the error panel before disappearing or prompting user action.

14. Save and Load Projects

  • How it should be like:
    A reliable system for storing and loading user-authored programs.
  • Placement:
    Available through the toolbar and file menu commands.
  • Functions:
    • Save workspace state (blocks arrangement, parameters, settings)
    • Load saved projects into the workspace
    • Auto-save feature
  • Where they should work / not work:
    • Works: On all supported devices where file I/O is allowed
    • Does not work: In environments with limited file system access (e.g., sandboxed browsers without IndexedDB)
  • Parameters:
    • File Format Specification: A precise blueprint (e.g., JSON schema) of the way the project data (settings, blocks, connections) will be stored.
    • Storage Options: Settings that describe where and under what conditions projects are stored (IndexedDB, cloud services, local storage), including URLs or paths.
    • Auto-save Interval: The interval time (in minutes or seconds) when the system automatically saves the current project status.

15. Undo/Redo Stack

  • How it should be like:
    A smooth history management system through which users can undo or redo changes.
  • Placement:
    Built-in the toolbar with specific buttons and perhaps also access through keyboard shortcuts.
  • Functions:
    • Follow every block add, remove, or change
    • Offer several levels of undo and redo
  • Where they should work / not work:
    • Works: When in design mode
    • Does not work: When actively running where changes are suspended
  • Parameters:
    • History Depth: The number of actions (e.g., 50, 100) that the system holds for undo/redo use, user configurable.
    • Action Metadata: Subtle records of each action such as timestamp, action type, and the targeted blocks.
    • Rollback Mechanism: Definition of how the system undo changes, e.g., possible animations or transit states to denote the undo/redo action.

16. Block Search Functionality

  • How it should be like:
    A lightweight search bar which searches and hightlights the blocks by their names or by type.
  • Placement:
    At the top of the Blocks Palette or as an overlay search bar.
  • Functions:
    • Instant filtering as the user types
    • Highlight search results within the palette
  • Where they should work / not work:
    • Works: In the Blocks Palette and optionally within the workspace for large projects
    • Does not work: When the palette is not clicked upon by the user.
  • Parameters:
    • Query String: The text input that filters blocks with the possibility of regex or fuzzy matching.
    • Filter Criteria: Precise parameters to limit search results such as block type, category, or recent use.
    • Result Highlighting: Visual attributes like highlight color or font weight variations that show corresponding blocks in the palette.

17. Block Customization Panel

  • How it should be like:
    A modal or sidebar that allows users to customize properties of a chosen block.
  • Placement:
    Comes up when a block is double-clicked or via a context menu item. This is placed inside the palette.
  • Functions:
    • Modify parameters such as numeric values, labels, and styles
    • Validate inputs and give feedback about errors
  • Where they should work / not work:
    • Works: On single block selection
    • Does not work: In bulk operations unless multi-edit mode is activated
  • Parameters:
    • Parameter List: A comprehensive layout describing every configurable attribute of a block (e.g., numeric value, text description), including data types and default values.
    • Validation Rules: Concrete rules (ranges, regex patterns, required fields) for every parameter to guarantee data integrity.
    • UI Controls: Input control types (sliders, text fields, dropdowns) and their settings (min/max values, step increments) for editing each parameter.

18. Block Parameter Editor Popup

  • How it should be like:
    A focused dialog for editing detailed parameters of complex blocks (e.g., loops, function calls).
  • Placement:
    Centered popup when a block with multiple parameters is clicked.
  • Functions:
  • A form layout for entering parameters
    • Real-time validation and tip hints
  • Where they should work / not work:
    • Works: On blocks where detailed configuration is needed
    • Does not work: On simple blocks where inline editing is required
  • Parameters:
    • Form Structure: A structure definition for the popup, with fields for various parameter groups and titles for every field.
    • Real-time Validation: Specific requirements that are validated as the user enters values, with instant feedback messages and error icons.
    • Submission Actions: Parameters that determine what occurs when the user makes final changes, e.g., updating the block's data model and forcing a UI refresh.

19. Zoom and Pan Controls

  • How it should be like:
    Convenient controls facilitating easy navigation of large workspaces.
  • Placement:
    Included as gestures (mouse wheel, touch pinch) and on-screen buttons within the workspace.
  • Functions:
  • Smooth zoom in/out
    • Click-drag pan across the canvas
  • Where they should work / not work:
    • Works: On all devices with the correct input methods
    • Does not work: If the workspace is fixed at a certain zoom (e.g., during some presentations)
  • Parameters:
    • Zoom Factor Constraints: Range of minimum and maximum scale values (e.g., 0.5x to 4x) that limit the extent to which the user can zoom in or out.
    • Pan Sensitivity: Speed at which the workspace travels due to drag, usually as pixels per movement event.
    • Input Method Settings: Settings to manage varied inputs (mouse wheel, pinch by touch, arrow keys) along with respective acceleration and sensitivity curves.

20. Context Menu for Blocks

  • How it should be like:
    Right-click menu having quick block-centric actions available.
  • Placement:
    For every block within the workspace.
  • Functions:
    • Duplicate, delete, customize, add breakpoints
    • Offer more options depending on block type
  • Where they should work / not work:
    • Works: Right-clicked on an active block
    • Does not work: On locked blocks or read-only blocks
  • Parameters:
    • Menu Item List: An ordered array of items, each with a label, corresponding action callback, and optional icon.
    • Contextual Conditions: Conditions for rules that can be enabled or disabled depending on the properties of the block (e.g., "delete" not available for core blocks).
    • Display Duration: Duration settings that manage when the menu opens after an activation or after no activity for some time.

21. Block Duplication and Deletion

  • How it should be like:
    Quick action to duplicate a block or delete one from the workspace with prompting options.
  • Placement:
    Accessible via context menus and keyboard shortcuts.
  • Functions:
    • Copy blocks with all their parameters
    • Delete blocks safely, with the ability to undo
  • Where they should work / not work:
    • Works: On any editable block
    • Does not work: On system-critical blocks that are part of the program's core structure
  • Parameters:
    • Block Identifier: An identifier for the block to be copied or removed so that the right target is being manipulated.
    • Confirmation Prompts: Adjustable settings for requesting user confirmation (text content, delay before deletion) prior to removal in order to avoid accidental loss.
    • Duplication Options: Other settings that may enable the copying of several blocks simultaneously, including keeping relative positions and parameters.

22. Dynamic Parameter Validation

  • How it should be like:
    Immediacy that validates user entries while they are adjusting block parameters.
  • Placement:
    Part of the Block Customization Panel and Parameter Editor Popup.
  • Functions:
    • Check numbers within ranges, text formats, and conditional states
    • Offer instant response (e.g., color cues, error message)
  • Where they should work / not work:
    • Works: On parameter entry and modification
    • Does not work: Upon final submission (though error messages remain until resolved)
  • Parameters:
    • Validation Criteria: Detailed rules for every parameter including permitted ranges (min/max values), accepted forms (regex patterns), and specialized functions for difficult validations.
    • Feedback Mechanisms: Rules for presenting validation feedback (e.g., inline messages, border color flashes, tooltip prompts).
    • Error Persistence: Timing options on how long error messages stay shown and circumstances for when they dismiss.

23. Code Reordering Functionality

  • How it should be like:
    A simple method to reorder chunks in a sequence or nested ordering.
  • Placement:
    Accessible through drag-and-drop in the workspace and through up/down arrows in the context menu.
  • Functions:
    • Enable blocks to be moved without disconnection
    • Reconfigure dependent connections automatically
  • Where they should work / not work:
    • Works: In linear chains and grouped blocks
    • Does not work: Between distinct subroutine boundaries unless specifically allowed
  • Parameters:
    • Ordering Index: A numerical index or position number for every block in a series to handle reordering effectively.
    • Reordering Constraints: Constraints that decide legal movements, like preventing moves across non-adjacent group boundaries without verification.
    • Transition Effects: Visual attributes like animation time and easing functions that yield a smooth visual transition while blocks are being moved.

24. Multi-selection for Group Editing

  • How it should be like:
    A feature to select multiple blocks at once for mass operations.
  • Placement:
    Activated by shift-click or marquee selection within the workspace.
  • Functions:
    • Group blocks to move, copy, or delete in unison
    • Give a visual border around selected blocks
  • Where they should work / not work:
    • Works: When editing similar or analogous block groups
    • Does not work: Within blocks of distinct, non-editable contexts (e.g., locked UI components)
  • Parameters:
    • Selection Criteria: Parameters that specify the way multiple blocks are selected (shift-click, click-and-drag rectangle) including sensitivity thresholds.
    • Action Identifiers: An array of actions possible on the target group (move, duplicate, delete), along with protection to avoid conflicting actions.
    • Selection Boundaries: Instructions about how the bounding box is displayed and reacts on meeting blocks of other layers or locked areas.

25. Block Grouping (Subroutines/Functions)

  • How it should be like:
    A feature that allows users to wrap a collection of blocks in one reusable module.
  • Placement:
    Accessible through a group button on the toolbar or context menu.
  • Functions:
    • Make a new function/subroutine out of selected blocks
    • Enable parameter passing into and out of the group
  • Where they should work / not work:
    • Works: In user-defined function and modular programming environments
    • Does not work: For internal system modules that need independent processing
  • Parameters:
    • Group ID and Name: Identifiers and names that can be customized for the newly formed group or function.
    • Input/Output Definitions: Complete lists of parameters for the function inputs and outputs, with data types and default values.
    • Encapsulation Rules: Rules that specify which blocks can be encapsulated and how their connections must be preserved or re-mapped inside the encapsulation.

26. Execution Flow Highlighting

  • How it should be like:
    Visual trails showing the current execution path through connected blocks.
  • Placement:
    Superimposed over the work space while in program execution.
  • Functions:
    • Animate the order in which blocks have been executed
    • Make branches in the conditional structures blink
  • Where they should work / not work:
    • Works: During live execution
    • Does not work: In design mode when a program is not executing
  • Parameters:
    • Highlight Animation: Advanced settings for the animation style (color, duration, easing) used to highlight the active block.
    • Sequence Delay: Timing settings that control how long each block is highlighted before advancing to the next.
    • Branching Indicators: Visual indicators (e.g., arrows, trail lines) with customizable styles that assist in differentiating various execution paths in conditional or loop constructs.

27. Connection Error Detection

  • How it should be like:
    A routine process that is constantly tracking block connections and marking for inconsistencies.
  • Placement:
    Baked into the workspace's logic engine.
  • Functions:
    • Notify users when incompatible blocks are connected
    • Offer suggestions for proper connections
  • Where they should work / not work:
    • Works: In edit mode and prior to running
  • Does not work: Only after program runtime has commenced (warnings only ought to remain active)
  • Parameters:
    • Connection Ruleset: Full enumeration of allowable connections in pairs together with block-to-block exception conditions and rules.
    • Error Notification Settings: Controls defining how errors get presented (visual overlays, popup messages) in addition to how serious and closable.
    • Continuous Monitoring Frequency: The frequency (in milliseconds) at which the system monitors for connection errors while editing blocks.

28. Tooltip and Help System

  • How it should be like:
    Context-specific tooltips and an exclusive help system that offers in-depth explanations for every block and function.
  • Placement:
    Tooltips on hover over blocks; a help panel is reachable through the toolbar.
  • Functions:
    • Present short descriptions and examples of usage
    • Refer to detailed documentation
  • Where they should work / not work:
    • Works: On hover when a help button is enabled
    • Does not work: When playing in full-screen interface mode (except when manually enabled)
  • Parameters:
    • Tooltip Content: Text or markdown information explaining the function of each block, examples of use, and any restrictions.
    • Display Duration: Options for display duration of how long a tooltip is shown once the user moves the cursor over a block and then disappears.
    • Help Panel Configuration: Help panel layout options including searchable topics, collapsible areas, and inclusion of multimedia content.

29. Layout Adaptation and Responsive Design

  • How it should be like:
    An auto-adaptive interface to varying screen sizes and orientation.
  • Placement:
    Used in the whole application layout.
  • Functions:
    • Dynamically adjust workspace, palette, and panels
    • Adapt between desktop, tablet, and mobile layouts
  • Where they should work / not work:
    • Works: In all supported device types
    • Does not work: When operating in fixed-resolution mode (i.e., when a user has specifically turned off responsiveness)
  • Parameters:
    • Breakpoints: Explicit pixel widths (e.g., 480px, 768px, 1024px) that signal when the layout should adapt to fit varying device sizes.
    • Layout Modes: Predetermined settings for desktop, tablet, and mobile views that vary component sizes, locations, and navigation menus.
    • User Overrides: User settings that enable users to toggle between responsive and fixed layouts, with scale factors and margins that can be customized.
Select a repo