Commit Graph

4245 Commits

Author SHA1 Message Date
Maribeth Bottorff
cdb1215d95 revert: "refactor: Remove block and workspace drag surfaces (#6758)" (#6888)
This reverts commit 332c0fd2f2.
2023-03-09 13:43:12 -08: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
Maribeth Bottorff
8173d139e1 feat: make renderer methods public or protected (#6887)
* feat: make renderering methods public or protected

* chore: formatting

* chore: recommend thrasos more strongly
2023-03-09 00:31:47 +00: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
Blake Thomas Williams
9e5bfc243e fix: export Field-related types from Blockly (#6877)
* chore: re-exported Field config types from Blockly

* mark `@internal` types, export field error, and add validator comments
2023-03-03 14:20:20 -08:00
Aaron Dodson
3a7ac3be1b fix: Don't repeatedly recreate the last marker block during a drag. (#6875)
* fix: Don't repeatedly recreate the last marker block during a drag.

* refactor: Reorganize insertion marker initialization and disposal.
2023-03-01 15:52:37 -08:00
Beka Westberg
bb6124a7c3 fix: updating connections in the db multiple times (#6859)
* fix: updating connections in the DB recursively

* chore: cleanup
2023-03-01 15:00:05 -08:00
Beka Westberg
f2b75fb877 feat: add basic render queueing (#6851)
* feat: add basic render queueing

* feat: change connecting and disconnecting to queue renders

* feat: delay bringToFront

* chore: format

* chore: fix build

* fix: stop updating connections when setting the parent.

This was causing erroneous block bumps because the connection locations
were changed before the blocks were actually rerendered.

* fix: connection highlight positioning
2023-03-01 10:29:01 -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
Aaron Dodson
a312e9e3d3 refactor: Use input type=number for field_number.ts (#6845) 2023-02-14 13:37:28 -08:00
Beka Westberg
7255d980d6 chore: fixup dialog deprecation warnings (#6844) 2023-02-13 09:35:42 -08:00
Blake Thomas Williams
7439a70864 feat: updated flyout button to set border radius via static variable (#6838) 2023-02-10 20:17:29 +01: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
Neil Fraser
72b2af2100 fix: move deprecation warning to correct fromJson (#6831)
Resolves #6830.

https://groups.google.com/g/blockly/c/uy_8e7Q8XEw/m/8XveAYi3AQAJ
2023-02-07 23:37:25 +01:00
Neil Fraser
1169b04a45 chore: Make dropdownDispose available for plugins. (#6826)
Specifically in Blockly Samples the field-grid-dropdown wants to call this inherited function.
2023-02-07 12:29:26 -08:00
Neil Fraser
90217360c7 fix: Fire deletion events when clearing variables. (#6827)
https://groups.google.com/g/blockly/c/l_vUnrGSJ0M
2023-02-07 21:20:01 +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
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
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
Aaron Dodson
332c0fd2f2 refactor: Remove block and workspace drag surfaces (#6758)
* refactor: Remove BlockDragSurface.

* refactor: Remove WorkspaceDragSurfaceSvg.

* chore: Remove drag surface-related CSS.

* chore: Removed unused variable in block_dragger.ts.

* chore: Remove references to drag surfaces in comments.

* refactor: Only track icons with visible bubbles for position updates during a drag.

* fix: Remove rendundant condition.

* fix: Remove arg inadvertently reintroduced in merge
2023-01-20 11:55:28 -08:00
Beka Westberg
3eb7031f14 chore: reexport procedure related symbols (#6769)
* chore: reexport triggerProcedureUpdate

* chore: export interfaces

* fix: incorrect module ID in IProcedureBlock
2023-01-20 10:29:58 -08:00
Aaron Dodson
6cb2f7229c refactor: Don't use skew_ and translate_ attributes on SVGs to animate blocks. (#6782)
* refactor: Remove unused translate_ and skew_ attributes from workspace_comment_svg.ts.

* refactor: Stop setting skew_ and translate_ attributes on SVGs.

* chore: Run format.

* refactor: Return early if no wobbling block is present.
2023-01-18 15:05:10 -08:00
Beka Westberg
65834a0f01 chore: make inline docs for events informative (#6755)
* chore: make inline docs for events informative

* Notifies the developer -> Notifies listeners

* chore: cleanup from PR comments

* chore: final PR fixes

* chore: format
2023-01-13 12:09:27 -08:00
Christopher Allen
cd57e74d1a fix(deps): Don't use global variables for jsdom injection in scripts/package/node/core.js and core/utils/xml.ts (#6764)
* fix(node): Don't use global variables for jsdom injection

Introduce a (hopefully generally applicable) mechanism for
injecting dependencies into modules, specifically in this case
to inject required bits of JSDOM's Window and Document
implementations into core/utils/xml.js when running in
node.js or other environments lacking a DOM.

The injectDependencies function uses an options object to
facilitate optionally injecting multiple named dependencies
at the same time.

Rename the xmlDocument local variable back to document (was
renamed in #5461) so that the name used in this module
corresponds to the usual global variable it replaces.

Change the injection in scripts/package/node/core.js to use
injectDependencies instead of setXmlDocument + global variables;
also eliminate apparently-unnecessary creation of a special
Document instance, using the default one supplied by jsdom
instead.

Fixes #6725.

* deprecate(xml): Deprecate getXmlDocument and setXmlDocument

Mark getXmlDocument and setXmlDocument as @deprecated, with
suitable calls to deprecation.warn().

There are no remaining callers to either function within core -
setXmlDocument was only used by the node.js wrapper, and and
apparently getXmlDocument was never used AFAICT - and we do not
anticipate that either were used by external developers.

* fix: Corrections for comments on PR #6764.
2023-01-12 15:31:53 -08: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
a9d6c7b9cc chore: add docs link to generator error (#6765)
* chore: add docs link to generator error

* chore: add scheme to URL
2023-01-12 12:53:53 -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
Maribeth Bottorff
76c55754c2 fix: export Abstract event class directly (#6752) 2023-01-10 15:50:12 -08:00
Blake Thomas Williams
0fb64a6772 fix: replace 'AnyDuringMigration' for core/field.ts value functions (#6639)
* chore: replace `AnyDuringMigration` for field value functions

* chore: removed unnecessary `KeyboardEvent` comments and `AnyDuringMigration` casts

* chore: cleaned up `doValueUpdate_` and `doClassValidation_` in `Field` subclasses

* fix: updated `FieldValidator` to allow returning `undefined` and restructured `setValue`

* fix: implemented initial `core/field_checkbox.ts` feedback

* fix: updated `Field` to accept `U` and `undefined` and reverted subclass constructor handling of the input value

* fix: reverted `getVars` to returning `string[]` and added related comment

* chore: removed unnecessary comment

* fix: updated `processValidation_` to no longer allow returning `undefined`

* fix: removed `Un` type alias for `undefined`

* chore: removed unnecessary string cast in `core/field_colour.ts`

* fix: updated `doClassValidation_` not to expect `null` since it will never come up in `setValue`

* fix: updated `doClassValidation_` to only allow `undefined` when the new value exists

* Updated `FieldValidator` type to expect `newValue` to exist

* cleanup: updated `picker` from type `Element` to type `HTMLElement`

* fix: updated `doValueInvalid_` type info in `core/field_input.ts` to handle `string` and `undefined`

* fix: reverted `getValue` in `core/field_checkbox.ts` to previous logic

* fix: updated the `Field` constructor to allow `value` to be optional

* chore: consolidated `Validation` with `FieldValidator` and `doClassValidation_`

* fix: reverted generic param `U` while handling diverging user input is being discussed

* fix: updated `doClassValidation_` return comment to work for TSDoc

* fix: misc keyboard event function tweaks
2023-01-10 14:13:49 -08:00
Maribeth Bottorff
25d9acb418 fix: correct docs for flyout metrics (#6751) 2023-01-10 13:54:51 -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
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
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
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
Neil Fraser
fccf8e436e feat: Display a 'wait' cursor when opening trashcan (#6699)
No visible change for regular case.  But if there's thousands of blocks in the trash, the visual feedback that something's happening is better.  Otherwise the user clicks, and that click will cause some random block to be spawned out of the trash.
2022-12-15 00:25:06 +01:00
Neil Fraser
768d18468a fix: Don't spellcheck number fields. (#6698)
For the most part spellcheckers ignore numbers so this isn't an issue.  But (for example) 'Infinity' is an English word that's hardcoded into Blockly, and other languages may spellcheck it as wrong.
2022-12-12 11:25:00 -08:00
Maribeth Bottorff
20f378e082 fix: don't reopen dropdownDiv if it was already open (#6688) 2022-12-09 19:27:27 -08:00
Blake Thomas Williams
9ee1559e34 fix: set default field to any and fix validator function return type (#6690)
* chore: set default field to  and fix validator function return type

* Fix format
2022-12-09 14:16:37 -08:00