* refactor(VariableMap): Stop using deprecated wrapper methods
* fix format
* fix: Apply review suggestions
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
* fix: restore blank line
---------
Co-authored-by: Christopher Allen <cpcallen+github@gmail.com>
* feat!: Make bubbles, comments, and icons focusable
* feat!: Make ISelectable and ICopyable focusable.
* feat: Consolidate selection calls.
Now everything is based on focus with selection only being used as a
proxy.
* feat: Invert responsibility for setSelected().
Now setSelected() is only for quasi-external use.
* feat: Push up shadow check to getters.
Needed new common-level helper.
* chore: Lint fixes.
* feat!: Allow IFocusableNode to disable focus.
* chore: post-merge lint fixes
* fix: Fix tests + text bubble focusing.
This fixed then regressed a circular dependency causing the node and
advanced compilation steps to fail. This investigation is ongoing.
* fix: Clean up & fix imports.
This ensures the node and advanced compilation test steps now pass.
* fix: Lint fixes + revert commented out logic.
* chore: Remove unnecessary cast.
Addresses reviewer comment.
* fix: Some issues and a bunch of clean-ups.
This addresses a bunch of review comments, and fixes selecting workspace
comments.
* chore: Lint fix.
* fix: Remove unnecessary shadow consideration.
* chore: Revert import.
* chore: Some doc updates & added a warn statement.
* 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
* 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
* 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
* 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.
* chore: delete mocha tests for angle field
* feat! : delete angle field
* chore(tests): delete colour tests from generator tests and golden files
* chore: delete colour blocks and associated generators
* chore: remove colour blocks from playgrounds
* chore: delete mocha tests for colour fields
* chore: fix incorrect comment
* chore: delete colour field from core
* chore: delete multiline input tests from generators tests and golden files
* chore: delete multiline text block and associated generators
* chore: remove multiline text block from playgrounds
* chore: delete mocha tests for multiline input field
* chore: delete multiline input field from core
* refactor(generators): Migrate javascript_generator.js to TypeScript
* refactor(generators): Simplify getAdjusted
Slightly simplify the implementation of getAdjusted, in part to
make it more readable. Also improve its JSDoc comment.
* refactor(generators): Migrate generators/javascript/* to TypeScript
First pass doing very mechanistic migration, not attempting to fix
all the resulting type errors.
* fix(generators): Fix type errors in generator functions
This consists almost entirely of adding casts, so the code output
by tsc should be as similar as possible to the pre-migration .js
source files.
* refactor(generators): Migrate generators/javascript.js to TypeScript
The way the generator functions are added to
javascriptGenerator.forBlock has been modified so that incorrect
generator function signatures will cause tsc to generate a type
error.
* chore(generator): Format
One block protected with // prettier-ignore to preserve careful
comment formatting.
Where there are repeated concatenations prettier has made a pretty
mess of things, but the correct fix is probably to use template
literals instead (rather than just locally disabling prettier).
This has been added to the to-do list in #7600.
* fix(generators): Fixes for PR #7602
* fix(generators): Fix syntax error
* 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
Where certain block mixin methods had been marked @private,
and these annotations had been deleted while migrating the
containing files to TypeScript, mark those methods as
@internal.
* 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>
* 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
* chore: remove render call from procedure blocks
* chore: have workspace queue renders when unhiding
* chore: remove forced rendering from flyouts
* chore: change mutators to use queueing
* chore: change shadows to use queueing
* chore: add comments about icon rendering
* 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
* refactor(blocks): auto-migration of blocks/text.js to ts
* refactor(blocks): fix up some types in blocks/text.ts
* refactor(blocks): improve some types in text.ts
* refactor(blocks): additional type cleanups
* chore: format
* chore: fix typo
* chore: respond to PR comments
* chore: respond to PR comments
* refactor: run js2ts on variables
* refactor: clean up conversion of variables blocks to typescript
* refactor: add types for custom context menu options
* refactor: run js2ts on blocks/variables_dynamic.js
* refactor: clean up types in variables_dynamic
* chore: respond to PR comments
* chore: format
* refactor(blocks): Auto-migration of blocks/loops.js to ts
* fix(blocks): Manually migrate types and fix imports in loops.ts
* chore: respond to PR comments
* refactor(blocks): Auto-migration of blocks/lists.js to ts
* fix(blocks): Manually migrate & fix types in lists.ts
* chore(blocks): format lists.ts
Not running clang-format on this as for some reason it decides
half way through the file to indent everything after that by
an extra four spaces (and then has to re-wrap a bunch of lines
that are consequently too long).
* refactor(blocks): Improve types in lists.ts
It turns out that the way I originally specified the types for
the mixins meant that they were all 'any', which is a bit
useless. Change them so that tsc actually typechecks
properties (including method calls) on the mixed-in blocks,
and then fix the numerous additional type errors which
doing this revealed.
(By "fix", I mean apply "as" casts and "!"s as required to
suppress type errors from tsc. Actually fixing the code in a
way that makes the blocks meaningfully more bulletproof is
left as an exercise to the reader - sorry, I mean: will be
dealt with in a future PR.)
* fix(blocks): Additional fixes for comments PR #6902
* refactor(blocks): Auto-migration of blocks/math.js to ts
This is just the result of running js2ts on this file.
* fix(blocks): Manually migrate & fix types in math.ts
* chore(blocks): clang-format math.ts
* fix(blocks): Corrections for comments on PR #6900
* refactor(blocks): Define types for mixin-ed blocks, etc.
Define types to represent the union of Block and each of the
*_MIXINs, and use these types for the type of this in mixin
methods.
* refactor(blocks): Misc minor changes
Make sure validator functions explicitly return undefined.
Field.prototype.setValidator takes a FieldValidator<T>, which
must be a non-void function. I'm not sure why tsc was not
objecting to the void implementation here, but it does in
other very similar situations so for consistency explicitly
return undefined to signal the value should be used unchanged.
Also undo previous change of !. to ?.: I think it wisest to
try to preserve the existing behaviour as exactly as possible
for now, and make behaviour changes (i.e., ones that affect
the generated code) separately.
* fix(blocks): Fix erroneous typing of mixins
It turns out that the previous types for these were completely
wrong, for two reasons:
- They should be intersection types (which have the union of the
properties), not union types (which have the interseciton of the
properties).
- The *_MIXIN types were already declared as having type
BlockDefinition, which is ultimately an alias for any.
TypeScript doesn't like (some) kinds of circularly defined types,
so fixing the above necessitates declaring a few auxiliary types
just to make the type checker happy - but the end result is
excellent and caught an actual type error in the code.
* refactor: Use the field registry to instantiate fields for list blocks.
* refactor: Use the field registry to instantiate fields for procedure blocks.
* refactor: Use the field registry to instantiate fields for text blocks.
* 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