Commit Graph

4460 Commits

Author SHA1 Message Date
Aaron Dodson
6daa162a8c fix: Fix the browser tests. (#8735)
(cherry picked from commit a86ba15154)
2025-01-16 10:42:13 -08:00
Aaron Dodson
f166b677c0 fix: Fix bug that preventing scrolling menu items into view. (#8726)
* fix: Fix bug that preventing scrolling menu items into view.

* chore: Deprecate now-unused-in-core functions in style.

(cherry picked from commit 0c20129a26)
2025-01-15 09:03:35 -08:00
Aaron Dodson
2a36de148b fix: Listen for keyboard shortcuts when the widget or dropdown divs have focus. (#8731)
(cherry picked from commit f9ef78521e)
2025-01-15 09:03:35 -08:00
Mateus S. Pereira
7219800183 fix: workspace shifts when deleting a block (#8666)
* fix: workspace shifts when deleting a block

* fix: awaiting for block rerender

* fix: create reusable method to prevent marking method as async
2024-12-04 09:25:01 -08:00
echoooooo
eb79f667e2 fix: typo in comment (#8685) 2024-12-04 08:54:34 -08:00
Aaron Dodson
6118ffe8fc chore: Remove obsolete workaround for resize events on iPads. (#8669) 2024-12-03 14:48:41 -08:00
Aaron Dodson
43ebf20500 chore: Remove CSS targeting multiline input field. (#8684) 2024-12-03 14:17:09 -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
b73d6156a5 fix: Fix bug that caused comments to be incorrectly positioned. (#8668) 2024-11-21 11:28:27 -08:00
Aaron Dodson
9a7de53029 fix: Fix crash when resizing page while editing a field. (#8646)
* fix: Fix crash when resizing page while editing a field.

* refactor: Clean up positioning and exceptions.
2024-11-11 08:51:16 -08:00
Aaron Dodson
f1cbaab6ef refactor: Move functions into FieldDropdown. (#8634)
* refactor: Move functions into FieldDropdown.

* refactor: Make dropdown field image metrics static.

* refactor: Use template literals in FieldDropdown validator.
2024-11-08 14:21:16 -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
Richard Knoll
6a674002cc fix: clear touch identifier on comment icon down (#8627) 2024-10-28 13:05:31 -07:00
John Nesky
437f6a3d93 fix: bump initiator group in an orthogonal direction from neighboring group (#8613)
* fix: bump connected connections in a different direction

* Bump initiator block group in orthogonal direction.

* Revert the wording of a doc comment.

* Addressing PR feedback.
2024-10-25 11:37:55 -07:00
Christopher Allen
9cd58e325a refactor(shortcuts): Improve shortcut registry documentation & style (#8598)
* refactor(shortcuts): Improve shortcut registry documentation & style

  Make some minor refactorings of shortcut_registry.ts to improve
  readability and style, and add documentation for the
  KeyboardShortcut interface type.

* docs(shortcuts): Fix JSDoc typos etc. for PR #8598

* chore: Format
2024-10-02 12:30:19 +01:00
John Nesky
8d44a4d93a fix: Group field validator changes with field value changes. (#8589) 2024-09-24 16:09:41 -07:00
John Nesky
561b4189fb fix: Factor out workspace drag methods into utils. (#8566) 2024-09-13 12:53:37 -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
Rachel Fenichel
0a6596ce75 feat: mark some marker_svg properties protected instead of private (#8558) 2024-09-03 09:17:42 -07:00
Chang Min Bark
4d0fd5db79 fix(comments): added workspace comments and comment drag strategy isDeadOrDying() checks (#8532)
* fix: added id to rendered ws comments; made getCommentById public; added blocklyDraggable class to ws comments

* fix: added workspace comments and comment drag strategy isDeadOrDying checks

* chore: removed .idea files

* chore: formatted with prettier
2024-09-03 17:12: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
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
032b5ed9ea refactor(events): Introduce and use event type predicates (#8538)
* refactor(events): Introduce type predicates for event classes

  Introduce predicates for testing Abstract event subclasses based on
  their .type properties.  These are useful because there are places
  where it is not possible to use instanceof <ClassConstructor> tests
  for type narrowing due to load ordering issues that would be caused
  by the need to import (rather than just import type) the class
  constructors in question.

* refactor(events): Use event type predicates

  Simplify several sections of code by using type predicates for
  type narrowing and thereby avoiding the need for explicit casts.

* chore(events): Fix copyright date of recently-added files

* chore: Remove unused import
2024-08-20 19:50:29 +01:00
Christopher Allen
bde216d120 refactor(events): Don't filter events before undo (#8537)
Use of the filter function in Workspace.prototype.undo has caused
problems with repeated undo/redo (see issue #7026), the
originally-chosen fix for which was the addition (in PR #7069) of
code to fireNow to post-filter the .undoStack_ and .redoStack_ of
any workspace that had just been involved in dispatching events.

This apparently resolved the issue but added considerable
additional complexity and made it difficult to reason about how
events are processed for undo/redo.

Instead, since this filtering typically does nothing (at least
nothing desirable), simply don't re-filter events on the undo
stack before replaying them.
2024-08-20 08:39:37 +01: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
John Nesky
17e4f1c966 Fix: let workspace comment have delete cursor over trash. (#8477) 2024-08-15 11:41:22 -07: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
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
AbhinavKRNarayan
6b3f9a6723 fix(touch): prevent infinite loop on multi-touch drag (#8470)
* Change in gesture.ts

* prettier
2024-08-08 15:17:34 -07:00
Jeremiah Saunders
23e901120b feat: expose bringToFront() method (#8472)
* Remove internal from bringToFront JSDoc

* Add a note about the cost of this method

* Remove unnecessary colon
2024-08-07 09:07:48 -07:00
Jeremiah Saunders
f020b54fd0 fix: bring comments and bubbles to the front on click (#8451)
* Bring comment to the block layer when clicked

* Bring bubbles to front when clicked
2024-08-02 13:09:30 -07:00
John Nesky
e2310a4fed fix: Codify component weights with toolbox in front of flyouts. (#8432) 2024-07-29 10:30:29 -07:00
ℍ𝕠𝕝𝕝𝕠𝕨 𝕄𝕒𝕟
504de6a98c fix: drag strategy only clear group id set by us (#8355)
Add a condition check so that we don't unset
the group ID that is not set by us. Otherwise the
multi-select plugin undo/redo will be broken (apply
individually instead of all together)

Signed-off-by: Hollow Man <hollowman@opensuse.org>
2024-07-25 22:09:10 +01:00
Christopher Allen
ebb56b2ce8 docs(blocks): block.ts and blocks/* JSDoc / formatting / etc. cleanup (#8431)
* docs(block): Improve documentation for well-known block methods

  Improve the JSDocs for the declarations of well-known block
  methods:

  - getDeveloperVariables
  - compose
  - decompose
  - saveConnections

* docs(blocks): Improve block comments

  Fix JSDoc formatting in both core/block.ts and blocks/*, as well as
  making various other minor improvments.

* chore(blocks): Remove one unexported const
2024-07-25 17:25:24 +01: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
Chang Min Bark
4cdca28fe5 fix: added id to rendered ws comments; made getCommentById public; added blocklyDraggable class to ws comments (#8358) 2024-07-15 18:39:39 -07:00
Aaron Dodson
b0169ab724 fix: use the correct with in getBoundingRectangleWithoutChildren(). 2024-07-10 15:54:56 -07:00
Aaron Dodson
fa15cda950 feat: allow fetching block bounds not including children. (#8284)
* feat: allow fetching block bounds not including children.

* chore: run formatter.

* chore: run the other formatter.

* fix: don't include subsequent blocks in the childless bounding rect.

* chore: remove logging.
2024-07-10 14:52:07 -07:00
Aaron Dodson
8323642d0e fix: export the layer constants. (#8256)
* fix: export the layer constants.

* refactor: remove @internal annotations from layer constants.
2024-07-09 15:25:20 -07:00
Aaron Dodson
a6361fbd81 chore: make getEventWorkspace_() public (#8241) 2024-07-02 14:48:16 -07:00
Aaron Dodson
21a73c463f fix: correctly report the pre-resize-drag size to workspace comment size change listeners (#8240)
* fix: correctly report the pre-resize-drag size to workspace comment size change listeners

* chore: run formatter

* refactor: implicitly use the presence of preResizeSize to identify a drag.
2024-07-02 14:42:47 -07:00
John Nesky
9a0619aa2a fix: Drag and Resize events for workspace comments (#8217)
* feat: Added a comment_drag event.

* Add workspace comment resize events.

* Addressing PR feedback.

* Fixed chai imports in new test files.

* Addressing more PR feedback.
2024-06-26 12:16:56 -07:00
Maribeth Bottorff
3fa46f45fe chore: tsdoc for generator exceptions (#8214)
* chore: tsdoc for generator exceptions

* chore: missed a period
2024-06-13 17:07:24 -07:00