* chore(messages): npm run messages
This is the raw changes made by `npm run messages`, without any
manual reverts / backporting.
* fix(messages): Backport TranslateWiki hints (with edits)
Backport changes made to qqq.json by TranslateWiki editors to
messages.json, with some modifications.
See https://translatewiki.net/wiki/Template:Optional for details
of how the {{Optional}} template works.
* chore(messages): Apply backported messages.js changes to qqq.json
Also manually revert deletion of translation credits.
This is mostly just chore updating to the new import names
(e.g. BlocklyJavaScript -> javascript.javascriptGenerator),
but the change to Code.checkAllGeneratorFunctionsDefined is
a necessary fix due to the breaking change in PR #7150,
implementing the .forBlock dictionary.
Update the BlockFactory block generator function stub generator
to apply recent changes in generator function best practices:
- Use languageGenarator instead of Blockly.Language.
- Put generator functions in .forBlock dictionary.
- Accept (and use) a second argument that is the calling
CodeGenerator object.
- User Order.ATOMIC enum instead of ORDER_ATOMIC.
Also:
- Prefix (e.g.) javascriptGenerator and Order with "javascript.".
- Use template literals where useful.
- DRY up all the non-special field stub code generation.
Where certain block mixin methods had been marked @private,
and these annotations had been deleted while migrating the
containing files to TypeScript, mark those methods as
@internal.
* refactor(generators): Move lang.js -> lang/lang_gernator.js
Move the LangGenerator definitions into their respective
subdirectories and add a _generator suffix to their filenames,
i.e. generators/javascript.js becomes
generators/javascript/javascript_generator.js.
This is to keep related code together and allow the `lang/all.js`
entrypoints to be moved to the top level generators/ directory.
No goog module IDs were changed, so playground and test code
that accesses this modules by filename does not need to be modified.
* refactor(generators) Move lang/all.js -> lang.js
- Move the entrypoints in generators/*/all.js to correspondingly-named
files in generators/ instead—i.e., generators/javascript/all.js
becomes generators/javascript.js.
- Update build_tasks.js accordingly.
* fix(generators): Add missing exports for LuaGenerator, PhpGenerator
These were inadvertently omitted from #7161 and #7162, respectively.
* refactor(generators): Make block generator modules side-effect free
- Move declaration of <lang>Generator instance from
generators/<lang>/<lang>_generator.js to generators/<lang>.js.
- Move .addReservedWords() calls from generators/<lang>/*.js to
generators/<lang>.js
- Modify generators/<lang>/*.js to export block generator functions
individually, rather than installing on <lang>Generator instance.
- Modify generators/<lang>.js to import and install block generator
functions on <lang>Generator instance.
* fix(tests): Fix tests broken by restructuring of generators
Where these tests needed block generator functions preinstalled
they should have been importing the Blockly.<Lang>.all module.
Where they do not need the provided block generator functions
they can now create their own empty <Lang>Generator instances.
* chore: Update renamings file
- Fix a malformation in previous entries that was not detected by
the renaming file validator test.
- Add entries describing the work done in this and related recent
PRs.
* fix: Correct minor errors in PR #7173
- Fix a search-and-replace error in renamings.json5
- Fix an incorrect-but-usable import in generator_test.js
* fix(build): Include node_modules/@blockly/ in gh-pages branch
- Add node_modules/@blockly to the list of files added to the gh-pages
branch.
- Add a _config.yml file telling Jekyll (which is needed to produce
the homepage served at https://google.github.io/blockly/, and hence
can't be disabled with a .nojekyll file instead) not to exclude
node_modules (which it does by default).
* refactor(build): Modernise git_tasks.js
- Various style updates:
- Use CONSTANT_CASE.
- Use /** JSDoc comments */
- Use `template ${literals}`.
- Use git switch instead of git checkout.
- Try to avoid use of remote names; use URLs where possible.
* refactor(build): Look up upstream git remote
Since git reset can't take a URL but needs an actual remote name,
use git branch -v to look up the remote for
github.com/google/blockly and then use that remote name.
* chores(build): format
Due to errors in PRs #7171 and 7173 (and the author's failure to do
enough local testing before submitting those PRs), compressed mode
loading was broken in the playgrounds. Fix this by:
- Fix a typo in bootstrap.js ("Blocky" -> "Blockly").
- Updating the chunks definitions build_tasks.js to use the new
variables we expect to contain generator exports objects.
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Added basic example test for Blockly Playground and Blockly Demo
* feat: Add functionality to run playground and block factory test locally
* feat: Add functionality to run playground and block factory test locally
* feat: Add functionality to run playground and block factory test locally
* feat: Add functionality to run playground and block factory test locally
* feat: Create procedure test
* feat: Create procedure test
* feat: Create procedure test
* chore: test for procedures
* chore: test for procedures
* chore: test for procedures
* chore: test for procedures
* fix: Switch broswer_test.yaml to be macOS as to match local development evn
* fix: Switch broswer_test.yaml to be macOS as to match local development evn
* fix: Switch broswer_test.yaml to be macOS as to match local development evn
* fix: Switch broswer_test.yaml to be macOS as to match local development evn
* fix: Update browser test to run manually, and move browser test suiteSetup in to a separate function
* fix: input exports
* chore: fix build
* chore: attempt to fix build
* chore: attempt to fix build
* chore: create new align enum to replace old one
* chore: format
* fix: Tweak renamings entries
It appears that the goal is to map:
Blockly.Input.Align -> Blockly.inputs.Align
Blockly.Align -> Blockly.inputs.Align
Blockly.ALIGN_* -> Blockly.inputs.Align.*
I believe this commit achieves that in a more minimal (and correct)
way—but if I have misunderstood the intention then this will not
be a useful correction.
---------
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
* Copy core/events/events_block_change.ts to core/events/events_block_field_intermediate_change.ts
* New intermediate event type for field edits.
* Addressing PR feedback.
* Ran npm run format.
* Fixed procedure mutator responding to param edits.
* Intermediate events now inherit from BlockBase.
* Addressing feedback on PR.
* chore: format
Refactor bootstrap.js and bootstrap_helper.js to be able to deal
with generator chunks. In particular for each chunk, specify:
- The goog.module ID to goog.require() in uncompressed mode.
- The script filename to load in compressed mode.
- Where the chunk's UMD wrapper will save the export object when
loaded as a script.
- What global variable the chunk's export object should be saved in
(if desired).
- Any individual named exports to destructure to global variables.
This allows the bootstrap scripts to be slightly simpler while
also being more flexible.
Previously, when loading a generator chunk (e.g.,
javascript_compressed.js) as a script (e.g., in a browser using
a <SCRIPT> tag), only a single named export from that chunk would
be made available (e.g, javascriptGenerator would be made availabe
as Blockly.JavaScript).
Until recently, that was fine because each generator chunk had only
a single named export, but now each one additionally has a
<Lang>Generator class and Order enum export.
To allow these new exports to be accessed by script users, the
chunk wrappers are modified to provide the whole export object
at a correspondingly-named global variable—e.g., when loaded as
a script javascript_compressed.js creates a global variable named
javascript, so the named exports can be accessed as
javascript.javascriptGenerator, javascript.JavascriptGenerator
and javascript.Order, as if the user had imported them via
import * as javascript from 'blockly/javascript';
This PR includes a breaking change and a deprecation, both of
which are only applicable when loading generators as scripts
(e.g. via a <SCRIPT> tag):
BREAKING CHANGE: The generator chunks will, when loaded as scripts
(e.g. via a <SCRIPT> tag, now clobber any existing global variable
of the corresponding name:
- dart_compresed.js will set dart
- javascript_compresed.js will set javascript
- lua_compresed.js will set lua
- php_compresed.js will set php
- python_compresed.js will set python
DEPRECATION: Accessing the generator instances at their previous
locations (Blockly.Dart, Blockly.JavaScript, Blockly.Lua,
Blockly.PHP, and Blockly.Python) is deprecated and may cease
to work in a future version of Blockly.
* feat(generators): Pass this CodeGenerator to generator functions
This implements option 1A of proposal 1 of #7086.
This commit is not by itself a breaking change, except in the unlikely event that
developers' custom generator functions take an (optional) second argument of a
dfferent type.
* feat(generators): Accept generator argument in block functions
Accept a CodeGenerator instance as parameter two of every
per-block-type generator function.
* fix(generators): Pass generator when calling other generator functions
Make sure to pass generator to any other block functions that are
called recursively.
* refactor(generators)!: Use generator argument in generator functions
Refactor per-block-type generator functions to use the provided
generator argument to make recursive calls, rather than depending
on the closed-over <lang>Generator instance.
This allows generator functions to be moved between CodeGenerator
instances (of the same language, at least).
This commit was created by search-and-replace and addresses most
but not all recursive references; remaining uses will require
manual attention and will be dealt with in a following commit.
BREAKING CHANGE: This commit makes the generator functions we provide
dependent on the new generator parameter. Although
CodeGenerator.prototype.blockToCode has been modified to supply this,
so this change will not affect most developers, this change will be a
breaking change where developers make direct calls to these generator
functions without supplying the generator parameter. See previous
commit for an example of the update required.
* refactor(generators): Manual fix for remaining uses of langGenerator
Manually replace remaining uses of <lang>Generator in block
generator functions.
* fix(generators): Delete duplicate procedures_callnoreturn generator
For some reason the generator function for procedures_callnoreturn
appears twice in generators/javascript/procedures.js. Delete the
first copy (since the second one overwrote it anyway).
* chore(generators): Format
Addresses various nits that escaped previous PRs:
* Add TSDoc for `BlockGenerator` in `core/generator.ts` for PR #7150.
* Fix bad formating in `generators/javascript.js` from PR #7153.
* Add missing `@enum` tag that should have been included in PR #7160.
* Delete obsolete comment from `generators/python.js` for PR #7163.