Commit Graph

124 Commits

Author SHA1 Message Date
Neil Fraser
aca1a43ec8 Fix regular expressions.
1) Simplifications.
2) Enable toolbox category colours to be specified using the full range of CSS formats (not just hue or #rrggbb).
3) Fix bug where `Blockly.utils.checkMessageReferences('%{BKY_today}  %{BKY_xxx}')` returns true.
2019-06-10 11:03:22 -07:00
Neil Fraser
848d3a3509 Move setCssTransform & createSvgElement to dom.
Also move SVG_NS and HTML_NS properties.
2019-06-07 10:32:57 -07:00
Neil Fraser
3dfac9a2ba Alphabetize require statements.
Search and replace for userAgent didn’t take into account alphabetic ordering.
Also some line wraping.
2019-06-07 10:32:57 -07:00
Neil Fraser
566f182fa8 Move Blockly.userAgent to Blockly.utils.userAgent 2019-06-07 10:32:57 -07:00
Neil Fraser
d1a29739d8 Move utilities into own directory.
TODO: There are more functions which may be migrated into dom and string.
2019-06-07 10:32:57 -07:00
Neil Fraser
5bf7069a2f Remove goog.math.Coordinate 2019-06-07 10:32:57 -07:00
Neil Fraser
931cc85c83 Remove last goog.dom dependency. 2019-06-07 10:32:57 -07:00
Neil Fraser
9f528922a7 Fix some dependencies 2019-05-24 15:45:05 -07:00
Neil Fraser
a4e0091d4e Fix style matching in Firefox 67 (#2485)
Chrome returns ‘transform: translate(107px, 0px);’ whereas Firefox now returns ‘transform: translate(107px);’ if the y value is 0.  This is consistent with existing behaviour in the translate SVG attribute.

The comment in our code specifically states:
// Accounts for same exceptions as XY_REGEX_
Yet that was not true at all.

This PR makes the y argument optional (as falsely described in the comment).  It also merges the 2D and 3D regeps together to simplify the code.

Resolves issue #2482.  Needs to be cherrypicked to Master and everything rebuilt and pushed.
2019-05-24 08:43:22 -07:00
Neil Fraser
4161ba0fa7 Move goog.global to Blockly.utils.global
Can’t use Blockly.global since that’s the last file to load.
2019-05-17 15:04:39 -07:00
Neil Fraser
25bc3e0268 Fix require statements.
Also throw error instead of string.
And stop using goog.asserts.
2019-05-17 15:04:39 -07:00
Neil Fraser
49954e0cec Remove calls to goog.dom.getViewportSize
document.documentElement.clientWidth/clientHeight seems to work everywhere Blockly works.  Closure’s functions are mind-numbingly complex due to IE5, old WebKit, Opera 8, and others.
2019-05-17 15:04:39 -07:00
Neil Fraser
28ad3a9bd3 Blockly.utils.userAgent moved to Blockly.userAgent 2019-05-10 16:56:26 -07:00
Neil Fraser
25ddecab50 Undo workaround for IE10.
Due to no longer supporting IE10, we don’t need the code added here: 92f3880008
2019-05-10 16:39:32 -07:00
Neil Fraser
fa8c7f3884 Lint fix. 2019-05-10 14:30:31 -07:00
Neil Fraser
4062030731 Remove goog.userAgent dependency. 2019-05-10 14:03:21 -07:00
Neil Fraser
f118d33855 Corrections to JSDoc comments 2019-03-29 15:24:37 -07:00
Neil Fraser
e9de083361 Fix @return JSDocs. 2019-03-29 15:24:37 -07:00
Neil Fraser
405b1e4e78 Lint issues found while debugging. 2019-03-27 15:47:29 -07:00
Rachel Fenichel
47fff5cddb Merge pull request #2313 from rachel-fenichel/feature/dropdowndiv
Add dropdowndiv and use it for the colour picker and angle fields
2019-03-01 12:54:39 -08:00
Rachel Fenichel
0b1bd78674 Clarify some dropdown rendering code 2019-02-28 15:11:57 -08:00
Beka Westberg
4e7e712549 Added scroll delta mode constants. 2019-02-21 07:35:44 -08:00
BeksOmega
1c4ba38300 Added Max Instances Property to Workspace Options (#2130)
* Added Max Instances property to Blocks

* eslint cleanup

* eslint cleanup 2

* Moved maxInstances property from block to workspace (as a map of block type to max instances). isDuplicate() changed to correctly handle siblings/branches.

* eslint cleanup

* Changed checking types to map. Added hasBlockLimits. Fixed Nits.

* Added limit_instances test block. eslint fixes.

* fixup! Added limit_instances test block. eslint fixes.

* Changed sorting objects to a private static function of the workspace. Fixed nits. Undeleted .eslintrc

* Reverted .gitignore file.

* Added getBlockTypeCounts() to utils. Added isCapacityAvailable() to workspace. Changed clipboard to save typeCountsMap rather than object.
2018-11-27 16:34:21 -08:00
Neil Fraser
db0dbc69ee Update todos and requires. 2018-10-16 11:34:10 -07:00
Neil Fraser
aa09ad9175 Line wrap at 80. 2018-10-16 11:34:10 -07:00
Neil Fraser
dddb94aedd Fix circular dependency. 2018-10-16 11:34:10 -07:00
Andrew n marshall
411ec9724e Replacing node.parentNode.removeChild(node)
...with Blockly.utils.removeNode(..), which includes
a null/undefined check on parentNode before continuing.
2018-09-04 13:31:53 -07:00
Neil Fraser
c6afb08c4b Add unit tests and code cleanup to utils (#1993)
* Add unit tests for new util functions
* Utils functions shouldn’t be package, not private.
* Use existing utility function for insertAfter
2018-08-03 14:31:50 -07:00
Neil Fraser
6ce31942e0 Some goog.dom removal (#1991) 2018-08-01 15:47:28 -07:00
Neil Fraser
8f7674ea08 Correct requires for goog.events 2018-07-11 12:20:02 -07:00
Neil Fraser
67a18036d0 Fix Travis errors 2018-07-11 12:20:02 -07:00
Neil Fraser
60cce6cd0c Remove goog.math angle functions. 2018-07-11 12:20:02 -07:00
Neil Fraser
06d90c9b34 Remove goog.array 2018-07-11 12:20:02 -07:00
Neil Fraser
03bf9f5e71 Remove goog.string 2018-07-11 12:20:02 -07:00
Neil Fraser
3909bd420a Remove all goog.asserts and goog.isXxx
First step to reducing Closure’s footprint.
2018-07-11 12:20:02 -07:00
Neil Fraser
4cb4b42f8d Use named properties on Msg. 2018-04-27 11:50:51 -07:00
Andrew n marshall
42e229fb4c Removing Blockly.utils.getScale_() and usage. (#1821)
The function only returns 1 for the two cases it was used on,
making the scale multiplication a no-op.
2018-04-24 10:24:03 -07:00
Rachel Fenichel
90a3730424 Fix more compiler warnings 2018-03-14 17:05:19 -07:00
Rachel Fenichel
9a53e96d53 More lint fixes 2018-01-23 18:22:53 -08:00
Neil Fraser
870f7b7f8a Fix document detection.
Andrew LGTMs in person.
2018-01-08 15:10:14 -08:00
Neil Fraser
4262b09002 Resolve 106 warnings. 2017-10-24 14:06:29 -07: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
Rachel Fenichel
078b4fceb3 Revert some whitespace changes to appease eslint (#1370) 2017-10-19 16:08:54 -07:00
Neil Fraser
5c00256e96 Style improvements. No functional changes. (#1367) 2017-10-17 15:19:50 -07:00
Rachel Fenichel
acd3a00f4a Unify code for positioning the widget div (#1334)
* New widget div functions, used in context menu code

* Make all widget div positioning functions use the same argument order

* Use new widget div functions for fields

* share code for measuring menu size

* Get rid of positionMenu

* Update copyright date

* Rebuild blockly_uncompressed because there's a new require in town
2017-09-22 16:07:32 -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
Neil Fraser
fc8d4c90b4 Compatibility for Closure Compiler. (#1240) 2017-07-31 09:07:41 -07:00
Rachel Fenichel
92f3880008 RemoveAttribute doesn't work on SVG elements in IE 10. Use setAttribute to null instead. 2017-03-27 17:25:41 -07:00
Andrew n marshall
b32136d81f Clarification update.
Unraveling nested ternaries in Blockly.utils.tokenizeInterpolation_()
2017-02-14 15:51:24 -08:00
Andrew n marshall
afd1fdeb15 .utils.replaceMessageReferences(..) now gracefully returns non-string arguments. 2017-02-14 11:00:34 -08:00