Commit Graph

387 Commits

Author SHA1 Message Date
Rachel Fenichel
27699ed08b chore: move remaining function definitions out of blockly.js (#5699)
* chore: move remaining function definitions out of blockly.js

* chore: record renamings

* chore: add aliases to moved function jsdoc

* chore: add deprecation warnings in blockly.js

* chore: fix bad merge

* chore: move functions in response to PR comments

* chore: move isNumber to utils.string
2021-11-17 11:13:27 -08:00
Christopher Allen
335ff199d7 refactor: Update uncompiled-mode dependency loading for playground, tests (#5715)
* chore: rename module Blockly.blocks.Lists to ....lists

All the other Blockly.blocks modules have lower-case names.  This
one being named with an upper-case initial appears to have been a
typo on my part.

This module name is not mentioned anywhere else in the source code
(though it will be soon!) so no other files need to be edited.
Further, it does not appear anywhere in the last release (which
before PR #5696) so it is not necessary to add an entry in
renamings.js for this change.

* chore(build): Rationalise deps.js, deps.mocha.js

* Include blocks/*.js (Blockly.blocks.*) in tests/deps.js, since
  these modules are used in the playground.  (They are goog.provide
  modules loaded via <script> tags, so their absence from deps.js
  does not cause errors - but it will when they are migrated to
  goog.module and must be loaded via goog.require.)

* Filter the entries in deps.mocha.js so that it includes only the
  additional mocha test modules (i.e. those not mentioned in deps.js
  already).

* refactor: Load blocks and generators using goog.require
2021-11-17 00:04:45 +00:00
Rachel Fenichel
075385c87c chore: move remaining functions out of utils.js (#5714)
* chore: move arrayRemove to a new utils.array namespace

* chore: move getBlockTypeCounts out of utils.js

* chore: remove last functions from utils.js

* chore: reorder imports

* chore: add re-export for runAfterPageLoad
2021-11-15 18:12:45 -08:00
Rachel Fenichel
969fcac455 chore: Move functions from utils (#5706)
* chore: move functions from utils to more specific files

* chore: use new names for utils functions

* chore: run clang-format

* chore: add deprecation warnings back to utils.js
2021-11-15 15:59:27 -08:00
Christopher Allen
82fde60fe6 chore: update deps.js, deps.mocha.js (#5698) 2021-11-09 17:14:04 -08:00
Christopher Allen
beefe361a3 fix!(blocks): Rename Blockly.Blocks.* modules to Blockly.blocks.* (#5696)
Use Blockly.blocks.* for blocks modules, leaving the Blockly.Blocks
name for the block dictionary object.

This resolves a problem with advanced compilation of Blockly Games,
 where, in the compressed output, (the minified name of)
 Blockly.Blocks gets overwritten, with the dictionary object defined in
 core/blocks.js being replaced by an empty namespace object
 created by the provides of Blockly.Blocks.* in blocks/*.js. Without
 this fix, some block definitions end up being created in the
 dictionary and some on the namespace object—with chaos
 predictably ensuing.
2021-11-08 18:35:38 +00:00
Christopher Allen
5cdc5f587f chore: Update deps.js with modified lang values (#5636)
This updates should have been included in PR #5626 but were apparently
omitted (and the omission not noted by the code reviewer either!)
2021-10-25 17:11:22 +01:00
Aaron Dodson
3851b14627 refactor: Migrate to named exports (#5623)
* refactor: Migrate to named exports

* fix: Sort requires

* fix: Remove duplicate deps
2021-10-20 15:53:23 -07:00
Aaron Dodson
30eb4d45c3 fix: Positioning of pasted/duplicated blocks in LTR workspaces (#5613) 2021-10-18 12:15:27 -07:00
Sandeep Dubey
ec9092fd67 Changes Css.register API to accept string param (#5472)
* Chnages Css.register API to accept string param

* Address self review comments and nits

* Fix code-comment

* Address minor review comments and nits

* Allow passing an array of strings when registering CSS

* Fix lint errors

Co-authored-by: Aaron Dodson <adodson@google.com>
2021-10-14 15:47:10 -07:00
Christopher Allen
d2d5dc4b71 fix: Use require instead of requireType for interfaces (#5568)
But only if the interface is used in an @implements or @extends
declaration.

Fixes #5450
2021-09-29 17:44:21 +01:00
alschmiedt
839cb7bef1 fix: infinite loop when using defineProperties (#5549) 2021-09-27 14:31:30 -07:00
alschmiedt
2b34748e0e chore: remove declareLegacyNamespace from events (#5532)
- Adds an extra events/utils.js file to hold helper methods related to events.
2021-09-24 14:20:32 -07:00
Christopher Allen
16b6d4526a refactor: Rename Blockly.Blocks, migrate to named exports (#5515)
* Rename Blockly.Blocks to Blockly.blocks
  Because it does not export a type as its default export.

  Part of #5073.

* Name default export of Blockly.blocks Blocks.

  Use named exports in Blockly.blocks by giving the former default
  export the name Blocks.

  Part of #5153.

* Reexport Blockly.blocks from blockly.js

* Document the format of renamings.js better.
2021-09-24 19:12:03 +01:00
Christopher Allen
8ab8536739 refactor: Migrate Blockly.ConnectionType to named exports (#5533)
* refactor: Migrate Blockly.ConnectionType to named exports
* Add corresponding information to renamings.js
2021-09-24 17:38:08 +01:00
kozbial
757878c646 chore: Remove declareLegacyNamespace() from files under interfaces/* 2021-09-24 09:05:17 -07:00
Aaron Dodson
6b07ccab96 chore: Remove declareLegacyNamespace from renderers (#5528)
* chore: Remove declareLegacyNamespace from Geras renderer

* chore: Remove declareLegacyNamespace from minimalist renderer

* chore: Remove declareLegacyNamespace from thrasos renderer

* chore: Remove declareLegacyNamespace from zelos renderer

* fix: Move debugger functionality out of Blockly.blockRendering to avoid dependency cycle when re-exporting submodules

* chore: Remove declareLegacyNamespace from Blockly.blockRendering.*
2021-09-24 08:33:35 -07:00
Himanshu
3629ed5f65 refactor: Rename Blockly.connectionTypes to Blockly.ConnectionType (#5407)
* Renamed Blockly.connectionTypes to Blockly.ConnectionType
* Renamed core/connection_types.js to connection_type.js
* Add entry to renamings.js for renaming of Blockly.connectionTypes

Co-authored-by: Christopher Allen <cpcallen+git@google.com>
2021-09-24 12:45:10 +01:00
kozbial
de330c8874 chore: Remove declareLegacyNamespace() from theme files 2021-09-23 15:32:28 -07:00
Aaron Dodson
e0693a65d2 chore: Remove declareLegacyNamespace() from files in core (#5525)
* chore: Remove declareLegacyNamespace() from files in core

* fix: Update missing/errant re-exports in blockly.js
2021-09-23 14:48:52 -07:00
Aaron Dodson
ede7e8c18d chore: Remove declareLegacyNamespace() from field_* files 2021-09-23 14:29:56 -07:00
kozbial
8bd2e8c9e2 chore: Remove declareLegacyNamespace() from toolbox/ files 2021-09-23 11:23:02 -07:00
Neil Fraser
fd917f42b8 Migrate core/field_angle.js to to goog.module syntax (#5521)
Move angle picker field to goog module and ES6.
2021-09-23 09:37:23 -07:00
kozbial
fd251dae22 Merge branch 'goog_module' into merge-develop-to-goog_module 2021-09-22 09:27:52 -07:00
kozbial
6fc90213a6 Merge branch 'develop' into merge-develop-to-goog_module 2021-09-21 16:04:33 -07:00
Aaron Dodson
d6c9423bdf Remove declareLegacyNamespace from block-related files. 2021-09-21 13:18:07 -07:00
Rachel Fenichel
953e3b67b1 chore: remove deprecated functions (#5509) 2021-09-21 13:10:33 -07:00
Christopher Allen
e7955084ae refactor: Remove remaining references to Blockly.* from goog.modules (#5505) 2021-09-21 17:51:35 +01:00
alschmiedt
d79640592f chore: rebuild deps after rebase 2021-09-20 13:08:35 -07:00
Beka Westberg
e954193009 fix: project cereal cleanup (#5398)
* fix: make exception constructors package

* fix: rename blocks.load to blocks.append

* fix: inline docs

* fix: consistency in block serialization

* fix: remove unexported functions

* fix: interface requires

* fix: tag TODO with issue number
2021-09-20 13:08:35 -07:00
Beka Westberg
84514efb09 fix: create and delete events, and the trashcan (#5425)
* fix: create and delete events with JSON serialization

* fix: trashcan with JSON serialization

* fix: build

* fix: tests

* fix: PR comments

* fix: types

* fix: tests
2021-09-20 13:08:35 -07:00
Beka Westberg
e7541cb315 fix: copy paste with json system (#5423)
* fix: copy paste w/ json system

* fix: pr comments
2021-09-20 13:08:35 -07:00
Beka Westberg
96935c2502 fix: cereal backwards compatibility (#5421)
* fix: remove duplicate serialization hook implementations

* feat: add backwards compatibility to field serialization

* feat: add support for serializing old mutator hooks

* fix: build

* fix: refactor field changes into helpers

* fix: typo

* fix: removing xmlns

* tests: add tests for serialization and deserialization of mutator hooks

* fix: switch to early returns
2021-09-20 13:08:35 -07:00
Beka Westberg
410365f4a1 feat: add support for defining toolboxes using pure json (#5392)
* feat: add recycling to core

* feat: add support for json block definitions in flyout

* tests: reorganize tests

* tests: add tests for generating contents

* Fixup reycling

* tests: add tests for recycling

* fix: types

* fix: lint

* fix: PR comments

* fix: creating blocks from flyout

* test: add test block to playground

* fix: types

* feat: add support for enabled
2021-09-20 13:08:35 -07:00
Beka Westberg
07057d087c feat: adds hooks for serializing plugins (#5276)
* Reformat registry tests

* Add tests for plugin hooks

* Add plugin hooks for serialization

* Switch PluginSerializer to IPluginSerializer

* fix: types

* fix: PR comments

* fix: tests

* cleanup: formatting

* fix: types

* feat: add respecting case in registry

* feat: add separate registry for serializers

* fix: rename serialiation registry alias

* fix: move serializer interface into interface dir
2021-09-20 13:08:35 -07:00
Beka Westberg
486123e4ff fix: insertion markers and change events to work with JSO hooks (#5378)
* fix: add tests for fixing change events

* fix: change events and insertion markers

* fix: build:

* fix: remove duplicate code

* fix: requires
2021-09-20 13:08:35 -07:00
Beka Westberg
1d4cbd1ab6 Add serializing shadows as JSOs for the JSO system (#5246)
* Move existing tests into new suite

* Add tests for setShadowState

* Add assertions for serialization

* Unskip serialization tests

* Add logic to handle shadows in both systems

* Uncomment tests

* fix: add access modifiers to new comment funcs

* fix: fixup types

* fix: remove addNextBlocks = true

* feat: add real child of shadow errors

* fix: types
2021-09-20 13:08:35 -07:00
Beka Westberg
1b47953c58 feat: add serialization and deserialization of comments (#5216)
* Add tests for (de)seralizing icons

* Add logic for (de)serializing icons

* fix: add docs for saveIcons

* fix: add timeout for setting comment visible
2021-09-20 13:08:35 -07:00
Beka Westberg
91922aa571 Add throwing exceptions during deserialization (#5200)
* Add exception definitions

* Add tests for throwing errors during deserialization

* Add actually throwing exceptions

* Cleanup

* Cleanup

* Fix tests

* fix: PR Comments
2021-09-20 13:08:35 -07:00
Beka Westberg
ee78b41987 feat: upgrade block defs to have JSO serialization hooks (#5329)
* Respect nulls from blocks.save

* Upgrade list blocks to use JSO serialization

* Upgrade logic blocks to use JSO serialization

* Upgrade math blocks to use JSO serialization

* Upgrade text blocks to use JSO serialization

* Upgrade procedure blocks to use JSO serialization

* Add more mutator tests

* Fix firing enabled events

* PR Comments
2021-09-20 13:08:35 -07:00
Beka Westberg
bd77b4ad3d fix: touch up some deserialization behavior (#5181)
* Add parameter for recording undo.

This sets up the most common default behavior, but also makes it clear
to people that it is happening, because it might not be expected.

* Add grouping of events

* Add text width caching

* Add disabling workspace resizing

* Add performance optimizations

* Respect nulls from blocks.save

* Cleanup from rebase

* PR Comments

* Cleanup from rebase
2021-09-20 13:08:35 -07:00
Beka Westberg
d3a9e517b2 feat: add top level save and load functions for JSO serialization (#5132)
* Add top-level serialization API

* Add using JSO system in serializer tests

* Make compiler happy
2021-09-20 13:08:35 -07:00
Beka Westberg
28ff2c84c6 feat: add JSO serialization and deserialization of variables (#5131)
* Add variable serialization tests

* Fix requires for new file

* Add serialization and deserialization of variables

* Remove only in tests

* Cleanup
2021-09-20 13:08:35 -07:00
Beka Westberg
56d3cb6c8f feat: add serialization of child blocks (#5120)
* Add tests for serializing connected blocks

* Add serialization of child blocks

* Add tests for not serializing children

* Add options for not serializing children

* Fix types

* Change addNextBlocks to default to true

* Cleanup

* Fix types
2021-09-20 13:08:35 -07:00
Beka Westberg
ceeda333dc Add serialization of basic block attributes to JSOs (#5053)
* Add basic attribute tests

* Add basic block serialization

* Add more attribute tests

* Change save to use options dictionary

* Add obeying save options

* Add test for data attribute

* Add saving data tag

* Move to ES6 syntax

* Fixup move to es6 syntax

* Declare module

* Format and lint

* Add docs

* Add returning null on insertion markers

* Fixup for move to module

* Switch to other function declarations

* Cleanup for finalized style

* Fix lint and types

* Export State def

* Switch disabled=true to enabled=false
2021-09-20 13:08:35 -07:00
Beka Westberg
f77526e558 Move browser event utils from utils.js to browser_events.js (#5464)
* fix: move browser event utils to browserEvents

* fix: mark browser event utils in utils as deprecated

* fix: move uses of browser event funcs to browserEvents

* fix: remove browserEvents definition of noEvent

* fix: add renames for browser event utils

* docs: add suggested alternatives for browser event utils

* fix: change deprecations to stubs

* fix: PR comments
2021-09-17 14:49:01 -07:00
Aaron Dodson
511ce5df2b Migrate core/blockly.js to goog.module syntax (#5494)
* Migrate core/blockly.js to ES6 const/let

* Migrate core/blockly.js to goog.module

* Migrate core/blockly.js to named requires

* clang-format core/blockly.js

* Consolidate accessors in core/blockly.js
2021-09-17 14:30:23 -07:00
Aaron Dodson
7aab18409f Migrate selected from Blockly to Blockly.common (#5489)
* Add getSelected/setSelected to core/common.js

* Migrate core to use Blockly.common.getSelected/setSelected instead of Blockly.selected

* Migrate demos to use Blockly.common.getSelected/setSelected instead of Blockly.selected

* Remove Blockly.selected

* Use variable instead of calling common.getSelected() multiple times

* Add accessor for selected on Blockly

* Add renaming record for Blockly.selected -> Blockly.common.getSelected/setSelected
2021-09-17 11:42:43 -07:00
Christopher Allen
dbf10cf167 Clean up get/set accessor definitions (#5488)
* Use Object.defineProperties instead of .defineProperty when
  installing get and set accessors for previously-mutable exports.

* Add entries to renamings.js where feasible (i.e., for static rather
  than instance properties).

(Don't do blockly.js yet, to avoid merge conflicts.)
2021-09-17 19:30:21 +01:00
Maribeth Bottorff
6dbc534dcc refactor: Move Blockly.svgResize to Blockly.common (#5485)
* refactor: Move Blockly.svgResize to Blockly.common

* fix formatting and deps
2021-09-16 15:53:33 -07:00