Commit Graph

1849 Commits

Author SHA1 Message Date
Aaron Dodson
b8f71b83b7 Merge branch 'rc/v12.0.0' into develop-v12-merge 2025-03-11 09:42:25 -07:00
Aaron Dodson
34da1da061 fix: Fix flaky connection checker test. (#8754) 2025-01-31 08:10:33 -08:00
Aaron Dodson
343c2f51f3 feat: Add support for toggling readonly mode. (#8750)
* feat: Add methods for toggling and inspecting the readonly state of a workspace.

* refactor: Use the new readonly setters/getters in place of checking the injection options.

* fix: Fix bug that allowed dragging blocks from a flyout onto a readonly workspace.

* feat: Toggle a `blocklyReadOnly` class when readonly status is changed.

* chore: Placate the linter.

* chore: Placate the compiler.
2025-01-30 13:47:36 -08:00
Ben Henning
94794af02f Merge branch 'develop' into improve-workspace-svg-test-robustness 2025-01-16 22:16:01 +00:00
Aaron Dodson
7a23c8878f fix: Actually fix the browser tests. (#8736) 2025-01-16 11:02:49 -08:00
Aaron Dodson
a86ba15154 fix: Fix the browser tests. (#8735) 2025-01-16 10:37:24 -08:00
Aaron Dodson
bcdb65c623 release: Merge branch 'develop' into rc/v12.0.0 2025-01-10 10:53:09 -08:00
Aaron Dodson
80a6d85c26 refactor!: Use JSON instead of XML for defining dynamic toolbox categories. (#8658)
* refactor!: Use JSON instead of XML for defining dynamic toolbox categories.

* chore: Fix tests.

* chore: Remove unused import.

* chore: Update docstrings.

* chore: Revert removal of XML-based category functions.

* chore: Add deprecation notices.
2025-01-08 11:50:18 -08:00
Aaron Dodson
77c695a648 fix: Paste blocks copied from a mutator into the mutator. (#8719) 2025-01-06 11:19:23 -08:00
Aaron Dodson
bd7c86a909 chore: Improve code health of generator tests. (#8703) 2025-01-06 10:55:57 -08:00
Aaron Dodson
b8bb26f8fd fix: Fix serialization of the lists_split block. (#8702) 2025-01-06 10:54:33 -08:00
Ben Henning
9283c4e6e8 Improve the robustness of workspace SVG tests.
This largely reduces the dependence on direct value testing and instead
updates clean-up tests to verify logic based on relative positioning.
This guards against potential system-specific flakes that can occur when
there are subtle calculation differences on different systems.
2024-12-06 00:33:58 +00:00
Aaron Dodson
9fcd5a3037 release: Merge branch 'rc/v11.2.0' into rc/v12.0.0 2024-12-04 12:06:12 -08:00
Christopher Allen
4680b4b5c1 test: Disable failing tests (#8677)
See issue #8676.
2024-12-04 09:30:22 -08:00
Aaron Dodson
24ab50d49d fix: Fix bug that caused text to be selected when long-pressing in the workspace on a touch device. (#8670)
* fix: Fix bug that caused text to be selected when long-pressing in the workspace on a touch device.

* chore: Fix test failure.
2024-12-03 13:41:32 -08:00
Aaron Dodson
5870c66cf0 chore: Migrate ESLint configuration file to new flat format. (#8675)
* chore: rename .eslintrc.js to eslint.config.js

* chore: Rename eslint.config.js to eslint.config.mjs.

* refactor: Migrate ESLint config to new flat format.

* chore: Remove old per-directory and global ignore ESLint config files.

* fix: Allowlist JSDoc tag aliases.

* fix: Don't require @license in tests/*.

* fix: Add NodeJS globals to several files that run under Node.

* chore: Remove now-unneeded ESLint directives in core.

* chore: Remove invalid/unneeded ESLint directives.

* fix: Fix invalid use of `await` outside of an `async` function.

* fix: Improve screenshot error message.

* fix: Update ESLint config file to not warn on existing violations.

* chore: Remove suppressions of rules that weren't triggering.

* chore: Fix package-lock.json.
2024-12-03 12:40:48 -08:00
Aaron Dodson
61bbd7dbf6 chore: Remove underscores from private fields. (#8682)
* chore: Remove underscores from private fields.

* refactor: Use public APIs in tests where possible.
2024-12-02 11:33:05 -08:00
Aaron Dodson
ae2a140141 refactor!: Use one map for toolbox contents. (#8654) 2024-11-12 09:52:23 -08:00
Aaron Dodson
d804c1a3c4 refactor!: Improve ability to use CSS to style Blockly. (#8647)
* refactor!: Rename blocklyTreeIconClosed to blocklyToolboxCategoryIconClosed.

* refactor!: Rename blocklyTreeLabel to blocklyToolboxCategoryLabel

* refactor!: Rename blocklyToolboxDiv to blocklyToolbox.

* refactor: remove unreferenced CSS classes.

* refactor!: Remove the blocklyArrowTop and blocklyArrowBottom classes.

* feat: Add a blocklyTextInputField class to text fields.
2024-11-07 12:16:17 -08:00
Aaron Dodson
2523093cc9 refactor!: Remove the InsertionMarkerManager. (#8649)
* refactor!: Remove the InsertionMarkerManager.

* chore: Remove unused imports.

* chore: Remove import of insertion marker manager test.
2024-11-07 12:15:55 -08:00
Aaron Dodson
aedcfd6da5 fix: Use a readonly textarea for non-editable comments. (#8632)
* fix: Use a readonly textarea for non-editable comments.

* chore: Run formatter.

* chore: remove old function definition
2024-11-04 09:43:17 -08:00
Aaron Dodson
e777086f16 refactor!: Update flyouts to use inflaters. (#8601)
* refactor: Update flyouts to use inflaters.

* fix: Specify an axis when creating flyout separators.

* chore: Remove unused import.

* chore: Fix tests.

* chore: Update documentation.

* chore: Improve code readability.

* refactor: Use null instead of undefined.
2024-10-02 09:20:45 -07:00
Aaron Dodson
e5c1a89cdf fix: Fix bug that caused fields in the flyout to use the main workspace's scale. (#8607)
* fix: Fix bug that caused fields in the flyout to use the main workspace's scale.

* chore: remove errant param in docs.
2024-10-02 08:18:47 -07:00
John Nesky
8d44a4d93a fix: Group field validator changes with field value changes. (#8589) 2024-09-24 16:09:41 -07:00
Ben Henning
05795a06ea Rename 'tidyUp' back to 'cleanUp'. 2024-09-03 23:13:50 +00:00
Ben Henning
fbafda3e4c Merge branch 'develop' into ensure-immovable-blocks-are-considered-during-workspace-tidying 2024-09-03 23:02:37 +00:00
Christopher Allen
2409123d66 refactor: Omit unused exception arguments from catch blocks (#8559)
Fixes #1770.
2024-09-03 15:27:40 +01:00
Christopher Allen
724828f689 refactor: Use arrow functions when calling Array.prototype.filter (#8557) 2024-08-30 17:23:23 +01:00
Christopher Allen
a7afda8343 fix(events): Simplify filter function, add new enqueueEvent function (#8539)
* docs(events): JSDoc improvments

* fix(filter): Introduce enqueueEvent; don't reorder in filter

  Remove the broken BlockChange event reordering code from filter.
  Instead, do necessary event reordering (correctly, this time)
  in a new enqueueEvent function used by fireInternal.

* chore(events): Deprecate forward parameter of filter

  Since we don't filter in undo any more, and filtering in reverse
  order causes problems, prepare to remove this opportunity for
  error.

* fix(events): Only merge adjacent events

  Simplify filter by having it consider only adjacent events in the
  queue for merging.

  Previously any events in the queue could potentially be merged if
  they were of suitable (typically identical) .type, even if other
  events had occurred between them (with the sole exception of
  BlockMove events, which would only be merged with adjacent
  events).  This could potentially result in replay failures during
  undo/redo/mirroring, though it is unknown whether any such
  problems occurred in practice.

* refactor(events): Tweaks

  - Use for…of loop where appropriate.
  - Make filter reason-merging code more concise.
  - Use arrow functions when calling Array.prototype.filter.

* chore(events): Fix typos for PR #8539.
2024-08-29 17:41:54 +01:00
John Nesky
095f29e274 fix: Detect if deleting shadow block affects selection highlight (#8533)
* fix: Detect if deleting shadow block affects selection highlight

* Use contains instead of descendsFrom for html consistency.

* Added tests.

* Removing and manually inlining new contains function.
2024-08-26 12:22:37 -07:00
Ben Henning
348a5b33b8 Addressed self-review comment. 2024-08-22 18:00:22 +00:00
Ben Henning
0413021b7c Auto-fix formatting issues to address CI failure. 2024-08-21 21:02:07 +00:00
Ben Henning
ca42a4b4fd Merge branch 'develop' into ensure-immovable-blocks-are-considered-during-workspace-tidying 2024-08-21 17:44:37 +00:00
Ben Henning
3a3e83fe44 Fix workspace clean up not considering immovables.
At a high-level, this change ensures that cleaning up a workspace
doesn't move blocks in a way that overlaps with immovable blocks. It
also adds missing testing coverage for both Rect (used for bounding box
calculations during workspace cleanup) and WorkspaceSvg (for verifying
the updated clean up functionality).

This also renames the clean up function to be 'tidyUp' since that better
suits what's happening (as opposed to other clean-up routines which are
actually deinitializing objects).
2024-08-21 17:41:38 +00:00
Christopher Allen
7ccdcc5cef refactor(events): introduce EventType enum in separate module (#8530)
* refactor(events): Use "export ... from" where applicable

* refactor(events): Introduce EventType enum

  Introduce an enum for the event .type values.  We can't actually
  use it as the type of the .type property on Abstract events,
  because we want to allow developers to add their own custom
  event types inheriting from this type, but at least this way we
  can be reasonably sure that all of our own event subclasses have
  distinct .type values—plus consistent use of enum syntax
  (EventType.TYPE_NAME) is probably good for readability overall.

  Put it in a separate module from the rest of events/utils.ts
  because it would be helpful if event utils could use

      event instanceof SomeEventType

  for type narrowing but but at the moment most events are in
  modules that depend on events/utils.ts for their .type
  constant, and although circular ESM dependencies should work
  in principle there are various restrictions and this
  particular circularity causes issues at the moment.

  A few of the event classes also depend on utils.ts for fire()
  or other functions, which will be harder to deal with, but at
  least this commit is win in terms of reducing the complexity
  of our dependencies, making most of the Abstract event subclass
  module dependent on type.ts, which has no imports, rather than
  on utils.ts which has multiple imports.
2024-08-20 08:36:33 +01:00
Christopher Allen
ce22f42868 chore: Organise imports (#8527)
* chore(deps): Add pretter-plugin-organize-imports

* chore: Remove insignificant blank lines in import sections

  Since prettier-plugin-organize-imports sorts imports within
  sections separated by blank lines, but preserves the section
  divisions, remove any blank lines that are not dividing imports
  into meaningful sections.

  Do not remove blank lines separating side-effect-only imports
  from main imports.

* chore: Remove unneded eslint-disable directives

* chore: Organise imports
2024-08-15 03:16:14 +01:00
abhinavjha0239
ec8f9c8589 chore: removed the whole Drag category from the browser test (#8478)
* fix: removed the whole Drag category from the blocks

* fix: added comment according to reviewer

* fix: added comment according to reviewer

* fix: added comment according to reviewer
2024-08-14 11:17:28 -07:00
dependabot[bot]
f57ef73aaf chore(deps): bump @typescript-eslint/eslint-plugin from 7.17.0 to 8.0.1 (#8479)
* chore(deps): bump @typescript-eslint/eslint-plugin from 7.17.0 to 8.0.1

Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 7.17.0 to 8.0.1.
- [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/v8.0.1/packages/eslint-plugin)

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

Signed-off-by: dependabot[bot] <support@github.com>

* fix: lint plugin versions

* chore: fix linting

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Beka Westberg <bwestberg@google.com>
2024-08-14 09:10:34 -07:00
John Nesky
cd31edbd9a fix: Update dev-tools and remove toolbox category tests Colour and Angles. (#8457) 2024-08-05 12:02:58 -07:00
dakshkanaujia
dc1f276759 fix!: Redundant blockly non selectable #8328 (#8433)
* Remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes

* Removed .gitpod file

* fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes https://github.com/google/blockly/issues/8328

* fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes #8328

* fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes #8328

* fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes #8328

* fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes #8328

* fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes
2024-07-30 08:24:15 -07:00
Aaron Dodson
82c7aad4e7 feat: Add a VarTypeChange event. (#8402)
* feat: Add a VarTypeChange event.

* chore: Update copyright date.

* refactor: Inline fields in the constructor.
2024-07-29 12:00:52 -07:00
Aaron Dodson
91892ac303 refactor: deprecate and clean up variable-related methods. (#8415)
* refactor: deprecate and clean up variable-related methods.

* chore: Add deprecation JSDoc.
2024-07-22 17:13:20 -07:00
Aaron Dodson
26e6d80e15 refactor: clean up VariableModel. (#8416) 2024-07-22 10:51:56 -07:00
John Nesky
40c6d9c490 fix: Enable blocks if user can't manually enable them. (#8354)
* fix: Enable blocks if user can't manually enable them.

* Only change the affected test method.
2024-07-22 09:21:51 -07:00
Aaron Dodson
21c0a7d999 refactor!: Use IVariableMap instead of VariableMap (#8401)
* refactor: use IVariableMap in place of VariableMap.

* refactor!: move variable deletion prompting out of VariableMap.

* chore: Remove unused imports.
2024-07-22 09:17:40 -07:00
Aaron Dodson
294ef74d1b refactor: Use IVariableModel instead of VariableModel. (#8400)
* refactor: Use IVariableModel methods instead of directly accessing properties.

* refactor: replace references to VariableModel with IVariableModel.
2024-07-19 14:58:04 -07:00
Aaron Dodson
02e64bebbe refactor: make VariableMap implement IVariableMap. (#8395)
* refactor: make VariableMap implement IVariableMap.

* chore: remove unused arrayUtils import.

* chore: fix comment on variable map backing store.

* chore: Added JSDoc to new VariableMap methods.

* chore: Improve test descriptions.
2024-07-19 10:53:16 -07:00
dependabot[bot]
8cad97a214 chore(deps): bump @hyperjump/json-schema from 1.6.7 to 1.9.3 (#8363)
* chore(deps): bump @hyperjump/json-schema from 1.6.7 to 1.9.3

  Bumps [@hyperjump/json-schema](https://github.com/hyperjump-io/json-schema) from 1.6.7 to 1.9.3.
  - [Commits](https://github.com/hyperjump-io/json-schema/compare/v1.6.7...v1.9.3)

  ---
  updated-dependencies:
  - dependency-name: "@hyperjump/json-schema"
    dependency-type: direct:development
    update-type: version-update:semver-minor
  ...

  Signed-off-by: dependabot[bot] <support@github.com>

* chore(deps): Add dev dependency on @hyperjump/browser

  @hyperjump/json-schema (v1.7.0 and later) depends upon
  @hyperjump/browser, but fails to declare it as a dependency,
  only listing it as a peer dependency, so said package must be
  installed separately.

* fix(tests): Use BASIC output as DETAILED is no longer supported

  See issue hyperjump-io/json-chema#68 for additional info.

* feat(tests): Add more informational output in case of test failure

  Since the BASIC output of the schema verifier is (slightly) less
  helpful than the old DETAILED output, add an additional output
  containing the first invalid path, e.g.:

      #/9.3.0/0/exports/textToDom/newModule

  in the results object returned by validate, since this is the
  most useful part of that info.

  Also use console.error and console.info instead of console.log
  where appropriate.

* chore(tests): Format

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
2024-07-19 11:22:07 +01:00
Abhinav Choudhary
ae2fea484f fix!: Rename blocklyTreeRow and blocklyToolboxCategory CSS classes (#8357)
* fix!: #8345 rename css class

This commit renames the blocklyTreeRow CSS class to blocklyToolboxCategory

* Update category.ts

* fix: css class conflicts

Rename original blocklyToolboxCategory to blocklyToolboxCategoryContainer
2024-07-16 11:00:32 -07:00
Aaron Dodson
989c91f626 feat!: Add support for preserving block comment locations. (#8231)
* feat: Add support for preserving block comment locations.

* chore: format the tests.
2024-06-27 11:11:45 -07:00