Commit Graph

57 Commits

Author SHA1 Message Date
Beka Westberg 0fc0e5792c 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 10:32:09 -07:00
Monica Kozbial a9223b0b22 Typo fixes. (#3769) 2020-03-25 15:47:27 -07:00
Jakub Vrána 00bb99e0ff Add non-nullable modifier to return type of functions never returning null (#3742) 2020-03-16 08:14:47 -07:00
Neil Fraser 4e2f8e6e02 Use SPDX licences.
This is a followup to #3127.
At the time, SPDX licenses were pending approval by Google.
2020-02-11 13:27:20 -08:00
Neil Fraser b46a4fe286 Bring our license format up to date (#3127)
* Google changed from an Inc to an LLC.

This happened back in 2017 but we didn’t notice.  Officially we should update files from Inc to LLC when they are changed as part of regular edits, but this is a nightmare to remember for the next decade.

* Remove project description/titles from licenses

This is no longer part of Google’s header requirements.  Our existing descriptions were useless (“Visual Blocks Editor”) or grossly obselete (“Visual Blocks Language”).

* License no longer requires URL.

* Fix license regexps.
2019-10-02 14:46:56 -07:00
Neil Fraser 0add3a5e3e Add require statements to all block files. 2019-09-18 13:00:44 -07:00
Rachel Fenichel f717add5a5 Block annotations (#2997)
* Replace `@this Blockly.Block` with `@this {Blockly.Block}` in all block files.

* Fix 9 compiler warnings (JSC_USED_GLOBAL_THIS)
2019-09-11 17:50:52 -07:00
Neil Fraser 52b6ce18a5 Fix unit tests 2019-07-08 13:29:43 -07:00
Beka Westberg 73ff710a4d Added getSourceBlock function to field. (#2508) 2019-05-29 12:50:00 -07:00
alschmiedt 4982c5c310 Changes names for block styles 2019-01-08 09:40:30 -08:00
alschmiedt d9c4608da8 Remove use of style variables in block definition 2018-12-20 10:09:47 -08:00
alschmiedt 034bcb00bb Replace setting colour to setting style in block definitions 2018-12-18 10:01:05 -08:00
Nadya Febiana Djojosantoso 633bbbc8fa Add math_atan2 block with two inputs 2018-10-11 13:12:23 -07:00
Neil Fraser 4cb4b42f8d Use named properties on Msg. 2018-04-27 11:50:51 -07:00
Andrew n marshall ab8692652a Revert "Removing namespace declarations for deprecated and unused namespaces. (#1796)" (#1809)
This reverts commit 75459abfdd.
2018-04-20 08:08:11 -07:00
Andrew n marshall 75459abfdd Removing namespace declarations for deprecated and unused namespaces. (#1796)
These namespaces use to contain the original block hue constants,
but were deprecated (via comment, except for procedures) over a year
ago. With the removal of those constants, the declarations were
creating empty, unused objects.
2018-04-18 15:32:26 -07:00
Andrew n marshall e9d8e00a55 Making all blocks use the MSG colour values. (#1749)
* Making all blocks use the MSG colour values.
 * Deprecating Blockly.Constants.Lists.HUE and similar constants.
 * Removing deprecated Blockly.Blocks.lists.HUE constants.
 * Allowing message references in the Block.setColour() parameter.
 * Adding checking of older constants, ensuring they are not overwritten.
2018-04-09 17:37:47 -07:00
Andrew n marshall f45c6faf05 Fix #1619. buildTooltipWithFieldValue() => buildTooltipWithFieldText() (#1638)
Fix #1619. buildTooltipWithFieldValue() => buildTooltipWithFieldText()

The "value" of FieldVariables was the variable id.
However, we usually want the field text for the human visible tooltip.
Refactoring and renaming buildTooltipWithFieldValue to use the field
text.
2018-02-16 16:51:18 -08:00
Andrew n marshall f992ea0f9c Fix #1369: resource loading order constraints, interpolation tokens in message expansion (PR #1383)
This fixes race condition in #1369 by using message references instead of explicit string lookups. This required fixing a bug the token interpolation parser that was breaking on the inner '"%1"' for these tooltips.
2017-10-24 13:02:14 -07:00
Neil Fraser 5c00256e96 Style improvements. No functional changes. (#1367) 2017-10-17 15:19:50 -07:00
Tom a6245f4c6e Compile messages with externs and demo with advanced optimizations (#1259)
* Revert "Fix synonyms when compiled. (#1248)"

This reverts commit f08afbb351.

* Revert "Compatibility for Closure Compiler. (#1240)" [fc8d4c9]

* Adding exports to all messages.

* Fixed missing dependency to Blockly.defineBlocksWithJsonArray()

* Adding a fully compiled demo draft (still simple optimizations).

* Demo optimizations switched to advanced and enabled exports (for Blockly.Msg).

* Message interpolation updated to use the exported (global) Blockly.Msg array.

* Adding some debug compilation options to the build script.

* Adding SVG externs.

* Fixed Blockly.inject's config array to work with compilation.

* Reverting all compiled code.

This fixes commit b307ba1151.
This fixes commit dec6910b67.

* Reverting all compiled code.

This fixes commit 824c806ec3.

* Removing old todo

* Merge commit 'fe96bec765f0eb58c5321101965100c2716760ed' into compile-messages-with-externs

* commit 'fe96bec765f0eb58c5321101965100c2716760ed':
  Fixes positional index for Czech translation (#1264)
  Missed one use of string instead of .property in extensions.js (#1262)
  Update extensions.js to be compatible with ADVANCED_OPTIMIZATIONS (#1253)
  Fix type tags and todo placement.
  Procedure block renames variable in mutator if there is a case change.

* Fixes based on review by @NeilFraser
- 80 cols
- using goog.global instead of window
- @export on the same line as messages

* BF: Moving the msg dependency earlier, since Blockly.Msg.en is filling the Blockly.Msg object, which is empty without Blockly.Msg.en (and the rest of the code is using it as Blockly.Msg).

* Updating some texts in the demo's html file to be more descriptive.

* Commenting the debug options in the build, to maximize the optimizations. They are not removed, to allow anybody to turn them on if needed (since they are not documented on the Closure Compiler's REST API pages).

* BF: fixed blocks_compressed.js compilation, as it now requires Blockly namespace to exist.

* SVG externs file updated based on the one in https://github.com/google/closure-compiler/blob/master/contrib/externs/svg.js (eliminating 2 warnings)
2017-08-08 11:16:49 -07:00
Andrew n marshall b5f91dd054 Typo in comment. 2017-03-02 08:34:27 -08:00
Rachel Fenichel aa8e996799 Handle mutations with both mixins and functions 2017-02-23 17:07:06 -08:00
Andrew n marshall a4cfd5cbc8 Porting Loop blocks to JSON (#919)
* Improved documentation on `Blockly.Extensions.buildTooltipForDropdown`
 * Replaced incorrect uses of `@mixes` JSDoc annotation (on mixin extensions) with `@augments Blockly.Block`.
 * Added Blockly.Extensions.buildTooltipWithFieldValue() extension helper.
2017-02-08 11:36:38 -08:00
Andrew n marshall d97edf0dde Blockly.Constants.Math and Blockly.Constants.Colour extension constants (#916)
Also, correcting quotes in logic.js.
2017-02-06 16:20:48 -08:00
Andrew n marshall 680fc4b6d3 Porting Logic blocks to JSON (#913)
Extensions, mixins, mutators and constants now grouped under the new namespace Blockly.Constants.Logic.
2017-02-06 13:40:05 -08:00
Rachel Fenichel e429e0c42f Merge pull request #912 from rachel-fenichel/lint
Fix some lint errors
2017-02-06 12:39:45 -08:00
Andrew n marshall 15827c5d30 Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin(). (#907)
Adds Block.prototype.mixin() and Blockly.Extensions.registerMixin().
This adds support for a common use pattern in extensions, and adds
error checking to avoid future incompatibilities.
2017-02-06 10:00:08 -08:00
Rachel Fenichel 4152542c2f Fix some lint errors 2017-02-03 14:01:18 -08:00
Andrew n marshall 709295a689 Correcting math_change color 2017-01-23 17:03:05 -08:00
Andrew n marshall 7b0275cd70 Porting math.js blocks to JSON (#846)
Moving all `math.js` definitions into a single JSON array, complete with i18n syntax for all messages, dropdowns, and tooltips.

Adding Blockly.Extensions.buildTooltipForDropdown(..) to facilitate the creation and error-checking of tooltips that update based on the value of a dropdown.

Now warn on raw string in JSON 'extensions'.
2017-01-23 10:23:55 -08:00
Andrew n marshall 78dc5ed9c2 JSON definitions for colour blocks (#838)
Replaces old colour block definitions with a Blockly.defineBlocksWithJsonArray(..) call. Generator unit tests continue to load and pass, signifying compatibility with prior block definitions.

Replaces extension 'math_number_tooltip' with the reusable 'parent_tooltip_when_inline' extension, also used by colour_picker. Includes tests.
2017-01-18 13:48:46 -08:00
Andrew n marshall a47bd93f4c Adding extensions for JSON support of dynamic blocks. (#834)
Adding support for extensions, functions that can assist with loading blocks, much like init functions, but that can be referenced from JSON definitions. This allows JSON definitions to define dynamic blocks such as onchange handlers and mutators.

Rewrote math_number as an example pure JSON block.
2017-01-18 12:45:39 -08:00
Rachel Fenichel 5418843c12 Move the change block to the variables category 2016-07-07 14:39:45 -07:00
Neil Fraser 732e9b0659 Start using field_number. 2016-06-21 04:10:32 -07:00
rachel-fenichel f468b6a6cb Merge pull request #357 from rachel-fenichel/feature/field_number_js
Add lightweight field_number
2016-05-05 12:32:01 -07:00
Rachel Fenichel d89d8a2113 Add lightweight field_number 2016-05-04 13:30:18 -07:00
Neil Fraser ea71cec0c7 Trivial blocks only inherit tooltip from parent if on external inputs.
Recompile.
2016-05-03 17:49:10 -07:00
Neil Fraser 05f5af3df1 JSON some math block. 2016-04-04 14:56:00 -07:00
Neil Fraser 4c542240e2 Provide default getVars and renameVar functions. Issue 265. 2016-02-27 12:28:32 -08:00
Neil Fraser 06858e8972 Trivial number/text/colour blocks should inherit parent's tooltip. 2016-02-02 16:20:02 -08:00
Neil Fraser 8d87f73f45 Fix types in lists_split block. 2015-07-28 13:00:03 -07:00
Neil Fraser 179052792c Save dynamic output types in XML. 2015-07-22 17:17:01 -07:00
Neil Fraser e300931071 Allow multiple interpolation messages. Fix variable context menus. 2015-06-27 12:49:01 -07:00
Neil Fraser edd3e3bf33 Lint corrections. 2015-06-17 13:05:24 -07:00
Neil Fraser 059c2f1778 Add automatic mode for internal/external input layout. 2015-06-10 18:45:15 -07:00
Neil Fraser 838a6a954b Remove interpolateMsg. 2015-06-08 18:38:33 -07:00
Neil Fraser 9050e32954 Adding JsonInit method of creating blocks. 2015-06-08 15:54:18 -07:00
Neil Fraser ddcf1ac969 Factor out hues into constants. 2015-01-26 01:20:03 -08:00
Neil Fraser e69f5f4502 Add list/text join/split block. 2015-01-18 16:54:30 -08:00