Releases: scratchblocks/scratchblocks
High contrast bugfixes, add Hindi
What's Changed
- Fix rendering issues by @apple502j in #488
- Add Hindi, update deps by @apple502j in #493
Full Changelog: v3.6.3...v3.6.4
Fix SVG export
High Contrast support
This update includes support for the new High Contrast blocks! Use the scratch3-high-contrast
style instead of scratch3
to render.
This version also contains the following updates:
- Fixes certain colors not encountered by default, such as motion/looks blocks with boolean inputs
- Fixes wrong font being used to render blocks. The font was previously specified as "Helevetica", with an extra "e". It is now rendered using "Helvetica".
- Fixes rendering of Scratch 2.0 "ring blocks".
- Translation updates, including WeDo extension for French.
What's Changed
- Rollup v3 and updates by @apple502j in #459
- scratch2: Handle newlines in translatePath by @tjvr in #461
- Bump deps, update French by @apple502j in #463
- Bump rollup and scratch-l10n by @apple502j in #464
- Add extra aliases for Hungarian by @CST1229 in #470
- Update locale (2023-01-26) by @apple502j in #468
- Locale updates by @apple502j in #471
- Support new block colors by @apple502j in #474
- Code refactor and bump deps by @apple502j in #476
Full Changelog: v3.6.1...v3.6.2
ES6
The main change for this release were behind-the-scenes: @apple502j and @tjvr refactored the whole codebase to bring it up to "modern ES" standards 🎉 We also added and improved the CI jobs. Hopefully these changes should make this project easier to maintain! (#414, #415, #417, #420, #421, #422, #423, #424, #427, #428, #437, #441, #446, #447)
Other changes
- Fixed a bug when rendering an empty loop (#387)
The following fixes are all thanks to @apple502j!
- Removed extra whitespace from the generated SVGs (#432)
- Brought the Readme up-to-date (#435)
- Fixed a bug when exporting a PNG of an empty script (#419)
- Fixed stringifying of escaped
\v
(#440)
Locale changes
- Fix the Catalan aliases, thanks to @qucchia (#410)
- Add 5 new locales just added to Scratch: Filipino, Asturian, Occitan, Esperanto, and Hausa.
Full Changelog: v3.6.0...v3.6.1
Translation fixes, scale option, etc
What's Changed
This release:
- Fixes a whole handful of translation issues, by overhauling how blocks are stored and conflicts are resolved (#383, thanks to @apple502j)
- Adds a new
scale
option (#379, thanks to @HunorMarton ) - Fixes the bottom padding on C blocks (#382)
- Adds new stop sign and Snap! list icons (#378, #390, thanks to @CST1229)
- Fixes some edge cases with the comparator predicates
<
and>
(#401)
Special thanks to @apple502j for their many other contributions 🙏
Full Changelog: v3.5.2...v3.6.0
v3.5.2
v3.5.1
This release includes the following fixes:
- Remove extra padding at the bottom of Scratch 3 SVGs (#301), with thanks to @exKAZUu and others. This solves a long-standing problem with inline scratchblocks! 😅
- Add
viewbox
to the SVGs (#365), thanks to @JackMorganNZ. This allows resizing the SVGs with CSS! - Avoid
<use xlink:href>
in SVG (#348), thanks to @DarDoro. This should help with the Discourse plugin!
I've also fixed a couple of regressions in ring blocks, since those are used a fair bit on the Snap! forums.
I'll aim to do another release (v3.6 perhaps?) in the next month or so, which will include #343 plus an updated translation file.
v3.5.0
-
Rework define hat recognition (#311, #266)
Previously we were assuming that the
define
keyword was a single word in all languages and that it was always a prefix. We were matchingdefine
hats before matching built-in blocks. In fact, we were using a totally separate parser for define hat contents.I've removed this special parser, and moved
define
matching to a later stage. The result is less clean code, but we can now support languages where the define keyword is a suffix rather than a prefix, and we can match built-in blocks before checking for a define hat (which fixes a bug with Brazilian Portugese). I've also added support for multiple-word prefixes and suffixes.As a side-effect of this change we will now handle certain edge cases differently. For example, previously we would parse
[foo v]
inside a define hat as a string reporter with the label "foo v"; it will now be parsed as a dropdown. I don't think breaking backwards-compatibility is too bad here; the syntax for define hats has never been particularly well-defined in the first place!This also breaks compatibility with old langauge packs (necessitating a new minor version).
-
Add "when stage clicked" block (#333), thanks to @azhou4
Incredibly, this block from Scratch 3 has been missing this whole time! Who knew?
-
Support Japanese "stop" block (#315)
The Japanese "stop" block has no labels, just a dropdown, and a bug in the locale generation meant it was omitted. This is fixed so you can now use it.
Note that dropdown menus are still not translated automatically (see #324).
-
Center label text in small reporters (#331), thanks to @exKAZUu
-
Re-generate all the locales (#334)
The locales have been updated to the latest version of
scratch-l10n
. -
Add cat blocks (#327)
These were temporarily shown in Scratch 3 as part of April Fools' 2020. You can now use these in scratchblocks via a new
:: cat
shape override.
Use Scratch 3.0 translations site
This release updates scratchblocks to use the Scratch 3 translations repository instead of the Scratch 2 translations repository.
- I removed
toJSON()
. This was used for the long-defunct "Backpack plugin". Keeping it working was proving to be a pain; it was mostly used for the tests, which I've rewritten to better express what we're actually testing for. - I removed
fromJSON()
. This was only used for the generator, which is no longer supported.
For more details on the internal changes, see #285.
This work was kindly supported by the Raspberry Pi Foundation.
Scratch 3 Renderer
The interface for using scratchblocks has changed. It now looks something like this:
// Parse the source code
var doc = scratchblocks.parse(source, {
languages: obj.lang ? ['en', obj.lang] : ['en'],
})
// Create a DocView with your chosen style
var docView = scratchblocks.newView(doc, {
style: 'scratch3', // Or 'scratch2'
})
// Render to an SVG
var svg = docView.render()
// Scratch 3 is zoomed out by default, so you probably want to do the same
svg.style.transform = 'scale(0.675)';
svg.style.transformOrigin = '0 0';
// Add that SVG to your page, etc
document.body.appendChild(svg)