Commit Graph

8015 Commits

Author SHA1 Message Date
ericblackmonGoogle
d832085c40 Merge pull request #7222 from google/rc/v10.0.0
release: v10.0.0
blockly-v10.0.0
2023-06-28 19:46:53 +00:00
Eric Blackmon
241c9632cf release: Update version number to 10.0.0 2023-06-28 15:25:32 -04:00
Eric Blackmon
fb95ae6f72 release: Merge branch 'develop' into rc/v10.0.0 2023-06-28 15:23:21 -04:00
ericblackmonGoogle
4b563c1503 chore: update renamings file for new release (#7219)
* chore: update renamings file for new release

* chore: update renamings file for new release

* chore: update renamings file for new release
2023-06-28 15:20:40 -04:00
ericblackmonGoogle
86053a4ba6 chore: Update metadata for 2023 Q2 release (#7221) 2023-06-28 15:19:45 -04:00
Christopher Allen
6670db1f2d chore(messages): Update messages (#7220)
* 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.
2023-06-28 15:13:28 -04:00
ericblackmonGoogle
6732b097fa chore: Rollup of 2023 Q2 updates from TranslateWiki (#7217) 2023-06-28 15:10:49 -04:00
Rachel Fenichel
e2cd1bad24 chore: remove js-green-licenses (#7201) 2023-06-27 13:36:06 -07:00
Beka Westberg
452abd4b93 chore: add setVisible (#7214)
* chore: add setVisible

* chore: format
2023-06-27 13:09:10 -07:00
Christopher Allen
e49c028c84 fix(demos): Update to use new script import names for generators (#7213)
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.
2023-06-27 17:50:36 +01:00
Christopher Allen
5579098e35 fix(demos): Update BlockFactory generator stub generator (#7211)
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.
2023-06-27 14:36:15 +01:00
Beka Westberg
b189b1989c chore: deprecate minimalist renderer (#7210)
* chore: deprecate the minimalist renderer

* chore: add renamings
2023-06-26 14:30:06 -07:00
Beka Westberg
d6848de645 fix: export the IIcon and related interfaces (#7203)
* fix: export the IIcon interface

* fix: export ISerializable interface

* fix: export IHasBubble interface
2023-06-23 14:26:32 -07:00
jayway
1174777b7c fix: Utilize getIcon instead of getCommentIcon in tests (#7200)
* fix: refactor getCommentIcon to getIcon and remove warning

* format & lint (please squash)

* revert changes to block_svg.ts until v11
2023-06-23 11:16:34 -07:00
Beka Westberg
acbe2c6a29 fix: properly pass the block to the icon constructor in blockfactory blocks (#7202) 2023-06-23 11:01:35 -07:00
Christopher Allen
7771a6dbff fix(build): Correct typos in PR #7169 (#7197)
Three separate mistakes left only the Python and PHP chunks with
the correct code for the legacy script exports.
2023-06-22 20:35:19 +00:00
Christopher Allen
5a39c4c8d5 refactor(tests): Migrate mocha tests from goog.require to import (#7196)
Migrate the two remaining uses of goog.require in the mocha tests
from goog.require to import.
2023-06-22 17:29:54 +01:00
Beka Westberg
a4ba65abf7 chore: make getWorkspace public (#7195) 2023-06-21 17:14:25 -07:00
Christopher Allen
b6e084257e refactor(blocks): Migrate blocks/blocks.js to TypeScript (#7193)
* refactor(blocks): Auto-migration of blocks/blocks.js to ts

* fix(blocks): Manually migrate & fix types in blocks.ts

* fix(build): Update location of blocks/blocks.ts exports object

* fix(blocks): Remove lint

* chore(blocks): Format
2023-06-21 22:07:20 +01:00
Christopher Allen
ec71261813 refactor(blocks): Migrate blocks/procedures.js to TypeScript (#7192)
* refactor(blocks): Auto-migration of blocks/procedures.js to ts

* fix(blocks): Revert obvious automigration fails in blocks/procedures.js

* fix(blocks): Manually migrate & fix types in procecures.ts

* fix(blocks): Remove lint

* chore(blocks): Format

* fix(7192): Corrections for PR #7192
2023-06-21 21:51:14 +01:00
Christopher Allen
ea74772e30 fix(blocks): Mark previously-@private methods @internal (#7194)
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.
2023-06-21 20:38:27 +01:00
Beka Westberg
5ee9003044 fix: bubble exports (#7189)
* fix: bubble exports

* chore: delete the old bubble
2023-06-21 11:26:22 -07:00
Beka Westberg
91e8105e81 chore: add top-level inline docs to bubbles icons and inputs (#7190)
* chore: add top-level inline docs to bubbles icons and inputs

* chore: fixup for PR comments
2023-06-21 10:14:25 -07:00
Beka Westberg
5f2e143ab8 chore: allow themes to override eachother (#7188) 2023-06-21 08:26:01 -07:00
Christopher Allen
130989763c refactor(generators): Restructure generator modules to contain side effects (#7173)
* 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
2023-06-20 23:22:44 +01:00
dependabot[bot]
021a560ef0 chore(deps): Bump eslint from 8.42.0 to 8.43.0 (#7179)
Bumps [eslint](https://github.com/eslint/eslint) from 8.42.0 to 8.43.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.42.0...v8.43.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-20 13:58:43 -07:00
dependabot[bot]
f12c206731 chore(deps): Bump @typescript-eslint/eslint-plugin (#7180)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.59.6 to 5.59.11.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.59.11/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-20 13:58:31 -07:00
dependabot[bot]
b41ec7d940 chore(deps): Bump typescript from 5.0.4 to 5.1.3 (#7182)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 5.0.4 to 5.1.3.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v5.0.4...v5.1.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-20 13:58:21 -07:00
dependabot[bot]
b56b755ca4 chore(deps): Bump @microsoft/api-documenter from 7.22.16 to 7.22.20 (#7183)
Bumps [@microsoft/api-documenter](https://github.com/microsoft/rushstack/tree/HEAD/apps/api-documenter) from 7.22.16 to 7.22.20.
- [Changelog](https://github.com/microsoft/rushstack/blob/main/apps/api-documenter/CHANGELOG.md)
- [Commits](https://github.com/microsoft/rushstack/commits/@microsoft/api-documenter_v7.22.20/apps/api-documenter)

---
updated-dependencies:
- dependency-name: "@microsoft/api-documenter"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-20 13:58:07 -07:00
Christopher Allen
4adc932ed5 fix(build): Fix GitHub pages & deployment task (#7186)
* 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
2023-06-20 21:50:44 +01:00
Christopher Allen
ace9c4a188 fix(tests): Fix compressed mode loading (#7178)
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.
2023-06-20 21:49:26 +01:00
ericblackmonGoogle
d22c3b4383 Fix: Update browser test to run manually, and move browser test suiteSetup in to a separate function (#7138)
* 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
2023-06-20 13:10:07 -04:00
dependabot[bot]
0f3fa22f66 chore(deps): Bump @microsoft/api-extractor from 7.35.0 to 7.35.4 (#7181)
Bumps [@microsoft/api-extractor](https://github.com/microsoft/rushstack/tree/HEAD/apps/api-extractor) from 7.35.0 to 7.35.4.
- [Changelog](https://github.com/microsoft/rushstack/blob/main/apps/api-extractor/CHANGELOG.md)
- [Commits](https://github.com/microsoft/rushstack/commits/@microsoft/api-extractor_v7.35.4/apps/api-extractor)

---
updated-dependencies:
- dependency-name: "@microsoft/api-extractor"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-20 09:56:01 -07:00
Christopher Allen
95dd63b2bd refactor(blocks): Migrate blocks/logic.js to TypeScript (#7003)
* refactor(blocks): Auto-migration of blocks/logic.js to ts

* fix(blocks): Manually migrate & fix types in logic.ts

* chore(blocks): Fix import order

* chore(blocks): Fixes for PR #7003

* chore(blocks): Lint removal

* chore(blocks): Format blocks/logic.ts
2023-06-16 21:13:41 +01:00
Beka Westberg
d7ccf8a5ee fix: input exports (#7165)
* 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>
2023-06-16 11:27:46 -07:00
Beka Westberg
2d3aec45f6 fix: icon exports (#7159) 2023-06-16 10:59:36 -07:00
John Nesky
b8ad7d307f feat: use new intermediate block change event for field edits, normal block change event for closing editor. #7105 (#7151)
* 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
2023-06-16 09:27:56 -07:00
Maribeth Bottorff
cb8ed73c48 fix: update disabled status after rendering (#7172)
* fix: update disabled status after rendering

* fix: add test for json disabled
2023-06-15 15:31:40 -07:00
Christopher Allen
817ffab754 refactor(tests): Update bootstrap.js to better support generator chunks (#7171)
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.
2023-06-15 21:03:04 +01:00
Christopher Allen
2d97e5aaf1 refactor(build)!: Provide all generator exports when loaded as script (#7169)
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.
2023-06-15 16:52:51 +01:00
Christopher Allen
a3458871db refactor(generators)!: Pass this CodeGenerator to individual generator functions (#7168)
* 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
2023-06-14 23:25:36 +01:00
Christopher Allen
12b91ae49c chore(generators): Fix nits (#7166)
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.
2023-06-14 22:17:38 +01:00
Maribeth Bottorff
438df8761d fix: remove input type from number field (#7025)
* fix: use inputMode instead of type for number fields

* fix: remove input type and mode from number field
2023-06-14 09:36:52 -07:00
Christopher Allen
a11419d6b7 refactor(generators): Introduce LuaGenerator class, Order enum (#7161)
* refactor(generators): Introduce LuaGenerator class, Order enum

* refactor(generators): Use Order.* instead of .ORDER_*

* refactor(generators): Don't rename luaGenerator
2023-06-14 09:11:37 -07:00
Christopher Allen
eeb89194c4 refactor(generators): Introduce PhpGenerator class, Order enum (#7162)
* refactor(generators): Introduce PhpGenerator class, Order enum

* refactor(generators): Use Order.* instead of .ORDER_*

* refactor(generators): Don't rename phpGenerator
2023-06-14 09:09:52 -07:00
Christopher Allen
2f89c0dd09 refactor(generators): Introduce PythonGenerator class, Order enum (#7163)
* refactor(generators): Introduce PhpGenerator class, Order enum

* refactor(generators): Use Order.* instead of .ORDER_*

* refactor(generators): Don't rename pythonGenerator
2023-06-14 08:51:15 -07:00
Christopher Allen
26901654ea refactor(generators): Introduce DartGenerator class, Order enum (#7160)
* refactor(generators): Introduce DartGenerator class, Order enum

* refactor(generators): Use Order.* instead of .ORDER_*

* refactor(generators): Don't rename dartGenerator
2023-06-14 00:39:12 +01:00
Beka Westberg
aeee278767 fix: remove old icon handling code (#7141)
* fix: remove old icon handling code

* fix: remove calls to getCommentIcon

* chore: delete the old icon class
2023-06-13 15:41:07 -07:00
Beka Westberg
c6fbb85a69 Revert "chore!: remove angle field from core (#7155)" (#7158)
This reverts commit 0961aca4c8.
2023-06-13 15:25:41 -07:00
Beka Westberg
0961aca4c8 chore!: remove angle field from core (#7155)
* chore!: remove angle field from core

* chore: fix mocha failures
2023-06-13 15:09:15 -07:00