chore!: Update plugins and examples to `blockly` version `9.0.0-beta.1`
This branch is intended to collect all the changes to the blockly-samples repository needed to update samples to Blockly v9.
The first four commits:
- Use
clang-formatto fix (whitespace) formatting ofpackage.jsonandpackage-lock.jsonfiles so they are consistent. - Bump
blocklypeerDependenciesforplugins/*/from<9to<10. - Bump
blocklydevDependenciesforpluins/*/to9.0.0-beta.1. - Run
npm install blockly@betain each package inexamples/*to make surepackage-lock.jsonis consistent withpackage.json.
(Notably this does not yet include updating packages in examples/* to the Blockly v9 beta.)
Current breakages:
- field-date (fixed by #1295)
- field-bitmap (probably fixed by https://github.com/google/blockly/pull/6453 but needs confirmation)
- blocks-plus-minus (fixed by #1305)
- generator imports in dev tools (fixed by #1305)
- keyboard-navigation
Remaining issues:
- Keyboard nav tests inject a workspaceSvg, but it's actually using jsdom. The tests fail on these lines in
core/renderers/marker_svg.ts:
// Ensures the marker will be visible immediately after the move.
const animate = this.currentMarkerSvg!.childNodes[0];
if (animate !== undefined) {
animate instanceof SVGAnimationElement && animate.beginElement();
}
My proposed solution is to swap it back from an instanceof check to a cast or AnyDuringMigration, at least for release. That requires a change in core, a beta, and installing the beta over here.
- Keyboard nav monkeypatches functions on fields and then tries to call functions on the superclass in a way that's no longer allowed.
I don't have a workaround yet.
The next issue is also related to running rendered workspaces in jsdom for testing. Canvas doesn't exist, and Blockly uses it for text width computation.
Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)
The old workaround was to monkeypatch Blockly.dom.utils.getFastTextWidthWithSizeString, but that's no longer accessible for monkeypatching.
Based on the error message, the new workaround is to install a package to add this.
@maribethb fyi I just updated this to a full PR instead of a draft, and I think it's ready to go:
- Every commit has been reviewed individually
- Initial changes are primarily whitespace
- We've tested the results of these changes on my gh-pages.
Normally after the release, we'd update the branch to the full non-beta 9.0.0 release before merging the branch. That should be done first as we don't want the main version of plugins to have a dependency on a beta version.