Commit Graph

150 Commits

Author SHA1 Message Date
truongductri01
96a354b46b feat: added intermediate event change (#7671)
* feat: added intermediate event change

* fix: update prettier format for the code

* fix: update comment style

* fix: update test statements
2023-12-04 13:10:09 -08: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
Maribeth Bottorff
b9a7a0c7ad fix: do not create extra shadow blocks when mirroring events (#7427) 2023-08-23 16:20:40 -07:00
Beka Westberg
9efd944de7 fix: block change serialization (#7400) 2023-08-16 15:05:08 -07: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
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
John Nesky
b8ad7d307f feat: use new intermediate block change event for field edits, normal block change event for closing editor. #7105 (#7151)
* Copy core/events/events_block_change.ts to core/events/events_block_field_intermediate_change.ts

* New intermediate event type for field edits.

* Addressing PR feedback.

* Ran npm run format.

* Fixed procedure mutator responding to param edits.

* Intermediate events now inherit from BlockBase.

* Addressing feedback on PR.

* chore: format
2023-06-16 09:27:56 -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
Rachel Fenichel
de904ab128 chore: remove deprecated functionality for v10 (#7077)
* chore: remove deprecated functionality in events files

* chore: remove deprecated items in renderers

* chore: remove deprecated items in core

* chore: remove mixin deprecation

* chore: fix tests after removing deprecations
2023-05-11 14:30:54 -07:00
Evan W. Patton
bef5526f1c fix: Filter undo stack after firing events (#7069)
Change-Id: I21eb3dfaaf5089d373b0f7e810da657c9b541b8b
2023-05-11 14:27:09 -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
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
a7d250cb78 fix: flyouts resizing for blocks (#6914)
* fix: flyouts resizing for blocks

* chore: fix node build

* chore: actually fix node
2023-03-21 15:27:04 -07:00
Beka Westberg
ed531ec313 chore: remove all namespace comments (#6903)
* chore: remove all namespace comments

* chore: fix lint
2023-03-20 09:43:58 -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
c9e2af2a27 fix: variable events not deserializing properly (#6832) 2023-02-27 10:43:19 -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
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
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
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
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
Maribeth Bottorff
76c55754c2 fix: export Abstract event class directly (#6752) 2023-01-10 15:50:12 -08: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
c959ce85ae feat: add running procedure events (#6650)
* chore: fixup procedure change event tests

* feat: add running procedure change return events

* fixup change return

* feat: add running the procedure rename event

* feat: add running procedure enable events

* feat: add running parameter rename events

* feat: add running procedure create events

* feat: add running procedure delete events

* feat: add running parameter create events

* feat: add running procedure parameter delete events

* chore: add types to all of the new procedure events

* chore: format

* chore: use type imports

* chore: fix test comments

* chore: add more inline docs
2022-12-01 08:38:50 -08:00
Beka Westberg
7b055dbc7e chore(tests): test running procedure events (#6627)
* chore: define necessary events

* chore: cleanup test organization

* chore: cleanup comment

* chore: move assertEventFiredShallow to test helpers

* chore: add tests for running the procedure change return events

* chore: work on tests??

* chore: add tests for running the change return events

* chore: add tests for running enable events

* chore: add tests for procedure rename events

* chore: add tests for renaming procedure parameters

* chore: add tests for running procedure create events

* chore: add tests for running procedure parameter create events

* chore: add tests for running procedure delete events

* chore: add tests for running procedure parameter delete events

* chore: skip all tests for running procedure events
2022-11-18 16:01:41 -08:00
Beka Westberg
f64c934f04 feat: refactor event serialization to use static fromJson method (#6614)
* feat: add new path for deserialization of events

* chore: add tests for round-tripping events

* chore: add static fromJson methods to all events

* chore: add inline docs to new static methods

* chore: add deprecation warnings

* chore: cleanup

* chore: add deprecation and docs to abstract

* chore: format

* chore: cleanup from rebase

* chore: update docs comment
2022-11-14 11:07:36 -08:00
Beka Westberg
0532b5d1c0 feat: add firing of procedure events. (#6604)
* feat: add empty implementations of events

* chore: register all events

* chore: change assertions to shallow match properties

* feat: add firing events from the observable procedure map

* fix: make event not fired assertions actually fail

* chore: fixup typos in tests

* feat: add firing procedure model events

* feat: add firing parameter create and parameter delete events

* chore: reorganize event tests into suites

* feat: add firing parameter rename events

* chore: format

* chore: use tripple equals
2022-11-10 16:38:32 -08:00
Neil Fraser
5a23c84e6e Don't quote fromJson property. (#6545)
This is the only place in our codebase where it's quoted.  The result is a failure to compile correctly using advanced optimizations.
2022-10-14 19:01:28 +02:00
Beka Westberg
f678531389 chore: remove AnyDuringMigration from events (#6382)
* chore: remove AnyDuringMigration from events

* chore: format

* chore: lint

* chore: fix tests

* fix: correct types for JSON properties

* chore: fix tests

* refactor: replace exclamation markers with errors

* chore: fix build and tests

* chore: set event types as members, rather than in constructor

* chore: update comment

* chore: export new types

* chore: format

* chore: remove unnecessary override

* chore: change how we're overriding isBlank

* chore: remove unnecessary ?

* chore: remove non-null assertion in block move event

* chore: format

* chore: revert changes to isNull

* chore: format
2022-09-27 15:08:05 -07:00
Neil Fraser
e5dcb766bd chore: Remove radix from parseInt, simplify Blockly.utils.dom methods, use Unicode characters. (#6441)
* chore: remove radix from parseInt

Previously any number starting with '0' would be parsed as octal if the radix was left blank.  But this was changed years ago.  It is no longer needed to specify a radix.

* chore: 'ID' is identification

'id' is a part of Freud's brain.

* Use Unicode characters instead of codes

This is in line with the current style guide.

* Simplify Blockly.utils.dom methods.

classList add/remove/has supports SVG elements in all browsers Blockly supports (i.e. not IE).
2022-09-22 06:59:24 -07:00
Maribeth Bottorff
60bc01acc8 fix: make eventUtils throw if event type not registered (#6381)
* chore: update lint rules

* fix: have eventUtils.get throw if event isn't found

* chore: remove nonnull assertion from eventUtils.get and format
2022-08-24 13:41:32 -07:00
Aaron Dodson
980fe138e7 refactor: Mark optional parameters as optional. (#6380)
* refactor: Mark optional params as optional.

* refactor: Slightly narrow the typing of rendererOverrides.
2022-08-24 13:19:37 -07:00
Maribeth Bottorff
037eb59b89 chore: Lint TsDoc. (#6353)
* chore: add linting for tsdoc

* chore: don't require types on return

* chore: remove redundant fileoverview from ts

* chore: change return to returns and add some newlines

* chore: remove license tag

* chore: don't require params/return docs

* chore: remove spurious struct tags

* Revert "chore: change return to returns and add some newlines"

This reverts commit d6d8656a45.

* chore: don't auto-add param names

* chore: disable require-param bc it breaks on this

* return to returns and add line breaks

* chore: configure additional jsdoc rules

* chore: run format

* Revert "chore: remove license tag"

This reverts commit 173455588a.

* chore: allow license tag format

* chore: only require jsdoc on exported items

* chore: add missing jsdoc or silence where needed

* chore: run format

* chore: lint fixes
2022-08-23 14:27:22 -07:00
Maribeth Bottorff
49f87fba79 chore: enable linting ts files (#6351)
* chore: initial setup for linting ts

* chore: Temporarily disable most of the rules causing problems

* chore: fix autofixable problems.

* chore: ignore the last few files and rules

* chore: fix remaining lint errors

* chore: fix more small lint

* chore: run original rules on js files, new ts rules on ts files

* chore: use jsdoc style return in js files

* chore: add lint fix script

* chore: fix prefer-spread lint

* chore: fix no-invalid-this rule

* chore: fix no-unused-vars

* chore: fix trashcan lint
2022-08-16 13:59:15 -07:00
Aaron Dodson
83a3e74ec9 fix: Made workspace non-nullable. (#6300)
* Made workspace non-nullable.

* chore: clang-format files.

* fix: Fixed incorrect block disposal check in connection.ts
2022-08-02 13:36:15 -07:00
Beka Westberg
21d90696d1 chore: Migrate core/ to Typescript, actually (#6299)
* fix: convert files to typescript

* fix: add alias for AnyDuringMigration so that tsc will run

* chore: format

* chore: enable ts for the clang-format workflow (#6233)

* chore: Restore @fileoverview comment locations (#6237)

* chore: add declareModuleId (#6238)

* fix: Revert comment change to app_controller.js (#6241)

* fix: Add missing import goog statements (#6240)

I've added the import statement immediately before the
goog.declareModuleId calls that depend on it.

There is an argument to be made that we should put the import
statement in their normal place amongst any other imports, and
move the declareModuleId statement to below the double blank
line below the imports, but as these are so tightly coupled,
replace the previous goog.module calls, and will both be deleted
at the same time once the transition to TypeScript is fully complete
I think it's fine (and certainly much easier) to do it this way.

* chore: Fix whitespace (#6243)

* fix: Remove spurious blank lines

  Remove extraneous blank lines introduced by deletion of
  'use strict'; pragmas.

  Also fix the location of the goog.declareModuleId call in
  core/utils/array.ts.

* fix: Add missing double-blank-line before body of modules

  Our convention is to have two blank lines between the imports (or
  module ID, if there are no imports) and the beginning of the body
  of the module.  Enforce this.

* fix: one addition format error for PR #6243

* fix(build): Skip npm prepare when running in CI (#6244)

Have npm prepare do nothing when running in CI.

We don't need to do any building, because npm test will build
everything needed in the workflows in which it is run, and we
don't want to build anything in other workflows because a tsc
error would prevent those workflows from completing.

* fix: re-add `@package` annotations as `@internal` annotations (#6232)

* fix: add ~70% of internal attributes

* fix: work on manually adding more @internal annotations

* fix: add more manual internal annotations

* fix: rename package typos to internal

* fix: final manual fixes for internal annotations

* chore: format

* chore: make unnecessary multiline jsdoc a single line

* fix: fix internal tags in serialization exceptions

* fix: tsc errors picked up from develop (#6224)

* fix: relative path for deprecation utils

* fix: checking if properties exist in svg_math

* fix: set all timeout PIDs to AnyDuringMigration

* fix: make nullability errors explicity in block drag surface

* fix: make null check in events_block_change explicit

* fix: make getEventWorkspace_ internal so we can access it from CommentCreateDeleteHelper

* fix: rename DIV -> containerDiv in tooltip

* fix: ignore backwards compat check in category

* fix: set block styles to AnyDuringMigration

* fix: type typo in KeyboardShortcut

* fix: constants name in row measurables

* fix: typecast in mutator

* fix: populateProcedures type of flattened array

* fix: ignore errors related to workspace comment deserialization

* chore: format files

* fix: renaming imports missing file extensions

* fix: remove check for sound.play

* fix: temporarily remove bad requireType.

All `export type` statements are stripped when tsc is run. This means
that when we attempt to require BlockDefinition from the block files, we
get an error because it does not exist.

We decided to temporarily remove the require, because this will no
longer be a problem when we conver the blocks to typescript, and
everything gets compiled together.

* fix: bad jsdoc in array

* fix: silence missing property errors

Closure was complaining about inexistant properties, but they actually
do exist, they're just not being transpiled by tsc in a way that closure
understands.

I.E. if things are initialized in a function called by the constructor,
rather than in a class field or in the custructor itself, closure would
error.

It would also error on enums, because they are transpiled to a weird
IIFE.

* fix: context menu action handler not knowing the type of this.

this: TypeX information gets stripped when tsc is run, so closure could
not know that this was not global. Fixed this by reorganizing to use the
option object directly instead of passing it to onAction to be bound to
this.

* fix: readd getDeveloperVars checks (should not be part of migration)

This was found because ALL_DEVELOPER_VARS_WARNINGS_BY_BLOCK_TYPE was no
longer being accessed.

* fix: silence closure errors about overriding supertype props

We propertly define the overrides in typescript, but these get removed
from the compiled output, so closure doesn't know they exist.

* fix: silence globalThis errors

this: TypeX annotations get stripped from the compiled output, so
closure can't know that we're accessing the correct things. However,
typescript makes sure that this always has the correct properties, so
silencing this should be fine.

* fix: bad jsdoc name

* chore: attempt compiling with blockly.js

* fix: attempt moving the import statement above the namespace line

* chore: add todo comments to block def files

* chore: remove todo from context menu

* chore: add comments abotu disabled errors

* chore: move comments back to their correct positions (#6249)

* fix: work on fixing comments

* chore: finish moving all comments

* chore: format

* chore: move some other messed up comments

* chore: format

* fix: Correct enum formatting, use merged `namespace`s for types that are class static members (#6246)

* fix: formatting of enum KeyCodes

* fix: Use merged namespace for ContextMenuRegistry static types

  - Create a namespace to be merged with the ContextMenuRegistry
    class containing the types that were formerly declared as static
    properties on that class.

  - Use type aliases to export them individually as well, for
    compatibility with the changes made by MigranTS (and/or
    @gonfunko) to how other modules in core/ now import these
    types.

  - Update renamings.json5 to reflect the availability of the
    direct exports for modules that import this module directly
    (though they are not available to, and will not be used by,
    code that imports only via blockly.js/blockly.ts.)

* fix: Use merged namespace for Input.Align

  - Create a merged namespace for the Input.Align enum.

  - Use type/const aliases to export it as Input too.

  - Update renamings.json5 to reflect the availability of the
    direct export.

* fix: Use merged namespace for Names.NameType

  - Create a merged namespace for the Names.NameType enum.

  - Use type/const aliases to export it as NameType too.

  - Update renamings.json5 to reflect the availability of the
    direct export.  (This ought to have happened in an earlier
    version as it was already available by both routes.)

* chore: Fix minor issues for PR #6246

  - Use `Align` instead of `Input.Align` where possible.

* fix(build): Suppress irrelevant JSC_UNUSED_LOCAL_ASSIGNMENT errors

  tsc generates code for merged namespaces that looks like:

      (function (ClassName) {
          let EnumName;
          (function (EnumName) {
              EnumName[EnumNameAlign["v1"] = 0] = "v1";
              // etc.
          })(EnumName = ClassName.EnumName || (ClassName.EnumName = {}));
      })(ClassName || (ClassName = {}));

  and Closure Compiler complains about the fact that the EnumName let
  binding is initialised but never used.  (It exists so that any other
  code that was in the namespace could see the enum.)

  Suppress this message, since it is not actionable and lint and/or tsc
  should tell us if we have actual unused variables in our .ts files.

* chore(build): Suppress spurious warnings from closure-make-deps (#6253)

A little bit of an ugly hack, but it works: pipe stderr through
grep -v to suppress error output starting with "WARNING in".

* fix: remaining enums that weren't properly exported (#6251)

* fix: remaining enums that weren't properly exported

* chore: format

* fix: add enum value exports

* chore: format

* fix: properly export interfaces that were typedefs (#6250)

* fix: properly export interfaces that were typedefs

* fix: allowCollsion -> allowCollision

* fix: convert unconverted enums

* fix: enums that were/are instance properties

* fix: revert changes to property enums

* fix: renamed protected parameter properties (#6252)

* fix: bad protected parameter properties

* chore:format

* fix: gesture constructor

* fix: overridden properties that were renamed

* refactor: Migrate `blockly.js` to TypeScript (#6261)

* chore: Apply changes to blockly.js to blockly.ts

* fix: Build using core/blockly.ts instead of .js

  Compiles and runs in compressed mode correctly!

* fix(build): Don't depend on execSync running bash (#6262)

For some reason on Github CI servers execSync uses /bin/sh, which
is (on Ubuntu) dash rather than bash, and does not understand
the pipefail option.

So remove the grep pipe on stderr and just discard all error output
at all.

This is not ideal as errors in test deps will go unreported AND
not even cause test failure, but it's not clear that it's worth
investing more time to fix this at the moment.

* chore: use `import type` where possible (#6279)

* chore: automatically change imports to import types

* chore: revert changes that actually need to be imports

* chore: format

* chore: add more import type statements based on importsNotUsedAsValues

* chore: fix tsconfig

* chore: add link to compiler issue

* fix: add type information to blockly options (#6283)

* fix: add type information to blockly options

* chore: format

* chore: remove erroneous comment

* fix: bugs revealed by getting the built output working (#6282)

* fix: types of compose and decompose in block

* fix: workspace naming in toolbox

* chore: add jsdoc

* chore: restore registry comments to better positions

* chore: pr comments'

* fix(variables): Revert inadvertent change to allDeveloperVariables (#6290)

It appears that a function call got modified incorrectly (probably
in an effort to fix a typing issue).  This fix trivially reverts
the line in question to match the original JS version from develop.

This causes the generator tests to pass.

* fix: circular dependencies (#6281)

* chore: fix circular dependencies w/ static workspace funcs

* remove preserved imports that aren't currently necessary (probably)

* fix circular dependency with workspaces and block using stub

* fix dependency between variables and xml by moving function to utils

* add stub for trashcan as well

* fix line endings from rebase

* fix goog/base order

* add trashcan patch

* fix: types of compose and decompose in block

* fix: workspace naming in toolbox

* chore: add jsdoc

* chore: restore registry comments to better positions

* chore: remove implementations in goog.js

* chore: fix types of stubs

* chore: remove added AnyDuringMigration casts

* chore: remove modifications to xml and variables

* chore: format

* chore: remove event requirements in workspace comments

* chore: fix circular dependency with xml and workspace comments

* fixup remove ContextMenu import

* chore: fix dependency between mutator and workspace

* chore: break circular dependency between names and procedures

* chore: get tests to run?

* chore: pr comments'

* chore: fix stubbing field registry fromJson

* chore: fix spying on fire

* chore: fix stubbing parts of connection checker

* chore: fix stubbing dialog

* chore: fix stubbing style

* chore: fix spying on duplicate

* chore: fix stubbing variables

* chore: fix stubbing copy

* chore: fix stubbing in workspace

* chore: remove unnecessary stubs

* chore: fix formatting

* chore: fix other formatting

* chore: add backwards compatible static properties to workspace

* chore: move static type properties

* chore: move and comment stubs

* chore: add newlines at EOF

* chore: improve errors for monkey patched functions

* chore: update comment with a pointer to the doc

* chore: update comment with a pointer to the doc

* chore: format

* chore: revert changes to playground used for testing (#6292)

* chore: get mocha tests to pass. (#6291)

* chore: fix undo and empty code blocks

* chore: skip IE test

* chore: fix gesture test

* chore: fix replace message references test

* chore: fix string table interpolation

* chore: skip getById tests

* chore: fix field tests

* chore: fix console errors by making workspace nullable

* chore: format

* chore: fix definition overwrite warning

* chore: update metadata

* chore: temporarily modify the the advanced compile test

* chore: fix gestures by fixing test instead

Co-authored-by: Neil Fraser <fraser@google.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
2022-08-02 10:30:13 -07:00
Beka Westberg
27d6760ec6 chore: rename all JS files to TS files (#6297) 2022-08-01 13:09:51 -07:00
Christopher Allen
aaafbc2b6f fix!: Move backwards-compatibility hacks to main.js (#6260)
* fix!: Move backwards-compatibility hacks out of blockly.js

  Move accessor properties for Blockly.alert, .confirm,
  .mainWorkspace, .prompt, .selected, .HSV_SATURATION and
  .HSV_VALUE, as well as the hack to allow loading of messages
  via <script> tags, from core/blockly.js to core/main.js,
  which becomes the entrypoint for the first chunk when
  compiled.

  BREAKING CHANGE: The aforementioned properties / hack are no
  longer available in uncompiled mode (or when using advanced
  compilation, unless also compiling against main.js.)

* fix!: Move backwards-compatibility hacks out of contextmenu.js

  Move accessor property for ContextMenu.currentBlock from
  core/contextmenu.js to core/main.js.

* chore: Update deprecation date for Generator.variableDB_ accessors

  Bring the deprecation date forward from May 2026 to September 2022.

  Not technically a breaking change—just a warning that there will
  be a breaking change earlier than previously advertised.

* fix!: Move backwards-compatibility hacks out of tooltip.js

  Move accessor properties for Blockly.Tooltip.visible and .DIV
  from core/tooltip.js to core/main.js.

* fix!: Move backwards-compatibility hacks out of widgetdiv.js

  Move accessor property for Blockly.WidgetDiv.DIV
  from core/widgetdiv.js to core/main.js.
2022-07-05 16:27:16 +01:00
Rachel Fenichel
619ee66b23 fix: add compose and decompose to block (#6102) 2022-04-22 09:43:07 -07:00
Aaron Dodson
edc2a5cd0c fix: Fix compilation errors under Closure's strict mode (#6073)
* fix: Fix errors under strict compilation.

* fix: Fix tests that referenced properties converted to data attributes.

* fix: Incorporate feedback on resolving compiler errors.

* refactor: Revert changes to skew and translate attributes.

* refactor: Introduce LegacyContextMenuOption type to correspond to documented fields.

* refactor: Introduce PathLeftShape and PathDownShape vs casting to PuzzleTab/Notch.

* chore: Added nullability modifiers to type annotations.

* refactor: Export FlyoutItem directly.

* chore: clang-format renderers/zelos/drawer.js.
2022-04-19 14:17:17 -07:00
Beka Westberg
c4a25eb3c4 fix: revert "Delete events should animate when played (#5919)" (#6031)
* Revert "Delete events should animate when played (#5919)"

This reverts commit bce4c5e2c6.

* fix: lint in screenshot
2022-03-29 11:47:50 -07:00
Aaron Dodson
1647a3299a fix: Move @alias onto classes instead of constructors (#6003)
* fix: Move @alias onto classes instead of constructors

* fix: Fix JSDoc for constructors.
2022-03-16 15:48:32 -07:00
Beka Westberg
e2eaebec47 fix: convert the Workspace class to an ES6 class (#5977)
* fix: run conversion script on workspace

* fix: cleanup from conversion script

* fix: make debug build happy

* fix: tests

* fix: format

* fix: format
2022-03-16 13:22:03 -07:00
Beka Westberg
fa14e9d6de refactor: convert blocksvg and block to ES6 classes (#5952)
* refact: move super call to top of block svg

* refact: run conversion script on block svg and block

* fix: make debug build happy

* fix: tests

* style: format

* fix: cleanup from rebase

* fix: use new.target instead of a new parameter

* fix: add more overridden casted methods to BlockSvg

* style: fix typos

* style: move override tags to the end of JSDoc

* fix: cleanup from rebase
2022-02-28 09:48:37 -08:00
Rachel Fenichel
b52c65c810 refactor: convert some classes to ES6 classes (#5928)
* refactor: move optional function declarations into the constructor

* refactor: convert options.js to es6 class

* refactor: convert generator.js to es6 class

* refactor: convert workspace_events.js to es6 class

* refactor: convert events_abstract.js to an es6 class

* chore: format

* chore: fix lint

* chore: rebuild

* chore: respond to PR feedback
2022-02-16 13:48:18 -08:00
Neil Fraser
bce4c5e2c6 Delete events should animate when played (#5919)
Same as PR #5640, except for the addition of a parameter in the JSON to turn this on or off.  While one would normally want animations/sounds on (e.g. undo/redo stack) sometimes they'd be annoying (e.g. events from realtime collaborators).
2022-02-11 14:20:10 -08:00
Rachel Fenichel
9e8c5ea8ed refactor: convert some files to es classes (#5917)
* refactor: update several files to es6 classes

* refactor: update several files to es6 classes

* chore: add some type casts for specificity about event types

* chore: run formatter

* chore: rebuild
2022-02-09 08:29:39 -08:00
Aaron Dodson
328cd35d10 refactor: Migrate Blockly.Events.Abstract to named exports (#5916) 2022-02-04 15:32:33 -08:00