Commit Graph

4711 Commits

Author SHA1 Message Date
Aaron Dodson
14c9b1abcb chore: remove obsolete comment. (#8606) 2024-10-02 09:52:16 -07: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
Aaron Dodson
a4b522781c fix: Fix bug that prevented dismissing the widgetdiv in a mutator workspace. (#8600)
* fix: Fix bug that prevented dismissing the widgetdiv in a mutator workspace.

* fix: Check if the correct workspace is null.

* fix: Remove errant this.
2024-10-02 08:18:21 -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
Aaron Dodson
ec5b6e7f71 feat: Add a BlockFlyoutInflater class. (#8591)
* feat: Add a BlockFlyoutInflater class.

* fix: Fix the capacity filter callback argument name.

* fix: Fix addBlockListeners comment.

* chore: Add license.

* chore: Add TSDoc.

* refactor: Make capacity filtering a normal method.

* fix: Bind flyout filter to `this`.
2024-09-27 14:12:59 -07:00
Aaron Dodson
bdc43bd0f7 feat: Add support for inflating flyout separators. (#8592)
* feat: Add support for inflating flyout separators.

* chore: Add license.

* chore: Add TSDoc.

* refactor: Allow specifying an axis for flyout separators.
2024-09-27 13:23:56 -07:00
Aaron Dodson
489aded31d feat: Add inflaters for flyout labels and buttons. (#8593)
* feat: Add inflaters for flyout labels and buttons.

* chore: Temporarily re-add createDom().

* chore: fix JSDoc.

* chore: Add license.

* chore: Add TSDoc.
2024-09-27 13:22:36 -07:00
Aaron Dodson
6ec1bc5ba5 feat: Add the IFlyoutInflater interface. (#8581)
* feat: Add the IFlyoutInflater interface.

* fix: Add a return type for IFlyoutInflater.disposeElement().

* refactor: Add the gapForElement method.
2024-09-25 10:23:25 -07:00
John Nesky
8d44a4d93a fix: Group field validator changes with field value changes. (#8589) 2024-09-24 16:09:41 -07:00
Aaron Dodson
c79610cea6 refactor: remove redundant flyout positioning. (#8573)
* refactor: remove redundant flyout positioning.

* fix: handle the case where there is a flyout without a toolbox
2024-09-18 11:58:39 -07:00
Aaron Dodson
476d454c05 fix: include potential variables in variable dropdowns in the flyout (#8574) 2024-09-16 09:14:56 -07:00
John Nesky
561b4189fb fix: Factor out workspace drag methods into utils. (#8566) 2024-09-13 12:53:37 -07:00
Aaron Dodson
732bd7f616 fix: size text with computed styles even when hidden (#8572)
* fix: size text with computed styles even when hidden

* refactor: remove unneeded try/catch.
2024-09-13 09:58:57 -07:00
Aaron Dodson
def80b3f31 fix: improve flyout performance (#8571)
* fix: improve flyout performance

* refactor: don't call position() in show()

The later call to reflow() itself winds up calling position(), so this calculation is redundant.
2024-09-11 12:37:32 -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
Aaron Dodson
cb1c055bff refactor: use getters for flyout width and height. (#8564) 2024-09-03 13:25:18 -07: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
Aaron Dodson
ba0762348d fix: display the correct variable reference count when deleting a variable. (#8549) 2024-08-21 13:57:32 -07: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
Arun Chandran
d6125d4fb9 fix!: Remove the blocklyMenuItemHighlight CSS class and use the hover (#8536)
* fix!: Remove the blocklyMenuItemHighlight CSS class and use the hover

* fix: Remove setHighlighted method in menuitem

* fix: Remove blocklymenuitemhighlight css class
2024-08-21 09:01:07 -07: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
Aaron Dodson
14d119b204 fix: improve prompting when deleting variables (#8529)
* fix: improve variable deletion behaviors.

* fix: don't prompt about deletion of only 1 variable block when triggered programmatically.

* fix: include the triggering block in the count of referencing blocks

* fix: only count the triggering block as a referencing block if it's not in the flyout
2024-08-19 15:47:00 -07: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
Shreshtha Sharma
64fd9ad89a feat: added blocklyHighlighted CSS class to highlighted block's root… (#8407)
* fix: added 'blocklyHighlighted' CSS class to highlighted block's root svg

* fix: added 'blocklyHighlighted' CSS class to highlighted block's root svg

* fix: added 'blocklyHighlighted' CSS class to highlighted block's root svg

* fix: added 'blocklyHighlighted' CSS class to highlighted block's root svg

* fix: added 'blocklyHighlighted' CSS class to highlighted block's root svg
2024-08-14 09:06:27 -07:00
Jeremiah Saunders
731fb40faa feat: implement WorkspaceSvg class manipulation (#8473)
* Implement addClass and removeClass functions

* feat: implement `WorkspaceSvg` class manipulation

* Update core/workspace_svg.ts

* Update core/workspace_svg.ts
2024-08-13 11:14:05 -07:00
Adityajaiswal03
59fab944f4 feat: change blocklyEditableText to blocklyEditableField and blocklyNonEditableText to blocklyNonEditableField BREAKING CHANGE: The blocklyEditableText and blocklyNonEditableText identifiers have been renamed to blocklyEditableField and blocklyNonEditableField respectively. This change may require updates to any existing code that references the old identifiers. (#8475) 2024-08-12 13:10:38 -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
aishwaryavenkatesan
68dda11623 fix!: deleted styles without associated classes from css.ts, issue #8285 (#8465) 2024-08-07 09:07:34 -07:00
Shreshtha Sharma
9374c028d4 feat: added block's style as a CSS class to block's root SVG (#8436)
* fix: added block's style as a CSS class to block's root SVG

* fix: added block's style as a CSS class to block's root SVG

* fix: added block's style as a CSS class to block's root SVG
2024-08-06 09:35:35 -07:00
omwagh28
f10c3b0ee8 fix!: Renamed the blocklyTreeSelected CSS class to blocklyToolboxSelected https://github.com/google/blockly/issues/8351 (#8459) 2024-08-06 09:26:05 -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
Aaron Dodson
6887940e22 feat: add a method for subclasses of FieldVariable to get the default type. (#8453) 2024-08-02 10:57:15 -07:00
Aayush Khopade
8a1b01568e feat: Add a blocklyNumberField CSS class to number fields (#8414)
* feat: Add a blocklyNumberField CSS class to number fields https://github.com/google/blockly/issues/8313

* feat: add 'blocklyNumberField' CSS class to FieldNumber Fixes https://github.com/google/blockly/issues/8313
2024-07-31 15:34:14 -07:00
UtkershBasnet
17db6039b5 fix!: Rename blocklyTreeIconOpen to blocklyToolboxCategoryIconOpen (#8440) 2024-07-31 15:33:25 -07:00
surajguduru
6393ab39ce feat: add blocklyLabelField CSS class to label fields (#8423) 2024-07-30 18:26:17 -07:00
Tejas Ghatule
203e422977 feat: add the block's type as a CSS class to the block's root SVG (#8428)
* feat: Added the block's type as a CSS class to the block's root SVG https://github.com/google/blockly/issues/8268

* fix: Added the block type as a CSS class to the blocks root SVG https://github.com/google/blockly/issues/8268
2024-07-30 18:12:48 -07:00
Shreshtha Sharma
9c88970d46 feat: added blocklyNotDetetable class to block_svg (#8406)
* feat: added blocklynotdetetable class to block_svg

* feat: added blocklynotdetetable class to block_svg
2024-07-31 00:50:38 +01:00