Commit Graph

1539 Commits

Author SHA1 Message Date
Maribeth Bottorff
8e1890a93c fix: allow splicing into shadow block stacks (#6939)
* fix: allow splicing into shadow block stacks

* chore: format

(cherry picked from commit 69afe5b60f)
2023-03-30 20:44:40 +00:00
Beka Westberg
9328eebd73 chore: Update metadata for 2023 Q1 release (#6933) 2023-03-29 10:10:11 -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
c2919c51bd fix: improve performance of connecting blocks (#6876)
* fix: early return from updateDisabled if it is noop

* chore: trigger connect and disconnect before hiding

* chore: remove disconnectInternal

* fix: skip setting parent when disconnecting before connecting

* chore: fixup docs

* chore: remove erroneous test

* fix: add delay to context menu callback.

Improve INP by allowing the browser to do a paint (closing the context
menu) before we trigger callbacks. This improves the user experience
for expensive callbacks (e.g. collapsing, or updating disabled).

* fix: rendering bug

When disconnecting the last block in the stack, the block would not be
rerendered correctly (the top-start corner would not be reshaped)

* fix: connecting bug

The order for applying connections was changed so that connections were
applied and then the insertion marker was hidden. This caused an error
because hiding the insertion marker expected there to be a child block
when there was not.

* chore: remove setParent param from public API

* chore: tsdoc
2023-03-16 13:40:33 -07:00
Neil Fraser
42fde0f81b chore: Reduce delta on ports to blockly-samples (#6886)
* Reduce usage of obsolete .keyCode property.
* Rename private properties/methods which violate eslint rules.
* Use arrays of bound events rather than individual properties.
* Improve typing info.
* Also fix O(n^2) recursive performance issue in theme's getComponentStyle function.
* And replace String(...) with '${...}' (smaller, faster).
* .toString() is considered harmful.
2023-03-15 13:28:57 -07:00
Aaron Dodson
17064a1c39 chore: Remove various IE hacks and workarounds (#6781)
* chore: Remove IE-specific hacks from flyout_base.ts.

* chore: Remove IE hacks from workspace_svg.ts.

* chore: Remove IE hacks from css.ts.

* chore: Remove IE hacks from xml.ts.

* chore: Remove IE hacks from grid.ts.

* chore: Remove errant logging from flyout_base.ts.

* chore: Remove obsolete comments about IE from bootstrap.js.

* chore: Remove reference to IE from README.

* chore: Clean up trailing spaces in bootstrap.js.
2023-03-14 11:26:38 -07:00
Beka Westberg
9236b4e207 fix: improve performance of modifying block shape (#6884) 2023-03-13 08:55:00 -07:00
Beka Westberg
c0934216f8 fix: creating duplicate params via renaming vars (#6885)
* feat: add IVariableHolder

* chore: reorganize variable prompts to early return

* fix: add retriggering prompt for conflicting params

* chore: add unit tests

* chore: fix build

* chore: reorganize checking for param conflicts

* fix: visibility

* chore: rename variable holder interface

* chore: fix typo

* chore: fix lint
2023-03-09 06:00:48 -08:00
Beka Westberg
5cae074431 fix: improve collapse / uncollapse performance (#6860)
* feat: enable render queueing for collapse-related things

* chore: delay bumping

* chore: fixup tests
2023-03-08 06:03:20 -08: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
c9e2af2a27 fix: variable events not deserializing properly (#6832) 2023-02-27 10:43:19 -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
Blake Thomas Williams
13fe6eeccf feat: added tests/typescript to test supported TS examples (#6775)
* feat: added `tests/typescript` to test supported TS examples

* fix: update the test name, description, and output

* chore: remove unused imports in `test_tasks.js`

* fix: wrap README line at 80 characters

* fix: implemented `different_user_input.ts` feedback

* fix: correct mistaken comments

* chore: rename `./eslintrc.json` to `./eslintrc.js`

* feat: added linting for tests/typescript

* chore: cleanup eslintrc lines over 80 characters

* fix: updated `.eslintrc.js` to provide an override for linting itself

* fix: updated tests to build to the `build` directory

* feat: updated `gulp format` to handle formatting `.eslintrc.js`

* fix: updated `.eslintrc.js` to align with both formatter and linter

* fix: updated config comment wording

* fix: removed quotes for valid identifiers

* Revert "fix: removed quotes for valid identifiers"

  This reverts commit 03eff91aea1468e503bc79a90fb139914d3f39d2.
2023-02-10 17:12:18 +00:00
Beka Westberg
8386024e44 chore: fix isNameUsed not fully respecting the procedure map (#6833)
* chore: fix isNameUsed not fully respecting the procedure map

* chore: add tests that isNameUsed respects the procedure map
2023-02-08 09:12:23 -08:00
Christopher Allen
d83dcfbe2e chore(build,tests): Remove obsolete kludges / config options (#6835)
* chore(tests): Remove circular import loading issue kludge

  Prior to PR #6818, circular imports resulted in the debug module
  loader (in closure/goog/base.js) failing to record the
  goog.module ID of most modules that were
  involved in the cycle, and in particular of the Blockly.Xml
  module.  This had secondary fallout that resulted
  in library blocks modules being loaded in the wrong order.

  A kludge was introduced in PR #6703 that worked around this
  problem by making sure that window.Blockly was set, allowing
  the modules loaded out-of-order to still work.

  Now that we have removed all remaining circular dependencies
  there is no need for the kludge, since all module IDs are
  properly recorded and modules are loaded in the correct order.

* chore(build): Remove exclude for non-existent core/blockly.js

  There was a transitional period where we had both
  core/blockly.ts and core/blockly.js, and wished to exclude
  the latter from tsc's input, but the latter file was deleted
  (and inadvertently restored, then re-deleted) some time ago.
2023-02-08 11:56:35 +01:00
Christopher Allen
167e26521c refactor: Remove last remaining circular import in core/ (#6818)
* refactor(xml): Move textToDom to core/utils/xml.ts

  This function being in core/xml.ts was the cause for the last
  remaining circular import in core/ (between variables.ts and
  xml.ts).

  Moving it to utils/xml.ts makes sense anyway, since there is
  nothing Blockly-specific about this function.

  Fixes #6817.

* fix(closure): Reenable goog.declareModuleId multiple-call check

  Reenable an assertion which check to make sure that
  goog.declareModuleId is not called more than once in a module
  (and which also catches circular imports amongst ES modules, which
  are not detected by closure-make-deps).

* chore(tests,demos): Augo-migrate use of textToDom

  Testing the migration file entry by auto-migrating all uses of
  Blockly.Xml.textToDom to Blockly.utils.xml.textToDom.

* chore(blocks): Manually migrate remaining use of textToDom

  Update the one remaining call to textToDom (in blocks/lists.ts)
  to the function's new location - also removing the last use of
  the Blockly.Xml / core/xml.ts) module from this file.

* docs(xml): Remove unneeded @alias per comments on PR #6818

* fix(imports): Remove unused import
2023-02-07 12:11:11 +00:00
Christopher Allen
d808c068d2 fix(tests): Use build/msg/en.js instead of msg/messages.js (#6825)
This change had already been made (by PR #6475 amongst other) to
most of the tests, but there were a couple of stragglers that
still mentioned messages.js.

Fixes #6824.
2023-02-07 10:25:13 +00:00
Rachel Fenichel
1d1a927628 chore: remove alias comments (#6816)
* chore: remove alias comments

* chore: format

* chore: remove extra newlines

* chore: fix bad replaces
2023-02-06 10:08:55 -08:00
Maribeth Bottorff
a96eec8a70 fix: don't splice into unmovable stacks (#6800)
* fix: don't splice into unmovable stacks

* chore: fix the tests and comments

* chore: format

* chore: clean up xml

* chore: use test row blocks
2023-02-03 14:44:53 -08:00
Aaron Dodson
299016e78d chore: Remove some more uses of AnyDuringMigration (#6785)
* chore: Remove uses of AnyDuringMigration in workspace_comment_svg.ts.

* chore: Remove uses of AnyDuringMigration in toolbox.ts.

* chore: Remove uses of AnyDuringMigration in field_colour.ts.

* chore: Remove uses of AnyDuringMigration from field_image.ts.

* chore: Remove uses of AnyDuringMigration from workspace.ts.

* Update core/workspace_comment_svg.ts

Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>

* chore: Remove uses of AnyDuringMigration in collapsible_category.ts.

* chore: Revert unary - change to make clang-format happy.

* chore: Remove unnecessary quotes in toolbox.ts.

* Update core/workspace_comment_svg.ts

Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>

---------

Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
2023-02-03 08:03:31 -08:00
Aaron Dodson
c1b2ddb96f feat: Add support for centering on a block itself vs its stack. (#6810)
* feat: Add support for centering on a block itself vs its stack.

* fix: Make centerOnBlock test actually call it.
2023-02-01 14:46:28 -08:00
Christopher Allen
a7f498a6a0 fix(build): Fix event tests, improve buildDeps (#6773)
* fix(tests): Fix errors in event tests
  - Fix actual syntax errors in imports in event_marker_move_test.js
    and event_selected.test.js, which were preventing those tests from
    being run.
  - Remove suite.only directives in those tests that would prevent
    all the other tests from running.

* refactor(build): Improve buildDeps

  - Run closure-make-deps only once, instead of separately for core/
    and tests/.

  - Specify a larger exec maxBuffer size, to ensure output and
    diagnostics are not truncated.

  - Change stderr filtering in buildDeps to filter out bounded
    generics messages and blank lines.

  - Attempt to suppress warnings in stderr output when
    closure-make-deps returns a non-zero exit code.

    Unfortunately, there seems to be a race condition which usually
    the stderr argument to the exec callback not to contain the
    complete output, so in that case print a helpful message.

  - Have buildDeps just return a Promise instead of using a callback.

* fix(docs): Typo fix in JSDoc for log helper
2023-01-26 20:09:19 +00:00
Beka Westberg
75963ea58e chore: clean up leftover procedure-related things in core (#6797)
* chore: remove triggering updates

* chore: export isObservable

* chore: move the observable procedure model out of its own directory
2023-01-26 09:54:49 -08:00
Beka Westberg
5bbb39972a chore: delete procedure data models (#6796)
* chore: delete procedure data models

* chore: remove and fix procedure model related tests
2023-01-26 09:35:08 -08:00
Beka Westberg
da9ae8f472 chore: revert procedure events (#6795)
* chore: delete procedure events

* chore: delete event related tests
2023-01-26 09:25:42 -08:00
Beka Westberg
e4d7c381bc chore: revert changes to procedure blocks (#6794)
* chore: revert procedure blocks

* chore: fix tests
2023-01-26 09:21:54 -08:00
Aaron Dodson
e89fcea02c fix: Make metadata tests more resilient. (#6771)
* fix: Make metadata tests more resilient.

* fix: improve control flow and clarify xargs purpose.
2023-01-17 08:32:05 -08:00
Maribeth Bottorff
59c7cb941b fix: Increase generator test timeout (#6776) 2023-01-17 16:17:46 +00:00
Beka Westberg
3cf0663847 fix: copying and pasting procedure definitions (#6747)
* fix: copy-pasting procedure definitions

* chore: add test for loading two procedure defs
2023-01-12 12:54:51 -08:00
Beka Westberg
32c7585cd7 fix: proc json serialization (#6746)
* fix: params not being rendered when loading from JSON

* chore: fix tests
2023-01-11 16:55:06 -08:00
Beka Westberg
902c30948a chore: refactor procedures namespace (#6745)
* chore: refactor procedures namespace

* fix: getCallers

* chore: add inline docs
2023-01-11 07:45:14 -08:00
Beka Westberg
8978f573d3 chore: delete old proc data code (#6736)
* chore: refactor getVars and getVarModels

* chore: cleanup renaming procedures

* fix: updating params in mutator

* chore: remove dead visual update code

* chore: fix test assertions

* chore: move context menu to use procedure model

* fix: renaming early parameters not applying

* chore: remove data update code

* chore: remove references to argumnets from caller serialization

* chore: remove extraneous visual update code

* chore: remove delete event listener

* chore: remove last unused data attributes

* fix: creating procedure defs with params from callers

* chore: format

* chore: cleanup from rebase

* chore: format

* chore: remove logs

* chore: fix PR comments

* chore: cleanup

* chore: make hasReturn_ private
2023-01-09 16:22:24 -08:00
Samriddhi
5dbcaeb4e2 fix: change assertFieldValue in test helpers to use deepEqual (#6739) 2023-01-09 09:51:13 -08:00
Christopher Allen
f1e5f22423 chore(tests): Enable testing on node.js v18.x on GitHub CI (#6619)
* chore(tests): Enable testing on node.js v18.x on GitHub CI

* chore(tests): Remove outdated calls to test:prepare npm script

The calls to `npm run test:prepare` in `tests/scripts/setup_*_env.sh`
should have been removed along with that npm script in PR #4906.

* chore(deps): Fix alphabetisation in package.json
2023-01-09 09:57:12 +00:00
Beka Westberg
d27f7c81b4 fix: undoing and redoing deleting procedures (#6722)
* fix: undoing and redoing deleting procedure defs

* chore: added tests for undoing and redoing procedure def deletes

* fix: dragging blocks from flyout

* chore: PR comments

* chore: fixup from rebase
2023-01-06 16:02:45 -08:00
Beka Westberg
23fb76b9f2 fix: undoing and redoing parameter events (#6721)
* fix: undoing and redoing parameters creating dupe parameters

* chore: add tests for undoing and redoing adding parameters

* fix: undoing and redoing renaming parameters

* chore: change tests to tick clock

* chore: format

* chore: add tests for deleting procedure parameters

* chore: fix tests

* chore: unskip tests

* chore: fix return type of saveExtraState

* chore: increase mocha timeout
2023-01-06 15:32:04 -08:00
Beka Westberg
e1995ae3b0 feat: procedure callers respond to models (#6718)
* chore: add test for reconnecting procedure input blocks

* feat: add caller blocks responding to updates

* chore: format

* chore: add test for deserializing callers before defs

* chore: format
2023-01-06 09:55:36 -08:00
Beka Westberg
dee3951541 feat: procedure defs deserialize models (#6706)
* feat: add procedure defs deserializing models

* chore: rename model to model_

* chore: cleanup

* chore: fix tests failures

* fix: PR comments
2023-01-05 15:19:17 -08:00
Beka Westberg
faf5a08c90 feat: procedure def blocks respond to models (#6673)
* feat: make procedure def blocks respond to model updates

* chore: format

* chore: unskip tests
2023-01-05 15:11:37 -08:00
Beka Westberg
5d20b62339 feat: procedure blocks update models (#6672)
* feat: procedure blocks have models

* feat: add updating the name of the model

* feat: add procedure defs updating the model enabled state

* feat: add procedure blocks updating parameters in the model

* fix: add disposing of the procedure model

* chore: updates test to check for identity of parameters

* chore: move statement handling into setStatement

* fix: make parameter IDs consistent

* chore: un-only tests

* chore: fixup tests

* chore: revert validator to use Procedures.rename

* chore: cleanup typo
2023-01-05 14:31:20 -08:00
Beka Westberg
863c985928 chore(tests): procedure blocks (#6670)
* chore: sketch out necessary test cases

* chore: add tests for updating the data models

* chore: outline more response tests

* chore: add tests for updating procedure def blocks based on models

* chore: add tests for updating procedure callers based on procedure model updates

* chore: add tests for renaming procedures

* chore: add tests for adding procedure parameters

* chore: add tests for renaming procedure parameters

* chore: add tests for reordering procedure parameters

* chore: add tests for enabling and disabling procedures

* chore: add tests for deleting procedure def

* chore: fixup tests that we accidentally broke

* chore: format
2022-12-19 15:18:55 -08:00
Christopher Allen
e4f42aa8fa chore(tests): Update metadata for 2022 Q4 release (#6710) 2022-12-15 17:50:52 +00:00
Beka Westberg
658e14ff75 fix: not being able to set field values to empty (#6702) 2022-12-14 17:08:15 -08:00
Christopher Allen
3be3d4a6ff chore: miscellaneous fixes to docs, style, and tests (#6705)
* docs(icon): Better description for Icon.prototype.setVisible

  Also tweak description of getBlock.

* docs(blocks): Fix typo in description of BlockDefinition

* chore(tests): Factor out common goog:chromeOptions

* chore(build): Minor style fixes
2022-12-14 23:48:12 +00:00
Christopher Allen
f528eccba7 fix(tests): Fix bootstrapping of generators in compressed mode (#6703)
Previously we had code that would, in uncompiled mode, make sure
that javascriptGenerator etc. were set to the corresponding module
exports object (by fetching it with goog.module.get), but in
compressed mode we made no effort to set (e.g.) javascriptGenerator
to Blockly.JavaScript, which is where that export actually appears
in the namespace tree when loading the chunk via a <script> tag.

This commit introduces two new configuration options to bootstrap.js
(preconfigured with defaults that should work in most cases) mapping
global variable names to their corresponding module identifiers, and
modifies the code in bootstrap_helper.js to set global variables
appropriately in both uncompressed and compressed modes.
2022-12-14 19:47:27 +00:00
Beka Westberg
d6230b2a44 feat: procedure event serialization (#6669)
* feat: add serialization to procedure base event

* feat: add serialization to procedure change return event

* feat: add serialization to procedure create event

* feat: add serialization of the procedure delete event

* feat: add serialization of procedure enable events

* feat: add serialization of procedure parameter create events

* feat: add serialization of the parameter delete event

* feat: add serialization of procedure parameter rename events

* feat: add serialization for procedure rename events
2022-12-09 10:30:39 -08:00
Beka Westberg
0ea319c4c3 feat: add destroy lifecycle hook to blocks (#6678)
* chore: move healing tests

* chore: add tests for calling destroy

* feat: add calling the destroy callback

* chore: cleanup reversions

* chore: fixup type of destroy
2022-12-05 14:39:07 -08:00
Aaron Dodson
90cb965e7c refactor: Migrate to PointerEvents (#6598)
* refactor: Remove checks for PointerEvent support.

* refactor: Deprecate and remove calls to splitEventByTouches.

* refactor: Deprecate and remove calls to setClientFromTouch().

* refactor: Use PointerEvent in place of Event/MouseEvent/TouchEvent/PseudoEvent.

* refactor: Update references to mouse/touch events in code and documentation to reference pointer events.

* refactor: Merge Gesture and TouchGesture

* chore: clang-format changed files

* refactor: Bind and expect PointerEvents instead of MouseEvents.

* refactor: Rename TouchGesture to Gesture.

* fix: Fix test failures.

* chore: clang-format changed files.

* fix: Fix errant _ from merging

* refactor: Clean up dead code in browser_events.ts.

* chore: Update version in deprecation notices to reflect release schedule

* fix: Fixed a bug that caused the browser context menu to not be suppressed in Chrome.

* fix: Re-export Gesture as TouchGesture for backwards compatibility.

* refactor: Deprecate and remove uses of opt_noPreventDefault.

* chore: Fix error message in gesture.ts.

* chore: Removed obsolete todo.
2022-12-05 11:27:52 -08:00
Beka Westberg
9741cd2530 chore: add simple round tripping tests (#6668) 2022-12-05 10:30:28 -08:00
Beka Westberg
fc2c10d0d0 feat: make the variable map return early for noops (#6674)
* chore: add variable map tests

* chore: move firing create events into the variable map

* feat: add early returning in the case of noop renames

* chore: format
2022-12-02 08:10:41 -08:00