Commit Graph

69 Commits

Author SHA1 Message Date
Aaron Dodson
eeef2edf34 chore!: Fix warnings when generating docs. (#8660) 2025-01-06 10:53:45 -08:00
Aaron Dodson
389dd1a1cb chore: Post-merge fixits. 2024-12-04 12:15:19 -08:00
Aaron Dodson
9fcd5a3037 release: Merge branch 'rc/v11.2.0' into rc/v12.0.0 2024-12-04 12:06:12 -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
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
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
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
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
Beka Westberg
6e4ba00be5 fix: dragging and disposing of shadows (#8172)
* Revert "fix: dragging blocks by shadows to delete (#8138)"

This reverts commit 3fd749205f.

* fix: dragging shadows
2024-05-28 10:28:16 -07:00
Beka Westberg
3fd749205f fix: dragging blocks by shadows to delete (#8138)
* Revert "fix: dragging shadow blocks (#7992)"

This reverts commit c0e6e6745f.

* fix: dragging by shadow not being deletable

* fix: unselecting shadows

* fix: revert changes to select and unselect
2024-05-17 13:22:53 -07:00
John Nesky
cee7f916bb feat!: Invalid Blocks (#7958)
* feat: Invalid Blocks

* Rename the new json property from invalid to invalidReasons.

* Merged isValid into isEnabled.

* Minor fixes.

* More minor fixes.

* Reverting some stuff that didn't need to change.

* Addressing PR feedback.

* Update the BlockInfo interface to match State.

* Make BlockChange.disabledReason private.
2024-04-17 19:47:51 -07:00
Beka Westberg
abfbbbc299 fix!: various drag-adjacent interfaces (#7975)
* fix: ISelectable and IDeletable interfaces

* fix: switch everything over to use new draggable interface

* fix: exports
2024-03-29 21:00:56 +00:00
Christopher Allen
10ffcb706d release: Merge branch 'develop' into rc/v11.0.0 2024-03-18 19:57:04 +00:00
Beka Westberg
8821c83cc9 feat: allow overriding comment icons (#7937)
* feat: add comment icon interface

* feat: have blocks construct comment icons from registry

* chore: add tests for setCommentText

* fix: typeguard
2024-03-15 18:20:08 +00:00
Neil Fraser
0ecbcde9fc chore: Use .includes and .startsWith, not .indexOf (#7936)
Easier to read than the diverse collection of `=== 0` and `!== -1` and `> -1` tests.
2024-03-15 00:03:55 +01:00
Beka Westberg
a5126d1176 fix!: have disposing be true from start of dispose (#7891) 2024-03-13 09:23:11 -07:00
Beka Westberg
5db9b5bf11 fix: block initialization (#7777)
* fix: reorganize initialization

* chore: fix failing tests

* fix: tests

* chore: format

* chore: remove console trace
2024-01-23 08:48:08 -08:00
Beka Westberg
8c5f32b2f9 fix: bump neighbours performance regression (#7748)
* fix: move bumping neighbours to the end of rendering

* chore: remove scheduleSnapAndBump

* chore: remove references to bumpNeighbours

* chore: work on fixing tests

* fix: bump neighbours event grouping

* chore: format

* chore: readd deprecation import

* fix: move event ordering

* chore: undeprecate bumpNeighbours

* fix: bumping during drag due to insertion markers

* chore: tests

* chore: PR feedback

* chore: docs

* chore: typo
2024-01-23 08:48:08 -08:00
Beka Westberg
43f6df92a3 fix!: rendered meaning (#7747)
* fix: make rendered strictly for differentiating blocksvgs

* chore: fix references to rendered

* chore: fix tests

* chore: delete TODO
2024-01-23 08:48:08 -08:00
Cassidy
a2b895f7a9 fix: update setShadow TSDoc for Block and BlockSvg (#7639)
* fix: update setShadow TSDoc for Block and BlockSvg

* fix: Wrap comment lines at col 80

* fix: Corrected formatting with Prettier
2023-11-10 10:28:51 -08:00
Oscar
3a03f4d11b fix: block creation successful with undefined messages (#7591)
closes #7589

Signed-off-by: Oscar <71343264+0scvr@users.noreply.github.com>
2023-10-17 11:19:17 -07:00
Trey Pisano
6b023b3a32 fix: comment change event fires block change event (#7505)
* add fire event to comment change

* change variable names to make readable

* add oldtext field to commenticon

* remove debugger

* remove oldtext field

* add firing block change event to setText

* add fire to setText

* fix: setCommentText fire block change when icon removed

* remove whitespace

* NOT PASSING TESTS: fix block test fails

* fix: remove duplicate events so tests pass

* fix: remove whitespace

* fix: run format

* refactor: add early returns to onTextChange for readability

* remove console.log

* disable events temporarily when setText called in setCommentText

* refactor: move fire event to original position

* fix: run format

* fix: move fire event so it happpens after events are enabled and disabled
2023-10-02 13:14:12 -07:00
satya verma
4a6d4399d1 fix: incorrect blockchange firing (#7492)
* BlockChange event disabled

* BlockChange event disabled

* executed command (npm run format)
2023-09-21 05:34:24 -07:00
Beka Westberg
25d15fd596 fix: zelos full block fields rendering badly (#7490)
* fix: text input fields

* fix: colour field

* chore: cleanup override keywords

* chore: revert playground changes

* fix: applyColour not being called

* chore: swap visibility for display

* chore: cleanup for PR comments

* fix: PR comments
2023-09-14 22:22:40 +00:00
Christopher Allen
b0a7c004a9 refactor(build): Delete Closure Library (#7415)
* fix(build): Restore erroneously-deleted filter function

  This was deleted in PR #7406 as it was mainly being used to
  filter core/ vs. test/mocha/ deps into separate deps files -
  but it turns out also to be used for filtering error
  messages too.  Oops.

* refactor(tests): Migrate advanced compilation test to ES Modules

* refactor(build): Migrate main.js to TypeScript

  This turns out to be pretty straight forward, even if it would
  cause crashing if one actually tried to import this module
  instead of just feeding it to Closure Compiler.

* chore(build): Remove goog.declareModuleId calls

  Replace goog.declareModuleId calls with a comment recording the
  former module ID for posterity (or at least until we decide
  how to reformat the renamings file.

* chore(tests): Delete closure/goog/*

  For the moment we still need something to serve as base.js for
  the benefit of closure-make-deps, so we keep a vestigial
  base.js around, containing only the @provideGoog declaration.

* refactor(build): Remove vestigial base.js

  By changing slightly the command line arguments to
  closure-make-deps and closure-calculate-chunks the need to have
  any base.js is eliminated.

* chore: Typo fix for PR #7415
2023-08-31 00:24:47 +01:00
Beka Westberg
b4ce6afd2a feat: add doFullSerialization support to blocks (#7363)
* feat: add doFullSerialization support to blocks

* chore: PR comments
2023-08-16 09:30:13 -07:00
John Nesky
f246adbd26 feat: Parse newlines in JSON message as row separators. (#6944)
* feat: Parse message newlines as endOfRow dummies.

* Fix the multilineinput field test.

* Addressing PR feedback.

* Addressing PR feedback.

* Newline parsing now uses a new custom input.

* npm run format

* Added input_end_row to block factory.

* Addres feedback, fix endrow after external value.
2023-08-11 12:41:49 -07:00
Maribeth Bottorff
a0b565724b feat: make field initView and initModel more accessible (#7345)
* chore: update loop style to remove any type

* feat: make initView protected and initModel public

* feat: make image element in image field protected
2023-08-08 10:18:51 -07:00
dependabot[bot]
2546b01d70 chore(deps): Bump prettier from 2.8.8 to 3.0.0 (#7322)
* chore(deps): Bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

---
updated-dependencies:
- dependency-name: prettier
  dependency-type: direct:development
  update-type: version-update:semver-major
...

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

* chore: Reformat using Prettier v3.0 defaults

The main change is to add trailing commas to the last line of
block-formatted function calls.

---------

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>
2023-07-25 14:56:10 +00:00
Rachel Fenichel
55decfe7c9 chore: delete unused function getFirstStatementConnection (#7228) 2023-06-29 20:37:10 +00: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
0cfd388a5d feat: add types for accessing icons. (#7132)
* feat: add types for accessing icons.

* chore: PR comments
2023-06-13 14:39:36 -07:00
Beka Westberg
2f74ce822f fix!: refactor mutator icon (#7115)
* feat: add basic mutator icon

* feat: add actual mutation behavior to icon

* chore: add bumping blocks back into the bubble

* fix: add updating block styles

* feat: add static methods to mutator icon

* chore: delete old mutator code

* fix: use the new mutator icon

* chore: docs and format

* chore: my own comments

* chore: first pass at PR comments

* chore: make type strings internal

* chore: add todo

* chore: format

* chore: move properties to module level

* chore: fix using in demos

* chore: move Mutator to icons.MutatorIcon

* chore: move reconnect to connection

* chore: move findParentWs to workspace

* chore: properly override and call super

* chore: remove bubbleIsVisible check

* chore: change imports to import type

* chore: use elvis operator

* chore: update renamings

* chore: reduce changes to js block files
2023-06-02 12:18:41 -07:00
Beka Westberg
50d9474db5 fix!: refactor comment icon (#7128)
* fix: add basic comment icon

* fix: add using comment icon

* chore: delete old comment icon

* chore: add docs to the comment icon

* chore: move Comment to icons.CommentIcon

* chore: mode properties to module level

* chore: properly override and call super

* chore: remove .comment and .commentIcon_

* chore: cleanup test

* chore: deprecate getCommentIcon and getCommentText

* chore: change imports to import type

* chore: refactor code for paren peace

* chore: fix lint and make it error

* chore: remove change to block JS file

* chore: fix css

* chore: add renamings

* chore: format
2023-06-02 09:53:05 -07:00
Beka Westberg
f4e378d096 fix!: refactor warning icon (#7112)
* feat: add basic warning icon

* feat: work on actually using the warning icon

* chore: add docs

* chore: delete old warning icon

* chore: fix build

* chore: my own comments

* chore: move Warning to icons.WarningIcon

* chore: move properties to the module level

* chore: properly override and call super

* chore: properly use optional chaining

* chore: fixup comment typo

* chore: change imports to import type

* chore: reduces changes in block js files

* chore: add renaming
2023-06-02 09:34:34 -07:00
Beka Westberg
91be84ab7c fix!: move destroy earlier in the lifcycle (#7117) 2023-06-01 05:25:31 -07:00
Beka Westberg
473a5ab7b1 fix: have inputs construct connections (#7116)
* fix: have inputs construct connections

* chore: fix build hopefully

* fix: PR comments
2023-05-24 13:50:06 -07:00
Beka Westberg
42b8c6e3ab fix: return annotations (#7118)
* chore: remove suppress annotations

* chore: remove fileoverview annotation

* chore: remove other unused annotations

* chore: change return to returns

* chore: enable tag linting
2023-05-24 13:01:33 -07:00
Beka Westberg
8b0c40bb1b feat: add implementations for adding, removing, and getting icons (#7059)
* feat: add implementations for adding, removing, and getting icons

* chore: fix tests

* chore: switch order of adding icons

* chore: create duplicate icon error

* chore: un-only test
2023-05-11 15:48:01 -07:00
Maribeth Bottorff
88ff901a72 chore: use prettier instead of clang-format (#7014)
* chore: add and configure prettier

* chore: remove clang-format

* chore: remove clang-format config

* chore: lint additional ts files

* chore: fix lint errors in blocks

* chore: add prettier-ignore where needed

* chore: ignore js blocks when formatting

* chore: fix playground html syntax

* chore: fix yaml spacing from merge

* chore: convert text blocks to use arrow functions

* chore: format everything with prettier

* chore: fix lint unused imports in blocks
2023-05-10 16:01:39 -07:00
Beka Westberg
3a9a9bd24e feat: break input types into separate classes (#7019)
* chore: move input and input types into new directory

* feat: define and export new input types

* feat: modify blocks to construct individual inputs

* chore: transition code to use actual type checks

* chore: fixup input type type

* chore: format

* chore: fixup PR comments

* chore: fix build
2023-05-04 08:50:45 -07:00
Neil Fraser
64aa3e7df4 feat: Add 'reason' field to move event (#6996)
* feat: Add 'reason' field to move event

There are many types of move.  This addition allows one to detect what the reason for each move is.

* Clang formatting.

And unsaved editor tabs.

* Change reason string to array.
2023-04-26 00:22:10 +02:00
Beka Westberg
d726080eaa feat: add support for appending custom inputs (#6990)
* feat: add appendInput method

* feat: enable constructing inputs from the registry

* chore: reorganize into suites

* chore: add new input test + fixup existing

* chore: reorganize appending from registry

* chore: fix input types enum

* chore: fix tests
2023-04-21 15:58:42 -07:00
Neil Fraser
6f64d1801a fix: Don't clober event group when renaming vars (#6829)
* fix: Don't clober event group when renaming vars

Also audit all existing event group commands and tweak a few of them where I think there's a potential issue.
2023-03-17 12:09:51 -07:00
Beka Westberg
670f7da802 fix: dispose performance (#6894)
* fix: improve dispose performance

* chore: cleanup dispose functions

* chore: split dispose into dispose and disposeInternal

* chore: remove unnecessary node removal

* fix: remove unnecessary unbinding of event listeners

* fix: readd skipping event construction

* chore: work on fixing tests

* chore: fix remaining test failures

* chore: format

* chore: typo

* fix: first pass of PR comments

* chore: remove TODO
2023-03-16 15:28:25 -07:00
Beka Westberg
66fd055a83 fix: toString performance (#6896)
* fix: performance of reducing

* chore: remove AST from toString

* chore: format

* chore: fix build

* chore: readd comment
2023-03-15 13:12:36 -07:00
Aaron Dodson
8a44dff4e8 refactor: Remove more uses of AnyDuringMigration (#6863)
* refactor: Remove uses of AnyDuringMigration from xml.ts.

* refactor: Remove uses of AnyDuringMigration from block_svg.ts.

* refactor: Remove uses of AnyDuringMigration from theme_manager.ts.

* refactor: Remove uses of AnyDuringMigration from names.ts.

* refactor: Remove uses of AnyDuringMigration from field_angle.ts.

* refactor: Remove some uses of AnyDuringMigration from block.ts.

* refactor: Make safename construction more readable.

* fix: Use a default size for block comments.

* fix: Clarify test of shadow block disposal.

* fix: Update assert in workspace_svg_test to use isDeadOrDying().
2023-02-28 14:38:17 -08:00
Beka Westberg
4d16584266 fix: serializing disabled interactions (#6847)
* feat: add own property getters for disabled interactions

* feat: add serialization of disabled attributes
2023-02-19 08:18:43 -08:00