Commit Graph

87 Commits

Author SHA1 Message Date
Neil Fraser
ae39fb9e23 Add supressPrefixSuffix to if/else block
Alternatively, this could be done by using an extension, rather than JSON.  I have no preference.
Issue #5268.
2021-08-04 10:19:25 -07:00
Neil Fraser
d919b0af21 Update JSDoc from Array.<> to Array<>
Same with Object.
2021-05-27 21:30:26 -07:00
Beka Westberg
04ea0f1397 Fixes mutators considering insertion markers during compose (#4449)
* Fix markers for lists, logic, and text

* Fix insertion markers in procedure mutators
2020-11-17 13:32:36 -08:00
Rachel Fenichel
7288c66294 Rename connectionTypeChecker->connectionChecker 2020-07-16 17:40:13 -06:00
Rachel Fenichel
e24f3cef9b Add isDragging to canConnectWithReason and delete newly unused code paths. 2020-07-16 17:40:13 -06:00
Rachel Fenichel
bb8348befd Move to a single canConnect function, and update tests 2020-07-16 17:40:12 -06:00
Rachel Fenichel
c743a92bb9 Start work on connection type checker 2020-07-16 17:40:12 -06: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
Beka Westberg
1ce97d1c50 Added checking if the block is disposed before trying to reconnect in logic_compare block. 2019-11-04 14:41:45 -08:00
Sam El-Husseini
52bef4463c Fix warnings related to connections. (#3306)
* Fix warnings related to connections.
2019-10-23 17:56:52 -04:00
Sam El-Husseini
d0772ad496 Fix compiler warnings related to fields. (#3144)
* Fix compiler warnings related to fields.
2019-10-03 15:58:46 -07: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
84a814cda1 Make mutator an optional module. (#3048) 2019-09-19 11:39:55 -07:00
Neil Fraser
0add3a5e3e Add require statements to all block files. 2019-09-18 13:00:44 -07:00
Neil Fraser
5650fe51a2 Typos. 2019-09-12 18:24:48 -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
Neil Fraser
b8cbd9e7df Resolve 13 warnings
Reduce count from 632 to 619.
Eliminate copy-paste code duplication in Field.prototype.setValue
2019-06-12 10:59:33 -07:00
Neil Fraser
c0e14c3a7c Add method to suppress prefix/suffix from blocks.
This allows generators to have more control over the placement of suffix.  Needed for ‘if’ blocks and function calls which require their suffix code to be somewhere other than the end.
Also, add loop’s prefix to ‘break’ blocks, since the loop’s suffix will be the next statement hit.
Also, reuse procedures_callreturn generator for procedures_callnoreturn.
2019-05-14 17:19:31 -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
f125065a17 Merge branch 'develop' of https://github.com/alschmiedt/blockly into blockly_colours 2018-12-19 10:39:10 -08:00
alschmiedt
034bcb00bb Replace setting colour to setting style in block definitions 2018-12-18 10:01:05 -08:00
alschmiedt
3bf9337205 Fixed comment 2018-12-13 10:32:38 -08:00
alschmiedt
094418f928 Reconnects child blocks when an undo is done on an else block 2018-12-13 08:11:16 -08:00
Neil Fraser
c8bfc888c8 Throw errors instead of strings. (#1974)
Blocks and generators
2018-07-16 16:33:44 -07:00
Neil Fraser
6319cab317 Simplify RTL handling of '<' and '>'. (#1823)
Tested in Playground and RTL demo.
2018-05-10 15:34:06 -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
ef23b0e4ef Do not reconnect a previous shadow block.
Assume unplug() will recreate a new correct shadow.
2018-04-13 16:26:20 -07:00
Andrew n marshall
c0e220214c Rewrote LOGIC_COMPARE_ONCHANGE_MIXIN to fix #1408.
* Create prevBlock_ upon first call to onchange.
 * Revert state upon an incompatible combination, bumping the new incompatible
   block, instead of the old block. Thus, the shadow is never the bumped block.

Bug:
 * The undo stack get caught in a loop, and will never undo back to a state
   equivalent to the previous action.
2018-04-12 17:27:20 -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
Neil Fraser
870f7b7f8a Fix document detection.
Andrew LGTMs in person.
2018-01-08 15:10:14 -08: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
picklesrus
36fa5f6016 Fix #986. Looks like the original PR just forgot this block. (#992) 2017-03-23 10:20:42 -07:00
Rachel Fenichel
aa8e996799 Handle mutations with both mixins and functions 2017-02-23 17:07:06 -08:00
Rachel Fenichel
455432250e Use mutator extension for controls_if block 2017-02-22 17:05:52 -08:00
Andrew n marshall
feed5ffc6d Renamed extension function constant, and moved variables into the mixin. 2017-02-14 09:37:45 -08:00
Andrew n marshall
6919f588f8 extension controls_if => controls_if_mutator. 2017-02-14 09:37:45 -08:00
Andrew n marshall
2e8d107682 Correcting output of the logic_null block. 2017-02-13 16:28:43 -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
49c9c024e4 Correction to logic_ternary type check (#920) 2017-02-08 10:16:59 -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
Andrew n marshall
4fdd16b499 JSON support for message lookup in colour, tooltip, and help URL. (#825)
String replacement for the colour, tooltip text and help URL attributes of JSON defined blocks.
Demonstrated in logic_boolean.
2017-01-13 16:54:27 -08:00
Andrew n marshall
ac3df2759c PR #818: Adding support for string table lookups in dropdown field labels
Adding support for string table lookups in dropdown field labels specified in JSON.

Adds Blockly.utils.replaceMessageReferences() method to handle string replacement without interpolation tokens.  Effectively uses the same old code, now moved into tokenizeInterpolation_(), which takes a parseInterpolationTokens option.

Replaces the direct JavaScript references (not pure JSON, and thus not portable).

Demonstrating this behavior in the logic_boolean dropdown.
2017-01-11 15:47:56 -08:00
Andrew n marshall
dd95203cdc controls_ifelse: Remove right-align. Remove Boolean check on statements. (#749) 2016-11-16 09:55:58 -08:00
Neil Fraser
c27841f8df Fix compiler errors. 2016-11-15 16:41:11 -08:00