Skip to content

v0.3.0

Choose a tag to compare

@yousifamanuel yousifamanuel released this 29 Sep 23:33
· 63 commits to main since this release

Morphic Blocks 0.3.0 shows one program in as many views as you like, keeps every request on your own site, and makes the toolbox work without a mouse. It has two breaking changes; see below.

Breaking changes

  • Blockly's media loads from your own site by default. Images and sounds now come from blockly-media/ next to your page. Copy them there with the new command before dev and build:

    "dev": "morphic-blocks copy-media public/blockly-media && vite"

    A console warning names the problem when the media is missing. To keep loading from Blockly's server, set blockly: { media: "https://blockly-demo.appspot.com/static/media/" }. See Privacy & External Requests.

  • Language settings of code elements moved into a code section. stringQuote and empty (from elementTypes) and the top level highlighting map now live under code.<element>, next to the new emptyStatement and values. mount() throws on the old places and names where each setting moved. See Definitions Format.

New

  • More views: engine.addView() adds more previews, codespaces (editable) and read only workspaces, each in its own mode. Presets set their modes with views, and toolbars attach to any view by name.
  • Toolbox without a mouse: tiles drag with a finger or pen, and are reached with Tab and added with Enter or Space, with names for screen readers. Both are on by default (toolbox.touch, toolbox.keyboard).
  • Toolbox: mount() sets its label and block list, code shown as text on tiles is colored like the codespace, and the widest block's width is published as --morphic-toolbox-block-width for your layout.
  • Warnings for the app: onWarning in mount() receives the framework's warnings instead of the console.
  • Runtime changes: setModeElements() changes which elements a mode shows, and refresh() measures blocks again after a font change.
  • Output: runJavaScript() prints values the way the codespace's language writes them (True, None, …), set with code.<element>.values.
  • Codespace and preview carry their mode's class, so mode CSS styles them too.

Fixes

  • Codespace drops follow the workspace's connection checks, connect into top level chains and no longer cover other blocks.
  • Toolbox tiles show slot defaults and field values, draw each code element from its own template, and render right to left correctly.
  • Field values a mode's template leaves out are kept, and values typed into default slots survive a redraw.
  • New blocks no longer push nearby blocks away.
  • Highlighting matches keywords in any script and custom colors win over the defaults.
  • The selection highlight is visible on light and dark backgrounds and follows theme changes.
  • JavaScript language support loads only for the code editor.

Full changelog: v0.2.1...v0.3.0