blockly-samples icon indicating copy to clipboard operation
blockly-samples copied to clipboard

Export the individual mutators and extensions from block-shareable-procedures

Open maribethb opened this issue 1 year ago • 0 comments

Category

Plugins

Component block-shareable-procedures

Is your feature request related to a problem? Please describe.

If you want to make procedure blocks that use a custom mutator UI, it's very difficult to do so with the plugin. The mutator has all of the complex serialization and procedure-map management functionality, and also comes with compose and decompose functions which will mean the default mutator UI is used. We need to provide some way to access the mutator object so that developers can pick and choose which portions of it they want.

  • You can't register an extension that deletes the compose and decompose properties because we enforce that extensions don't alter the mutator properties. the check happens during jsonInit so you can't even catch and ignore the error because it would trigger every time the block is created.
  • We don't provide an API to get an extension or mutator out of the registry once it's been registered

Describe the solution you'd like

Export each of the mutator and extension objects from the plugin so users have the option to copy and modify the pieces they need to

Describe alternatives you've considered

Developers have to either copy/paste large amounts of logic out of the mutator in the plugin, which is bad (effectively untracked forking of the plugin) or use the undocumented and very fragile TEST_ONLY property in the Extensions class, which we may change at any time and should definitely not be relied on

Alternatively, we could add an API to core to get you an Extension out of the registry, but I think it makes sense to solve this at the plugin level

Additional context

this is needed for cdo sprite lab migration

maribethb avatar Jul 20 '23 19:07 maribethb