diff --git a/.eslintignore b/.eslintignore index c884c6b9e..792c074e6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,6 +4,7 @@ gulpfile.js /msg/* /core/utils/global.js /tests/blocks/* +/tests/themes/* /tests/compile/* /tests/jsunit/* /tests/generators/* @@ -16,3 +17,4 @@ gulpfile.js /appengine/* /externs/* /closure/* +/scripts/gulpfiles/* diff --git a/.travis.yml b/.travis.yml index 643c96a63..287cf1f5a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ node_js: addons: chrome: stable firefox: latest - # TODO (#2114): reenable osx build. + # TODO (#2114): re-enable osx build. # - os: osx # node_js: stable # osx_image: xcode8.3 diff --git a/appengine/.gcloudignore b/appengine/.gcloudignore index 83d812a47..8a3772bae 100644 --- a/appengine/.gcloudignore +++ b/appengine/.gcloudignore @@ -1,23 +1,24 @@ # Do not upload these files. .* -deploy *.soy -static/appengine/ -static/closure/ -static/demos/plane/soy/*.jar -static/demos/plane/xlf/ -static/externs/ -static/i18n/ -static/msg/json/ -static/node_modules/ -static/package/ -static/theme_scripts/ -static/typings/ +*.komodoproject +/deploy +/static/appengine/ +/static/closure/ +/static/demos/plane/soy/*.jar +/static/demos/plane/xlf/ +/static/externs/ +/static/i18n/ +/static/msg/json/ +/static/node_modules/ +/static/package/ +/static/theme_scripts/ +/static/typings/ -static/build.py -static/gulpfile.js -static/jsconfig.json -static/LICENSE -static/package-lock.json -static/package.json -static/README.md +/static/build.py +/static/gulpfile.js +/static/jsconfig.json +/static/LICENSE +/static/package-lock.json +/static/package.json +/static/README.md diff --git a/appengine/README.txt b/appengine/README.txt index 6ba262bba..caaa8e7b7 100644 --- a/appengine/README.txt +++ b/appengine/README.txt @@ -11,12 +11,13 @@ structure: blockly/ |- app.yaml + |- deploy |- index.yaml - |- index_redirect.py + |- main.py |- README.txt + |- requirements.txt |- storage.js |- storage.py - |- closure-library/ (Optional) `- static/ |- blocks/ |- core/ @@ -26,7 +27,7 @@ blockly/ |- msg/ |- tests/ |- blockly_compressed.js - |- blockly_uncompressed.js (Optional) + |- blockly_uncompressed.js |- blocks_compressed.js |- dart_compressed.js |- javascript_compressed.js @@ -34,11 +35,8 @@ blockly/ |- php_compressed.js `- python_compressed.js -Instructions for fetching the optional Closure library may be found here: - https://developers.google.com/blockly/guides/modify/web/closure - Go to https://appengine.google.com/ and create your App Engine application. -Modify the 'application' name of app.yaml to your App Engine application name. +Modify the 'PROJECT' name in the 'deploy' file to your App Engine application name. Finally, upload this directory structure to your App Engine account, -wait a minute, then go to http://YOURAPPNAME.appspot.com/ +then go to http://YOURAPPNAME.appspot.com/ diff --git a/appengine/storage.js b/appengine/storage.js index dc62a0035..82a74052a 100644 --- a/appengine/storage.js +++ b/appengine/storage.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/blockly_compressed.js b/blockly_compressed.js index c21c79d82..08b305a36 100644 --- a/blockly_compressed.js +++ b/blockly_compressed.js @@ -1,8 +1,7 @@ // Do not edit this file; automatically generated by gulp. -'use strict';var Blockly={constants:{},LINE_MODE_MULTIPLIER:40,PAGE_MODE_MULTIPLIER:125,DRAG_RADIUS:5,FLYOUT_DRAG_RADIUS:10,SNAP_RADIUS:28};Blockly.CONNECTING_SNAP_RADIUS=Blockly.SNAP_RADIUS;Blockly.CURRENT_CONNECTION_PREFERENCE=8;Blockly.INSERTION_MARKER_COLOUR="#000000";Blockly.BUMP_DELAY=250;Blockly.BUMP_RANDOMNESS=10;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.SOUND_LIMIT=100;Blockly.DRAG_STACK=!0;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65; -Blockly.SPRITE={width:96,height:124,url:"sprites.png"};Blockly.INPUT_VALUE=1;Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE; -Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT;Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.DELETE_AREA_NONE=null;Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE"; -Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.utils={};Blockly.utils.global=function(){return"object"===typeof self?self:"object"===typeof window?window:"object"===typeof global?global:this}();Blockly.Msg={};Blockly.utils.global.Blockly||(Blockly.utils.global.Blockly={});Blockly.utils.global.Blockly.Msg||(Blockly.utils.global.Blockly.Msg=Blockly.Msg);Blockly.utils.colour={}; +'use strict';var Blockly={constants:{},LINE_MODE_MULTIPLIER:40,PAGE_MODE_MULTIPLIER:125,DRAG_RADIUS:5,FLYOUT_DRAG_RADIUS:10,SNAP_RADIUS:28};Blockly.CONNECTING_SNAP_RADIUS=Blockly.SNAP_RADIUS;Blockly.CURRENT_CONNECTION_PREFERENCE=8;Blockly.BUMP_DELAY=250;Blockly.BUMP_RANDOMNESS=10;Blockly.COLLAPSE_CHARS=30;Blockly.LONGPRESS=750;Blockly.SOUND_LIMIT=100;Blockly.DRAG_STACK=!0;Blockly.HSV_SATURATION=.45;Blockly.HSV_VALUE=.65;Blockly.SPRITE={width:96,height:124,url:"sprites.png"};Blockly.INPUT_VALUE=1; +Blockly.OUTPUT_VALUE=2;Blockly.NEXT_STATEMENT=3;Blockly.PREVIOUS_STATEMENT=4;Blockly.DUMMY_INPUT=5;Blockly.ALIGN_LEFT=-1;Blockly.ALIGN_CENTRE=0;Blockly.ALIGN_RIGHT=1;Blockly.DRAG_NONE=0;Blockly.DRAG_STICKY=1;Blockly.DRAG_BEGIN=1;Blockly.DRAG_FREE=2;Blockly.OPPOSITE_TYPE=[];Blockly.OPPOSITE_TYPE[Blockly.INPUT_VALUE]=Blockly.OUTPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.OUTPUT_VALUE]=Blockly.INPUT_VALUE;Blockly.OPPOSITE_TYPE[Blockly.NEXT_STATEMENT]=Blockly.PREVIOUS_STATEMENT; +Blockly.OPPOSITE_TYPE[Blockly.PREVIOUS_STATEMENT]=Blockly.NEXT_STATEMENT;Blockly.TOOLBOX_AT_TOP=0;Blockly.TOOLBOX_AT_BOTTOM=1;Blockly.TOOLBOX_AT_LEFT=2;Blockly.TOOLBOX_AT_RIGHT=3;Blockly.DELETE_AREA_NONE=null;Blockly.DELETE_AREA_TRASH=1;Blockly.DELETE_AREA_TOOLBOX=2;Blockly.VARIABLE_CATEGORY_NAME="VARIABLE";Blockly.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC";Blockly.PROCEDURE_CATEGORY_NAME="PROCEDURE";Blockly.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID";Blockly.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID";Blockly.utils={};Blockly.utils.global=function(){return"object"===typeof self?self:"object"===typeof window?window:"object"===typeof global?global:this}();Blockly.Msg={};Blockly.utils.global.Blockly||(Blockly.utils.global.Blockly={});Blockly.utils.global.Blockly.Msg||(Blockly.utils.global.Blockly.Msg=Blockly.Msg);Blockly.utils.colour={}; Blockly.utils.colour.parse=function(a){a=String(a).toLowerCase().trim();var b=Blockly.utils.colour.names[a];if(b)return b;b="0x"==a.substring(0,2)?"#"+a.substring(2):a;b="#"==b[0]?b:"#"+b;if(/^#[0-9a-f]{6}$/.test(b))return b;if(/^#[0-9a-f]{3}$/.test(b))return["#",b[1],b[1],b[2],b[2],b[3],b[3]].join("");var c=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return c&&(a=Number(c[1]),b=Number(c[2]),c=Number(c[3]),0<=a&&256>a&&0<=b&&256>b&&0<=c&&256>c)?Blockly.utils.colour.rgbToHex(a,b, c):null};Blockly.utils.colour.rgbToHex=function(a,b,c){b=a<<16|b<<8|c;return 16>a?"#"+(16777216|b).toString(16).substr(1):"#"+b.toString(16)};Blockly.utils.colour.hexToRgb=function(a){a=Blockly.utils.colour.parse(a);if(!a)return[0,0,0];a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]}; Blockly.utils.colour.hsvToHex=function(a,b,c){var d=0,e=0,f=0;if(0==b)f=e=d=c;else{var g=Math.floor(a/60),h=a/60-g;a=c*(1-b);var k=c*(1-b*h);b=c*(1-b*(1-h));switch(g){case 1:d=k;e=c;f=a;break;case 2:d=a;e=c;f=b;break;case 3:d=a;e=k;f=c;break;case 4:d=b;e=a;f=c;break;case 5:d=c;e=a;f=k;break;case 6:case 0:d=c,e=b,f=a}}return Blockly.utils.colour.rgbToHex(Math.floor(d),Math.floor(e),Math.floor(f))}; @@ -46,15 +45,18 @@ Blockly.Events.fromJson=function(a,b){switch(a.type){case Blockly.Events.CREATE: new Blockly.Events.VarRename(null,"");break;case Blockly.Events.UI:c=new Blockly.Events.Ui(null,"","","");break;case Blockly.Events.COMMENT_CREATE:c=new Blockly.Events.CommentCreate(null);break;case Blockly.Events.COMMENT_CHANGE:c=new Blockly.Events.CommentChange(null,"","");break;case Blockly.Events.COMMENT_MOVE:c=new Blockly.Events.CommentMove(null);break;case Blockly.Events.COMMENT_DELETE:c=new Blockly.Events.CommentDelete(null);break;case Blockly.Events.FINISHED_LOADING:c=new Blockly.Events.FinishedLoading(b); break;default:throw Error("Unknown event type.");}c.fromJson(a);c.workspaceId=b.id;return c}; Blockly.Events.disableOrphans=function(a){if((a.type==Blockly.Events.MOVE||a.type==Blockly.Events.CREATE)&&a.workspaceId){var b=Blockly.Workspace.getById(a.workspaceId);if(a=b.getBlockById(a.blockId)){var c=a.getParent();if(c&&c.isEnabled())for(b=a.getDescendants(!1),a=0;c=b[a];a++)c.setEnabled(!0);else if((a.outputConnection||a.previousConnection)&&!b.isDragging()){do a.setEnabled(!1),a=a.getNextBlock();while(a)}}}};Blockly.Events.Abstract=function(){this.workspaceId=void 0;this.group=Blockly.Events.getGroup();this.recordUndo=Blockly.Events.recordUndo};Blockly.Events.Abstract.prototype.toJson=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};Blockly.Events.Abstract.prototype.fromJson=function(a){this.group=a.group};Blockly.Events.Abstract.prototype.isNull=function(){return!1};Blockly.Events.Abstract.prototype.run=function(a){}; -Blockly.Events.Abstract.prototype.getEventWorkspace_=function(){if(this.workspaceId)var a=Blockly.Workspace.getById(this.workspaceId);if(!a)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return a};Blockly.utils.object={};Blockly.utils.object.inherits=function(a,b){a.superClass_=b.prototype;a.prototype=Object.create(b.prototype);a.prototype.constructor=a};Blockly.utils.object.mixin=function(a,b){for(var c in b)a[c]=b[c]};Blockly.utils.object.values=function(a){return Object.values?Object.values(a):Object.keys(a).map(function(b){return a[b]})};Blockly.Events.Ui=function(a,b,c,d){Blockly.Events.Ui.superClass_.constructor.call(this);this.blockId=a?a.id:null;this.workspaceId=a?a.workspace.id:void 0;this.element=b;this.oldValue=c;this.newValue=d;this.recordUndo=!1};Blockly.utils.object.inherits(Blockly.Events.Ui,Blockly.Events.Abstract);Blockly.Events.Ui.prototype.type=Blockly.Events.UI; +Blockly.Events.Abstract.prototype.getEventWorkspace_=function(){if(this.workspaceId)var a=Blockly.Workspace.getById(this.workspaceId);if(!a)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return a};Blockly.utils.object={};Blockly.utils.object.inherits=function(a,b){a.superClass_=b.prototype;a.prototype=Object.create(b.prototype);a.prototype.constructor=a};Blockly.utils.object.mixin=function(a,b){for(var c in b)a[c]=b[c]};Blockly.utils.object.deepMerge=function(a,b){for(var c in b)a[c]="object"===typeof b[c]?Blockly.utils.object.deepMerge(a[c]||Object.create(null),b[c]):b[c];return a};Blockly.utils.object.values=function(a){return Object.values?Object.values(a):Object.keys(a).map(function(b){return a[b]})};Blockly.Events.Ui=function(a,b,c,d){Blockly.Events.Ui.superClass_.constructor.call(this);this.blockId=a?a.id:null;this.workspaceId=a?a.workspace.id:void 0;this.element=b;this.oldValue=c;this.newValue=d;this.recordUndo=!1};Blockly.utils.object.inherits(Blockly.Events.Ui,Blockly.Events.Abstract);Blockly.Events.Ui.prototype.type=Blockly.Events.UI; Blockly.Events.Ui.prototype.toJson=function(){var a=Blockly.Events.Ui.superClass_.toJson.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.blockId&&(a.blockId=this.blockId);return a};Blockly.Events.Ui.prototype.fromJson=function(a){Blockly.Events.Ui.superClass_.fromJson.call(this,a);this.element=a.element;this.newValue=a.newValue;this.blockId=a.blockId};Blockly.utils.dom={};Blockly.utils.dom.SVG_NS="http://www.w3.org/2000/svg";Blockly.utils.dom.HTML_NS="http://www.w3.org/1999/xhtml";Blockly.utils.dom.XLINK_NS="http://www.w3.org/1999/xlink";Blockly.utils.dom.Node={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16};Blockly.utils.dom.cacheWidths_=null;Blockly.utils.dom.cacheReference_=0;Blockly.utils.dom.canvasContext_=null; Blockly.utils.dom.createSvgElement=function(a,b,c){a=document.createElementNS(Blockly.utils.dom.SVG_NS,a);for(var d in b)a.setAttribute(d,b[d]);document.body.runtimeStyle&&(a.runtimeStyle=a.currentStyle=a.style);c&&c.appendChild(a);return a};Blockly.utils.dom.addClass=function(a,b){var c=a.getAttribute("class")||"";if(-1!=(" "+c+" ").indexOf(" "+b+" "))return!1;c&&(c+=" ");a.setAttribute("class",c+b);return!0}; Blockly.utils.dom.removeClass=function(a,b){var c=a.getAttribute("class");if(-1==(" "+c+" ").indexOf(" "+b+" "))return!1;c=c.split(/\s+/);for(var d=0;db||b>this.getChildCount())throw Error(Blockly.Component.Error.CHILD_INDEX_OUT_OF_BOUNDS);this.childIndex_[a.getId()]=a;if(a.getParent()==this){var d=this.children_.indexOf(a);-1>>/g,a),a=document.createElement("style"),a.id="blockly-common-style",c=document.createTextNode(c),a.appendChild(c),document.head.insertBefore(a,document.head.firstChild))}};Blockly.Css.setCursor=function(a){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")}; @@ -77,25 +79,25 @@ Blockly.Css.CONTENT=[".blocklySvg {","background-color: #fff;","outline: none;", "border-top-left-radius: 4px;","border-color: inherit;","}",".blocklyArrowBottom {","border-bottom: 1px solid;","border-right: 1px solid;","border-bottom-right-radius: 4px;","border-color: inherit;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #515A5A;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPathLight {", "fill: none;","stroke-linecap: round;","stroke-width: 1;","}",".blocklySelected>.blocklyPathLight {","display: none;","}",".blocklyDraggable {",'cursor: url("<<>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyBlockDragSurface .blocklyDraggable {", 'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDragging>.blocklyPathDark {","display: none;","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;","}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {", -"display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none","}",".blocklyMultilineText {","font-family: monospace;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyBubbleText {","fill: #000;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklyText text {","cursor: default;","}",".blocklySvg text, .blocklyBlockDragSurface text {", -"user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;", -"}",".blocklyHtmlInput {","border: none;","border-radius: 4px;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","display: block;","box-sizing: border-box;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyMainWorkspaceScrollbar {", -"z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,", -".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem {","padding-left: 28px;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl {", -"padding-left: 5px;","padding-right: 28px;","}",".blocklyVerticalMarker {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<>>/sprites.png) no-repeat -48px -16px;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;", -"border-color: transparent;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyWidgetDiv .goog-menu.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;', +"display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none","}",".blocklyMultilineText {","font-family: monospace;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklyText text {","cursor: default;","}",".blocklySvg text, .blocklyBlockDragSurface text {","user-select: none;","-ms-user-select: none;", +"-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;","}",".blocklyHtmlInput {","border: none;","border-radius: 4px;", +"height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","display: block;","box-sizing: border-box;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyMainWorkspaceScrollbar {","z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;", +"}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {", +"fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem {","padding-left: 28px;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl {", +"padding-left: 5px;","padding-right: 28px;","}",".blocklyVerticalMarker {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","pointer-events: none","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<>>/sprites.png) no-repeat -48px -16px;","}",".blocklyWidgetDiv .goog-menu {", +"background: #fff;","border-color: transparent;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyWidgetDiv .goog-menu.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;', "outline: none;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem,",".blocklyDropDownDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","min-width: 7em;","border: none;","padding: 6px 15px;","white-space: nowrap;","cursor: pointer;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem,",".blocklyDropDownDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyDropDownDiv .goog-menu-noicon .goog-menuitem {", "padding-left: 12px;","}",".blocklyWidgetDiv .goog-menuitem-content,",".blocklyDropDownDiv .goog-menuitem-content {","font-family: Arial, sans-serif;","font-size: 13px;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","}",".blocklyDropDownDiv .goog-menuitem-content {","color: #000;","}",".blocklyWidgetDiv .goog-menuitem-disabled,",".blocklyDropDownDiv .goog-menuitem-disabled {","cursor: inherit;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content,",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-content {", "color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: .3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight ,",".blocklyDropDownDiv .goog-menuitem-highlight {","background-color: rgba(0,0,0,.1);","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-icon {", "background-repeat: no-repeat;","height: 16px;","left: 6px;","position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,", ".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","position: static;","float: left;","margin-left: -24px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","float: right;","margin-right: -24px;","}",".blocklyComputeCanvas {", -"position: absolute;","width: 0;","height: 0;","}",".blocklyNoPointerEvents {","pointer-events: none;","}"];Blockly.utils.math={};Blockly.utils.math.toRadians=function(a){return a*Math.PI/180};Blockly.utils.math.toDegrees=function(a){return 180*a/Math.PI};Blockly.utils.math.clamp=function(a,b,c){if(ce.top?Blockly.DropDownDiv.getPositionAboveMetrics_(c,d,e,f):b+f.heightdocument.documentElement.clientTop?Blockly.DropDownDiv.getPositionAboveMetrics_(c, d,e,f):Blockly.DropDownDiv.getPositionTopOfPageMetrics_(a,e,f)};Blockly.DropDownDiv.getPositionBelowMetrics_=function(a,b,c,d){a=Blockly.DropDownDiv.getPositionX(a,c.left,c.right,d.width);return{initialX:a.divX,initialY:b,finalX:a.divX,finalY:b+Blockly.DropDownDiv.PADDING_Y,arrowX:a.arrowX,arrowY:-(Blockly.DropDownDiv.ARROW_SIZE/2+Blockly.DropDownDiv.BORDER_SIZE),arrowAtTop:!0,arrowVisible:!0}}; @@ -104,13 +106,15 @@ Blockly.DropDownDiv.getPositionTopOfPageMetrics_=function(a,b,c){a=Blockly.DropD Blockly.DropDownDiv.isVisible=function(){return!!Blockly.DropDownDiv.owner_};Blockly.DropDownDiv.hideIfOwner=function(a,b){return Blockly.DropDownDiv.owner_===a?(b?Blockly.DropDownDiv.hideWithoutAnimation():Blockly.DropDownDiv.hide(),!0):!1}; Blockly.DropDownDiv.hide=function(){var a=Blockly.DropDownDiv.DIV_;a.style.transform="translate(0, 0)";a.style.opacity=0;Blockly.DropDownDiv.animateOutTimer_=setTimeout(function(){Blockly.DropDownDiv.hideWithoutAnimation()},1E3*Blockly.DropDownDiv.ANIMATION_TIME);Blockly.DropDownDiv.onHide_&&(Blockly.DropDownDiv.onHide_(),Blockly.DropDownDiv.onHide_=null)}; Blockly.DropDownDiv.hideWithoutAnimation=function(){if(Blockly.DropDownDiv.isVisible()){Blockly.DropDownDiv.animateOutTimer_&&clearTimeout(Blockly.DropDownDiv.animateOutTimer_);var a=Blockly.DropDownDiv.DIV_;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor="";a.style.borderColor="";Blockly.DropDownDiv.onHide_&&(Blockly.DropDownDiv.onHide_(),Blockly.DropDownDiv.onHide_=null);Blockly.DropDownDiv.clearContent();Blockly.DropDownDiv.owner_= -null;Blockly.DropDownDiv.rendererClassName_&&(Blockly.utils.dom.removeClass(a,Blockly.DropDownDiv.rendererClassName_),Blockly.DropDownDiv.rendererClassName_=null);Blockly.DropDownDiv.themeClassName_&&(Blockly.utils.dom.removeClass(a,Blockly.DropDownDiv.themeClassName_),Blockly.DropDownDiv.themeClassName_=null);Blockly.getMainWorkspace().markFocused()}}; +null;Blockly.DropDownDiv.rendererClassName_&&(Blockly.utils.dom.removeClass(a,Blockly.DropDownDiv.rendererClassName_),Blockly.DropDownDiv.rendererClassName_="");Blockly.DropDownDiv.themeClassName_&&(Blockly.utils.dom.removeClass(a,Blockly.DropDownDiv.themeClassName_),Blockly.DropDownDiv.themeClassName_="");Blockly.getMainWorkspace().markFocused()}}; Blockly.DropDownDiv.positionInternal_=function(a,b,c,d){a=Blockly.DropDownDiv.getPositionMetrics_(a,b,c,d);a.arrowVisible?(Blockly.DropDownDiv.arrow_.style.display="",Blockly.DropDownDiv.arrow_.style.transform="translate("+a.arrowX+"px,"+a.arrowY+"px) rotate(45deg)",Blockly.DropDownDiv.arrow_.setAttribute("class",a.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):Blockly.DropDownDiv.arrow_.style.display="none";b=Math.floor(a.initialX);c=Math.floor(a.initialY); d=Math.floor(a.finalX);var e=Math.floor(a.finalY),f=Blockly.DropDownDiv.DIV_;f.style.left=b+"px";f.style.top=c+"px";f.style.display="block";f.style.opacity=1;f.style.transform="translate("+(d-b)+"px,"+(e-c)+"px)";return a.arrowAtTop}; Blockly.DropDownDiv.repositionForWindowResize=function(){if(Blockly.DropDownDiv.owner_){var a=Blockly.DropDownDiv.owner_,b=Blockly.DropDownDiv.owner_.getSourceBlock();a=Blockly.DropDownDiv.positionToField_?Blockly.DropDownDiv.getScaledBboxOfField_(a):Blockly.DropDownDiv.getScaledBboxOfBlock_(b);b=a.left+(a.right-a.left)/2;Blockly.DropDownDiv.positionInternal_(b,a.bottom,b,a.top)}else Blockly.DropDownDiv.hide()};Blockly.Grid=function(a,b){this.gridPattern_=a;this.spacing_=b.spacing;this.length_=b.length;this.line2_=(this.line1_=a.firstChild)&&this.line1_.nextSibling;this.snapToGrid_=b.snap};Blockly.Grid.prototype.scale_=1;Blockly.Grid.prototype.dispose=function(){this.gridPattern_=null};Blockly.Grid.prototype.shouldSnap=function(){return this.snapToGrid_};Blockly.Grid.prototype.getSpacing=function(){return this.spacing_};Blockly.Grid.prototype.getPatternId=function(){return this.gridPattern_.id}; Blockly.Grid.prototype.update=function(a){this.scale_=a;var b=this.spacing_*a||100;this.gridPattern_.setAttribute("width",b);this.gridPattern_.setAttribute("height",b);b=Math.floor(this.spacing_/2)+.5;var c=b-this.length_/2,d=b+this.length_/2;b*=a;c*=a;d*=a;this.setLineAttributes_(this.line1_,a,c,d,b,b);this.setLineAttributes_(this.line2_,a,b,b,c,d)}; Blockly.Grid.prototype.setLineAttributes_=function(a,b,c,d,e,f){a&&(a.setAttribute("stroke-width",b),a.setAttribute("x1",c),a.setAttribute("y1",e),a.setAttribute("x2",d),a.setAttribute("y2",f))};Blockly.Grid.prototype.moveTo=function(a,b){this.gridPattern_.setAttribute("x",a);this.gridPattern_.setAttribute("y",b);(Blockly.utils.userAgent.IE||Blockly.utils.userAgent.EDGE)&&this.update(this.scale_)}; -Blockly.Grid.createDom=function(a,b,c){a=Blockly.utils.dom.createSvgElement("pattern",{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},c);0]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var c=a;a=a.replace(b,"$1 $2")}while(a!=c);return a};Blockly.Xml.domToPrettyText=function(a){a=Blockly.Xml.domToText(a).split("<");for(var b="",c=1;c"!=d.slice(-2)&&(b+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1");return a.replace(/^\n/,"")}; +Blockly.Xml.domToText=function(a){a=Blockly.utils.xml.domToText(a);var b=/(<[^/](?:[^>]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var c=a;a=a.replace(b,"$1 $2")}while(a!=c);return a.replace(/<(\w+)([^<]*)\/>/g,"<$1$2>")}; +Blockly.Xml.domToPrettyText=function(a){a=Blockly.Xml.domToText(a).split("<");for(var b="",c=1;c"!=d.slice(-2)&&(b+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1");return a.replace(/^\n/,"")}; Blockly.Xml.textToDom=function(a){var b=Blockly.utils.xml.textToDomDocument(a);if(!b||!b.documentElement||b.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return b.documentElement};Blockly.Xml.clearWorkspaceAndLoadFromXml=function(a,b){b.setResizesEnabled(!1);b.clear();a=Blockly.Xml.domToWorkspace(a,b);b.setResizesEnabled(!0);return a}; Blockly.Xml.domToWorkspace=function(a,b){if(a instanceof Blockly.Workspace){var c=a;a=b;b=c;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var d;b.RTL&&(d=b.getWidth());c=[];Blockly.utils.dom.startTextWidthCache();var e=Blockly.Events.getGroup();e||Blockly.Events.setGroup(!0);b.setResizesEnabled&&b.setResizesEnabled(!1);var f=!0;try{for(var g=0,h;h=a.childNodes[g];g++){var k=h.nodeName.toLowerCase(),l=h;if("block"==k||"shadow"==k&&!Blockly.Events.recordUndo){var m= Blockly.Xml.domToBlock(l,b);c.push(m.id);var n=l.hasAttribute("x")?parseInt(l.getAttribute("x"),10):10,p=l.hasAttribute("y")?parseInt(l.getAttribute("y"),10):10;isNaN(n)||isNaN(p)||m.moveBy(b.RTL?d-n:n,p);f=!1}else{if("shadow"==k)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==k)b.rendered?Blockly.WorkspaceCommentSvg?Blockly.WorkspaceCommentSvg.fromXml(l,b,d):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment."):Blockly.WorkspaceComment? @@ -166,10 +171,10 @@ break;case "next":h&&c.nextConnection&&c.nextConnection.setShadowDom(h);if(f){if c.setInputsInline("true"==e);(e=a.getAttribute("disabled"))&&c.setEnabled("true"!=e&&"disabled"!=e);(e=a.getAttribute("deletable"))&&c.setDeletable("true"==e);(e=a.getAttribute("movable"))&&c.setMovable("true"==e);(e=a.getAttribute("editable"))&&c.setEditable("true"==e);(e=a.getAttribute("collapsed"))&&c.setCollapsed("true"==e);if("shadow"==a.nodeName.toLowerCase()){a=c.getChildren(!1);for(e=0;b=a[e];e++)if(!b.isShadow())throw TypeError("Shadow block not allowed non-shadow child.");if(c.getVarModels().length)throw TypeError("Shadow blocks cannot have variable references."); c.setShadow(!0)}return c};Blockly.Xml.domToField_=function(a,b,c){var d=a.getField(b);d?d.fromXml(c):console.warn("Ignoring non-existent field "+b+" in block "+a.type)};Blockly.Xml.deleteNext=function(a){for(var b=0,c;c=a.childNodes[b];b++)if("next"==c.nodeName.toLowerCase()){a.removeChild(c);break}};Blockly.Options=function(a){var b=!!a.readOnly;if(b)var c=null,d=!1,e=!1,f=!1,g=!1,h=!1,k=!1;else{c=Blockly.Options.parseToolboxTree(a.toolbox||null);d=!(!c||!c.getElementsByTagName("category").length);e=a.trashcan;void 0===e&&(e=d);var l=a.maxTrashcanContents;e?void 0===l&&(l=32):l=0;f=a.collapse;void 0===f&&(f=d);g=a.comments;void 0===g&&(g=d);h=a.disable;void 0===h&&(h=d);k=a.sounds;void 0===k&&(k=!0)}var m=!!a.rtl,n=a.horizontalLayout;void 0===n&&(n=!1);var p=a.toolboxPosition;p="end"!==p;p=n? p?Blockly.TOOLBOX_AT_TOP:Blockly.TOOLBOX_AT_BOTTOM:p==m?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT;var q=a.css;void 0===q&&(q=!0);var r="https://blockly-demo.appspot.com/static/media/";a.media?r=a.media:a.path&&(r=a.path+"media/");var t=void 0===a.oneBasedIndex?!0:!!a.oneBasedIndex,u=a.keyMap||Blockly.user.keyMap.createDefaultKeyMap(),v=a.renderer||"geras";this.RTL=m;this.oneBasedIndex=t;this.collapse=f;this.comments=g;this.disable=h;this.readOnly=b;this.maxBlocks=a.maxBlocks||Infinity;this.maxInstances= -a.maxInstances;this.pathToMedia=r;this.hasCategories=d;this.moveOptions=Blockly.Options.parseMoveOptions(a,d);this.hasScrollbars=this.moveOptions.scrollbars;this.hasTrashcan=e;this.maxTrashcanContents=l;this.hasSounds=k;this.hasCss=q;this.horizontalLayout=n;this.languageTree=c;this.gridOptions=Blockly.Options.parseGridOptions_(a);this.zoomOptions=Blockly.Options.parseZoomOptions_(a);this.toolboxPosition=p;this.theme=Blockly.Options.parseThemeOptions_(a);this.keyMap=u;this.renderer=v;this.gridPattern= -void 0;this.parentWorkspace=a.parentWorkspace};Blockly.BlocklyOptions=function(){};Blockly.Options.parseMoveOptions=function(a,b){var c=a.move||{},d={};d.scrollbars=void 0===c.scrollbars&&void 0===a.scrollbars?b:!!c.scrollbars||!!a.scrollbars;d.wheel=d.scrollbars&&void 0!==c.wheel?!!c.wheel:!1;d.drag=d.scrollbars?void 0===c.drag?!0:!!c.drag:!1;return d}; +a.maxInstances;this.pathToMedia=r;this.hasCategories=d;this.moveOptions=Blockly.Options.parseMoveOptions(a,d);this.hasScrollbars=this.moveOptions.scrollbars;this.hasTrashcan=e;this.maxTrashcanContents=l;this.hasSounds=k;this.hasCss=q;this.horizontalLayout=n;this.languageTree=c;this.gridOptions=Blockly.Options.parseGridOptions_(a);this.zoomOptions=Blockly.Options.parseZoomOptions_(a);this.toolboxPosition=p;this.theme=Blockly.Options.parseThemeOptions_(a);this.keyMap=u;this.renderer=v;this.rendererOverrides= +a.rendererOverrides;this.gridPattern=void 0;this.parentWorkspace=a.parentWorkspace};Blockly.BlocklyOptions=function(){};Blockly.Options.parseMoveOptions=function(a,b){var c=a.move||{},d={};d.scrollbars=void 0===c.scrollbars&&void 0===a.scrollbars?b:!!c.scrollbars||!!a.scrollbars;d.wheel=d.scrollbars&&void 0!==c.wheel?!!c.wheel:!1;d.drag=d.scrollbars?void 0===c.drag?!0:!!c.drag:!1;return d}; Blockly.Options.parseZoomOptions_=function(a){a=a.zoom||{};var b={};b.controls=void 0===a.controls?!1:!!a.controls;b.wheel=void 0===a.wheel?!1:!!a.wheel;b.startScale=void 0===a.startScale?1:Number(a.startScale);b.maxScale=void 0===a.maxScale?3:Number(a.maxScale);b.minScale=void 0===a.minScale?.3:Number(a.minScale);b.scaleSpeed=void 0===a.scaleSpeed?1.2:Number(a.scaleSpeed);b.pinch=void 0===a.pinch?b.wheel||b.controls:!!a.pinch;return b}; -Blockly.Options.parseGridOptions_=function(a){a=a.grid||{};var b={};b.spacing=Number(a.spacing)||0;b.colour=a.colour||"#888";b.length=void 0===a.length?1:Number(a.length);b.snap=0 document.");}else a=null;return a};Blockly.Touch={};Blockly.Touch.TOUCH_ENABLED="ontouchstart"in Blockly.utils.global||!!(Blockly.utils.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!Blockly.utils.global.navigator||!Blockly.utils.global.navigator.maxTouchPoints&&!Blockly.utils.global.navigator.msMaxTouchPoints);Blockly.Touch.touchIdentifier_=null;Blockly.Touch.TOUCH_MAP={}; Blockly.utils.global.PointerEvent?Blockly.Touch.TOUCH_MAP={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:Blockly.Touch.TOUCH_ENABLED&&(Blockly.Touch.TOUCH_MAP={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]});Blockly.longPid_=0; Blockly.longStart=function(a,b){Blockly.longStop_();a.changedTouches&&1!=a.changedTouches.length||(Blockly.longPid_=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);b&&b.handleRightClick(a)},Blockly.LONGPRESS))};Blockly.longStop_=function(){Blockly.longPid_&&(clearTimeout(Blockly.longPid_),Blockly.longPid_=0)};Blockly.Touch.clearTouchIdentifier=function(){Blockly.Touch.touchIdentifier_=null}; @@ -204,12 +209,14 @@ a.stopPropagation(),a.preventDefault())};Blockly.Scrollbar.prototype.onMouseMove Blockly.Scrollbar.prototype.cleanUp_=function(){Blockly.hideChaff(!0);Blockly.Scrollbar.onMouseUpWrapper_&&(Blockly.unbindEvent_(Blockly.Scrollbar.onMouseUpWrapper_),Blockly.Scrollbar.onMouseUpWrapper_=null);Blockly.Scrollbar.onMouseMoveWrapper_&&(Blockly.unbindEvent_(Blockly.Scrollbar.onMouseMoveWrapper_),Blockly.Scrollbar.onMouseMoveWrapper_=null)}; Blockly.Scrollbar.prototype.constrainHandle_=function(a){return a=0>=a||isNaN(a)||this.scrollViewSize_Blockly.Tooltip.RADIUS_OK&&Blockly.Tooltip.hide()}else Blockly.Tooltip.poisonedElement_!=Blockly.Tooltip.element_&&(clearTimeout(Blockly.Tooltip.showPid_),Blockly.Tooltip.lastX_=a.pageX,Blockly.Tooltip.lastY_=a.pageY,Blockly.Tooltip.showPid_=setTimeout(Blockly.Tooltip.show_, -Blockly.Tooltip.HOVER_MS))};Blockly.Tooltip.hide=function(){Blockly.Tooltip.visible&&(Blockly.Tooltip.visible=!1,Blockly.Tooltip.DIV&&(Blockly.Tooltip.DIV.style.display="none"));Blockly.Tooltip.showPid_&&clearTimeout(Blockly.Tooltip.showPid_)};Blockly.Tooltip.block=function(){Blockly.Tooltip.hide();Blockly.Tooltip.blocked_=!0};Blockly.Tooltip.unblock=function(){Blockly.Tooltip.blocked_=!1}; -Blockly.Tooltip.show_=function(){if(!Blockly.Tooltip.blocked_&&(Blockly.Tooltip.poisonedElement_=Blockly.Tooltip.element_,Blockly.Tooltip.DIV)){Blockly.Tooltip.DIV.innerHTML="";for(var a=Blockly.Tooltip.element_.tooltip;"function"==typeof a;)a=a();a=Blockly.utils.string.wrap(a,Blockly.Tooltip.LIMIT);a=a.split("\n");for(var b=0;bc+window.scrollY&&(e-=Blockly.Tooltip.DIV.offsetHeight+2*Blockly.Tooltip.OFFSET_Y);a?d=Math.max(Blockly.Tooltip.MARGINS-window.scrollX, d):d+Blockly.Tooltip.DIV.offsetWidth>b+window.scrollX-2*Blockly.Tooltip.MARGINS&&(d=b-Blockly.Tooltip.DIV.offsetWidth-2*Blockly.Tooltip.MARGINS);Blockly.Tooltip.DIV.style.top=e+"px";Blockly.Tooltip.DIV.style.left=d+"px"}};Blockly.WorkspaceDragSurfaceSvg=function(a){this.container_=a;this.createDom()};Blockly.WorkspaceDragSurfaceSvg.prototype.SVG_=null;Blockly.WorkspaceDragSurfaceSvg.prototype.dragGroup_=null;Blockly.WorkspaceDragSurfaceSvg.prototype.container_=null; Blockly.WorkspaceDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=Blockly.utils.dom.createSvgElement("svg",{xmlns:Blockly.utils.dom.SVG_NS,"xmlns:html":Blockly.utils.dom.HTML_NS,"xmlns:xlink":Blockly.utils.dom.XLINK_NS,version:"1.1","class":"blocklyWsDragSurface blocklyOverflowVisible"},null),this.container_.appendChild(this.SVG_))}; @@ -276,33 +283,32 @@ Blockly.blockAnimations.connectionUiEffect=function(a){var b=a.workspace,c=b.sca Blockly.blockAnimations.connectionUiStep_=function(a,b,c){var d=(new Date-b)/150;1a.workspace.scale)){var b=a.getHeightWidth().height;b=Math.atan(10/b)/Math.PI*180;a.RTL||(b*=-1);Blockly.blockAnimations.disconnectUiStep_(a.getSvgRoot(),b,new Date)}}; Blockly.blockAnimations.disconnectUiStep_=function(a,b,c){var d=(new Date-c)/200;1b-Blockly.CURRENT_CONNECTION_PREFERENCE)}if(this.localConnection_||this.closestConnection_)console.error("Only one of localConnection_ and closestConnection_ was set."); else return!0}else return!(!this.localConnection_||!this.closestConnection_);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0};Blockly.InsertionMarkerManager.prototype.getCandidate_=function(a){for(var b=this.getStartRadius_(),c=null,d=null,e=0;ethis.constants_.FIELD_TEXT_HEIGHT&&(c+=(this.size_.height-c)/2);this.textElement_=Blockly.utils.dom.createSvgElement("text",{"class":"blocklyText",y:b?this.size_.height/2:c,dy:this.constants_.FIELD_TEXT_Y_OFFSET, -x:a},this.fieldGroup_);b&&this.textElement_.setAttribute("dominant-baseline","central");this.textContent_=document.createTextNode("");this.textElement_.appendChild(this.textContent_)};Blockly.Field.prototype.bindEvents_=function(){Blockly.Tooltip.bindMouseEvents(this.getClickTarget_());this.mouseDownWrapper_=Blockly.bindEventWithChecks_(this.getClickTarget_(),"mousedown",this,this.onMouseDown_)};Blockly.Field.prototype.fromXml=function(a){this.setValue(a.textContent)}; -Blockly.Field.prototype.toXml=function(a){a.textContent=this.getValue();return a};Blockly.Field.prototype.dispose=function(){Blockly.DropDownDiv.hideIfOwner(this);Blockly.WidgetDiv.hideIfOwner(this);this.mouseDownWrapper_&&Blockly.unbindEvent_(this.mouseDownWrapper_);Blockly.utils.dom.removeNode(this.fieldGroup_);this.disposed=!0}; +Blockly.Field.prototype.createBorderRect_=function(){this.borderRect_=Blockly.utils.dom.createSvgElement("rect",{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,"class":"blocklyFieldRect"},this.fieldGroup_)}; +Blockly.Field.prototype.createTextElement_=function(){this.textElement_=Blockly.utils.dom.createSvgElement("text",{"class":"blocklyText"},this.fieldGroup_);this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central");this.textContent_=document.createTextNode("");this.textElement_.appendChild(this.textContent_)}; +Blockly.Field.prototype.bindEvents_=function(){Blockly.Tooltip.bindMouseEvents(this.getClickTarget_());this.mouseDownWrapper_=Blockly.bindEventWithChecks_(this.getClickTarget_(),"mousedown",this,this.onMouseDown_)};Blockly.Field.prototype.fromXml=function(a){this.setValue(a.textContent)};Blockly.Field.prototype.toXml=function(a){a.textContent=this.getValue();return a}; +Blockly.Field.prototype.dispose=function(){Blockly.DropDownDiv.hideIfOwner(this);Blockly.WidgetDiv.hideIfOwner(this);Blockly.Tooltip.unbindMouseEvents(this.getClickTarget_());this.mouseDownWrapper_&&Blockly.unbindEvent_(this.mouseDownWrapper_);Blockly.utils.dom.removeNode(this.fieldGroup_);this.disposed=!0}; Blockly.Field.prototype.updateEditable=function(){var a=this.fieldGroup_;this.EDITABLE&&a&&(this.sourceBlock_.isEditable()?(Blockly.utils.dom.addClass(a,"blocklyEditableText"),Blockly.utils.dom.removeClass(a,"blocklyNonEditableText"),a.style.cursor=this.CURSOR):(Blockly.utils.dom.addClass(a,"blocklyNonEditableText"),Blockly.utils.dom.removeClass(a,"blocklyEditableText"),a.style.cursor=""))}; Blockly.Field.prototype.isClickable=function(){return!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&!!this.showEditor_&&"function"===typeof this.showEditor_};Blockly.Field.prototype.isCurrentlyEditable=function(){return this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()}; Blockly.Field.prototype.isSerializable=function(){var a=!1;this.name&&(this.SERIALIZABLE?a=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),a=!0));return a};Blockly.Field.prototype.isVisible=function(){return this.visible_}; Blockly.Field.prototype.setVisible=function(a){if(this.visible_!=a){this.visible_=a;var b=this.getSvgRoot();b&&(b.style.display=a?"block":"none")}};Blockly.Field.prototype.setValidator=function(a){this.validator_=a};Blockly.Field.prototype.getValidator=function(){return this.validator_};Blockly.Field.prototype.classValidator=function(a){return a}; -Blockly.Field.prototype.callValidator=function(a){var b=this.classValidator(a);if(null===b)return null;void 0!==b&&(a=b);if(b=this.getValidator()){b=b.call(this,a);if(null===b)return null;void 0!==b&&(a=b)}return a};Blockly.Field.prototype.getSvgRoot=function(){return this.fieldGroup_};Blockly.Field.prototype.applyColour=function(){};Blockly.Field.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_(),this.updateSize_())}; +Blockly.Field.prototype.callValidator=function(a){var b=this.classValidator(a);if(null===b)return null;void 0!==b&&(a=b);if(b=this.getValidator()){b=b.call(this,a);if(null===b)return null;void 0!==b&&(a=b)}return a};Blockly.Field.prototype.getSvgRoot=function(){return this.fieldGroup_};Blockly.Field.prototype.applyColour=function(){};Blockly.Field.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_());this.updateSize_()}; Blockly.Field.prototype.showEditor=function(a){this.isClickable()&&this.showEditor_(a)};Blockly.Field.prototype.updateWidth=function(){console.warn("Deprecated call to updateWidth, call Blockly.Field.updateSize_ to force an update to the size of the field, or Blockly.utils.dom.getTextWidth() to check the size of the field.");this.updateSize_()}; -Blockly.Field.prototype.updateSize_=function(){var a=Blockly.utils.dom.getFastTextWidth(this.textElement_,this.constants_.FIELD_TEXT_FONTSIZE,this.constants_.FIELD_TEXT_FONTWEIGHT,this.constants_.FIELD_TEXT_FONTFAMILY);this.borderRect_&&(a+=2*this.constants_.FIELD_BORDER_RECT_X_PADDING,this.borderRect_.setAttribute("width",a));this.size_.width=a}; +Blockly.Field.prototype.updateSize_=function(a){var b=this.getConstants();a=void 0!=a?a:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0;var c=2*a,d=b.FIELD_TEXT_HEIGHT,e=0;this.textElement_&&(e=Blockly.utils.dom.getFastTextWidth(this.textElement_,b.FIELD_TEXT_FONTSIZE,b.FIELD_TEXT_FONTWEIGHT,b.FIELD_TEXT_FONTFAMILY),c+=e);this.borderRect_&&(d=Math.max(d,b.FIELD_BORDER_RECT_HEIGHT));this.size_.height=d;this.size_.width=c;this.positionTextElement_(a,e);this.positionBorderRect_()}; +Blockly.Field.prototype.positionTextElement_=function(a,b){if(this.textElement_){var c=this.getConstants(),d=this.size_.height/2;this.textElement_.setAttribute("x",this.sourceBlock_.RTL?this.size_.width-b-a:a);this.textElement_.setAttribute("y",c.FIELD_TEXT_BASELINE_CENTER?d:d-c.FIELD_TEXT_HEIGHT/2+c.FIELD_TEXT_BASELINE)}}; +Blockly.Field.prototype.positionBorderRect_=function(){this.borderRect_&&(this.borderRect_.setAttribute("width",this.size_.width),this.borderRect_.setAttribute("height",this.size_.height),this.borderRect_.setAttribute("rx",this.getConstants().FIELD_BORDER_RECT_RADIUS),this.borderRect_.setAttribute("ry",this.getConstants().FIELD_BORDER_RECT_RADIUS))}; Blockly.Field.prototype.getSize=function(){if(!this.isVisible())return new Blockly.utils.Size(0,0);this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0==this.size_.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.render_());return this.size_}; Blockly.Field.prototype.getScaledBBox=function(){if(this.borderRect_)a=this.borderRect_.getBoundingClientRect(),c=Blockly.utils.style.getPageOffset(this.borderRect_),d=a.width,a=a.height;else{var a=this.sourceBlock_.getHeightWidth(),b=this.sourceBlock_.workspace.scale,c=this.getAbsoluteXY_(),d=a.width*b;a=a.height*b;Blockly.utils.userAgent.GECKO?(c.x+=1.5*b,c.y+=1.5*b):Blockly.utils.userAgent.EDGE||Blockly.utils.userAgent.IE||(c.x-=.5*b,c.y-=.5*b);d+=1*b;a+=1*b}return{top:c.y,bottom:c.y+a,left:c.x, right:c.x+d}};Blockly.Field.prototype.getDisplayText_=function(){var a=this.getText();if(!a)return Blockly.Field.NBSP;a.length>this.maxDisplayLength&&(a=a.substring(0,this.maxDisplayLength-2)+"\u2026");a=a.replace(/\s/g,Blockly.Field.NBSP);this.sourceBlock_&&this.sourceBlock_.RTL&&(a+="\u200f");return a};Blockly.Field.prototype.getText=function(){if(this.getText_){var a=this.getText_.call(this);if(null!==a)return String(a)}return String(this.getValue())}; -Blockly.Field.prototype.setText=function(a){throw Error("setText method is deprecated");};Blockly.Field.prototype.markDirty=function(){this.isDirty_=!0};Blockly.Field.prototype.forceRerender=function(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours())}; +Blockly.Field.prototype.setText=function(a){throw Error("setText method is deprecated");};Blockly.Field.prototype.markDirty=function(){this.isDirty_=!0;this.constants_=null};Blockly.Field.prototype.forceRerender=function(){this.isDirty_=!0;this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours(),this.updateMarkers_())}; Blockly.Field.prototype.setValue=function(a){if(null!==a){var b=this.doClassValidation_(a);a=this.processValidation_(a,b);if(!(a instanceof Error)){if(b=this.getValidator())if(b=b.call(this,a),a=this.processValidation_(a,b),a instanceof Error)return;b=this.getValue();b!==a&&(this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,"field",this.name||null,b,a)),this.doValueUpdate_(a),this.isDirty_&&this.forceRerender())}}}; Blockly.Field.prototype.processValidation_=function(a,b){if(null===b)return this.doValueInvalid_(a),this.isDirty_&&this.forceRerender(),Error();void 0!==b&&(a=b);return a};Blockly.Field.prototype.getValue=function(){return this.value_};Blockly.Field.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:a=this.classValidator(a)};Blockly.Field.prototype.doValueUpdate_=function(a){this.value_=a;this.isDirty_=!0};Blockly.Field.prototype.doValueInvalid_=function(a){}; Blockly.Field.prototype.onMouseDown_=function(a){this.sourceBlock_&&this.sourceBlock_.workspace&&(a=this.sourceBlock_.workspace.getGesture(a))&&a.setStartField(this)};Blockly.Field.prototype.setTooltip=function(a){var b=this.getClickTarget_();b?b.tooltip=a||""===a?a:this.sourceBlock_:this.tooltip_=a};Blockly.Field.prototype.getClickTarget_=function(){return this.clickTarget_||this.getSvgRoot()};Blockly.Field.prototype.getAbsoluteXY_=function(){return Blockly.utils.style.getPageOffset(this.getClickTarget_())}; Blockly.Field.prototype.referencesVariables=function(){return!1};Blockly.Field.prototype.getParentInput=function(){for(var a=null,b=this.sourceBlock_,c=b.inputList,d=0;da||a>this.fieldRow.length)throw Error("index "+a+" out of bounds.");if(!(b||""==b&&c))return a;"string"==typeof b&&(b=new Blockly.FieldLabel(b));b.setSourceBlock(this.sourceBlock_);this.sourceBlock_.rendered&&b.init();b.name=c;b.prefixField&&(a=this.insertFieldAt(a,b.prefixField));this.fieldRow.splice(a,0,b);++a;b.suffixField&&(a=this.insertFieldAt(a,b.suffixField));this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours()); @@ -468,9 +476,9 @@ return a};Blockly.Input.prototype.removeField=function(a){for(var b=0,c;c=this.f Blockly.Input.prototype.setVisible=function(a){var b=[];if(this.visible_==a)return b;for(var c=(this.visible_=a)?"block":"none",d=0,e;e=this.fieldRow[d];d++)e.setVisible(a);this.connection&&(a?b=this.connection.startTrackingAll():this.connection.stopTrackingAll(),d=this.connection.targetBlock())&&(d.getSvgRoot().style.display=c,a||(d.rendered=!1));return b};Blockly.Input.prototype.markDirty=function(){for(var a=0,b;b=this.fieldRow[a];a++)b.markDirty()}; Blockly.Input.prototype.setCheck=function(a){if(!this.connection)throw Error("This input does not have a connection.");this.connection.setCheck(a);return this};Blockly.Input.prototype.setAlign=function(a){this.align=a;this.sourceBlock_.rendered&&this.sourceBlock_.render();return this};Blockly.Input.prototype.init=function(){if(this.sourceBlock_.workspace.rendered)for(var a=0;a=k||k>b.length)throw Error('Block "'+this.type+'": Message index %'+k+" out of range.");if(f[k])throw Error('Block "'+this.type+'": Message index %'+k+" duplicated.");f[k]=!0;g++;a.push(b[k-1])}else(k=k.trim())&&a.push(k)}if(g!=b.length)throw Error('Block "'+this.type+'": Message does not reference all '+b.length+" arg(s)."); a.length&&("string"==typeof a[a.length-1]||Blockly.utils.string.startsWith(a[a.length-1].type,"field_"))&&(h={type:"input_dummy"},c&&(h.align=c),a.push(h));c={LEFT:Blockly.ALIGN_LEFT,RIGHT:Blockly.ALIGN_RIGHT,CENTRE:Blockly.ALIGN_CENTRE,CENTER:Blockly.ALIGN_CENTRE};b=[];for(h=0;h=this.inputList.length)throw RangeError("Input index "+a+" out of bounds.");if(b>this.inputList.length)throw RangeError("Reference input "+b+" out of bounds.");var c=this.inputList[a];this.inputList.splice(a,1);aa?b-1:a},this.highlightedIndex_)}; -Blockly.Menu.prototype.highlightHelper=function(a,b){b=0>b?-1:b;var c=this.getChildCount();b=a.call(this,b,c);for(var d=0;d<=c;){var e=this.getChildAt(b);if(e&&this.canHighlightItem(e))return this.setHighlightedIndex(b),!0;d++;b=a.call(this,b,c)}return!1};Blockly.Menu.prototype.canHighlightItem=function(a){return a.isEnabled()};Blockly.Menu.prototype.handleMouseOver_=function(a){(a=this.getMenuItem(a.target))&&a.isEnabled()&&this.getHighlighted()!==a&&(this.unhighlightCurrent(),this.setHighlighted(a))}; -Blockly.Menu.prototype.handleClick_=function(a){var b=this.openingCoords;this.openingCoords=null;if(b&&"number"===typeof a.clientX){var c=new Blockly.utils.Coordinate(a.clientX,a.clientY);if(1>Blockly.utils.Coordinate.distance(b,c))return}(b=this.getMenuItem(a.target))&&b.handleClick(a)&&a.preventDefault()};Blockly.Menu.prototype.handleMouseEnter_=function(a){this.focus()};Blockly.Menu.prototype.handleMouseLeave_=function(a){this.getElement()&&(this.blur(),this.clearHighlighted())}; -Blockly.Menu.prototype.handleKeyEvent=function(a){return 0!=this.getChildCount()&&this.handleKeyEventInternal(a)?(a.preventDefault(),a.stopPropagation(),!0):!1}; +Blockly.Menu.prototype.highlightHelper=function(a,b){b=0>b?-1:b;var c=this.getChildCount();b=a.call(this,b,c);for(var d=0;d<=c;){var e=this.getChildAt(b);if(e&&this.canHighlightItem(e))return this.setHighlightedIndex(b),!0;d++;b=a.call(this,b,c)}return!1};Blockly.Menu.prototype.canHighlightItem=function(a){return a.isEnabled()}; +Blockly.Menu.prototype.handleMouseOver_=function(a){if(a=this.getMenuItem(a.target))a.isEnabled()?this.getHighlighted()!==a&&(this.unhighlightCurrent(),this.setHighlighted(a)):this.unhighlightCurrent()};Blockly.Menu.prototype.handleClick_=function(a){var b=this.openingCoords;this.openingCoords=null;if(b&&"number"===typeof a.clientX){var c=new Blockly.utils.Coordinate(a.clientX,a.clientY);if(1>Blockly.utils.Coordinate.distance(b,c))return}(b=this.getMenuItem(a.target))&&b.handleClick(a)&&a.preventDefault()}; +Blockly.Menu.prototype.handleMouseEnter_=function(a){this.focus()};Blockly.Menu.prototype.handleMouseLeave_=function(a){this.getElement()&&(this.blur(),this.clearHighlighted())};Blockly.Menu.prototype.handleKeyEvent=function(a){return 0!=this.getChildCount()&&this.handleKeyEventInternal(a)?(a.preventDefault(),a.stopPropagation(),!0):!1}; Blockly.Menu.prototype.handleKeyEventInternal=function(a){var b=this.getHighlighted();if(b&&"function"==typeof b.handleKeyEvent&&b.handleKeyEvent(a))return!0;if(a.shiftKey||a.ctrlKey||a.metaKey||a.altKey)return!1;switch(a.keyCode){case Blockly.utils.KeyCodes.ENTER:b&&b.performActionInternal(a);break;case Blockly.utils.KeyCodes.UP:this.highlightPrevious();break;case Blockly.utils.KeyCodes.DOWN:this.highlightNext();break;default:return!1}return!0};Blockly.MenuItem=function(a,b){Blockly.Component.call(this);this.setContentInternal(a);this.setValue(b);this.enabled_=!0};Blockly.utils.object.inherits(Blockly.MenuItem,Blockly.Component); -Blockly.MenuItem.prototype.createDom=function(){var a=document.createElement("div");a.id=this.getId();this.setElementInternal(a);a.className="goog-menuitem goog-option "+(this.enabled_?"":"goog-menuitem-disabled ")+(this.checked_?"goog-option-selected ":"")+(this.isRightToLeft()?"goog-menuitem-rtl ":"");var b=this.getContentWrapperDom();a.appendChild(b);var c=this.getCheckboxDom();c&&b.appendChild(c);b.appendChild(this.getContentDom());Blockly.utils.aria.setRole(a,this.roleName_||(this.checkable_? -Blockly.utils.aria.Role.MENUITEMCHECKBOX:Blockly.utils.aria.Role.MENUITEM));Blockly.utils.aria.setState(a,Blockly.utils.aria.State.SELECTED,this.checkable_&&this.checked_||!1)};Blockly.MenuItem.prototype.getCheckboxDom=function(){if(!this.checkable_)return null;var a=document.createElement("div");a.className="goog-menuitem-checkbox";return a};Blockly.MenuItem.prototype.getContentDom=function(){var a=this.content_;"string"===typeof a&&(a=document.createTextNode(a));return a}; +Blockly.MenuItem.prototype.createDom=function(){var a=document.createElement("div");a.id=this.getId();this.setElementInternal(a);a.className="goog-menuitem goog-option "+(this.enabled_?"":"goog-menuitem-disabled ")+(this.checked_?"goog-option-selected ":"")+(this.rightToLeft_?"goog-menuitem-rtl ":"");var b=this.getContentWrapperDom();a.appendChild(b);var c=this.getCheckboxDom();c&&b.appendChild(c);b.appendChild(this.getContentDom());Blockly.utils.aria.setRole(a,this.roleName_||(this.checkable_?Blockly.utils.aria.Role.MENUITEMCHECKBOX: +Blockly.utils.aria.Role.MENUITEM));Blockly.utils.aria.setState(a,Blockly.utils.aria.State.SELECTED,this.checkable_&&this.checked_||!1)};Blockly.MenuItem.prototype.getCheckboxDom=function(){if(!this.checkable_)return null;var a=document.createElement("div");a.className="goog-menuitem-checkbox";return a};Blockly.MenuItem.prototype.getContentDom=function(){var a=this.content_;"string"===typeof a&&(a=document.createTextNode(a));return a}; Blockly.MenuItem.prototype.getContentWrapperDom=function(){var a=document.createElement("div");a.className="goog-menuitem-content";return a};Blockly.MenuItem.prototype.setContentInternal=function(a){this.content_=a};Blockly.MenuItem.prototype.setValue=function(a){this.value_=a};Blockly.MenuItem.prototype.getValue=function(){return this.value_};Blockly.MenuItem.prototype.setRole=function(a){this.roleName_=a};Blockly.MenuItem.prototype.setCheckable=function(a){this.checkable_=a}; Blockly.MenuItem.prototype.setChecked=function(a){if(this.checkable_){this.checked_=a;var b=this.getElement();b&&this.isEnabled()&&(a?(Blockly.utils.dom.addClass(b,"goog-option-selected"),Blockly.utils.aria.setState(b,Blockly.utils.aria.State.SELECTED,!0)):(Blockly.utils.dom.removeClass(b,"goog-option-selected"),Blockly.utils.aria.setState(b,Blockly.utils.aria.State.SELECTED,!1)))}}; Blockly.MenuItem.prototype.setHighlighted=function(a){this.highlight_=a;var b=this.getElement();b&&this.isEnabled()&&(a?Blockly.utils.dom.addClass(b,"goog-menuitem-highlight"):Blockly.utils.dom.removeClass(b,"goog-menuitem-highlight"))};Blockly.MenuItem.prototype.isEnabled=function(){return this.enabled_};Blockly.MenuItem.prototype.setEnabled=function(a){this.enabled_=a;(a=this.getElement())&&(this.enabled_?Blockly.utils.dom.removeClass(a,"goog-menuitem-disabled"):Blockly.utils.dom.addClass(a,"goog-menuitem-disabled"))}; @@ -580,26 +588,26 @@ Blockly.BlockSvg.prototype.moveBy=function(a,b){if(this.parentBlock_)throw Error Blockly.BlockSvg.prototype.moveToDragSurface=function(){if(this.useDragSurface_){var a=this.getRelativeToSurfaceXY();this.clearTransformAttributes_();this.workspace.getBlockDragSurface().translateSurface(a.x,a.y);(a=this.getSvgRoot())&&this.workspace.getBlockDragSurface().setBlocksAndShow(a)}};Blockly.BlockSvg.prototype.moveTo=function(a){var b=this.getRelativeToSurfaceXY();this.moveBy(a.x-b.x,a.y-b.y)}; Blockly.BlockSvg.prototype.moveOffDragSurface=function(a){this.useDragSurface_&&(this.translate(a.x,a.y),this.workspace.getBlockDragSurface().clearAndHide(this.workspace.getCanvas()))};Blockly.BlockSvg.prototype.moveDuringDrag=function(a){this.useDragSurface_?this.workspace.getBlockDragSurface().translateSurface(a.x,a.y):(this.svgGroup_.translate_="translate("+a.x+","+a.y+")",this.svgGroup_.setAttribute("transform",this.svgGroup_.translate_+this.svgGroup_.skew_))}; Blockly.BlockSvg.prototype.clearTransformAttributes_=function(){this.getSvgRoot().removeAttribute("transform")};Blockly.BlockSvg.prototype.snapToGrid=function(){if(this.workspace&&!this.workspace.isDragging()&&!this.getParent()&&!this.isInFlyout){var a=this.workspace.getGrid();if(a&&a.shouldSnap()){var b=a.getSpacing(),c=b/2,d=this.getRelativeToSurfaceXY();a=Math.round((d.x-c)/b)*b+c-d.x;b=Math.round((d.y-c)/b)*b+c-d.y;a=Math.round(a);b=Math.round(b);0==a&&0==b||this.moveBy(a,b)}}}; -Blockly.BlockSvg.prototype.getBoundingRectangle=function(){var a=this.getRelativeToSurfaceXY(),b=this.getHeightWidth();if(this.RTL){var c=a.x-b.width;var d=a.x}else c=a.x,d=a.x+b.width;return new Blockly.utils.Rect(a.y,a.y+b.height,c,d)};Blockly.BlockSvg.prototype.markDirty=function(){for(var a=0,b;b=this.inputList[a];a++)b.markDirty()}; +Blockly.BlockSvg.prototype.getBoundingRectangle=function(){var a=this.getRelativeToSurfaceXY(),b=this.getHeightWidth();if(this.RTL){var c=a.x-b.width;var d=a.x}else c=a.x,d=a.x+b.width;return new Blockly.utils.Rect(a.y,a.y+b.height,c,d)};Blockly.BlockSvg.prototype.markDirty=function(){this.pathObject.constants=this.workspace.getRenderer().getConstants();for(var a=0,b;b=this.inputList[a];a++)b.markDirty()}; Blockly.BlockSvg.prototype.setCollapsed=function(a){if(this.collapsed_!=a){for(var b=[],c=0,d;d=this.inputList[c];c++)b.push.apply(b,d.setVisible(!a));if(a){d=this.getIcons();for(c=0;c=this.connections_.length)return-1;b=a.y;for(var d=c;0<=d&&this.connections_[d].y==b;){if(this.connections_[d]==a)return d;d--}for(;ca)c=d;else{b=d;break}}return b};Blockly.ConnectionDB.prototype.removeConnection=function(a,b){a=this.findIndexOfConnection_(a,b);if(-1==a)throw Error("Unable to find connection in connectionDB.");this.connections_.splice(a,1)}; Blockly.ConnectionDB.prototype.getNeighbours=function(a,b){function c(a){var c=e-d[a].x,g=f-d[a].y;Math.sqrt(c*c+g*g)<=b&&k.push(d[a]);return ga)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");this.subscribedWorkspaces_.splice(a,1)}; +Blockly.MarkerManager.prototype.setMarkerSvg=function(a){a?this.workspace_.getBlockCanvas()&&(this.cursorSvg_?this.workspace_.getBlockCanvas().insertBefore(a,this.cursorSvg_):this.workspace_.getBlockCanvas().appendChild(a)):this.markerSvg_=null};Blockly.MarkerManager.prototype.updateMarkers=function(){this.workspace_.keyboardAccessibilityMode&&this.cursorSvg_&&this.workspace_.getCursor().draw()}; +Blockly.MarkerManager.prototype.dispose=function(){for(var a=Object.keys(this.markers_),b=0,c;c=a[b];b++)this.unregisterMarker(c);this.markers_=null;this.cursor_.dispose();this.cursor_=null};Blockly.ThemeManager=function(a,b){this.workspace_=a;this.theme_=b;this.subscribedWorkspaces_=[];this.componentDB_=Object.create(null)};Blockly.ThemeManager.prototype.getTheme=function(){return this.theme_}; +Blockly.ThemeManager.prototype.setTheme=function(a){var b=this.theme_;this.theme_=a;if(a=this.workspace_.getInjectionDiv())b&&Blockly.utils.dom.removeClass(a,b.getClassName()),Blockly.utils.dom.addClass(a,this.theme_.getClassName());for(b=0;a=this.subscribedWorkspaces_[b];b++)a.refreshTheme();b=0;a=Object.keys(this.componentDB_);for(var c;c=a[b];b++)for(var d=0,e;e=this.componentDB_[c][d];d++){var f=e.element;e=e.propertyName;var g=this.theme_&&this.theme_.getComponentStyle(c);f.style[e]=g||""}Blockly.hideChaff()}; +Blockly.ThemeManager.prototype.subscribeWorkspace=function(a){this.subscribedWorkspaces_.push(a)};Blockly.ThemeManager.prototype.unsubscribeWorkspace=function(a){a=this.subscribedWorkspaces_.indexOf(a);if(0>a)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");this.subscribedWorkspaces_.splice(a,1)}; Blockly.ThemeManager.prototype.subscribe=function(a,b,c){this.componentDB_[b]||(this.componentDB_[b]=[]);this.componentDB_[b].push({element:a,propertyName:c});b=this.theme_&&this.theme_.getComponentStyle(b);a.style[c]=b||""};Blockly.ThemeManager.prototype.unsubscribe=function(a){if(a)for(var b=Object.keys(this.componentDB_),c=0,d;d=b[c];c++){for(var e=this.componentDB_[d],f=e.length-1;0<=f;f--)e[f].element===a&&e.splice(f,1);this.componentDB_[d].length||delete this.componentDB_[d]}}; Blockly.ThemeManager.prototype.dispose=function(){this.componentDB_=this.subscribedWorkspaces_=this.theme_=this.owner_=null};Blockly.TouchGesture=function(a,b){Blockly.TouchGesture.superClass_.constructor.call(this,a,b);this.isMultiTouch_=!1;this.cachedPoints_=Object.create(null);this.startDistance_=this.previousScale_=0;this.isPinchZoomEnabled_=this.onStartWrapper_=null};Blockly.utils.object.inherits(Blockly.TouchGesture,Blockly.Gesture);Blockly.TouchGesture.ZOOM_IN_MULTIPLIER=5;Blockly.TouchGesture.ZOOM_OUT_MULTIPLIER=6; Blockly.TouchGesture.prototype.doStart=function(a){this.isPinchZoomEnabled_=this.startWorkspace_.options.zoomOptions&&this.startWorkspace_.options.zoomOptions.pinch;Blockly.TouchGesture.superClass_.doStart.call(this,a);!this.isEnding_&&Blockly.Touch.isTouchEvent(a)&&this.handleTouchStart(a)}; @@ -640,27 +650,27 @@ b;a.preventDefault()};Blockly.TouchGesture.prototype.handleTouchEnd=function(a){ Blockly.WorkspaceAudio.prototype.load=function(a,b){if(a.length){try{var c=new Blockly.utils.global.Audio}catch(h){return}for(var d,e=0;e=this.remainingCapacity()||(this.currentGesture_&&this.currentGesture_.cancel(),"comment"==a.tagName.toLowerCase()?this.pasteWorkspaceComment_(a):this.pasteBlock_(a))}; Blockly.WorkspaceSvg.prototype.pasteBlock_=function(a){Blockly.Events.disable();try{var b=Blockly.Xml.domToBlock(a,this),c=this.getMarker(Blockly.navigation.MARKER_NAME).getCurNode();if(this.keyboardAccessibilityMode&&c&&c.isConnection()){var d=c.getLocation();Blockly.navigation.insertBlock(b,d);return}var e=parseInt(a.getAttribute("x"),10),f=parseInt(a.getAttribute("y"),10);if(!isNaN(e)&&!isNaN(f)){this.RTL&&(e=-e);do{a=!1;var g=this.getAllBlocks(!1);c=0;for(var h;h=g[c];c++){var k=h.getRelativeToSurfaceXY(); @@ -688,7 +698,7 @@ Blockly.WorkspaceSvg.prototype.cleanUp=function(){this.setResizesEnabled(!1);Blo Blockly.WorkspaceSvg.prototype.showContextMenu=function(a){function b(a){if(a.isDeletable())p=p.concat(a.getDescendants(!1));else{a=a.getChildren(!1);for(var c=0;cp.length?c():Blockly.confirm(Blockly.Msg.DELETE_ALL_BLOCKS.replace("%1",p.length),function(a){a&& -c()})}};d.push(h);this.configureContextMenu&&this.configureContextMenu(d);Blockly.ContextMenu.show(a,d,this.RTL)}}; +c()})}};d.push(h);this.configureContextMenu&&this.configureContextMenu(d,a);Blockly.ContextMenu.show(a,d,this.RTL)}}; Blockly.WorkspaceSvg.prototype.updateToolbox=function(a){if(a=Blockly.Options.parseToolboxTree(a)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(a.getElementsByTagName("category").length){if(!this.toolbox_)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=a;this.toolbox_.renderTree(a)}else{if(!this.flyout_)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree= a;this.flyout_.show(a.childNodes)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.");};Blockly.WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(Blockly.mainWorkspace=this,this.setBrowserFocus())};Blockly.WorkspaceSvg.prototype.setBrowserFocus=function(){document.activeElement&&document.activeElement.blur();try{this.getParentSvg().focus({preventScroll:!0})}catch(a){try{this.getParentSvg().parentNode.setActive()}catch(b){this.getParentSvg().parentNode.focus({preventScroll:!0})}}}; Blockly.WorkspaceSvg.prototype.zoom=function(a,b,c){c=Math.pow(this.options.zoomOptions.scaleSpeed,c);var d=this.scale*c;if(this.scale!=d){d>this.options.zoomOptions.maxScale?c=this.options.zoomOptions.maxScale/this.scale:dthis.options.zoomOptions.maxScale?a=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&ab.viewBottom||b.contentLeftb.viewRight){c=null;a&&(c=Blockly.Events.getGroup(),Blockly.Events.setGroup(a.group));switch(a.type){case Blockly.Events.BLOCK_CREATE:case Blockly.Events.BLOCK_MOVE:var f= e.getBlockById(a.blockId);f&&(f=f.getRootBlock());break;case Blockly.Events.COMMENT_CREATE:case Blockly.Events.COMMENT_MOVE:f=e.getCommentById(a.commentId)}if(f){d=f.getBoundingRectangle();d.height=d.bottom-d.top;d.width=d.right-d.left;var m=b.viewTop,n=b.viewBottom-d.height;n=Math.max(m,n);m=Blockly.utils.math.clamp(m,d.top,n)-d.top;n=b.viewLeft;var p=b.viewRight-d.width;b.RTL?n=Math.min(p,n):p=Math.max(n,p);b=Blockly.utils.math.clamp(n,d.left,p)-d.left;f.moveBy(b,m)}a&&(!a.group&&f&&console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."), @@ -725,7 +735,7 @@ b.hasTrashcan&&(c=a.trashcan.init(c));b.zoomOptions&&b.zoomOptions.controls&&a.z Blockly.inject.bindDocumentEvents_=function(){Blockly.documentEventsBound_||(Blockly.bindEventWithChecks_(document,"scroll",null,function(){for(var a=Blockly.Workspace.getAll(),b=0,c;c=a[b];b++)c.updateInverseScreenCTM&&c.updateInverseScreenCTM()}),Blockly.bindEventWithChecks_(document,"keydown",null,Blockly.onKeyDown),Blockly.bindEvent_(document,"touchend",null,Blockly.longStop_),Blockly.bindEvent_(document,"touchcancel",null,Blockly.longStop_),Blockly.utils.userAgent.IPAD&&Blockly.bindEventWithChecks_(window, "orientationchange",document,function(){Blockly.svgResize(Blockly.getMainWorkspace())}));Blockly.documentEventsBound_=!0}; Blockly.inject.loadSounds_=function(a,b){var c=b.getAudioManager();c.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");c.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect");c.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var d=[];a=function(){for(;d.length;)Blockly.unbindEvent_(d.pop());c.preload()};d.push(Blockly.bindEventWithChecks_(document,"mousemove",null,a,!0));d.push(Blockly.bindEventWithChecks_(document,"touchstart",null,a,!0))};Blockly.Names=function(a,b){this.variablePrefix_=b||"";this.reservedDict_=Object.create(null);if(a)for(a=a.split(","),b=0;be?Blockly.WidgetDiv.positionInternal_(a,0,c.height+e):Blockly.WidgetDiv.positionInternal_(a,e,c.height)};Blockly.WidgetDiv.calculateX_=function(a,b,c,d){if(d)return b=Math.max(b.right-c.width,a.left),Math.min(b,a.right-c.width);b=Math.min(b.left,a.right-c.width);return Math.max(b,a.left)}; -Blockly.WidgetDiv.calculateY_=function(a,b,c){return b.bottom+c.height>=a.bottom?b.top-c.height:b.bottom};Blockly.VERSION="3.20200123.1";Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.draggingConnections=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.clipboardTypeCounts_=null;Blockly.cache3dSupported_=null;Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()}; +Blockly.WidgetDiv.calculateY_=function(a,b,c){return b.bottom+c.height>=a.bottom?b.top-c.height:b.bottom};Blockly.VERSION="3.20200402.0";Blockly.mainWorkspace=null;Blockly.selected=null;Blockly.draggingConnections=[];Blockly.clipboardXml_=null;Blockly.clipboardSource_=null;Blockly.clipboardTypeCounts_=null;Blockly.cache3dSupported_=null;Blockly.parentContainer=null;Blockly.svgSize=function(a){return{width:a.cachedWidth_,height:a.cachedHeight_}};Blockly.resizeSvgContents=function(a){a.resizeContents()}; Blockly.svgResize=function(a){for(;a.options.parentWorkspace;)a=a.options.parentWorkspace;var b=a.getParentSvg(),c=b.parentNode;if(c){var d=c.offsetWidth;c=c.offsetHeight;b.cachedWidth_!=d&&(b.setAttribute("width",d+"px"),b.cachedWidth_=d);b.cachedHeight_!=c&&(b.setAttribute("height",c+"px"),b.cachedHeight_=c);a.resize()}}; Blockly.onKeyDown=function(a){var b=Blockly.mainWorkspace;if(b&&!(Blockly.utils.isTargetInput(a)||b.rendered&&!b.isVisible()))if(b.options.readOnly)Blockly.navigation.onKeyPress(a);else{var c=!1;if(a.keyCode==Blockly.utils.KeyCodes.ESC)Blockly.hideChaff(),Blockly.navigation.onBlocklyAction(Blockly.navigation.ACTION_EXIT);else{if(Blockly.navigation.onKeyPress(a))return;if(a.keyCode==Blockly.utils.KeyCodes.BACKSPACE||a.keyCode==Blockly.utils.KeyCodes.DELETE){a.preventDefault();if(Blockly.Gesture.inProgress())return; Blockly.selected&&Blockly.selected.isDeletable()&&(c=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(Blockly.Gesture.inProgress())return;Blockly.selected&&Blockly.selected.isDeletable()&&Blockly.selected.isMovable()&&(a.keyCode==Blockly.utils.KeyCodes.C?(Blockly.hideChaff(),Blockly.copy_(Blockly.selected)):a.keyCode!=Blockly.utils.KeyCodes.X||Blockly.selected.workspace.isFlyout||(Blockly.copy_(Blockly.selected),c=!0));a.keyCode==Blockly.utils.KeyCodes.V?Blockly.clipboardXml_&&(a=Blockly.clipboardSource_, @@ -774,7 +784,7 @@ k,!1),f.push([a,h,k])}return f};Blockly.unbindEvent_=function(a){for(;a.length;) Blockly.checkBlockColourConstants=function(){Blockly.checkBlockColourConstant_("LOGIC_HUE",["Blocks","logic","HUE"],void 0);Blockly.checkBlockColourConstant_("LOGIC_HUE",["Constants","Logic","HUE"],210);Blockly.checkBlockColourConstant_("LOOPS_HUE",["Blocks","loops","HUE"],void 0);Blockly.checkBlockColourConstant_("LOOPS_HUE",["Constants","Loops","HUE"],120);Blockly.checkBlockColourConstant_("MATH_HUE",["Blocks","math","HUE"],void 0);Blockly.checkBlockColourConstant_("MATH_HUE",["Constants","Math", "HUE"],230);Blockly.checkBlockColourConstant_("TEXTS_HUE",["Blocks","texts","HUE"],void 0);Blockly.checkBlockColourConstant_("TEXTS_HUE",["Constants","Text","HUE"],160);Blockly.checkBlockColourConstant_("LISTS_HUE",["Blocks","lists","HUE"],void 0);Blockly.checkBlockColourConstant_("LISTS_HUE",["Constants","Lists","HUE"],260);Blockly.checkBlockColourConstant_("COLOUR_HUE",["Blocks","colour","HUE"],void 0);Blockly.checkBlockColourConstant_("COLOUR_HUE",["Constants","Colour","HUE"],20);Blockly.checkBlockColourConstant_("VARIABLES_HUE", ["Blocks","variables","HUE"],void 0);Blockly.checkBlockColourConstant_("VARIABLES_HUE",["Constants","Variables","HUE"],330);Blockly.checkBlockColourConstant_("VARIABLES_DYNAMIC_HUE",["Constants","VariablesDynamic","HUE"],310);Blockly.checkBlockColourConstant_("PROCEDURES_HUE",["Blocks","procedures","HUE"],void 0)}; -Blockly.checkBlockColourConstant_=function(a,b,c){for(var d="Blockly",e=Blockly,f=0;f-b||a<-180+b||a>180-b?!0:!1};Blockly.VerticalFlyout.prototype.getClientRect=function(){if(!this.svgGroup_)return null;var a=this.svgGroup_.getBoundingClientRect(),b=a.left;return this.toolboxPosition_==Blockly.TOOLBOX_AT_LEFT?new Blockly.utils.Rect(-1E9,1E9,-1E9,b+a.width):new Blockly.utils.Rect(-1E9,1E9,b,1E9)}; Blockly.VerticalFlyout.prototype.reflowInternal_=function(){this.workspace_.scale=this.targetWorkspace_.scale;for(var a=0,b=this.workspace_.getTopBlocks(!1),c=0,d;d=b[c];c++){var e=d.getHeightWidth().width;d.outputConnection&&(e-=this.tabWidth_);a=Math.max(a,e)}for(c=0;d=this.buttons_[c];c++)a=Math.max(a,d.width);a+=1.5*this.MARGIN+this.tabWidth_;a*=this.workspace_.scale;a+=Blockly.Scrollbar.scrollbarThickness;if(this.width_!=a){for(c=0;d=b[c];c++){if(this.RTL){e=d.getRelativeToSurfaceXY().x;var f= -a/this.workspace_.scale-this.MARGIN;d.outputConnection||(f-=this.tabWidth_);d.moveBy(f-e,0)}d.flyoutRect_&&this.moveRectToBlock_(d.flyoutRect_,d)}if(this.RTL)for(c=0;d=this.buttons_[c];c++)b=d.getPosition().y,d.moveTo(a/this.workspace_.scale-d.width-this.MARGIN-this.tabWidth_,b);this.width_=a;this.position()}};Blockly.FlyoutButton=function(a,b,c,d){this.workspace_=a;this.targetWorkspace_=b;this.text_=c.getAttribute("text");this.position_=new Blockly.utils.Coordinate(0,0);this.isLabel_=d;this.callbackKey_=c.getAttribute("callbackKey")||c.getAttribute("callbackkey");this.cssClass_=c.getAttribute("web-class")||null;this.onMouseUpWrapper_=null};Blockly.FlyoutButton.MARGIN=5;Blockly.FlyoutButton.prototype.width=0;Blockly.FlyoutButton.prototype.height=0; +a/this.workspace_.scale-this.MARGIN;d.outputConnection||(f-=this.tabWidth_);d.moveBy(f-e,0)}d.flyoutRect_&&this.moveRectToBlock_(d.flyoutRect_,d)}if(this.RTL)for(c=0;d=this.buttons_[c];c++)b=d.getPosition().y,d.moveTo(a/this.workspace_.scale-d.width-this.MARGIN-this.tabWidth_,b);this.width_=a;this.position()}};Blockly.FlyoutButton=function(a,b,c,d){this.workspace_=a;this.targetWorkspace_=b;this.text_=c.getAttribute("text");this.position_=new Blockly.utils.Coordinate(0,0);this.isLabel_=d;this.callbackKey_=c.getAttribute("callbackKey")||c.getAttribute("callbackkey");this.cssClass_=c.getAttribute("web-class")||null;this.onMouseUpWrapper_=null};Blockly.FlyoutButton.MARGIN_X=5;Blockly.FlyoutButton.MARGIN_Y=2;Blockly.FlyoutButton.prototype.width=0;Blockly.FlyoutButton.prototype.height=0; Blockly.FlyoutButton.prototype.createDom=function(){var a=this.isLabel_?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.cssClass_&&(a+=" "+this.cssClass_);this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":a},this.workspace_.getCanvas());if(!this.isLabel_)var b=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.svgGroup_);a=Blockly.utils.dom.createSvgElement("rect",{"class":this.isLabel_?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground", -rx:4,ry:4},this.svgGroup_);var c=Blockly.utils.dom.createSvgElement("text",{"class":this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_),d=Blockly.utils.replaceMessageReferences(this.text_);this.workspace_.RTL&&(d+="\u200f");c.textContent=d;this.isLabel_&&(this.svgText_=c,this.workspace_.getThemeManager().subscribe(this.svgText_,"flyoutForegroundColour","fill"));this.width=Blockly.utils.dom.getTextWidth(c);this.height=20;this.isLabel_||(this.width+= -2*Blockly.FlyoutButton.MARGIN,b.setAttribute("width",this.width),b.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);c.setAttribute("x",this.width/2);c.setAttribute("y",this.height-Blockly.FlyoutButton.MARGIN);this.updateTransform_();this.onMouseUpWrapper_=Blockly.bindEventWithChecks_(this.svgGroup_,"mouseup",this,this.onMouseUp_);return this.svgGroup_}; -Blockly.FlyoutButton.prototype.show=function(){this.updateTransform_();this.svgGroup_.setAttribute("display","block")};Blockly.FlyoutButton.prototype.updateTransform_=function(){this.svgGroup_.setAttribute("transform","translate("+this.position_.x+","+this.position_.y+")")};Blockly.FlyoutButton.prototype.moveTo=function(a,b){this.position_.x=a;this.position_.y=b;this.updateTransform_()};Blockly.FlyoutButton.prototype.getPosition=function(){return this.position_}; -Blockly.FlyoutButton.prototype.getTargetWorkspace=function(){return this.targetWorkspace_};Blockly.FlyoutButton.prototype.dispose=function(){this.onMouseUpWrapper_&&Blockly.unbindEvent_(this.onMouseUpWrapper_);this.svgGroup_&&Blockly.utils.dom.removeNode(this.svgGroup_);this.svgText_&&this.workspace_.getThemeManager().unsubscribe(this.svgText_)}; -Blockly.FlyoutButton.prototype.onMouseUp_=function(a){(a=this.targetWorkspace_.getGesture(a))&&a.cancel();this.isLabel_&&this.callbackKey_?console.warn("Labels should not have callbacks. Label text: "+this.text_):this.isLabel_||this.callbackKey_&&this.targetWorkspace_.getButtonCallback(this.callbackKey_)?this.isLabel_||this.targetWorkspace_.getButtonCallback(this.callbackKey_)(this):console.warn("Buttons should have callbacks. Button text: "+this.text_)};Blockly.Css.register(".blocklyFlyoutButton {,fill: #888;,cursor: default;,},.blocklyFlyoutButtonShadow {,fill: #666;,},.blocklyFlyoutButton:hover {,fill: #aaa;,},.blocklyFlyoutLabel {,cursor: default;,},.blocklyFlyoutLabelBackground {,opacity: 0;,},.blocklyFlyoutLabelText {,fill: #000;,}".split(","));Blockly.Generator=function(a){this.name_=a;this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")};Blockly.Generator.NAME_TYPE="generated_function";Blockly.Generator.prototype.INFINITE_LOOP_TRAP=null;Blockly.Generator.prototype.STATEMENT_PREFIX=null;Blockly.Generator.prototype.STATEMENT_SUFFIX=null;Blockly.Generator.prototype.INDENT=" ";Blockly.Generator.prototype.COMMENT_WRAP=60;Blockly.Generator.prototype.ORDER_OVERRIDES=[]; +rx:4,ry:4},this.svgGroup_);var c=Blockly.utils.dom.createSvgElement("text",{"class":this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_),d=Blockly.utils.replaceMessageReferences(this.text_);this.workspace_.RTL&&(d+="\u200f");c.textContent=d;this.isLabel_&&(this.svgText_=c,this.workspace_.getThemeManager().subscribe(this.svgText_,"flyoutForegroundColour","fill"));var e=Blockly.utils.style.getComputedStyle(c,"fontSize"),f=Blockly.utils.style.getComputedStyle(c, +"fontWeight"),g=Blockly.utils.style.getComputedStyle(c,"fontFamily");this.width=Blockly.utils.dom.getFastTextWidthWithSizeString(c,e,f,g);d=Blockly.utils.dom.measureFontMetrics(d,e,f,g);this.height=d.height;this.isLabel_||(this.width+=2*Blockly.FlyoutButton.MARGIN_X,this.height+=2*Blockly.FlyoutButton.MARGIN_Y,b.setAttribute("width",this.width),b.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);c.setAttribute("x",this.width/2);c.setAttribute("y", +this.height/2-d.height/2+d.baseline);this.updateTransform_();this.onMouseUpWrapper_=Blockly.bindEventWithChecks_(this.svgGroup_,"mouseup",this,this.onMouseUp_);return this.svgGroup_};Blockly.FlyoutButton.prototype.show=function(){this.updateTransform_();this.svgGroup_.setAttribute("display","block")};Blockly.FlyoutButton.prototype.updateTransform_=function(){this.svgGroup_.setAttribute("transform","translate("+this.position_.x+","+this.position_.y+")")}; +Blockly.FlyoutButton.prototype.moveTo=function(a,b){this.position_.x=a;this.position_.y=b;this.updateTransform_()};Blockly.FlyoutButton.prototype.getPosition=function(){return this.position_};Blockly.FlyoutButton.prototype.getTargetWorkspace=function(){return this.targetWorkspace_};Blockly.FlyoutButton.prototype.dispose=function(){this.onMouseUpWrapper_&&Blockly.unbindEvent_(this.onMouseUpWrapper_);this.svgGroup_&&Blockly.utils.dom.removeNode(this.svgGroup_);this.svgText_&&this.workspace_.getThemeManager().unsubscribe(this.svgText_)}; +Blockly.FlyoutButton.prototype.onMouseUp_=function(a){(a=this.targetWorkspace_.getGesture(a))&&a.cancel();this.isLabel_&&this.callbackKey_?console.warn("Labels should not have callbacks. Label text: "+this.text_):this.isLabel_||this.callbackKey_&&this.targetWorkspace_.getButtonCallback(this.callbackKey_)?this.isLabel_||this.targetWorkspace_.getButtonCallback(this.callbackKey_)(this):console.warn("Buttons should have callbacks. Button text: "+this.text_)};Blockly.Css.register(".blocklyFlyoutButton {,fill: #888;,cursor: default;,},.blocklyFlyoutButtonShadow {,fill: #666;,},.blocklyFlyoutButton:hover {,fill: #aaa;,},.blocklyFlyoutLabel {,cursor: default;,},.blocklyFlyoutLabelBackground {,opacity: 0;,}".split(","));Blockly.Generator=function(a){this.name_=a;this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")};Blockly.Generator.NAME_TYPE="generated_function";Blockly.Generator.prototype.INFINITE_LOOP_TRAP=null;Blockly.Generator.prototype.STATEMENT_PREFIX=null;Blockly.Generator.prototype.STATEMENT_SUFFIX=null;Blockly.Generator.prototype.INDENT=" ";Blockly.Generator.prototype.COMMENT_WRAP=60;Blockly.Generator.prototype.ORDER_OVERRIDES=[]; Blockly.Generator.prototype.workspaceToCode=function(a){a||(console.warn("No workspace specified in workspaceToCode call. Guessing."),a=Blockly.getMainWorkspace());var b=[];this.init(a);a=a.getTopBlocks(!0);for(var c=0,d;d=a[c];c++){var e=this.blockToCode(d);Array.isArray(e)&&(e=e[0]);e&&(d.outputConnection&&(e=this.scrubNakedValue(e),this.STATEMENT_PREFIX&&!d.suppressPrefixSuffix&&(e=this.injectId(this.STATEMENT_PREFIX,d)+e),this.STATEMENT_SUFFIX&&!d.suppressPrefixSuffix&&(e+=this.injectId(this.STATEMENT_SUFFIX, d))),b.push(e))}b=b.join("\n");b=this.finish(b);b=b.replace(/^\s+\n/,"");b=b.replace(/\n\s+$/,"\n");return b=b.replace(/[ \t]+\n/g,"\n")};Blockly.Generator.prototype.prefixLines=function(a,b){return b+a.replace(/(?!\n$)\n/g,"\n"+b)};Blockly.Generator.prototype.allNestedComments=function(a){var b=[];a=a.getDescendants(!0);for(var c=0;ca&&(a=this.computeDepth_(),this.setDepth_(a));return a};Blockly.tree.BaseNode.prototype.computeDepth_=function(){var a=this.getParent();return a?a.getDepth()+1:0};Blockly.tree.BaseNode.prototype.setDepth_=function(a){if(a!=this.depth_){this.depth_=a;var b=this.getRowElement();if(b){var c=this.getPixelIndent_()+"px";this.isRightToLeft()?b.style.paddingRight=c:b.style.paddingLeft=c}this.forEachChild(function(b){b.setDepth_(a+1)})}}; -Blockly.tree.BaseNode.prototype.contains=function(a){for(;a;){if(a==this)return!0;a=a.getParent()}return!1};Blockly.tree.BaseNode.prototype.getChildren=function(){var a=[];this.forEachChild(function(b){a.push(b)});return a};Blockly.tree.BaseNode.prototype.getFirstChild=function(){return this.getChildAt(0)};Blockly.tree.BaseNode.prototype.getLastChild=function(){return this.getChildAt(this.getChildCount()-1)};Blockly.tree.BaseNode.prototype.getPreviousSibling=function(){return this.previousSibling_}; -Blockly.tree.BaseNode.prototype.getNextSibling=function(){return this.nextSibling_};Blockly.tree.BaseNode.prototype.isLastSibling=function(){return!this.nextSibling_};Blockly.tree.BaseNode.prototype.isSelected=function(){return this.selected_};Blockly.tree.BaseNode.prototype.select=function(){var a=this.getTree();a&&a.setSelectedItem(this)};Blockly.tree.BaseNode.prototype.selectFirst=function(){var a=this.getTree();a&&this.firstChild_&&a.setSelectedItem(this.firstChild_)}; -Blockly.tree.BaseNode.prototype.setSelectedInternal=function(a){if(this.selected_!=a){this.selected_=a;this.updateRow();var b=this.getElement();b&&(Blockly.utils.aria.setState(b,Blockly.utils.aria.State.SELECTED,a),a&&(a=this.getTree().getElement(),Blockly.utils.aria.setState(a,Blockly.utils.aria.State.ACTIVEDESCENDANT,this.getId())))}};Blockly.tree.BaseNode.prototype.getExpanded=function(){return this.expanded_};Blockly.tree.BaseNode.prototype.setExpandedInternal=function(a){this.expanded_=a}; +Blockly.tree.BaseNode.prototype.addChildAt=function(a,b){var c=this.getChildAt(b-1),d=this.getChildAt(b);Blockly.tree.BaseNode.superClass_.addChildAt.call(this,a,b);a.previousSibling_=c;a.nextSibling_=d;c&&(c.nextSibling_=a);d&&(d.previousSibling_=a);(b=this.getTree())&&a.setTreeInternal(b);a.setDepth_(this.getDepth()+1);if(b=this.getElement())if(this.updateExpandIcon(),Blockly.utils.aria.setState(b,Blockly.utils.aria.State.EXPANDED,this.expanded_),this.expanded_){b=this.getChildrenElement();a.getElement()|| +a.createDom();var e=a.getElement(),f=d&&d.getElement();b.insertBefore(e,f);this.isInDocument()&&a.enterDocument();d||(c?c.updateExpandIcon():(Blockly.utils.style.setElementShown(b,!0),this.setExpanded(this.expanded_)))}};Blockly.tree.BaseNode.prototype.add=function(a){if(a.getParent())throw Error(Blockly.Component.Error.PARENT_UNABLE_TO_BE_SET);this.addChildAt(a,this.getChildCount())};Blockly.tree.BaseNode.prototype.getTree=function(){return null}; +Blockly.tree.BaseNode.prototype.getDepth=function(){var a=this.depth_;0>a&&(a=(a=this.getParent())?a.getDepth()+1:0,this.setDepth_(a));return a};Blockly.tree.BaseNode.prototype.setDepth_=function(a){if(a!=this.depth_){this.depth_=a;var b=this.getRowElement();if(b){var c=this.getPixelIndent_()+"px";this.rightToLeft_?b.style.paddingRight=c:b.style.paddingLeft=c}this.forEachChild(function(b){b.setDepth_(a+1)})}};Blockly.tree.BaseNode.prototype.contains=function(a){for(;a;){if(a==this)return!0;a=a.getParent()}return!1}; +Blockly.tree.BaseNode.prototype.getChildren=function(){var a=[];this.forEachChild(function(b){a.push(b)});return a};Blockly.tree.BaseNode.prototype.getPreviousSibling=function(){return this.previousSibling_};Blockly.tree.BaseNode.prototype.getNextSibling=function(){return this.nextSibling_};Blockly.tree.BaseNode.prototype.isLastSibling=function(){return!this.nextSibling_};Blockly.tree.BaseNode.prototype.isSelected=function(){return this.selected_}; +Blockly.tree.BaseNode.prototype.select=function(){var a=this.getTree();a&&a.setSelectedItem(this)};Blockly.tree.BaseNode.prototype.setSelected=function(a){if(this.selected_!=a){this.selected_=a;this.updateRow();var b=this.getElement();b&&(Blockly.utils.aria.setState(b,Blockly.utils.aria.State.SELECTED,a),a&&(a=this.getTree().getElement(),Blockly.utils.aria.setState(a,Blockly.utils.aria.State.ACTIVEDESCENDANT,this.getId())))}}; Blockly.tree.BaseNode.prototype.setExpanded=function(a){var b=a!=this.expanded_,c;this.expanded_=a;var d=this.getTree(),e=this.getElement();if(this.hasChildren()){if(!a&&d&&this.contains(d.getSelectedItem())&&this.select(),e){if(c=this.getChildrenElement())Blockly.utils.style.setElementShown(c,a),Blockly.utils.aria.setState(e,Blockly.utils.aria.State.EXPANDED,a),a&&this.isInDocument()&&!c.hasChildNodes()&&(this.forEachChild(function(a){c.appendChild(a.toDom())}),this.forEachChild(function(a){a.enterDocument()})); -this.updateExpandIcon()}}else(c=this.getChildrenElement())&&Blockly.utils.style.setElementShown(c,!1);e&&this.updateIcon_();b&&(a?this.doNodeExpanded():this.doNodeCollapsed())};Blockly.tree.BaseNode.prototype.doNodeExpanded=function(){};Blockly.tree.BaseNode.prototype.doNodeCollapsed=function(){};Blockly.tree.BaseNode.prototype.toggle=function(){this.setExpanded(!this.getExpanded())};Blockly.tree.BaseNode.prototype.isUserCollapsible=function(){return this.isUserCollapsible_}; -Blockly.tree.BaseNode.prototype.toDom=function(){var a=this.getExpanded()&&this.hasChildren(),b=document.createElement("div");b.style.backgroundPosition=this.getBackgroundPosition();a||(b.style.display="none");a&&this.forEachChild(function(a){b.appendChild(a.toDom())});a=document.createElement("div");a.id=this.getId();a.appendChild(this.getRowDom());a.appendChild(b);return a};Blockly.tree.BaseNode.prototype.getPixelIndent_=function(){return Math.max(0,(this.getDepth()-1)*this.config_.indentWidth)}; -Blockly.tree.BaseNode.prototype.getRowDom=function(){var a=document.createElement("div");a.className=this.getRowClassName();a.style["padding-"+(this.isRightToLeft()?"right":"left")]=this.getPixelIndent_()+"px";a.appendChild(this.getIconDom());a.appendChild(this.getLabelDom());return a};Blockly.tree.BaseNode.prototype.getRowClassName=function(){var a="";this.isSelected()&&(a=" "+(this.config_.cssSelectedRow||""));return this.config_.cssTreeRow+a}; -Blockly.tree.BaseNode.prototype.getLabelDom=function(){var a=document.createElement("span");a.className=this.config_.cssItemLabel||"";a.textContent=this.getText();return a};Blockly.tree.BaseNode.prototype.getIconDom=function(){var a=document.createElement("span");a.style.display="inline-block";a.className=this.getCalculatedIconClass();return a};Blockly.tree.BaseNode.prototype.getCalculatedIconClass=function(){throw Error("unimplemented abstract method");}; +this.updateExpandIcon()}}else(c=this.getChildrenElement())&&Blockly.utils.style.setElementShown(c,!1);e&&this.updateIcon_();b&&(a?this.doNodeExpanded():this.doNodeCollapsed())};Blockly.tree.BaseNode.prototype.doNodeExpanded=function(){};Blockly.tree.BaseNode.prototype.doNodeCollapsed=function(){};Blockly.tree.BaseNode.prototype.toggle=function(){this.setExpanded(!this.expanded_)}; +Blockly.tree.BaseNode.prototype.toDom=function(){var a=this.expanded_&&this.hasChildren(),b=document.createElement("div");b.style.backgroundPosition=this.getBackgroundPosition();a||(b.style.display="none");a&&this.forEachChild(function(a){b.appendChild(a.toDom())});a=document.createElement("div");a.id=this.getId();a.appendChild(this.getRowDom());a.appendChild(b);return a};Blockly.tree.BaseNode.prototype.getPixelIndent_=function(){return Math.max(0,(this.getDepth()-1)*this.config_.indentWidth)}; +Blockly.tree.BaseNode.prototype.getRowDom=function(){var a=document.createElement("div");a.className=this.getRowClassName();a.style["padding-"+(this.rightToLeft_?"right":"left")]=this.getPixelIndent_()+"px";a.appendChild(this.getIconDom());a.appendChild(this.getLabelDom());return a};Blockly.tree.BaseNode.prototype.getRowClassName=function(){var a="";this.isSelected()&&(a=" "+(this.config_.cssSelectedRow||""));return this.config_.cssTreeRow+a}; +Blockly.tree.BaseNode.prototype.getLabelDom=function(){var a=document.createElement("span");a.className=this.config_.cssItemLabel||"";a.textContent=this.content;return a};Blockly.tree.BaseNode.prototype.getIconDom=function(){var a=document.createElement("span");a.style.display="inline-block";a.className=this.getCalculatedIconClass();return a};Blockly.tree.BaseNode.prototype.getCalculatedIconClass=function(){throw Error("unimplemented abstract method");}; Blockly.tree.BaseNode.prototype.getBackgroundPosition=function(){return(this.isLastSibling()?"-100":(this.getDepth()-1)*this.config_.indentWidth)+"px 0"};Blockly.tree.BaseNode.prototype.getElement=function(){var a=Blockly.tree.BaseNode.superClass_.getElement.call(this);a||(a=document.getElementById(this.getId()),this.setElementInternal(a));return a};Blockly.tree.BaseNode.prototype.getRowElement=function(){var a=this.getElement();return a?a.firstChild:null}; -Blockly.tree.BaseNode.prototype.getIconElement=function(){var a=this.getRowElement();return a?a.firstChild:null};Blockly.tree.BaseNode.prototype.getLabelElement=function(){var a=this.getRowElement();return a&&a.lastChild?a.lastChild.previousSibling:null};Blockly.tree.BaseNode.prototype.getChildrenElement=function(){var a=this.getElement();return a?a.lastChild:null};Blockly.tree.BaseNode.prototype.getIconClass=function(){return this.iconClass_}; -Blockly.tree.BaseNode.prototype.getExpandedIconClass=function(){return this.expandedIconClass_};Blockly.tree.BaseNode.prototype.setText=function(a){this.content_=a};Blockly.tree.BaseNode.prototype.getText=function(){return this.content_};Blockly.tree.BaseNode.prototype.updateRow=function(){var a=this.getRowElement();a&&(a.className=this.getRowClassName())};Blockly.tree.BaseNode.prototype.updateExpandIcon=function(){var a=this.getChildrenElement();a&&(a.style.backgroundPosition=this.getBackgroundPosition())}; -Blockly.tree.BaseNode.prototype.updateIcon_=function(){this.getIconElement().className=this.getCalculatedIconClass()};Blockly.tree.BaseNode.prototype.onMouseDown=function(a){"expand"==a.target.getAttribute("type")&&this.hasChildren()?this.isUserCollapsible_&&this.toggle():(this.select(),this.updateRow())};Blockly.tree.BaseNode.prototype.onClick_=function(a){a.preventDefault()}; -Blockly.tree.BaseNode.prototype.onKeyDown=function(a){var b=!0;switch(a.keyCode){case Blockly.utils.KeyCodes.RIGHT:if(a.altKey)break;b=this.selectChild();break;case Blockly.utils.KeyCodes.LEFT:if(a.altKey)break;b=this.selectParent();break;case Blockly.utils.KeyCodes.DOWN:b=this.selectNext();break;case Blockly.utils.KeyCodes.UP:b=this.selectPrevious();break;default:b=!1}b&&a.preventDefault();return b}; -Blockly.tree.BaseNode.prototype.selectNext=function(){var a=this.getNextShownNode();a&&a.select();return!0};Blockly.tree.BaseNode.prototype.selectPrevious=function(){var a=this.getPreviousShownNode();a&&a.select();return!0};Blockly.tree.BaseNode.prototype.selectParent=function(){if(this.hasChildren()&&this.getExpanded()&&this.isUserCollapsible_)this.setExpanded(!1);else{var a=this.getParent(),b=this.getTree();a&&a!=b&&a.select()}return!0}; -Blockly.tree.BaseNode.prototype.selectChild=function(){return this.hasChildren()?(this.getExpanded()?this.getFirstChild().select():this.setExpanded(!0),!0):!1};Blockly.tree.BaseNode.prototype.getLastShownDescendant=function(){return this.getExpanded()&&this.hasChildren()?this.getLastChild().getLastShownDescendant():this}; -Blockly.tree.BaseNode.prototype.getNextShownNode=function(){if(this.hasChildren()&&this.getExpanded())return this.getFirstChild();for(var a=this,b;a!=this.getTree();){b=a.getNextSibling();if(null!=b)return b;a=a.getParent()}return null};Blockly.tree.BaseNode.prototype.getPreviousShownNode=function(){var a=this.getPreviousSibling();if(null!=a)return a.getLastShownDescendant();a=this.getParent();var b=this.getTree();return a==b||this==b?null:a};Blockly.tree.BaseNode.prototype.getConfig=function(){return this.config_}; +Blockly.tree.BaseNode.prototype.getIconElement=function(){var a=this.getRowElement();return a?a.firstChild:null};Blockly.tree.BaseNode.prototype.getLabelElement=function(){var a=this.getRowElement();return a&&a.lastChild?a.lastChild.previousSibling:null};Blockly.tree.BaseNode.prototype.getChildrenElement=function(){var a=this.getElement();return a?a.lastChild:null};Blockly.tree.BaseNode.prototype.updateRow=function(){var a=this.getRowElement();a&&(a.className=this.getRowClassName())}; +Blockly.tree.BaseNode.prototype.updateExpandIcon=function(){var a=this.getChildrenElement();a&&(a.style.backgroundPosition=this.getBackgroundPosition())};Blockly.tree.BaseNode.prototype.updateIcon_=function(){this.getIconElement().className=this.getCalculatedIconClass()};Blockly.tree.BaseNode.prototype.onMouseDown=function(a){"expand"==a.target.getAttribute("type")&&this.hasChildren()?this.isUserCollapsible_&&this.toggle():(this.select(),this.updateRow())}; +Blockly.tree.BaseNode.prototype.onClick_=function(a){a.preventDefault()};Blockly.tree.BaseNode.prototype.onKeyDown=function(a){var b=!0;switch(a.keyCode){case Blockly.utils.KeyCodes.RIGHT:if(a.altKey)break;b=this.selectChild();break;case Blockly.utils.KeyCodes.LEFT:if(a.altKey)break;b=this.selectParent();break;case Blockly.utils.KeyCodes.DOWN:b=this.selectNext();break;case Blockly.utils.KeyCodes.UP:b=this.selectPrevious();break;default:b=!1}b&&a.preventDefault();return b}; +Blockly.tree.BaseNode.prototype.selectNext=function(){var a=this.getNextShownNode();a&&a.select();return!0};Blockly.tree.BaseNode.prototype.selectPrevious=function(){var a=this.getPreviousShownNode();a&&a.select();return!0};Blockly.tree.BaseNode.prototype.selectParent=function(){if(this.hasChildren()&&this.expanded_&&this.isUserCollapsible_)this.setExpanded(!1);else{var a=this.getParent(),b=this.getTree();a&&a!=b&&a.select()}return!0}; +Blockly.tree.BaseNode.prototype.selectChild=function(){return this.hasChildren()?(this.expanded_?this.getChildAt(0).select():this.setExpanded(!0),!0):!1};Blockly.tree.BaseNode.prototype.getLastShownDescendant=function(){return this.expanded_&&this.hasChildren()?this.getChildAt(this.getChildCount()-1).getLastShownDescendant():this}; +Blockly.tree.BaseNode.prototype.getNextShownNode=function(){if(this.hasChildren()&&this.expanded_)return this.getChildAt(0);for(var a=this,b;a!=this.getTree();){b=a.getNextSibling();if(null!=b)return b;a=a.getParent()}return null};Blockly.tree.BaseNode.prototype.getPreviousShownNode=function(){var a=this.getPreviousSibling();if(null!=a)return a.getLastShownDescendant();a=this.getParent();var b=this.getTree();return a==b||this==b?null:a}; Blockly.tree.BaseNode.prototype.setTreeInternal=function(a){this.tree!=a&&(this.tree=a,this.forEachChild(function(b){b.setTreeInternal(a)}))};Blockly.tree.TreeNode=function(a,b,c){this.toolbox_=a;Blockly.tree.BaseNode.call(this,b,c)};Blockly.utils.object.inherits(Blockly.tree.TreeNode,Blockly.tree.BaseNode);Blockly.tree.TreeNode.prototype.getTree=function(){if(this.tree)return this.tree;var a=this.getParent();return a&&(a=a.getTree())?(this.setTreeInternal(a),a):null}; -Blockly.tree.TreeNode.prototype.getCalculatedIconClass=function(){var a=this.getExpanded(),b=this.getExpandedIconClass();if(a&&b)return b;b=this.getIconClass();if(!a&&b)return b;b=this.getConfig();if(this.hasChildren()){if(a&&b.cssExpandedFolderIcon)return b.cssTreeIcon+" "+b.cssExpandedFolderIcon;if(!a&&b.cssCollapsedFolderIcon)return b.cssTreeIcon+" "+b.cssCollapsedFolderIcon}else if(b.cssFileIcon)return b.cssTreeIcon+" "+b.cssFileIcon;return""}; -Blockly.tree.TreeNode.prototype.onClick_=function(a){this.hasChildren()&&this.isUserCollapsible()?(this.toggle(),this.select()):this.isSelected()?this.getTree().setSelectedItem(null):this.select();this.updateRow()};Blockly.tree.TreeNode.prototype.onMouseDown=function(a){}; -Blockly.tree.TreeNode.prototype.onKeyDown=function(a){if(this.tree.toolbox_.horizontalLayout_){var b={},c=Blockly.utils.KeyCodes.DOWN,d=Blockly.utils.KeyCodes.UP;b[Blockly.utils.KeyCodes.RIGHT]=this.isRightToLeft()?d:c;b[Blockly.utils.KeyCodes.LEFT]=this.isRightToLeft()?c:d;b[Blockly.utils.KeyCodes.UP]=Blockly.utils.KeyCodes.LEFT;b[Blockly.utils.KeyCodes.DOWN]=Blockly.utils.KeyCodes.RIGHT;Object.defineProperties(a,{keyCode:{value:b[a.keyCode]||a.keyCode}})}return Blockly.tree.TreeNode.superClass_.onKeyDown.call(this, -a)};Blockly.tree.TreeNode.prototype.onSizeChanged=function(a){this.onSizeChanged_=a};Blockly.tree.TreeNode.prototype.resizeToolbox_=function(){this.onSizeChanged_&&this.onSizeChanged_.call(this.toolbox_)};Blockly.tree.TreeNode.prototype.doNodeExpanded=Blockly.tree.TreeNode.prototype.resizeToolbox_;Blockly.tree.TreeNode.prototype.doNodeCollapsed=Blockly.tree.TreeNode.prototype.resizeToolbox_;Blockly.tree.TreeControl=function(a,b){this.toolbox_=a;this.onKeydownWrapper_=this.onClickWrapper_=this.onBlurWrapper_=this.onFocusWrapper_=null;Blockly.tree.BaseNode.call(this,"",b);this.setExpandedInternal(!0);this.setSelectedInternal(!0);this.selectedItem_=this};Blockly.utils.object.inherits(Blockly.tree.TreeControl,Blockly.tree.BaseNode);Blockly.tree.TreeControl.prototype.getTree=function(){return this};Blockly.tree.TreeControl.prototype.getToolbox=function(){return this.toolbox_}; +Blockly.tree.TreeNode.prototype.getCalculatedIconClass=function(){var a=this.expanded_;if(a&&this.expandedIconClass)return this.expandedIconClass;var b=this.iconClass;if(!a&&b)return b;b=this.config_;if(this.hasChildren()){if(a&&b.cssExpandedFolderIcon)return b.cssTreeIcon+" "+b.cssExpandedFolderIcon;if(!a&&b.cssCollapsedFolderIcon)return b.cssTreeIcon+" "+b.cssCollapsedFolderIcon}else if(b.cssFileIcon)return b.cssTreeIcon+" "+b.cssFileIcon;return""}; +Blockly.tree.TreeNode.prototype.onClick_=function(a){this.hasChildren()&&this.isUserCollapsible_?(this.toggle(),this.select()):this.isSelected()?this.getTree().setSelectedItem(null):this.select();this.updateRow()};Blockly.tree.TreeNode.prototype.onMouseDown=function(a){}; +Blockly.tree.TreeNode.prototype.onKeyDown=function(a){if(this.tree.toolbox_.horizontalLayout_){var b={},c=Blockly.utils.KeyCodes.DOWN,d=Blockly.utils.KeyCodes.UP;b[Blockly.utils.KeyCodes.RIGHT]=this.rightToLeft_?d:c;b[Blockly.utils.KeyCodes.LEFT]=this.rightToLeft_?c:d;b[Blockly.utils.KeyCodes.UP]=Blockly.utils.KeyCodes.LEFT;b[Blockly.utils.KeyCodes.DOWN]=Blockly.utils.KeyCodes.RIGHT;Object.defineProperties(a,{keyCode:{value:b[a.keyCode]||a.keyCode}})}return Blockly.tree.TreeNode.superClass_.onKeyDown.call(this, +a)};Blockly.tree.TreeNode.prototype.onSizeChanged=function(a){this.onSizeChanged_=a};Blockly.tree.TreeNode.prototype.resizeToolbox_=function(){this.onSizeChanged_&&this.onSizeChanged_.call(this.toolbox_)};Blockly.tree.TreeNode.prototype.doNodeExpanded=Blockly.tree.TreeNode.prototype.resizeToolbox_;Blockly.tree.TreeNode.prototype.doNodeCollapsed=Blockly.tree.TreeNode.prototype.resizeToolbox_;Blockly.tree.TreeControl=function(a,b){this.toolbox_=a;this.onKeydownWrapper_=this.onClickWrapper_=this.onBlurWrapper_=this.onFocusWrapper_=null;Blockly.tree.BaseNode.call(this,"",b);this.selected_=this.expanded_=!0;this.selectedItem_=this};Blockly.utils.object.inherits(Blockly.tree.TreeControl,Blockly.tree.BaseNode);Blockly.tree.TreeControl.prototype.getTree=function(){return this};Blockly.tree.TreeControl.prototype.getToolbox=function(){return this.toolbox_}; Blockly.tree.TreeControl.prototype.getDepth=function(){return 0};Blockly.tree.TreeControl.prototype.handleFocus_=function(a){this.focused_=!0;a=this.getElement();Blockly.utils.dom.addClass(a,"focused");this.selectedItem_&&this.selectedItem_.select()};Blockly.tree.TreeControl.prototype.handleBlur_=function(a){this.focused_=!1;a=this.getElement();Blockly.utils.dom.removeClass(a,"focused")};Blockly.tree.TreeControl.prototype.hasFocus=function(){return this.focused_}; -Blockly.tree.TreeControl.prototype.getExpanded=function(){return!0};Blockly.tree.TreeControl.prototype.setExpanded=function(a){this.setExpandedInternal(a)};Blockly.tree.TreeControl.prototype.getIconElement=function(){var a=this.getRowElement();return a?a.firstChild:null};Blockly.tree.TreeControl.prototype.updateExpandIcon=function(){};Blockly.tree.TreeControl.prototype.getRowClassName=function(){return Blockly.tree.TreeControl.superClass_.getRowClassName.call(this)+" "+this.getConfig().cssHideRoot}; -Blockly.tree.TreeControl.prototype.getCalculatedIconClass=function(){var a=this.getExpanded(),b=this.getExpandedIconClass();if(a&&b)return b;b=this.getIconClass();if(!a&&b)return b;b=this.getConfig();return a&&b.cssExpandedRootIcon?b.cssTreeIcon+" "+b.cssExpandedRootIcon:""}; -Blockly.tree.TreeControl.prototype.setSelectedItem=function(a){if(a!=this.selectedItem_&&(!this.onBeforeSelected_||this.onBeforeSelected_.call(this.toolbox_,a))){var b=this.getSelectedItem();this.selectedItem_&&this.selectedItem_.setSelectedInternal(!1);(this.selectedItem_=a)&&a.setSelectedInternal(!0);this.onAfterSelected_&&this.onAfterSelected_.call(this.toolbox_,b,a)}};Blockly.tree.TreeControl.prototype.onBeforeSelected=function(a){this.onBeforeSelected_=a}; +Blockly.tree.TreeControl.prototype.setExpanded=function(a){this.expanded_=a};Blockly.tree.TreeControl.prototype.getIconElement=function(){var a=this.getRowElement();return a?a.firstChild:null};Blockly.tree.TreeControl.prototype.updateExpandIcon=function(){};Blockly.tree.TreeControl.prototype.getRowClassName=function(){return Blockly.tree.TreeControl.superClass_.getRowClassName.call(this)+" "+this.config_.cssHideRoot}; +Blockly.tree.TreeControl.prototype.getCalculatedIconClass=function(){var a=this.expanded_;if(a&&this.expandedIconClass)return this.expandedIconClass;var b=this.iconClass;return!a&&b?b:a&&this.config_.cssExpandedRootIcon?this.config_.cssTreeIcon+" "+this.config_.cssExpandedRootIcon:""}; +Blockly.tree.TreeControl.prototype.setSelectedItem=function(a){if(a!=this.selectedItem_&&(!this.onBeforeSelected_||this.onBeforeSelected_.call(this.toolbox_,a))){var b=this.getSelectedItem();this.selectedItem_&&this.selectedItem_.setSelected(!1);(this.selectedItem_=a)&&a.setSelected(!0);this.onAfterSelected_&&this.onAfterSelected_.call(this.toolbox_,b,a)}};Blockly.tree.TreeControl.prototype.onBeforeSelected=function(a){this.onBeforeSelected_=a}; Blockly.tree.TreeControl.prototype.onAfterSelected=function(a){this.onAfterSelected_=a};Blockly.tree.TreeControl.prototype.getSelectedItem=function(){return this.selectedItem_};Blockly.tree.TreeControl.prototype.initAccessibility=function(){Blockly.tree.TreeControl.superClass_.initAccessibility.call(this);var a=this.getElement();Blockly.utils.aria.setRole(a,Blockly.utils.aria.Role.TREE);Blockly.utils.aria.setState(a,Blockly.utils.aria.State.LABELLEDBY,this.getLabelElement().id)}; -Blockly.tree.TreeControl.prototype.enterDocument=function(){Blockly.tree.TreeControl.superClass_.enterDocument.call(this);var a=this.getElement();a.className=this.getConfig().cssRoot;a.setAttribute("hideFocus","true");this.attachEvents_();this.initAccessibility()};Blockly.tree.TreeControl.prototype.exitDocument=function(){Blockly.tree.TreeControl.superClass_.exitDocument.call(this);this.detachEvents_()}; +Blockly.tree.TreeControl.prototype.enterDocument=function(){Blockly.tree.TreeControl.superClass_.enterDocument.call(this);var a=this.getElement();a.className=this.config_.cssRoot;a.setAttribute("hideFocus","true");this.attachEvents_();this.initAccessibility()};Blockly.tree.TreeControl.prototype.exitDocument=function(){Blockly.tree.TreeControl.superClass_.exitDocument.call(this);this.detachEvents_()}; Blockly.tree.TreeControl.prototype.attachEvents_=function(){var a=this.getElement();a.tabIndex=0;this.onFocusWrapper_=Blockly.bindEvent_(a,"focus",this,this.handleFocus_);this.onBlurWrapper_=Blockly.bindEvent_(a,"blur",this,this.handleBlur_);this.onClickWrapper_=Blockly.bindEventWithChecks_(a,"click",this,this.handleMouseEvent_);this.onKeydownWrapper_=Blockly.bindEvent_(a,"keydown",this,this.handleKeyEvent_)}; Blockly.tree.TreeControl.prototype.detachEvents_=function(){this.onFocusWrapper_&&(Blockly.unbindEvent_(this.onFocusWrapper_),this.onFocusWrapper_=null);this.onBlurWrapper_&&(Blockly.unbindEvent_(this.onBlurWrapper_),this.onBlurWrapper_=null);this.onClickWrapper_&&(Blockly.unbindEvent_(this.onClickWrapper_),this.onClickWrapper_=null);this.onKeydownWrapper_&&(Blockly.unbindEvent_(this.onKeydownWrapper_),this.onKeydownWrapper_=null)}; Blockly.tree.TreeControl.prototype.handleMouseEvent_=function(a){var b=this.getNodeFromEvent_(a);if(b)switch(a.type){case "mousedown":b.onMouseDown(a);break;case "click":b.onClick_(a)}};Blockly.tree.TreeControl.prototype.handleKeyEvent_=function(a){var b=!1;if(b=this.selectedItem_&&this.selectedItem_.onKeyDown(a)||b)Blockly.utils.style.scrollIntoContainerView(this.selectedItem_.getElement(),this.getElement().parentNode),a.preventDefault();return b}; -Blockly.tree.TreeControl.prototype.getNodeFromEvent_=function(a){for(var b=a.target;null!=b;){if(a=Blockly.tree.BaseNode.allNodes[b.id])return a;if(b==this.getElement())break;b=b.parentNode}return null};Blockly.tree.TreeControl.prototype.createNode=function(a){return new Blockly.tree.TreeNode(this.toolbox_,a||"",this.getConfig())};Blockly.Toolbox=function(a){this.workspace_=a;this.RTL=a.options.RTL;this.horizontalLayout_=a.options.horizontalLayout;this.toolboxPosition=a.options.toolboxPosition;this.config_={indentWidth:19,cssRoot:"blocklyTreeRoot",cssHideRoot:"blocklyHidden",cssTreeRow:"blocklyTreeRow",cssItemLabel:"blocklyTreeLabel",cssTreeIcon:"blocklyTreeIcon",cssExpandedFolderIcon:"blocklyTreeIconOpen",cssFileIcon:"blocklyTreeIconNone",cssSelectedRow:"blocklyTreeSelected"};this.treeSeparatorConfig_={cssTreeRow:"blocklyTreeSeparator"}; +Blockly.tree.TreeControl.prototype.getNodeFromEvent_=function(a){for(var b=a.target;null!=b;){if(a=Blockly.tree.BaseNode.allNodes[b.id])return a;if(b==this.getElement())break;if(b.getAttribute("role")==Blockly.utils.aria.Role.GROUP)break;b=b.parentNode}return null};Blockly.tree.TreeControl.prototype.createNode=function(a){return new Blockly.tree.TreeNode(this.toolbox_,a||"",this.config_)};Blockly.Toolbox=function(a){this.workspace_=a;this.RTL=a.options.RTL;this.horizontalLayout_=a.options.horizontalLayout;this.toolboxPosition=a.options.toolboxPosition;this.config_={indentWidth:19,cssRoot:"blocklyTreeRoot",cssHideRoot:"blocklyHidden",cssTreeRow:"blocklyTreeRow",cssItemLabel:"blocklyTreeLabel",cssTreeIcon:"blocklyTreeIcon",cssExpandedFolderIcon:"blocklyTreeIconOpen",cssFileIcon:"blocklyTreeIconNone",cssSelectedRow:"blocklyTreeSelected"};this.treeSeparatorConfig_={cssTreeRow:"blocklyTreeSeparator"}; this.horizontalLayout_&&(this.config_.cssTreeRow+=a.RTL?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.treeSeparatorConfig_.cssTreeRow="blocklyTreeSeparatorHorizontal "+(a.RTL?"blocklyHorizontalTreeRtl":"blocklyHorizontalTree"),this.config_.cssTreeIcon="");this.flyout_=null};Blockly.Toolbox.prototype.width=0;Blockly.Toolbox.prototype.height=0;Blockly.Toolbox.prototype.selectedOption_=null;Blockly.Toolbox.prototype.lastCategory_=null; Blockly.Toolbox.prototype.init=function(){var a=this.workspace_,b=this.workspace_.getParentSvg();this.HtmlDiv=document.createElement("div");this.HtmlDiv.className="blocklyToolboxDiv blocklyNonSelectable";this.HtmlDiv.setAttribute("dir",a.RTL?"RTL":"LTR");b.parentNode.insertBefore(this.HtmlDiv,b);var c=a.getThemeManager();c.subscribe(this.HtmlDiv,"toolboxBackgroundColour","background-color");c.subscribe(this.HtmlDiv,"toolboxForegroundColour","color");Blockly.bindEventWithChecks_(this.HtmlDiv,"mousedown", -this,function(a){Blockly.utils.isRightButton(a)||a.target==this.HtmlDiv?Blockly.hideChaff(!1):Blockly.hideChaff(!0);Blockly.Touch.clearTouchIdentifier()},!1,!0);c=new Blockly.Options({parentWorkspace:a,rtl:a.RTL,oneBasedIndex:a.options.oneBasedIndex,horizontalLayout:a.horizontalLayout,renderer:a.options.renderer});c.toolboxPosition=a.options.toolboxPosition;if(a.horizontalLayout){if(!Blockly.HorizontalFlyout)throw Error("Missing require for Blockly.HorizontalFlyout");this.flyout_=new Blockly.HorizontalFlyout(c)}else{if(!Blockly.VerticalFlyout)throw Error("Missing require for Blockly.VerticalFlyout"); -this.flyout_=new Blockly.VerticalFlyout(c)}if(!this.flyout_)throw Error("One of Blockly.VerticalFlyout or Blockly.Horizontal must berequired.");Blockly.utils.dom.insertAfter(this.flyout_.createDom("svg"),b);this.flyout_.init(a);this.config_.cleardotPath=a.options.pathToMedia+"1x1.gif";this.config_.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(a.RTL?"Rtl":"Ltr");this.renderTree(a.options.languageTree)}; -Blockly.Toolbox.prototype.renderTree=function(a){this.tree_&&(this.tree_.dispose(),this.lastCategory_=null);var b=new Blockly.tree.TreeControl(this,this.config_);this.tree_=b;b.setSelectedItem(null);b.onBeforeSelected(this.handleBeforeTreeSelected_);b.onAfterSelected(this.handleAfterTreeSelected_);var c=null;if(a){this.tree_.blocks=[];this.hasColours_=!1;c=this.syncTrees_(a,this.tree_,this.workspace_.options.pathToMedia);if(this.tree_.blocks.length)throw Error("Toolbox cannot have both blocks and categories in the root level."); -this.workspace_.resizeContents()}b.render(this.HtmlDiv);c&&b.setSelectedItem(c);this.addColour_();this.position();this.horizontalLayout_&&Blockly.utils.aria.setState(this.tree_.getElement(),Blockly.utils.aria.State.ORIENTATION,"horizontal")};Blockly.Toolbox.prototype.handleBeforeTreeSelected_=function(a){if(a==this.tree_)return!1;this.lastCategory_&&(this.lastCategory_.getRowElement().style.backgroundColor="");if(a){var b=a.hexColour||"#57e";a.getRowElement().style.backgroundColor=b;this.addColour_(a)}return!0}; +this,function(a){Blockly.utils.isRightButton(a)||a.target==this.HtmlDiv?Blockly.hideChaff(!1):Blockly.hideChaff(!0);Blockly.Touch.clearTouchIdentifier()},!1,!0);c=new Blockly.Options({parentWorkspace:a,rtl:a.RTL,oneBasedIndex:a.options.oneBasedIndex,horizontalLayout:a.horizontalLayout,renderer:a.options.renderer,rendererOverrides:a.options.rendererOverrides});c.toolboxPosition=a.options.toolboxPosition;if(a.horizontalLayout){if(!Blockly.HorizontalFlyout)throw Error("Missing require for Blockly.HorizontalFlyout"); +this.flyout_=new Blockly.HorizontalFlyout(c)}else{if(!Blockly.VerticalFlyout)throw Error("Missing require for Blockly.VerticalFlyout");this.flyout_=new Blockly.VerticalFlyout(c)}if(!this.flyout_)throw Error("One of Blockly.VerticalFlyout or Blockly.Horizontal must berequired.");Blockly.utils.dom.insertAfter(this.flyout_.createDom("svg"),b);this.flyout_.init(a);this.config_.cleardotPath=a.options.pathToMedia+"1x1.gif";this.config_.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(a.RTL?"Rtl":"Ltr"); +this.renderTree(a.options.languageTree)}; +Blockly.Toolbox.prototype.renderTree=function(a){this.tree_&&(this.tree_.dispose(),this.lastCategory_=null);var b=new Blockly.tree.TreeControl(this,this.config_);this.tree_=b;b.setSelectedItem(null);b.onBeforeSelected(this.handleBeforeTreeSelected_);b.onAfterSelected(this.handleAfterTreeSelected_);var c=null;if(a){this.tree_.blocks=[];this.hasColours_=!1;c=this.syncTrees_(a,this.tree_,this.workspace_.options.pathToMedia);if(this.tree_.blocks.length)throw Error("Toolbox cannot have both blocks and categories in the root level.");this.workspace_.resizeContents()}b.render(this.HtmlDiv); +c&&b.setSelectedItem(c);this.addColour_();this.position();this.horizontalLayout_&&Blockly.utils.aria.setState(this.tree_.getElement(),Blockly.utils.aria.State.ORIENTATION,"horizontal")};Blockly.Toolbox.prototype.handleBeforeTreeSelected_=function(a){if(a==this.tree_)return!1;this.lastCategory_&&(this.lastCategory_.getRowElement().style.backgroundColor="");if(a){var b=a.hexColour||"#57e";a.getRowElement().style.backgroundColor=b;this.addColour_(a)}return!0}; Blockly.Toolbox.prototype.handleAfterTreeSelected_=function(a,b){b&&b.blocks&&b.blocks.length?(this.flyout_.show(b.blocks),this.lastCategory_!=b&&this.flyout_.scrollToStart(),this.workspace_.keyboardAccessibilityMode&&Blockly.navigation.setState(Blockly.navigation.STATE_TOOLBOX)):(this.flyout_.hide(),!this.workspace_.keyboardAccessibilityMode||b instanceof Blockly.Toolbox.TreeSeparator||Blockly.navigation.setState(Blockly.navigation.STATE_WS));a!=b&&a!=this&&(a=new Blockly.Events.Ui(null,"category", -a&&a.getText(),b&&b.getText()),a.workspaceId=this.workspace_.id,Blockly.Events.fire(a));b&&(this.lastCategory_=b)};Blockly.Toolbox.prototype.handleNodeSizeChanged_=function(){Blockly.svgResize(this.workspace_)}; +a&&a.content,b&&b.content),a.workspaceId=this.workspace_.id,Blockly.Events.fire(a));b&&(this.lastCategory_=b)};Blockly.Toolbox.prototype.handleNodeSizeChanged_=function(){Blockly.svgResize(this.workspace_)}; Blockly.Toolbox.prototype.onBlocklyAction=function(a){var b=this.tree_.getSelectedItem();if(!b)return!1;switch(a.name){case Blockly.navigation.actionNames.PREVIOUS:return b.selectPrevious();case Blockly.navigation.actionNames.OUT:return b.selectParent();case Blockly.navigation.actionNames.NEXT:return b.selectNext();case Blockly.navigation.actionNames.IN:return b.selectChild();default:return!1}}; Blockly.Toolbox.prototype.dispose=function(){this.flyout_.dispose();this.tree_.dispose();this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv);Blockly.utils.dom.removeNode(this.HtmlDiv);this.lastCategory_=null};Blockly.Toolbox.prototype.getWidth=function(){return this.width};Blockly.Toolbox.prototype.getHeight=function(){return this.height};Blockly.Toolbox.prototype.getFlyout=function(){return this.flyout_}; Blockly.Toolbox.prototype.position=function(){var a=this.HtmlDiv;if(a){var b=Blockly.svgSize(this.workspace_.getParentSvg());this.horizontalLayout_?(a.style.left="0",a.style.height="auto",a.style.width=b.width+"px",this.height=a.offsetHeight,this.toolboxPosition==Blockly.TOOLBOX_AT_TOP?a.style.top="0":a.style.bottom="0"):(this.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT?a.style.right="0":a.style.left="0",a.style.height=b.height+"px",this.width=a.offsetWidth);this.flyout_.position()}}; @@ -914,26 +923,27 @@ Blockly.Toolbox.prototype.updateColourFromTheme=function(){var a=this.tree_;a&&( Blockly.Toolbox.prototype.addColour_=function(a){a=(a||this.tree_).getChildren(!1);for(var b=0,c;c=a[b];b++){var d=c.getRowElement();if(d){var e=this.hasColours_?"8px solid "+(c.hexColour||"#ddd"):"none";this.workspace_.RTL?d.style.borderRight=e:d.style.borderLeft=e}this.addColour_(c)}};Blockly.Toolbox.prototype.clearSelection=function(){this.tree_.setSelectedItem(null)};Blockly.Toolbox.prototype.addStyle=function(a){Blockly.utils.dom.addClass(this.HtmlDiv,a)}; Blockly.Toolbox.prototype.removeStyle=function(a){Blockly.utils.dom.removeClass(this.HtmlDiv,a)}; Blockly.Toolbox.prototype.getClientRect=function(){if(!this.HtmlDiv)return null;var a=this.HtmlDiv.getBoundingClientRect(),b=a.top,c=b+a.height,d=a.left;a=d+a.width;return this.toolboxPosition==Blockly.TOOLBOX_AT_TOP?new Blockly.utils.Rect(-1E7,c,-1E7,1E7):this.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM?new Blockly.utils.Rect(b,1E7,-1E7,1E7):this.toolboxPosition==Blockly.TOOLBOX_AT_LEFT?new Blockly.utils.Rect(-1E7,1E7,-1E7,a):new Blockly.utils.Rect(-1E7,1E7,d,1E7)}; -Blockly.Toolbox.prototype.refreshSelection=function(){var a=this.tree_.getSelectedItem();a&&a.blocks&&this.flyout_.show(a.blocks)};Blockly.Toolbox.prototype.selectFirstCategory=function(){this.tree_.getSelectedItem()||this.tree_.selectFirst()};Blockly.Toolbox.TreeSeparator=function(a){Blockly.tree.TreeNode.call(this,null,"",a)};Blockly.utils.object.inherits(Blockly.Toolbox.TreeSeparator,Blockly.tree.TreeNode); +Blockly.Toolbox.prototype.refreshSelection=function(){var a=this.tree_.getSelectedItem();a&&a.blocks&&this.flyout_.show(a.blocks)};Blockly.Toolbox.prototype.selectFirstCategory=function(){this.tree_.getSelectedItem()||this.tree_.selectChild()};Blockly.Toolbox.TreeSeparator=function(a){Blockly.tree.TreeNode.call(this,null,"",a)};Blockly.utils.object.inherits(Blockly.Toolbox.TreeSeparator,Blockly.tree.TreeNode); Blockly.Css.register([".blocklyToolboxDelete {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {", -"height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;", -"}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;","margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<>>/sprites.png);","height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {", +"height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: rgba(255, 255, 255, 0.2);","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;", +"margin: 5px 0;","}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;","margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<>>/sprites.png);","height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {", "background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {", -'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]);Blockly.Trashcan=function(a){this.workspace_=a;this.contents_=[];this.flyout=null;if(!(0>=this.workspace_.options.maxTrashcanContents)){a=new Blockly.Options({scrollbars:!0,parentWorkspace:this.workspace_,rtl:this.workspace_.RTL,oneBasedIndex:this.workspace_.options.oneBasedIndex,renderer:this.workspace_.options.renderer});if(this.workspace_.horizontalLayout){a.toolboxPosition=this.workspace_.toolboxPosition==Blockly.TOOLBOX_AT_TOP?Blockly.TOOLBOX_AT_BOTTOM:Blockly.TOOLBOX_AT_TOP;if(!Blockly.HorizontalFlyout)throw Error("Missing require for Blockly.HorizontalFlyout"); -this.flyout=new Blockly.HorizontalFlyout(a)}else{a.toolboxPosition=this.workspace_.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT?Blockly.TOOLBOX_AT_LEFT:Blockly.TOOLBOX_AT_RIGHT;if(!Blockly.VerticalFlyout)throw Error("Missing require for Blockly.VerticalFlyout");this.flyout=new Blockly.VerticalFlyout(a)}this.workspace_.addChangeListener(this.onDelete_.bind(this))}};Blockly.Trashcan.prototype.WIDTH_=47;Blockly.Trashcan.prototype.BODY_HEIGHT_=44;Blockly.Trashcan.prototype.LID_HEIGHT_=16; -Blockly.Trashcan.prototype.MARGIN_BOTTOM_=20;Blockly.Trashcan.prototype.MARGIN_SIDE_=20;Blockly.Trashcan.prototype.MARGIN_HOTSPOT_=10;Blockly.Trashcan.prototype.SPRITE_LEFT_=0;Blockly.Trashcan.prototype.SPRITE_TOP_=32;Blockly.Trashcan.prototype.HAS_BLOCKS_LID_ANGLE=.1;Blockly.Trashcan.prototype.isOpen=!1;Blockly.Trashcan.prototype.minOpenness_=0;Blockly.Trashcan.prototype.svgGroup_=null;Blockly.Trashcan.prototype.svgLid_=null;Blockly.Trashcan.prototype.lidTask_=0; -Blockly.Trashcan.prototype.lidOpen_=0;Blockly.Trashcan.prototype.left_=0;Blockly.Trashcan.prototype.top_=0; +'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]);Blockly.Trashcan=function(a){this.workspace_=a;this.contents_=[];this.flyout=null;if(!(0>=this.workspace_.options.maxTrashcanContents)){a=new Blockly.Options({scrollbars:!0,parentWorkspace:this.workspace_,rtl:this.workspace_.RTL,oneBasedIndex:this.workspace_.options.oneBasedIndex,renderer:this.workspace_.options.renderer,rendererOverrides:this.workspace_.options.rendererOverrides});if(this.workspace_.horizontalLayout){a.toolboxPosition=this.workspace_.toolboxPosition==Blockly.TOOLBOX_AT_TOP?Blockly.TOOLBOX_AT_BOTTOM: +Blockly.TOOLBOX_AT_TOP;if(!Blockly.HorizontalFlyout)throw Error("Missing require for Blockly.HorizontalFlyout");this.flyout=new Blockly.HorizontalFlyout(a)}else{a.toolboxPosition=this.workspace_.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT?Blockly.TOOLBOX_AT_LEFT:Blockly.TOOLBOX_AT_RIGHT;if(!Blockly.VerticalFlyout)throw Error("Missing require for Blockly.VerticalFlyout");this.flyout=new Blockly.VerticalFlyout(a)}this.workspace_.addChangeListener(this.onDelete_.bind(this))}}; +Blockly.Trashcan.prototype.WIDTH_=47;Blockly.Trashcan.prototype.BODY_HEIGHT_=44;Blockly.Trashcan.prototype.LID_HEIGHT_=16;Blockly.Trashcan.prototype.MARGIN_BOTTOM_=20;Blockly.Trashcan.prototype.MARGIN_SIDE_=20;Blockly.Trashcan.prototype.MARGIN_HOTSPOT_=10;Blockly.Trashcan.prototype.SPRITE_LEFT_=0;Blockly.Trashcan.prototype.SPRITE_TOP_=32;Blockly.Trashcan.prototype.HAS_BLOCKS_LID_ANGLE_=.1;Blockly.Trashcan.ANIMATION_LENGTH_=80;Blockly.Trashcan.ANIMATION_FRAMES_=4;Blockly.Trashcan.OPACITY_MIN_=.4; +Blockly.Trashcan.OPACITY_MAX_=.8;Blockly.Trashcan.MAX_LID_ANGLE_=45;Blockly.Trashcan.prototype.isOpen=!1;Blockly.Trashcan.prototype.minOpenness_=0;Blockly.Trashcan.prototype.svgGroup_=null;Blockly.Trashcan.prototype.svgLid_=null;Blockly.Trashcan.prototype.lidTask_=0;Blockly.Trashcan.prototype.lidOpen_=0;Blockly.Trashcan.prototype.left_=0;Blockly.Trashcan.prototype.top_=0; Blockly.Trashcan.prototype.createDom=function(){this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyTrash"},null);var a=String(Math.random()).substring(2);var b=Blockly.utils.dom.createSvgElement("clipPath",{id:"blocklyTrashBodyClipPath"+a},this.svgGroup_);Blockly.utils.dom.createSvgElement("rect",{width:this.WIDTH_,height:this.BODY_HEIGHT_,y:this.LID_HEIGHT_},b);var c=Blockly.utils.dom.createSvgElement("image",{width:Blockly.SPRITE.width,x:-this.SPRITE_LEFT_,height:Blockly.SPRITE.height, y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.svgGroup_);c.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+Blockly.SPRITE.url);b=Blockly.utils.dom.createSvgElement("clipPath",{id:"blocklyTrashLidClipPath"+a},this.svgGroup_);Blockly.utils.dom.createSvgElement("rect",{width:this.WIDTH_,height:this.LID_HEIGHT_},b);this.svgLid_=Blockly.utils.dom.createSvgElement("image",{width:Blockly.SPRITE.width,x:-this.SPRITE_LEFT_,height:Blockly.SPRITE.height, y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.svgGroup_);this.svgLid_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+Blockly.SPRITE.url);Blockly.bindEventWithChecks_(this.svgGroup_,"mouseup",this,this.click);Blockly.bindEvent_(c,"mouseover",this,this.mouseOver_);Blockly.bindEvent_(c,"mouseout",this,this.mouseOut_);this.animateLid_();return this.svgGroup_}; Blockly.Trashcan.prototype.init=function(a){0this.minOpenness_&&1>this.lidOpen_&&(this.lidTask_=setTimeout(this.animateLid_.bind(this),20))}; -Blockly.Trashcan.prototype.setLidAngle_=function(a){var b=this.workspace_.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT||this.workspace_.horizontalLayout&&this.workspace_.RTL;this.svgLid_.setAttribute("transform","rotate("+(b?-a:a)+","+(b?4:this.WIDTH_-4)+","+(this.LID_HEIGHT_-2)+")")};Blockly.Trashcan.prototype.close=function(){this.setOpen(!1)};Blockly.Trashcan.prototype.click=function(){if(this.contents_.length){for(var a=[],b=0,c;c=this.contents_[b];b++)a[b]=Blockly.Xml.textToDom(c);this.flyout.show(a)}}; -Blockly.Trashcan.prototype.mouseOver_=function(){this.contents_.length&&this.setOpen(!0)};Blockly.Trashcan.prototype.mouseOut_=function(){this.setOpen(!1)}; -Blockly.Trashcan.prototype.onDelete_=function(a){if(!(0>=this.workspace_.options.maxTrashcanContents)&&a.type==Blockly.Events.BLOCK_DELETE&&"shadow"!=a.oldXml.tagName.toLowerCase()&&(a=this.cleanBlockXML_(a.oldXml),-1==this.contents_.indexOf(a))){for(this.contents_.unshift(a);this.contents_.length>this.workspace_.options.maxTrashcanContents;)this.contents_.pop();this.minOpenness_=this.HAS_BLOCKS_LID_ANGLE;this.setLidAngle_(45*this.minOpenness_)}}; +Blockly.Trashcan.prototype.setOpen=function(a){this.isOpen!=a&&(clearTimeout(this.lidTask_),this.isOpen=a,this.animateLid_())}; +Blockly.Trashcan.prototype.animateLid_=function(){var a=Blockly.Trashcan.ANIMATION_FRAMES_,b=1/(a+1);this.lidOpen_+=this.isOpen?b:-b;this.lidOpen_=Math.min(Math.max(this.lidOpen_,this.minOpenness_),1);this.setLidAngle_(this.lidOpen_*Blockly.Trashcan.MAX_LID_ANGLE_);b=Blockly.Trashcan.OPACITY_MIN_;this.svgGroup_.style.opacity=b+this.lidOpen_*(Blockly.Trashcan.OPACITY_MAX_-b);this.lidOpen_>this.minOpenness_&&1>this.lidOpen_&&(this.lidTask_=setTimeout(this.animateLid_.bind(this),Blockly.Trashcan.ANIMATION_LENGTH_/ +a))};Blockly.Trashcan.prototype.setLidAngle_=function(a){var b=this.workspace_.toolboxPosition==Blockly.TOOLBOX_AT_RIGHT||this.workspace_.horizontalLayout&&this.workspace_.RTL;this.svgLid_.setAttribute("transform","rotate("+(b?-a:a)+","+(b?4:this.WIDTH_-4)+","+(this.LID_HEIGHT_-2)+")")};Blockly.Trashcan.prototype.setMinOpenness_=function(a){this.minOpenness_=a;this.isOpen||this.setLidAngle_(a*Blockly.Trashcan.MAX_LID_ANGLE_)};Blockly.Trashcan.prototype.close=function(){this.setOpen(!1)}; +Blockly.Trashcan.prototype.click=function(){if(this.contents_.length){for(var a=[],b=0,c;c=this.contents_[b];b++)a[b]=Blockly.Xml.textToDom(c);this.flyout.show(a)}};Blockly.Trashcan.prototype.mouseOver_=function(){this.contents_.length&&this.setOpen(!0)};Blockly.Trashcan.prototype.mouseOut_=function(){this.setOpen(!1)}; +Blockly.Trashcan.prototype.onDelete_=function(a){if(!(0>=this.workspace_.options.maxTrashcanContents)&&a.type==Blockly.Events.BLOCK_DELETE&&"shadow"!=a.oldXml.tagName.toLowerCase()&&(a=this.cleanBlockXML_(a.oldXml),-1==this.contents_.indexOf(a))){for(this.contents_.unshift(a);this.contents_.length>this.workspace_.options.maxTrashcanContents;)this.contents_.pop();this.setMinOpenness_(this.HAS_BLOCKS_LID_ANGLE_)}}; Blockly.Trashcan.prototype.cleanBlockXML_=function(a){for(var b=a=a.cloneNode(!0);b;){b.removeAttribute&&(b.removeAttribute("x"),b.removeAttribute("y"),b.removeAttribute("id"),b.removeAttribute("disabled"),"comment"==b.nodeName&&(b.removeAttribute("h"),b.removeAttribute("w"),b.removeAttribute("pinned")));var c=b.firstChild||b.nextSibling;if(!c)for(c=b.parentNode;c;){if(c.nextSibling){c=c.nextSibling;break}c=c.parentNode}b=c}return Blockly.Xml.domToText(a)};Blockly.VariablesDynamic={};Blockly.VariablesDynamic.onCreateVariableButtonClick_String=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),void 0,"String")};Blockly.VariablesDynamic.onCreateVariableButtonClick_Number=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),void 0,"Number")};Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),void 0,"Colour")}; Blockly.VariablesDynamic.flyoutCategory=function(a){var b=[],c=document.createElement("button");c.setAttribute("text",Blockly.Msg.NEW_STRING_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_STRING");b.push(c);c=document.createElement("button");c.setAttribute("text",Blockly.Msg.NEW_NUMBER_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER");b.push(c);c=document.createElement("button");c.setAttribute("text",Blockly.Msg.NEW_COLOUR_VARIABLE);c.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"); b.push(c);a.registerButtonCallback("CREATE_VARIABLE_STRING",Blockly.VariablesDynamic.onCreateVariableButtonClick_String);a.registerButtonCallback("CREATE_VARIABLE_NUMBER",Blockly.VariablesDynamic.onCreateVariableButtonClick_Number);a.registerButtonCallback("CREATE_VARIABLE_COLOUR",Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour);a=Blockly.VariablesDynamic.flyoutCategoryBlocks(a);return b=b.concat(a)}; @@ -952,8 +962,8 @@ Blockly.Css.register([".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: . Blockly.Mutator.prototype.drawIcon_=function(a){Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},a);Blockly.utils.dom.createSvgElement("path",{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"}, a);Blockly.utils.dom.createSvgElement("circle",{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)};Blockly.Mutator.prototype.iconClick_=function(a){this.block_.isEditable()&&Blockly.Icon.prototype.iconClick_.call(this,a)}; Blockly.Mutator.prototype.createEditor_=function(){this.svgDialog_=Blockly.utils.dom.createSvgElement("svg",{x:Blockly.Bubble.BORDER_WIDTH,y:Blockly.Bubble.BORDER_WIDTH},null);if(this.quarkNames_.length)for(var a=Blockly.utils.xml.createElement("xml"),b=0,c;c=this.quarkNames_[b];b++){var d=Blockly.utils.xml.createElement("block");d.setAttribute("type",c);a.appendChild(d)}else a=null;b=new Blockly.Options({disable:!1,parentWorkspace:this.block_.workspace,media:this.block_.workspace.options.pathToMedia, -rtl:this.block_.RTL,horizontalLayout:!1,renderer:this.block_.workspace.options.renderer});b.toolboxPosition=this.block_.RTL?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT;b.languageTree=a;b.getMetrics=this.getFlyoutMetrics_.bind(this);this.workspace_=new Blockly.WorkspaceSvg(b);this.workspace_.isMutator=!0;this.workspace_.addChangeListener(Blockly.Events.disableOrphans);a=this.workspace_.addFlyout("g");b=this.workspace_.createDom("blocklyMutatorBackground");b.insertBefore(a,this.workspace_.svgBlockCanvas_); -this.svgDialog_.appendChild(b);return this.svgDialog_};Blockly.Mutator.prototype.updateEditable=function(){Blockly.Mutator.superClass_.updateEditable.call(this);this.block_.isInFlyout||(this.block_.isEditable()?this.iconGroup_&&Blockly.utils.dom.removeClass(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&Blockly.utils.dom.addClass(this.iconGroup_,"blocklyIconGroupReadonly")))}; +rtl:this.block_.RTL,horizontalLayout:!1,renderer:this.block_.workspace.options.renderer,rendererOverrides:this.block_.workspace.options.rendererOverrides});b.toolboxPosition=this.block_.RTL?Blockly.TOOLBOX_AT_RIGHT:Blockly.TOOLBOX_AT_LEFT;b.languageTree=a;b.getMetrics=this.getFlyoutMetrics_.bind(this);this.workspace_=new Blockly.WorkspaceSvg(b);this.workspace_.isMutator=!0;this.workspace_.addChangeListener(Blockly.Events.disableOrphans);a=this.workspace_.addFlyout("g");b=this.workspace_.createDom("blocklyMutatorBackground"); +b.insertBefore(a,this.workspace_.svgBlockCanvas_);this.svgDialog_.appendChild(b);return this.svgDialog_};Blockly.Mutator.prototype.updateEditable=function(){Blockly.Mutator.superClass_.updateEditable.call(this);this.block_.isInFlyout||(this.block_.isEditable()?this.iconGroup_&&Blockly.utils.dom.removeClass(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&Blockly.utils.dom.addClass(this.iconGroup_,"blocklyIconGroupReadonly")))}; Blockly.Mutator.prototype.resizeBubble_=function(){var a=2*Blockly.Bubble.BORDER_WIDTH,b=this.workspace_.getCanvas().getBBox();var c=this.block_.RTL?-b.x:b.width+b.x;b=b.height+3*a;var d=this.workspace_.getFlyout();d&&(d=d.getMetrics_(),b=Math.max(b,d.contentHeight+20));c+=3*a;if(Math.abs(this.workspaceWidth_-c)>a||Math.abs(this.workspaceHeight_-b)>a)this.workspaceWidth_=c,this.workspaceHeight_=b,this.bubble_.setBubbleSize(c+a,b+a),this.svgDialog_.setAttribute("width",this.workspaceWidth_),this.svgDialog_.setAttribute("height", this.workspaceHeight_);this.block_.RTL&&(a="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",a));this.workspace_.resize()};Blockly.Mutator.prototype.onBubbleMove_=function(){this.workspace_&&this.workspace_.recordDeleteAreas()}; Blockly.Mutator.prototype.setVisible=function(a){if(a!=this.isVisible())if(Blockly.Events.fire(new Blockly.Events.Ui(this.block_,"mutatorOpen",!a,a)),a){this.bubble_=new Blockly.Bubble(this.block_.workspace,this.createEditor_(),this.block_.pathObject.svgPath,this.iconXY_,null,null);this.bubble_.setSvgId(this.block_.id);this.bubble_.registerMoveEvent(this.onBubbleMove_.bind(this));var b=this.workspace_.options.languageTree;a=this.workspace_.getFlyout();b&&(a.init(this.workspace_),a.show(b.childNodes)); @@ -965,14 +975,14 @@ Blockly.Mutator.prototype.getFlyoutMetrics_=function(){return{viewHeight:this.wo Blockly.Mutator.prototype.updateBlockStyle=function(){var a=this.workspace_;if(a&&a.getAllBlocks(!1)){for(var b=a.getAllBlocks(!1),c=0;c=a&&this.sourceBlock_.outputConnection&&!b}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_();this.createTextElement_()}; +Blockly.FieldTextInput.prototype.initView=function(){if(this.getConstants().FULL_BLOCK_FIELDS){for(var a=0,b=0,c=0,d;d=this.sourceBlock_.inputList[c];c++){for(var e=0;d.fieldRow[e];e++)a++;d.connection&&b++}this.fullBlockClickTarget_=1>=a&&this.sourceBlock_.outputConnection&&!b}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_();this.createTextElement_()}; Blockly.FieldTextInput.prototype.doClassValidation_=function(a){return null===a||void 0===a?null:String(a)};Blockly.FieldTextInput.prototype.doValueInvalid_=function(a){this.isBeingEdited_&&(this.isTextValid_=!1,a=this.value_,this.value_=this.htmlInput_.untypedDefaultValue_,this.sourceBlock_&&Blockly.Events.isEnabled()&&Blockly.Events.fire(new Blockly.Events.BlockChange(this.sourceBlock_,"field",this.name||null,a,this.value_)))}; -Blockly.FieldTextInput.prototype.doValueUpdate_=function(a){this.isTextValid_=!0;this.value_=a;this.isBeingEdited_||(this.isDirty_=!0)};Blockly.FieldTextInput.prototype.applyColour=function(){this.sourceBlock_&&this.constants_.FULL_BLOCK_FIELDS&&(this.borderRect_?this.borderRect_.setAttribute("stroke",this.sourceBlock_.style.colourTertiary):this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.constants_.FIELD_BORDER_RECT_COLOUR))}; +Blockly.FieldTextInput.prototype.doValueUpdate_=function(a){this.isTextValid_=!0;this.value_=a;this.isBeingEdited_||(this.isDirty_=!0)};Blockly.FieldTextInput.prototype.applyColour=function(){this.sourceBlock_&&this.getConstants().FULL_BLOCK_FIELDS&&(this.borderRect_?this.borderRect_.setAttribute("stroke",this.sourceBlock_.style.colourTertiary):this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR))}; Blockly.FieldTextInput.prototype.render_=function(){Blockly.FieldTextInput.superClass_.render_.call(this);if(this.isBeingEdited_){this.resizeEditor_();var a=this.htmlInput_;this.isTextValid_?(Blockly.utils.dom.removeClass(a,"blocklyInvalidInput"),Blockly.utils.aria.setState(a,Blockly.utils.aria.State.INVALID,!1)):(Blockly.utils.dom.addClass(a,"blocklyInvalidInput"),Blockly.utils.aria.setState(a,Blockly.utils.aria.State.INVALID,!0))}}; Blockly.FieldTextInput.prototype.setSpellcheck=function(a){a!=this.spellcheck_&&(this.spellcheck_=a,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))};Blockly.FieldTextInput.prototype.showEditor_=function(a,b){this.workspace_=this.sourceBlock_.workspace;a=b||!1;!a&&(Blockly.utils.userAgent.MOBILE||Blockly.utils.userAgent.ANDROID||Blockly.utils.userAgent.IPAD)?this.showPromptEditor_():this.showInlineEditor_(a)}; Blockly.FieldTextInput.prototype.showPromptEditor_=function(){var a=this;Blockly.prompt(Blockly.Msg.CHANGE_VALUE_TITLE,this.getText(),function(b){a.setValue(b)})};Blockly.FieldTextInput.prototype.showInlineEditor_=function(a){Blockly.WidgetDiv.show(this,this.sourceBlock_.RTL,this.widgetDispose_.bind(this));this.htmlInput_=this.widgetCreate_();this.isBeingEdited_=!0;a||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())}; -Blockly.FieldTextInput.prototype.widgetCreate_=function(){var a=Blockly.WidgetDiv.DIV;Blockly.utils.dom.addClass(this.getClickTarget_(),"editing");var b=document.createElement("input");b.className="blocklyHtmlInput";b.setAttribute("spellcheck",this.spellcheck_);var c=this.workspace_.scale,d=this.constants_.FIELD_TEXT_FONTSIZE*c+"pt";a.style.fontSize=d;b.style.fontSize=d;d=Blockly.FieldTextInput.BORDERRADIUS*c+"px";if(this.fullBlockClickTarget_){d=this.getScaledBBox();d=(d.bottom-d.top)/2+"px";var e= -this.sourceBlock_.getParent()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;b.style.border=1*c+"px solid "+e;a.style.borderRadius=d;a.style.transition="box-shadow 0.25s ease 0s";this.constants_.FIELD_TEXTINPUT_BOX_SHADOW&&(a.style.boxShadow="rgba(255, 255, 255, 0.3) 0px 0px 0px "+4*c+"px")}b.style.borderRadius=d;a.appendChild(b);b.value=b.defaultValue=this.getEditorText_(this.value_);b.untypedDefaultValue_=this.value_;b.oldValue_=null;this.resizeEditor_(); +Blockly.FieldTextInput.prototype.widgetCreate_=function(){var a=Blockly.WidgetDiv.DIV;Blockly.utils.dom.addClass(this.getClickTarget_(),"editing");var b=document.createElement("input");b.className="blocklyHtmlInput";b.setAttribute("spellcheck",this.spellcheck_);var c=this.workspace_.getScale(),d=this.getConstants().FIELD_TEXT_FONTSIZE*c+"pt";a.style.fontSize=d;b.style.fontSize=d;d=Blockly.FieldTextInput.BORDERRADIUS*c+"px";if(this.fullBlockClickTarget_){d=this.getScaledBBox();d=(d.bottom-d.top)/2+ +"px";var e=this.sourceBlock_.getParent()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;b.style.border=1*c+"px solid "+e;a.style.borderRadius=d;a.style.transition="box-shadow 0.25s ease 0s";this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(a.style.boxShadow="rgba(255, 255, 255, 0.3) 0px 0px 0px "+4*c+"px")}b.style.borderRadius=d;a.appendChild(b);b.value=b.defaultValue=this.getEditorText_(this.value_);b.untypedDefaultValue_=this.value_;b.oldValue_=null;this.resizeEditor_(); this.bindInputEvents_(b);return b};Blockly.FieldTextInput.prototype.widgetDispose_=function(){this.isBeingEdited_=!1;this.isTextValid_=!0;this.forceRerender();if(this.onFinishEditing_)this.onFinishEditing_(this.value_);this.unbindInputEvents_();var a=Blockly.WidgetDiv.DIV.style;a.width="auto";a.height="auto";a.fontSize="";a.transition="";a.boxShadow="";this.htmlInput_=null;Blockly.utils.dom.removeClass(this.getClickTarget_(),"editing")}; Blockly.FieldTextInput.prototype.bindInputEvents_=function(a){this.onKeyDownWrapper_=Blockly.bindEventWithChecks_(a,"keydown",this,this.onHtmlInputKeyDown_);this.onKeyInputWrapper_=Blockly.bindEventWithChecks_(a,"input",this,this.onHtmlInputChange_)}; Blockly.FieldTextInput.prototype.unbindInputEvents_=function(){this.onKeyDownWrapper_&&(Blockly.unbindEvent_(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null);this.onKeyInputWrapper_&&(Blockly.unbindEvent_(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)}; @@ -995,15 +1005,14 @@ Blockly.FieldAngle.prototype.updateGraph_=function(){if(this.gauge_){var a=Numbe Blockly.FieldAngle.RADIUS;b=Math.abs(Math.floor((b-f)/Math.PI)%2);e&&(b=1-b);a.push(" l ",g,",",h," A ",Blockly.FieldAngle.RADIUS,",",Blockly.FieldAngle.RADIUS," 0 ",b," ",e," ",c,",",d," z")}this.gauge_.setAttribute("d",a.join(""));this.line_.setAttribute("x2",c);this.line_.setAttribute("y2",d)}}; Blockly.FieldAngle.prototype.onHtmlInputKeyDown_=function(a){Blockly.FieldAngle.superClass_.onHtmlInputKeyDown_.call(this,a);var b;a.keyCode===Blockly.utils.KeyCodes.LEFT?b=this.sourceBlock_.RTL?1:-1:a.keyCode===Blockly.utils.KeyCodes.RIGHT?b=this.sourceBlock_.RTL?-1:1:a.keyCode===Blockly.utils.KeyCodes.DOWN?b=-1:a.keyCode===Blockly.utils.KeyCodes.UP&&(b=1);if(b){var c=this.getValue();this.displayMouseOrKeyboardValue_(c+b*this.round_);a.preventDefault();a.stopPropagation()}}; Blockly.FieldAngle.prototype.doClassValidation_=function(a){a=Number(a);return isNaN(a)||!isFinite(a)?null:this.wrapValue_(a)};Blockly.FieldAngle.prototype.wrapValue_=function(a){a%=360;0>a&&(a+=360);a>this.wrap_&&(a-=360);return a};Blockly.Css.register(".blocklyAngleCircle {,stroke: #444;,stroke-width: 1;,fill: #ddd;,fill-opacity: .8;,},.blocklyAngleMarks {,stroke: #444;,stroke-width: 1;,},.blocklyAngleGauge {,fill: #f88;,fill-opacity: .8;,pointer-events: none;,},.blocklyAngleLine {,stroke: #f00;,stroke-width: 2;,stroke-linecap: round;,pointer-events: none;,}".split(",")); -Blockly.fieldRegistry.register("field_angle",Blockly.FieldAngle);Blockly.FieldCheckbox=function(a,b,c){this.checkChar_=null;null==a&&(a="FALSE");Blockly.FieldCheckbox.superClass_.constructor.call(this,a,b,c)};Blockly.utils.object.inherits(Blockly.FieldCheckbox,Blockly.Field);Blockly.FieldCheckbox.fromJson=function(a){return new Blockly.FieldCheckbox(a.checked,void 0,a)};Blockly.FieldCheckbox.CHECK_CHAR="\u2713";Blockly.FieldCheckbox.prototype.SERIALIZABLE=!0;Blockly.FieldCheckbox.prototype.CURSOR="default";Blockly.FieldCheckbox.prototype.isDirty_=!1; -Blockly.FieldCheckbox.prototype.configure_=function(a){Blockly.FieldCheckbox.superClass_.configure_.call(this,a);a.checkCharacter&&(this.checkChar_=a.checkCharacter)}; -Blockly.FieldCheckbox.prototype.initView=function(){this.size_.width=this.constants_.FIELD_CHECKBOX_DEFAULT_WIDTH;Blockly.FieldCheckbox.superClass_.initView.call(this);this.textElement_.setAttribute("x",this.constants_.FIELD_CHECKBOX_X_OFFSET);this.textElement_.setAttribute("y",this.constants_.FIELD_CHECKBOX_Y_OFFSET);this.textElement_.removeAttribute("dominant-baseline");Blockly.utils.dom.addClass(this.textElement_,"blocklyCheckbox");this.textContent_.nodeValue=this.checkChar_||Blockly.FieldCheckbox.CHECK_CHAR; -this.textElement_.style.display=this.value_?"block":"none"};Blockly.FieldCheckbox.prototype.setCheckCharacter=function(a){this.checkChar_=a;this.textContent_&&(this.textContent_.nodeValue=a||Blockly.FieldCheckbox.CHECK_CHAR)};Blockly.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)};Blockly.FieldCheckbox.prototype.doClassValidation_=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null}; -Blockly.FieldCheckbox.prototype.doValueUpdate_=function(a){this.value_=this.convertValueToBool_(a);this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")};Blockly.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"};Blockly.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_};Blockly.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))}; -Blockly.FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"==typeof a?"TRUE"==a:!!a};Blockly.fieldRegistry.register("field_checkbox",Blockly.FieldCheckbox);Blockly.FieldColour=function(a,b,c){Blockly.FieldColour.superClass_.constructor.call(this,a||Blockly.FieldColour.COLOURS[0],b,c);this.onKeyDownWrapper_=this.onMouseLeaveWrapper_=this.onMouseEnterWrapper_=this.onMouseMoveWrapper_=this.onClickWrapper_=this.highlightedIndex_=this.picker_=null};Blockly.utils.object.inherits(Blockly.FieldColour,Blockly.Field);Blockly.FieldColour.fromJson=function(a){return new Blockly.FieldColour(a.colour,void 0,a)};Blockly.FieldColour.prototype.SERIALIZABLE=!0; +Blockly.fieldRegistry.register("field_angle",Blockly.FieldAngle);Blockly.FieldCheckbox=function(a,b,c){this.checkChar_=null;null==a&&(a="FALSE");Blockly.FieldCheckbox.superClass_.constructor.call(this,a,b,c)};Blockly.utils.object.inherits(Blockly.FieldCheckbox,Blockly.Field);Blockly.FieldCheckbox.fromJson=function(a){return new Blockly.FieldCheckbox(a.checked,void 0,a)};Blockly.FieldCheckbox.CHECK_CHAR="\u2713";Blockly.FieldCheckbox.prototype.SERIALIZABLE=!0;Blockly.FieldCheckbox.prototype.CURSOR="default"; +Blockly.FieldCheckbox.prototype.configure_=function(a){Blockly.FieldCheckbox.superClass_.configure_.call(this,a);a.checkCharacter&&(this.checkChar_=a.checkCharacter)};Blockly.FieldCheckbox.prototype.initView=function(){Blockly.FieldCheckbox.superClass_.initView.call(this);Blockly.utils.dom.addClass(this.textElement_,"blocklyCheckbox");this.textElement_.style.display=this.value_?"block":"none"}; +Blockly.FieldCheckbox.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_());this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)};Blockly.FieldCheckbox.prototype.getDisplayText_=function(){return this.checkChar_||Blockly.FieldCheckbox.CHECK_CHAR};Blockly.FieldCheckbox.prototype.setCheckCharacter=function(a){this.checkChar_=a;this.forceRerender()};Blockly.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)}; +Blockly.FieldCheckbox.prototype.doClassValidation_=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null};Blockly.FieldCheckbox.prototype.doValueUpdate_=function(a){this.value_=this.convertValueToBool_(a);this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")};Blockly.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"};Blockly.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_}; +Blockly.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))};Blockly.FieldCheckbox.prototype.convertValueToBool_=function(a){return"string"==typeof a?"TRUE"==a:!!a};Blockly.fieldRegistry.register("field_checkbox",Blockly.FieldCheckbox);Blockly.FieldColour=function(a,b,c){Blockly.FieldColour.superClass_.constructor.call(this,a||Blockly.FieldColour.COLOURS[0],b,c);this.onKeyDownWrapper_=this.onMouseLeaveWrapper_=this.onMouseEnterWrapper_=this.onMouseMoveWrapper_=this.onClickWrapper_=this.highlightedIndex_=this.picker_=null};Blockly.utils.object.inherits(Blockly.FieldColour,Blockly.Field);Blockly.FieldColour.fromJson=function(a){return new Blockly.FieldColour(a.colour,void 0,a)};Blockly.FieldColour.prototype.SERIALIZABLE=!0; Blockly.FieldColour.prototype.CURSOR="default";Blockly.FieldColour.prototype.isDirty_=!1;Blockly.FieldColour.prototype.colours_=null;Blockly.FieldColour.prototype.titles_=null;Blockly.FieldColour.prototype.columns_=0;Blockly.FieldColour.prototype.configure_=function(a){Blockly.FieldColour.superClass_.configure_.call(this,a);a.colourOptions&&(this.colours_=a.colourOptions,this.titles_=a.colourTitles);a.columns&&(this.columns_=a.columns)}; -Blockly.FieldColour.prototype.initView=function(){this.size_=new Blockly.utils.Size(this.constants_.FIELD_COLOUR_DEFAULT_WIDTH,this.constants_.FIELD_COLOUR_DEFAULT_HEIGHT);this.constants_.FIELD_COLOUR_FULL_BLOCK?this.clickTarget_=this.sourceBlock_.getSvgRoot():(this.createBorderRect_(),this.borderRect_.style.fillOpacity="1")}; -Blockly.FieldColour.prototype.applyColour=function(){this.constants_.FIELD_COLOUR_FULL_BLOCK?(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getValue()),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff")):this.borderRect_&&(this.borderRect_.style.fill=this.getValue())};Blockly.FieldColour.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:Blockly.utils.colour.parse(a)}; +Blockly.FieldColour.prototype.initView=function(){this.size_=new Blockly.utils.Size(this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH,this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT);this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.clickTarget_=this.sourceBlock_.getSvgRoot():(this.createBorderRect_(),this.borderRect_.style.fillOpacity="1")}; +Blockly.FieldColour.prototype.applyColour=function(){this.getConstants().FIELD_COLOUR_FULL_BLOCK?(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getValue()),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff")):this.borderRect_&&(this.borderRect_.style.fill=this.getValue())};Blockly.FieldColour.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:Blockly.utils.colour.parse(a)}; Blockly.FieldColour.prototype.doValueUpdate_=function(a){this.value_=a;this.borderRect_?this.borderRect_.style.fill=a:this.sourceBlock_&&(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",a),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff"))};Blockly.FieldColour.prototype.getText=function(){var a=this.value_;/^#(.)\1(.)\2(.)\3$/.test(a)&&(a="#"+a[1]+a[3]+a[5]);return a};Blockly.FieldColour.COLOURS="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" "); Blockly.FieldColour.TITLES=[];Blockly.FieldColour.COLUMNS=7;Blockly.FieldColour.prototype.setColours=function(a,b){this.colours_=a;b&&(this.titles_=b);return this};Blockly.FieldColour.prototype.setColumns=function(a){this.columns_=a;return this};Blockly.FieldColour.prototype.showEditor_=function(){this.picker_=this.dropdownCreate_();Blockly.DropDownDiv.getContentDiv().appendChild(this.picker_);Blockly.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this));this.picker_.focus({preventScroll:!0})}; Blockly.FieldColour.prototype.onClick_=function(a){a=(a=a.target)&&a.label;null!==a&&(this.setValue(a),Blockly.DropDownDiv.hideIfOwner(this))}; @@ -1022,11 +1031,11 @@ this.onKeyDownWrapper_=null);this.highlightedIndex_=this.picker_=null}; Blockly.Css.register([".blocklyColourTable {","border-collapse: collapse;","display: block;","outline: none;","padding: 1px;","}",".blocklyColourTable>tr>td {","border: .5px solid #888;","box-sizing: border-box;","cursor: pointer;","display: inline-block;","height: 20px;","padding: 0;","width: 20px;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","position: relative;","}",".blocklyColourSelected, .blocklyColourSelected:hover {", "border-color: #eee !important;","outline: 1px solid #333;","position: relative;","}"]);Blockly.fieldRegistry.register("field_colour",Blockly.FieldColour);Blockly.FieldDropdown=function(a,b,c){"function"!=typeof a&&Blockly.FieldDropdown.validateOptions_(a);this.menuGenerator_=a;this.generatedOptions_=null;this.trimOptions_();this.selectedOption_=this.getOptions(!1)[0];Blockly.FieldDropdown.superClass_.constructor.call(this,this.selectedOption_[1],b,c);this.svgArrow_=this.arrow_=this.imageElement_=this.menu_=this.selectedMenuItem_=null};Blockly.utils.object.inherits(Blockly.FieldDropdown,Blockly.Field); Blockly.FieldDropdown.fromJson=function(a){return new Blockly.FieldDropdown(a.options,void 0,a)};Blockly.FieldDropdown.prototype.SERIALIZABLE=!0;Blockly.FieldDropdown.CHECKMARK_OVERHANG=25;Blockly.FieldDropdown.MAX_MENU_HEIGHT_VH=.45;Blockly.FieldDropdown.IMAGE_Y_OFFSET=5;Blockly.FieldDropdown.IMAGE_Y_PADDING=2*Blockly.FieldDropdown.IMAGE_Y_OFFSET;Blockly.FieldDropdown.ARROW_CHAR=Blockly.utils.userAgent.ANDROID?"\u25bc":"\u25be";Blockly.FieldDropdown.prototype.CURSOR="default"; -Blockly.FieldDropdown.prototype.initView=function(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot();this.createTextElement_();this.imageElement_=Blockly.utils.dom.createSvgElement("image",{},this.fieldGroup_);this.constants_.FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_();this.borderRect_&&Blockly.utils.dom.addClass(this.borderRect_,"blocklyDropdownRect")}; -Blockly.FieldDropdown.prototype.shouldAddBorderRect_=function(){return!this.constants_.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.constants_.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!this.sourceBlock_.isShadow()}; +Blockly.FieldDropdown.prototype.initView=function(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot();this.createTextElement_();this.imageElement_=Blockly.utils.dom.createSvgElement("image",{},this.fieldGroup_);this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_();this.borderRect_&&Blockly.utils.dom.addClass(this.borderRect_,"blocklyDropdownRect")}; +Blockly.FieldDropdown.prototype.shouldAddBorderRect_=function(){return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!this.sourceBlock_.isShadow()}; Blockly.FieldDropdown.prototype.createTextArrow_=function(){this.arrow_=Blockly.utils.dom.createSvgElement("tspan",{},this.textElement_);this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?Blockly.FieldDropdown.ARROW_CHAR+" ":" "+Blockly.FieldDropdown.ARROW_CHAR));this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textContent_):this.textElement_.appendChild(this.arrow_)}; -Blockly.FieldDropdown.prototype.createSVGArrow_=function(){this.svgArrow_=Blockly.utils.dom.createSvgElement("image",{height:this.constants_.FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.constants_.FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.constants_.FIELD_DROPDOWN_SVG_ARROW_DATAURI)}; -Blockly.FieldDropdown.prototype.showEditor_=function(a){this.menu_=this.dropdownCreate_();this.menu_.openingCoords=a&&"number"===typeof a.clientX?new Blockly.utils.Coordinate(a.clientX,a.clientY):null;this.menu_.render(Blockly.DropDownDiv.getContentDiv());Blockly.utils.dom.addClass(this.menu_.getElement(),"blocklyDropdownMenu");if(this.constants_.FIELD_DROPDOWN_COLOURED_DIV){a=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().getColour():this.sourceBlock_.getColour();var b=this.sourceBlock_.isShadow()? +Blockly.FieldDropdown.prototype.createSVGArrow_=function(){this.svgArrow_=Blockly.utils.dom.createSvgElement("image",{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_);this.svgArrow_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)}; +Blockly.FieldDropdown.prototype.showEditor_=function(a){this.menu_=this.dropdownCreate_();this.menu_.openingCoords=a&&"number"===typeof a.clientX?new Blockly.utils.Coordinate(a.clientX,a.clientY):null;this.menu_.render(Blockly.DropDownDiv.getContentDiv());Blockly.utils.dom.addClass(this.menu_.getElement(),"blocklyDropdownMenu");if(this.getConstants().FIELD_DROPDOWN_COLOURED_DIV){a=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().getColour():this.sourceBlock_.getColour();var b=this.sourceBlock_.isShadow()? this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;Blockly.DropDownDiv.setColour(a,b)}Blockly.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this));this.menu_.focus();this.selectedMenuItem_&&Blockly.utils.style.scrollIntoContainerView(this.selectedMenuItem_.getElement(),this.menu_.getElement());this.applyColour()}; Blockly.FieldDropdown.prototype.dropdownCreate_=function(){var a=new Blockly.Menu;a.setRightToLeft(this.sourceBlock_.RTL);a.setRole(Blockly.utils.aria.Role.LISTBOX);var b=this.getOptions(!1);this.selectedMenuItem_=null;for(var c=0;c=c||0>=b)throw Error("Height and width values of an image field must be greater than 0.");this.flipRtl_=!1;this.altText_="";Blockly.FieldImage.superClass_.constructor.call(this, a||"",null,g);g||(this.flipRtl_=!!f,this.altText_=Blockly.utils.replaceMessageReferences(d)||"");this.size_=new Blockly.utils.Size(b,c+Blockly.FieldImage.Y_PADDING);this.imageHeight_=c;this.clickHandler_=null;"function"==typeof e&&(this.clickHandler_=e);this.imageElement_=null};Blockly.utils.object.inherits(Blockly.FieldImage,Blockly.Field);Blockly.FieldImage.fromJson=function(a){return new Blockly.FieldImage(a.src,a.width,a.height,void 0,void 0,void 0,a)};Blockly.FieldImage.Y_PADDING=1; Blockly.FieldImage.prototype.EDITABLE=!1;Blockly.FieldImage.prototype.isDirty_=!1;Blockly.FieldImage.prototype.configure_=function(a){Blockly.FieldImage.superClass_.configure_.call(this,a);this.flipRtl_=!!a.flipRtl;this.altText_=Blockly.utils.replaceMessageReferences(a.alt)||""}; -Blockly.FieldImage.prototype.initView=function(){this.imageElement_=Blockly.utils.dom.createSvgElement("image",{height:this.imageHeight_+"px",width:this.size_.width+"px",alt:this.altText_},this.fieldGroup_);this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.value_)};Blockly.FieldImage.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:a}; -Blockly.FieldImage.prototype.doValueUpdate_=function(a){this.value_=a;this.imageElement_&&this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",String(this.value_))};Blockly.FieldImage.prototype.getFlipRtl=function(){return this.flipRtl_};Blockly.FieldImage.prototype.setAlt=function(a){a!=this.altText_&&(this.altText_=a||"",this.imageElement_&&this.imageElement_.setAttribute("alt",this.altText_))};Blockly.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)}; -Blockly.FieldImage.prototype.setOnClickHandler=function(a){this.clickHandler_=a};Blockly.FieldImage.prototype.getText_=function(){return this.altText_};Blockly.fieldRegistry.register("field_image",Blockly.FieldImage);Blockly.FieldMultilineInput=function(a,b,c){null==a&&(a="");Blockly.FieldMultilineInput.superClass_.constructor.call(this,a,b,c);this.textGroup_=null};Blockly.utils.object.inherits(Blockly.FieldMultilineInput,Blockly.FieldTextInput);Blockly.FieldMultilineInput.LINE_HEIGHT=20;Blockly.FieldMultilineInput.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldMultilineInput(b,void 0,a)}; +Blockly.FieldImage.prototype.initView=function(){this.imageElement_=Blockly.utils.dom.createSvgElement("image",{height:this.imageHeight_+"px",width:this.size_.width+"px",alt:this.altText_},this.fieldGroup_);this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",this.value_);this.clickHandler_&&(this.imageElement_.style.cursor="pointer")};Blockly.FieldImage.prototype.updateSize_=function(){}; +Blockly.FieldImage.prototype.doClassValidation_=function(a){return"string"!=typeof a?null:a};Blockly.FieldImage.prototype.doValueUpdate_=function(a){this.value_=a;this.imageElement_&&this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,"xlink:href",String(this.value_))};Blockly.FieldImage.prototype.getFlipRtl=function(){return this.flipRtl_};Blockly.FieldImage.prototype.setAlt=function(a){a!=this.altText_&&(this.altText_=a||"",this.imageElement_&&this.imageElement_.setAttribute("alt",this.altText_))}; +Blockly.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)};Blockly.FieldImage.prototype.setOnClickHandler=function(a){this.clickHandler_=a};Blockly.FieldImage.prototype.getText_=function(){return this.altText_};Blockly.fieldRegistry.register("field_image",Blockly.FieldImage);Blockly.FieldMultilineInput=function(a,b,c){null==a&&(a="");Blockly.FieldMultilineInput.superClass_.constructor.call(this,a,b,c);this.textGroup_=null};Blockly.utils.object.inherits(Blockly.FieldMultilineInput,Blockly.FieldTextInput);Blockly.FieldMultilineInput.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.text);return new Blockly.FieldMultilineInput(b,void 0,a)}; Blockly.FieldMultilineInput.prototype.initView=function(){this.createBorderRect_();this.textGroup_=Blockly.utils.dom.createSvgElement("g",{"class":"blocklyEditableText"},this.fieldGroup_)}; Blockly.FieldMultilineInput.prototype.getDisplayText_=function(){var a=this.value_;if(!a)return Blockly.Field.NBSP;var b=a.split("\n");a="";for(var c=0;cthis.maxDisplayLength&&(d=d.substring(0,this.maxDisplayLength-4)+"...");d=d.replace(/\s/g,Blockly.Field.NBSP);a+=d;c!==b.length-1&&(a+="\n")}this.sourceBlock_.RTL&&(a+="\u200f");return a}; -Blockly.FieldMultilineInput.prototype.render_=function(){for(var a;a=this.textGroup_.firstChild;)this.textGroup_.removeChild(a);a=this.getDisplayText_().split("\n");for(var b=0,c=0;cb&&(b=e);c+=Blockly.FieldMultilineInput.LINE_HEIGHT}this.borderRect_&&(b+=2*this.constants_.FIELD_BORDER_RECT_X_PADDING,this.borderRect_.setAttribute("width",b),this.borderRect_.setAttribute("height",c));this.size_.width=b;this.size_.height=c}; -Blockly.FieldMultilineInput.prototype.resizeEditor_=function(){var a=Blockly.WidgetDiv.DIV,b=this.getScaledBBox();a.style.width=b.right-b.left+"px";a.style.height=b.bottom-b.top+"px";b=new Blockly.utils.Coordinate(this.sourceBlock_.RTL?b.right-a.offsetWidth:b.left,b.top);a.style.left=b.x+"px";a.style.top=b.y+"px"}; -Blockly.FieldMultilineInput.prototype.widgetCreate_=function(){var a=Blockly.WidgetDiv.DIV,b=this.workspace_.scale,c=document.createElement("textarea");c.className="blocklyHtmlInput blocklyHtmlTextAreaInput";c.setAttribute("spellcheck",this.spellcheck_);var d=this.constants_.FIELD_TEXT_FONTSIZE*b+"pt";a.style.fontSize=d;c.style.fontSize=d;c.style.borderRadius=Blockly.FieldTextInput.BORDERRADIUS*b+"px";d=this.constants_.FIELD_BORDER_RECT_X_PADDING*b;c.style.paddingLeft=d+"px";c.style.width="calc(100% - "+ -d+"px)";c.style.lineHeight=Blockly.FieldMultilineInput.LINE_HEIGHT*b+"px";a.appendChild(c);c.value=c.defaultValue=this.getEditorText_(this.value_);c.untypedDefaultValue_=this.value_;c.oldValue_=null;Blockly.utils.userAgent.GECKO?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_();this.bindInputEvents_(c);return c}; +Blockly.FieldMultilineInput.prototype.render_=function(){for(var a;a=this.textGroup_.firstChild;)this.textGroup_.removeChild(a);a=this.getDisplayText_().split("\n");for(var b=0,c=0;cb&&(b=e);c+=this.getConstants().FIELD_TEXT_HEIGHT+(0this.max_&&Blockly.utils.aria.setState(a,Blockly.utils.aria.State.VALUEMAX,this.max_);return a};Blockly.fieldRegistry.register("field_number",Blockly.FieldNumber);Blockly.FieldVariable=function(a,b,c,d,e){this.menuGenerator_=Blockly.FieldVariable.dropdownCreate;this.defaultVariableName=a||"";this.size_=new Blockly.utils.Size(0,0);e&&this.configure_(e);b&&this.setValidator(b);e||this.setTypes_(c,d)};Blockly.utils.object.inherits(Blockly.FieldVariable,Blockly.FieldDropdown);Blockly.FieldVariable.fromJson=function(a){var b=Blockly.utils.replaceMessageReferences(a.variable);return new Blockly.FieldVariable(b,void 0,void 0,void 0,a)}; Blockly.FieldVariable.prototype.workspace_=null;Blockly.FieldVariable.prototype.SERIALIZABLE=!0;Blockly.FieldVariable.prototype.configure_=function(a){Blockly.FieldVariable.superClass_.configure_.call(this,a);this.setTypes_(a.variableTypes,a.defaultType)};Blockly.FieldVariable.prototype.initModel=function(){if(!this.variable_){var a=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_);this.doValueUpdate_(a.getId())}}; -Blockly.FieldVariable.prototype.shouldAddBorderRect_=function(){return Blockly.FieldVariable.superClass_.shouldAddBorderRect_.call(this)&&(!this.constants_.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!=this.sourceBlock_.type)}; +Blockly.FieldVariable.prototype.shouldAddBorderRect_=function(){return Blockly.FieldVariable.superClass_.shouldAddBorderRect_.call(this)&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!=this.sourceBlock_.type)}; Blockly.FieldVariable.prototype.fromXml=function(a){var b=a.getAttribute("id"),c=a.textContent,d=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";b=Blockly.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,b,c,d);if(null!=d&&d!==b.type)throw Error("Serialized variable type with id '"+b.getId()+"' had type "+b.type+", and does not match variable field that references it: "+Blockly.Xml.domToText(a)+".");this.setValue(b.getId())}; Blockly.FieldVariable.prototype.toXml=function(a){this.initModel();a.id=this.variable_.getId();a.textContent=this.variable_.name;this.variable_.type&&a.setAttribute("variabletype",this.variable_.type);return a};Blockly.FieldVariable.prototype.setSourceBlock=function(a){if(a.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");Blockly.FieldVariable.superClass_.setSourceBlock.call(this,a)}; Blockly.FieldVariable.prototype.getValue=function(){return this.variable_?this.variable_.getId():null};Blockly.FieldVariable.prototype.getText=function(){return this.variable_?this.variable_.name:""};Blockly.FieldVariable.prototype.getVariable=function(){return this.variable_};Blockly.FieldVariable.prototype.getValidator=function(){return this.variable_?this.validator_:null}; @@ -1082,15 +1091,20 @@ Blockly.Msg.DELETE_VARIABLE&&c.push([Blockly.Msg.DELETE_VARIABLE.replace("%1",a) Blockly.FieldVariable.prototype.referencesVariables=function(){return!0};Blockly.fieldRegistry.register("field_variable",Blockly.FieldVariable);Blockly.utils.svgPaths={};Blockly.utils.svgPaths.point=function(a,b){return" "+a+","+b+" "};Blockly.utils.svgPaths.curve=function(a,b){return" "+a+b.join("")};Blockly.utils.svgPaths.moveTo=function(a,b){return" M "+a+","+b+" "};Blockly.utils.svgPaths.moveBy=function(a,b){return" m "+a+","+b+" "};Blockly.utils.svgPaths.lineTo=function(a,b){return" l "+a+","+b+" "};Blockly.utils.svgPaths.line=function(a){return" l"+a.join("")};Blockly.utils.svgPaths.lineOnAxis=function(a,b){return" "+a+" "+b+" "}; Blockly.utils.svgPaths.arc=function(a,b,c,d){return a+" "+c+" "+c+" "+b+d};Blockly.blockRendering.ConstantProvider=function(){this.NO_PADDING=0;this.SMALL_PADDING=3;this.MEDIUM_PADDING=5;this.MEDIUM_LARGE_PADDING=8;this.LARGE_PADDING=10;this.TALL_INPUT_FIELD_OFFSET_Y=this.MEDIUM_PADDING;this.TAB_HEIGHT=15;this.TAB_OFFSET_FROM_TOP=5;this.TAB_VERTICAL_OVERLAP=2.5;this.TAB_WIDTH=8;this.NOTCH_WIDTH=15;this.NOTCH_HEIGHT=4;this.MIN_BLOCK_WIDTH=12;this.EMPTY_BLOCK_SPACER_HEIGHT=16;this.DUMMY_INPUT_SHADOW_MIN_HEIGHT=this.DUMMY_INPUT_MIN_HEIGHT=this.TAB_HEIGHT;this.CORNER_RADIUS= 8;this.STATEMENT_INPUT_NOTCH_OFFSET=this.NOTCH_OFFSET_LEFT=15;this.STATEMENT_BOTTOM_SPACER=0;this.STATEMENT_INPUT_PADDING_LEFT=20;this.BETWEEN_STATEMENT_PADDING_Y=4;this.TOP_ROW_MIN_HEIGHT=this.MEDIUM_PADDING;this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING;this.BOTTOM_ROW_MIN_HEIGHT=this.MEDIUM_PADDING;this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT=this.LARGE_PADDING;this.ADD_START_HATS=!1;this.START_HAT_HEIGHT=15;this.START_HAT_WIDTH=100;this.SPACER_DEFAULT_HEIGHT=15;this.MIN_BLOCK_HEIGHT= -24;this.EMPTY_INLINE_INPUT_PADDING=14.5;this.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11;this.EXTERNAL_VALUE_INPUT_PADDING=2;this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT;this.START_POINT=Blockly.utils.svgPaths.moveBy(0,0);this.JAGGED_TEETH_HEIGHT=12;this.JAGGED_TEETH_WIDTH=6;this.FIELD_TEXT_FONTSIZE=11;this.FIELD_TEXT_HEIGHT=16;this.FIELD_TEXT_FONTWEIGHT="normal";this.FIELD_TEXT_FONTFAMILY="sans-serif";this.FIELD_BORDER_RECT_RADIUS=4;this.FIELD_BORDER_RECT_HEIGHT=16;this.FIELD_BORDER_RECT_X_PADDING= -5;this.FIELD_BORDER_RECT_Y_PADDING=3;this.FIELD_BORDER_RECT_COLOUR="#fff";this.FIELD_TEXT_BASELINE_Y=Blockly.utils.userAgent.GECKO?12:13.09;this.FIELD_TEXT_Y_OFFSET=0;this.FIELD_TEXT_BASELINE_CENTER=!Blockly.utils.userAgent.IE&&!Blockly.utils.userAgent.EDGE;this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT;this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!1;this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING; -this.FIELD_DROPDOWN_SVG_ARROW_SIZE=12;this.FIELD_DROPDOWN_SVG_ARROW_DATAURI="data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4="; -this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!1;this.FIELD_COLOUR_DEFAULT_WIDTH=26;this.FIELD_COLOUR_DEFAULT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT;this.FIELD_CHECKBOX_X_OFFSET=this.FIELD_BORDER_RECT_X_PADDING-3;this.FIELD_CHECKBOX_Y_OFFSET=14;this.FIELD_CHECKBOX_DEFAULT_WIDTH=15;this.randomIdentifier_=String(Math.random()).substring(2);this.embossFilterId="";this.embossFilter_=null;this.disabledPatternId="";this.disabledPattern_=null;this.CURSOR_COLOUR="#cc0a0a";this.MARKER_COLOUR= -"#4286f4";this.CURSOR_WS_WIDTH=100;this.WS_CURSOR_HEIGHT=5;this.CURSOR_STACK_PADDING=10;this.CURSOR_BLOCK_PADDING=2;this.CURSOR_STROKE_WIDTH=4;this.FULL_BLOCK_FIELDS=!1;this.SHAPES={PUZZLE:1,NOTCH:2}};Blockly.blockRendering.ConstantProvider.prototype.init=function(){this.JAGGED_TEETH=this.makeJaggedTeeth();this.NOTCH=this.makeNotch();this.START_HAT=this.makeStartHat();this.PUZZLE_TAB=this.makePuzzleTab();this.INSIDE_CORNERS=this.makeInsideCorners();this.OUTSIDE_CORNERS=this.makeOutsideCorners()}; -Blockly.blockRendering.ConstantProvider.prototype.refreshTheme=function(a){this.blockStyles={};a=a.blockStyles;for(var b in a)this.blockStyles[b]=this.validatedBlockStyle_(a[b])};Blockly.blockRendering.ConstantProvider.prototype.getBlockStyleForColour=function(a){var b="auto_"+a;this.blockStyles[b]||(this.blockStyles[b]=this.createBlockStyle_(a));return{style:this.blockStyles[b],name:b}};Blockly.blockRendering.ConstantProvider.prototype.getBlockStyle=function(a){return this.blockStyles[a||""]||this.createBlockStyle_("#000000")}; -Blockly.blockRendering.ConstantProvider.prototype.createBlockStyle_=function(a){return this.validatedBlockStyle_({colourPrimary:a})}; +24;this.EMPTY_INLINE_INPUT_PADDING=14.5;this.EMPTY_INLINE_INPUT_HEIGHT=this.TAB_HEIGHT+11;this.EXTERNAL_VALUE_INPUT_PADDING=2;this.EMPTY_STATEMENT_INPUT_HEIGHT=this.MIN_BLOCK_HEIGHT;this.START_POINT=Blockly.utils.svgPaths.moveBy(0,0);this.JAGGED_TEETH_HEIGHT=12;this.JAGGED_TEETH_WIDTH=6;this.FIELD_TEXT_FONTSIZE=11;this.FIELD_TEXT_FONTWEIGHT="normal";this.FIELD_TEXT_FONTFAMILY="sans-serif";this.FIELD_TEXT_BASELINE=this.FIELD_TEXT_HEIGHT=-1;this.FIELD_BORDER_RECT_RADIUS=4;this.FIELD_BORDER_RECT_HEIGHT= +16;this.FIELD_BORDER_RECT_X_PADDING=5;this.FIELD_BORDER_RECT_Y_PADDING=3;this.FIELD_BORDER_RECT_COLOUR="#fff";this.FIELD_TEXT_BASELINE_CENTER=!Blockly.utils.userAgent.IE&&!Blockly.utils.userAgent.EDGE;this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT;this.FIELD_DROPDOWN_SVG_ARROW=this.FIELD_DROPDOWN_COLOURED_DIV=this.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW=!1;this.FIELD_DROPDOWN_SVG_ARROW_PADDING=this.FIELD_BORDER_RECT_X_PADDING;this.FIELD_DROPDOWN_SVG_ARROW_SIZE=12;this.FIELD_DROPDOWN_SVG_ARROW_DATAURI= +"data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMi43MSIgaGVpZ2h0PSI4Ljc5IiB2aWV3Qm94PSIwIDAgMTIuNzEgOC43OSI+PHRpdGxlPmRyb3Bkb3duLWFycm93PC90aXRsZT48ZyBvcGFjaXR5PSIwLjEiPjxwYXRoIGQ9Ik0xMi43MSwyLjQ0QTIuNDEsMi40MSwwLDAsMSwxMiw0LjE2TDguMDgsOC4wOGEyLjQ1LDIuNDUsMCwwLDEtMy40NSwwTDAuNzIsNC4xNkEyLjQyLDIuNDIsMCwwLDEsMCwyLjQ0LDIuNDgsMi40OCwwLDAsMSwuNzEuNzFDMSwwLjQ3LDEuNDMsMCw2LjM2LDBTMTEuNzUsMC40NiwxMiwuNzFBMi40NCwyLjQ0LDAsMCwxLDEyLjcxLDIuNDRaIiBmaWxsPSIjMjMxZjIwIi8+PC9nPjxwYXRoIGQ9Ik02LjM2LDcuNzlhMS40MywxLjQzLDAsMCwxLTEtLjQyTDEuNDIsMy40NWExLjQ0LDEuNDQsMCwwLDEsMC0yYzAuNTYtLjU2LDkuMzEtMC41Niw5Ljg3LDBhMS40NCwxLjQ0LDAsMCwxLDAsMkw3LjM3LDcuMzdBMS40MywxLjQzLDAsMCwxLDYuMzYsNy43OVoiIGZpbGw9IiNmZmYiLz48L3N2Zz4="; +this.FIELD_COLOUR_FULL_BLOCK=this.FIELD_TEXTINPUT_BOX_SHADOW=!1;this.FIELD_COLOUR_DEFAULT_WIDTH=26;this.FIELD_COLOUR_DEFAULT_HEIGHT=this.FIELD_BORDER_RECT_HEIGHT;this.FIELD_CHECKBOX_X_OFFSET=this.FIELD_BORDER_RECT_X_PADDING-3;this.randomIdentifier=String(Math.random()).substring(2);this.embossFilterId="";this.embossFilter_=null;this.disabledPatternId="";this.disabledPattern_=null;this.debugFilterId="";this.cssNode_=this.debugFilter_=null;this.CURSOR_COLOUR="#cc0a0a";this.MARKER_COLOUR="#4286f4";this.CURSOR_WS_WIDTH= +100;this.WS_CURSOR_HEIGHT=5;this.CURSOR_STACK_PADDING=10;this.CURSOR_BLOCK_PADDING=2;this.CURSOR_STROKE_WIDTH=4;this.FULL_BLOCK_FIELDS=!1;this.INSERTION_MARKER_COLOUR="#000000";this.INSERTION_MARKER_OPACITY=.2;this.SHAPES={PUZZLE:1,NOTCH:2}}; +Blockly.blockRendering.ConstantProvider.prototype.init=function(){this.JAGGED_TEETH=this.makeJaggedTeeth();this.NOTCH=this.makeNotch();this.START_HAT=this.makeStartHat();this.PUZZLE_TAB=this.makePuzzleTab();this.INSIDE_CORNERS=this.makeInsideCorners();this.OUTSIDE_CORNERS=this.makeOutsideCorners()};Blockly.blockRendering.ConstantProvider.prototype.setTheme=function(a){this.blockStyles={};var b=a.blockStyles,c;for(c in b)this.blockStyles[c]=this.validatedBlockStyle_(b[c]);this.setDynamicProperties_(a)}; +Blockly.blockRendering.ConstantProvider.prototype.setDynamicProperties_=function(a){this.setFontConstants_(a);this.setComponentConstants_(a);this.ADD_START_HATS=null!=a.startHats?a.startHats:this.ADD_START_HATS}; +Blockly.blockRendering.ConstantProvider.prototype.setFontConstants_=function(a){this.FIELD_TEXT_FONTFAMILY=a.fontStyle&&void 0!=a.fontStyle.family?a.fontStyle.family:this.FIELD_TEXT_FONTFAMILY;this.FIELD_TEXT_FONTWEIGHT=a.fontStyle&&void 0!=a.fontStyle.weight?a.fontStyle.weight:this.FIELD_TEXT_FONTWEIGHT;this.FIELD_TEXT_FONTSIZE=a.fontStyle&&void 0!=a.fontStyle.size?a.fontStyle.size:this.FIELD_TEXT_FONTSIZE;a=Blockly.utils.dom.measureFontMetrics("Hg",this.FIELD_TEXT_FONTSIZE+"pt",this.FIELD_TEXT_FONTWEIGHT, +this.FIELD_TEXT_FONTFAMILY);this.FIELD_TEXT_HEIGHT=a.height;this.FIELD_TEXT_BASELINE=a.baseline}; +Blockly.blockRendering.ConstantProvider.prototype.setComponentConstants_=function(a){this.CURSOR_COLOUR=a.getComponentStyle("cursorColour")||this.CURSOR_COLOUR;this.MARKER_COLOUR=a.getComponentStyle("markerColour")||this.MARKER_COLOUR;this.INSERTION_MARKER_COLOUR=a.getComponentStyle("insertionMarkerColour")||this.INSERTION_MARKER_COLOUR;this.INSERTION_MARKER_OPACITY=Number(a.getComponentStyle("insertionMarkerOpacity"))||this.INSERTION_MARKER_OPACITY}; +Blockly.blockRendering.ConstantProvider.prototype.getBlockStyleForColour=function(a){var b="auto_"+a;this.blockStyles[b]||(this.blockStyles[b]=this.createBlockStyle_(a));return{style:this.blockStyles[b],name:b}};Blockly.blockRendering.ConstantProvider.prototype.getBlockStyle=function(a){return this.blockStyles[a||""]||(a&&0==a.indexOf("auto_")?this.getBlockStyleForColour(a.substring(5)).style:this.createBlockStyle_("#000000"))};Blockly.blockRendering.ConstantProvider.prototype.createBlockStyle_=function(a){return this.validatedBlockStyle_({colourPrimary:a})}; Blockly.blockRendering.ConstantProvider.prototype.validatedBlockStyle_=function(a){var b={};a&&Blockly.utils.object.mixin(b,a);a=Blockly.utils.parseBlockColour(b.colourPrimary||"#000");b.colourPrimary=a.hex;b.colourSecondary=b.colourSecondary?Blockly.utils.parseBlockColour(b.colourSecondary).hex:this.generateSecondaryColour_(b.colourPrimary);b.colourTertiary=b.colourTertiary?Blockly.utils.parseBlockColour(b.colourTertiary).hex:this.generateTertiaryColour_(b.colourPrimary);b.hat=b.hat||"";return b}; -Blockly.blockRendering.ConstantProvider.prototype.generateSecondaryColour_=function(a){return Blockly.utils.colour.blend("#fff",a,.6)||a};Blockly.blockRendering.ConstantProvider.prototype.generateTertiaryColour_=function(a){return Blockly.utils.colour.blend("#fff",a,.3)||a};Blockly.blockRendering.ConstantProvider.prototype.dispose=function(){this.embossFilter_&&Blockly.utils.dom.removeNode(this.embossFilter_);this.disabledPattern_&&Blockly.utils.dom.removeNode(this.disabledPattern_)}; +Blockly.blockRendering.ConstantProvider.prototype.generateSecondaryColour_=function(a){return Blockly.utils.colour.blend("#fff",a,.6)||a};Blockly.blockRendering.ConstantProvider.prototype.generateTertiaryColour_=function(a){return Blockly.utils.colour.blend("#fff",a,.3)||a}; +Blockly.blockRendering.ConstantProvider.prototype.dispose=function(){this.embossFilter_&&Blockly.utils.dom.removeNode(this.embossFilter_);this.disabledPattern_&&Blockly.utils.dom.removeNode(this.disabledPattern_);this.debugFilter_&&Blockly.utils.dom.removeNode(this.debugFilter_);this.cssNode_=null}; Blockly.blockRendering.ConstantProvider.prototype.makeJaggedTeeth=function(){var a=this.JAGGED_TEETH_HEIGHT,b=this.JAGGED_TEETH_WIDTH,c=Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(b,a/4),Blockly.utils.svgPaths.point(2*-b,a/2),Blockly.utils.svgPaths.point(b,a/4)]);return{height:a,width:b,path:c}}; Blockly.blockRendering.ConstantProvider.prototype.makeStartHat=function(){var a=this.START_HAT_HEIGHT,b=this.START_HAT_WIDTH,c=Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(30,-a),Blockly.utils.svgPaths.point(70,-a),Blockly.utils.svgPaths.point(b,0)]);return{height:a,width:b,path:c}}; Blockly.blockRendering.ConstantProvider.prototype.makePuzzleTab=function(){function a(a){a=a?-1:1;var d=-a,e=c/2,f=e+2.5,l=e+.5,m=Blockly.utils.svgPaths.point(-b,a*e);e=Blockly.utils.svgPaths.point(b,a*e);return Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(0,a*f),Blockly.utils.svgPaths.point(-b,d*l),m])+Blockly.utils.svgPaths.curve("s",[Blockly.utils.svgPaths.point(b,2.5*d),e])}var b=this.TAB_WIDTH,c=this.TAB_HEIGHT,d=a(!0),e=a(!1);return{type:this.SHAPES.PUZZLE,width:b,height:c, @@ -1098,14 +1112,15 @@ pathDown:e,pathUp:d}};Blockly.blockRendering.ConstantProvider.prototype.makeNotc Blockly.blockRendering.ConstantProvider.prototype.makeInsideCorners=function(){var a=this.CORNER_RADIUS,b=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(-a,a)),c=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(a,a));return{width:a,height:a,pathTop:b,pathBottom:c}}; Blockly.blockRendering.ConstantProvider.prototype.makeOutsideCorners=function(){var a=this.CORNER_RADIUS,b=Blockly.utils.svgPaths.moveBy(0,a)+Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,-a)),c=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,a)),d=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,-a)),e=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,a));return{topLeft:b,topRight:c,bottomRight:e,bottomLeft:d, rightHeight:a}};Blockly.blockRendering.ConstantProvider.prototype.shapeFor=function(a){switch(a.type){case Blockly.INPUT_VALUE:case Blockly.OUTPUT_VALUE:return this.PUZZLE_TAB;case Blockly.PREVIOUS_STATEMENT:case Blockly.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown connection type");}}; -Blockly.blockRendering.ConstantProvider.prototype.createDom=function(a){a=Blockly.utils.dom.createSvgElement("defs",{},a);var b=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyEmbossFilter"+this.randomIdentifier_},a);Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:1,result:"blur"},b);var c=Blockly.utils.dom.createSvgElement("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",result:"specOut"}, -b);Blockly.utils.dom.createSvgElement("fePointLight",{x:-5E3,y:-1E4,z:2E4},c);Blockly.utils.dom.createSvgElement("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},b);Blockly.utils.dom.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},b);this.embossFilterId=b.id;this.embossFilter_=b;a=Blockly.utils.dom.createSvgElement("pattern",{id:"blocklyDisabledPattern"+this.randomIdentifier_,patternUnits:"userSpaceOnUse", -width:10,height:10},a);Blockly.utils.dom.createSvgElement("rect",{width:10,height:10,fill:"#aaa"},a);Blockly.utils.dom.createSvgElement("path",{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},a);this.disabledPatternId=a.id;this.disabledPattern_=a}; -Blockly.blockRendering.ConstantProvider.prototype.injectCSS=function(a){var b=this.getCSS_(a);a="blockly-renderer-style-"+a;if(!document.getElementById(a)){var c=b.join("\n");b=document.createElement("style");b.id=a;a=document.createTextNode(c);b.appendChild(a);document.head.insertBefore(b,document.head.firstChild)}}; -Blockly.blockRendering.ConstantProvider.prototype.getCSS_=function(a){a="."+a+"-renderer";return[a+" .blocklyText {","fill: #fff;","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-size: "+this.FIELD_TEXT_FONTSIZE+"pt;","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",a+" .blocklyNonEditableText>rect,",a+" .blocklyEditableText>rect {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","fill-opacity: .6;","stroke: none;","}",a+" .blocklyNonEditableText>text,",a+" .blocklyEditableText>text {","fill: #000;", -"}",a+" .blocklyEditableText:not(.editing):hover>rect {","stroke: #fff;","stroke-width: 2;","}",a+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",a+" .blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",a+" .blocklyHighlightedConnectionPath {","stroke: #fc3;","}",a+" .blocklyReplaceable .blocklyPath {","fill-opacity: .5;","}",a+" .blocklyReplaceable .blocklyPathLight,",a+" .blocklyReplaceable .blocklyPathDark {", -"display: none;","}"]};Blockly.blockRendering.MarkerSvg=function(a,b,c){this.workspace_=a;this.marker_=c;this.parent_=null;this.constants_=b;this.currentMarkerSvg=null;a=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=c.colour||a};Blockly.blockRendering.MarkerSvg.CURSOR_CLASS="blocklyCursor";Blockly.blockRendering.MarkerSvg.MARKER_CLASS="blocklyMarker";Blockly.blockRendering.MarkerSvg.HEIGHT_MULTIPLIER=.75;Blockly.blockRendering.MarkerSvg.prototype.getSvgRoot=function(){return this.svgGroup_}; -Blockly.blockRendering.MarkerSvg.prototype.isCursor=function(){return"cursor"==this.marker_.type};Blockly.blockRendering.MarkerSvg.prototype.createDom=function(){var a=this.isCursor()?Blockly.blockRendering.MarkerSvg.CURSOR_CLASS:Blockly.blockRendering.MarkerSvg.MARKER_CLASS;this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":a},null);this.createDomInternal_();return this.svgGroup_}; +Blockly.blockRendering.ConstantProvider.prototype.createDom=function(a,b,c){this.injectCSS_(b,c);a=Blockly.utils.dom.createSvgElement("defs",{},a);b=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyEmbossFilter"+this.randomIdentifier},a);Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:1,result:"blur"},b);c=Blockly.utils.dom.createSvgElement("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white", +result:"specOut"},b);Blockly.utils.dom.createSvgElement("fePointLight",{x:-5E3,y:-1E4,z:2E4},c);Blockly.utils.dom.createSvgElement("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},b);Blockly.utils.dom.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},b);this.embossFilterId=b.id;this.embossFilter_=b;b=Blockly.utils.dom.createSvgElement("pattern",{id:"blocklyDisabledPattern"+this.randomIdentifier,patternUnits:"userSpaceOnUse", +width:10,height:10},a);Blockly.utils.dom.createSvgElement("rect",{width:10,height:10,fill:"#aaa"},b);Blockly.utils.dom.createSvgElement("path",{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},b);this.disabledPatternId=b.id;this.disabledPattern_=b;Blockly.blockRendering.Debug&&(a=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyDebugFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},a),b=Blockly.utils.dom.createSvgElement("feComponentTransfer",{result:"outBlur"},a),Blockly.utils.dom.createSvgElement("feFuncA", +{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},b),Blockly.utils.dom.createSvgElement("feFlood",{"flood-color":"#ff0000","flood-opacity":.5,result:"outColor"},a),Blockly.utils.dom.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},a),this.debugFilterId=a.id,this.debugFilter_=a)}; +Blockly.blockRendering.ConstantProvider.prototype.injectCSS_=function(a,b){b=this.getCSS_(b);a="blockly-renderer-style-"+a;this.cssNode_=document.getElementById(a);var c=b.join("\n");this.cssNode_?this.cssNode_.firstChild.textContent=c:(b=document.createElement("style"),b.id=a,a=document.createTextNode(c),b.appendChild(a),document.head.insertBefore(b,document.head.firstChild),this.cssNode_=b)}; +Blockly.blockRendering.ConstantProvider.prototype.getCSS_=function(a){return[a+" .blocklyText, ",a+" .blocklyFlyoutLabelText {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-size: "+this.FIELD_TEXT_FONTSIZE+"pt;","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",a+" .blocklyText {","fill: #fff;","}",a+" .blocklyNonEditableText>rect,",a+" .blocklyEditableText>rect {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","fill-opacity: .6;","stroke: none;","}",a+" .blocklyNonEditableText>text,",a+" .blocklyEditableText>text {", +"fill: #000;","}",a+" .blocklyFlyoutLabelText {","fill: #000;","}",a+" .blocklyText.blocklyBubbleText {","fill: #000;","}",a+" .blocklyEditableText:not(.editing):hover>rect {","stroke: #fff;","stroke-width: 2;","}",a+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",a+" .blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",a+" .blocklyHighlightedConnectionPath {","stroke: #fc3;","}",a+" .blocklyReplaceable .blocklyPath {", +"fill-opacity: .5;","}",a+" .blocklyReplaceable .blocklyPathLight,",a+" .blocklyReplaceable .blocklyPathDark {","display: none;","}",a+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none","}"]};Blockly.blockRendering.MarkerSvg=function(a,b,c){this.workspace_=a;this.marker_=c;this.parent_=null;this.constants_=b;this.currentMarkerSvg=null;a=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=c.colour||a};Blockly.blockRendering.MarkerSvg.CURSOR_CLASS="blocklyCursor";Blockly.blockRendering.MarkerSvg.MARKER_CLASS="blocklyMarker";Blockly.blockRendering.MarkerSvg.HEIGHT_MULTIPLIER=.75;Blockly.blockRendering.MarkerSvg.prototype.getSvgRoot=function(){return this.svgGroup_}; +Blockly.blockRendering.MarkerSvg.prototype.isCursor=function(){return"cursor"==this.marker_.type};Blockly.blockRendering.MarkerSvg.prototype.createDom=function(){var a=this.isCursor()?Blockly.blockRendering.MarkerSvg.CURSOR_CLASS:Blockly.blockRendering.MarkerSvg.MARKER_CLASS;this.svgGroup_=Blockly.utils.dom.createSvgElement("g",{"class":a},null);this.createDomInternal_();this.applyColour_();return this.svgGroup_}; Blockly.blockRendering.MarkerSvg.prototype.setParent_=function(a){this.isCursor()?(this.parent_&&this.parent_.setCursorSvg(null),a.setCursorSvg(this.getSvgRoot())):(this.parent_&&this.parent_.setMarkerSvg(null),a.setMarkerSvg(this.getSvgRoot()));this.parent_=a}; Blockly.blockRendering.MarkerSvg.prototype.showWithBlockPrevOutput_=function(a){if(a){var b=a.width,c=a.height,d=c*Blockly.blockRendering.MarkerSvg.HEIGHT_MULTIPLIER,e=this.constants_.CURSOR_BLOCK_PADDING;if(a.previousConnection){var f=this.constants_.shapeFor(a.previousConnection);this.positionPrevious_(b,e,d,f)}else a.outputConnection?(f=this.constants_.shapeFor(a.outputConnection),this.positionOutput_(b,c,f)):this.positionBlock_(b,e,d);this.setParent_(a);this.showCurrent_()}}; Blockly.blockRendering.MarkerSvg.prototype.showWithCoordinates_=function(a){var b=a.getWsCoordinate();a=b.x;b=b.y;this.workspace_.RTL&&(a-=this.constants_.CURSOR_WS_WIDTH);this.positionLine_(a,b,this.constants_.CURSOR_WS_WIDTH);this.setParent_(this.workspace_);this.showCurrent_()};Blockly.blockRendering.MarkerSvg.prototype.showWithField_=function(a){a=a.getLocation();var b=a.getSize().width,c=a.getSize().height;this.positionRect_(0,0,b,c);this.setParent_(a);this.showCurrent_()}; @@ -1117,13 +1132,16 @@ Blockly.blockRendering.MarkerSvg.prototype.positionLine_=function(a,b,c){this.ma Blockly.blockRendering.MarkerSvg.prototype.positionOutput_=function(a,b,c){a=Blockly.utils.svgPaths.moveBy(a,0)+Blockly.utils.svgPaths.lineOnAxis("h",-(a-c.width))+Blockly.utils.svgPaths.lineOnAxis("v",this.constants_.TAB_OFFSET_FROM_TOP)+c.pathDown+Blockly.utils.svgPaths.lineOnAxis("V",b)+Blockly.utils.svgPaths.lineOnAxis("H",a);this.markerBlock_.setAttribute("d",a);this.workspace_.RTL&&this.flipRtl_(this.markerBlock_);this.currentMarkerSvg=this.markerBlock_}; Blockly.blockRendering.MarkerSvg.prototype.positionPrevious_=function(a,b,c,d){a=Blockly.utils.svgPaths.moveBy(-b,c)+Blockly.utils.svgPaths.lineOnAxis("V",-b)+Blockly.utils.svgPaths.lineOnAxis("H",this.constants_.NOTCH_OFFSET_LEFT)+d.pathLeft+Blockly.utils.svgPaths.lineOnAxis("H",a+2*b)+Blockly.utils.svgPaths.lineOnAxis("V",c);this.markerBlock_.setAttribute("d",a);this.workspace_.RTL&&this.flipRtl_(this.markerBlock_);this.currentMarkerSvg=this.markerBlock_}; Blockly.blockRendering.MarkerSvg.prototype.positionRect_=function(a,b,c,d){this.markerSvgRect_.setAttribute("x",a);this.markerSvgRect_.setAttribute("y",b);this.markerSvgRect_.setAttribute("width",c);this.markerSvgRect_.setAttribute("height",d);this.currentMarkerSvg=this.markerSvgRect_};Blockly.blockRendering.MarkerSvg.prototype.flipRtl_=function(a){a.setAttribute("transform","scale(-1 1)")}; -Blockly.blockRendering.MarkerSvg.prototype.hide=function(){this.markerSvgLine_.style.display="none";this.markerSvgRect_.style.display="none";this.markerInput_.style.display="none";this.markerBlock_.style.display="none"};Blockly.blockRendering.MarkerSvg.prototype.draw=function(a,b){b?(this.showAtLocation_(b),this.firemarkerEvent_(a,b),a=this.currentMarkerSvg.childNodes[0],void 0!==a&&a.beginElement&&a.beginElement()):this.hide()}; +Blockly.blockRendering.MarkerSvg.prototype.hide=function(){this.markerSvgLine_.style.display="none";this.markerSvgRect_.style.display="none";this.markerInput_.style.display="none";this.markerBlock_.style.display="none"}; +Blockly.blockRendering.MarkerSvg.prototype.draw=function(a,b){if(b){this.constants_=this.workspace_.getRenderer().getConstants();var c=this.isCursor()?this.constants_.CURSOR_COLOUR:this.constants_.MARKER_COLOUR;this.colour_=this.marker_.colour||c;this.applyColour_();this.showAtLocation_(b);this.firemarkerEvent_(a,b);a=this.currentMarkerSvg.childNodes[0];void 0!==a&&a.beginElement&&a.beginElement()}else this.hide()}; Blockly.blockRendering.MarkerSvg.prototype.showAtLocation_=function(a){a.getType()==Blockly.ASTNode.types.BLOCK?(a=a.getLocation(),this.showWithBlockPrevOutput_(a)):a.getType()==Blockly.ASTNode.types.OUTPUT?(a=a.getLocation().getSourceBlock(),this.showWithBlockPrevOutput_(a)):a.getLocation().type==Blockly.INPUT_VALUE?this.showWithInput_(a):a.getLocation().type==Blockly.NEXT_STATEMENT?this.showWithNext_(a):a.getType()==Blockly.ASTNode.types.PREVIOUS?(a=a.getLocation().getSourceBlock(),this.showWithBlockPrevOutput_(a)): a.getType()==Blockly.ASTNode.types.FIELD?this.showWithField_(a):a.getType()==Blockly.ASTNode.types.WORKSPACE?this.showWithCoordinates_(a):a.getType()==Blockly.ASTNode.types.STACK&&this.showWithStack_(a)};Blockly.blockRendering.MarkerSvg.prototype.firemarkerEvent_=function(a,b){var c=b.getSourceBlock(),d=this.isCursor()?"cursorMove":"markerMove";a=new Blockly.Events.Ui(c,d,a,b);b.getType()==Blockly.ASTNode.types.WORKSPACE&&(a.workspaceId=b.getLocation().id);Blockly.Events.fire(a)}; Blockly.blockRendering.MarkerSvg.prototype.getBlinkProperties_=function(){return{attributeType:"XML",attributeName:"fill",dur:"1s",values:this.colour_+";transparent;transparent;",repeatCount:"indefinite"}}; -Blockly.blockRendering.MarkerSvg.prototype.createDomInternal_=function(){this.markerSvg_=Blockly.utils.dom.createSvgElement("g",{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.svgGroup_);this.markerSvgLine_=Blockly.utils.dom.createSvgElement("rect",{fill:this.colour_,width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT,style:"display: none"},this.markerSvg_);this.markerSvgRect_=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyVerticalMarker", -rx:10,ry:10,style:"display: none",stroke:this.colour_},this.markerSvg_);this.markerInput_=Blockly.utils.dom.createSvgElement("path",{transform:"",style:"display: none",fill:this.colour_},this.markerSvg_);this.markerBlock_=Blockly.utils.dom.createSvgElement("path",{transform:"",style:"display: none",fill:"none",stroke:this.colour_,"stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_);if(this.isCursor()){var a=this.getBlinkProperties_();Blockly.utils.dom.createSvgElement("animate",this.getBlinkProperties_(), -this.markerSvgLine_);Blockly.utils.dom.createSvgElement("animate",a,this.markerInput_);a.attributeName="stroke";Blockly.utils.dom.createSvgElement("animate",a,this.markerBlock_)}return this.markerSvg_};Blockly.blockRendering.MarkerSvg.prototype.dispose=function(){this.svgGroup_&&Blockly.utils.dom.removeNode(this.svgGroup_)};Blockly.blockRendering.Types={NONE:0,FIELD:1,HAT:2,ICON:4,SPACER:8,BETWEEN_ROW_SPACER:16,IN_ROW_SPACER:32,EXTERNAL_VALUE_INPUT:64,INPUT:128,INLINE_INPUT:256,STATEMENT_INPUT:512,CONNECTION:1024,PREVIOUS_CONNECTION:2048,NEXT_CONNECTION:4096,OUTPUT_CONNECTION:8192,CORNER:16384,LEFT_SQUARE_CORNER:32768,LEFT_ROUND_CORNER:65536,RIGHT_SQUARE_CORNER:131072,RIGHT_ROUND_CORNER:262144,JAGGED_EDGE:524288,ROW:1048576,TOP_ROW:2097152,BOTTOM_ROW:4194304,INPUT_ROW:8388608}; +Blockly.blockRendering.MarkerSvg.prototype.createDomInternal_=function(){this.markerSvg_=Blockly.utils.dom.createSvgElement("g",{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT},this.svgGroup_);this.markerSvgLine_=Blockly.utils.dom.createSvgElement("rect",{width:this.constants_.CURSOR_WS_WIDTH,height:this.constants_.WS_CURSOR_HEIGHT,style:"display: none"},this.markerSvg_);this.markerSvgRect_=Blockly.utils.dom.createSvgElement("rect",{"class":"blocklyVerticalMarker",rx:10, +ry:10,style:"display: none"},this.markerSvg_);this.markerInput_=Blockly.utils.dom.createSvgElement("path",{transform:"",style:"display: none"},this.markerSvg_);this.markerBlock_=Blockly.utils.dom.createSvgElement("path",{transform:"",style:"display: none",fill:"none","stroke-width":this.constants_.CURSOR_STROKE_WIDTH},this.markerSvg_);if(this.isCursor()){var a=this.getBlinkProperties_();Blockly.utils.dom.createSvgElement("animate",a,this.markerSvgLine_);Blockly.utils.dom.createSvgElement("animate", +a,this.markerInput_);a.attributeName="stroke";Blockly.utils.dom.createSvgElement("animate",a,this.markerBlock_)}return this.markerSvg_}; +Blockly.blockRendering.MarkerSvg.prototype.applyColour_=function(){this.markerSvgLine_.setAttribute("fill",this.colour_);this.markerSvgRect_.setAttribute("stroke",this.colour_);this.markerInput_.setAttribute("fill",this.colour_);this.markerBlock_.setAttribute("stroke",this.colour_);if(this.isCursor()){var a=this.colour_+";transparent;transparent;";this.markerSvgLine_.firstChild.setAttribute("values",a);this.markerInput_.firstChild.setAttribute("values",a);this.markerBlock_.firstChild.setAttribute("values", +a)}};Blockly.blockRendering.MarkerSvg.prototype.dispose=function(){this.svgGroup_&&Blockly.utils.dom.removeNode(this.svgGroup_)};Blockly.blockRendering.Types={NONE:0,FIELD:1,HAT:2,ICON:4,SPACER:8,BETWEEN_ROW_SPACER:16,IN_ROW_SPACER:32,EXTERNAL_VALUE_INPUT:64,INPUT:128,INLINE_INPUT:256,STATEMENT_INPUT:512,CONNECTION:1024,PREVIOUS_CONNECTION:2048,NEXT_CONNECTION:4096,OUTPUT_CONNECTION:8192,CORNER:16384,LEFT_SQUARE_CORNER:32768,LEFT_ROUND_CORNER:65536,RIGHT_SQUARE_CORNER:131072,RIGHT_ROUND_CORNER:262144,JAGGED_EDGE:524288,ROW:1048576,TOP_ROW:2097152,BOTTOM_ROW:4194304,INPUT_ROW:8388608}; Blockly.blockRendering.Types.LEFT_CORNER=Blockly.blockRendering.Types.LEFT_SQUARE_CORNER|Blockly.blockRendering.Types.LEFT_ROUND_CORNER;Blockly.blockRendering.Types.RIGHT_CORNER=Blockly.blockRendering.Types.RIGHT_SQUARE_CORNER|Blockly.blockRendering.Types.RIGHT_ROUND_CORNER;Blockly.blockRendering.Types.nextTypeValue_=16777216; Blockly.blockRendering.Types.getType=function(a){Blockly.blockRendering.Types.hasOwnProperty(a)||(Blockly.blockRendering.Types[a]=Blockly.blockRendering.Types.nextTypeValue_,Blockly.blockRendering.Types.nextTypeValue_<<=1);return Blockly.blockRendering.Types[a]};Blockly.blockRendering.Types.isField=function(a){return a.type&Blockly.blockRendering.Types.FIELD};Blockly.blockRendering.Types.isHat=function(a){return a.type&Blockly.blockRendering.Types.HAT}; Blockly.blockRendering.Types.isIcon=function(a){return a.type&Blockly.blockRendering.Types.ICON};Blockly.blockRendering.Types.isSpacer=function(a){return a.type&Blockly.blockRendering.Types.SPACER};Blockly.blockRendering.Types.isInRowSpacer=function(a){return a.type&Blockly.blockRendering.Types.IN_ROW_SPACER};Blockly.blockRendering.Types.isInput=function(a){return a.type&Blockly.blockRendering.Types.INPUT};Blockly.blockRendering.Types.isExternalInput=function(a){return a.type&Blockly.blockRendering.Types.EXTERNAL_VALUE_INPUT}; @@ -1158,10 +1176,10 @@ Blockly.blockRendering.BottomRow.prototype.measure=function(){for(var a=0,b=0,c= Blockly.blockRendering.BottomRow.prototype.endsWithElemSpacer=function(){return!1};Blockly.blockRendering.SpacerRow=function(a,b,c){Blockly.blockRendering.SpacerRow.superClass_.constructor.call(this,a);this.type=this.type|Blockly.blockRendering.Types.SPACER|Blockly.blockRendering.Types.BETWEEN_ROW_SPACER;this.width=c;this.height=b;this.followsStatement=!1;this.widthWithConnectedBlocks=0;this.elements=[new Blockly.blockRendering.InRowSpacer(this.constants_,c)]}; Blockly.utils.object.inherits(Blockly.blockRendering.SpacerRow,Blockly.blockRendering.Row);Blockly.blockRendering.SpacerRow.prototype.measure=function(){};Blockly.blockRendering.InputRow=function(a){Blockly.blockRendering.InputRow.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.INPUT_ROW;this.connectedBlockWidths=0};Blockly.utils.object.inherits(Blockly.blockRendering.InputRow,Blockly.blockRendering.Row); Blockly.blockRendering.InputRow.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,b=0,c;c=this.elements[b];b++)this.width+=c.width,Blockly.blockRendering.Types.isInput(c)&&(Blockly.blockRendering.Types.isStatementInput(c)?a+=c.connectedBlockWidth:Blockly.blockRendering.Types.isExternalInput(c)&&0!=c.connectedBlockWidth&&(a+=c.connectedBlockWidth-c.connectionWidth)),Blockly.blockRendering.Types.isSpacer(c)||(this.height=Math.max(this.height,c.height));this.connectedBlockWidths= -a;this.widthWithConnectedBlocks=this.width+a};Blockly.blockRendering.InputRow.prototype.endsWithElemSpacer=function(){return!this.hasExternalInput&&!this.hasStatement};Blockly.blockRendering.RenderInfo=function(a,b){this.block_=b;this.renderer_=a;this.constants_=this.renderer_.getConstants();this.outputConnection=b.outputConnection?new Blockly.blockRendering.OutputConnection(this.constants_,b.outputConnection):null;this.isInline=b.getInputsInline()&&!b.isCollapsed();this.isCollapsed=b.isCollapsed();this.isInsertionMarker=b.isInsertionMarker();this.RTL=b.RTL;this.statementEdge=this.width=this.widthWithChildren=this.height=0;this.rows=[];this.inputRowNum_=1;this.hiddenIcons= +a;this.widthWithConnectedBlocks=this.width+a};Blockly.blockRendering.InputRow.prototype.endsWithElemSpacer=function(){return!this.hasExternalInput&&!this.hasStatement};Blockly.blockRendering.RenderInfo=function(a,b){this.block_=b;this.renderer_=a;this.constants_=this.renderer_.getConstants();this.outputConnection=b.outputConnection?new Blockly.blockRendering.OutputConnection(this.constants_,b.outputConnection):null;this.isInline=b.getInputsInline()&&!b.isCollapsed();this.isCollapsed=b.isCollapsed();this.isInsertionMarker=b.isInsertionMarker();this.RTL=b.RTL;this.statementEdge=this.width=this.widthWithChildren=this.height=0;this.rows=[];this.inputRows=[];this.hiddenIcons= [];this.topRow=new Blockly.blockRendering.TopRow(this.constants_);this.bottomRow=new Blockly.blockRendering.BottomRow(this.constants_);this.startY=this.startX=0};Blockly.blockRendering.RenderInfo.prototype.getRenderer=function(){return this.renderer_};Blockly.blockRendering.RenderInfo.prototype.measure=function(){this.createRows_();this.addElemSpacing_();this.addRowSpacing_();this.computeBounds_();this.alignRowElements_();this.finalize_()}; -Blockly.blockRendering.RenderInfo.prototype.createRows_=function(){this.populateTopRow_();this.rows.push(this.topRow);var a=new Blockly.blockRendering.InputRow(this.constants_),b=this.block_.getIcons();if(b.length)for(var c=0,d;d=b[c];c++){var e=new Blockly.blockRendering.Icon(this.constants_,d);this.isCollapsed&&d.collapseHidden?this.hiddenIcons.push(e):a.elements.push(e)}d=null;for(c=0;b=this.block_.inputList[c];c++)if(b.isVisible()){this.shouldStartNewRow_(b,d)&&(this.rows.push(a),a=new Blockly.blockRendering.InputRow(this.constants_), -this.inputRowNum_++);for(d=0;e=b.fieldRow[d];d++)a.elements.push(new Blockly.blockRendering.Field(this.constants_,e,b));this.addInput_(b,a);d=b}this.isCollapsed&&(a.hasJaggedEdge=!0,a.elements.push(new Blockly.blockRendering.JaggedEdge(this.constants_)));(a.elements.length||a.hasDummyInput)&&this.rows.push(a);this.populateBottomRow_();this.rows.push(this.bottomRow)}; +Blockly.blockRendering.RenderInfo.prototype.createRows_=function(){this.populateTopRow_();this.rows.push(this.topRow);var a=new Blockly.blockRendering.InputRow(this.constants_);this.inputRows.push(a);var b=this.block_.getIcons();if(b.length)for(var c=0,d;d=b[c];c++){var e=new Blockly.blockRendering.Icon(this.constants_,d);this.isCollapsed&&d.collapseHidden?this.hiddenIcons.push(e):a.elements.push(e)}d=null;for(c=0;b=this.block_.inputList[c];c++)if(b.isVisible()){this.shouldStartNewRow_(b,d)&&(this.rows.push(a), +a=new Blockly.blockRendering.InputRow(this.constants_),this.inputRows.push(a));for(d=0;e=b.fieldRow[d];d++)a.elements.push(new Blockly.blockRendering.Field(this.constants_,e,b));this.addInput_(b,a);d=b}this.isCollapsed&&(a.hasJaggedEdge=!0,a.elements.push(new Blockly.blockRendering.JaggedEdge(this.constants_)));(a.elements.length||a.hasDummyInput)&&this.rows.push(a);this.populateBottomRow_();this.rows.push(this.bottomRow)}; Blockly.blockRendering.RenderInfo.prototype.populateTopRow_=function(){var a=!!this.block_.previousConnection,b=(this.block_.hat?"cap"===this.block_.hat:this.constants_.ADD_START_HATS)&&!this.outputConnection&&!a;this.topRow.hasLeftSquareCorner(this.block_)?this.topRow.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_)):this.topRow.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_));b?(a=new Blockly.blockRendering.Hat(this.constants_),this.topRow.elements.push(a), this.topRow.capline=a.ascenderHeight):a&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new Blockly.blockRendering.PreviousConnection(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection));this.block_.inputList.length&&this.block_.inputList[0].type==Blockly.NEXT_STATEMENT&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT;this.topRow.hasRightSquareCorner(this.block_)? this.topRow.elements.push(new Blockly.blockRendering.SquareCorner(this.constants_,"right")):this.topRow.elements.push(new Blockly.blockRendering.RoundCorner(this.constants_,"right"))}; @@ -1175,15 +1193,14 @@ b.elements.push(new Blockly.blockRendering.InRowSpacer(this.constants_,this.getI Blockly.blockRendering.RenderInfo.prototype.getInRowSpacing_=function(a,b){if(!a&&b&&Blockly.blockRendering.Types.isStatementInput(b))return this.constants_.STATEMENT_INPUT_PADDING_LEFT;if(a&&Blockly.blockRendering.Types.isInput(a)&&!b){if(Blockly.blockRendering.Types.isExternalInput(a))return this.constants_.NO_PADDING;if(Blockly.blockRendering.Types.isInlineInput(a))return this.constants_.LARGE_PADDING;if(Blockly.blockRendering.Types.isStatementInput(a))return this.constants_.NO_PADDING}return a&& Blockly.blockRendering.Types.isLeftSquareCorner(a)&&b&&(Blockly.blockRendering.Types.isPreviousConnection(b)||Blockly.blockRendering.Types.isNextConnection(b))?b.notchOffset:a&&Blockly.blockRendering.Types.isLeftRoundedCorner(a)&&b&&(Blockly.blockRendering.Types.isPreviousConnection(b)||Blockly.blockRendering.Types.isNextConnection(b))?b.notchOffset-this.constants_.CORNER_RADIUS:this.constants_.MEDIUM_PADDING}; Blockly.blockRendering.RenderInfo.prototype.computeBounds_=function(){for(var a=0,b=0,c=0,d=0,e;e=this.rows[d];d++){e.measure();b=Math.max(b,e.width);if(e.hasStatement){var f=e.getLastInput();a=Math.max(a,e.width-f.width)}c=Math.max(c,e.widthWithConnectedBlocks)}this.statementEdge=a;this.width=b;for(d=0;e=this.rows[d];d++)e.hasStatement&&(e.statementEdge=this.statementEdge);this.widthWithChildren=Math.max(b,c);this.outputConnection&&(this.startX=this.outputConnection.width,this.width+=this.outputConnection.width, -this.widthWithChildren+=this.outputConnection.width)};Blockly.blockRendering.RenderInfo.prototype.alignRowElements_=function(){for(var a=0,b;b=this.rows[a];a++)if(b.hasStatement)this.alignStatementRow_(b);else{var c=b.width;c=this.getDesiredRowWidth_(b)-c;0.blocklyPathLight,",a+" .blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none","}"])};Blockly.geras.Highlighter=function(a){this.info_=a;this.inlineSteps_=this.steps_="";this.RTL_=this.info_.RTL;a=a.getRenderer();this.constants_=a.getConstants();this.highlightConstants_=a.getHighlightConstants();this.highlightOffset_=this.highlightConstants_.OFFSET;this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER;this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER;this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB;this.notchPaths_=this.highlightConstants_.NOTCH;this.startPaths_= this.highlightConstants_.START_HAT;this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH};Blockly.geras.Highlighter.prototype.getPath=function(){return this.steps_+"\n"+this.inlineSteps_}; Blockly.geras.Highlighter.prototype.drawTopCorner=function(a){this.steps_+=Blockly.utils.svgPaths.moveBy(a.xPos,this.info_.startY);for(var b=0,c;c=a.elements[b];b++)Blockly.blockRendering.Types.isLeftSquareCorner(c)?this.steps_+=this.highlightConstants_.START_POINT:Blockly.blockRendering.Types.isLeftRoundedCorner(c)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):Blockly.blockRendering.Types.isPreviousConnection(c)?this.steps_+=this.notchPaths_.pathLeft:Blockly.blockRendering.Types.isHat(c)? -this.steps_+=this.startPaths_.path(this.RTL_):Blockly.blockRendering.Types.isSpacer(c)&&0!=c.width&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",c.xPos+c.width-this.highlightOffset_));this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",a.xPos+a.width-this.highlightOffset_)}; -Blockly.geras.Highlighter.prototype.drawJaggedEdge_=function(a){this.info_.RTL&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",a.width-this.highlightOffset_),this.steps_+=this.jaggedTeethPaths_.pathLeft,this.steps_+=Blockly.utils.svgPaths.lineOnAxis("v",a.height-this.jaggedTeethPaths_.height-this.highlightOffset_))}; +this.steps_+=this.startPaths_.path(this.RTL_):Blockly.blockRendering.Types.isSpacer(c)&&0!=c.width&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",c.xPos+c.width-this.highlightOffset_));this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",a.xPos+a.width-this.highlightOffset_)};Blockly.geras.Highlighter.prototype.drawJaggedEdge_=function(a){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+Blockly.utils.svgPaths.lineOnAxis("v",a.height-this.jaggedTeethPaths_.height-this.highlightOffset_))}; Blockly.geras.Highlighter.prototype.drawValueInput=function(a){var b=a.getLastInput();if(this.RTL_){var c=a.height-b.connectionHeight;this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos+b.width-this.highlightOffset_,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",c)}else this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos+b.width,a.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)}; Blockly.geras.Highlighter.prototype.drawStatementInput=function(a){var b=a.getLastInput();if(this.RTL_){var c=a.height-2*this.insideCornerPaths_.height;this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos,a.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+Blockly.utils.svgPaths.lineOnAxis("v",c)+this.insideCornerPaths_.pathBottom(this.RTL_)+Blockly.utils.svgPaths.lineTo(a.width-b.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=Blockly.utils.svgPaths.moveTo(b.xPos,a.yPos+a.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+ Blockly.utils.svgPaths.lineTo(a.width-b.xPos-this.insideCornerPaths_.width,0)};Blockly.geras.Highlighter.prototype.drawRightSideRow=function(a){var b=a.xPos+a.width-this.highlightOffset_;a.followsStatement&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",b));this.RTL_&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("H",b),a.height>this.highlightOffset_&&(this.steps_+=Blockly.utils.svgPaths.lineOnAxis("V",a.yPos+a.height-this.highlightOffset_)))}; @@ -1249,22 +1269,22 @@ Blockly.geras.Drawer.prototype.drawValueInput_=function(a){this.highlighter_.dra Blockly.geras.Drawer.prototype.drawRightSideRow_=function(a){this.highlighter_.drawRightSideRow(a);this.outlinePath_+=Blockly.utils.svgPaths.lineOnAxis("H",a.xPos+a.width)+Blockly.utils.svgPaths.lineOnAxis("V",a.yPos+a.height)};Blockly.geras.Drawer.prototype.drawBottom_=function(){this.highlighter_.drawBottomRow(this.info_.bottomRow);Blockly.geras.Drawer.superClass_.drawBottom_.call(this)};Blockly.geras.Drawer.prototype.drawLeft_=function(){this.highlighter_.drawLeft();Blockly.geras.Drawer.superClass_.drawLeft_.call(this)}; Blockly.geras.Drawer.prototype.drawInlineInput_=function(a){this.highlighter_.drawInlineInput(a);Blockly.geras.Drawer.superClass_.drawInlineInput_.call(this,a)};Blockly.geras.Drawer.prototype.positionInlineInputConnection_=function(a){var b=a.centerline-a.height/2;if(a.connectionModel){var c=a.xPos+a.connectionWidth+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);a.connectionModel.setOffsetInBlock(c,b+a.connectionOffsetY+this.constants_.DARK_PATH_OFFSET)}}; Blockly.geras.Drawer.prototype.positionStatementInputConnection_=function(a){var b=a.getLastInput();if(b.connectionModel){var c=a.xPos+a.statementEdge+b.notchOffset;c=this.info_.RTL?-1*c:c+this.constants_.DARK_PATH_OFFSET;b.connectionModel.setOffsetInBlock(c,a.yPos+this.constants_.DARK_PATH_OFFSET)}}; -Blockly.geras.Drawer.prototype.positionExternalValueConnection_=function(a){var b=a.getLastInput();if(b.connectionModel){var c=a.xPos+a.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);b.connectionModel.setOffsetInBlock(c,a.yPos)}};Blockly.geras.Drawer.prototype.positionNextConnection_=function(){var a=this.info_.bottomRow;if(a.connection){var b=a.connection,c=b.xPos;b.connectionModel.setOffsetInBlock((this.info_.RTL?-c:c)+this.constants_.DARK_PATH_OFFSET/2,a.baseline+this.constants_.DARK_PATH_OFFSET)}};Blockly.geras.HighlightConstantProvider=function(a){this.constantProvider=a;this.OFFSET=.5;this.START_POINT=Blockly.utils.svgPaths.moveBy(this.OFFSET,this.OFFSET);this.INSIDE_CORNER=this.makeInsideCorner();this.OUTSIDE_CORNER=this.makeOutsideCorner();this.PUZZLE_TAB=this.makePuzzleTab();this.NOTCH=this.makeNotch();this.JAGGED_TEETH=this.makeJaggedTeeth();this.START_HAT=this.makeStartHat()}; +Blockly.geras.Drawer.prototype.positionExternalValueConnection_=function(a){var b=a.getLastInput();if(b.connectionModel){var c=a.xPos+a.width+this.constants_.DARK_PATH_OFFSET;this.info_.RTL&&(c*=-1);b.connectionModel.setOffsetInBlock(c,a.yPos)}};Blockly.geras.Drawer.prototype.positionNextConnection_=function(){var a=this.info_.bottomRow;if(a.connection){var b=a.connection,c=b.xPos;b.connectionModel.setOffsetInBlock((this.info_.RTL?-c:c)+this.constants_.DARK_PATH_OFFSET/2,a.baseline+this.constants_.DARK_PATH_OFFSET)}};Blockly.geras.HighlightConstantProvider=function(a){this.constantProvider=a;this.OFFSET=.5;this.START_POINT=Blockly.utils.svgPaths.moveBy(this.OFFSET,this.OFFSET)};Blockly.geras.HighlightConstantProvider.prototype.init=function(){this.INSIDE_CORNER=this.makeInsideCorner();this.OUTSIDE_CORNER=this.makeOutsideCorner();this.PUZZLE_TAB=this.makePuzzleTab();this.NOTCH=this.makeNotch();this.JAGGED_TEETH=this.makeJaggedTeeth();this.START_HAT=this.makeStartHat()}; Blockly.geras.HighlightConstantProvider.prototype.makeInsideCorner=function(){var a=this.constantProvider.CORNER_RADIUS,b=this.OFFSET,c=(1-Math.SQRT1_2)*(a+b)-b,d=Blockly.utils.svgPaths.moveBy(c,c)+Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(-c-b,a-c)),e=Blockly.utils.svgPaths.arc("a","0 0,0",a+b,Blockly.utils.svgPaths.point(a+b,a+b)),f=Blockly.utils.svgPaths.moveBy(c,-c)+Blockly.utils.svgPaths.arc("a","0 0,0",a+b,Blockly.utils.svgPaths.point(a-c,c+b));return{width:a+b,height:a, pathTop:function(a){return a?d:""},pathBottom:function(a){return a?e:f}}}; Blockly.geras.HighlightConstantProvider.prototype.makeOutsideCorner=function(){var a=this.constantProvider.CORNER_RADIUS,b=this.OFFSET,c=(1-Math.SQRT1_2)*(a-b)+b,d=Blockly.utils.svgPaths.moveBy(c,c)+Blockly.utils.svgPaths.arc("a","0 0,1",a-b,Blockly.utils.svgPaths.point(a-c,-c+b)),e=Blockly.utils.svgPaths.moveBy(b,a)+Blockly.utils.svgPaths.arc("a","0 0,1",a-b,Blockly.utils.svgPaths.point(a,-a+b)),f=-c,g=Blockly.utils.svgPaths.moveBy(c,f)+Blockly.utils.svgPaths.arc("a","0 0,1",a-b,Blockly.utils.svgPaths.point(-c+ b,-f-a));return{height:a,topLeft:function(a){return a?d:e},bottomLeft:function(){return g}}}; Blockly.geras.HighlightConstantProvider.prototype.makePuzzleTab=function(){var a=this.constantProvider.TAB_WIDTH,b=this.constantProvider.TAB_HEIGHT,c=Blockly.utils.svgPaths.moveBy(-2,-b+3.4)+Blockly.utils.svgPaths.lineTo(-.45*a,-2.1),d=Blockly.utils.svgPaths.lineOnAxis("v",2.5)+Blockly.utils.svgPaths.moveBy(.97*-a,2.5)+Blockly.utils.svgPaths.curve("q",[Blockly.utils.svgPaths.point(.05*-a,10),Blockly.utils.svgPaths.point(.3*a,9.5)])+Blockly.utils.svgPaths.moveBy(.67*a,-1.9)+Blockly.utils.svgPaths.lineOnAxis("v", 2.5),e=Blockly.utils.svgPaths.lineOnAxis("v",-1.5)+Blockly.utils.svgPaths.moveBy(-.92*a,-.5)+Blockly.utils.svgPaths.curve("q",[Blockly.utils.svgPaths.point(-.19*a,-5.5),Blockly.utils.svgPaths.point(0,-11)])+Blockly.utils.svgPaths.moveBy(.92*a,1),f=Blockly.utils.svgPaths.moveBy(-5,b-.7)+Blockly.utils.svgPaths.lineTo(.46*a,-2.1);return{width:a,height:b,pathUp:function(a){return a?c:e},pathDown:function(a){return a?d:f}}}; -Blockly.geras.HighlightConstantProvider.prototype.makeNotch=function(){return{pathLeft:Blockly.utils.svgPaths.lineOnAxis("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}};Blockly.geras.HighlightConstantProvider.prototype.makeJaggedTeeth=function(){return{pathLeft:Blockly.utils.svgPaths.lineTo(5.1,2.6)+Blockly.utils.svgPaths.moveBy(-10.2,6.8)+Blockly.utils.svgPaths.lineTo(5.1,2.6)}}; +Blockly.geras.HighlightConstantProvider.prototype.makeNotch=function(){return{pathLeft:Blockly.utils.svgPaths.lineOnAxis("h",this.OFFSET)+this.constantProvider.NOTCH.pathLeft}};Blockly.geras.HighlightConstantProvider.prototype.makeJaggedTeeth=function(){return{pathLeft:Blockly.utils.svgPaths.lineTo(5.1,2.6)+Blockly.utils.svgPaths.moveBy(-10.2,6.8)+Blockly.utils.svgPaths.lineTo(5.1,2.6),height:12,width:10.2}}; Blockly.geras.HighlightConstantProvider.prototype.makeStartHat=function(){var a=this.constantProvider.START_HAT.height,b=Blockly.utils.svgPaths.moveBy(25,-8.7)+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(29.7,-6.2),Blockly.utils.svgPaths.point(57.2,-.5),Blockly.utils.svgPaths.point(75,8.7)]),c=Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(17.8,-9.2),Blockly.utils.svgPaths.point(45.3,-14.9),Blockly.utils.svgPaths.point(75,-8.7)])+Blockly.utils.svgPaths.moveTo(100.5, -a+.5);return{path:function(a){return a?b:c}}};Blockly.geras.PathObject=function(a,b,c){this.constants_=c;this.svgRoot=a;this.svgPathDark=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.svgRoot);this.svgPath=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPath"},this.svgRoot);this.svgPathLight=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathLight"},this.svgRoot);this.colourDark="#000000";this.style=b};Blockly.utils.object.inherits(Blockly.geras.PathObject,Blockly.blockRendering.PathObject); +a+.5);return{path:function(a){return a?b:c}}};Blockly.geras.PathObject=function(a,b,c){this.constants=c;this.svgRoot=a;this.svgPathDark=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.svgRoot);this.svgPath=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPath"},this.svgRoot);this.svgPathLight=Blockly.utils.dom.createSvgElement("path",{"class":"blocklyPathLight"},this.svgRoot);this.colourDark="#000000";this.style=b};Blockly.utils.object.inherits(Blockly.geras.PathObject,Blockly.blockRendering.PathObject); Blockly.geras.PathObject.prototype.setPath=function(a){this.svgPath.setAttribute("d",a);this.svgPathDark.setAttribute("d",a)};Blockly.geras.PathObject.prototype.setHighlightPath=function(a){this.svgPathLight.setAttribute("d",a)};Blockly.geras.PathObject.prototype.flipRTL=function(){this.svgPath.setAttribute("transform","scale(-1 1)");this.svgPathLight.setAttribute("transform","scale(-1 1)");this.svgPathDark.setAttribute("transform","translate(1,1) scale(-1 1)")}; Blockly.geras.PathObject.prototype.applyColour=function(a){this.svgPathLight.style.display="";this.svgPathDark.style.display="";this.svgPathLight.setAttribute("stroke",this.style.colourTertiary);this.svgPathDark.setAttribute("fill",this.colourDark);Blockly.geras.PathObject.superClass_.applyColour.call(this,a);this.svgPath.setAttribute("stroke","none")}; -Blockly.geras.PathObject.prototype.setStyle=function(a){this.style=a;this.colourDark=Blockly.utils.colour.blend("#000",this.style.colourPrimary,.2)||this.colourDark};Blockly.geras.PathObject.prototype.updateHighlighted=function(a){a?(this.svgPath.setAttribute("filter","url(#"+this.constants_.embossFilterId+")"),this.svgPathLight.style.display="none"):(this.svgPath.setAttribute("filter","none"),this.svgPathLight.style.display="inline")}; -Blockly.geras.PathObject.prototype.updateShadow_=function(a){a&&(this.svgPathLight.style.display="none",this.svgPathDark.setAttribute("fill",this.style.colourSecondary),this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary))};Blockly.geras.PathObject.prototype.updateDisabled_=function(a){Blockly.geras.PathObject.superClass_.updateDisabled_.call(this,a);a&&this.svgPath.setAttribute("stroke","none")};Blockly.geras.Renderer=function(a){Blockly.geras.Renderer.superClass_.constructor.call(this,a);this.highlightConstants_=null};Blockly.utils.object.inherits(Blockly.geras.Renderer,Blockly.blockRendering.Renderer);Blockly.geras.Renderer.prototype.init=function(){Blockly.geras.Renderer.superClass_.init.call(this);this.highlightConstants_=this.makeHighlightConstants_()};Blockly.geras.Renderer.prototype.makeConstants_=function(){return new Blockly.geras.ConstantProvider}; -Blockly.geras.Renderer.prototype.makeRenderInfo_=function(a){return new Blockly.geras.RenderInfo(this,a)};Blockly.geras.Renderer.prototype.makeDrawer_=function(a,b){return new Blockly.geras.Drawer(a,b)};Blockly.geras.Renderer.prototype.makePathObject=function(a,b){return new Blockly.geras.PathObject(a,b,this.getConstants())};Blockly.geras.Renderer.prototype.makeHighlightConstants_=function(){return new Blockly.geras.HighlightConstantProvider(this.getConstants())}; -Blockly.geras.Renderer.prototype.getHighlightConstants=function(){return this.highlightConstants_};Blockly.blockRendering.register("geras",Blockly.geras.Renderer);Blockly.thrasos={};Blockly.thrasos.RenderInfo=function(a,b){Blockly.thrasos.RenderInfo.superClass_.constructor.call(this,a,b)};Blockly.utils.object.inherits(Blockly.thrasos.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.thrasos.RenderInfo.prototype.getRenderer=function(){return this.renderer_}; +Blockly.geras.PathObject.prototype.setStyle=function(a){this.style=a;this.colourDark=Blockly.utils.colour.blend("#000",this.style.colourPrimary,.2)||this.colourDark};Blockly.geras.PathObject.prototype.updateHighlighted=function(a){a?(this.svgPath.setAttribute("filter","url(#"+this.constants.embossFilterId+")"),this.svgPathLight.style.display="none"):(this.svgPath.setAttribute("filter","none"),this.svgPathLight.style.display="inline")}; +Blockly.geras.PathObject.prototype.updateShadow_=function(a){a&&(this.svgPathLight.style.display="none",this.svgPathDark.setAttribute("fill",this.style.colourSecondary),this.svgPath.setAttribute("stroke","none"),this.svgPath.setAttribute("fill",this.style.colourSecondary))};Blockly.geras.PathObject.prototype.updateDisabled_=function(a){Blockly.geras.PathObject.superClass_.updateDisabled_.call(this,a);a&&this.svgPath.setAttribute("stroke","none")};Blockly.geras.Renderer=function(a){Blockly.geras.Renderer.superClass_.constructor.call(this,a);this.highlightConstants_=null};Blockly.utils.object.inherits(Blockly.geras.Renderer,Blockly.blockRendering.Renderer);Blockly.geras.Renderer.prototype.init=function(a,b){Blockly.geras.Renderer.superClass_.init.call(this,a,b);this.highlightConstants_=this.makeHighlightConstants_();this.highlightConstants_.init()}; +Blockly.geras.Renderer.prototype.refreshDom=function(a,b){Blockly.geras.Renderer.superClass_.refreshDom.call(this,a,b);this.getHighlightConstants().init()};Blockly.geras.Renderer.prototype.makeConstants_=function(){return new Blockly.geras.ConstantProvider};Blockly.geras.Renderer.prototype.makeRenderInfo_=function(a){return new Blockly.geras.RenderInfo(this,a)};Blockly.geras.Renderer.prototype.makeDrawer_=function(a,b){return new Blockly.geras.Drawer(a,b)}; +Blockly.geras.Renderer.prototype.makePathObject=function(a,b){return new Blockly.geras.PathObject(a,b,this.getConstants())};Blockly.geras.Renderer.prototype.makeHighlightConstants_=function(){return new Blockly.geras.HighlightConstantProvider(this.getConstants())};Blockly.geras.Renderer.prototype.getHighlightConstants=function(){return this.highlightConstants_};Blockly.blockRendering.register("geras",Blockly.geras.Renderer);Blockly.thrasos={};Blockly.thrasos.RenderInfo=function(a,b){Blockly.thrasos.RenderInfo.superClass_.constructor.call(this,a,b)};Blockly.utils.object.inherits(Blockly.thrasos.RenderInfo,Blockly.blockRendering.RenderInfo);Blockly.thrasos.RenderInfo.prototype.getRenderer=function(){return this.renderer_}; Blockly.thrasos.RenderInfo.prototype.addElemSpacing_=function(){for(var a=!1,b=0,c;c=this.rows[b];b++)c.hasExternalInput&&(a=!0);for(b=0;c=this.rows[b];b++){var d=c.elements;c.elements=[];c.startsWithElemSpacer()&&c.elements.push(new Blockly.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,d[0])));for(var e=0;eb?b:c;e=e?-1:1;a=(d?-1:1)*a/2;return Blockly.utils.svgPaths.lineTo(-e*c,a)+Blockly.utils.svgPaths.lineTo(e*c,a)}var b=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width:function(a){a/=2;return a>b?b:a},height:function(a){return a},connectionOffsetY:function(a){return a/2},connectionOffsetX:function(a){return-a},pathDown:function(b){return a(b,!1,!1)},pathUp:function(b){return a(b, +!0,!1)},pathRightDown:function(b){return a(b,!1,!0)},pathRightUp:function(b){return a(b,!1,!0)}}}; +Blockly.zelos.ConstantProvider.prototype.makeRounded=function(){function a(a,b,f){var d=a>c?a-c:0;a=(a>c?c:a)/2;return Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point((b?-1:1)*a,(b?-1:1)*a))+Blockly.utils.svgPaths.lineOnAxis("v",(f?1:-1)*d)+Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point((b?1:-1)*a,(b?-1:1)*a))}var b=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,c=2*b;return{type:this.SHAPES.ROUND,isDynamic:!0,width:function(a){a/=2;return a>b?b:a},height:function(a){return a}, +connectionOffsetY:function(a){return a/2},connectionOffsetX:function(a){return-a},pathDown:function(b){return a(b,!1,!1)},pathUp:function(b){return a(b,!0,!1)},pathRightDown:function(b){return a(b,!1,!0)},pathRightUp:function(b){return a(b,!1,!0)}}}; Blockly.zelos.ConstantProvider.prototype.makeSquared=function(){function a(a,d,e){a-=2*b;return Blockly.utils.svgPaths.arc("a","0 0,1",b,Blockly.utils.svgPaths.point((d?-1:1)*b,(d?-1:1)*b))+Blockly.utils.svgPaths.lineOnAxis("v",(e?1:-1)*a)+Blockly.utils.svgPaths.arc("a","0 0,1",b,Blockly.utils.svgPaths.point((d?1:-1)*b,(d?-1:1)*b))}var b=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width:function(a){return b},height:function(a){return a},connectionOffsetY:function(a){return a/2}, connectionOffsetX:function(a){return-a},pathDown:function(b){return a(b,!1,!1)},pathUp:function(b){return a(b,!0,!1)},pathRightDown:function(b){return a(b,!1,!0)},pathRightUp:function(b){return a(b,!1,!0)}}}; Blockly.zelos.ConstantProvider.prototype.shapeFor=function(a){var b=a.getCheck();!b&&a.targetConnection&&(b=a.targetConnection.getCheck());switch(a.type){case Blockly.INPUT_VALUE:case Blockly.OUTPUT_VALUE:a=a.getSourceBlock().getOutputShape();if(null!=a)switch(a){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}if(b&&-1!=b.indexOf("Boolean"))return this.HEXAGONAL;if(b&&-1!=b.indexOf("Number"))return this.ROUNDED; @@ -1299,69 +1322,66 @@ Blockly.zelos.ConstantProvider.prototype.makeNotch=function(){function a(a){retu [Blockly.utils.svgPaths.point(a*e/2,0),Blockly.utils.svgPaths.point(a*e*3/4,-(g/2)),Blockly.utils.svgPaths.point(a*e,-g)])+Blockly.utils.svgPaths.line([Blockly.utils.svgPaths.point(a*e,-f)])+Blockly.utils.svgPaths.curve("c",[Blockly.utils.svgPaths.point(a*e/4,-(g/2)),Blockly.utils.svgPaths.point(a*e/2,-g),Blockly.utils.svgPaths.point(a*e,-g)])}var b=this.NOTCH_WIDTH,c=this.NOTCH_HEIGHT,d=b/3,e=d/3,f=c/2,g=f/2,h=a(1),k=a(-1);return{type:this.SHAPES.NOTCH,width:b,height:c,pathLeft:h,pathRight:k}}; Blockly.zelos.ConstantProvider.prototype.makeInsideCorners=function(){var a=this.CORNER_RADIUS,b=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(-a,a)),c=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(-a,a)),d=Blockly.utils.svgPaths.arc("a","0 0,0",a,Blockly.utils.svgPaths.point(a,a)),e=Blockly.utils.svgPaths.arc("a","0 0,1",a,Blockly.utils.svgPaths.point(a,a));return{width:a,height:a,pathTop:b,pathBottom:d,rightWidth:a,rightHeight:a,pathTopRight:c,pathBottomRight:e}}; Blockly.zelos.ConstantProvider.prototype.generateSecondaryColour_=function(a){return Blockly.utils.colour.blend("#000",a,.15)||a};Blockly.zelos.ConstantProvider.prototype.generateTertiaryColour_=function(a){return Blockly.utils.colour.blend("#000",a,.25)||a}; -Blockly.zelos.ConstantProvider.prototype.createDom=function(a){Blockly.zelos.ConstantProvider.superClass_.createDom.call(this,a);a=Blockly.utils.dom.createSvgElement("defs",{},a);var b=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyHighlightGlowFilter"+this.randomIdentifier_,height:"160%",width:"180%",y:"-30%",x:"-40%"},a);Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:.5},b);var c=Blockly.utils.dom.createSvgElement("feComponentTransfer",{result:"outBlur"}, -b);Blockly.utils.dom.createSvgElement("feFuncA",{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},c);Blockly.utils.dom.createSvgElement("feFlood",{"flood-color":"#fff200","flood-opacity":1,result:"outColor"},b);Blockly.utils.dom.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},b);this.highlightGlowFilterId=b.id;this.highlightGlowFilter_=b;a=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyReplacementGlowFilter"+this.randomIdentifier_, -height:"160%",width:"180%",y:"-30%",x:"-40%"},a);Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:2},a);b=Blockly.utils.dom.createSvgElement("feComponentTransfer",{result:"outBlur"},a);Blockly.utils.dom.createSvgElement("feFuncA",{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},b);Blockly.utils.dom.createSvgElement("feFlood",{"flood-color":"#fff200","flood-opacity":1,result:"outColor"},a);Blockly.utils.dom.createSvgElement("feComposite",{"in":"outColor", -in2:"outBlur",operator:"in",result:"outGlow"},a);Blockly.utils.dom.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"outGlow",operator:"over"},a);this.replacementGlowFilterId=a.id;this.replacementGlowFilter_=a}; -Blockly.zelos.ConstantProvider.prototype.getCSS_=function(a){a="."+a+"-renderer";return[a+" .blocklyText {","fill: #fff;","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-size: "+this.FIELD_TEXT_FONTSIZE+"pt;","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",a+" .blocklyNonEditableText>rect:not(.blocklyDropdownRect),",a+" .blocklyEditableText>rect:not(.blocklyDropdownRect) {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","}",a+" .blocklyNonEditableText>text,",a+" .blocklyEditableText>text,",a+ -" .blocklyNonEditableText>g>text,",a+" .blocklyEditableText>g>text {","fill: #575E75;","}",a+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>rect ,",a+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",a+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","color: #575E75;","}",a+" .blocklyDropdownText {","fill: #fff !important;", -"}",a+".blocklyWidgetDiv .goog-menuitem,",a+".blocklyDropDownDiv .goog-menuitem {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","}",a+".blocklyDropDownDiv .goog-menuitem-content {","color: #fff;","}",a+" .blocklyHighlightedConnectionPath {","stroke: #fff200;","}",a+" .blocklyDisabled > .blocklyOutlinePath {","fill: url(#blocklyDisabledPattern"+this.randomIdentifier_+")","}"]};Blockly.zelos.TopRow=function(a){Blockly.zelos.TopRow.superClass_.constructor.call(this,a)};Blockly.utils.object.inherits(Blockly.zelos.TopRow,Blockly.blockRendering.TopRow);Blockly.zelos.TopRow.prototype.endsWithElemSpacer=function(){return!1};Blockly.zelos.TopRow.prototype.hasLeftSquareCorner=function(a){var b=(a.hat?"cap"===a.hat:this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection;return!!a.outputConnection||b};Blockly.zelos.TopRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection}; -Blockly.zelos.BottomRow=function(a){Blockly.zelos.BottomRow.superClass_.constructor.call(this,a)};Blockly.utils.object.inherits(Blockly.zelos.BottomRow,Blockly.blockRendering.BottomRow);Blockly.zelos.BottomRow.prototype.endsWithElemSpacer=function(){return!1};Blockly.zelos.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection};Blockly.zelos.BottomRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection};Blockly.zelos.RightConnectionShape=function(a){Blockly.zelos.RightConnectionShape.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.getType("RIGHT_CONNECTION");this.width=this.height=0};Blockly.utils.object.inherits(Blockly.zelos.RightConnectionShape,Blockly.blockRendering.Measurable);Blockly.zelos.StatementInput=function(a,b){Blockly.zelos.StatementInput.superClass_.constructor.call(this,a,b);if(this.connectedBlock){for(a=this.connectedBlock;a.getNextBlock();)a=a.getNextBlock();a.nextConnection||(this.height=this.connectedBlockHeight,this.connectedBottomNextConnection=!0)}};Blockly.utils.object.inherits(Blockly.zelos.StatementInput,Blockly.blockRendering.StatementInput);Blockly.zelos.RenderInfo=function(a,b){Blockly.zelos.RenderInfo.superClass_.constructor.call(this,a,b);this.topRow=new Blockly.zelos.TopRow(this.constants_);this.bottomRow=new Blockly.zelos.BottomRow(this.constants_);this.isInline=!0;this.isMultiRow=!b.getInputsInline()||b.isCollapsed();this.rightSide=this.outputConnection?new Blockly.zelos.RightConnectionShape(this.constants_):null};Blockly.utils.object.inherits(Blockly.zelos.RenderInfo,Blockly.blockRendering.RenderInfo); +Blockly.zelos.ConstantProvider.prototype.createDom=function(a,b,c){Blockly.zelos.ConstantProvider.superClass_.createDom.call(this,a,b,c);a=Blockly.utils.dom.createSvgElement("defs",{},a);b=Blockly.utils.dom.createSvgElement("filter",{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},a);Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},b);c=Blockly.utils.dom.createSvgElement("feComponentTransfer", +{result:"outBlur"},b);Blockly.utils.dom.createSvgElement("feFuncA",{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},c);Blockly.utils.dom.createSvgElement("feFlood",{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},b);Blockly.utils.dom.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},b);this.selectedGlowFilterId=b.id;this.selectedGlowFilter_=b;a=Blockly.utils.dom.createSvgElement("filter",{id:"blocklyReplacementGlowFilter"+ +this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},a);Blockly.utils.dom.createSvgElement("feGaussianBlur",{"in":"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},a);b=Blockly.utils.dom.createSvgElement("feComponentTransfer",{result:"outBlur"},a);Blockly.utils.dom.createSvgElement("feFuncA",{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},b);Blockly.utils.dom.createSvgElement("feFlood",{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"}, +a);Blockly.utils.dom.createSvgElement("feComposite",{"in":"outColor",in2:"outBlur",operator:"in",result:"outGlow"},a);Blockly.utils.dom.createSvgElement("feComposite",{"in":"SourceGraphic",in2:"outGlow",operator:"over"},a);this.replacementGlowFilterId=a.id;this.replacementGlowFilter_=a}; +Blockly.zelos.ConstantProvider.prototype.getCSS_=function(a){return[a+" .blocklyText, ",a+" .blocklyFlyoutLabelText {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-size: "+this.FIELD_TEXT_FONTSIZE+"pt;","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",a+" .blocklyText {","fill: #fff;","}",a+" .blocklyNonEditableText>rect:not(.blocklyDropdownRect),",a+" .blocklyEditableText>rect:not(.blocklyDropdownRect) {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","}",a+" .blocklyNonEditableText>text,", +a+" .blocklyEditableText>text,",a+" .blocklyNonEditableText>g>text,",a+" .blocklyEditableText>g>text {","fill: #575E75;","}",a+" .blocklyFlyoutLabelText {","fill: #575E75;","}",a+" .blocklyText.blocklyBubbleText {","fill: #575E75;","}",a+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>rect ,",a+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",a+" .blocklyHtmlInput {","font-family: "+ +this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","color: #575E75;","}",a+" .blocklyDropdownText {","fill: #fff !important;","}",a+".blocklyWidgetDiv .goog-menuitem,",a+".blocklyDropDownDiv .goog-menuitem {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","}",a+".blocklyDropDownDiv .goog-menuitem-content {","color: #fff;","}",a+" .blocklyHighlightedConnectionPath {","stroke: "+this.SELECTED_GLOW_COLOUR+";","}",a+" .blocklyDisabled > .blocklyOutlinePath {","fill: url(#blocklyDisabledPattern"+ +this.randomIdentifier+")","}",a+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none","}"]};Blockly.zelos.TopRow=function(a){Blockly.zelos.TopRow.superClass_.constructor.call(this,a)};Blockly.utils.object.inherits(Blockly.zelos.TopRow,Blockly.blockRendering.TopRow);Blockly.zelos.TopRow.prototype.endsWithElemSpacer=function(){return!1};Blockly.zelos.TopRow.prototype.hasLeftSquareCorner=function(a){var b=(a.hat?"cap"===a.hat:this.constants_.ADD_START_HATS)&&!a.outputConnection&&!a.previousConnection;return!!a.outputConnection||b}; +Blockly.zelos.TopRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection};Blockly.zelos.BottomRow=function(a){Blockly.zelos.BottomRow.superClass_.constructor.call(this,a)};Blockly.utils.object.inherits(Blockly.zelos.BottomRow,Blockly.blockRendering.BottomRow);Blockly.zelos.BottomRow.prototype.endsWithElemSpacer=function(){return!1};Blockly.zelos.BottomRow.prototype.hasLeftSquareCorner=function(a){return!!a.outputConnection}; +Blockly.zelos.BottomRow.prototype.hasRightSquareCorner=function(a){return!!a.outputConnection&&!a.statementInputCount&&!a.nextConnection};Blockly.zelos.RightConnectionShape=function(a){Blockly.zelos.RightConnectionShape.superClass_.constructor.call(this,a);this.type|=Blockly.blockRendering.Types.getType("RIGHT_CONNECTION");this.width=this.height=0};Blockly.utils.object.inherits(Blockly.zelos.RightConnectionShape,Blockly.blockRendering.Measurable);Blockly.zelos.StatementInput=function(a,b){Blockly.zelos.StatementInput.superClass_.constructor.call(this,a,b);if(this.connectedBlock){for(a=this.connectedBlock;a.getNextBlock();)a=a.getNextBlock();a.nextConnection||(this.height=this.connectedBlockHeight,this.connectedBottomNextConnection=!0)}};Blockly.utils.object.inherits(Blockly.zelos.StatementInput,Blockly.blockRendering.StatementInput);Blockly.zelos.RenderInfo=function(a,b){Blockly.zelos.RenderInfo.superClass_.constructor.call(this,a,b);this.topRow=new Blockly.zelos.TopRow(this.constants_);this.bottomRow=new Blockly.zelos.BottomRow(this.constants_);this.isInline=!0;this.isMultiRow=!b.getInputsInline()||b.isCollapsed();this.hasStatementInput=0=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!f.precedesStatement;if(Blockly.blockRendering.Types.isInputRow(e)&&e.hasStatement)e.measure(),b=e.width-e.getLastInput().width+a;else if(d&&(2==c||f)&& Blockly.blockRendering.Types.isInputRow(e)&&!e.hasStatement){f=e.xPos;d=null;for(var g=0,h;h=e.elements[g];g++)Blockly.blockRendering.Types.isSpacer(h)&&(d=h),!(d&&(Blockly.blockRendering.Types.isField(h)||Blockly.blockRendering.Types.isInput(h))&&fc?c:this.height/2,b-c*(1-Math.sin(Math.acos((c-this.constants_.SMALL_PADDING)/c)));default:return 0}if(Blockly.blockRendering.Types.isInlineInput(a)){var e=a.connectedBlock;a=e?e.pathObject.outputShapeType: +a.shape.type;return e&&e.outputConnection&&(e.statementInputCount||e.nextConnection)||c==d.SHAPES.HEXAGONAL&&c!=a?0:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][a]}return Blockly.blockRendering.Types.isField(a)?c==d.SHAPES.ROUND&&a.field instanceof Blockly.FieldTextInput?b-2.75*d.GRID_UNIT:b-this.constants_.SHAPE_IN_SHAPE_PADDING[c][0]:Blockly.blockRendering.Types.isIcon(a)?this.constants_.SMALL_PADDING:0}; Blockly.zelos.RenderInfo.prototype.finalizeVerticalAlignment_=function(){if(!this.outputConnection)for(var a=2;a=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!d.precedesStatement;if(e?this.topRow.hasPreviousConnection:b.followsStatement){var g=3==c.elements.length&&(c.elements[1].field instanceof Blockly.FieldLabel||c.elements[1].field instanceof Blockly.FieldImage);if(!e&&g)b.height-=this.constants_.SMALL_PADDING, d.height-=this.constants_.SMALL_PADDING,c.height-=this.constants_.MEDIUM_PADDING;else if(!e&&!f)b.height+=this.constants_.SMALL_PADDING;else if(f){e=!1;for(f=0;g=c.elements[f];f++)if(Blockly.blockRendering.Types.isInlineInput(g)&&g.connectedBlock&&!g.connectedBlock.isShadow()&&40<=g.connectedBlock.getHeightWidth().height){e=!0;break}e&&(b.height-=this.constants_.SMALL_PADDING,d.height-=this.constants_.SMALL_PADDING)}}}}; -Blockly.zelos.RenderInfo.prototype.finalize_=function(){this.finalizeOutputConnection_();this.finalizeHorizontalAlignment_();this.finalizeVerticalAlignment_();Blockly.zelos.RenderInfo.superClass_.finalize_.call(this)};Blockly.zelos.Drawer=function(a,b){Blockly.zelos.Drawer.superClass_.constructor.call(this,a,b)};Blockly.utils.object.inherits(Blockly.zelos.Drawer,Blockly.blockRendering.Drawer); +Blockly.zelos.RenderInfo.prototype.finalize_=function(){this.finalizeOutputConnection_();this.finalizeHorizontalAlignment_();this.finalizeVerticalAlignment_();Blockly.zelos.RenderInfo.superClass_.finalize_.call(this);this.rightSide&&(this.widthWithChildren+=this.rightSide.width)};Blockly.zelos.Drawer=function(a,b){Blockly.zelos.Drawer.superClass_.constructor.call(this,a,b)};Blockly.utils.object.inherits(Blockly.zelos.Drawer,Blockly.blockRendering.Drawer); Blockly.zelos.Drawer.prototype.draw=function(){var a=this.block_.pathObject;a.beginDrawing();this.hideHiddenIcons_();this.drawOutline_();this.drawInternals_();a.setPath(this.outlinePath_+"\n"+this.inlinePath_);this.info_.RTL&&a.flipRTL();Blockly.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_);this.recordSizeOnBlock_();this.info_.outputConnection&&(a.outputShapeType=this.info_.outputConnection.shape.type);a.endDrawing()}; -Blockly.zelos.Drawer.prototype.drawOutline_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):Blockly.zelos.Drawer.superClass_.drawOutline_.call(this)}; +Blockly.zelos.Drawer.prototype.drawOutline_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape&&!this.info_.hasStatementInput&&!this.info_.bottomRow.hasNextConnection?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):Blockly.zelos.Drawer.superClass_.drawOutline_.call(this)}; +Blockly.zelos.Drawer.prototype.drawLeft_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():Blockly.zelos.Drawer.superClass_.drawLeft_.call(this)}; Blockly.zelos.Drawer.prototype.drawRightSideRow_=function(a){if(!(0>=a.height))if(a.precedesStatement||a.followsStatement){var b=this.constants_.INSIDE_CORNERS.rightHeight;b=a.height-(a.precedesStatement?b:0);this.outlinePath_+=(a.followsStatement?this.constants_.INSIDE_CORNERS.pathBottomRight:"")+(0d;d++){var f=1==d?b:c;f&&!f.outputConnection.checkType(e)&&(Blockly.Events.setGroup(a.group),e===this.prevParentConnection_?(this.unplug(),e.getSourceBlock().bumpNeighbours()):(f.unplug(),f.bumpNeighbours()),Blockly.Events.setGroup(!1))}this.prevParentConnection_= -e}};Blockly.Extensions.registerMixin("logic_ternary",Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN);Blockly.Blocks.loops={};Blockly.Constants.Loops={};Blockly.Constants.Loops.HUE=120; +Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN={prevParentConnection_:null,onchange:function(a){var b=this.getInputTargetBlock("THEN"),c=this.getInputTargetBlock("ELSE"),d=this.outputConnection.targetConnection;if((b||c)&&d)for(var e=0;2>e;e++){var f=1==e?b:c;f&&!f.outputConnection.checkType(d)&&(Blockly.Events.setGroup(a.group),d===this.prevParentConnection_?(this.unplug(),d.getSourceBlock().bumpNeighbours()):(f.unplug(),f.bumpNeighbours()),Blockly.Events.setGroup(!1))}this.prevParentConnection_= +d}};Blockly.Extensions.registerMixin("logic_ternary",Blockly.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN);Blockly.Blocks.loops={};Blockly.Constants.Loops={};Blockly.Constants.Loops.HUE=120; Blockly.defineBlocksWithJsonArray([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10, min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}], message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY", @@ -66,10 +66,10 @@ check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",arg args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}", extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]);Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};Blockly.Extensions.register("controls_whileUntil_tooltip",Blockly.Extensions.buildTooltipForDropdown("MODE",Blockly.Constants.Loops.WHILE_UNTIL_TOOLTIPS));Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"}; Blockly.Extensions.register("controls_flow_tooltip",Blockly.Extensions.buildTooltipForDropdown("FLOW",Blockly.Constants.Loops.BREAK_CONTINUE_TOOLTIPS)); -Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){var b=this.getField("VAR").getVariable(),c=b.name;if(!this.isCollapsed()&&null!=c){var e={enabled:!0};e.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c);b=Blockly.Variables.generateVariableFieldDom(b);c=Blockly.utils.xml.createElement("block");c.setAttribute("type","variables_get");c.appendChild(b);e.callback=Blockly.ContextMenu.callbackFactory(this,c);a.push(e)}}}}; +Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(a){if(!this.isInFlyout){var b=this.getField("VAR").getVariable(),c=b.name;if(!this.isCollapsed()&&null!=c){var d={enabled:!0};d.text=Blockly.Msg.VARIABLES_SET_CREATE_GET.replace("%1",c);b=Blockly.Variables.generateVariableFieldDom(b);c=Blockly.utils.xml.createElement("block");c.setAttribute("type","variables_get");c.appendChild(b);d.callback=Blockly.ContextMenu.callbackFactory(this,c);a.push(d)}}}}; Blockly.Extensions.registerMixin("contextMenu_newGetVariableBlock",Blockly.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN);Blockly.Extensions.register("controls_for_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR"));Blockly.Extensions.register("controls_forEach_tooltip",Blockly.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR")); -Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],suppressPrefixSuffix:!0,getSurroundLoop:function(a){do{if(-1!=Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.LOOP_TYPES.indexOf(a.type))return a;a=a.getSurroundParent()}while(a);return null},onchange:function(a){this.workspace.isDragging&&!this.workspace.isDragging()&&(Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(this)? -(this.setWarningText(null),this.isInFlyout||this.setEnabled(!0)):(this.setWarningText(Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING),this.isInFlyout||this.getInheritedDisabled()||this.setEnabled(!1)))}};Blockly.Extensions.registerMixin("controls_flow_in_loop_check",Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN);Blockly.Blocks.math={};Blockly.Constants.Math={};Blockly.Constants.Math.HUE=230; +Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],suppressPrefixSuffix:!0,getSurroundLoop:function(a){do{if(-1!=Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.LOOP_TYPES.indexOf(a.type))return a;a=a.getSurroundParent()}while(a);return null},onchange:function(a){if(this.workspace.isDragging&&!this.workspace.isDragging()&&a.type==Blockly.Events.BLOCK_MOVE&&a.blockId==this.id){var b= +Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(this);this.setWarningText(b?null:Blockly.Msg.CONTROLS_FLOW_STATEMENTS_WARNING);if(!this.isInFlyout){var c=Blockly.Events.getGroup();Blockly.Events.setGroup(a.group);this.setEnabled(b);Blockly.Events.setGroup(c)}}}};Blockly.Extensions.registerMixin("controls_flow_in_loop_check",Blockly.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN);Blockly.Blocks.math={};Blockly.Constants.Math={};Blockly.Constants.Math.HUE=230; Blockly.defineBlocksWithJsonArray([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}", "MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]}, {type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks", @@ -90,34 +90,34 @@ Blockly.Constants.Math.LIST_MODES_MUTATOR_MIXIN={updateType_:function(a){"MODE"= Blockly.Extensions.registerMutator("math_modes_of_list_mutator",Blockly.Constants.Math.LIST_MODES_MUTATOR_MIXIN,Blockly.Constants.Math.LIST_MODES_MUTATOR_EXTENSION);Blockly.Blocks.procedures={}; Blockly.Blocks.procedures_defnoreturn={init:function(){var a=new Blockly.FieldTextInput("",Blockly.Procedures.rename);a.setSpellcheck(!1);this.appendDummyInput().appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(a,"NAME").appendField("","PARAMS");this.setMutator(new Blockly.Mutator(["procedures_mutatorarg"]));(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(Blockly.Msg.PROCEDURES_DEFNORETURN_COMMENT); this.setStyle("procedure_blocks");this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL);this.arguments_=[];this.argumentVarModels_=[];this.setStatements_(!0);this.statementConnection_=null},setStatements_:function(a){this.hasStatements_!==a&&(a?(this.appendStatementInput("STACK").appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_= -a)},updateParams_:function(){var a="";this.arguments_.length&&(a=Blockly.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", "));Blockly.Events.disable();try{this.setFieldValue(a,"PARAMS")}finally{Blockly.Events.enable()}},mutationToDom:function(a){var b=Blockly.utils.xml.createElement("mutation");a&&b.setAttribute("name",this.getFieldValue("NAME"));for(var c=0;c} lookupTable The table of field values to * tooltip text. - * @return {Function} The extension function. + * @return {!Function} The extension function. */ Blockly.Extensions.buildTooltipForDropdown = function(dropdownName, lookupTable) { @@ -412,7 +401,7 @@ Blockly.Extensions.checkDropdownOptionsInTable_ = function(block, dropdownName, * @param {string} msgTemplate The template form to of the message text, with * %1 placeholder. * @param {string} fieldName The field with the replacement text. - * @return {Function} The extension function. + * @return {!Function} The extension function. */ Blockly.Extensions.buildTooltipWithFieldText = function(msgTemplate, fieldName) { diff --git a/core/field.js b/core/field.js index 09507898d..2c6328fc8 100644 --- a/core/field.js +++ b/core/field.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -205,7 +194,7 @@ Blockly.Field.prototype.getText_; * clicked. Blockly will automatically set the field as clickable if this * method is defined. * @param {Event=} opt_e Optional mouse event that triggered the field to open, - * or undefined if triggered programatically. + * or undefined if triggered programmatically. * @return {void} * @protected */ @@ -260,9 +249,19 @@ Blockly.Field.prototype.setSourceBlock = function(block) { throw Error('Field already bound to a block.'); } this.sourceBlock_ = block; - if (block.workspace.rendered) { - this.constants_ = block.workspace.getRenderer().getConstants(); +}; + +/** + * Get the renderer constant provider. + * @return {?Blockly.blockRendering.ConstantProvider} The renderer constant + * provider. + */ +Blockly.Field.prototype.getConstants = function() { + if (!this.constants_ && this.sourceBlock_ && this.sourceBlock_.workspace && + this.sourceBlock_.workspace.rendered) { + this.constants_ = this.sourceBlock_.workspace.getRenderer().getConstants(); } + return this.constants_; }; /** @@ -321,15 +320,11 @@ Blockly.Field.prototype.initModel = function() { * @protected */ Blockly.Field.prototype.createBorderRect_ = function() { - this.size_.height = - Math.max(this.size_.height, this.constants_.FIELD_BORDER_RECT_HEIGHT); - this.size_.width = - Math.max(this.size_.width, this.constants_.FIELD_BORDER_RECT_X_PADDING * 2); this.borderRect_ = /** @type {!SVGRectElement} **/ (Blockly.utils.dom.createSvgElement('rect', { - 'rx': this.constants_.FIELD_BORDER_RECT_RADIUS, - 'ry': this.constants_.FIELD_BORDER_RECT_RADIUS, + 'rx': this.getConstants().FIELD_BORDER_RECT_RADIUS, + 'ry': this.getConstants().FIELD_BORDER_RECT_RADIUS, 'x': 0, 'y': 0, 'height': this.size_.height, @@ -345,24 +340,12 @@ Blockly.Field.prototype.createBorderRect_ = function() { * @protected */ Blockly.Field.prototype.createTextElement_ = function() { - var xOffset = this.borderRect_ ? - this.constants_.FIELD_BORDER_RECT_X_PADDING : 0; - var baselineCenter = this.constants_.FIELD_TEXT_BASELINE_CENTER; - var baselineY = this.constants_.FIELD_TEXT_BASELINE_Y; - this.size_.height = Math.max(this.size_.height, baselineCenter ? - this.constants_.FIELD_TEXT_HEIGHT : baselineY); - if (this.size_.height > this.constants_.FIELD_TEXT_HEIGHT) { - baselineY += (this.size_.height - baselineY) / 2; - } this.textElement_ = /** @type {!SVGTextElement} **/ (Blockly.utils.dom.createSvgElement('text', { 'class': 'blocklyText', - 'y': baselineCenter ? this.size_.height / 2 : baselineY, - 'dy': this.constants_.FIELD_TEXT_Y_OFFSET, - 'x': xOffset }, this.fieldGroup_)); - if (baselineCenter) { + if (this.getConstants().FIELD_TEXT_BASELINE_CENTER) { this.textElement_.setAttribute('dominant-baseline', 'central'); } this.textContent_ = document.createTextNode(''); @@ -411,6 +394,7 @@ Blockly.Field.prototype.toXml = function(fieldElement) { Blockly.Field.prototype.dispose = function() { Blockly.DropDownDiv.hideIfOwner(this); Blockly.WidgetDiv.hideIfOwner(this); + Blockly.Tooltip.unbindMouseEvents(this.getClickTarget_()); if (this.mouseDownWrapper_) { Blockly.unbindEvent_(this.mouseDownWrapper_); @@ -598,14 +582,14 @@ Blockly.Field.prototype.applyColour = function() { Blockly.Field.prototype.render_ = function() { if (this.textContent_) { this.textContent_.nodeValue = this.getDisplayText_(); - this.updateSize_(); } + this.updateSize_(); }; /** * Show an editor when the field is clicked only if the field is clickable. * @param {Event=} opt_e Optional mouse event that triggered the field to open, - * or undefined if triggered programatically. + * or undefined if triggered programmatically. * @package */ Blockly.Field.prototype.showEditor = function(opt_e) { @@ -630,22 +614,73 @@ Blockly.Field.prototype.updateWidth = function() { /** * Updates the size of the field based on the text. + * @param {number=} opt_margin margin to use when positioning the text element. * @protected */ -Blockly.Field.prototype.updateSize_ = function() { - var textWidth = Blockly.utils.dom.getFastTextWidth( - /** @type {!SVGTextElement} */ (this.textElement_), - this.constants_.FIELD_TEXT_FONTSIZE, - this.constants_.FIELD_TEXT_FONTWEIGHT, - this.constants_.FIELD_TEXT_FONTFAMILY); - var totalWidth = textWidth; - if (this.borderRect_) { - totalWidth += this.constants_.FIELD_BORDER_RECT_X_PADDING * 2; - this.borderRect_.setAttribute('width', totalWidth); +Blockly.Field.prototype.updateSize_ = function(opt_margin) { + var constants = this.getConstants(); + var xOffset = opt_margin != undefined ? opt_margin : + (this.borderRect_ ? this.getConstants().FIELD_BORDER_RECT_X_PADDING : 0); + var totalWidth = xOffset * 2; + var totalHeight = constants.FIELD_TEXT_HEIGHT; + + var contentWidth = 0; + if (this.textElement_) { + contentWidth = Blockly.utils.dom.getFastTextWidth(this.textElement_, + constants.FIELD_TEXT_FONTSIZE, + constants.FIELD_TEXT_FONTWEIGHT, + constants.FIELD_TEXT_FONTFAMILY); + totalWidth += contentWidth; } + if (this.borderRect_) { + totalHeight = Math.max(totalHeight, constants.FIELD_BORDER_RECT_HEIGHT); + } + + this.size_.height = totalHeight; this.size_.width = totalWidth; + + this.positionTextElement_(xOffset, contentWidth); + this.positionBorderRect_(); }; +/** + * Position a field's text element after a size change. This handles both LTR + * and RTL positioning. + * @param {number} xOffset x offset to use when positioning the text element. + * @param {number} contentWidth The content width. + * @protected + */ +Blockly.Field.prototype.positionTextElement_ = function(xOffset, contentWidth) { + if (!this.textElement_) { + return; + } + var constants = this.getConstants(); + var halfHeight = this.size_.height / 2; + + this.textElement_.setAttribute('x', this.sourceBlock_.RTL ? + this.size_.width - contentWidth - xOffset : xOffset); + this.textElement_.setAttribute('y', constants.FIELD_TEXT_BASELINE_CENTER ? + halfHeight : halfHeight - constants.FIELD_TEXT_HEIGHT / 2 + + constants.FIELD_TEXT_BASELINE); +}; + +/** + * Position a field's border rect after a size change. + * @protected + */ +Blockly.Field.prototype.positionBorderRect_ = function() { + if (!this.borderRect_) { + return; + } + this.borderRect_.setAttribute('width', this.size_.width); + this.borderRect_.setAttribute('height', this.size_.height); + this.borderRect_.setAttribute('rx', + this.getConstants().FIELD_BORDER_RECT_RADIUS); + this.borderRect_.setAttribute('ry', + this.getConstants().FIELD_BORDER_RECT_RADIUS); +}; + + /** * Returns the height and width of the field. * @@ -772,6 +807,7 @@ Blockly.Field.prototype.setText = function(_newText) { */ Blockly.Field.prototype.markDirty = function() { this.isDirty_ = true; + this.constants_ = null; }; /** @@ -786,6 +822,7 @@ Blockly.Field.prototype.forceRerender = function() { if (this.sourceBlock_ && this.sourceBlock_.rendered) { this.sourceBlock_.render(); this.sourceBlock_.bumpNeighbours(); + this.updateMarkers_(); } }; @@ -898,7 +935,7 @@ Blockly.Field.prototype.doValueUpdate_ = function(newValue) { }; /** - * Used to notify the field an invalid value was input. Can be overidden by + * Used to notify the field an invalid value was input. Can be overridden by * subclasses, see FieldTextInput. * No-op by default. * @param {*} _invalidValue The input value that was determined to be invalid. @@ -1058,3 +1095,17 @@ Blockly.Field.prototype.setMarkerSvg = function(markerSvg) { this.fieldGroup_.appendChild(markerSvg); this.markerSvg_ = markerSvg; }; + +/** + * Redraw any attached marker or cursor svgs if needed. + * @protected + */ +Blockly.Field.prototype.updateMarkers_ = function() { + var workspace = this.sourceBlock_.workspace; + if (workspace.keyboardAccessibilityMode && this.cursorSvg_) { + workspace.getCursor().draw(); + } + if (workspace.keyboardAccessibilityMode && this.markerSvg_) { + workspace.getMarker(Blockly.navigation.MARKER_NAME).draw(); + } +}; diff --git a/core/field_angle.js b/core/field_angle.js index 131adce28..4dbe1b19c 100644 --- a/core/field_angle.js +++ b/core/field_angle.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2013 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -257,7 +246,7 @@ Blockly.FieldAngle.prototype.render_ = function() { /** * Create and show the angle field's editor. * @param {Event=} opt_e Optional mouse event that triggered the field to open, - * or undefined if triggered programatically. + * or undefined if triggered programmatically. * @private */ Blockly.FieldAngle.prototype.showEditor_ = function(opt_e) { diff --git a/core/field_checkbox.js b/core/field_checkbox.js index ea417927f..e4818ebe8 100644 --- a/core/field_checkbox.js +++ b/core/field_checkbox.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -93,15 +82,6 @@ Blockly.FieldCheckbox.prototype.SERIALIZABLE = true; */ Blockly.FieldCheckbox.prototype.CURSOR = 'default'; -/** - * Used to tell if the field needs to be rendered the next time the block is - * rendered. Checkbox fields are statically sized, and only need to be - * rendered at initialization. - * @type {boolean} - * @protected - */ -Blockly.FieldCheckbox.prototype.isDirty_ = false; - /** * Configure the field based on the given map of options. * @param {!Object} config A map of options to configure the field based on. @@ -119,19 +99,30 @@ Blockly.FieldCheckbox.prototype.configure_ = function(config) { * @package */ Blockly.FieldCheckbox.prototype.initView = function() { - this.size_.width = this.constants_.FIELD_CHECKBOX_DEFAULT_WIDTH; Blockly.FieldCheckbox.superClass_.initView.call(this); - this.textElement_.setAttribute('x', this.constants_.FIELD_CHECKBOX_X_OFFSET); - this.textElement_.setAttribute('y', this.constants_.FIELD_CHECKBOX_Y_OFFSET); - this.textElement_.removeAttribute('dominant-baseline'); - Blockly.utils.dom.addClass(this.textElement_, 'blocklyCheckbox'); - - this.textContent_.nodeValue = - this.checkChar_ || Blockly.FieldCheckbox.CHECK_CHAR; + Blockly.utils.dom.addClass( + /** @type {!SVGTextElement} **/ (this.textElement_), 'blocklyCheckbox'); this.textElement_.style.display = this.value_ ? 'block' : 'none'; }; +/** + * @override + */ +Blockly.FieldCheckbox.prototype.render_ = function() { + if (this.textContent_) { + this.textContent_.nodeValue = this.getDisplayText_(); + } + this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET); +}; + +/** + * @override + */ +Blockly.FieldCheckbox.prototype.getDisplayText_ = function() { + return this.checkChar_ || Blockly.FieldCheckbox.CHECK_CHAR; +}; + /** * Set the character used for the check mark. * @param {?string} character The character to use for the check mark, or @@ -139,9 +130,7 @@ Blockly.FieldCheckbox.prototype.initView = function() { */ Blockly.FieldCheckbox.prototype.setCheckCharacter = function(character) { this.checkChar_ = character; - if (this.textContent_) { - this.textContent_.nodeValue = character || Blockly.FieldCheckbox.CHECK_CHAR; - } + this.forceRerender(); }; /** diff --git a/core/field_colour.js b/core/field_colour.js index 1909f874c..6cf82d089 100644 --- a/core/field_colour.js +++ b/core/field_colour.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -184,9 +173,9 @@ Blockly.FieldColour.prototype.configure_ = function(config) { */ Blockly.FieldColour.prototype.initView = function() { this.size_ = new Blockly.utils.Size( - this.constants_.FIELD_COLOUR_DEFAULT_WIDTH, - this.constants_.FIELD_COLOUR_DEFAULT_HEIGHT); - if (!this.constants_.FIELD_COLOUR_FULL_BLOCK) { + this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH, + this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT); + if (!this.getConstants().FIELD_COLOUR_FULL_BLOCK) { this.createBorderRect_(); this.borderRect_.style['fillOpacity'] = '1'; } else { @@ -198,7 +187,7 @@ Blockly.FieldColour.prototype.initView = function() { * @override */ Blockly.FieldColour.prototype.applyColour = function() { - if (!this.constants_.FIELD_COLOUR_FULL_BLOCK) { + if (!this.getConstants().FIELD_COLOUR_FULL_BLOCK) { if (this.borderRect_) { this.borderRect_.style.fill = this.getValue(); } diff --git a/core/field_date.js b/core/field_date.js index a39ca849e..aaed6bfa4 100644 --- a/core/field_date.js +++ b/core/field_date.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/field_dropdown.js b/core/field_dropdown.js index 4a42c3429..87062c5a4 100644 --- a/core/field_dropdown.js +++ b/core/field_dropdown.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -212,7 +201,7 @@ Blockly.FieldDropdown.prototype.initView = function() { this.imageElement_ = /** @type {!SVGImageElement} */ (Blockly.utils.dom.createSvgElement('image', {}, this.fieldGroup_)); - if (this.constants_.FIELD_DROPDOWN_SVG_ARROW) { + if (this.getConstants().FIELD_DROPDOWN_SVG_ARROW) { this.createSVGArrow_(); } else { this.createTextArrow_(); @@ -229,8 +218,8 @@ Blockly.FieldDropdown.prototype.initView = function() { * @protected */ Blockly.FieldDropdown.prototype.shouldAddBorderRect_ = function() { - return !this.constants_.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW || - (this.constants_.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW && + return !this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW || + (this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW && !this.sourceBlock_.isShadow()); }; @@ -258,17 +247,17 @@ Blockly.FieldDropdown.prototype.createTextArrow_ = function() { */ Blockly.FieldDropdown.prototype.createSVGArrow_ = function() { this.svgArrow_ = Blockly.utils.dom.createSvgElement('image', { - 'height': this.constants_.FIELD_DROPDOWN_SVG_ARROW_SIZE + 'px', - 'width': this.constants_.FIELD_DROPDOWN_SVG_ARROW_SIZE + 'px' + 'height': this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE + 'px', + 'width': this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE + 'px' }, this.fieldGroup_); this.svgArrow_.setAttributeNS(Blockly.utils.dom.XLINK_NS, 'xlink:href', - this.constants_.FIELD_DROPDOWN_SVG_ARROW_DATAURI); + this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI); }; /** * Create a dropdown menu under the text. * @param {Event=} opt_e Optional mouse event that triggered the field to open, - * or undefined if triggered programatically. + * or undefined if triggered programmatically. * @private */ Blockly.FieldDropdown.prototype.showEditor_ = function(opt_e) { @@ -284,7 +273,7 @@ Blockly.FieldDropdown.prototype.showEditor_ = function(opt_e) { Blockly.utils.dom.addClass( /** @type {!Element} */ (this.menu_.getElement()), 'blocklyDropdownMenu'); - if (this.constants_.FIELD_DROPDOWN_COLOURED_DIV) { + if (this.getConstants().FIELD_DROPDOWN_COLOURED_DIV) { var primaryColour = (this.sourceBlock_.isShadow()) ? this.sourceBlock_.getParent().getColour() : this.sourceBlock_.getColour(); @@ -575,10 +564,8 @@ Blockly.FieldDropdown.prototype.render_ = function() { } else { this.renderSelectedText_(); } - if (this.borderRect_) { - this.borderRect_.setAttribute('height', this.size_.height); - this.borderRect_.setAttribute('width', this.size_.width); - } + + this.positionBorderRect_(); }; /** @@ -599,36 +586,36 @@ Blockly.FieldDropdown.prototype.renderSelectedImage_ = function(imageJson) { // Height and width include the border rect. var hasBorder = !!this.borderRect_; - this.size_.height = Math.max( - hasBorder ? this.constants_.FIELD_DROPDOWN_BORDER_RECT_HEIGHT : 0, + var height = Math.max( + hasBorder ? this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT : 0, imageHeight + Blockly.FieldDropdown.IMAGE_Y_PADDING); - var halfHeight = this.size_.height / 2; - var xPadding = hasBorder ? this.constants_.FIELD_BORDER_RECT_X_PADDING : 0; + var xPadding = hasBorder ? this.getConstants().FIELD_BORDER_RECT_X_PADDING : 0; var arrowWidth = 0; if (this.svgArrow_) { - arrowWidth = this.positionSVGArrow_(imageWidth + xPadding, halfHeight - - this.constants_.FIELD_DROPDOWN_SVG_ARROW_SIZE / 2); + arrowWidth = this.positionSVGArrow_(imageWidth + xPadding, height / 2 - + this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE / 2); } else { arrowWidth = Blockly.utils.dom.getFastTextWidth( /** @type {!SVGTSpanElement} */ (this.arrow_), - this.constants_.FIELD_TEXT_FONTSIZE, - this.constants_.FIELD_TEXT_FONTWEIGHT, - this.constants_.FIELD_TEXT_FONTFAMILY); + this.getConstants().FIELD_TEXT_FONTSIZE, + this.getConstants().FIELD_TEXT_FONTWEIGHT, + this.getConstants().FIELD_TEXT_FONTFAMILY); } this.size_.width = imageWidth + arrowWidth + xPadding * 2; + this.size_.height = height; + var arrowX = 0; if (this.sourceBlock_.RTL) { var imageX = xPadding + arrowWidth; - var arrowX = xPadding - 1; this.imageElement_.setAttribute('x', imageX); - this.textElement_.setAttribute('x', arrowX); } else { - var arrowX = imageWidth + arrowWidth + xPadding + 1; + arrowX = imageWidth + arrowWidth; this.textElement_.setAttribute('text-anchor', 'end'); - this.textElement_.setAttribute('x', arrowX); this.imageElement_.setAttribute('x', xPadding); } - this.imageElement_.setAttribute('y', halfHeight - imageHeight / 2); + this.imageElement_.setAttribute('y', height / 2 - imageHeight / 2); + + this.positionTextElement_(arrowX + xPadding, imageWidth + arrowWidth); }; /** @@ -644,31 +631,23 @@ Blockly.FieldDropdown.prototype.renderSelectedText_ = function() { // Height and width include the border rect. var hasBorder = !!this.borderRect_; - this.size_.height = Math.max( - hasBorder ? this.constants_.FIELD_DROPDOWN_BORDER_RECT_HEIGHT : 0, - this.constants_.FIELD_TEXT_HEIGHT); - var halfHeight = this.size_.height / 2; + var height = Math.max( + hasBorder ? this.getConstants().FIELD_DROPDOWN_BORDER_RECT_HEIGHT : 0, + this.getConstants().FIELD_TEXT_HEIGHT); var textWidth = Blockly.utils.dom.getFastTextWidth(this.textElement_, - this.constants_.FIELD_TEXT_FONTSIZE, - this.constants_.FIELD_TEXT_FONTWEIGHT, - this.constants_.FIELD_TEXT_FONTFAMILY); - var xPadding = hasBorder ? this.constants_.FIELD_BORDER_RECT_X_PADDING : 0; + this.getConstants().FIELD_TEXT_FONTSIZE, + this.getConstants().FIELD_TEXT_FONTWEIGHT, + this.getConstants().FIELD_TEXT_FONTFAMILY); + var xPadding = hasBorder ? this.getConstants().FIELD_BORDER_RECT_X_PADDING : 0; var arrowWidth = 0; if (this.svgArrow_) { - arrowWidth = this.positionSVGArrow_(textWidth + xPadding, halfHeight - - this.constants_.FIELD_DROPDOWN_SVG_ARROW_SIZE / 2); + arrowWidth = this.positionSVGArrow_(textWidth + xPadding, height / 2 - + this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE / 2); } this.size_.width = textWidth + arrowWidth + xPadding * 2; + this.size_.height = height; - this.textElement_.setAttribute('x', this.sourceBlock_.RTL ? - this.size_.width - textWidth - xPadding : xPadding); - this.textElement_.setAttribute('y', halfHeight); - if (!this.constants_.FIELD_TEXT_BASELINE_CENTER) { - this.textElement_.setAttribute('dy', - this.constants_.FIELD_TEXT_BASELINE_Y - - this.constants_.FIELD_TEXT_HEIGHT / 2 + - this.constants_.FIELD_TEXT_Y_OFFSET); - } + this.positionTextElement_(xPadding, textWidth); }; /** @@ -683,9 +662,9 @@ Blockly.FieldDropdown.prototype.positionSVGArrow_ = function(x, y) { return 0; } var hasBorder = !!this.borderRect_; - var xPadding = hasBorder ? this.constants_.FIELD_BORDER_RECT_X_PADDING : 0; - var textPadding = this.constants_.FIELD_DROPDOWN_SVG_ARROW_PADDING; - var svgArrowSize = this.constants_.FIELD_DROPDOWN_SVG_ARROW_SIZE; + var xPadding = hasBorder ? this.getConstants().FIELD_BORDER_RECT_X_PADDING : 0; + var textPadding = this.getConstants().FIELD_DROPDOWN_SVG_ARROW_PADDING; + var svgArrowSize = this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE; var arrowX = this.sourceBlock_.RTL ? xPadding : x + textPadding; this.svgArrow_.setAttribute('transform', 'translate(' + arrowX + ',' + y + ')'); diff --git a/core/field_image.js b/core/field_image.js index f60c40a92..32af8adca 100644 --- a/core/field_image.js +++ b/core/field_image.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -191,6 +180,17 @@ Blockly.FieldImage.prototype.initView = function() { this.fieldGroup_)); this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS, 'xlink:href', /** @type {string} */ (this.value_)); + + if (this.clickHandler_) { + this.imageElement_.style.cursor = 'pointer'; + } +}; + +/** + * @override + */ +Blockly.FieldImage.prototype.updateSize_ = function() { + // NOP }; /** diff --git a/core/field_label.js b/core/field_label.js index 510a457d7..666e2ec78 100644 --- a/core/field_label.js +++ b/core/field_label.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/field_label_serializable.js b/core/field_label_serializable.js index 38eff9179..eeaac9ffa 100644 --- a/core/field_label_serializable.js +++ b/core/field_label_serializable.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/field_multilineinput.js b/core/field_multilineinput.js index df4293e5b..734f4135a 100644 --- a/core/field_multilineinput.js +++ b/core/field_multilineinput.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -71,13 +60,6 @@ Blockly.utils.object.inherits(Blockly.FieldMultilineInput, Blockly.FieldTextInput); -/** - * The default height of a single line of text. - * @type {number} - * @const - */ -Blockly.FieldMultilineInput.LINE_HEIGHT = 20; - /** * Construct a FieldMultilineInput from a JSON arg object, * dereferencing any string table references. @@ -154,14 +136,16 @@ Blockly.FieldMultilineInput.prototype.render_ = function() { var lines = this.getDisplayText_().split('\n'); var y = 0; for (var i = 0; i < lines.length; i++) { + var lineHeight = this.getConstants().FIELD_TEXT_HEIGHT + + this.getConstants().FIELD_BORDER_RECT_Y_PADDING; var span = Blockly.utils.dom.createSvgElement('text', { 'class': 'blocklyText blocklyMultilineText', - x: this.constants_.FIELD_BORDER_RECT_X_PADDING, - y: y + this.constants_.FIELD_BORDER_RECT_Y_PADDING, - dy: Blockly.FieldMultilineInput.LINE_HEIGHT / 2 + x: this.getConstants().FIELD_BORDER_RECT_X_PADDING, + y: y + this.getConstants().FIELD_BORDER_RECT_Y_PADDING, + dy: this.getConstants().FIELD_TEXT_BASELINE }, this.textGroup_); span.appendChild(document.createTextNode(lines[i])); - y += Blockly.FieldMultilineInput.LINE_HEIGHT; + y += lineHeight; } this.updateSize_(); @@ -202,34 +186,19 @@ Blockly.FieldMultilineInput.prototype.updateSize_ = function() { if (textWidth > totalWidth) { totalWidth = textWidth; } - totalHeight += Blockly.FieldMultilineInput.LINE_HEIGHT; + totalHeight += this.getConstants().FIELD_TEXT_HEIGHT + + (i > 0 ? this.getConstants().FIELD_BORDER_RECT_Y_PADDING : 0); } if (this.borderRect_) { - totalWidth += this.constants_.FIELD_BORDER_RECT_X_PADDING * 2; + totalHeight += this.getConstants().FIELD_BORDER_RECT_Y_PADDING * 2; + totalWidth += this.getConstants().FIELD_BORDER_RECT_X_PADDING * 2; this.borderRect_.setAttribute('width', totalWidth); this.borderRect_.setAttribute('height', totalHeight); } this.size_.width = totalWidth; this.size_.height = totalHeight; -}; -/** - * Resize the editor to fit the text. - * @protected - */ -Blockly.FieldMultilineInput.prototype.resizeEditor_ = function() { - var div = Blockly.WidgetDiv.DIV; - var bBox = this.getScaledBBox(); - div.style.width = bBox.right - bBox.left + 'px'; - div.style.height = bBox.bottom - bBox.top + 'px'; - - // In RTL mode block fields and LTR input fields the left edge moves, - // whereas the right edge is fixed. Reposition the editor. - var x = this.sourceBlock_.RTL ? bBox.right - div.offsetWidth : bBox.left; - var xy = new Blockly.utils.Coordinate(x, bBox.top); - - div.style.left = xy.x + 'px'; - div.style.top = xy.y + 'px'; + this.positionBorderRect_(); }; /** @@ -239,21 +208,24 @@ Blockly.FieldMultilineInput.prototype.resizeEditor_ = function() { */ Blockly.FieldMultilineInput.prototype.widgetCreate_ = function() { var div = Blockly.WidgetDiv.DIV; - var scale = this.workspace_.scale; + var scale = this.workspace_.getScale(); - var htmlInput = /** @type {HTMLTextAreaElement} */ (document.createElement('textarea')); + var htmlInput = + /** @type {HTMLTextAreaElement} */ (document.createElement('textarea')); htmlInput.className = 'blocklyHtmlInput blocklyHtmlTextAreaInput'; htmlInput.setAttribute('spellcheck', this.spellcheck_); - var fontSize = (this.constants_.FIELD_TEXT_FONTSIZE * scale) + 'pt'; + var fontSize = (this.getConstants().FIELD_TEXT_FONTSIZE * scale) + 'pt'; div.style.fontSize = fontSize; htmlInput.style.fontSize = fontSize; var borderRadius = (Blockly.FieldTextInput.BORDERRADIUS * scale) + 'px'; htmlInput.style.borderRadius = borderRadius; - var padding = this.constants_.FIELD_BORDER_RECT_X_PADDING * scale; - htmlInput.style.paddingLeft = padding + 'px'; - htmlInput.style.width = 'calc(100% - ' + padding + 'px)'; - htmlInput.style.lineHeight = - (Blockly.FieldMultilineInput.LINE_HEIGHT * scale) + 'px'; + var paddingX = this.getConstants().FIELD_BORDER_RECT_X_PADDING * scale; + var paddingY = this.getConstants().FIELD_BORDER_RECT_Y_PADDING * scale / 2; + htmlInput.style.padding = paddingY + 'px ' + paddingX + 'px ' + paddingY + + 'px ' + paddingX + 'px'; + var lineHeight = this.getConstants().FIELD_TEXT_HEIGHT + + this.getConstants().FIELD_BORDER_RECT_Y_PADDING; + htmlInput.style.lineHeight = (lineHeight * scale) + 'px'; div.appendChild(htmlInput); diff --git a/core/field_number.js b/core/field_number.js index 9cdd99439..8e49a2abe 100644 --- a/core/field_number.js +++ b/core/field_number.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/field_registry.js b/core/field_registry.js index 4f0814fcd..5e6b7bde0 100644 --- a/core/field_registry.js +++ b/core/field_registry.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/field_textinput.js b/core/field_textinput.js index 69b20bc54..2343a2232 100644 --- a/core/field_textinput.js +++ b/core/field_textinput.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -139,7 +128,7 @@ Blockly.FieldTextInput.prototype.configure_ = function(config) { * @override */ Blockly.FieldTextInput.prototype.initView = function() { - if (this.constants_.FULL_BLOCK_FIELDS) { + if (this.getConstants().FULL_BLOCK_FIELDS) { // Step one: figure out if this is the only field on this block. // Rendering is quite different in that case. var nFields = 0; @@ -227,13 +216,13 @@ Blockly.FieldTextInput.prototype.doValueUpdate_ = function(newValue) { * @package */ Blockly.FieldTextInput.prototype.applyColour = function() { - if (this.sourceBlock_ && this.constants_.FULL_BLOCK_FIELDS) { + if (this.sourceBlock_ && this.getConstants().FULL_BLOCK_FIELDS) { if (this.borderRect_) { this.borderRect_.setAttribute('stroke', this.sourceBlock_.style.colourTertiary); } else { this.sourceBlock_.pathObject.svgPath.setAttribute('fill', - this.constants_.FIELD_BORDER_RECT_COLOUR); + this.getConstants().FIELD_BORDER_RECT_COLOUR); } } }; @@ -279,7 +268,7 @@ Blockly.FieldTextInput.prototype.setSpellcheck = function(check) { /** * Show the inline free-text editor on top of the text. * @param {Event=} _opt_e Optional mouse event that triggered the field to open, - * or undefined if triggered programatically. + * or undefined if triggered programmatically. * @param {boolean=} opt_quietInput True if editor should be created without * focus. Defaults to false. * @protected @@ -341,9 +330,9 @@ Blockly.FieldTextInput.prototype.widgetCreate_ = function() { var htmlInput = /** @type {HTMLInputElement} */ (document.createElement('input')); htmlInput.className = 'blocklyHtmlInput'; htmlInput.setAttribute('spellcheck', this.spellcheck_); - var scale = this.workspace_.scale; + var scale = this.workspace_.getScale(); var fontSize = - (this.constants_.FIELD_TEXT_FONTSIZE * scale) + 'pt'; + (this.getConstants().FIELD_TEXT_FONTSIZE * scale) + 'pt'; div.style.fontSize = fontSize; htmlInput.style.fontSize = fontSize; var borderRadius = @@ -361,7 +350,7 @@ Blockly.FieldTextInput.prototype.widgetCreate_ = function() { htmlInput.style.border = (1 * scale) + 'px solid ' + strokeColour; div.style.borderRadius = borderRadius; div.style.transition = 'box-shadow 0.25s ease 0s'; - if (this.constants_.FIELD_TEXTINPUT_BOX_SHADOW) { + if (this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW) { div.style.boxShadow = 'rgba(255, 255, 255, 0.3) 0px 0px 0px ' + 4 * scale + 'px'; } diff --git a/core/field_variable.js b/core/field_variable.js index 8d486d197..7d7801384 100644 --- a/core/field_variable.js +++ b/core/field_variable.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -156,7 +145,7 @@ Blockly.FieldVariable.prototype.initModel = function() { */ Blockly.FieldVariable.prototype.shouldAddBorderRect_ = function() { return Blockly.FieldVariable.superClass_.shouldAddBorderRect_.call(this) && - (!this.constants_.FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW || + (!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW || this.sourceBlock_.type != 'variables_get'); }; diff --git a/core/flyout_base.js b/core/flyout_base.js index 471c4d558..5d0628700 100644 --- a/core/flyout_base.js +++ b/core/flyout_base.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2011 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -57,6 +46,8 @@ Blockly.Flyout = function(workspaceOptions) { */ this.workspace_ = new Blockly.WorkspaceSvg(workspaceOptions); this.workspace_.isFlyout = true; + // Keep the workspace visibility consistent with the flyout's visibility. + this.workspace_.setVisible(this.isVisible_); /** * Is RTL vs LTR. @@ -557,6 +548,7 @@ Blockly.Flyout.prototype.clearOldBlocks_ = function() { for (var j = 0; j < this.mats_.length; j++) { var rect = this.mats_[j]; if (rect) { + Blockly.Tooltip.unbindMouseEvents(rect); Blockly.utils.dom.removeNode(rect); } } @@ -638,8 +630,8 @@ Blockly.Flyout.prototype.isBlockCreatable_ = function(block) { /** * Create a copy of this block on the workspace. * @param {!Blockly.BlockSvg} originalBlock The block to copy from the flyout. - * @return {Blockly.BlockSvg} The newly created block, or null if something - * went wrong with deserialization. + * @return {!Blockly.BlockSvg} The newly created block. + * @throws {Error} if something went wrong with deserialization. * @package */ Blockly.Flyout.prototype.createBlock = function(originalBlock) { diff --git a/core/flyout_button.js b/core/flyout_button.js index f400f0fb6..f4cead8af 100644 --- a/core/flyout_button.js +++ b/core/flyout_button.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -97,9 +86,14 @@ Blockly.FlyoutButton = function(workspace, targetWorkspace, xml, isLabel) { }; /** - * The margin around the text in the button. + * The horizontal margin around the text in the button. */ -Blockly.FlyoutButton.MARGIN = 5; +Blockly.FlyoutButton.MARGIN_X = 5; + +/** + * The vertical margin around the text in the button. + */ +Blockly.FlyoutButton.MARGIN_Y = 2; /** * The width of the button's rect. @@ -164,11 +158,18 @@ Blockly.FlyoutButton.prototype.createDom = function() { 'flyoutForegroundColour', 'fill'); } - this.width = Blockly.utils.dom.getTextWidth(svgText); - this.height = 20; // Can't compute it :( - + var fontSize = Blockly.utils.style.getComputedStyle(svgText, 'fontSize'); + var fontWeight = Blockly.utils.style.getComputedStyle(svgText, 'fontWeight'); + var fontFamily = Blockly.utils.style.getComputedStyle(svgText, 'fontFamily'); + this.width = Blockly.utils.dom.getFastTextWidthWithSizeString(svgText, + fontSize, fontWeight, fontFamily); + var fontMetrics = Blockly.utils.dom.measureFontMetrics(text, fontSize, + fontWeight, fontFamily); + this.height = fontMetrics.height; + if (!this.isLabel_) { - this.width += 2 * Blockly.FlyoutButton.MARGIN; + this.width += 2 * Blockly.FlyoutButton.MARGIN_X; + this.height += 2 * Blockly.FlyoutButton.MARGIN_Y; shadow.setAttribute('width', this.width); shadow.setAttribute('height', this.height); } @@ -176,7 +177,8 @@ Blockly.FlyoutButton.prototype.createDom = function() { rect.setAttribute('height', this.height); svgText.setAttribute('x', this.width / 2); - svgText.setAttribute('y', this.height - Blockly.FlyoutButton.MARGIN); + svgText.setAttribute('y', this.height / 2 - fontMetrics.height / 2 + + fontMetrics.baseline); this.updateTransform_(); @@ -292,9 +294,5 @@ Blockly.Css.register([ '.blocklyFlyoutLabelBackground {', 'opacity: 0;', '}', - - '.blocklyFlyoutLabelText {', - 'fill: #000;', - '}' /* eslint-enable indent */ ]); diff --git a/core/flyout_dragger.js b/core/flyout_dragger.js index 545c2fb1e..3b0828e8c 100644 --- a/core/flyout_dragger.js +++ b/core/flyout_dragger.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/flyout_horizontal.js b/core/flyout_horizontal.js index 1bb701790..7efea87f5 100644 --- a/core/flyout_horizontal.js +++ b/core/flyout_horizontal.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/flyout_vertical.js b/core/flyout_vertical.js index 0404ff205..ae27031ee 100644 --- a/core/flyout_vertical.js +++ b/core/flyout_vertical.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/generator.js b/core/generator.js index 8a73d5f8c..6937042d5 100644 --- a/core/generator.js +++ b/core/generator.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/gesture.js b/core/gesture.js index 1e069ec4e..3de14fc38 100644 --- a/core/gesture.js +++ b/core/gesture.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/grid.js b/core/grid.js index 72367c10b..89b1a4ca8 100644 --- a/core/grid.js +++ b/core/grid.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -178,7 +167,7 @@ Blockly.Grid.prototype.setLineAttributes_ = function(line, width, * Move the grid to a new x and y position, and make sure that change is * visible. * @param {number} x The new x position of the grid (in px). - * @param {number} y The new y position ofthe grid (in px). + * @param {number} y The new y position of the grid (in px). * @package */ Blockly.Grid.prototype.moveTo = function(x, y) { diff --git a/core/icon.js b/core/icon.js index 5fb7cf9c7..7123dbc6a 100644 --- a/core/icon.js +++ b/core/icon.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2013 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/inject.js b/core/inject.js index cade0f695..cc599ab9f 100644 --- a/core/inject.js +++ b/core/inject.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2011 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -167,9 +156,9 @@ Blockly.createMainWorkspace_ = function(svg, options, blockDragSurface, // Set the theme name and renderer name onto the injection div. Blockly.utils.dom.addClass(mainWorkspace.getInjectionDiv(), - (wsOptions.renderer || 'geras') + '-renderer'); + mainWorkspace.getRenderer().getClassName()); Blockly.utils.dom.addClass(mainWorkspace.getInjectionDiv(), - mainWorkspace.getTheme().name + '-theme'); + mainWorkspace.getTheme().getClassName()); if (!wsOptions.hasCategories && wsOptions.languageTree) { // Add flyout as an that is a sibling of the workspace svg. diff --git a/core/input.js b/core/input.js index b8fd2e944..8e6bfb7b4 100644 --- a/core/input.js +++ b/core/input.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/insertion_marker_manager.js b/core/insertion_marker_manager.js index 92860e643..49f264e72 100644 --- a/core/insertion_marker_manager.js +++ b/core/insertion_marker_manager.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -116,20 +105,19 @@ Blockly.InsertionMarkerManager = function(block) { this.markerConnection_ = null; /** - * Whether we are currently highlighting the block (shadow or real) that would - * be replaced if the drag were released immediately. - * @type {boolean} - * @private - */ - this.highlightingBlock_ = false; - - /** - * The block that is being highlighted for replacement, or null. + * The block that currently has an input being highlighted, or null. * @type {Blockly.BlockSvg} * @private */ this.highlightedBlock_ = null; + /** + * The block being faded to indicate replacement, or null. + * @type {Blockly.BlockSvg} + * @private + */ + this.fadedBlock_ = null; + /** * The connections on the dragging blocks that are available to connect to * other blocks. This includes all open connections on the top block, as well @@ -141,6 +129,17 @@ Blockly.InsertionMarkerManager = function(block) { this.availableConnections_ = this.initAvailableConnections_(); }; +/** + * An enum describing different kinds of previews the InsertionMarkerManager + * could display. + * @enum {number} + */ +Blockly.InsertionMarkerManager.PREVIEW_TYPE = { + INSERTION_MARKER: 0, + INPUT_OUTLINE: 1, + REPLACEMENT_FADE: 2, +}; + /** * Sever all links from this object. * @package @@ -210,7 +209,7 @@ Blockly.InsertionMarkerManager.prototype.applyConnections = function() { }; /** - * Update highlighted connections based on the most recent move location. + * Update connections based on the most recent move location. * @param {!Blockly.utils.Coordinate} dxy Position relative to drag start, * in workspace units. * @param {?number} deleteArea One of {@link Blockly.DELETE_AREA_TRASH}, @@ -255,16 +254,19 @@ Blockly.InsertionMarkerManager.prototype.createMarkerBlock_ = function(sourceBlo } } result.setCollapsed(sourceBlock.isCollapsed()); - // Copy field values from the other block. These values may impact the - // rendered size of the insertion marker. Note that we do not care about - // child blocks here. + result.setInputsInline(sourceBlock.getInputsInline()); + // Copy visible field values from the other block. These values may impact + // the rendered size of the insertion marker. Note that we do not care + // about child blocks here. for (var i = 0; i < sourceBlock.inputList.length; i++) { var sourceInput = sourceBlock.inputList[i]; - var resultInput = result.inputList[i]; - for (var j = 0; j < sourceInput.fieldRow.length; j++) { - var sourceField = sourceInput.fieldRow[j]; - var resultField = resultInput.fieldRow[j]; - resultField.setValue(sourceField.getValue()); + if (sourceInput.isVisible()) { + var resultInput = result.inputList[i]; + for (var j = 0; j < sourceInput.fieldRow.length; j++) { + var sourceField = sourceInput.fieldRow[j]; + var resultField = resultInput.fieldRow[j]; + resultField.setValue(sourceField.getValue()); + } } } @@ -394,48 +396,6 @@ Blockly.InsertionMarkerManager.prototype.getStartRadius_ = function() { return Blockly.SNAP_RADIUS; }; -/** - * Whether ending the drag would replace a block or insert a block. - * @return {boolean} True if dropping the block immediately would replace - * another block. False if dropping the block immediately would result in - * the block being inserted in a block stack. - * @private - */ -Blockly.InsertionMarkerManager.prototype.shouldReplace_ = function() { - var closest = this.closestConnection_; - var local = this.localConnection_; - - // Dragging a block over an existing block in an input. - if (local.type == Blockly.OUTPUT_VALUE) { - // Insert the dragged block into the stack if possible. - if (closest && - this.workspace_.getRenderer() - .shouldInsertDraggedBlock(this.topBlock_, closest)) { - return false; // Insert. - } - // Otherwise replace the existing block and bump it out. - return true; // Replace. - } - - // Connecting to a statement input of c-block is an insertion, even if that - // c-block is terminal (e.g. forever). - if (local == local.getSourceBlock().getFirstStatementConnection()) { - return false; // Insert. - } - - // Dragging a terminal block over another (connected) terminal block will - // replace, not insert. - var isTerminalBlock = !this.topBlock_.nextConnection; - var isConnectedTerminal = isTerminalBlock && - local.type == Blockly.PREVIOUS_STATEMENT && closest.isConnected(); - if (isConnectedTerminal) { - return true; // Replace. - } - - // Otherwise it's an insertion. - return false; -}; - /** * Whether ending the drag would delete the block. * @param {!Object} candidate An object containing a local connection, a closest @@ -498,16 +458,28 @@ Blockly.InsertionMarkerManager.prototype.maybeShowPreview_ = function(candidate) * @private */ Blockly.InsertionMarkerManager.prototype.showPreview_ = function() { - if (this.shouldReplace_()) { - this.highlightBlock_(); - } else { // Should insert - this.connectMarker_(); + var closest = this.closestConnection_; + var renderer = this.workspace_.getRenderer(); + var method = renderer.getConnectionPreviewMethod( + /** @type {!Blockly.RenderedConnection} */ (closest), + /** @type {!Blockly.RenderedConnection} */ (this.localConnection_), + this.topBlock_); + + switch (method) { + case Blockly.InsertionMarkerManager.PREVIEW_TYPE.INPUT_OUTLINE: + this.showInsertionInputOutline_(); + break; + case Blockly.InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER: + this.showInsertionMarker_(); + break; + case Blockly.InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE: + this.showReplacementFade_(); + break; } - // Also highlight the actual connection, as a nod to previous behaviour. - if (this.closestConnection_ && this.closestConnection_.targetBlock() && - this.workspace_.getRenderer() - .shouldHighlightConnection(this.closestConnection_)) { - this.closestConnection_.highlight(); + + // Optionally highlight the actual connection, as a nod to previous behaviour. + if (closest && renderer.shouldHighlightConnection(closest)) { + closest.highlight(); } }; @@ -555,53 +527,57 @@ Blockly.InsertionMarkerManager.prototype.hidePreview_ = function() { .shouldHighlightConnection(this.closestConnection_)) { this.closestConnection_.unhighlight(); } - if (this.highlightingBlock_) { - this.unhighlightBlock_(); + if (this.fadedBlock_) { + this.hideReplacementFade_(); + } else if (this.highlightedBlock_) { + this.hideInsertionInputOutline_(); } else if (this.markerConnection_) { - this.disconnectMarker_(); + this.hideInsertionMarker_(); } }; /** - * Add highlighting showing which block will be replaced. + * Shows an insertion marker connected to the appropriate blocks (based on + * manager state). * @private */ -Blockly.InsertionMarkerManager.prototype.highlightBlock_ = function() { - var closest = this.closestConnection_; +Blockly.InsertionMarkerManager.prototype.showInsertionMarker_ = function() { var local = this.localConnection_; - if (closest.targetBlock()) { - this.highlightedBlock_ = closest.targetBlock(); - closest.targetBlock().highlightForReplacement(true); - } else if (local.type == Blockly.OUTPUT_VALUE) { - this.highlightedBlock_ = closest.getSourceBlock(); - closest.getSourceBlock().highlightShapeForInput(closest, true); - } - this.highlightingBlock_ = true; -}; - -/** - * Get rid of the highlighting marking the block that will be replaced. - * @private - */ -Blockly.InsertionMarkerManager.prototype.unhighlightBlock_ = function() { var closest = this.closestConnection_; - // If there's no block in place, but we're still connecting to a value input, - // then we must have been highlighting an input shape. - if (closest.type == Blockly.INPUT_VALUE && !closest.isConnected()) { - this.highlightedBlock_.highlightShapeForInput(closest, false); - } else { - this.highlightedBlock_.highlightForReplacement(false); + + var isLastInStack = this.lastOnStack_ && local == this.lastOnStack_; + var imBlock = isLastInStack ? this.lastMarker_ : this.firstMarker_; + var imConn = imBlock.getMatchingConnection(local.getSourceBlock(), local); + + if (imConn == this.markerConnection_) { + throw Error('Made it to showInsertionMarker_ even though the marker isn\'t ' + + 'changing'); } - this.highlightedBlock_ = null; - this.highlightingBlock_ = false; + + // Render disconnected from everything else so that we have a valid + // connection location. + imBlock.render(); + imBlock.rendered = true; + imBlock.getSvgRoot().setAttribute('visibility', 'visible'); + + if (imConn && closest) { + // Position so that the existing block doesn't move. + imBlock.positionNearConnection(imConn, closest); + } + if (closest) { + // Connect() also renders the insertion marker. + imConn.connect(closest); + } + + this.markerConnection_ = imConn; }; /** - * Disconnect the insertion marker block in a manner that returns the stack to - * original state. + * Disconnects and hides the current insertion marker. Should return the blocks + * to their original state. * @private */ -Blockly.InsertionMarkerManager.prototype.disconnectMarker_ = function() { +Blockly.InsertionMarkerManager.prototype.hideInsertionMarker_ = function() { if (!this.markerConnection_) { console.log('No insertion marker connection to disconnect'); return; @@ -649,38 +625,41 @@ Blockly.InsertionMarkerManager.prototype.disconnectMarker_ = function() { }; /** - * Add an insertion marker connected to the appropriate blocks. + * Shows an outline around the input the closest connection belongs to. * @private */ -Blockly.InsertionMarkerManager.prototype.connectMarker_ = function() { - var local = this.localConnection_; +Blockly.InsertionMarkerManager.prototype.showInsertionInputOutline_ = function() { var closest = this.closestConnection_; + this.highlightedBlock_ = closest.getSourceBlock(); + this.highlightedBlock_.highlightShapeForInput(closest, true); +}; - var isLastInStack = this.lastOnStack_ && local == this.lastOnStack_; - var imBlock = isLastInStack ? this.lastMarker_ : this.firstMarker_; - var imConn = imBlock.getMatchingConnection(local.getSourceBlock(), local); +/** + * Hides any visible input outlines. + * @private + */ +Blockly.InsertionMarkerManager.prototype.hideInsertionInputOutline_ = function() { + this.highlightedBlock_.highlightShapeForInput(this.closestConnection_, false); + this.highlightedBlock_ = null; +}; - if (imConn == this.markerConnection_) { - throw Error('Made it to connectMarker_ even though the marker isn\'t ' + - 'changing'); - } +/** + * Shows a replacement fade affect on the closest connection's target block + * (the block that is currently connected to it). + * @private + */ +Blockly.InsertionMarkerManager.prototype.showReplacementFade_ = function() { + this.fadedBlock_ = this.closestConnection_.targetBlock(); + this.fadedBlock_.fadeForReplacement(true); +}; - // Render disconnected from everything else so that we have a valid - // connection location. - imBlock.render(); - imBlock.rendered = true; - imBlock.getSvgRoot().setAttribute('visibility', 'visible'); - - if (imConn && closest) { - // Position so that the existing block doesn't move. - imBlock.positionNearConnection(imConn, closest); - } - if (closest) { - // Connect() also renders the insertion marker. - imConn.connect(closest); - } - - this.markerConnection_ = imConn; +/** + * Hides/Removes any visible fade affects. + * @private + */ +Blockly.InsertionMarkerManager.prototype.hideReplacementFade_ = function() { + this.fadedBlock_.fadeForReplacement(false); + this.fadedBlock_ = null; }; /** diff --git a/core/keyboard_nav/action.js b/core/keyboard_nav/action.js index d4a3dbbe8..348049bf0 100644 --- a/core/keyboard_nav/action.js +++ b/core/keyboard_nav/action.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/keyboard_nav/ast_node.js b/core/keyboard_nav/ast_node.js index 509759aaf..4f111b84c 100644 --- a/core/keyboard_nav/ast_node.js +++ b/core/keyboard_nav/ast_node.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -31,7 +20,7 @@ goog.require('Blockly.utils.Coordinate'); * It is recommended that you use one of the createNode methods instead of * creating a node directly. * @param {string} type The type of the location. - * Must be in Bockly.ASTNode.types. + * Must be in Blockly.ASTNode.types. * @param {!(Blockly.Block|Blockly.Connection|Blockly.Field|Blockly.Workspace)} * location The position in the AST. * @param {!Object=} opt_params Optional dictionary of options. diff --git a/core/keyboard_nav/basic_cursor.js b/core/keyboard_nav/basic_cursor.js index d301a2fb1..981c8cc89 100644 --- a/core/keyboard_nav/basic_cursor.js +++ b/core/keyboard_nav/basic_cursor.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -90,7 +79,7 @@ Blockly.BasicCursor.prototype.prev = function() { }; /** - * For a basic cursor we only have the ability to go next and previou, so + * For a basic cursor we only have the ability to go next and previous, so * out will allow the user to get to the previous node in the pre order traversal. * @return {Blockly.ASTNode} The previous node, or null if the current node is * not set or there is no previous value. diff --git a/core/keyboard_nav/cursor.js b/core/keyboard_nav/cursor.js index 7342e2491..1d8b4ae78 100644 --- a/core/keyboard_nav/cursor.js +++ b/core/keyboard_nav/cursor.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/keyboard_nav/flyout_cursor.js b/core/keyboard_nav/flyout_cursor.js index 9208a24fe..abe7a80a3 100644 --- a/core/keyboard_nav/flyout_cursor.js +++ b/core/keyboard_nav/flyout_cursor.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/keyboard_nav/key_map.js b/core/keyboard_nav/key_map.js index 01e5cea49..e0c4b7957 100644 --- a/core/keyboard_nav/key_map.js +++ b/core/keyboard_nav/key_map.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/keyboard_nav/marker.js b/core/keyboard_nav/marker.js index f70fa0eea..069475985 100644 --- a/core/keyboard_nav/marker.js +++ b/core/keyboard_nav/marker.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/keyboard_nav/navigation.js b/core/keyboard_nav/navigation.js index a2b861b5a..385ef676a 100644 --- a/core/keyboard_nav/navigation.js +++ b/core/keyboard_nav/navigation.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -793,7 +782,7 @@ Blockly.navigation.onBlocklyAction = function(action) { } else if (Blockly.navigation.READONLY_ACTION_LIST.indexOf(action) > -1) { actionHandled = Blockly.navigation.handleActions_(action); } - // If not in accessibility mode only hanlde turning on keyboard navigation. + // If not in accessibility mode only handle turning on keyboard navigation. } else if (action.name === Blockly.navigation.actionNames.TOGGLE_KEYBOARD_NAV) { Blockly.navigation.enableKeyboardAccessibility(); actionHandled = true; @@ -1042,7 +1031,7 @@ Blockly.navigation.ACTION_TOGGLE_KEYBOARD_NAV = new Blockly.Action( 'Turns on and off keyboard navigation.'); /** - * The action to move the cursor to the keft on a worksapce. + * The action to move the cursor to the left on a workspace. * @type {!Blockly.Action} */ Blockly.navigation.ACTION_MOVE_WS_CURSOR_LEFT = new Blockly.Action( @@ -1050,7 +1039,7 @@ Blockly.navigation.ACTION_MOVE_WS_CURSOR_LEFT = new Blockly.Action( 'Move the workspace cursor to the lefts.'); /** - * The action to move the cursor to the right on a worksapce. + * The action to move the cursor to the right on a workspace. * @type {!Blockly.Action} */ Blockly.navigation.ACTION_MOVE_WS_CURSOR_RIGHT = new Blockly.Action( @@ -1058,7 +1047,7 @@ Blockly.navigation.ACTION_MOVE_WS_CURSOR_RIGHT = new Blockly.Action( 'Move the workspace cursor to the right.'); /** - * The action to move the cursor up on a worksapce. + * The action to move the cursor up on a workspace. * @type {!Blockly.Action} */ Blockly.navigation.ACTION_MOVE_WS_CURSOR_UP = new Blockly.Action( @@ -1066,7 +1055,7 @@ Blockly.navigation.ACTION_MOVE_WS_CURSOR_UP = new Blockly.Action( 'Move the workspace cursor up.'); /** - * The action to move the cursor down on a worksapce. + * The action to move the cursor down on a workspace. * @type {!Blockly.Action} */ Blockly.navigation.ACTION_MOVE_WS_CURSOR_DOWN = new Blockly.Action( diff --git a/core/keyboard_nav/tab_navigate_cursor.js b/core/keyboard_nav/tab_navigate_cursor.js index 4074f3588..5e85136a9 100644 --- a/core/keyboard_nav/tab_navigate_cursor.js +++ b/core/keyboard_nav/tab_navigate_cursor.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/marker_manager.js b/core/marker_manager.js index e64ff2d74..22090e81e 100644 --- a/core/marker_manager.js +++ b/core/marker_manager.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -165,6 +154,16 @@ Blockly.MarkerManager.prototype.setMarkerSvg = function(markerSvg) { } }; +/** + * Redraw the attached cursor svg if needed. + * @package + */ +Blockly.MarkerManager.prototype.updateMarkers = function() { + if (this.workspace_.keyboardAccessibilityMode && this.cursorSvg_) { + this.workspace_.getCursor().draw(); + } +}; + /** * Dispose of the marker manager. * Go through and delete all markers associated with this marker manager. diff --git a/core/msg.js b/core/msg.js index 905ea8ec3..8cf7a2c5b 100644 --- a/core/msg.js +++ b/core/msg.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2013 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/mutator.js b/core/mutator.js index 9971f26be..313e3f101 100644 --- a/core/mutator.js +++ b/core/mutator.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -171,7 +160,8 @@ Blockly.Mutator.prototype.createEditor_ = function() { 'media': this.block_.workspace.options.pathToMedia, 'rtl': this.block_.RTL, 'horizontalLayout': false, - 'renderer': this.block_.workspace.options.renderer + 'renderer': this.block_.workspace.options.renderer, + 'rendererOverrides': this.block_.workspace.options.rendererOverrides })); workspaceOptions.toolboxPosition = this.block_.RTL ? Blockly.TOOLBOX_AT_RIGHT : Blockly.TOOLBOX_AT_LEFT; @@ -304,7 +294,7 @@ Blockly.Mutator.prototype.setVisible = function(visible) { for (var i = 0, child; (child = blocks[i]); i++) { child.render(); } - // The root block should not be dragable or deletable. + // The root block should not be draggable or deletable. this.rootBlock_.setMovable(false); this.rootBlock_.setDeletable(false); if (flyout) { diff --git a/core/names.js b/core/names.js index daa7edb73..8772f1e41 100644 --- a/core/names.js +++ b/core/names.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -93,7 +82,7 @@ Blockly.Names.prototype.setVariableMap = function(map) { Blockly.Names.prototype.getNameForUserVariable_ = function(id) { if (!this.variableMap_) { console.log('Deprecated call to Blockly.Names.prototype.getName without ' + - 'defining a variable map. To fix, add the folowing code in your ' + + 'defining a variable map. To fix, add the following code in your ' + 'generator\'s init() function:\n' + 'Blockly.YourGeneratorName.variableDB_.setVariableMap(' + 'workspace.getVariableMap());'); diff --git a/core/options.js b/core/options.js index cf0d8dba2..fd97f8d94 100644 --- a/core/options.js +++ b/core/options.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -142,6 +131,7 @@ Blockly.Options = function(options) { this.theme = Blockly.Options.parseThemeOptions_(options); this.keyMap = keyMap; this.renderer = renderer; + this.rendererOverrides = options['rendererOverrides']; /** * The SVG element for the grid pattern. @@ -160,7 +150,8 @@ Blockly.Options = function(options) { /** * Blockly options. - * This interface is further described in `typings/blockly-interfaces.d.ts`. + * This interface is further described in + * `typings/parts/blockly-interfaces.d.ts`. * @interface */ Blockly.BlocklyOptions = function() {}; @@ -292,8 +283,7 @@ Blockly.Options.parseThemeOptions_ = function(options) { if (theme instanceof Blockly.Theme) { return /** @type {!Blockly.Theme} */ (theme); } - return new Blockly.Theme('builtin', - theme['blockStyles'], theme['categoryStyles'], theme['componentStyles']); + return Blockly.Theme.defineTheme('builtin', theme); }; /** diff --git a/core/procedures.js b/core/procedures.js index b0bb55651..79fa4e630 100644 --- a/core/procedures.js +++ b/core/procedures.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/rendered_connection.js b/core/rendered_connection.js index 5ede9de0e..d6eab4827 100644 --- a/core/rendered_connection.js +++ b/core/rendered_connection.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/common/block_rendering.js b/core/renderers/common/block_rendering.js index da3a71f6a..8a7757cd1 100644 --- a/core/renderers/common/block_rendering.js +++ b/core/renderers/common/block_rendering.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -90,27 +79,18 @@ Blockly.blockRendering.stopDebugger = function() { /** * Initialize anything needed for rendering (constants, etc). * @param {!string} name Name of the renderer to initialize. + * @param {!Blockly.Theme} theme The workspace theme object. + * @param {Object=} opt_rendererOverrides Rendering constant overrides. * @return {!Blockly.blockRendering.Renderer} The new instance of a renderer. * Already initialized. * @package */ -Blockly.blockRendering.init = function(name) { +Blockly.blockRendering.init = function(name, theme, opt_rendererOverrides) { if (!Blockly.blockRendering.rendererMap_[name]) { throw Error('Renderer not registered: ', name); } - /** - * Wrap the renderer constructor into a temporary constructor - * function so the closure compiler treats it as a constructor. - * @param {string} name The renderer name. - * @constructor - * @extends {Blockly.blockRendering.Renderer} - */ - var rendererCtor = function(name) { - rendererCtor.superClass_.constructor.call(this, name); - }; - Blockly.utils.object.inherits(rendererCtor, - Blockly.blockRendering.rendererMap_[name]); - var renderer = new rendererCtor(name); - renderer.init(); + var renderer = (/** @type {!Blockly.blockRendering.Renderer} */ ( + new Blockly.blockRendering.rendererMap_[name](name))); + renderer.init(theme, opt_rendererOverrides); return renderer; }; diff --git a/core/renderers/common/constants.js b/core/renderers/common/constants.js index 654208612..8a5b19cff 100644 --- a/core/renderers/common/constants.js +++ b/core/renderers/common/constants.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -29,6 +18,8 @@ goog.require('Blockly.utils.dom'); goog.require('Blockly.utils.svgPaths'); goog.require('Blockly.utils.userAgent'); +goog.requireType('Blockly.blockRendering.Debug'); + /** * An object that provides constants for rendering blocks. @@ -247,12 +238,6 @@ Blockly.blockRendering.ConstantProvider = function() { */ this.FIELD_TEXT_FONTSIZE = 11; - /** - * Height of text. - * @type {number} - */ - this.FIELD_TEXT_HEIGHT = 16; - /** * Text font weight. * @type {string} @@ -265,6 +250,20 @@ Blockly.blockRendering.ConstantProvider = function() { */ this.FIELD_TEXT_FONTFAMILY = 'sans-serif'; + /** + * Height of text. This constant is dynamically set in ``setFontConstants_`` + * to be the height of the text based on the font used. + * @type {number} + */ + this.FIELD_TEXT_HEIGHT = -1; // Dynamically set + + /** + * Text baseline. This constant is dynamically set in ``setFontConstants_`` + * to be the baseline of the text based on the font used. + * @type {number} + */ + this.FIELD_TEXT_BASELINE = -1; // Dynamically set + /** * A field's border rect corner radius. * @type {number} @@ -296,19 +295,6 @@ Blockly.blockRendering.ConstantProvider = function() { */ this.FIELD_BORDER_RECT_COLOUR = '#fff'; - /** - * Field text baseline. - * This is only used if `FIELD_TEXT_BASELINE_CENTER` is false. - * @type {number} - */ - this.FIELD_TEXT_BASELINE_Y = Blockly.utils.userAgent.GECKO ? 12 : 13.09; - - /** - * An text offset adjusting the Y position of text after positioning. - * @type {number} - */ - this.FIELD_TEXT_Y_OFFSET = 0; - /** * A field's text element's dominant baseline. * @type {boolean} @@ -403,25 +389,13 @@ Blockly.blockRendering.ConstantProvider = function() { */ this.FIELD_CHECKBOX_X_OFFSET = this.FIELD_BORDER_RECT_X_PADDING - 3; - /** - * A checkbox field's Y offset. - * @type {number} - */ - this.FIELD_CHECKBOX_Y_OFFSET = 14; - - /** - * A checkbox field's default width. - * @type {number} - */ - this.FIELD_CHECKBOX_DEFAULT_WIDTH = 15; - /** * A random identifier used to ensure a unique ID is used for each * filter/pattern for the case of multiple Blockly instances on a page. * @type {string} - * @protected + * @package */ - this.randomIdentifier_ = String(Math.random()).substring(2); + this.randomIdentifier = String(Math.random()).substring(2); /** * The ID of the emboss filter, or the empty string if no filter is set. @@ -451,6 +425,27 @@ Blockly.blockRendering.ConstantProvider = function() { */ this.disabledPattern_ = null; + /** + * The ID of the debug filter, or the empty string if no pattern is set. + * @type {string} + * @package + */ + this.debugFilterId = ''; + + /** + * The element to use for a debug highlight, or null if not set. + * @type {SVGElement} + * @private + */ + this.debugFilter_ = null; + + /** + * The */ var embossFilter = Blockly.utils.dom.createSvgElement('filter', - {'id': 'blocklyEmbossFilter' + this.randomIdentifier_}, defs); + {'id': 'blocklyEmbossFilter' + this.randomIdentifier}, defs); Blockly.utils.dom.createSvgElement('feGaussianBlur', {'in': 'SourceAlpha', 'stdDeviation': 1, 'result': 'blur'}, embossFilter); var feSpecularLighting = Blockly.utils.dom.createSvgElement('feSpecularLighting', @@ -994,7 +1079,7 @@ Blockly.blockRendering.ConstantProvider.prototype.createDom = function(svg) { */ var disabledPattern = Blockly.utils.dom.createSvgElement('pattern', { - 'id': 'blocklyDisabledPattern' + this.randomIdentifier_, + 'id': 'blocklyDisabledPattern' + this.randomIdentifier, 'patternUnits': 'userSpaceOnUse', 'width': 10, 'height': 10 @@ -1005,47 +1090,93 @@ Blockly.blockRendering.ConstantProvider.prototype.createDom = function(svg) { {'d': 'M 0 0 L 10 10 M 10 0 L 0 10', 'stroke': '#cc0'}, disabledPattern); this.disabledPatternId = disabledPattern.id; this.disabledPattern_ = disabledPattern; + + if (Blockly.blockRendering.Debug) { + var debugFilter = Blockly.utils.dom.createSvgElement('filter', + { + 'id': 'blocklyDebugFilter' + this.randomIdentifier, + 'height': '160%', + 'width': '180%', + y: '-30%', + x: '-40%' + }, + defs); + // Set all gaussian blur pixels to 1 opacity before applying flood + var debugComponentTransfer = Blockly.utils.dom.createSvgElement( + 'feComponentTransfer', {'result': 'outBlur'}, debugFilter); + Blockly.utils.dom.createSvgElement('feFuncA', + { + 'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' + }, + debugComponentTransfer); + // Color the highlight + Blockly.utils.dom.createSvgElement('feFlood', + { + 'flood-color': '#ff0000', + 'flood-opacity': 0.5, + 'result': 'outColor' + }, + debugFilter); + Blockly.utils.dom.createSvgElement('feComposite', + { + 'in': 'outColor', 'in2': 'outBlur', + 'operator': 'in', 'result': 'outGlow' + }, + debugFilter); + this.debugFilterId = debugFilter.id; + this.debugFilter_ = debugFilter; + } }; /** * Inject renderer specific CSS into the page. - * @param {string} name Name of the renderer. - * @package + * @param {string} tagName The name of the style tag to use. + * @param {string} selector The CSS selector to use. + * @protected */ -Blockly.blockRendering.ConstantProvider.prototype.injectCSS = function( - name) { - var cssArray = this.getCSS_(name); - var cssNodeId = 'blockly-renderer-style-' + name; - if (document.getElementById(cssNodeId)) { - // Already injected. +Blockly.blockRendering.ConstantProvider.prototype.injectCSS_ = function( + tagName, selector) { + var cssArray = this.getCSS_(selector); + var cssNodeId = 'blockly-renderer-style-' + tagName; + this.cssNode_ = + /** @type {!HTMLStyleElement} */ (document.getElementById(cssNodeId)); + var text = cssArray.join('\n'); + if (this.cssNode_) { + // Already injected, update if the theme changed. + this.cssNode_.firstChild.textContent = text; return; } - var text = cssArray.join('\n'); // Inject CSS tag at start of head. - var cssNode = document.createElement('style'); + var cssNode = + /** @type {!HTMLStyleElement} */ (document.createElement('style')); cssNode.id = cssNodeId; var cssTextNode = document.createTextNode(text); cssNode.appendChild(cssTextNode); document.head.insertBefore(cssNode, document.head.firstChild); + this.cssNode_ = cssNode; }; /** * Get any renderer specific CSS to inject when the renderer is initialized. - * @param {string} name Name of the renderer. + * @param {string} selector CSS selector to use. * @return {!Array.} Array of CSS strings. * @protected */ -Blockly.blockRendering.ConstantProvider.prototype.getCSS_ = function(name) { - var selector = '.' + name + '-renderer'; +Blockly.blockRendering.ConstantProvider.prototype.getCSS_ = function(selector) { return [ /* eslint-disable indent */ - // Fields. - selector + ' .blocklyText {', - 'fill: #fff;', + // Text. + selector + ' .blocklyText, ', + selector + ' .blocklyFlyoutLabelText {', 'font-family: ' + this.FIELD_TEXT_FONTFAMILY + ';', 'font-size: ' + this.FIELD_TEXT_FONTSIZE + 'pt;', 'font-weight: ' + this.FIELD_TEXT_FONTWEIGHT + ';', '}', + + // Fields. + selector + ' .blocklyText {', + 'fill: #fff;', + '}', selector + ' .blocklyNonEditableText>rect,', selector + ' .blocklyEditableText>rect {', 'fill: ' + this.FIELD_BORDER_RECT_COLOUR + ';', @@ -1057,6 +1188,16 @@ Blockly.blockRendering.ConstantProvider.prototype.getCSS_ = function(name) { 'fill: #000;', '}', + // Flyout labels. + selector + ' .blocklyFlyoutLabelText {', + 'fill: #000;', + '}', + + // Bubbles. + selector + ' .blocklyText.blocklyBubbleText {', + 'fill: #000;', + '}', + // Editable field hover. selector + ' .blocklyEditableText:not(.editing):hover>rect {', 'stroke: #fff;', @@ -1080,7 +1221,7 @@ Blockly.blockRendering.ConstantProvider.prototype.getCSS_ = function(name) { 'stroke: #fc3;', '}', - // Replacable highlight. + // Replaceable highlight. selector + ' .blocklyReplaceable .blocklyPath {', 'fill-opacity: .5;', '}', @@ -1088,6 +1229,12 @@ Blockly.blockRendering.ConstantProvider.prototype.getCSS_ = function(name) { selector + ' .blocklyReplaceable .blocklyPathDark {', 'display: none;', '}', + + // Insertion marker. + selector + ' .blocklyInsertionMarker>.blocklyPath {', + 'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', + 'stroke: none', + '}', /* eslint-enable indent */ ]; }; diff --git a/core/renderers/common/debugger.js b/core/renderers/common/debugger.js index 2bb37a6c6..0e5588b4b 100644 --- a/core/renderers/common/debugger.js +++ b/core/renderers/common/debugger.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -35,10 +24,12 @@ goog.require('Blockly.blockRendering.Types'); /** * An object that renders rectangles and dots for debugging rendering code. + * @param {!Blockly.blockRendering.ConstantProvider} constants The renderer's + * constants. * @package * @constructor */ -Blockly.blockRendering.Debug = function() { +Blockly.blockRendering.Debug = function(constants) { /** * An array of SVG elements that have been created by this object. * @type {Array.} @@ -53,6 +44,13 @@ Blockly.blockRendering.Debug = function() { * @private */ this.svgRoot_ = null; + + /** + * The renderer's constant provider. + * @type {!Blockly.blockRendering.ConstantProvider} + * @private + */ + this.constants_ = constants; }; /** @@ -67,7 +65,8 @@ Blockly.blockRendering.Debug.config = { elems: true, connections: true, blockBounds: true, - connectedBlockBounds: true + connectedBlockBounds: true, + render: true }; /** @@ -174,6 +173,23 @@ Blockly.blockRendering.Debug.prototype.drawRenderedElem = function(elem, isRtl) 'stroke-width': '1px' }, this.svgRoot_)); + + if (Blockly.blockRendering.Types.isField(elem) && + elem.field instanceof Blockly.FieldLabel) { + var baseline = this.constants_.FIELD_TEXT_BASELINE; + this.debugElements_.push(Blockly.utils.dom.createSvgElement('rect', + { + 'class': 'rowRenderingRect blockRenderDebug', + 'x': xPos, + 'y': yPos + baseline, + 'width': elem.width, + 'height': '0.1px', + 'stroke': 'red', + 'fill': 'none', + 'stroke-width': '0.5px' + }, + this.svgRoot_)); + } } @@ -382,4 +398,23 @@ Blockly.blockRendering.Debug.prototype.drawDebug = function(block, info) { } this.drawBoundingBox(info); + + this.drawRender(block.pathObject.svgPath); +}; + + +/** + * Show a debug filter to highlight that a block has been rendered. + * @param {!SVGElement} svgPath The block's svg path. + * @package + */ +Blockly.blockRendering.Debug.prototype.drawRender = function(svgPath) { + if (!Blockly.blockRendering.Debug.config.render) { + return; + } + svgPath.setAttribute('filter', + 'url(#' + this.constants_.debugFilterId + ')'); + setTimeout(function() { + svgPath.setAttribute('filter', ''); + }, 100); }; diff --git a/core/renderers/common/drawer.js b/core/renderers/common/drawer.js index b498bba1f..6f5cc249d 100644 --- a/core/renderers/common/drawer.js +++ b/core/renderers/common/drawer.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/common/i_path_object.js b/core/renderers/common/i_path_object.js index 12454e41d..82a58f513 100644 --- a/core/renderers/common/i_path_object.js +++ b/core/renderers/common/i_path_object.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -127,4 +116,4 @@ Blockly.blockRendering.IPathObject.prototype.updateMovable; * @param {boolean} enable True if styling should be added. * @package */ -Blockly.blockRendering.IPathObject.prototype.updateReplacementHighlight; +Blockly.blockRendering.IPathObject.prototype.updateReplacementFade; diff --git a/core/renderers/common/info.js b/core/renderers/common/info.js index 0e20b9b24..a49624316 100644 --- a/core/renderers/common/info.js +++ b/core/renderers/common/info.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -139,11 +128,10 @@ Blockly.blockRendering.RenderInfo = function(renderer, block) { this.rows = []; /** - * The total number of input rows added onto the block. - * @type {number} - * @protected + * An array of input rows on the block. + * @type {!Array.} */ - this.inputRowNum_ = 1; + this.inputRows = []; /** * An array of measurable objects containing hidden icons. @@ -206,6 +194,7 @@ Blockly.blockRendering.RenderInfo.prototype.createRows_ = function() { this.populateTopRow_(); this.rows.push(this.topRow); var activeRow = new Blockly.blockRendering.InputRow(this.constants_); + this.inputRows.push(activeRow); // Icons always go on the first row, before anything else. var icons = this.block_.getIcons(); @@ -231,7 +220,7 @@ Blockly.blockRendering.RenderInfo.prototype.createRows_ = function() { // Finish this row and create a new one. this.rows.push(activeRow); activeRow = new Blockly.blockRendering.InputRow(this.constants_); - this.inputRowNum_ ++; + this.inputRows.push(activeRow); } // All of the fields in an input go on the same row. @@ -559,6 +548,9 @@ Blockly.blockRendering.RenderInfo.prototype.alignRowElements_ = function() { if (missingSpace > 0) { this.addAlignmentPadding_(row, missingSpace); } + if (Blockly.blockRendering.Types.isTopOrBottomRow(row)) { + row.widthWithConnectedBlocks = row.width; + } } } }; @@ -775,8 +767,7 @@ Blockly.blockRendering.RenderInfo.prototype.finalize_ = function() { this.block_.nextConnection.targetBlock().getHeightWidth().width); } - this.widthWithChildren = Math.max(this.widthWithChildren, - widestRowWithConnectedBlocks + this.startX); + this.widthWithChildren = widestRowWithConnectedBlocks + this.startX; this.height = yCursor; this.startY = this.topRow.capline; diff --git a/core/renderers/common/marker_svg.js b/core/renderers/common/marker_svg.js index f845922cc..a9b005b88 100644 --- a/core/renderers/common/marker_svg.js +++ b/core/renderers/common/marker_svg.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -134,6 +123,7 @@ Blockly.blockRendering.MarkerSvg.prototype.createDom = function() { }, null); this.createDomInternal_(); + this.applyColour_(); return this.svgGroup_; }; @@ -465,6 +455,13 @@ Blockly.blockRendering.MarkerSvg.prototype.draw = function(oldNode, curNode) { return; } + this.constants_ = this.workspace_.getRenderer().getConstants(); + + var defaultColour = this.isCursor() ? this.constants_.CURSOR_COLOUR : + this.constants_.MARKER_COLOUR; + this.colour_ = this.marker_.colour || defaultColour; + this.applyColour_(); + this.showAtLocation_(curNode); this.firemarkerEvent_(oldNode, curNode); @@ -561,7 +558,6 @@ Blockly.blockRendering.MarkerSvg.prototype.createDomInternal_ = function() { // A horizontal line used to represent a workspace coordinate or next connection. this.markerSvgLine_ = Blockly.utils.dom.createSvgElement('rect', { - 'fill': this.colour_, 'width': this.constants_.CURSOR_WS_WIDTH, 'height': this.constants_.WS_CURSOR_HEIGHT, 'style': 'display: none' @@ -573,8 +569,7 @@ Blockly.blockRendering.MarkerSvg.prototype.createDomInternal_ = function() { { 'class': 'blocklyVerticalMarker', 'rx': 10, 'ry': 10, - 'style': 'display: none', - 'stroke': this.colour_ + 'style': 'display: none' }, this.markerSvg_); @@ -582,8 +577,7 @@ Blockly.blockRendering.MarkerSvg.prototype.createDomInternal_ = function() { this.markerInput_ = Blockly.utils.dom.createSvgElement('path', { 'transform': '', - 'style': 'display: none', - 'fill': this.colour_ + 'style': 'display: none' }, this.markerSvg_); @@ -594,7 +588,6 @@ Blockly.blockRendering.MarkerSvg.prototype.createDomInternal_ = function() { 'transform': '', 'style': 'display: none', 'fill': 'none', - 'stroke': this.colour_, 'stroke-width': this.constants_.CURSOR_STROKE_WIDTH }, this.markerSvg_); @@ -602,7 +595,7 @@ Blockly.blockRendering.MarkerSvg.prototype.createDomInternal_ = function() { // Markers and stack markers don't blink. if (this.isCursor()) { var blinkProperties = this.getBlinkProperties_(); - Blockly.utils.dom.createSvgElement('animate', this.getBlinkProperties_(), + Blockly.utils.dom.createSvgElement('animate', blinkProperties, this.markerSvgLine_); Blockly.utils.dom.createSvgElement('animate', blinkProperties, this.markerInput_); @@ -614,6 +607,24 @@ Blockly.blockRendering.MarkerSvg.prototype.createDomInternal_ = function() { return this.markerSvg_; }; +/** + * Apply the marker's colour. + * @protected + */ +Blockly.blockRendering.MarkerSvg.prototype.applyColour_ = function() { + this.markerSvgLine_.setAttribute('fill', this.colour_); + this.markerSvgRect_.setAttribute('stroke', this.colour_); + this.markerInput_.setAttribute('fill', this.colour_); + this.markerBlock_.setAttribute('stroke', this.colour_); + + if (this.isCursor()) { + var values = this.colour_ + ';transparent;transparent;'; + this.markerSvgLine_.firstChild.setAttribute('values', values); + this.markerInput_.firstChild.setAttribute('values', values); + this.markerBlock_.firstChild.setAttribute('values', values); + } +}; + /** * Dispose of this marker. * @package diff --git a/core/renderers/common/path_object.js b/core/renderers/common/path_object.js index c52996638..73d1cc732 100644 --- a/core/renderers/common/path_object.js +++ b/core/renderers/common/path_object.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -46,9 +35,9 @@ Blockly.blockRendering.PathObject = function(root, style, constants) { /** * The renderer's constant provider. * @type {!Blockly.blockRendering.ConstantProvider} - * @protected + * @package */ - this.constants_ = constants; + this.constants = constants; this.svgRoot = root; @@ -71,17 +60,17 @@ Blockly.blockRendering.PathObject = function(root, style, constants) { * Holds the cursors svg element when the cursor is attached to the block. * This is null if there is no cursor on the block. * @type {SVGElement} - * @private + * @package */ - this.cursorSvg_ = null; + this.cursorSvg = null; /** * Holds the markers svg element when the marker is attached to the block. * This is null if there is no marker on the block. * @type {SVGElement} - * @private + * @package */ - this.markerSvg_ = null; + this.markerSvg = null; }; /** @@ -110,12 +99,12 @@ Blockly.blockRendering.PathObject.prototype.flipRTL = function() { */ Blockly.blockRendering.PathObject.prototype.setCursorSvg = function(cursorSvg) { if (!cursorSvg) { - this.cursorSvg_ = null; + this.cursorSvg = null; return; } this.svgRoot.appendChild(cursorSvg); - this.cursorSvg_ = cursorSvg; + this.cursorSvg = cursorSvg; }; /** @@ -126,16 +115,16 @@ Blockly.blockRendering.PathObject.prototype.setCursorSvg = function(cursorSvg) { */ Blockly.blockRendering.PathObject.prototype.setMarkerSvg = function(markerSvg) { if (!markerSvg) { - this.markerSvg_ = null; + this.markerSvg = null; return; } - if (this.cursorSvg_) { - this.svgRoot.insertBefore(markerSvg, this.cursorSvg_); + if (this.cursorSvg) { + this.svgRoot.insertBefore(markerSvg, this.cursorSvg); } else { this.svgRoot.appendChild(markerSvg); } - this.markerSvg_ = markerSvg; + this.markerSvg = markerSvg; }; /** @@ -189,7 +178,7 @@ Blockly.blockRendering.PathObject.prototype.updateHighlighted = function( enable) { if (enable) { this.svgPath.setAttribute('filter', - 'url(#' + this.constants_.embossFilterId + ')'); + 'url(#' + this.constants.embossFilterId + ')'); } else { this.svgPath.setAttribute('filter', 'none'); } @@ -217,7 +206,7 @@ Blockly.blockRendering.PathObject.prototype.updateDisabled_ = function( this.setClass_('blocklyDisabled', disabled); if (disabled) { this.svgPath.setAttribute('fill', - 'url(#' + this.constants_.disabledPatternId + ')'); + 'url(#' + this.constants.disabledPatternId + ')'); } }; @@ -268,7 +257,7 @@ Blockly.blockRendering.PathObject.prototype.updateMovable = function(enable) { * @param {boolean} enable True if styling should be added. * @package */ -Blockly.blockRendering.PathObject.prototype.updateReplacementHighlight = +Blockly.blockRendering.PathObject.prototype.updateReplacementFade = function(enable) { /* eslint-disable indent */ this.setClass_('blocklyReplaceable', enable); diff --git a/core/renderers/common/renderer.js b/core/renderers/common/renderer.js index 3ec261e2a..74b9f6f3d 100644 --- a/core/renderers/common/renderer.js +++ b/core/renderers/common/renderer.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -29,6 +18,7 @@ goog.require('Blockly.blockRendering.Drawer'); goog.require('Blockly.blockRendering.IPathObject'); goog.require('Blockly.blockRendering.PathObject'); goog.require('Blockly.blockRendering.RenderInfo'); +goog.require('Blockly.InsertionMarkerManager'); goog.requireType('Blockly.blockRendering.Debug'); @@ -54,17 +44,83 @@ Blockly.blockRendering.Renderer = function(name) { * @private */ this.constants_ = null; + + /** + * Rendering constant overrides, passed in through options. + * @type {?Object} + * @package + */ + this.overrides = null; +}; + +/** + * Gets the class name that identifies this renderer. + * @return {string} The CSS class name. + * @package + */ +Blockly.blockRendering.Renderer.prototype.getClassName = function() { + return this.name + '-renderer'; }; /** * Initialize the renderer. + * @param {!Blockly.Theme} theme The workspace theme object. + * @param {Object=} opt_rendererOverrides Rendering constant overrides. * @package */ -Blockly.blockRendering.Renderer.prototype.init = function() { +Blockly.blockRendering.Renderer.prototype.init = function(theme, + opt_rendererOverrides) { this.constants_ = this.makeConstants_(); + if (opt_rendererOverrides) { + this.overrides = opt_rendererOverrides; + Blockly.utils.object.mixin(this.constants_, opt_rendererOverrides); + } + this.constants_.setTheme(theme); this.constants_.init(); }; +/** + * Create any DOM elements that this renderer needs. + * @param {!SVGElement} svg The root of the workspace's SVG. + * @param {!Blockly.Theme} theme The workspace theme object. + * @package + */ +Blockly.blockRendering.Renderer.prototype.createDom = function(svg, theme) { + this.constants_.createDom(svg, this.name + '-' + theme.name, + '.' + this.getClassName() + '.' + theme.getClassName()); +}; + +/** + * Refresh the renderer after a theme change. + * @param {!SVGElement} svg The root of the workspace's SVG. + * @param {!Blockly.Theme} theme The workspace theme object. + * @package + */ +Blockly.blockRendering.Renderer.prototype.refreshDom = function(svg, theme) { + var previousConstants = this.getConstants(); + previousConstants.dispose(); + this.constants_ = this.makeConstants_(); + if (this.overrides) { + Blockly.utils.object.mixin(this.constants_, this.overrides); + } + // Ensure the constant provider's random identifier does not change. + this.constants_.randomIdentifier = previousConstants.randomIdentifier; + this.constants_.setTheme(theme); + this.constants_.init(); + this.createDom(svg, theme); +}; + +/** + * Dispose of this renderer. + * Delete all DOM elements that this renderer and its constants created. + * @package + */ +Blockly.blockRendering.Renderer.prototype.dispose = function() { + if (this.constants_) { + this.constants_.dispose(); + } +}; + /** * Create a new instance of the renderer's constant provider. * @return {!Blockly.blockRendering.ConstantProvider} The constant provider. @@ -106,7 +162,7 @@ Blockly.blockRendering.Renderer.prototype.makeDebugger_ = function() { if (!Blockly.blockRendering.Debug) { throw Error('Missing require for Blockly.blockRendering.Debug'); } - return new Blockly.blockRendering.Debug(); + return new Blockly.blockRendering.Debug(this.getConstants()); }; /** @@ -163,19 +219,69 @@ Blockly.blockRendering.Renderer.prototype.shouldHighlightConnection = }; /* eslint-enable indent */ /** - * Determine whether or not to insert a dragged block into a stack. - * @param {!Blockly.Block} block The target block. - * @param {!Blockly.Connection} conn The closest connection. - * @return {boolean} True if we should insert the dragged block into the stack. + * Checks if an orphaned block can connect to the "end" of the topBlock's + * block-clump. If the clump is a row the end is the last input. If the clump + * is a stack, the end is the last next connection. If the clump is neither, + * then this returns false. + * @param {!Blockly.BlockSvg} topBlock The top block of the block clump we want to try and + * connect to. + * @param {!Blockly.BlockSvg} orphanBlock The orphan block that wants to find + * a home. + * @param {number} localType The type of the connection being dragged. + * @return {boolean} Whether there is a home for the orphan or not. * @package */ -Blockly.blockRendering.Renderer.prototype.shouldInsertDraggedBlock = - function(block, conn) { - /* eslint-disable indent */ - return !conn.isConnected() || - !!Blockly.Connection.lastConnectionInRow(block, - conn.targetConnection.getSourceBlock()); -}; /* eslint-enable indent */ +Blockly.blockRendering.Renderer.prototype.orphanCanConnectAtEnd = + function(topBlock, orphanBlock, localType) { + var orphanConnection = null; + var lastConnection = null; + if (localType == Blockly.OUTPUT_VALUE) { // We are replacing an output. + orphanConnection = orphanBlock.outputConnection; + // TODO: I don't think this function necessarily has the correct logic, + // but for now it is being kept for behavioral backwards-compat. + lastConnection = Blockly.Connection + .lastConnectionInRow( + /** @type {!Blockly.Block} **/ (topBlock), orphanBlock); + } else { // We are replacing a previous. + orphanConnection = orphanBlock.previousConnection; + // TODO: This lives on the block while lastConnectionInRow lives on + // on the connection. Something is fishy. + lastConnection = topBlock.lastConnectionInStack(); + } + + if (!lastConnection) { + return false; + } + return orphanConnection.checkType(lastConnection); + }; + +/** + * Chooses a connection preview method based on the available connection, the + * current dragged connection, and the block being dragged. + * @param {!Blockly.RenderedConnection} closest The available connection. + * @param {!Blockly.RenderedConnection} local The connection currently being + * dragged. + * @param {!Blockly.BlockSvg} topBlock The block currently being dragged. + * @return {!Blockly.InsertionMarkerManager.PREVIEW_TYPE} The preview type + * to display. + * @package + */ +Blockly.blockRendering.Renderer.prototype.getConnectionPreviewMethod = + function(closest, local, topBlock) { + if (local.type == Blockly.OUTPUT_VALUE || + local.type == Blockly.PREVIOUS_STATEMENT) { + if (!closest.isConnected() || + this.orphanCanConnectAtEnd( + topBlock, + /** @type {!Blockly.BlockSvg} */ (closest.targetBlock()), + local.type)) { + return Blockly.InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER; + } + return Blockly.InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE; + } + + return Blockly.InsertionMarkerManager.PREVIEW_TYPE.INSERTION_MARKER; + }; /** * Render the block. diff --git a/core/renderers/geras/constants.js b/core/renderers/geras/constants.js index 2e4952731..0499a135b 100644 --- a/core/renderers/geras/constants.js +++ b/core/renderers/geras/constants.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -55,3 +44,21 @@ Blockly.geras.ConstantProvider = function() { }; Blockly.utils.object.inherits(Blockly.geras.ConstantProvider, Blockly.blockRendering.ConstantProvider); + + +/** + * @override + */ +Blockly.geras.ConstantProvider.prototype.getCSS_ = function(selector) { + return Blockly.geras.ConstantProvider.superClass_.getCSS_.call(this, selector) + .concat([ + /* eslint-disable indent */ + // Insertion marker. + selector + ' .blocklyInsertionMarker>.blocklyPathLight,', + selector + ' .blocklyInsertionMarker>.blocklyPathDark {', + 'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', + 'stroke: none', + '}', + /* eslint-enable indent */ + ]); +}; diff --git a/core/renderers/geras/drawer.js b/core/renderers/geras/drawer.js index d879dfdd4..2e85eac5a 100644 --- a/core/renderers/geras/drawer.js +++ b/core/renderers/geras/drawer.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/geras/highlight_constants.js b/core/renderers/geras/highlight_constants.js index a95ea2d12..a986c9e35 100644 --- a/core/renderers/geras/highlight_constants.js +++ b/core/renderers/geras/highlight_constants.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -57,6 +46,14 @@ Blockly.geras.HighlightConstantProvider = function(constants) { */ this.START_POINT = Blockly.utils.svgPaths.moveBy(this.OFFSET, this.OFFSET); +}; + +/** + * Initialize shape objects based on the constants set in the constructor. + * @package + */ +Blockly.geras.HighlightConstantProvider.prototype.init = function() { + /** * An object containing sizing and path information about inside corner * highlights. @@ -276,7 +273,9 @@ Blockly.geras.HighlightConstantProvider.prototype.makeJaggedTeeth = function() { Blockly.utils.svgPaths.moveBy(-10.2, 6.8) + Blockly.utils.svgPaths.lineTo(5.1, 2.6); return { - pathLeft: pathLeft + pathLeft: pathLeft, + height: 12, + width: 10.2 }; }; diff --git a/core/renderers/geras/highlighter.js b/core/renderers/geras/highlighter.js index a740fe1cf..811c0e16b 100644 --- a/core/renderers/geras/highlighter.js +++ b/core/renderers/geras/highlighter.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -121,11 +110,10 @@ Blockly.geras.Highlighter.prototype.drawTopCorner = function(row) { Blockly.geras.Highlighter.prototype.drawJaggedEdge_ = function(row) { if (this.info_.RTL) { - this.steps_ += Blockly.utils.svgPaths.lineOnAxis('H', row.width - this.highlightOffset_); - this.steps_ += this.jaggedTeethPaths_.pathLeft; var remainder = row.height - this.jaggedTeethPaths_.height - this.highlightOffset_; - this.steps_ += Blockly.utils.svgPaths.lineOnAxis('v', remainder); + this.steps_ += this.jaggedTeethPaths_.pathLeft + + Blockly.utils.svgPaths.lineOnAxis('v', remainder); } }; diff --git a/core/renderers/geras/info.js b/core/renderers/geras/info.js index 7fe68853d..9d20634b5 100644 --- a/core/renderers/geras/info.js +++ b/core/renderers/geras/info.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/geras/measurables/inputs.js b/core/renderers/geras/measurables/inputs.js index f662b2969..14c601768 100644 --- a/core/renderers/geras/measurables/inputs.js +++ b/core/renderers/geras/measurables/inputs.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/geras/path_object.js b/core/renderers/geras/path_object.js index 33143d729..76884c9bc 100644 --- a/core/renderers/geras/path_object.js +++ b/core/renderers/geras/path_object.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -47,7 +36,7 @@ Blockly.geras.PathObject = function(root, style, constants) { * The renderer's constant provider. * @type {!Blockly.geras.ConstantProvider} */ - this.constants_ = constants; + this.constants = constants; this.svgRoot = root; @@ -153,7 +142,7 @@ Blockly.geras.PathObject.prototype.setStyle = function(blockStyle) { Blockly.geras.PathObject.prototype.updateHighlighted = function(highlighted) { if (highlighted) { this.svgPath.setAttribute('filter', - 'url(#' + this.constants_.embossFilterId + ')'); + 'url(#' + this.constants.embossFilterId + ')'); this.svgPathLight.style.display = 'none'; } else { this.svgPath.setAttribute('filter', 'none'); diff --git a/core/renderers/geras/renderer.js b/core/renderers/geras/renderer.js index 32508972b..34a62a73a 100644 --- a/core/renderers/geras/renderer.js +++ b/core/renderers/geras/renderer.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -59,9 +48,20 @@ Blockly.utils.object.inherits(Blockly.geras.Renderer, * @package * @override */ -Blockly.geras.Renderer.prototype.init = function() { - Blockly.geras.Renderer.superClass_.init.call(this); +Blockly.geras.Renderer.prototype.init = function(theme, + opt_rendererOverrides) { + Blockly.geras.Renderer.superClass_.init.call(this, theme, + opt_rendererOverrides); this.highlightConstants_ = this.makeHighlightConstants_(); + this.highlightConstants_.init(); +}; + +/** + * @override + */ +Blockly.geras.Renderer.prototype.refreshDom = function(svg, theme) { + Blockly.geras.Renderer.superClass_.refreshDom.call(this, svg, theme); + this.getHighlightConstants().init(); }; /** diff --git a/core/renderers/measurables/base.js b/core/renderers/measurables/base.js index 43ee29618..34373af4d 100644 --- a/core/renderers/measurables/base.js +++ b/core/renderers/measurables/base.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/measurables/connections.js b/core/renderers/measurables/connections.js index 5c095433d..c9c8c5c6d 100644 --- a/core/renderers/measurables/connections.js +++ b/core/renderers/measurables/connections.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/measurables/inputs.js b/core/renderers/measurables/inputs.js index 2272755d3..8d820686d 100644 --- a/core/renderers/measurables/inputs.js +++ b/core/renderers/measurables/inputs.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/measurables/row_elements.js b/core/renderers/measurables/row_elements.js index 095449c05..a39b72021 100644 --- a/core/renderers/measurables/row_elements.js +++ b/core/renderers/measurables/row_elements.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/measurables/rows.js b/core/renderers/measurables/rows.js index 254b31e95..4227cba27 100644 --- a/core/renderers/measurables/rows.js +++ b/core/renderers/measurables/rows.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/measurables/types.js b/core/renderers/measurables/types.js index 5784e2d9e..02e5b9a9a 100644 --- a/core/renderers/measurables/types.js +++ b/core/renderers/measurables/types.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -90,7 +79,7 @@ Blockly.blockRendering.Types.nextTypeValue_ = 1 << 24; /** * Get the enum flag value of an existing type or register a new type. * @param {!string} type The name of the type. - * @return {!number} The enum flag value assosiated with that type. + * @return {!number} The enum flag value associated with that type. * @package */ Blockly.blockRendering.Types.getType = function(type) { diff --git a/core/renderers/minimalist/constants.js b/core/renderers/minimalist/constants.js index 6a9839204..fdcfc2767 100644 --- a/core/renderers/minimalist/constants.js +++ b/core/renderers/minimalist/constants.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/minimalist/drawer.js b/core/renderers/minimalist/drawer.js index f467d8bca..41a8e496b 100644 --- a/core/renderers/minimalist/drawer.js +++ b/core/renderers/minimalist/drawer.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/minimalist/info.js b/core/renderers/minimalist/info.js index bdd1b6df8..d7bbae6bf 100644 --- a/core/renderers/minimalist/info.js +++ b/core/renderers/minimalist/info.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/minimalist/renderer.js b/core/renderers/minimalist/renderer.js index e475f6e1e..f85bd9a40 100644 --- a/core/renderers/minimalist/renderer.js +++ b/core/renderers/minimalist/renderer.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/thrasos/info.js b/core/renderers/thrasos/info.js index 25014a805..480822231 100644 --- a/core/renderers/thrasos/info.js +++ b/core/renderers/thrasos/info.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/thrasos/renderer.js b/core/renderers/thrasos/renderer.js index 2e49886a3..fae501b1c 100644 --- a/core/renderers/thrasos/renderer.js +++ b/core/renderers/thrasos/renderer.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/zelos/constants.js b/core/renderers/zelos/constants.js index 97ec307a8..57ebdca11 100644 --- a/core/renderers/zelos/constants.js +++ b/core/renderers/zelos/constants.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -109,7 +98,7 @@ Blockly.zelos.ConstantProvider = function() { /** * @override */ - this.TOP_ROW_MIN_HEIGHT = this.GRID_UNIT; + this.TOP_ROW_MIN_HEIGHT = this.CORNER_RADIUS; /** * @override @@ -119,7 +108,7 @@ Blockly.zelos.ConstantProvider = function() { /** * @override */ - this.BOTTOM_ROW_MIN_HEIGHT = this.GRID_UNIT; + this.BOTTOM_ROW_MIN_HEIGHT = this.CORNER_RADIUS; /** * @override @@ -259,19 +248,7 @@ Blockly.zelos.ConstantProvider = function() { * @override */ this.FIELD_TEXT_FONTFAMILY = - '"Helvetica Neue", "Segoe UI", Helvetica, sans-serif'; - - /** - * @override - */ - this.FIELD_TEXT_HEIGHT = 13.1; - - /** - * Used by positioning text on IE and Edge as they don't support - * dominant-baseline:center. - * @override - */ - this.FIELD_TEXT_BASELINE_Y = 13.1; + '"Helvetica Neue", "Segoe UI", Helvetica, sans-serif'; /** * @override @@ -286,7 +263,7 @@ Blockly.zelos.ConstantProvider = function() { /** * @override */ - this.FIELD_BORDER_RECT_Y_PADDING = 1 * this.GRID_UNIT; + this.FIELD_BORDER_RECT_Y_PADDING = 1.625 * this.GRID_UNIT; /** * @override @@ -323,11 +300,6 @@ Blockly.zelos.ConstantProvider = function() { */ this.FIELD_TEXTINPUT_BOX_SHADOW = true; - /** - * @override - */ - this.FIELD_TEXT_Y_OFFSET = Blockly.utils.userAgent.CHROME ? -.45 : 0; - /** * @override */ @@ -346,35 +318,55 @@ Blockly.zelos.ConstantProvider = function() { /** * @override */ - this.FIELD_CHECKBOX_X_OFFSET = this.FIELD_BORDER_RECT_X_PADDING - 3; + this.FIELD_CHECKBOX_X_OFFSET = 1 * this.GRID_UNIT; /** - * @override + * The maximum width of a dynamic connection shape. + * @type {number} */ - this.FIELD_CHECKBOX_Y_OFFSET = 22; + this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH = 12 * this.GRID_UNIT; /** - * @override + * The selected glow colour. + * @type {string} */ - this.FIELD_CHECKBOX_DEFAULT_WIDTH = 6 * this.GRID_UNIT; + this.SELECTED_GLOW_COLOUR = '#fff200'; /** - * The ID of the highlight glow filter, or the empty string if no filter is + * The size of the selected glow. + * @type {number} + */ + this.SELECTED_GLOW_SIZE = 0.5; + + /** + * The replacement glow colour. + * @type {string} + */ + this.REPLACEMENT_GLOW_COLOUR = '#fff200'; + + /** + * The size of the selected glow. + * @type {number} + */ + this.REPLACEMENT_GLOW_SIZE = 2; + + /** + * The ID of the selected glow filter, or the empty string if no filter is * set. * @type {string} * @package */ - this.highlightGlowFilterId = ''; + this.selectedGlowFilterId = ''; /** - * The element to use for a higlight glow, or null if not set. + * The element to use for a selected glow, or null if not set. * @type {SVGElement} * @private */ - this.highlightGlowFilter_ = null; + this.selectedGlowFilter_ = null; /** - * The ID of the highlight glow filter, or the empty string if no filter is + * The ID of the replacement glow filter, or the empty string if no filter is * set. * @type {string} * @package @@ -382,7 +374,7 @@ Blockly.zelos.ConstantProvider = function() { this.replacementGlowFilterId = ''; /** - * The element to use for a higlight glow, or null if not set. + * The element to use for a replacement glow, or null if not set. * @type {SVGElement} * @private */ @@ -391,6 +383,18 @@ Blockly.zelos.ConstantProvider = function() { Blockly.utils.object.inherits(Blockly.zelos.ConstantProvider, Blockly.blockRendering.ConstantProvider); +/** + * @override + */ +Blockly.zelos.ConstantProvider.prototype.setFontConstants_ = function(theme) { + Blockly.zelos.ConstantProvider.superClass_.setFontConstants_.call(this, + theme); + + this.FIELD_BORDER_RECT_HEIGHT = this.FIELD_TEXT_HEIGHT + + this.FIELD_BORDER_RECT_Y_PADDING * 2; + this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT = this.FIELD_BORDER_RECT_HEIGHT; +}; + /** * @override */ @@ -400,7 +404,34 @@ Blockly.zelos.ConstantProvider.prototype.init = function() { this.ROUNDED = this.makeRounded(); this.SQUARED = this.makeSquared(); - this.STATEMENT_INPUT_NOTCH_OFFSET += this.INSIDE_CORNERS.rightWidth; + this.STATEMENT_INPUT_NOTCH_OFFSET = this.NOTCH_OFFSET_LEFT + + this.INSIDE_CORNERS.rightWidth; +}; + +/** + * @override + */ +Blockly.zelos.ConstantProvider.prototype.setDynamicProperties_ = function( + theme) { + Blockly.zelos.ConstantProvider.superClass_.setDynamicProperties_.call(this, + theme); + + this.SELECTED_GLOW_COLOUR = + theme.getComponentStyle('selectedGlowColour') || + this.SELECTED_GLOW_COLOUR; + var selectedGlowSize = + Number(theme.getComponentStyle('selectedGlowSize')); + this.SELECTED_GLOW_SIZE = + selectedGlowSize && !isNaN(selectedGlowSize) ? + selectedGlowSize : this.SELECTED_GLOW_SIZE; + this.REPLACEMENT_GLOW_COLOUR = + theme.getComponentStyle('replacementGlowColour') || + this.REPLACEMENT_GLOW_COLOUR; + var replacementGlowSize = + Number(theme.getComponentStyle('replacementGlowSize')); + this.REPLACEMENT_GLOW_SIZE = + replacementGlowSize && !isNaN(replacementGlowSize) ? + replacementGlowSize : this.REPLACEMENT_GLOW_SIZE; }; /** @@ -408,8 +439,11 @@ Blockly.zelos.ConstantProvider.prototype.init = function() { */ Blockly.zelos.ConstantProvider.prototype.dispose = function() { Blockly.zelos.ConstantProvider.superClass_.dispose.call(this); - if (this.highlightGlowFilter_) { - Blockly.utils.dom.removeNode(this.highlightGlowFilter_); + if (this.selectedGlowFilter_) { + Blockly.utils.dom.removeNode(this.selectedGlowFilter_); + } + if (this.replacementGlowFilter_) { + Blockly.utils.dom.removeNode(this.replacementGlowFilter_); } }; @@ -441,13 +475,16 @@ Blockly.zelos.ConstantProvider.prototype.makeStartHat = function() { * @package */ Blockly.zelos.ConstantProvider.prototype.makeHexagonal = function() { + var maxWidth = this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH; + // The main path for the hexagonal connection shape is made out of two lines. - // The lines are defined with relative positons and require the block height. + // The lines are defined with relative positions and require the block height. // The 'up' and 'down' versions of the paths are the same, but the Y sign // flips. The 'left' and 'right' versions of the path are also the same, but // the X sign flips. function makeMainPath(height, up, right) { - var width = height / 2; + var halfHeight = height / 2; + var width = halfHeight > maxWidth ? maxWidth : halfHeight; var forward = up ? -1 : 1; var direction = right ? -1 : 1; var dy = forward * height / 2; @@ -459,7 +496,8 @@ Blockly.zelos.ConstantProvider.prototype.makeHexagonal = function() { type: this.SHAPES.HEXAGONAL, isDynamic: true, width: function(height) { - return height / 2; + var halfHeight = height / 2; + return halfHeight > maxWidth ? maxWidth : halfHeight; }, height: function(height) { return height; @@ -492,22 +530,34 @@ Blockly.zelos.ConstantProvider.prototype.makeHexagonal = function() { * @package */ Blockly.zelos.ConstantProvider.prototype.makeRounded = function() { - // The main path for the rounded connection shape is made out of a single arc. - // The arc is defined with relative positions and requires the block height. + var maxWidth = this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH; + var maxHeight = maxWidth * 2; + + // The main path for the rounded connection shape is made out of two arcs and + // a line that joins them. The arcs are defined with relative positions. + // Usually, the height of the block is split between the two arcs. In the case + // where the height of the block exceeds the maximum height, a line is drawn + // in between the two arcs. // The 'up' and 'down' versions of the paths are the same, but the Y sign // flips. The 'up' and 'right' versions of the path flip the sweep-flag // which moves the arc at negative angles. - function makeMainPath(height, up, right) { - var edgeWidth = height / 2; - return Blockly.utils.svgPaths.arc('a', '0 0 ' + (up || right ? 1 : 0), edgeWidth, - Blockly.utils.svgPaths.point(0, (up ? -1 : 1) * edgeWidth * 2)); + function makeMainPath(blockHeight, up, right) { + var remainingHeight = blockHeight > maxHeight ? blockHeight - maxHeight : 0; + var height = blockHeight > maxHeight ? maxHeight : blockHeight; + var radius = height / 2; + return Blockly.utils.svgPaths.arc('a', '0 0,1', radius, + Blockly.utils.svgPaths.point((up ? -1 : 1) * radius, (up ? -1 : 1) * radius)) + + Blockly.utils.svgPaths.lineOnAxis('v', (right ? 1 : -1) * remainingHeight) + + Blockly.utils.svgPaths.arc('a', '0 0,1', radius, + Blockly.utils.svgPaths.point((up ? 1 : -1) * radius, (up ? -1 : 1) * radius)); } return { type: this.SHAPES.ROUND, isDynamic: true, width: function(height) { - return height / 2; + var halfHeight = height / 2; + return halfHeight > maxWidth ? maxWidth : halfHeight; }, height: function(height) { return height; @@ -600,7 +650,7 @@ Blockly.zelos.ConstantProvider.prototype.shapeFor = function( case Blockly.INPUT_VALUE: case Blockly.OUTPUT_VALUE: var outputShape = connection.getSourceBlock().getOutputShape(); - // If the block has an ouput shape set, use that instead. + // If the block has an output shape set, use that instead. if (outputShape != null) { switch (outputShape) { case this.SHAPES.HEXAGONAL: return this.HEXAGONAL; @@ -747,8 +797,10 @@ Blockly.zelos.ConstantProvider.prototype.generateTertiaryColour_ = function( /** * @override */ -Blockly.zelos.ConstantProvider.prototype.createDom = function(svg) { - Blockly.zelos.ConstantProvider.superClass_.createDom.call(this, svg); +Blockly.zelos.ConstantProvider.prototype.createDom = function(svg, + tagName, selector) { + Blockly.zelos.ConstantProvider.superClass_.createDom.call(this, svg, + tagName, selector); /* ... filters go here ... @@ -757,9 +809,9 @@ Blockly.zelos.ConstantProvider.prototype.createDom = function(svg) { var defs = Blockly.utils.dom.createSvgElement('defs', {}, svg); // Using a dilate distorts the block shape. // Instead use a gaussian blur, and then set all alpha to 1 with a transfer. - var highlightGlowFilter = Blockly.utils.dom.createSvgElement('filter', + var selectedGlowFilter = Blockly.utils.dom.createSvgElement('filter', { - 'id': 'blocklyHighlightGlowFilter' + this.randomIdentifier_, + 'id': 'blocklySelectedGlowFilter' + this.randomIdentifier, 'height': '160%', 'width': '180%', y: '-30%', @@ -769,39 +821,39 @@ Blockly.zelos.ConstantProvider.prototype.createDom = function(svg) { Blockly.utils.dom.createSvgElement('feGaussianBlur', { 'in': 'SourceGraphic', - 'stdDeviation': 0.5 // TODO: configure size in theme. + 'stdDeviation': this.SELECTED_GLOW_SIZE }, - highlightGlowFilter); + selectedGlowFilter); // Set all gaussian blur pixels to 1 opacity before applying flood - var highlightComponentTransfer = Blockly.utils.dom.createSvgElement( - 'feComponentTransfer', {'result': 'outBlur'}, highlightGlowFilter); + var selectedComponentTransfer = Blockly.utils.dom.createSvgElement( + 'feComponentTransfer', {'result': 'outBlur'}, selectedGlowFilter); Blockly.utils.dom.createSvgElement('feFuncA', { 'type': 'table', 'tableValues': '0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1' }, - highlightComponentTransfer); + selectedComponentTransfer); // Color the highlight Blockly.utils.dom.createSvgElement('feFlood', { - 'flood-color': '#fff200', // TODO: configure colour in theme. + 'flood-color': this.SELECTED_GLOW_COLOUR, 'flood-opacity': 1, 'result': 'outColor' }, - highlightGlowFilter); + selectedGlowFilter); Blockly.utils.dom.createSvgElement('feComposite', { 'in': 'outColor', 'in2': 'outBlur', 'operator': 'in', 'result': 'outGlow' }, - highlightGlowFilter); - this.highlightGlowFilterId = highlightGlowFilter.id; - this.highlightGlowFilter_ = highlightGlowFilter; + selectedGlowFilter); + this.selectedGlowFilterId = selectedGlowFilter.id; + this.selectedGlowFilter_ = selectedGlowFilter; // Using a dilate distorts the block shape. // Instead use a gaussian blur, and then set all alpha to 1 with a transfer. var replacementGlowFilter = Blockly.utils.dom.createSvgElement('filter', { - 'id': 'blocklyReplacementGlowFilter' + this.randomIdentifier_, + 'id': 'blocklyReplacementGlowFilter' + this.randomIdentifier, 'height': '160%', 'width': '180%', y: '-30%', @@ -811,7 +863,7 @@ Blockly.zelos.ConstantProvider.prototype.createDom = function(svg) { Blockly.utils.dom.createSvgElement('feGaussianBlur', { 'in': 'SourceGraphic', - 'stdDeviation': 2 // TODO: configure size in theme. + 'stdDeviation': this.REPLACEMENT_GLOW_SIZE }, replacementGlowFilter); // Set all gaussian blur pixels to 1 opacity before applying flood @@ -825,7 +877,7 @@ Blockly.zelos.ConstantProvider.prototype.createDom = function(svg) { // Color the highlight Blockly.utils.dom.createSvgElement('feFlood', { - 'flood-color': '#fff200', // TODO: configure colour in theme. + 'flood-color': this.REPLACEMENT_GLOW_COLOUR, 'flood-opacity': 1, 'result': 'outColor' }, @@ -849,17 +901,21 @@ Blockly.zelos.ConstantProvider.prototype.createDom = function(svg) { /** * @override */ -Blockly.zelos.ConstantProvider.prototype.getCSS_ = function(name) { - var selector = '.' + name + '-renderer'; +Blockly.zelos.ConstantProvider.prototype.getCSS_ = function(selector) { return [ /* eslint-disable indent */ - // Fields. - selector + ' .blocklyText {', - 'fill: #fff;', + // Text. + selector + ' .blocklyText, ', + selector + ' .blocklyFlyoutLabelText {', 'font-family: ' + this.FIELD_TEXT_FONTFAMILY + ';', 'font-size: ' + this.FIELD_TEXT_FONTSIZE + 'pt;', 'font-weight: ' + this.FIELD_TEXT_FONTWEIGHT + ';', '}', + + // Fields. + selector + ' .blocklyText {', + 'fill: #fff;', + '}', selector + ' .blocklyNonEditableText>rect:not(.blocklyDropdownRect),', selector + ' .blocklyEditableText>rect:not(.blocklyDropdownRect) {', 'fill: ' + this.FIELD_BORDER_RECT_COLOUR + ';', @@ -870,6 +926,16 @@ Blockly.zelos.ConstantProvider.prototype.getCSS_ = function(name) { selector + ' .blocklyEditableText>g>text {', 'fill: #575E75;', '}', + + // Flyout labels. + selector + ' .blocklyFlyoutLabelText {', + 'fill: #575E75;', + '}', + + // Bubbles. + selector + ' .blocklyText.blocklyBubbleText {', + 'fill: #575E75;', + '}', // Editable field hover. selector + ' .blocklyDraggable:not(.blocklyDisabled)', @@ -902,12 +968,18 @@ Blockly.zelos.ConstantProvider.prototype.getCSS_ = function(name) { // Connection highlight. selector + ' .blocklyHighlightedConnectionPath {', - 'stroke: #fff200;', + 'stroke: ' + this.SELECTED_GLOW_COLOUR + ';', '}', // Disabled outline paths. selector + ' .blocklyDisabled > .blocklyOutlinePath {', - 'fill: url(#blocklyDisabledPattern' + this.randomIdentifier_ + ')', + 'fill: url(#blocklyDisabledPattern' + this.randomIdentifier + ')', + '}', + + // Insertion marker. + selector + ' .blocklyInsertionMarker>.blocklyPath {', + 'fill-opacity: ' + this.INSERTION_MARKER_OPACITY + ';', + 'stroke: none', '}', /* eslint-enable indent */ ]; diff --git a/core/renderers/zelos/drawer.js b/core/renderers/zelos/drawer.js index 22580d233..4e15bfd01 100644 --- a/core/renderers/zelos/drawer.js +++ b/core/renderers/zelos/drawer.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -80,7 +69,9 @@ Blockly.zelos.Drawer.prototype.draw = function() { */ Blockly.zelos.Drawer.prototype.drawOutline_ = function() { if (this.info_.outputConnection && - this.info_.outputConnection.isDynamicShape) { + this.info_.outputConnection.isDynamicShape && + !this.info_.hasStatementInput && + !this.info_.bottomRow.hasNextConnection) { this.drawFlatTop_(); this.drawRightDynamicConnection_(); this.drawFlatBottom_(); @@ -90,6 +81,18 @@ Blockly.zelos.Drawer.prototype.drawOutline_ = function() { } }; +/** + * @override + */ +Blockly.zelos.Drawer.prototype.drawLeft_ = function() { + if (this.info_.outputConnection && + this.info_.outputConnection.isDynamicShape) { + this.drawLeftDynamicConnection_(); + } else { + Blockly.zelos.Drawer.superClass_.drawLeft_.call(this); + } +}; + /** * Add steps for the right side of a row that does not have value or * statement input connections. diff --git a/core/renderers/zelos/info.js b/core/renderers/zelos/info.js index c80c6b5f3..ac822772b 100644 --- a/core/renderers/zelos/info.js +++ b/core/renderers/zelos/info.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -89,6 +78,12 @@ Blockly.zelos.RenderInfo = function(renderer, block) { */ this.isMultiRow = !block.getInputsInline() || block.isCollapsed(); + /** + * Whether or not the block has a statement input in one of its rows. + * @type {boolean} + */ + this.hasStatementInput = block.statementInputCount > 0; + /** * An object with rendering information about the right connection shape. * @type {Blockly.zelos.RightConnectionShape} @@ -112,7 +107,7 @@ Blockly.zelos.RenderInfo.prototype.getRenderer = function() { * @override */ Blockly.zelos.RenderInfo.prototype.measure = function() { - // Modifing parent measure method to add `adjustXPosition_`. + // Modifying parent measure method to add `adjustXPosition_`. this.createRows_(); this.addElemSpacing_(); this.addRowSpacing_(); @@ -164,7 +159,8 @@ Blockly.zelos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) { if (!prev || !next) { // No need for padding at the beginning or end of the row if the // output shape is dynamic. - if (this.outputConnection && this.outputConnection.isDynamicShape) { + if (this.outputConnection && this.outputConnection.isDynamicShape && + !this.hasStatementInput && !this.bottomRow.hasNextConnection) { return this.constants_.NO_PADDING; } } @@ -205,21 +201,28 @@ Blockly.zelos.RenderInfo.prototype.getSpacerRowHeight_ = function( Blockly.blockRendering.Types.isInputRow(next) && next.hasStatement; if (precedesStatement || followsStatement) { var cornerHeight = this.constants_.INSIDE_CORNERS.rightHeight || 0; - var height = Math.max(this.constants_.MEDIUM_PADDING, - Math.max(this.constants_.NOTCH_HEIGHT, cornerHeight)); + var height = Math.max(this.constants_.NOTCH_HEIGHT, cornerHeight); return precedesStatement && followsStatement ? Math.max(height, this.constants_.DUMMY_INPUT_MIN_HEIGHT) : height; } // Top and bottom rows act as a spacer so we don't need any extra padding. if ((Blockly.blockRendering.Types.isTopRow(prev))) { - if (!prev.hasPreviousConnection && !this.outputConnection) { - return this.constants_.SMALL_PADDING; + if (!prev.hasPreviousConnection && + (!this.outputConnection || this.hasStatementInput)) { + return Math.abs(this.constants_.NOTCH_HEIGHT - + this.constants_.CORNER_RADIUS); } return this.constants_.NO_PADDING; } if ((Blockly.blockRendering.Types.isBottomRow(next))) { if (!this.outputConnection) { - return this.constants_.SMALL_PADDING; + var topHeight = Math.max(this.topRow.minHeight, + Math.max(this.constants_.NOTCH_HEIGHT, + this.constants_.CORNER_RADIUS)) - this.constants_.CORNER_RADIUS; + return topHeight; + } else if (!next.hasNextConnection && this.hasStatementInput) { + return Math.abs(this.constants_.NOTCH_HEIGHT - + this.constants_.CORNER_RADIUS); } return this.constants_.NO_PADDING; } @@ -242,9 +245,17 @@ Blockly.zelos.RenderInfo.prototype.getSpacerRowWidth_ = function(prev, next) { * @override */ Blockly.zelos.RenderInfo.prototype.getElemCenterline_ = function(row, elem) { - if (row.hasStatement && !Blockly.blockRendering.Types.isSpacer(elem)) { + if (row.hasStatement && !Blockly.blockRendering.Types.isSpacer(elem) && + !Blockly.blockRendering.Types.isStatementInput(elem)) { return row.yPos + this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT / 2; } + if (Blockly.blockRendering.Types.isInlineInput(elem)) { + var connectedBlock = elem.connectedBlock; + if (connectedBlock && connectedBlock.outputConnection && + connectedBlock.nextConnection) { + return row.yPos + connectedBlock.height / 2; + } + } return Blockly.zelos.RenderInfo.superClass_.getElemCenterline_.call(this, row, elem); }; @@ -261,31 +272,7 @@ Blockly.zelos.RenderInfo.prototype.addInput_ = function(input, activeRow) { input.align == Blockly.ALIGN_RIGHT) { activeRow.rightAlignedDummyInput = input; } - // Non-dummy inputs have visual representations onscreen. - if (this.isInline && input.type == Blockly.INPUT_VALUE) { - activeRow.elements.push( - new Blockly.blockRendering.InlineInput(this.constants_, input)); - activeRow.hasInlineInput = true; - } else if (input.type == Blockly.NEXT_STATEMENT) { - activeRow.elements.push( - new Blockly.zelos.StatementInput(this.constants_, input)); - activeRow.hasStatement = true; - } else if (input.type == Blockly.INPUT_VALUE) { - activeRow.elements.push( - new Blockly.blockRendering.ExternalValueInput(this.constants_, input)); - activeRow.hasExternalInput = true; - } else if (input.type == Blockly.DUMMY_INPUT) { - // Dummy inputs have no visual representation, but the information is still - // important. - activeRow.minHeight = Math.max(activeRow.minHeight, - input.getSourceBlock() && input.getSourceBlock().isShadow() ? - this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT : - this.constants_.DUMMY_INPUT_MIN_HEIGHT); - activeRow.hasDummyInput = true; - } - if (activeRow.align == null) { - activeRow.align = input.align; - } + Blockly.zelos.RenderInfo.superClass_.addInput_.call(this, input, activeRow); }; /** @@ -385,8 +372,10 @@ Blockly.zelos.RenderInfo.prototype.finalizeOutputConnection_ = function() { this.height = yCursor; // Adjust the height of the output connection. - var connectionHeight = this.outputConnection.shape.height(yCursor); - var connectionWidth = this.outputConnection.shape.width(yCursor); + var blockHeight = this.bottomRow.hasNextConnection ? + this.height - this.bottomRow.descenderHeight : this.height; + var connectionHeight = this.outputConnection.shape.height(blockHeight); + var connectionWidth = this.outputConnection.shape.width(blockHeight); this.outputConnection.height = connectionHeight; this.outputConnection.width = connectionWidth; @@ -396,15 +385,19 @@ Blockly.zelos.RenderInfo.prototype.finalizeOutputConnection_ = function() { this.outputConnection.connectionOffsetX = this.outputConnection.shape.connectionOffsetX(connectionWidth); - // Adjust right side measurable. - this.rightSide.height = connectionHeight; - this.rightSide.width = connectionWidth; - this.rightSide.centerline = connectionHeight / 2; - this.rightSide.xPos = this.width + connectionWidth; - + // Add the right connection measurable. + // Don't add it if we have a value-to-statement or a value-to-stack block. + var rightConnectionWidth = 0; + if (!this.hasStatementInput && !this.bottomRow.hasNextConnection) { + rightConnectionWidth = connectionWidth; + this.rightSide.height = connectionHeight; + this.rightSide.width = rightConnectionWidth; + this.rightSide.centerline = connectionHeight / 2; + this.rightSide.xPos = this.width + rightConnectionWidth; + } this.startX = connectionWidth; - this.width += connectionWidth * 2; - this.widthWithChildren += connectionWidth * 2; + this.width += connectionWidth + rightConnectionWidth; + this.widthWithChildren += connectionWidth + rightConnectionWidth; }; /** @@ -415,7 +408,8 @@ Blockly.zelos.RenderInfo.prototype.finalizeOutputConnection_ = function() { * @protected */ Blockly.zelos.RenderInfo.prototype.finalizeHorizontalAlignment_ = function() { - if (!this.outputConnection) { + if (!this.outputConnection || this.hasStatementInput || + this.bottomRow.hasNextConnection) { return; } var totalNegativeSpacing = 0; @@ -448,9 +442,9 @@ Blockly.zelos.RenderInfo.prototype.finalizeHorizontalAlignment_ = function() { this.widthWithChildren -= totalNegativeSpacing; this.rightSide.xPos -= totalNegativeSpacing; for (var i = 0, row; (row = this.rows[i]); i++) { - if (Blockly.blockRendering.Types.isTopRow(row) || - Blockly.blockRendering.Types.isBottomRow(row)) { + if (Blockly.blockRendering.Types.isTopOrBottomRow(row)) { row.elements[1].width -= totalNegativeSpacing; + row.elements[1].widthWithConnectedBlocks -= totalNegativeSpacing; } row.width -= totalNegativeSpacing; row.widthWithConnectedBlocks -= totalNegativeSpacing; @@ -474,23 +468,30 @@ Blockly.zelos.RenderInfo.prototype.getNegativeSpacing_ = function(elem) { var outerShape = this.outputConnection.shape.type; var constants = /** @type {!Blockly.zelos.ConstantProvider} */ (this.constants_); - if (this.isMultiRow && this.inputRowNum_ > 1) { + if (this.isMultiRow && this.inputRows.length > 1) { switch (outerShape) { case constants.SHAPES.ROUND: // Special case for multi-row round reporter blocks. - var radius = this.height / 2; + var maxWidth = this.constants_.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH; + var width = this.height / 2 > maxWidth ? maxWidth : this.height / 2; var topPadding = this.constants_.SMALL_PADDING; - var roundPadding = radius * - (1 - Math.sin(Math.acos((radius - topPadding) / radius))); + var roundPadding = width * + (1 - Math.sin(Math.acos((width - topPadding) / width))); return connectionWidth - roundPadding; default: return 0; } } if (Blockly.blockRendering.Types.isInlineInput(elem)) { - var innerShape = elem.connectedBlock ? - elem.connectedBlock.pathObject.outputShapeType : + var connectedBlock = elem.connectedBlock; + var innerShape = connectedBlock ? + connectedBlock.pathObject.outputShapeType : elem.shape.type; + // Special case for value to stack / value to statement blocks. + if (connectedBlock && connectedBlock.outputConnection && + (connectedBlock.statementInputCount || connectedBlock.nextConnection)) { + return 0; + } // Special case for hexagonal output. if (outerShape == constants.SHAPES.HEXAGONAL && outerShape != innerShape) { @@ -579,4 +580,8 @@ Blockly.zelos.RenderInfo.prototype.finalize_ = function() { this.finalizeHorizontalAlignment_(); this.finalizeVerticalAlignment_(); Blockly.zelos.RenderInfo.superClass_.finalize_.call(this); + + if (this.rightSide) { + this.widthWithChildren += this.rightSide.width; + } }; diff --git a/core/renderers/zelos/marker_svg.js b/core/renderers/zelos/marker_svg.js index 7d262043f..7c9bdd120 100644 --- a/core/renderers/zelos/marker_svg.js +++ b/core/renderers/zelos/marker_svg.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -50,9 +39,7 @@ Blockly.zelos.MarkerSvg.prototype.showWithInput_ = function(curNode) { var connection = curNode.getLocation(); var offsetInBlock = connection.getOffsetInBlock(); - var y = offsetInBlock.y + this.constants_.CURSOR_RADIUS; - - this.positionCircle_(offsetInBlock.x, y); + this.positionCircle_(offsetInBlock.x, offsetInBlock.y); this.setParent_(block); this.showCurrent_(); }; @@ -130,8 +117,6 @@ Blockly.zelos.MarkerSvg.prototype.createDomInternal_ = function() { this.markerCircle_ = Blockly.utils.dom.createSvgElement('circle', { 'r': this.constants_.CURSOR_RADIUS, 'style': 'display: none', - 'fill': this.colour_, - 'stroke': this.colour_, 'stroke-width': this.constants_.CURSOR_STROKE_WIDTH }, this.markerSvg_); @@ -146,3 +131,17 @@ Blockly.zelos.MarkerSvg.prototype.createDomInternal_ = function() { return this.markerSvg_; }; +/** + * @override + */ +Blockly.zelos.MarkerSvg.prototype.applyColour_ = function() { + Blockly.zelos.MarkerSvg.superClass_.applyColour_.call(this); + + this.markerCircle_.setAttribute('fill', this.colour_); + this.markerCircle_.setAttribute('stroke', this.colour_); + + if (this.isCursor()) { + var values = this.colour_ + ';transparent;transparent;'; + this.markerCircle_.firstChild.setAttribute('values', values); + } +}; diff --git a/core/renderers/zelos/measurables/inputs.js b/core/renderers/zelos/measurables/inputs.js index b7ecab505..beb16f40b 100644 --- a/core/renderers/zelos/measurables/inputs.js +++ b/core/renderers/zelos/measurables/inputs.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/zelos/measurables/row_elements.js b/core/renderers/zelos/measurables/row_elements.js index ba6bb2de0..98a331b5e 100644 --- a/core/renderers/zelos/measurables/row_elements.js +++ b/core/renderers/zelos/measurables/row_elements.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/renderers/zelos/measurables/rows.js b/core/renderers/zelos/measurables/rows.js index 5b025eda2..2c9437edf 100644 --- a/core/renderers/zelos/measurables/rows.js +++ b/core/renderers/zelos/measurables/rows.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -73,7 +62,8 @@ Blockly.zelos.TopRow.prototype.hasLeftSquareCorner = function(block) { * @override */ Blockly.zelos.TopRow.prototype.hasRightSquareCorner = function(block) { - return !!block.outputConnection; + return !!block.outputConnection && !block.statementInputCount && + !block.nextConnection; }; /** @@ -113,5 +103,6 @@ Blockly.zelos.BottomRow.prototype.hasLeftSquareCorner = function(block) { * @override */ Blockly.zelos.BottomRow.prototype.hasRightSquareCorner = function(block) { - return !!block.outputConnection; + return !!block.outputConnection && !block.statementInputCount && + !block.nextConnection; }; diff --git a/core/renderers/zelos/path_object.js b/core/renderers/zelos/path_object.js index 70ced53b9..360f329af 100644 --- a/core/renderers/zelos/path_object.js +++ b/core/renderers/zelos/path_object.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -49,7 +38,7 @@ Blockly.zelos.PathObject = function(root, style, constants) { * The renderer's constant provider. * @type {!Blockly.zelos.ConstantProvider} */ - this.constants_ = constants; + this.constants = constants; /** * The selected path of the block. @@ -68,7 +57,7 @@ Blockly.zelos.PathObject = function(root, style, constants) { /** * A set used to determine which outlines were used during a draw pass. The * set is initialized with a reference to all the outlines in - * `this.outlines_`. Everytime we use an outline during the draw pass, the + * `this.outlines_`. Every time we use an outline during the draw pass, the * reference is removed from this set. * @type {Object.} * @private @@ -135,7 +124,7 @@ Blockly.zelos.PathObject.prototype.updateSelected = function(enable) { /** @type {!SVGElement} */ (this.svgPath.cloneNode(true)); this.svgPathSelected_.setAttribute('fill', 'none'); this.svgPathSelected_.setAttribute('filter', - 'url(#' + this.constants_.highlightGlowFilterId + ')'); + 'url(#' + this.constants.selectedGlowFilterId + ')'); this.svgRoot.appendChild(this.svgPathSelected_); } } else { @@ -149,12 +138,12 @@ Blockly.zelos.PathObject.prototype.updateSelected = function(enable) { /** * @override */ -Blockly.zelos.PathObject.prototype.updateReplacementHighlight = function( +Blockly.zelos.PathObject.prototype.updateReplacementFade = function( enable) { this.setClass_('blocklyReplaceable', enable); if (enable) { this.svgPath.setAttribute('filter', - 'url(#' + this.constants_.replacementGlowFilterId + ')'); + 'url(#' + this.constants.replacementGlowFilterId + ')'); } else { this.svgPath.removeAttribute('filter'); } @@ -172,7 +161,7 @@ Blockly.zelos.PathObject.prototype.updateShapeForInputHighlight = function( } if (enable) { outlinePath.setAttribute('filter', - 'url(#' + this.constants_.replacementGlowFilterId + ')'); + 'url(#' + this.constants.replacementGlowFilterId + ')'); } else { outlinePath.removeAttribute('filter'); } diff --git a/core/renderers/zelos/renderer.js b/core/renderers/zelos/renderer.js index 5f805baf8..a9ee7f0e3 100644 --- a/core/renderers/zelos/renderer.js +++ b/core/renderers/zelos/renderer.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -25,6 +14,7 @@ goog.provide('Blockly.zelos.Renderer'); goog.require('Blockly.blockRendering'); goog.require('Blockly.blockRendering.Renderer'); +goog.require('Blockly.InsertionMarkerManager'); goog.require('Blockly.utils.object'); goog.require('Blockly.zelos.ConstantProvider'); goog.require('Blockly.zelos.Drawer'); @@ -119,9 +109,22 @@ Blockly.zelos.Renderer.prototype.shouldHighlightConnection = function(conn) { /** * @override */ -Blockly.zelos.Renderer.prototype.shouldInsertDraggedBlock = function(_block, - _conn) { - return false; -}; +Blockly.zelos.Renderer.prototype.getConnectionPreviewMethod = + function(closest, local, topBlock) { + if (local.type == Blockly.OUTPUT_VALUE) { + if (!closest.isConnected()) { + return Blockly.InsertionMarkerManager.PREVIEW_TYPE.INPUT_OUTLINE; + } + // TODO: Returning this is a total hack, because we don't want to show + // a replacement fade, we want to show an outline affect. + // Sadly zelos does not support showing an outline around filled + // inputs, so we have to pretend like the connected block is getting + // replaced. + return Blockly.InsertionMarkerManager.PREVIEW_TYPE.REPLACEMENT_FADE; + } + + return Blockly.zelos.Renderer.superClass_ + .getConnectionPreviewMethod(closest, local, topBlock); + }; Blockly.blockRendering.register('zelos', Blockly.zelos.Renderer); diff --git a/core/requires.js b/core/requires.js index 223bc7d6d..a9c87b5f6 100644 --- a/core/requires.js +++ b/core/requires.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -75,7 +64,7 @@ goog.require('Blockly.FieldNumber'); goog.require('Blockly.FieldVariable'); // If you'd like to include the date field in your build, you will also need to -// include the closure library as a build dependency. You can do so by running: +// include the Closure library as a build dependency. You can do so by running: // gulp build-compressed --closure-library // Be sure to also include "google-closure-library" to your list of // devDependencies. diff --git a/core/scrollbar.js b/core/scrollbar.js index 9d20f89dc..eaa522c5b 100644 --- a/core/scrollbar.js +++ b/core/scrollbar.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2011 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/theme.js b/core/theme.js index 70aa6fba2..311782f55 100644 --- a/core/theme.js +++ b/core/theme.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -24,27 +13,27 @@ goog.provide('Blockly.Theme'); goog.require('Blockly.utils'); goog.require('Blockly.utils.colour'); +goog.require('Blockly.utils.object'); /** * Class for a theme. * @param {string} name Theme name. - * @param {!Object.} blockStyles A map from - * style names (strings) to objects with style attributes for blocks. - * @param {!Object.} categoryStyles A map - * from style names (strings) to objects with style attributes for + * @param {!Object.=} opt_blockStyles A map + * from style names (strings) to objects with style attributes for blocks. + * @param {!Object.=} opt_categoryStyles A + * map from style names (strings) to objects with style attributes for * categories. - * @param {!Object.=} opt_componentStyles A map of Blockly component - * names to style value. + * @param {!Blockly.Theme.ComponentStyle=} opt_componentStyles A map of Blockly + * component names to style value. * @constructor */ -Blockly.Theme = function(name, blockStyles, categoryStyles, +Blockly.Theme = function(name, opt_blockStyles, opt_categoryStyles, opt_componentStyles) { /** * The theme name. This can be used to reference a specific theme in CSS. * @type {string} - * @package */ this.name = name; @@ -53,42 +42,119 @@ Blockly.Theme = function(name, blockStyles, categoryStyles, * @type {!Object.} * @package */ - this.blockStyles = blockStyles; + this.blockStyles = opt_blockStyles || Object.create(null); /** * The category styles map. * @type {!Object.} * @package */ - this.categoryStyles = categoryStyles; + this.categoryStyles = opt_categoryStyles || Object.create(null); /** * The UI components styles map. - * @type {!Object.} - * @private + * @type {!Blockly.Theme.ComponentStyle} + * @package */ - this.componentStyles_ = opt_componentStyles || Object.create(null); + this.componentStyles = opt_componentStyles || + (/** @type {Blockly.Theme.ComponentStyle} */ (Object.create(null))); + + /** + * The font style. + * @type {!Blockly.Theme.FontStyle} + * @package + */ + this.fontStyle = /** @type {Blockly.Theme.FontStyle} */ (Object.create(null)); + + /** + * Whether or not to add a 'hat' on top of all blocks with no previous or + * output connections. + * @type {?boolean} + * @package + */ + this.startHats = null; }; /** * A block style. * @typedef {{ - * colourPrimary:string, - * colourSecondary:string, - * colourTertiary:string, - * hat:string - * }} - */ + * colourPrimary:string, + * colourSecondary:string, + * colourTertiary:string, + * hat:string + * }} + */ Blockly.Theme.BlockStyle; /** * A category style. * @typedef {{ - * colour:string - * }} - */ + * colour:string + * }} + */ Blockly.Theme.CategoryStyle; +/** + * A component style. + * @typedef {{ + * workspaceBackgroundColour:string?, + * toolboxBackgroundColour:string?, + * toolboxForegroundColour:string?, + * flyoutBackgroundColour:string?, + * flyoutForegroundColour:string?, + * flyoutOpacity:number?, + * scrollbarColour:string?, + * scrollbarOpacity:number?, + * insertionMarkerColour:string?, + * insertionMarkerOpacity:number?, + * markerColour:string?, + * cursorColour:string?, + * selectedGlowColour:string?, + * selectedGlowOpacity:number?, + * replacementGlowColour:string?, + * replacementGlowOpacity:number? + * }} + */ +Blockly.Theme.ComponentStyle; + +/** + * A font style. + * @typedef {{ + * family:string?, + * weight:string?, + * size:number? + * }} + */ +Blockly.Theme.FontStyle; + +/** + * Gets the class name that identifies this theme. + * @return {string} The CSS class name. + * @package + */ +Blockly.Theme.prototype.getClassName = function() { + return this.name + '-theme'; +}; + +/** + * Overrides or adds a style to the blockStyles map. + * @param {string} blockStyleName The name of the block style. + * @param {Blockly.Theme.BlockStyle} blockStyle The block style. +*/ +Blockly.Theme.prototype.setBlockStyle = function(blockStyleName, blockStyle) { + this.blockStyles[blockStyleName] = blockStyle; +}; + +/** + * Overrides or adds a style to the categoryStyles map. + * @param {string} categoryStyleName The name of the category style. + * @param {Blockly.Theme.CategoryStyle} categoryStyle The category style. +*/ +Blockly.Theme.prototype.setCategoryStyle = function(categoryStyleName, + categoryStyle) { + this.categoryStyles[categoryStyleName] = categoryStyle; +}; + /** * Gets the style for a given Blockly UI component. If the style value is a * string, we attempt to find the value of any named references. @@ -96,7 +162,7 @@ Blockly.Theme.CategoryStyle; * @return {?string} The style value. */ Blockly.Theme.prototype.getComponentStyle = function(componentName) { - var style = this.componentStyles_[componentName]; + var style = this.componentStyles[componentName]; if (style && typeof propertyValue == 'string' && this.getComponentStyle(/** @type {string} */ (style))) { return this.getComponentStyle(/** @type {string} */ (style)); @@ -111,5 +177,50 @@ Blockly.Theme.prototype.getComponentStyle = function(componentName) { */ Blockly.Theme.prototype.setComponentStyle = function(componentName, styleValue) { - this.componentStyles_[componentName] = styleValue; + this.componentStyles[componentName] = styleValue; +}; + +/** + * Configure a theme's font style. + * @param {Blockly.Theme.FontStyle} fontStyle The font style. +*/ +Blockly.Theme.prototype.setFontStyle = function(fontStyle) { + this.fontStyle = fontStyle; +}; + +/** + * Configure a theme's start hats. + * @param {boolean} startHats True if the theme enables start hats, false + * otherwise. +*/ +Blockly.Theme.prototype.setStartHats = function(startHats) { + this.startHats = startHats; +}; + +/** + * Define a new Blockly theme. + * @param {string} name The name of the theme. + * @param {!Object} themeObj An object containing theme properties. + * @return {!Blockly.Theme} A new Blockly theme. +*/ +Blockly.Theme.defineTheme = function(name, themeObj) { + var theme = new Blockly.Theme(name); + var base = themeObj['base']; + if (base && base instanceof Blockly.Theme) { + Blockly.utils.object.deepMerge(theme, base); + theme.name = name; + } + + Blockly.utils.object.deepMerge(theme.blockStyles, + themeObj['blockStyles']); + Blockly.utils.object.deepMerge(theme.categoryStyles, + themeObj['categoryStyles']); + Blockly.utils.object.deepMerge(theme.componentStyles, + themeObj['componentStyles']); + Blockly.utils.object.deepMerge(theme.fontStyle, + themeObj['fontStyle']); + if (themeObj['startHats'] != null) { + theme.startHats = themeObj['startHats']; + } + return theme; }; diff --git a/core/theme/classic.js b/core/theme/classic.js index b39836de4..5c128eb18 100644 --- a/core/theme/classic.js +++ b/core/theme/classic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/theme/dark.js b/core/theme/dark.js index e9b7697b2..c8cc976a4 100644 --- a/core/theme/dark.js +++ b/core/theme/dark.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -23,143 +12,21 @@ goog.provide('Blockly.Themes.Dark'); -goog.require('Blockly.Css'); goog.require('Blockly.Theme'); - -// Temporary holding object. -Blockly.Themes.Dark = {}; - -Blockly.Themes.Dark.defaultBlockStyles = { - "colour_blocks": { - "colourPrimary": "#a5745b", - "colourSecondary": "#dbc7bd", - "colourTertiary": "#845d49" - }, - "list_blocks": { - "colourPrimary": "#745ba5", - "colourSecondary": "#c7bddb", - "colourTertiary": "#5d4984" - }, - "logic_blocks": { - "colourPrimary": "#5b80a5", - "colourSecondary": "#bdccdb", - "colourTertiary": "#496684" - }, - "loop_blocks": { - "colourPrimary": "#5ba55b", - "colourSecondary": "#bddbbd", - "colourTertiary": "#498449" - }, - "math_blocks": { - "colourPrimary": "#5b67a5", - "colourSecondary": "#bdc2db", - "colourTertiary": "#495284" - }, - "procedure_blocks": { - "colourPrimary": "#995ba5", - "colourSecondary": "#d6bddb", - "colourTertiary": "#7a4984" - }, - "text_blocks": { - "colourPrimary": "#5ba58c", - "colourSecondary": "#bddbd1", - "colourTertiary": "#498470" - }, - "variable_blocks": { - "colourPrimary": "#a55b99", - "colourSecondary": "#dbbdd6", - "colourTertiary": "#84497a" - }, - "variable_dynamic_blocks": { - "colourPrimary": "#a55b99", - "colourSecondary": "#dbbdd6", - "colourTertiary": "#84497a" - }, - "hat_blocks": { - "colourPrimary": "#a55b99", - "colourSecondary": "#dbbdd6", - "colourTertiary": "#84497a", - "hat": "cap" +Blockly.Themes.Dark = Blockly.Theme.defineTheme('dark', { + 'base': Blockly.Themes.Classic, + 'componentStyles': { + 'workspaceBackgroundColour': '#1e1e1e', + 'toolboxBackgroundColour': '#333', + 'toolboxForegroundColour': '#fff', + 'flyoutBackgroundColour': '#252526', + 'flyoutForegroundColour': '#ccc', + 'flyoutOpacity': 1, + 'scrollbarColour': '#797979', + 'insertionMarkerColour': '#fff', + 'insertionMarkerOpacity': 0.3, + 'scrollbarOpacity': 0.4, + 'cursorColour': '#d0d0d0' } -}; - -Blockly.Themes.Dark.categoryStyles = { - "colour_category": { - "colour": "#a5745b" - }, - "list_category": { - "colour": "#745ba5" - }, - "logic_category": { - "colour": "#5b80a5" - }, - "loop_category": { - "colour": "#5ba55b" - }, - "math_category": { - "colour": "#5b67a5" - }, - "procedure_category": { - "colour": "#995ba5" - }, - "text_category": { - "colour": "#5ba58c" - }, - "variable_category": { - "colour": "#a55b99" - }, - "variable_dynamic_category": { - "colour": "#a55b99" - } -}; - -// This style is still being fleshed out and may change. -Blockly.Themes.Dark = - new Blockly.Theme('dark', Blockly.Themes.Dark.defaultBlockStyles, - Blockly.Themes.Dark.categoryStyles); - -Blockly.Themes.Dark.setComponentStyle('workspaceBackgroundColour', '#1e1e1e'); -Blockly.Themes.Dark.setComponentStyle('toolboxBackgroundColour', '#333'); -Blockly.Themes.Dark.setComponentStyle('toolboxForegroundColour', '#fff'); -Blockly.Themes.Dark.setComponentStyle('flyoutBackgroundColour', '#252526'); -Blockly.Themes.Dark.setComponentStyle('flyoutForegroundColour', '#ccc'); -Blockly.Themes.Dark.setComponentStyle('flyoutOpacity', 1); -Blockly.Themes.Dark.setComponentStyle('scrollbarColour', '#797979'); -Blockly.Themes.Dark.setComponentStyle('scrollbarOpacity', 0.4); - -/** - * CSS for the dark theme. - * This registers CSS that is specific to this theme. It does so by prepending a - * ``.dark-theme`` selector before every CSS rule that we wish to override by - * this theme. - */ -(function() { - var selector = '.dark-theme'; - Blockly.Css.register([ - /* eslint-disable indent */ - // Toolbox hover - selector + ' .blocklyTreeRow:not(.blocklyTreeSelected):hover {', - 'background-color: #2a2d2e;', - '}', - // Dropdown and Widget div. - selector + '.blocklyWidgetDiv .goog-menu, ', - selector + '.blocklyDropDownDiv {', - 'background-color: #3c3c3c;', - '}', - selector + '.blocklyDropDownDiv {', - 'border-color: #565656;', - '}', - selector + '.blocklyWidgetDiv .goog-menuitem-content, ', - selector + '.blocklyDropDownDiv .goog-menuitem-content {', - 'color: #f0f0f0;', - '}', - selector + '.blocklyWidgetDiv .goog-menuitem-disabled', - ' .goog-menuitem-content,', - selector + '.blocklyDropDownDiv .goog-menuitem-disabled', - ' .goog-menuitem-content {', - 'color: #8a8a8a !important;', - '}', - /* eslint-enable indent */ - ]); -})(); +}); diff --git a/core/theme/deuteranopia.js b/core/theme/deuteranopia.js index dbd1bfbab..94deac221 100644 --- a/core/theme/deuteranopia.js +++ b/core/theme/deuteranopia.js @@ -1,24 +1,13 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview Deuteranopia theme. - * A color palette for people that have deuteranopia(the inability to perceive - * green light). This can also be used for people that have protanopia(the + * A colour palette for people that have deuteranopia (the inability to perceive + * green light). This can also be used for people that have protanopia (the * inability to perceive red light). */ 'use strict'; diff --git a/core/theme/highcontrast.js b/core/theme/highcontrast.js index 3f2c15850..bd1084354 100644 --- a/core/theme/highcontrast.js +++ b/core/theme/highcontrast.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -118,3 +107,13 @@ Blockly.Themes.HighContrast = new Blockly.Theme('highcontrast', Blockly.Themes.HighContrast.defaultBlockStyles, Blockly.Themes.HighContrast.categoryStyles); + +Blockly.Themes.HighContrast.setComponentStyle('selectedGlowColour', '#000000'); +Blockly.Themes.HighContrast.setComponentStyle('selectedGlowSize', 1); +Blockly.Themes.HighContrast.setComponentStyle('replacementGlowColour', '#000000'); + +Blockly.Themes.HighContrast.setFontStyle({ + 'family': null, // Use default font-family + 'weight': null, // Use default font-weight + 'size': 16 +}); diff --git a/core/theme/modern.js b/core/theme/modern.js index 9d6cc6afd..2ed8a6845 100644 --- a/core/theme/modern.js +++ b/core/theme/modern.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/theme/tritanopia.js b/core/theme/tritanopia.js index d90d86aa0..544e10600 100644 --- a/core/theme/tritanopia.js +++ b/core/theme/tritanopia.js @@ -1,23 +1,12 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview Tritanopia theme. - * A color palette for people that have tritanopia(the inability to perceive + * A color palette for people that have tritanopia (the inability to perceive * blue light). */ 'use strict'; diff --git a/core/theme/zelos.js b/core/theme/zelos.js index c6305ee62..361b9e4d0 100644 --- a/core/theme/zelos.js +++ b/core/theme/zelos.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/theme_manager.js b/core/theme_manager.js index 48003911e..5cd193c63 100644 --- a/core/theme_manager.js +++ b/core/theme_manager.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -90,11 +79,6 @@ Blockly.ThemeManager.prototype.getTheme = function() { * @package */ Blockly.ThemeManager.prototype.setTheme = function(theme) { - if (this.theme_ === theme) { - // No change. - return; - } - var prevTheme = this.theme_; this.theme_ = theme; @@ -102,9 +86,9 @@ Blockly.ThemeManager.prototype.setTheme = function(theme) { var injectionDiv = this.workspace_.getInjectionDiv(); if (injectionDiv) { if (prevTheme) { - Blockly.utils.dom.removeClass(injectionDiv, prevTheme.name + '-theme'); + Blockly.utils.dom.removeClass(injectionDiv, prevTheme.getClassName()); } - Blockly.utils.dom.addClass(injectionDiv, this.theme_.name + '-theme'); + Blockly.utils.dom.addClass(injectionDiv, this.theme_.getClassName()); } // Refresh all subscribed workspaces. diff --git a/core/toolbox.js b/core/toolbox.js index c0a82d8ea..c79e5f585 100644 --- a/core/toolbox.js +++ b/core/toolbox.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2011 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -186,7 +175,8 @@ Blockly.Toolbox.prototype.init = function() { 'rtl': workspace.RTL, 'oneBasedIndex': workspace.options.oneBasedIndex, 'horizontalLayout': workspace.horizontalLayout, - 'renderer': workspace.options.renderer + 'renderer': workspace.options.renderer, + 'rendererOverrides': workspace.options.rendererOverrides })); workspaceOptions.toolboxPosition = workspace.options.toolboxPosition; @@ -312,7 +302,7 @@ Blockly.Toolbox.prototype.handleAfterTreeSelected_ = function( } if (oldNode != newNode && oldNode != this) { var event = new Blockly.Events.Ui(null, 'category', - oldNode && oldNode.getText(), newNode && newNode.getText()); + oldNode && oldNode.content, newNode && newNode.content); event.workspaceId = this.workspace_.id; Blockly.Events.fire(event); } @@ -719,7 +709,7 @@ Blockly.Toolbox.prototype.refreshSelection = function() { Blockly.Toolbox.prototype.selectFirstCategory = function() { var selectedItem = this.tree_.getSelectedItem(); if (!selectedItem) { - this.tree_.selectFirst(); + this.tree_.selectChild(); } }; @@ -791,7 +781,7 @@ Blockly.Css.register([ '}', '.blocklyTreeRow:not(.blocklyTreeSelected):hover {', - 'background-color: #e4e4e4;', + 'background-color: rgba(255, 255, 255, 0.2);', '}', '.blocklyTreeSeparator {', diff --git a/core/tooltip.js b/core/tooltip.js index 28ddefeb8..966807dc7 100644 --- a/core/tooltip.js +++ b/core/tooltip.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2011 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -132,7 +121,8 @@ Blockly.Tooltip.createDom = function() { // Create an HTML container for popup overlays (e.g. editor widgets). Blockly.Tooltip.DIV = document.createElement('div'); Blockly.Tooltip.DIV.className = 'blocklyTooltipDiv'; - document.body.appendChild(Blockly.Tooltip.DIV); + var container = Blockly.parentContainer || document.body; + container.appendChild(Blockly.Tooltip.DIV); }; /** @@ -140,9 +130,9 @@ Blockly.Tooltip.createDom = function() { * @param {!Element} element SVG element onto which tooltip is to be bound. */ Blockly.Tooltip.bindMouseEvents = function(element) { - Blockly.bindEvent_(element, 'mouseover', null, + element.mouseOverWrapper_ = Blockly.bindEvent_(element, 'mouseover', null, Blockly.Tooltip.onMouseOver_); - Blockly.bindEvent_(element, 'mouseout', null, + element.mouseOutWrapper_ = Blockly.bindEvent_(element, 'mouseout', null, Blockly.Tooltip.onMouseOut_); // Don't use bindEvent_ for mousemove since that would create a @@ -151,6 +141,19 @@ Blockly.Tooltip.bindMouseEvents = function(element) { element.addEventListener('mousemove', Blockly.Tooltip.onMouseMove_, false); }; +/** + * Unbinds tooltip mouse events from the SVG element. + * @param {!Element} element SVG element onto which tooltip is bound. + */ +Blockly.Tooltip.unbindMouseEvents = function(element) { + if (!element) { + return; + } + Blockly.unbindEvent_(element.mouseOverWrapper_); + Blockly.unbindEvent_(element.mouseOutWrapper_); + element.removeEventListener('mousemove', Blockly.Tooltip.onMouseMove_); +}; + /** * Hide the tooltip if the mouse is over a different object. * Initialize the tooltip to potentially appear for this object. @@ -234,6 +237,16 @@ Blockly.Tooltip.onMouseMove_ = function(e) { } }; +/** + * Dispose of the tooltip. + * @package + */ +Blockly.Tooltip.dispose = function() { + Blockly.Tooltip.element_ = null; + Blockly.Tooltip.poisonedElement_ = null; + Blockly.Tooltip.hide(); +}; + /** * Hide the tooltip. */ @@ -282,7 +295,7 @@ Blockly.Tooltip.show_ = function() { return; } // Erase all existing text. - Blockly.Tooltip.DIV.innerHTML = ''; + Blockly.Tooltip.DIV.textContent = ''; // Get the new text. var tip = Blockly.Tooltip.element_.tooltip; while (typeof tip == 'function') { diff --git a/core/touch.js b/core/touch.js index 2c5094ae6..e21d88f16 100644 --- a/core/touch.js +++ b/core/touch.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/touch_gesture.js b/core/touch_gesture.js index 374fdddb5..ff4c8f02f 100644 --- a/core/touch_gesture.js +++ b/core/touch_gesture.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/trashcan.js b/core/trashcan.js index fde748787..5c45cf82b 100644 --- a/core/trashcan.js +++ b/core/trashcan.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2011 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -67,7 +56,8 @@ Blockly.Trashcan = function(workspace) { 'parentWorkspace': this.workspace_, 'rtl': this.workspace_.RTL, 'oneBasedIndex': this.workspace_.options.oneBasedIndex, - 'renderer': this.workspace_.options.renderer + 'renderer': this.workspace_.options.renderer, + 'rendererOverrides': this.workspace_.options.rendererOverrides })); // Create vertical or horizontal flyout. if (this.workspace_.horizontalLayout) { @@ -92,56 +82,56 @@ Blockly.Trashcan = function(workspace) { /** * Width of both the trash can and lid images. - * @type {number} + * @const {number} * @private */ Blockly.Trashcan.prototype.WIDTH_ = 47; /** * Height of the trashcan image (minus lid). - * @type {number} + * @const {number} * @private */ Blockly.Trashcan.prototype.BODY_HEIGHT_ = 44; /** * Height of the lid image. - * @type {number} + * @const {number} * @private */ Blockly.Trashcan.prototype.LID_HEIGHT_ = 16; /** * Distance between trashcan and bottom edge of workspace. - * @type {number} + * @const {number} * @private */ Blockly.Trashcan.prototype.MARGIN_BOTTOM_ = 20; /** * Distance between trashcan and right edge of workspace. - * @type {number} + * @const {number} * @private */ Blockly.Trashcan.prototype.MARGIN_SIDE_ = 20; /** * Extent of hotspot on all sides beyond the size of the image. - * @type {number} + * @const {number} * @private */ Blockly.Trashcan.prototype.MARGIN_HOTSPOT_ = 10; /** * Location of trashcan in sprite image. - * @type {number} + * @const {number} * @private */ Blockly.Trashcan.prototype.SPRITE_LEFT_ = 0; /** * Location of trashcan in sprite image. - * @type {number} + * @const {number} * @private */ Blockly.Trashcan.prototype.SPRITE_TOP_ = 32; @@ -149,10 +139,46 @@ Blockly.Trashcan.prototype.SPRITE_TOP_ = 32; /** * The openness of the lid when the trashcan contains blocks. * (0.0 = closed, 1.0 = open) - * @type {number} + * @const {number} * @private */ -Blockly.Trashcan.prototype.HAS_BLOCKS_LID_ANGLE = 0.1; +Blockly.Trashcan.prototype.HAS_BLOCKS_LID_ANGLE_ = 0.1; + +/** + * The length of the open/close animation in milliseconds. + * @const {number} + * @private + */ +Blockly.Trashcan.ANIMATION_LENGTH_ = 80; + +/** + * The number of frames in the animation. + * @const {number} + * @private + */ +Blockly.Trashcan.ANIMATION_FRAMES_ = 4; + +/** + * The minimum (resting) opacity of the trashcan and lid. + * @const {number} + * @private + */ +Blockly.Trashcan.OPACITY_MIN_ = 0.4; + +/** + * The maximum (hovered) opacity of the trashcan and lid. + * @const {number} + * @private + */ +Blockly.Trashcan.OPACITY_MAX_ = 0.8; + +/** + * The maximum angle the trashcan lid can opens to. At the end of the open + * animation the lid will be open to this angle. + * @const {number} + * @private + */ +Blockly.Trashcan.MAX_LID_ANGLE_ = 45; /** * Current open/close state of the lid. @@ -316,6 +342,29 @@ Blockly.Trashcan.prototype.dispose = function() { clearTimeout(this.lidTask_); }; +/** + * Returns true if the trashcan contents-flyout is currently open. + * @return {boolean} True if the trashcan contents-flyout is currently open. + */ +Blockly.Trashcan.prototype.contentsIsOpen = function() { + return this.flyout.isVisible(); +}; + +/** + * Empties the trashcan's contents. If the contents-flyout is currently open + * it will be closed. + */ +Blockly.Trashcan.prototype.emptyContents = function() { + if (!this.contents_.length) { + return; + } + this.contents_.length = 0; + this.setMinOpenness_(0); + if (this.contentsIsOpen()) { + this.flyout.hide(); + } +}; + /** * Position the trashcan. * It is positioned in the opposite corner to the corner the @@ -389,14 +438,23 @@ Blockly.Trashcan.prototype.setOpen = function(state) { * @private */ Blockly.Trashcan.prototype.animateLid_ = function() { - this.lidOpen_ += this.isOpen ? 0.2 : -0.2; + var frames = Blockly.Trashcan.ANIMATION_FRAMES_; + + var delta = 1 / (frames + 1); + this.lidOpen_ += this.isOpen ? delta : -delta; this.lidOpen_ = Math.min(Math.max(this.lidOpen_, this.minOpenness_), 1); - this.setLidAngle_(this.lidOpen_ * 45); - // Linear interpolation between 0.4 and 0.8. - var opacity = 0.4 + this.lidOpen_ * (0.8 - 0.4); + + this.setLidAngle_(this.lidOpen_ * Blockly.Trashcan.MAX_LID_ANGLE_); + + var minOpacity = Blockly.Trashcan.OPACITY_MIN_; + var maxOpacity = Blockly.Trashcan.OPACITY_MAX_; + // Linear interpolation between min and max. + var opacity = minOpacity + this.lidOpen_ * (maxOpacity - minOpacity); this.svgGroup_.style.opacity = opacity; + if (this.lidOpen_ > this.minOpenness_ && this.lidOpen_ < 1) { - this.lidTask_ = setTimeout(this.animateLid_.bind(this), 20); + this.lidTask_ = setTimeout(this.animateLid_.bind(this), + Blockly.Trashcan.ANIMATION_LENGTH_ / frames); } }; @@ -414,6 +472,20 @@ Blockly.Trashcan.prototype.setLidAngle_ = function(lidAngle) { (this.LID_HEIGHT_ - 2) + ')'); }; +/** + * Sets the minimum openness of the trashcan lid. If the lid is currently + * closed, this will update lid's position. + * @param {number} newMin The new minimum openness of the lid. Should be between + * 0 and 1. + * @private + */ +Blockly.Trashcan.prototype.setMinOpenness_ = function(newMin) { + this.minOpenness_ = newMin; + if (!this.isOpen) { + this.setLidAngle_(newMin * Blockly.Trashcan.MAX_LID_ANGLE_); + } +}; + /** * Flip the lid shut. * Called externally after a drag. @@ -479,8 +551,7 @@ Blockly.Trashcan.prototype.onDelete_ = function(event) { this.contents_.pop(); } - this.minOpenness_ = this.HAS_BLOCKS_LID_ANGLE; - this.setLidAngle_(this.minOpenness_ * 45); + this.setMinOpenness_(this.HAS_BLOCKS_LID_ANGLE_); } }; diff --git a/core/ui_events.js b/core/ui_events.js index cc8cabcfb..693b7443d 100644 --- a/core/ui_events.js +++ b/core/ui_events.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/ui_menu_utils.js b/core/ui_menu_utils.js index bd77bf750..321501e23 100644 --- a/core/ui_menu_utils.js +++ b/core/ui_menu_utils.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils.js b/core/utils.js index 2bacaee0d..cfd047ca1 100644 --- a/core/utils.js +++ b/core/utils.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -590,7 +579,7 @@ Blockly.utils.getBlockTypeCounts = function(block, opt_stripFollowing) { * Converts screen coordinates to workspace coordinates. * @param {Blockly.WorkspaceSvg} ws The workspace to find the coordinates on. * @param {Blockly.utils.Coordinate} screenCoordinates The screen coordinates to - * be converted to workspace coordintaes + * be converted to workspace coordinates * @return {Blockly.utils.Coordinate} The workspace coordinates. * @package */ diff --git a/core/utils/aria.js b/core/utils/aria.js index 3ba1eac11..eab295f12 100644 --- a/core/utils/aria.js +++ b/core/utils/aria.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/colour.js b/core/utils/colour.js index fb1c82709..ded55d5e9 100644 --- a/core/utils/colour.js +++ b/core/utils/colour.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/coordinate.js b/core/utils/coordinate.js index a2f843e95..be17d00a1 100644 --- a/core/utils/coordinate.js +++ b/core/utils/coordinate.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/dom.js b/core/utils/dom.js index c2337e595..c68f98778 100644 --- a/core/utils/dom.js +++ b/core/utils/dom.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -291,6 +280,24 @@ Blockly.utils.dom.getTextWidth = function(textElement) { */ Blockly.utils.dom.getFastTextWidth = function(textElement, fontSize, fontWeight, fontFamily) { + return Blockly.utils.dom.getFastTextWidthWithSizeString(textElement, + fontSize + 'pt', fontWeight, fontFamily); +}; + +/** + * Gets the width of a text element using a faster method than `getTextWidth`. + * This method requires that we know the text element's font family and size in + * advance. Similar to `getTextWidth`, we cache the width we compute. + * This method is similar to ``getFastTextWidth`` but expects the font size + * parameter to be a string. + * @param {!Element} textElement An SVG 'text' element. + * @param {string} fontSize The font size to use. + * @param {string} fontWeight The font weight to use. + * @param {string} fontFamily The font family to use. + * @return {number} Width of element. + */ +Blockly.utils.dom.getFastTextWidthWithSizeString = function(textElement, + fontSize, fontWeight, fontFamily) { var text = textElement.textContent; var key = text + '\n' + textElement.className.baseVal; var width; @@ -316,7 +323,7 @@ Blockly.utils.dom.getFastTextWidth = function(textElement, } // Set the desired font size and family. Blockly.utils.dom.canvasContext_.font = - fontWeight + ' ' + fontSize + 'pt ' + fontFamily; + fontWeight + ' ' + fontSize + ' ' + fontFamily; // Measure the text width using the helper canvas context. width = Blockly.utils.dom.canvasContext_.measureText(text).width; @@ -327,3 +334,40 @@ Blockly.utils.dom.getFastTextWidth = function(textElement, } return width; }; + +/** + * Measure a font's metrics. The height and baseline values. + * @param {string} text Text to measure the font dimensions of. + * @param {string} fontSize The font size to use. + * @param {string} fontWeight The font weight to use. + * @param {string} fontFamily The font family to use. + * @return {{height: number, baseline: number}} Font measurements. + */ +Blockly.utils.dom.measureFontMetrics = function(text, fontSize, fontWeight, + fontFamily) { + + var span = document.createElement('span'); + span.style.font = fontWeight + ' ' + fontSize + ' ' + fontFamily; + span.textContent = text; + + var block = document.createElement('div'); + block.style.width = '1px'; + block.style.height = '0px'; + + var div = document.createElement('div'); + div.setAttribute('style', 'position: fixed; top: 0; left: 0; display: flex;'); + div.appendChild(span); + div.appendChild(block); + + document.body.appendChild(div); + try { + var result = {}; + div.style.alignItems = 'baseline'; + result.baseline = block.offsetTop - span.offsetTop; + div.style.alignItems = 'flex-end'; + result.height = block.offsetTop - span.offsetTop; + } finally { + document.body.removeChild(div); + } + return result; +}; diff --git a/core/utils/global.js b/core/utils/global.js index bf12c6b25..bbb6eb898 100644 --- a/core/utils/global.js +++ b/core/utils/global.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/idgenerator.js b/core/utils/idgenerator.js index 88a1a84cb..81bd405a6 100644 --- a/core/utils/idgenerator.js +++ b/core/utils/idgenerator.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/keycodes.js b/core/utils/keycodes.js index f156765d7..2129dadf1 100644 --- a/core/utils/keycodes.js +++ b/core/utils/keycodes.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/math.js b/core/utils/math.js index 9bd1fe928..516972579 100644 --- a/core/utils/math.js +++ b/core/utils/math.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/object.js b/core/utils/object.js index 2a9b848a9..0212f3fdc 100644 --- a/core/utils/object.js +++ b/core/utils/object.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -48,6 +37,24 @@ Blockly.utils.object.mixin = function(target, source) { } }; +/** + * Complete a deep merge of all members of a source object with a target object. + * @param {!Object} target Target. + * @param {!Object} source Source. + * @return {!Object} The resulting object. + */ +Blockly.utils.object.deepMerge = function(target, source) { + for (var x in source) { + if (typeof source[x] === 'object') { + target[x] = Blockly.utils.object.deepMerge( + target[x] || Object.create(null), source[x]); + } else { + target[x] = source[x]; + } + } + return target; +}; + /** * Returns an array of a given object's own enumerable property values. * @param {!Object} obj Object containing values. diff --git a/core/utils/rect.js b/core/utils/rect.js index 1e5406c3d..296c0fcda 100644 --- a/core/utils/rect.js +++ b/core/utils/rect.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/size.js b/core/utils/size.js index 45ff4a158..66c9d0be1 100644 --- a/core/utils/size.js +++ b/core/utils/size.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/string.js b/core/utils/string.js index 1d468e567..2d1b8e6e1 100644 --- a/core/utils/string.js +++ b/core/utils/string.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/style.js b/core/utils/style.js index 3e01fe053..d236e5ab2 100644 --- a/core/utils/style.js +++ b/core/utils/style.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/svg_paths.js b/core/utils/svg_paths.js index 34f4d8c0b..d2066599a 100644 --- a/core/utils/svg_paths.js +++ b/core/utils/svg_paths.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -44,7 +33,7 @@ Blockly.utils.svgPaths.point = function(x, y) { }; /** - * Draw a curbic or quadratic curve. See + * Draw a cubic or quadratic curve. See * developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Cubic_B%C3%A9zier_Curve * These coordinates are unitless and hence in the user coordinate system. * @param {string} command The command to use. diff --git a/core/utils/useragent.js b/core/utils/useragent.js index f34d73e74..401a49afb 100644 --- a/core/utils/useragent.js +++ b/core/utils/useragent.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/utils/xml.js b/core/utils/xml.js index ec6302b10..4bd3f7dfa 100644 --- a/core/utils/xml.js +++ b/core/utils/xml.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/variable_events.js b/core/variable_events.js index 36018019b..78c6d65c4 100644 --- a/core/variable_events.js +++ b/core/variable_events.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/variable_map.js b/core/variable_map.js index dc8bf709e..4b6059ead 100644 --- a/core/variable_map.js +++ b/core/variable_map.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/variable_model.js b/core/variable_model.js index 89e0ca17d..6de5c7067 100644 --- a/core/variable_model.js +++ b/core/variable_model.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/variables.js b/core/variables.js index 5e260990d..271439a60 100644 --- a/core/variables.js +++ b/core/variables.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/variables_dynamic.js b/core/variables_dynamic.js index e7490dd19..d9669b68e 100644 --- a/core/variables_dynamic.js +++ b/core/variables_dynamic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/warning.js b/core/warning.js index 6d0f4d9eb..7a5364c5b 100644 --- a/core/warning.js +++ b/core/warning.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/widgetdiv.js b/core/widgetdiv.js index 326ee0cff..3529a4400 100644 --- a/core/widgetdiv.js +++ b/core/widgetdiv.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2013 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -48,17 +37,17 @@ Blockly.WidgetDiv.dispose_ = null; /** * A class name representing the current owner's workspace renderer. - * @type {?string} + * @type {string} * @private */ -Blockly.WidgetDiv.rendererClassName_ = null; +Blockly.WidgetDiv.rendererClassName_ = ''; /** * A class name representing the current owner's workspace theme. - * @type {?string} + * @type {string} * @private */ -Blockly.WidgetDiv.themeClassName_ = null; +Blockly.WidgetDiv.themeClassName_ = ''; /** * Create the widget div and inject it onto the page. @@ -73,7 +62,8 @@ Blockly.WidgetDiv.createDom = function() { */ Blockly.WidgetDiv.DIV = document.createElement('div'); Blockly.WidgetDiv.DIV.className = 'blocklyWidgetDiv'; - document.body.appendChild(Blockly.WidgetDiv.DIV); + var container = Blockly.parentContainer || document.body; + container.appendChild(Blockly.WidgetDiv.DIV); }; /** @@ -91,9 +81,9 @@ Blockly.WidgetDiv.show = function(newOwner, rtl, dispose) { div.style.direction = rtl ? 'rtl' : 'ltr'; div.style.display = 'block'; Blockly.WidgetDiv.rendererClassName_ = - Blockly.getMainWorkspace().getRenderer().name + '-renderer'; + Blockly.getMainWorkspace().getRenderer().getClassName(); Blockly.WidgetDiv.themeClassName_ = - Blockly.getMainWorkspace().getTheme().name + '-theme'; + Blockly.getMainWorkspace().getTheme().getClassName(); Blockly.utils.dom.addClass(div, Blockly.WidgetDiv.rendererClassName_); Blockly.utils.dom.addClass(div, Blockly.WidgetDiv.themeClassName_); }; @@ -102,23 +92,26 @@ Blockly.WidgetDiv.show = function(newOwner, rtl, dispose) { * Destroy the widget and hide the div. */ Blockly.WidgetDiv.hide = function() { - var div = Blockly.WidgetDiv.DIV; - if (Blockly.WidgetDiv.owner_) { - Blockly.WidgetDiv.owner_ = null; - div.style.display = 'none'; - div.style.left = ''; - div.style.top = ''; - Blockly.WidgetDiv.dispose_ && Blockly.WidgetDiv.dispose_(); - Blockly.WidgetDiv.dispose_ = null; - div.innerHTML = ''; + if (!Blockly.WidgetDiv.isVisible()) { + return; } + Blockly.WidgetDiv.owner_ = null; + + var div = Blockly.WidgetDiv.DIV; + div.style.display = 'none'; + div.style.left = ''; + div.style.top = ''; + Blockly.WidgetDiv.dispose_ && Blockly.WidgetDiv.dispose_(); + Blockly.WidgetDiv.dispose_ = null; + div.textContent = ''; + if (Blockly.WidgetDiv.rendererClassName_) { Blockly.utils.dom.removeClass(div, Blockly.WidgetDiv.rendererClassName_); - Blockly.WidgetDiv.rendererClassName_ = null; + Blockly.WidgetDiv.rendererClassName_ = ''; } if (Blockly.WidgetDiv.themeClassName_) { Blockly.utils.dom.removeClass(div, Blockly.WidgetDiv.themeClassName_); - Blockly.WidgetDiv.themeClassName_ = null; + Blockly.WidgetDiv.themeClassName_ = ''; } Blockly.getMainWorkspace().markFocused(); }; diff --git a/core/workspace.js b/core/workspace.js index 0596c2d8b..28a0ab817 100644 --- a/core/workspace.js +++ b/core/workspace.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/workspace_audio.js b/core/workspace_audio.js index 1c24f742b..9d2b358ff 100644 --- a/core/workspace_audio.js +++ b/core/workspace_audio.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/workspace_comment.js b/core/workspace_comment.js index 5d06eec21..3edaa4814 100644 --- a/core/workspace_comment.js +++ b/core/workspace_comment.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/workspace_comment_render_svg.js b/core/workspace_comment_render_svg.js index c2bc5f047..ee997e161 100644 --- a/core/workspace_comment_render_svg.js +++ b/core/workspace_comment_render_svg.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/workspace_comment_svg.js b/core/workspace_comment_svg.js index a2fcef7cc..f4b97a136 100644 --- a/core/workspace_comment_svg.js +++ b/core/workspace_comment_svg.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/workspace_drag_surface_svg.js b/core/workspace_drag_surface_svg.js index 70a5dd360..0a224fc87 100644 --- a/core/workspace_drag_surface_svg.js +++ b/core/workspace_drag_surface_svg.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/workspace_dragger.js b/core/workspace_dragger.js index 8d4d10568..d1ef7b708 100644 --- a/core/workspace_dragger.js +++ b/core/workspace_dragger.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/workspace_events.js b/core/workspace_events.js index b3b690f25..de98c5896 100644 --- a/core/workspace_events.js +++ b/core/workspace_events.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/workspace_svg.js b/core/workspace_svg.js index 5e72f231a..060ec942c 100644 --- a/core/workspace_svg.js +++ b/core/workspace_svg.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -116,6 +105,22 @@ Blockly.WorkspaceSvg = function(options, */ this.markerManager_ = new Blockly.MarkerManager(this); + /** + * Map from function names to callbacks, for deciding what to do when a custom + * toolbox category is opened. + * @type {!Object.>} + * @private + */ + this.toolboxCategoryCallbacks_ = {}; + + /** + * Map from function names to callbacks, for deciding what to do when a button + * is clicked. + * @type {!Object.} + * @private + */ + this.flyoutButtonCallbacks_ = {}; + if (Blockly.Variables && Blockly.Variables.flyoutCategory) { this.registerToolboxCategoryCallback(Blockly.VARIABLE_CATEGORY_NAME, Blockly.Variables.flyoutCategory); @@ -139,13 +144,15 @@ Blockly.WorkspaceSvg = function(options, this.options.parentWorkspace.getThemeManager() : new Blockly.ThemeManager(this, this.options.theme || Blockly.Themes.Classic); + this.themeManager_.subscribeWorkspace(this); /** * The block renderer used for rendering blocks on this workspace. * @type {!Blockly.blockRendering.Renderer} * @private */ - this.renderer_ = Blockly.blockRendering.init(this.options.renderer || 'geras'); + this.renderer_ = Blockly.blockRendering.init(this.options.renderer || 'geras', + this.getTheme(), this.options.rendererOverrides); /** * Cached parent SVG. @@ -154,13 +161,9 @@ Blockly.WorkspaceSvg = function(options, */ this.cachedParentSvg_ = null; - this.themeManager_.subscribeWorkspace(this); - this.renderer_.getConstants().refreshTheme(this.getTheme()); - /** * True if keyboard accessibility mode is on, false otherwise. * @type {boolean} - * @package */ this.keyboardAccessibilityMode = false; }; @@ -387,26 +390,11 @@ Blockly.WorkspaceSvg.prototype.injectionDiv_ = null; */ Blockly.WorkspaceSvg.prototype.lastRecordedPageScroll_ = null; -/** - * Map from function names to callbacks, for deciding what to do when a button - * is clicked. - * @type {!Object.} - * @private - */ -Blockly.WorkspaceSvg.prototype.flyoutButtonCallbacks_ = {}; - -/** - * Map from function names to callbacks, for deciding what to do when a custom - * toolbox category is opened. - * @type {!Object.>} - * @private - */ -Blockly.WorkspaceSvg.prototype.toolboxCategoryCallbacks_ = {}; - /** * Developers may define this function to add custom menu options to the * workspace's context menu or edit the workspace-created set of menu options. * @param {!Array.} options List of menu options to add to. + * @param {!Event} e The right-click event that triggered the context menu. */ Blockly.WorkspaceSvg.prototype.configureContextMenu; @@ -527,7 +515,9 @@ Blockly.WorkspaceSvg.prototype.setTheme = function(theme) { * @package */ Blockly.WorkspaceSvg.prototype.refreshTheme = function() { - this.getRenderer().getConstants().refreshTheme(this.getTheme()); + if (this.svgGroup_) { + this.renderer_.refreshDom(this.svgGroup_, this.getTheme()); + } // Update all blocks in workspace that have a style name. this.updateBlockStyles_(this.getAllBlocks(false).filter( @@ -542,6 +532,11 @@ Blockly.WorkspaceSvg.prototype.refreshTheme = function() { this.toolbox_.updateColourFromTheme(); } + // Re-render if workspace is visible + if (this.isVisible()) { + this.setVisible(true); + } + var event = new Blockly.Events.Ui(null, 'theme', null, null); event.workspaceId = this.id; Blockly.Events.fire(event); @@ -753,9 +748,7 @@ Blockly.WorkspaceSvg.prototype.createDom = function(opt_backgroundClass) { this.markerManager_.registerMarker(Blockly.navigation.MARKER_NAME, new Blockly.Marker()); - var constants = this.getRenderer().getConstants(); - constants.injectCSS(this.getRenderer().name); - constants.createDom(this.svgGroup_); + this.renderer_.createDom(this.svgGroup_, this.getTheme()); return this.svgGroup_; }; @@ -807,7 +800,7 @@ Blockly.WorkspaceSvg.prototype.dispose = function() { this.grid_ = null; } - this.renderer_.getConstants().dispose(); + this.renderer_.dispose(); if (this.themeManager_) { this.themeManager_.unsubscribeWorkspace(this); @@ -899,7 +892,8 @@ Blockly.WorkspaceSvg.prototype.addFlyout = function(tagName) { 'rtl': this.RTL, 'oneBasedIndex': this.options.oneBasedIndex, 'horizontalLayout': this.horizontalLayout, - 'renderer': this.options.renderer + 'renderer': this.options.renderer, + 'rendererOverrides': this.options.rendererOverrides })); workspaceOptions.toolboxPosition = this.options.toolboxPosition; if (this.horizontalLayout) { @@ -914,6 +908,7 @@ Blockly.WorkspaceSvg.prototype.addFlyout = function(tagName) { this.flyout_ = new Blockly.VerticalFlyout(workspaceOptions); } this.flyout_.autoClose = false; + this.flyout_.getWorkspace().setVisible(true); // Return the element so that callers can place it in their desired // spot in the DOM. For example, mutator flyouts do not go in the same place @@ -1160,6 +1155,10 @@ Blockly.WorkspaceSvg.prototype.getWidth = function() { * @param {boolean} isVisible True if workspace should be visible. */ Blockly.WorkspaceSvg.prototype.setVisible = function(isVisible) { + this.isVisible_ = isVisible; + if (!this.svgGroup_) { + return; + } // Tell the scrollbar whether its container is visible so it can // tell when to hide itself. @@ -1192,7 +1191,6 @@ Blockly.WorkspaceSvg.prototype.setVisible = function(isVisible) { } else { Blockly.hideChaff(true); } - this.isVisible_ = isVisible; }; /** @@ -1212,6 +1210,8 @@ Blockly.WorkspaceSvg.prototype.render = function() { imList[i].render(false); } } + + this.markerManager_.updateMarkers(); }; /** @@ -1807,7 +1807,7 @@ Blockly.WorkspaceSvg.prototype.showContextMenu = function(e) { // Allow the developer to add or modify menuOptions. if (this.configureContextMenu) { - this.configureContextMenu(menuOptions); + this.configureContextMenu(menuOptions, e); } Blockly.ContextMenu.show(e, menuOptions, this.RTL); @@ -2082,31 +2082,26 @@ Blockly.WorkspaceSvg.prototype.centerOnBlock = function(id) { // Workspace scale, used to convert from workspace coordinates to pixels. var scale = this.scale; - // Center in pixels. 0, 0 is at the workspace origin. These numbers may - // be negative. + // Center of block in pixels, relative to workspace origin (center 0,0). + // Scrolling to here would put the block in the top-left corner of the + // visible workspace. var pixelX = blockCenterX * scale; var pixelY = blockCenterY * scale; var metrics = this.getMetrics(); - // Scrolling to here would put the block in the top-left corner of the - // visible workspace. - var scrollToBlockX = pixelX - metrics.contentLeft; - var scrollToBlockY = pixelY - metrics.contentTop; - // viewHeight and viewWidth are in pixels. var halfViewWidth = metrics.viewWidth / 2; var halfViewHeight = metrics.viewHeight / 2; // Put the block in the center of the visible workspace instead. - var scrollToCenterX = scrollToBlockX - halfViewWidth; - var scrollToCenterY = scrollToBlockY - halfViewHeight; + var scrollToCenterX = pixelX - halfViewWidth; + var scrollToCenterY = pixelY - halfViewHeight; // Convert from workspace directions to canvas directions. - var x = -scrollToCenterX - metrics.contentLeft; - var y = -scrollToCenterY - metrics.contentTop; + var x = -scrollToCenterX; + var y = -scrollToCenterY; - Blockly.hideChaff(); this.scroll(x, y); }; @@ -2157,6 +2152,19 @@ Blockly.WorkspaceSvg.prototype.setScale = function(newScale) { } }; + +/** + * Get the workspace's zoom factor. If the workspace has a parent, we call into + * the parent to get the workspace scale. + * @return {number} The workspace zoom factor. Units: (pixels / workspaceUnit). + */ +Blockly.WorkspaceSvg.prototype.getScale = function() { + if (this.options.parentWorkspace) { + return this.options.parentWorkspace.getScale(); + } + return this.scale; +}; + /** * Scroll the workspace to a specified offset (in pixels), keeping in the * workspace bounds. See comment on workspaceSvg.scrollX for more detail on @@ -2302,7 +2310,7 @@ Blockly.WorkspaceSvg.getContentDimensionsBounded_ = function(ws, svgSize) { var halfWidth = viewWidth / 2; var halfHeight = viewHeight / 2; - // Add a border around the content that is at least half a screenful wide. + // Add a border around the content that is at least half a screen wide. // Ensure border is wide enough that blocks can scroll over entire screen. var left = Math.min(content.left - halfWidth, content.right - viewWidth); var right = Math.max(content.right + halfWidth, content.left + viewWidth); diff --git a/core/ws_comment_events.js b/core/ws_comment_events.js index 7e62d5451..6a88af290 100644 --- a/core/ws_comment_events.js +++ b/core/ws_comment_events.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/core/xml.js b/core/xml.js index a1a4dd970..e5d7cd6e3 100644 --- a/core/xml.js +++ b/core/xml.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -303,7 +292,9 @@ Blockly.Xml.domToText = function(dom) { oldText = text; text = text.replace(regexp, '$1 $2'); } while (text != oldText); - return text; + // Unpack self-closing tags. These tags fail when embedded in HTML. + // -> + return text.replace(/<(\w+)([^<]*)\/>/g, '<$1$2>'); }; /** diff --git a/core/zoom_controls.js b/core/zoom_controls.js index 0683b1535..802b8ce91 100644 --- a/core/zoom_controls.js +++ b/core/zoom_controls.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/analytics.js b/demos/blockfactory/analytics.js index e3d112f20..b22070844 100644 --- a/demos/blockfactory/analytics.js +++ b/demos/blockfactory/analytics.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/app_controller.js b/demos/blockfactory/app_controller.js index 3693b8dd6..911d3ae95 100644 --- a/demos/blockfactory/app_controller.js +++ b/demos/blockfactory/app_controller.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -173,7 +162,7 @@ AppController.prototype.formatBlockLibraryForImport_ = function(xmlText) { // since the addition to editorWorkspaceXml below removes it from inputXml. var inputChildren = Array.from(inputXml.children); - // Create empty map. The line below creates a truly empy object. It doesn't + // Create empty map. The line below creates a truly empty object. It doesn't // have built-in attributes/functions such as length or toString. var blockXmlTextMap = Object.create(null); diff --git a/demos/blockfactory/block_definition_extractor.js b/demos/blockfactory/block_definition_extractor.js index f684c75df..10d9d0f7b 100644 --- a/demos/blockfactory/block_definition_extractor.js +++ b/demos/blockfactory/block_definition_extractor.js @@ -556,7 +556,7 @@ BlockDefinitionExtractor.buildFieldColour_ = }; /** - * Creates a element representing a FieldVaraible definition. + * Creates a element representing a FieldVariable definition. * * @param {string} fieldName The identifying name of the field. * @param {string} varName The variables @@ -579,7 +579,7 @@ BlockDefinitionExtractor.buildFieldVariable_ = function(fieldName, varName) { * @param {string} src The URL of the field image. * @param {number} width The pixel width of the source image * @param {number} height The pixel height of the source image. - * @param {string} alt Alterante text to describe image. + * @param {string} alt Alternate text to describe image. * @private */ BlockDefinitionExtractor.buildFieldImage_ = @@ -693,7 +693,7 @@ BlockDefinitionExtractor.typeList_ = function() { * Creates a element representing the given custom connection * constraint type name. * - * @param {string} type The connection constratin type name. + * @param {string} type The connection constraint type name. * @return {Element} The element representing a custom input type * constraint. * @private diff --git a/demos/blockfactory/block_exporter_controller.js b/demos/blockfactory/block_exporter_controller.js index 37d2f15f6..525a2fefc 100644 --- a/demos/blockfactory/block_exporter_controller.js +++ b/demos/blockfactory/block_exporter_controller.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/block_exporter_tools.js b/demos/blockfactory/block_exporter_tools.js index 495d77211..3446312df 100644 --- a/demos/blockfactory/block_exporter_tools.js +++ b/demos/blockfactory/block_exporter_tools.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/block_exporter_view.js b/demos/blockfactory/block_exporter_view.js index 39fa67c81..f505438a7 100644 --- a/demos/blockfactory/block_exporter_view.js +++ b/demos/blockfactory/block_exporter_view.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -62,7 +51,7 @@ BlockExporterView.prototype.select = function(blockType) { /** * Deselects a block in the selector. - * @param {!Blockly.Block} block Type of block to add to selector workspce. + * @param {!Blockly.Block} block Type of block to add to selector workspace. */ BlockExporterView.prototype.deselect = function(blockType) { this.blockOptions[blockType].setSelected(false); diff --git a/demos/blockfactory/block_library_controller.js b/demos/blockfactory/block_library_controller.js index cdd32bca2..25156e9ce 100644 --- a/demos/blockfactory/block_library_controller.js +++ b/demos/blockfactory/block_library_controller.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/block_library_storage.js b/demos/blockfactory/block_library_storage.js index 3330732a7..b0df067fa 100644 --- a/demos/blockfactory/block_library_storage.js +++ b/demos/blockfactory/block_library_storage.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/block_library_view.js b/demos/blockfactory/block_library_view.js index 2b914766a..61779fdf6 100644 --- a/demos/blockfactory/block_library_view.js +++ b/demos/blockfactory/block_library_view.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/block_option.js b/demos/blockfactory/block_option.js index 8f6b0bbdf..a67b81f9e 100644 --- a/demos/blockfactory/block_option.js +++ b/demos/blockfactory/block_option.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/blocks.js b/demos/blockfactory/blocks.js index c5106899b..c7253cc67 100644 --- a/demos/blockfactory/blocks.js +++ b/demos/blockfactory/blocks.js @@ -1,18 +1,7 @@ /** - + * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -75,7 +64,7 @@ Blockly.Blocks['factory_base'] = { }, spawnOutputShadow_: function(option) { // Helper method for deciding which type of outputs this block needs - // to attach shaddow blocks to. + // to attach shadow blocks to. switch (option) { case 'LEFT': this.connectOutputShadow_('OUTPUTTYPE'); diff --git a/demos/blockfactory/cp.js b/demos/blockfactory/cp.js index 9ba012d4c..863aa7a9b 100644 --- a/demos/blockfactory/cp.js +++ b/demos/blockfactory/cp.js @@ -3,18 +3,7 @@ * * Copyright 2006 Neil Fraser * https://neil.fraser.name/software/colourpicker/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ // Include at the top of your page: diff --git a/demos/blockfactory/factory.css b/demos/blockfactory/factory.css index 751f6f0ed..e838b857c 100644 --- a/demos/blockfactory/factory.css +++ b/demos/blockfactory/factory.css @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ html, body { diff --git a/demos/blockfactory/factory.js b/demos/blockfactory/factory.js index 77ab56ff1..9f01f36f2 100644 --- a/demos/blockfactory/factory.js +++ b/demos/blockfactory/factory.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/factory_utils.js b/demos/blockfactory/factory_utils.js index 92f5a3370..8c1941d10 100644 --- a/demos/blockfactory/factory_utils.js +++ b/demos/blockfactory/factory_utils.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -174,7 +163,7 @@ FactoryUtils.getGeneratorStub = function(block, generatorLanguage) { * Update the language code as JSON. * @param {string} blockType Name of block. * @param {!Blockly.Block} rootBlock Factory_base block. - * @return {string} Generanted language code. + * @return {string} Generated language code. * @private */ FactoryUtils.formatJson_ = function(blockType, rootBlock) { @@ -841,7 +830,7 @@ FactoryUtils.parseJsonBlockDefinitions = function(blockDefsString) { else if (currentChar == '}') { unbalancedBracketCount--; if (unbalancedBracketCount == 0 && i > 0) { - // The brackets are balanced. We've got a complete block defintion. + // The brackets are balanced. We've got a complete block definition. var blockDef = blockDefsString.substring(defStart, i + 1); blockDefArray.push(blockDef); defStart = i + 1; diff --git a/demos/blockfactory/standard_categories.js b/demos/blockfactory/standard_categories.js index 95c33242f..4bb3d1f6f 100644 --- a/demos/blockfactory/standard_categories.js +++ b/demos/blockfactory/standard_categories.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/workspacefactory/wfactory_controller.js b/demos/blockfactory/workspacefactory/wfactory_controller.js index 30f032eae..cfecbbbc4 100644 --- a/demos/blockfactory/workspacefactory/wfactory_controller.js +++ b/demos/blockfactory/workspacefactory/wfactory_controller.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -340,10 +329,6 @@ WorkspaceFactoryController.prototype.exportXmlFile = function(exportMode) { throw Error(msg); } - // Unpack self-closing tags. These tags fail when embedded in HTML. - // -> - configXml = configXml.replace(/<(\w+)([^<]*)\/>/g, '<$1$2>'); - // Download file. var data = new Blob([configXml], {type: 'text/xml'}); this.view.createAndDownloadFile(fileName, data); diff --git a/demos/blockfactory/workspacefactory/wfactory_generator.js b/demos/blockfactory/workspacefactory/wfactory_generator.js index a58c565c0..8f1f2756c 100644 --- a/demos/blockfactory/workspacefactory/wfactory_generator.js +++ b/demos/blockfactory/workspacefactory/wfactory_generator.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/workspacefactory/wfactory_init.js b/demos/blockfactory/workspacefactory/wfactory_init.js index f99e85649..789f7314c 100644 --- a/demos/blockfactory/workspacefactory/wfactory_init.js +++ b/demos/blockfactory/workspacefactory/wfactory_init.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/workspacefactory/wfactory_model.js b/demos/blockfactory/workspacefactory/wfactory_model.js index ff9eaff8e..f5048bc43 100644 --- a/demos/blockfactory/workspacefactory/wfactory_model.js +++ b/demos/blockfactory/workspacefactory/wfactory_model.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory/workspacefactory/wfactory_view.js b/demos/blockfactory/workspacefactory/wfactory_view.js index 287fb3d26..99922395f 100644 --- a/demos/blockfactory/workspacefactory/wfactory_view.js +++ b/demos/blockfactory/workspacefactory/wfactory_view.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/blockfactory_old/blocks.js b/demos/blockfactory_old/blocks.js index 58c7ca383..050e53147 100644 --- a/demos/blockfactory_old/blocks.js +++ b/demos/blockfactory_old/blocks.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -69,7 +58,7 @@ Blockly.Blocks['factory_base'] = { }, spawnOutputShadow_: function(option) { // Helper method for deciding which type of outputs this block needs - // to attach shaddow blocks to. + // to attach shadow blocks to. switch (option) { case 'LEFT': this.connectOutputShadow_('OUTPUTTYPE'); diff --git a/demos/blockfactory_old/factory.js b/demos/blockfactory_old/factory.js index fce170a82..967d2a440 100644 --- a/demos/blockfactory_old/factory.js +++ b/demos/blockfactory_old/factory.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -92,7 +81,7 @@ function updateLanguage() { * Update the language code as JSON. * @param {string} blockType Name of block. * @param {!Blockly.Block} rootBlock Factory_base block. - * @return {string} Generanted language code. + * @return {string} Generated language code. * @private */ function formatJson_(blockType, rootBlock) { @@ -194,7 +183,7 @@ function formatJson_(blockType, rootBlock) { * Update the language code as JavaScript. * @param {string} blockType Name of block. * @param {!Blockly.Block} rootBlock Factory_base block. - * @return {string} Generanted language code. + * @return {string} Generated language code. * @private */ function formatJavaScript_(blockType, rootBlock) { @@ -498,7 +487,7 @@ function getFieldsJson_(block) { /** * Escape a string. * @param {string} string String to escape. - * @return {string} Escaped string surrouned by quotes. + * @return {string} Escaped string surrounded by quotes. */ function escapeString(string) { return JSON.stringify(string); diff --git a/demos/code/code.js b/demos/code/code.js index e19b9f532..0c2765325 100644 --- a/demos/code/code.js +++ b/demos/code/code.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/codelab/app-complete/scripts/main.js b/demos/codelab/app-complete/scripts/main.js index 795dd1a68..d5ebe0b3c 100644 --- a/demos/codelab/app-complete/scripts/main.js +++ b/demos/codelab/app-complete/scripts/main.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ (function() { diff --git a/demos/codelab/app-complete/scripts/music_maker.js b/demos/codelab/app-complete/scripts/music_maker.js index e3d4effe0..adfefeddc 100644 --- a/demos/codelab/app-complete/scripts/music_maker.js +++ b/demos/codelab/app-complete/scripts/music_maker.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ const MusicMaker = { queue_: [], diff --git a/demos/codelab/app-complete/scripts/sound_blocks.js b/demos/codelab/app-complete/scripts/sound_blocks.js index 55462267b..b8b851819 100644 --- a/demos/codelab/app-complete/scripts/sound_blocks.js +++ b/demos/codelab/app-complete/scripts/sound_blocks.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ Blockly.defineBlocksWithJsonArray([ diff --git a/demos/codelab/app/scripts/main.js b/demos/codelab/app/scripts/main.js index 21b884830..9eef2f96a 100644 --- a/demos/codelab/app/scripts/main.js +++ b/demos/codelab/app/scripts/main.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ (function() { diff --git a/demos/codelab/app/scripts/music_maker.js b/demos/codelab/app/scripts/music_maker.js index e3d4effe0..adfefeddc 100644 --- a/demos/codelab/app/scripts/music_maker.js +++ b/demos/codelab/app/scripts/music_maker.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ const MusicMaker = { queue_: [], diff --git a/demos/custom-dialogs/custom-dialog.js b/demos/custom-dialogs/custom-dialog.js index 99c66be0a..0918891f0 100644 --- a/demos/custom-dialogs/custom-dialog.js +++ b/demos/custom-dialogs/custom-dialog.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/custom-fields/pitch/blocks.js b/demos/custom-fields/pitch/blocks.js index 3e02ac80a..4e0b1092f 100644 --- a/demos/custom-fields/pitch/blocks.js +++ b/demos/custom-fields/pitch/blocks.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/custom-fields/pitch/field_pitch.js b/demos/custom-fields/pitch/field_pitch.js index cf3b9fd7f..b66dca6a8 100644 --- a/demos/custom-fields/pitch/field_pitch.js +++ b/demos/custom-fields/pitch/field_pitch.js @@ -2,18 +2,7 @@ * @license * Copyright 2016 Google LLC * https://github.com/google/blockly-games - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/custom-fields/pitch/pitch.css b/demos/custom-fields/pitch/pitch.css index 586c6cdb5..75d17a35d 100644 --- a/demos/custom-fields/pitch/pitch.css +++ b/demos/custom-fields/pitch/pitch.css @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ diff --git a/demos/custom-fields/turtle/blocks.js b/demos/custom-fields/turtle/blocks.js index ef8b245ae..deb28f99f 100644 --- a/demos/custom-fields/turtle/blocks.js +++ b/demos/custom-fields/turtle/blocks.js @@ -1,22 +1,11 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** - * @fileoverview Turtle field demo blocks.. + * @fileoverview Turtle field demo blocks. * @author bekawestberg@gmail.com (Beka Westberg) */ diff --git a/demos/custom-fields/turtle/field_turtle.js b/demos/custom-fields/turtle/field_turtle.js index 9a787e478..f790b1d1b 100644 --- a/demos/custom-fields/turtle/field_turtle.js +++ b/demos/custom-fields/turtle/field_turtle.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/custom-fields/turtle/turtle.css b/demos/custom-fields/turtle/turtle.css index 99ab0d4c1..ed5e9b307 100644 --- a/demos/custom-fields/turtle/turtle.css +++ b/demos/custom-fields/turtle/turtle.css @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ .customFieldsTurtleWidget { diff --git a/demos/interpreter/acorn_interpreter.js b/demos/interpreter/acorn_interpreter.js index 249bc6cdd..19db1c3ef 100644 --- a/demos/interpreter/acorn_interpreter.js +++ b/demos/interpreter/acorn_interpreter.js @@ -38,104 +38,106 @@ Pb=RegExp("[\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02 na=/[\n\r\u2028\u2029]/,Y=/\r\n|[\n\r\u2028\u2029]/g,la=a.isIdentifierStart=function(a){return 65>a?36===a:91>a?!0:97>a?95===a:123>a?!0:170<=a&&Za.test(String.fromCharCode(a))},ab=a.isIdentifierChar=function(a){return 48>a?36===a:58>a?!0:65>a?!1:91>a?!0:97>a?95===a:123>a?!0:170<=a&&Pb.test(String.fromCharCode(a))},ca,Ia={kind:"loop"},Ob={kind:"switch"}}; "object"==typeof exports&&"object"==typeof module?mod$$inline_58(exports):"function"==typeof define&&define.amd?define(["exports"],mod$$inline_58):mod$$inline_58(this.acorn||(this.acorn={})); // JS-Interpreter: Copyright 2013 Google LLC, Apache 2.0 -function u(a,b){"string"===typeof a&&(a=acorn.parse(a,ha));this.ha=a;this.ib=b;this.ya=!1;this.V=[];this.Da=0;this.nb=Object.create(null);var c=/^step([A-Z]\w*)$/,d,e;for(e in this)"function"===typeof this[e]&&(d=e.match(c))&&(this.nb[d[1]]=this[e].bind(this));this.global=ia(this,this.ha,null);this.ha=acorn.parse(this.V.join("\n"),ha);this.V=void 0;ra(this,this.ha,void 0,void 0);c=new y(this.ha,this.global);c.done=!1;this.j=[c];this.lb();this.value=void 0;this.ha=a;c=new y(this.ha,this.global);c.done= -!1;this.j.length=0;this.j[0]=c;this.Ra=c.node.constructor;this.stateStack=this.j} -var ha={Ca:5},sa={configurable:!0,enumerable:!0,writable:!1},A={configurable:!0,enumerable:!1,writable:!0},E={configurable:!0,enumerable:!1,writable:!1},za={configurable:!1,enumerable:!0,writable:!0},Aa={STEP_ERROR:!0},Ba={SCOPE_REFERENCE:!0},Ha={VALUE_IN_DESCRIPTOR:!0},Ia={REGEXP_TIMEOUT:!0},Ja=[],Ka=null,La=["onmessage = function(e) {","var result;","var data = e.data;","switch (data[0]) {","case 'split':","result = data[1].split(data[2], data[3]);","break;","case 'match':","result = data[1].match(data[2]);", -"break;","case 'search':","result = data[1].search(data[2]);","break;","case 'replace':","result = data[1].replace(data[2], data[3]);","break;","case 'exec':","var regexp = data[1];","regexp.lastIndex = data[2];","result = [regexp.exec(data[3]), data[1].lastIndex];","break;","default:","throw 'Unknown RegExp operation: ' + data[0];","}","postMessage(result);","};"];u.prototype.REGEXP_MODE=2;u.prototype.REGEXP_THREAD_TIMEOUT=1E3; -u.prototype.sb=function(a){var b=this.j[0];if(!b||"Program"!==b.node.type)throw Error("Expecting original AST to start with a Program node.");"string"===typeof a&&(a=acorn.parse(a,ha));if(!a||"Program"!==a.type)throw Error("Expecting new AST to start with a Program node.");Ma(this,a,b.scope);for(var c=0,d;d=a.body[c];c++)b.node.body.push(d);b.done=!1}; -u.prototype.step=function(){var a=this.j,b=a[a.length-1];if(!b)return!1;var c=b.node,d=c.type;if("Program"===d&&b.done)return!1;if(this.ya)return!0;try{var e=this.nb[d](a,b,c)}catch(g){if(g!==Aa)throw g;}e&&a.push(e);return c.end?!0:this.step()};u.prototype.lb=function(){for(;!this.ya&&this.step(););return this.ya}; -function Na(a,b){a.setProperty(b,"NaN",NaN,sa);a.setProperty(b,"Infinity",Infinity,sa);a.setProperty(b,"undefined",void 0,sa);a.setProperty(b,"window",b,sa);a.setProperty(b,"this",b,sa);a.setProperty(b,"self",b);a.G=new Oa(null);a.I=new Oa(a.G);Pa(a,b);cb(a,b);b.oa=a.G;a.setProperty(b,"constructor",a.m,A);db(a,b);Eb(a,b);Fb(a,b);Gb(a,b);Hb(a,b);Ib(a,b);Jb(a,b);Kb(a,b);Lb(a,b);var c=a.b(function(){throw EvalError("Can't happen");},!1);c.eval=!0;a.setProperty(b,"eval",c);a.setProperty(b,"parseInt", -a.b(parseInt,!1));a.setProperty(b,"parseFloat",a.b(parseFloat,!1));a.setProperty(b,"isNaN",a.b(isNaN,!1));a.setProperty(b,"isFinite",a.b(isFinite,!1));c=[[escape,"escape"],[unescape,"unescape"],[decodeURI,"decodeURI"],[decodeURIComponent,"decodeURIComponent"],[encodeURI,"encodeURI"],[encodeURIComponent,"encodeURIComponent"]];for(var d=0;d>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;", -"}","});","Object.defineProperty(Array.prototype, 'filter',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {","var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}", -"});","Object.defineProperty(Array.prototype, 'forEach',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map',","{configurable: true, writable: true, value:","function(callback, thisArg) {", -"if (!this || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);","k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (!this || typeof callback !== 'function') throw TypeError();", -"var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length === 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k++];","}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {", -"if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;","if (k < 0) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'some',", -"{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (!this || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","(function() {","var sort_ = Array.prototype.sort;","Array.prototype.sort = function(opt_comp) {","if (typeof opt_comp !== 'function') {", -"return sort_.call(this);","}","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp(this[j], this[j + 1]) > 0) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;","}","}","if (!changes) break;","}","return this;","};","})();","Object.defineProperty(Array.prototype, 'toLocaleString',","{configurable: true, writable: true, value:","function() {","var out = [];","for (var i = 0; i < this.length; i++) {", -"out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")} -function Eb(a,b){var c=function(e){e=String(e);return vc(a)?(this.data=e,this):e};a.A=a.b(c,!0);a.setProperty(b,"String",a.A);a.setProperty(a.A,"fromCharCode",a.b(String.fromCharCode,!1),A);c="charAt charCodeAt concat indexOf lastIndexOf slice substr substring toLocaleLowerCase toLocaleUpperCase toLowerCase toUpperCase trim".split(" ");for(var d=0;d>>0;return b===Number(a)?b:NaN}function Oa(a){var b=a>>>0;return String(b)===String(a)&&4294967295!==b?b:NaN} +function ra(a,b,c){b?a.start=b:delete a.start;c?a.end=c:delete a.end;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d];e&&"object"===typeof e&&ra(e,b,c)}}u.prototype.REGEXP_MODE=2;u.prototype.REGEXP_THREAD_TIMEOUT=1E3;q=u.prototype;q.I=!1;q.ya=!1; +q.ub=function(a){var b=this.j[0];if(!b||"Program"!==b.node.type)throw Error("Expecting original AST to start with a Program node.");"string"===typeof a&&(a=acorn.parse(a,ha));if(!a||"Program"!==a.type)throw Error("Expecting new AST to start with a Program node.");Pa(this,a,b.scope);Array.prototype.push.apply(b.node.body,a.body);b.done=!1}; +q.step=function(){var a=this.j;do{var b=a[a.length-1];if(!b)return!1;var c=b.node,d=c.type;if("Program"===d&&b.done)return!1;if(this.wa)break;try{var e=this.pb[d](a,b,c)}catch(g){if(g!==Aa)throw g;}e&&a.push(e);if(this.I)throw Error("Getter not supported in this context");if(this.ya)throw Error("Setter not supported in this context");}while(!c.end);return!0};q.nb=function(){for(;!this.wa&&this.step(););return this.wa}; +function Qa(a,b){a.setProperty(b,"NaN",NaN,ya);a.setProperty(b,"Infinity",Infinity,ya);a.setProperty(b,"undefined",void 0,ya);a.setProperty(b,"window",b,ya);a.setProperty(b,"this",b,ya);a.setProperty(b,"self",b);a.B=new F(null);a.W=new F(a.B);db(a,b);eb(a,b);b.la=a.B;a.setProperty(b,"constructor",a.m,B);Fb(a,b);Gb(a,b);Hb(a,b);Ib(a,b);Jb(a,b);Kb(a,b);Lb(a,b);Mb(a,b);Nb(a,b);var c=a.b(function(){throw EvalError("Can't happen");},!1);c.eval=!0;a.setProperty(b,"eval",c);a.setProperty(b,"parseInt",a.b(parseInt, +!1));a.setProperty(b,"parseFloat",a.b(parseFloat,!1));a.setProperty(b,"isNaN",a.b(isNaN,!1));a.setProperty(b,"isFinite",a.b(isFinite,!1));c=[[escape,"escape"],[unescape,"unescape"],[decodeURI,"decodeURI"],[decodeURIComponent,"decodeURIComponent"],[encodeURI,"encodeURI"],[encodeURIComponent,"encodeURIComponent"]];for(var d=0;d>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;", +"while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {", +"var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","Object.defineProperty(Array.prototype, 'forEach',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map',", +"{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);","k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {", +"if (!this || typeof callback !== 'function') throw TypeError();","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length === 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k++];","}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight',", +"{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;","if (k < 0) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);", +"}","return value;","}","});","Object.defineProperty(Array.prototype, 'some',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (!this || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","(function() {","var sort_ = Array.prototype.sort;", +"Array.prototype.sort = function(opt_comp) {","if (typeof opt_comp !== 'function') {","return sort_.call(this);","}","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp(this[j], this[j + 1]) > 0) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;","}","}","if (!changes) break;","}","return this;","};","})();","Object.defineProperty(Array.prototype, 'toLocaleString',","{configurable: true, writable: true, value:", +"function() {","var out = [];","for (var i = 0; i < this.length; i++) {","out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")} +function Gb(a,b){var c=function(e){e=arguments.length?String(e):"";return zc(a)?(this.data=e,this):e};a.w=a.b(c,!0);a.setProperty(b,"String",a.w);a.setProperty(a.w,"fromCharCode",a.b(String.fromCharCode,!1),B);c="charAt charCodeAt concat indexOf lastIndexOf slice substr substring toLocaleLowerCase toLocaleUpperCase toLowerCase toUpperCase trim".split(" ");for(var d=0;d= 0; i--) {","str = str.substring(0, subs[i][0]) + subs[i][2] + str.substring(subs[i][0] + subs[i][1]);", -"}","} else {","var i = str.indexOf(substr);","if (i !== -1) {","var inject = newSubstr(str.substr(i, substr.length), i, str);","str = str.substring(0, i) + inject + str.substring(i + substr.length);","}","}","return str;","};","})();","")}function Fb(a,b){a.Wa=a.b(function(c){c=!!c;return vc(a)?(this.data=c,this):c},!0);a.setProperty(b,"Boolean",a.Wa)} -function Gb(a,b){var c=function(e){e=Number(e);return vc(a)?(this.data=e,this):e};a.T=a.b(c,!0);a.setProperty(b,"Number",a.T);c=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"];for(var d=0;d>>0;return b===Number(a)?b:NaN}function Tc(a){var b=a>>>0;return String(b)===String(a)&&4294967295!==b?b:NaN}function Oa(a){this.O=Object.create(null);this.R=Object.create(null);this.a=Object.create(null);this.oa=a}p=Oa.prototype;p.oa=null;p.o=!0;p.K="Object";p.data=null; -p.toString=function(){if("Array"===this.K){var a=Ja;a.push(this);try{for(var b=[],c=0;cb.charCodeAt(0)&&T(this,a,this.A)){var c=Tc(b);if(!isNaN(c)&&c>=":d>>=e;break;case ">>>=":d>>>=e;break;case "&=":d&=e;break;case "^=":d^=e;break;case "|=":d|=e;break;default:throw SyntaxError("Unknown assignment expression: "+c.operator);}if(c=Zc(this,b.ua,d))return b.ka=!0,b.Ua=d,bd(this,c,b.ua,d);a.pop();a[a.length-1].value=d}}; -u.prototype.stepBinaryExpression=function(a,b,c){if(!b.Y)return b.Y=!0,new y(c.left,b.scope);if(!b.sa)return b.sa=!0,b.$=b.value,new y(c.right,b.scope);a.pop();var d=b.$;b=b.value;switch(c.operator){case "==":c=d==b;break;case "!=":c=d!=b;break;case "===":c=d===b;break;case "!==":c=d!==b;break;case ">":c=d>b;break;case ">=":c=d>=b;break;case "<":c=d>":c=d>>b;break;case ">>>":c=d>>>b;break;case "in":b&&b.o||J(this,this.h,"'in' expects an object, not '"+b+"'");c=xc(this,b,d);break;case "instanceof":T(this,b,this.C)||J(this,this.h,"Right-hand side of instanceof is not an object");c=d.o?T(this,d,b):!1;break;default:throw SyntaxError("Unknown binary operator: "+c.operator);}a[a.length-1].value=c}; -u.prototype.stepBlockStatement=function(a,b,c){var d=b.s||0;if(c=c.body[d])return b.s=d+1,new y(c,b.scope);a.pop()};u.prototype.stepBreakStatement=function(a,b,c){$c(this,1,void 0,c.label&&c.label.name)}; -u.prototype.stepCallExpression=function(a,b,c){if(!b.ja){b.ja=1;var d=new y(c.callee,b.scope);d.ia=!0;return d}if(1===b.ja){b.ja=2;d=b.value;if(Array.isArray(d)){if(b.Z=Yc(this,d),d[0]===Ba?b.wb="eval"===d[1]:b.J=d[0],(d=b.Z)&&"object"===typeof d&&d.L)return d.L=!1,b.ja=1,ad(this,d,b.value)}else b.Z=d;b.B=[];b.s=0}d=b.Z;if(!b.Oa){0!==b.s&&b.B.push(b.value);if(c.arguments[b.s])return new y(c.arguments[b.s++],b.scope);if("NewExpression"===c.type){d.Fb&&J(this,this.h,d+" is not a constructor");var e= -d.a.prototype;if("object"!==typeof e||null===e)e=this.G;b.J=this.g(e);b.isConstructor=!0}else void 0===b.J&&(b.J=b.scope.H?void 0:this.global);b.Oa=!0}if(b.Pa)a.pop(),a[a.length-1].value=b.isConstructor&&"object"!==typeof b.value?b.J:b.value;else{b.Pa=!0;d&&d.o||J(this,this.h,d+" is not a function");if(a=d.node){c=ia(this,a.body,d.ca);for(var g=0;gg?b.B[g]:void 0);e=this.g(this.ea);for(g=0;gb.charCodeAt(0)&&U(this,a,this.w)){var c=Oa(b);if(!isNaN(c)&&c>=":d>>=e;break;case ">>>=":d>>>=e;break;case "&=":d&=e;break;case "^=":d^=e;break;case "|=":d|=e;break;default:throw SyntaxError("Unknown assignment expression: "+c.operator);}if(c=cd(this,b.ra,d))return b.ia=!0,b.Wa=d,fd(this,c,b.ra,d);a.pop();a[a.length-1].value=d}}; +u.prototype.stepBinaryExpression=function(a,b,c){if(!b.Y)return b.Y=!0,new v(c.left,b.scope);if(!b.pa)return b.pa=!0,b.$=b.value,new v(c.right,b.scope);a.pop();var d=b.$;b=b.value;switch(c.operator){case "==":c=d==b;break;case "!=":c=d!=b;break;case "===":c=d===b;break;case "!==":c=d!==b;break;case ">":c=d>b;break;case ">=":c=d>=b;break;case "<":c=d>":c=d>>b;break;case ">>>":c=d>>>b;break;case "in":b instanceof F||I(this,this.g,"'in' expects an object, not '"+b+"'");c=Bc(this,b,d);break;case "instanceof":U(this,b,this.H)||I(this,this.g,"Right-hand side of instanceof is not an object");c=d instanceof F?U(this,d,b):!1;break;default:throw SyntaxError("Unknown binary operator: "+c.operator);}a[a.length-1].value=c}; +u.prototype.stepBlockStatement=function(a,b,c){var d=b.o||0;if(c=c.body[d])return b.o=d+1,new v(c,b.scope);a.pop()};u.prototype.stepBreakStatement=function(a,b,c){dd(this,1,void 0,c.label&&c.label.name)}; +u.prototype.stepCallExpression=function(a,b,c){if(!b.ha){b.ha=1;var d=new v(c.callee,b.scope);d.ga=!0;return d}if(1===b.ha){b.ha=2;d=b.value;if(Array.isArray(d)){if(b.Z=bd(this,d),d[0]===Ba?b.yb="eval"===d[1]:b.G=d[0],d=b.Z,this.I)return b.ha=1,ed(this,d,b.value)}else b.Z=d;b.A=[];b.o=0}d=b.Z;if(!b.Qa){0!==b.o&&b.A.push(b.value);if(c.arguments[b.o])return new v(c.arguments[b.o++],b.scope);if("NewExpression"===c.type){d.Hb&&I(this,this.g,d+" is not a constructor");if(d===this.l)b.G=Ac(this);else{var e= +d.a.prototype;if("object"!==typeof e||null===e)e=this.B;b.G=this.h(e)}b.isConstructor=!0}else void 0===b.G&&(b.G=b.scope.P?void 0:this.Da);b.Qa=!0}if(b.Ra)a.pop(),a[a.length-1].value=b.isConstructor&&"object"!==typeof b.value?b.G:b.value;else{b.Ra=!0;d instanceof F||I(this,this.g,d+" is not a function");if(a=d.node){c=ia(this,a.body,d.va);for(var g=0;gg?b.A[g]:void 0);e=Ac(this);for(g=0;gBlockly > Demos > Asynchronous Execution with JS Interpreter -

This is a demo of executing code asychronously (e.g., waiting for delays or user input) using the JavaScript interpreter.

+

This is a demo of executing code asynchronously (e.g., waiting for delays or user input) using the JavaScript interpreter.

More info on running code with JS Interpreter

@@ -151,13 +151,13 @@ var myInterpreter = null; var runner; - function initApi(interpreter, scope) { + function initApi(interpreter, globalObject) { // Add an API function for the alert() block, generated for "text_print" blocks. var wrapper = function(text) { text = text ? text.toString() : ''; outputArea.value = outputArea.value + '\n' + text; }; - interpreter.setProperty(scope, 'alert', + interpreter.setProperty(globalObject, 'alert', interpreter.createNativeFunction(wrapper)); // Add an API function for the prompt() block. @@ -165,18 +165,18 @@ text = text ? text.toString() : ''; return interpreter.createPrimitive(prompt(text)); }; - interpreter.setProperty(scope, 'prompt', + interpreter.setProperty(globalObject, 'prompt', interpreter.createNativeFunction(wrapper)); // Add an API for the wait block. See wait_block.js - initInterpreterWaitForSeconds(interpreter, scope); + initInterpreterWaitForSeconds(interpreter, globalObject); // Add an API function for highlighting blocks. var wrapper = function(id) { id = id ? id.toString() : ''; return interpreter.createPrimitive(highlightBlock(id)); }; - interpreter.setProperty(scope, 'highlightBlock', + interpreter.setProperty(globalObject, 'highlightBlock', interpreter.createNativeFunction(wrapper)); } diff --git a/demos/interpreter/index.html b/demos/interpreter/index.html index 2245057c0..52e49eee4 100644 --- a/demos/interpreter/index.html +++ b/demos/interpreter/index.html @@ -6,6 +6,6 @@ -Redirecting to step execution jsinterpreter demo. +Redirecting to step execution JS-Interpreter demo. diff --git a/demos/interpreter/step-execution.html b/demos/interpreter/step-execution.html index f3f411947..03e62aed6 100644 --- a/demos/interpreter/step-execution.html +++ b/demos/interpreter/step-execution.html @@ -149,9 +149,9 @@ var stepButton = document.getElementById('stepButton'); var myInterpreter = null; - function initApi(interpreter, scope) { + function initApi(interpreter, globalObject) { // Add an API function for the alert() block, generated for "text_print" blocks. - interpreter.setProperty(scope, 'alert', + interpreter.setProperty(globalObject, 'alert', interpreter.createNativeFunction(function(text) { text = arguments.length ? text : ''; outputArea.value += '\n' + text; @@ -161,7 +161,7 @@ var wrapper = function(text) { return interpreter.createPrimitive(prompt(text)); }; - interpreter.setProperty(scope, 'prompt', + interpreter.setProperty(globalObject, 'prompt', interpreter.createNativeFunction(wrapper)); // Add an API function for highlighting blocks. @@ -169,7 +169,7 @@ id = String(id || ''); return interpreter.createPrimitive(highlightBlock(id)); }; - interpreter.setProperty(scope, 'highlightBlock', + interpreter.setProperty(globalObject, 'highlightBlock', interpreter.createNativeFunction(wrapper)); } diff --git a/demos/interpreter/wait_block.js b/demos/interpreter/wait_block.js index 4f49d8afc..10a57b482 100644 --- a/demos/interpreter/wait_block.js +++ b/demos/interpreter/wait_block.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -51,7 +40,7 @@ Blockly.JavaScript['wait_seconds'] = function(block) { * Register the interpreter asynchronous function * waitForSeconds(). */ -function initInterpreterWaitForSeconds(interpreter, scope) { +function initInterpreterWaitForSeconds(interpreter, globalObject) { // Ensure function name does not conflict with variable names. Blockly.JavaScript.addReservedWords('waitForSeconds'); @@ -60,5 +49,5 @@ function initInterpreterWaitForSeconds(interpreter, scope) { // Delay the call to the callback. setTimeout(callback, timeInSeconds * 1000); }); - interpreter.setProperty(scope, 'waitForSeconds', wrapper); -} \ No newline at end of file + interpreter.setProperty(globalObject, 'waitForSeconds', wrapper); +} diff --git a/demos/keyboard_nav/index.html b/demos/keyboard_nav/index.html index b131bbeae..53408c57e 100644 --- a/demos/keyboard_nav/index.html +++ b/demos/keyboard_nav/index.html @@ -53,33 +53,26 @@ Demos > Keyboard Navigation

Keyboard Navigation is our first step towards an accessible Blockly.
- You can enter accessibility mode by shift clicking anywhere on the - workspace or on a block.
Some basic commands for moving around are below. - More complete documentation is still in progress.

- Workspace Navigation
- W: Previous block/field/input at the same level
- A: Up one level (Field (or input) -> Block -> Input (or field) -> Block -> - Stack -> Workspace)
- S: Next block/field/input at the same level
- D: Down one level (Workspace -> Stack -> Block -> Input (or field) -> Block - -> Field (or input))
- T: Will open the toolbox. Once in there you can moving around using the WASD keys. And insert a block by hitting Enter
- X: While on a connection hit X to disconnect the block after the cursor

- + For more information on how the default keyboard navigation works please see + the documentation. +
+
Pre Order Traversal
Feel free to just play around in accessibility mode or hit the button below to see the demo. The demo uses preorder tree traversal as an alternative way to navigate the blocks, connections, and fields on the workspace.

- - - - Cursor
+ Cursors
The cursor controls how the user navigates the blocks, inputs, fields and connections on a workspace. - This demo shows two different cursors:
- Default Cursor: Allow the user to go to the previous, next, in or out location.
- Basic Cursor: Using the pre order traversal allows the user to go to the next and previous location. + This demo shows three different cursors:
+ Default Cursor: Explained in documentation.
+ Basic Cursor: Uses pre order traversal to allow users to navigate + through everything using only the previous and next command.
+ Line Cursor: We tried to make this cursor mimic a text editor. Navigating + up and down will take the cursor to the next and previous "line" of code. + Navigating in and out will move the cursor through all the fields and inputs + in that "line" of code.

diff --git a/demos/keyboard_nav/line_cursor.js b/demos/keyboard_nav/line_cursor.js index d197e8a7e..d9cb80689 100644 --- a/demos/keyboard_nav/line_cursor.js +++ b/demos/keyboard_nav/line_cursor.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -110,7 +99,7 @@ Blockly.LineCursor.prototype.prev = function() { }; /** - * For a basic cursor we only have the ability to go next and previou, so + * For a basic cursor we only have the ability to go next and previous, so * out will allow the user to get to the previous node in the pre order traversal. * @return {Blockly.ASTNode} The previous node, or null if the current node is * not set or there is no previous value. diff --git a/demos/minimap/minimap.js b/demos/minimap/minimap.js index 05e00bb7a..db467a503 100644 --- a/demos/minimap/minimap.js +++ b/demos/minimap/minimap.js @@ -1,18 +1,7 @@ /** * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/mobile/README.md b/demos/mobile/README.md index bab09606b..168690e55 100644 --- a/demos/mobile/README.md +++ b/demos/mobile/README.md @@ -15,7 +15,7 @@ see changes in both the Android and iOS native apps. Before running the mobile HTML demo, you need to create some symbolic links in your local file system. Run the `mobile/html/ln_resources.sh` file from -the `mobile/html/` directory. This mimicks the relative locations of the +the `mobile/html/` directory. This mimics the relative locations of the Blockly files seen when loading the page in a native app's embedded WebView. After doing this, opening `mobile/html/index.html` should open normally, diff --git a/demos/plane/blocks.js b/demos/plane/blocks.js index 33c66c78c..d5f80a321 100644 --- a/demos/plane/blocks.js +++ b/demos/plane/blocks.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2013 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -46,12 +35,14 @@ Blockly.Blocks['plane_get_rows'] = { this.setHelpUrl(Blockly.Msg['VARIABLES_GET_HELPURL']); this.setColour(330); this.appendDummyInput() - .appendField(Plane.getMsg('Plane_getRows'), 'title'); + .appendField(Plane.getMsg('Plane_getRows') + .replace('%1', Plane.rows1st), 'title'); this.setOutput(true, 'Number'); }, customUpdate: function() { this.setFieldValue( - Plane.getMsg('Plane_getRows').replace('%1', Plane.rows1st), 'title'); + Plane.getMsg('Plane_getRows') + .replace('%1', Plane.rows1st), 'title'); } }; @@ -66,12 +57,14 @@ Blockly.Blocks['plane_get_rows1st'] = { this.setHelpUrl(Blockly.Msg['VARIABLES_GET_HELPURL']); this.setColour(330); this.appendDummyInput() - .appendField(Plane.getMsg('Plane_getRows1'), 'title'); + .appendField(Plane.getMsg('Plane_getRows1') + .replace('%1', Plane.rows1st), 'title'); this.setOutput(true, 'Number'); }, customUpdate: function() { this.setFieldValue( - Plane.getMsg('Plane_getRows1').replace('%1', Plane.rows1st), 'title'); + Plane.getMsg('Plane_getRows1') + .replace('%1', Plane.rows1st), 'title'); } }; @@ -86,12 +79,14 @@ Blockly.Blocks['plane_get_rows2nd'] = { this.setHelpUrl(Blockly.Msg['VARIABLES_GET_HELPURL']); this.setColour(330); this.appendDummyInput() - .appendField(Plane.getMsg('Plane_getRows2'), 'title'); + .appendField(Plane.getMsg('Plane_getRows2') + .replace('%1', Plane.rows2nd), 'title'); this.setOutput(true, 'Number'); }, customUpdate: function() { this.setFieldValue( - Plane.getMsg('Plane_getRows2').replace('%1', Plane.rows2nd), 'title'); + Plane.getMsg('Plane_getRows2') + .replace('%1', Plane.rows2nd), 'title'); } }; diff --git a/demos/plane/plane.js b/demos/plane/plane.js index 182de9edc..bc5cf512c 100644 --- a/demos/plane/plane.js +++ b/demos/plane/plane.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -211,12 +200,20 @@ Plane.rows1st = 0; Plane.rows2nd = 0; /** - * Redraw the rows when the slider has moved. + * Redraw the rows and update blocks when the slider has moved. * @param {number} value New slider position. */ Plane.sliderChange = function(value) { var newRows = Math.round(value * 410 / 20); Plane.redraw(newRows); + + function updateBlocks(blocks) { + for (var i = 0, block; block = blocks[i]; i++) { + block.customUpdate && block.customUpdate(); + } + } + updateBlocks(Plane.workspace.getAllBlocks(false), true); + updateBlocks(Plane.workspace.flyout_.workspace_.getAllBlocks(false)); }; /** @@ -351,15 +348,6 @@ Plane.recalculate = function() { Plane.getMsg('Plane_seats').replace( '%1', isNaN(seats) ? '?' : seats)); Plane.setCorrect(isNaN(seats) ? null : (Plane.answer() == seats)); - - // Update blocks to show values. - function updateBlocks(blocks) { - for (var i = 0, block; block = blocks[i]; i++) { - block.customUpdate && block.customUpdate(); - } - } - updateBlocks(Plane.workspace.getAllBlocks(false)); - updateBlocks(Plane.workspace.flyout_.workspace_.getAllBlocks(false)); }; /** diff --git a/demos/plane/slider.js b/demos/plane/slider.js index a21965346..8428749d8 100644 --- a/demos/plane/slider.js +++ b/demos/plane/slider.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/demos/plane/soy/soyutils.js b/demos/plane/soy/soyutils.js index 861c81f9f..949777cb9 100644 --- a/demos/plane/soy/soyutils.js +++ b/demos/plane/soy/soyutils.js @@ -1469,7 +1469,7 @@ soydata.VERY_UNSAFE.ordainSanitizedJs = // finally printed. /** * Takes a leap of faith that the provided content can be safely embedded in - * a Javascript string without re-esacping. + * a Javascript string without re-escaping. * * @param {*} content Content that can be safely inserted as part of a * single- or double-quoted string without terminating the string. @@ -2479,7 +2479,7 @@ soy.$$changeNewlineToBr = function(value) { /** * Inserts word breaks ('wbr' tags) into a HTML string at a given interval. The * counter is reset if a space is encountered. Word breaks aren't inserted into - * HTML tags or entities. Entites count towards the character count; HTML tags + * HTML tags or entities. Entities count towards the character count; HTML tags * do not. * * @param {*} value The HTML string to insert word breaks into. Can be other diff --git a/demos/storage/index.html b/demos/storage/index.html index 759dc2b83..41462e295 100644 --- a/demos/storage/index.html +++ b/demos/storage/index.html @@ -86,7 +86,7 @@ {media: '../../media/', toolbox: document.getElementById('toolbox')}); - // An href with #key trigers an AJAX call to retrieve saved blocks. + // An href with #key triggers an AJAX call to retrieve saved blocks. if ('BlocklyStorage' in window && window.location.hash.length > 1) { BlocklyStorage.retrieveXml(window.location.hash.substring(1)); } diff --git a/externs/goog-externs.js b/externs/goog-externs.js index 496805dc1..8b956d4b0 100644 --- a/externs/goog-externs.js +++ b/externs/goog-externs.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/externs/svg-externs.js b/externs/svg-externs.js index 5fca4dcde..e8a3326ab 100644 --- a/externs/svg-externs.js +++ b/externs/svg-externs.js @@ -1,17 +1,6 @@ /** * Copyright 2017 The Closure Compiler Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/dart.js b/generators/dart.js index 444709d91..da760b32a 100644 --- a/generators/dart.js +++ b/generators/dart.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/dart/colour.js b/generators/dart/colour.js index 8f58bd426..b40fac7a0 100644 --- a/generators/dart/colour.js +++ b/generators/dart/colour.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/dart/lists.js b/generators/dart/lists.js index 37f780de7..bfd6e9378 100644 --- a/generators/dart/lists.js +++ b/generators/dart/lists.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/dart/logic.js b/generators/dart/logic.js index abfdd05f9..035ffbd50 100644 --- a/generators/dart/logic.js +++ b/generators/dart/logic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/dart/loops.js b/generators/dart/loops.js index 9d10afd8e..4ab38ca66 100644 --- a/generators/dart/loops.js +++ b/generators/dart/loops.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/dart/math.js b/generators/dart/math.js index 95645887e..251047fdb 100644 --- a/generators/dart/math.js +++ b/generators/dart/math.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/dart/procedures.js b/generators/dart/procedures.js index d21fdfd81..dacacdad5 100644 --- a/generators/dart/procedures.js +++ b/generators/dart/procedures.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/dart/text.js b/generators/dart/text.js index b53eddf2b..acd15d8e6 100644 --- a/generators/dart/text.js +++ b/generators/dart/text.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/dart/variables.js b/generators/dart/variables.js index dd4d7cf92..2fe0a9e02 100644 --- a/generators/dart/variables.js +++ b/generators/dart/variables.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/dart/variables_dynamic.js b/generators/dart/variables_dynamic.js index 0fad712cc..7e4d7914c 100644 --- a/generators/dart/variables_dynamic.js +++ b/generators/dart/variables_dynamic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/javascript.js b/generators/javascript.js index 68cdbbd74..fa37716da 100644 --- a/generators/javascript.js +++ b/generators/javascript.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/javascript/colour.js b/generators/javascript/colour.js index 55cc80c14..712faea0d 100644 --- a/generators/javascript/colour.js +++ b/generators/javascript/colour.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/javascript/lists.js b/generators/javascript/lists.js index d799f6331..246871182 100644 --- a/generators/javascript/lists.js +++ b/generators/javascript/lists.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/javascript/logic.js b/generators/javascript/logic.js index 3160fa538..de7b42049 100644 --- a/generators/javascript/logic.js +++ b/generators/javascript/logic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/javascript/loops.js b/generators/javascript/loops.js index 9f0068087..595906f84 100644 --- a/generators/javascript/loops.js +++ b/generators/javascript/loops.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/javascript/math.js b/generators/javascript/math.js index 337a01d69..5266f8ed5 100644 --- a/generators/javascript/math.js +++ b/generators/javascript/math.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/javascript/procedures.js b/generators/javascript/procedures.js index 8874fcead..a987bca02 100644 --- a/generators/javascript/procedures.js +++ b/generators/javascript/procedures.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/javascript/text.js b/generators/javascript/text.js index d81dd15f4..e32b78fbb 100644 --- a/generators/javascript/text.js +++ b/generators/javascript/text.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/javascript/variables.js b/generators/javascript/variables.js index df596cc29..5ff961d2c 100644 --- a/generators/javascript/variables.js +++ b/generators/javascript/variables.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/javascript/variables_dynamic.js b/generators/javascript/variables_dynamic.js index c513e7b44..1862b3d27 100644 --- a/generators/javascript/variables_dynamic.js +++ b/generators/javascript/variables_dynamic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/lua.js b/generators/lua.js index 74eabcd4e..e3b25a333 100644 --- a/generators/lua.js +++ b/generators/lua.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/lua/colour.js b/generators/lua/colour.js index 1ec5ccba3..43db10d78 100644 --- a/generators/lua/colour.js +++ b/generators/lua/colour.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/lua/lists.js b/generators/lua/lists.js index d56141a8f..5c3831a02 100644 --- a/generators/lua/lists.js +++ b/generators/lua/lists.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -28,7 +17,7 @@ goog.require('Blockly.Lua'); Blockly.Lua['lists_create_empty'] = function(block) { // Create an empty list. - return ['{}', Blockly.Lua.ORDER_ATOMIC]; + return ['{}', Blockly.Lua.ORDER_HIGH]; }; Blockly.Lua['lists_create_with'] = function(block) { @@ -39,7 +28,7 @@ Blockly.Lua['lists_create_with'] = function(block) { Blockly.Lua.ORDER_NONE) || 'None'; } var code = '{' + elements.join(', ') + '}'; - return [code, Blockly.Lua.ORDER_ATOMIC]; + return [code, Blockly.Lua.ORDER_HIGH]; }; Blockly.Lua['lists_repeat'] = function(block) { @@ -137,7 +126,7 @@ Blockly.Lua['lists_getIndex'] = function(block) { var mode = block.getFieldValue('MODE') || 'GET'; var where = block.getFieldValue('WHERE') || 'FROM_START'; var list = Blockly.Lua.valueToCode(block, 'VALUE', Blockly.Lua.ORDER_HIGH) || - '{}'; + '({})'; var getIndex_ = Blockly.Lua.lists.getIndex_; // If `list` would be evaluated more than once (which is the case for LAST, diff --git a/generators/lua/logic.js b/generators/lua/logic.js index bc0d89507..cac58c699 100644 --- a/generators/lua/logic.js +++ b/generators/lua/logic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/lua/loops.js b/generators/lua/loops.js index 063aa2ba0..be95737bc 100644 --- a/generators/lua/loops.js +++ b/generators/lua/loops.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/lua/math.js b/generators/lua/math.js index a61f3185b..23f0485e6 100644 --- a/generators/lua/math.js +++ b/generators/lua/math.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/lua/procedures.js b/generators/lua/procedures.js index fd7b3b311..f0354c29a 100644 --- a/generators/lua/procedures.js +++ b/generators/lua/procedures.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/lua/text.js b/generators/lua/text.js index cb74d7cbb..5f95d9a93 100644 --- a/generators/lua/text.js +++ b/generators/lua/text.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/lua/variables.js b/generators/lua/variables.js index 3cb2d1888..9249a43e9 100644 --- a/generators/lua/variables.js +++ b/generators/lua/variables.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/lua/variables_dynamic.js b/generators/lua/variables_dynamic.js index 841c7795d..ac4456d4f 100644 --- a/generators/lua/variables_dynamic.js +++ b/generators/lua/variables_dynamic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/php.js b/generators/php.js index 5c4ebcd3f..01c507569 100644 --- a/generators/php.js +++ b/generators/php.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/php/colour.js b/generators/php/colour.js index b1f7b7317..295cd31d0 100644 --- a/generators/php/colour.js +++ b/generators/php/colour.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/php/lists.js b/generators/php/lists.js index 1facc35f5..71d3f201b 100644 --- a/generators/php/lists.js +++ b/generators/php/lists.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/php/logic.js b/generators/php/logic.js index 290eeb292..451993236 100644 --- a/generators/php/logic.js +++ b/generators/php/logic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/php/loops.js b/generators/php/loops.js index dc8a1d241..265bbe689 100644 --- a/generators/php/loops.js +++ b/generators/php/loops.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/php/math.js b/generators/php/math.js index a0b36c88e..6e72a68fa 100644 --- a/generators/php/math.js +++ b/generators/php/math.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/php/procedures.js b/generators/php/procedures.js index be811c6df..e4fe80879 100644 --- a/generators/php/procedures.js +++ b/generators/php/procedures.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/php/text.js b/generators/php/text.js index a9d08137e..9bb112117 100644 --- a/generators/php/text.js +++ b/generators/php/text.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/php/variables.js b/generators/php/variables.js index 5be864eea..5ac4849ff 100644 --- a/generators/php/variables.js +++ b/generators/php/variables.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/php/variables_dynamic.js b/generators/php/variables_dynamic.js index 1a5383b47..3b1584c54 100644 --- a/generators/php/variables_dynamic.js +++ b/generators/php/variables_dynamic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/python.js b/generators/python.js index 829101490..bee76bb19 100644 --- a/generators/python.js +++ b/generators/python.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/python/colour.js b/generators/python/colour.js index 6b1d2ad81..6be61d3a9 100644 --- a/generators/python/colour.js +++ b/generators/python/colour.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/python/lists.js b/generators/python/lists.js index 3321880c0..647cbc79a 100644 --- a/generators/python/lists.js +++ b/generators/python/lists.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/python/logic.js b/generators/python/logic.js index bd29f3e7e..67e06ac35 100644 --- a/generators/python/logic.js +++ b/generators/python/logic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/python/loops.js b/generators/python/loops.js index 71a7f304b..c4e402f05 100644 --- a/generators/python/loops.js +++ b/generators/python/loops.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/python/math.js b/generators/python/math.js index 1a003c479..c5d3eb6db 100644 --- a/generators/python/math.js +++ b/generators/python/math.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/python/procedures.js b/generators/python/procedures.js index d69fae692..8cc05dd3a 100644 --- a/generators/python/procedures.js +++ b/generators/python/procedures.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/python/text.js b/generators/python/text.js index 94241ed2c..e5354ec91 100644 --- a/generators/python/text.js +++ b/generators/python/text.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/python/variables.js b/generators/python/variables.js index 7567b29fa..f72f4c137 100644 --- a/generators/python/variables.js +++ b/generators/python/variables.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/generators/python/variables_dynamic.js b/generators/python/variables_dynamic.js index 6a3376dd0..34fc1a473 100644 --- a/generators/python/variables_dynamic.js +++ b/generators/python/variables_dynamic.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/gulpfile.js b/gulpfile.js index ef9fb4148..a7e26ee47 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -21,1001 +10,54 @@ */ var gulp = require('gulp'); -gulp.shell = require('gulp-shell'); -gulp.concat = require('gulp-concat'); -gulp.replace = require('gulp-replace'); -gulp.rename = require('gulp-rename'); -gulp.insert = require('gulp-insert'); -gulp.umd = require('gulp-umd'); - -var path = require('path'); -var fs = require('fs'); -var rimraf = require('rimraf'); var execSync = require('child_process').execSync; -var through2 = require('through2'); -var closureCompiler = require('google-closure-compiler').gulp(); -var closureDeps = require('google-closure-deps'); var packageJson = require('./package.json'); -var argv = require('yargs').argv; -const upstream_url = "https://github.com/google/blockly.git"; - -//////////////////////////////////////////////////////////// -// Build // -//////////////////////////////////////////////////////////// - -const licenseRegex = `\\/\\*\\* - \\* @license - \\* (Copyright \\d+ (Google LLC|Massachusetts Institute of Technology)) -( \\* All rights reserved. -)? \\* - \\* Licensed under the Apache License, Version 2.0 \\(the "License"\\); - \\* you may not use this file except in compliance with the License. - \\* You may obtain a copy of the License at - \\* - \\* http://www.apache.org/licenses/LICENSE-2.0 - \\* - \\* Unless required by applicable law or agreed to in writing, software - \\* distributed under the License is distributed on an "AS IS" BASIS, - \\* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - \\* See the License for the specific language governing permissions and - \\* limitations under the License. - \\*\\/`; - -/** - * Helper method for stripping the Google's and MIT's Apache Licenses. - */ -function stripApacheLicense() { - // Strip out Google's and MIT's Apache licences. - // Closure Compiler preserves dozens of Apache licences in the Blockly code. - // Remove these if they belong to Google or MIT. - // MIT's permission to do this is logged in Blockly issue #2412. - return gulp.replace(new RegExp(licenseRegex, "g"), ''); -} - -/** - * Helper method for prepending the auto-generated header text. - */ -function prependHeader() { - return gulp.insert.prepend(`// Do not edit this file; automatically generated by gulp.\n`); -} - -/** - * Closure compiler warning groups used to treat warnings as errors. - * For a full list of closure compiler groups, consult: - * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/DiagnosticGroups.java#L113 - */ -var JSCOMP_ERROR = [ - 'accessControls', - 'checkPrototypalTypes', - 'checkRegExp', - 'checkTypes', - 'checkVars', - 'conformanceViolations', - 'const', - 'constantProperty', - 'deprecated', - 'deprecatedAnnotations', - 'duplicateMessage', - 'es5Strict', - 'externsValidation', - 'functionParams', - 'globalThis', - 'invalidCasts', - 'misplacedTypeAnnotation', - 'missingGetCssName', - // 'missingOverride', - 'missingPolyfill', - 'missingProperties', - 'missingProvide', - 'missingRequire', - 'missingReturn', - // 'missingSourcesWarnings', - 'moduleLoad', - 'msgDescriptions', - 'nonStandardJsDocs', - // 'polymer', - // 'reportUnknownTypes', - // 'strictCheckTypes', - // 'strictMissingProperties', - 'strictModuleDepCheck', - // 'strictPrimitiveOperators', - 'suspiciousCode', - 'typeInvalidation', - 'undefinedNames', - 'undefinedVars', - 'underscore', - 'unknownDefines', - 'unusedLocalVariables', - // 'unusedPrivateMembers', - 'useOfGoogBase', - 'uselessCode', - 'untranspilableFeatures', - 'visibility' -]; - -/** - * Helper method for calling the Closure compiler. - * @param {*} compilerOptions - * @param {boolean=} opt_verbose Optional option for verbose logging - * @param {boolean=} opt_warnings_as_error Optional option for treating warnings - * as errors. - */ -function compile(compilerOptions, opt_verbose, opt_warnings_as_error) { - compilerOptions = compilerOptions || {}; - compilerOptions.compilation_level = 'SIMPLE_OPTIMIZATIONS'; - compilerOptions.warning_level = opt_verbose ? 'VERBOSE' : 'DEFAULT'; - compilerOptions.language_in = - compilerOptions.language_in || 'ECMASCRIPT5_STRICT'; - compilerOptions.language_out = 'ECMASCRIPT5_STRICT'; - compilerOptions.rewrite_polyfills = false; - compilerOptions.hide_warnings_for = 'node_modules'; - if (opt_warnings_as_error) { - compilerOptions.jscomp_error = JSCOMP_ERROR; - } - - const platform = ['native', 'java', 'javascript']; - - return closureCompiler(compilerOptions, { platform }); -} - -/** - * Helper method for possibly adding the closure library into a sources array. - * @param {Array.} srcs - */ -function maybeAddClosureLibrary(srcs) { - if (argv.closureLibrary) { - // If you require the google closure library, you can include it in your - // build by adding the --closure-library flag. - // You will also need to include the "google-closure-library" in your list - // of devDependencies. - console.log('Including the google-closure-library in your build.'); - if (!fs.existsSync('./node_modules/google-closure-library')) { - throw Error('You must add the google-closure-library to your ' + - 'devDependencies in package.json, and run `npm install`.'); - } - srcs.push('./node_modules/google-closure-library/closure/goog/**/**/*.js'); - } - return srcs; -} - -/** - * This task builds Blockly's core files. - * blockly_compressed.js - */ -gulp.task('build-compressed', function (cb) { - const defines = 'Blockly.VERSION="' + packageJson.version + '"'; - return gulp.src(maybeAddClosureLibrary(['core/**/**/*.js']), {base: './'}) - // Directories in Blockly are used to group similar files together - // but are not used to limit access with @package, instead the - // method means something is internal to Blockly and not a public - // API. - // Flatten all files so they're in the same directory, but ensure that - // files with the same name don't conflict. - .pipe(gulp.rename(function (p) { - var dirname = p.dirname.replace(new RegExp(path.sep, "g"), "-"); - p.dirname = ""; - p.basename = dirname + "-" + p.basename; - })) - .pipe(stripApacheLicense()) - .pipe(compile({ - dependency_mode: 'PRUNE', - entry_point: './core-requires.js', - js_output_file: 'blockly_compressed.js', - externs: ['./externs/svg-externs.js', './externs/goog-externs.js'], - define: defines, - language_in: - argv.closureLibrary ? 'ECMASCRIPT_2015' : 'ECMASCRIPT5_STRICT' - }, argv.verbose, argv.strict)) - .pipe(prependHeader()) - .pipe(gulp.dest('./')); -}); - -/** - * This task builds the Blockly's built in blocks. - * blocks_compressed.js - */ -gulp.task('build-blocks', function () { - // Add provides used throughout blocks/ in order to be compatible with the - // compiler. Anything added to this list must be removed from the compiled - // result using the remove regex steps below. - const provides = ` -goog.provide('Blockly'); -goog.provide('Blockly.Blocks'); -goog.provide('Blockly.Comment'); -goog.provide('Blockly.FieldCheckbox'); -goog.provide('Blockly.FieldColour'); -goog.provide('Blockly.FieldDropdown'); -goog.provide('Blockly.FieldImage'); -goog.provide('Blockly.FieldLabel'); -goog.provide('Blockly.FieldMultilineInput'); -goog.provide('Blockly.FieldNumber'); -goog.provide('Blockly.FieldTextInput'); -goog.provide('Blockly.FieldVariable'); -goog.provide('Blockly.Mutator'); -goog.provide('Blockly.Warning');`; - return gulp.src(maybeAddClosureLibrary(['blocks/*.js']), {base: './'}) - // Add Blockly.Blocks to be compatible with the compiler. - .pipe(gulp.replace(`goog.provide('Blockly.Constants.Colour');`, - `${provides}goog.provide('Blockly.Constants.Colour');`)) - .pipe(stripApacheLicense()) - .pipe(compile({ - dependency_mode: 'NONE', - externs: ['./externs/goog-externs.js'], - js_output_file: 'blocks_compressed.js' - }, argv.verbose, argv.strict)) - .pipe(gulp.replace('\'use strict\';', '\'use strict\';\n\n\n')) - // Remove Blockly.Blocks to be compatible with Blockly. - .pipe(gulp.replace(/var Blockly=\{[^;]*\};\n?/, '')) - // Remove Blockly Fields to be compatible with Blockly. - .pipe(gulp.replace(/Blockly\.Field[^=\(]+=\{[^;]*\};/g, '')) - // Remove Blockly Warning, Comment & Mutator to be compatible with Blockly. - .pipe(gulp.replace(/Blockly\.(Comment|Warning|Mutator)=\{[^;]*\};/g, '')) - .pipe(prependHeader()) - .pipe(gulp.dest('./')); -}); - -/** - * A helper method for building a Blockly code generator. - * @param {string} language Generator language. - * @param {string} namespace Language namespace. - */ -function buildGenerator(language, namespace) { - var provides = ` -goog.provide('Blockly.Generator'); -goog.provide('Blockly.utils.global'); -goog.provide('Blockly.utils.string');`; - return gulp.src([`generators/${language}.js`, `generators/${language}/*.js`], {base: './'}) - .pipe(stripApacheLicense()) - // Add Blockly.Generator and Blockly.utils.string to be compatible with the compiler. - .pipe(gulp.replace(`goog.provide('Blockly.${namespace}');`, - `${provides}goog.provide('Blockly.${namespace}');`)) - .pipe(compile({ - dependency_mode: 'NONE', - externs: ['./externs/goog-externs.js'], - js_output_file: `${language}_compressed.js` - }, argv.verbose, argv.strict)) - .pipe(gulp.replace('\'use strict\';', '\'use strict\';\n\n\n')) - // Remove Blockly.Generator and Blockly.utils.string to be compatible with Blockly. - .pipe(gulp.replace(/var Blockly=\{[^;]*\};\s*Blockly.utils.global={};\s*Blockly.utils.string={};\n?/, '')) - .pipe(prependHeader()) - .pipe(gulp.dest('./')); -}; - -/** - * This task builds the javascript generator. - * javascript_compressed.js - */ -gulp.task('build-javascript', function() { - return buildGenerator('javascript', 'JavaScript'); -}); - -/** - * This task builds the python generator. - * python_compressed.js - */ -gulp.task('build-python', function() { - return buildGenerator('python', 'Python'); -}); - -/** - * This task builds the php generator. - * php_compressed.js - */ -gulp.task('build-php', function() { - return buildGenerator('php', 'PHP'); -}); - -/** - * This task builds the lua generator. - * lua_compressed.js - */ -gulp.task('build-lua', function() { - return buildGenerator('lua', 'Lua'); -}); - -/** - * This task builds the dart generator: - * dart_compressed.js - */ -gulp.task('build-dart', function() { - return buildGenerator('dart', 'Dart'); -}); - -/** - * This tasks builds all the generators: - * javascript_compressed.js - * python_compressed.js - * php_compressed.js - * lua_compressed.js - * dart_compressed.js - */ -gulp.task('build-generators', gulp.parallel( - 'build-javascript', - 'build-python', - 'build-php', - 'build-lua', - 'build-dart' -)); - -/** - * This task builds Blockly's uncompressed file. - * blockly_uncompressed.js - */ -gulp.task('build-uncompressed', function() { - const closurePath = argv.closureLibrary ? - 'node_modules/google-closure-library/closure/goog' : - 'closure/goog'; - const header = `// Do not edit this file; automatically generated by gulp. -'use strict'; - -this.IS_NODE_JS = !!(typeof module !== 'undefined' && module.exports); - -this.BLOCKLY_DIR = (function(root) { - if (!root.IS_NODE_JS) { - // Find name of current directory. - var scripts = document.getElementsByTagName('script'); - var re = new RegExp('(.+)[\\\/]blockly_(.*)uncompressed\\\.js$'); - for (var i = 0, script; script = scripts[i]; i++) { - var match = re.exec(script.src); - if (match) { - return match[1]; - } - } - alert('Could not detect Blockly\\'s directory name.'); - } - return ''; -})(this); - -this.BLOCKLY_BOOT = function(root) { - // Execute after Closure has loaded. -`; - const footer = ` -delete root.BLOCKLY_DIR; -delete root.BLOCKLY_BOOT; -delete root.IS_NODE_JS; -}; - -if (this.IS_NODE_JS) { - this.BLOCKLY_BOOT(this); - module.exports = Blockly; -} else { - document.write(''); - document.write(''); -} -`; - -let deps = []; -return gulp.src(maybeAddClosureLibrary(['core/**/**/*.js'])) - .pipe(through2.obj((file, _enc, cb) => { - const result = closureDeps.parser.parseFile(file.path); - for (const dep of result.dependencies) { - deps.push(dep); - } - cb(null); - })) - .on('end', () => { - // Update the path to closure for any files that we don't know the full path - // of (parsed from a goog.addDependency call). - for (const dep of deps) { - dep.setClosurePath(closurePath); - } - - const addDependency = closureDeps.depFile.getDepFileText(closurePath, deps); - - const requires = `goog.addDependency("base.js", [], []); - -// Load Blockly. -goog.require('Blockly.requires') -`; - fs.writeFileSync('blockly_uncompressed.js', - header + - addDependency + - requires + - footer); - }); -}); - -/** - * This task builds Blockly's lang files. - * msg/*.js - */ -gulp.task('build-langfiles', function(done) { - // Run js_to_json.py - const jsToJsonCmd = `python ./i18n/js_to_json.py \ ---input_file ${path.join('msg', 'messages.js')} \ ---output_dir ${path.join('msg', 'json')} \ ---quiet`; - execSync(jsToJsonCmd, { stdio: 'inherit' }); - - // Run create_messages.py - let json_files = fs.readdirSync(path.join('msg', 'json')); - json_files = json_files.filter(file => file.endsWith('json') && - !(new RegExp(/(keys|synonyms|qqq|constants)\.json$/).test(file))); - json_files = json_files.map(file => path.join('msg', 'json', file)); - const createMessagesCmd = `python ./i18n/create_messages.py \ - --source_lang_file ${path.join('msg', 'json', 'en.json')} \ - --source_synonym_file ${path.join('msg', 'json', 'synonyms.json')} \ - --source_constants_file ${path.join('msg', 'json', 'constants.json')} \ - --key_file ${path.join('msg', 'json', 'keys.json')} \ - --output_dir ${path.join('msg', 'js')} \ - --quiet ${json_files.join(' ')}`; - execSync(createMessagesCmd, { stdio: 'inherit' }); - - done(); -}); - -/** - * This tasks builds Blockly's core files: - * blockly_compressed.js - * blocks_compressed.js - * blockly_uncompressed.js - */ -gulp.task('build-core', gulp.parallel( - 'build-compressed', - 'build-blocks', - 'build-uncompressed' -)); - -/** - * This task builds all of Blockly: - * blockly_compressed.js - * blocks_compressed.js - * javascript_compressed.js - * python_compressed.js - * php_compressed.js - * lua_compressed.js - * dart_compressed.js - * blockly_uncompressed.js - * msg/json/*.js - */ -gulp.task('build', gulp.parallel( - 'build-core', - 'build-generators', - 'build-langfiles' -)); - -//////////////////////////////////////////////////////////// -// Typings // -//////////////////////////////////////////////////////////// - -// Generates the TypeScript definition file (d.ts) for Blockly. -// As well as generating the typings of each of the files under core/ and msg/, -// the script also pulls in a number of part files from typings/parts. -// This includes the header (incl License), additional useful interfaces -// including Blockly Options and Google Closure typings. -gulp.task('typings', function (cb) { - const tmpDir = './typings/tmp'; - const blocklySrcs = [ - "core/", - "core/components", - "core/components/tree", - "core/components/menu", - "core/keyboard_nav", - "core/renderers/common", - "core/renderers/measurables", - "core/theme", - "core/utils", - "msg/" - ]; - // Clean directory if exists. - if (fs.existsSync(tmpDir)) { - rimraf.sync(tmpDir); - } - fs.mkdirSync(tmpDir); - - // Find all files that will be included in the typings file. - let files = []; - blocklySrcs.forEach((src) => { - files = files.concat(fs.readdirSync(src) - .filter(fn => fn.endsWith('.js')) - .map(fn => path.join(src, fn))); - }); - - // Generate typings file for each file. - files.forEach((file) => { - const typescriptFileName = `${path.join(tmpDir, file)}.d.ts`; - if (file.indexOf('core/msg.js') > -1) { - return; - } - const cmd = `node ./node_modules/typescript-closure-tools/definition-generator/src/main.js ${file} ${typescriptFileName}`; - console.log(`Generating typings for ${file}`); - execSync(cmd, { stdio: 'inherit' }); - }); - - const srcs = [ - 'typings/parts/blockly-header.d.ts', - 'typings/parts/blockly-interfaces.d.ts', - `${tmpDir}/core/**`, - `${tmpDir}/core/components/**`, - `${tmpDir}/core/components/tree/**`, - `${tmpDir}/core/components/menu/**`, - `${tmpDir}/core/keyboard_nav/**`, - `${tmpDir}/core/renderers/common/**`, - `${tmpDir}/core/renderers/measurables/**`, - `${tmpDir}/core/utils/**`, - `${tmpDir}/core/theme/**`, - `${tmpDir}/msg/**` - ]; - return gulp.src(srcs) - .pipe(gulp.concat('blockly.d.ts')) - .pipe(gulp.dest('typings')) - .on('end', function () { - // Clean up tmp directory. - if (fs.existsSync(tmpDir)) { - rimraf.sync(tmpDir); - } - }); -}); - -//////////////////////////////////////////////////////////// -// NPM packaging tasks // -//////////////////////////////////////////////////////////// - -// The destination path where all the NPM distribution files will go. -const packageDistribution = './dist'; - -/** - * A helper method for wrapping a file into a Universal Module Definition. - * @param {string} namespace The export namespace. - * @param {Array} dependencies An array of dependencies to inject. - */ -function packageUMD(namespace, dependencies) { - return gulp.umd({ - dependencies: function () { return dependencies; }, - namespace: function () { return namespace; }, - exports: function () { return namespace; }, - template: path.join(__dirname, 'package/templates/umd.template') - }); -}; - -/** - * A helper method for wrapping a file into a CommonJS module for Node.js. - * @param {string} namespace The export namespace. - * @param {Array} dependencies An array of dependencies to inject. - */ -function packageCommonJS(namespace, dependencies) { - return gulp.umd({ - dependencies: function () { return dependencies; }, - namespace: function () { return namespace; }, - exports: function () { return namespace; }, - template: path.join(__dirname, 'package/templates/node.template') - }); -}; - -/** - * This task wraps blockly_compressed.js into a UMD module. - * @example import 'blockly/blockly'; - */ -gulp.task('package-blockly', function() { - return gulp.src('blockly_compressed.js') - .pipe(packageUMD('Blockly', [])) - .pipe(gulp.rename('blockly.js')) - .pipe(gulp.dest(packageDistribution)); -}); - -/** - * This task wraps blocks_compressed.js into a CommonJS module for Node.js. - * This is an equivelant task to package-blockly but for Node.js. - * @example import 'blockly/blockly-node'; - */ -gulp.task('package-blockly-node', function() { - // Override textToDomDocument, providing a Node.js alternative to DOMParser. - return gulp.src('blockly_compressed.js') - .pipe(gulp.insert.append(` - if (typeof DOMParser !== 'function') { - var DOMParser = require("jsdom/lib/jsdom/living").DOMParser; - var XMLSerializer = require("jsdom/lib/jsdom/living").XMLSerializer; - var doc = Blockly.utils.xml.textToDomDocument( - ''); - Blockly.utils.xml.document = function() { - return doc; - }; - }`)) - .pipe(packageCommonJS('Blockly', [])) - .pipe(gulp.rename('blockly-node.js')) - .pipe(gulp.dest(packageDistribution)); -}) - -/** - * This task wraps blocks_compressed.js into a UMD module. - * @example import 'blockly/blocks'; - */ -gulp.task('package-blocks', function() { - return gulp.src('blocks_compressed.js') - .pipe(gulp.insert.prepend(` - Blockly.Blocks={};`)) - .pipe(packageUMD('Blockly.Blocks', [{ - name: 'Blockly', - amd: './core', - cjs: './core', - }])) - .pipe(gulp.rename('blocks.js')) - .pipe(gulp.dest(packageDistribution)); -}); - -/** - * This task wraps package/index.js into a UMD module. - * We implicitly require the Node entry point in CommonJS environments, - * and the Browser entry point for AMD environments. - * @example import * as Blockly from 'blockly'; - */ -gulp.task('package-index', function() { - return gulp.src('package/index.js') - .pipe(packageUMD('Blockly', [{ - name: 'Blockly', - amd: './browser', - cjs: './node', - }])) - .pipe(gulp.rename('index.js')) - .pipe(gulp.dest(packageDistribution)); -}); - -/** - * This task wraps package/browser/index.js into a UMD module. - * By default, the module includes Blockly core and built-in blocks, - * as well as the JavaScript code generator and the English block - * localization files. - * This module is configured (in package.json) to replaces the module - * built by package-node in browser environments. - * @example import * as Blockly from 'blockly/browser'; - */ -gulp.task('package-browser', function() { - return gulp.src('package/browser/index.js') - .pipe(packageUMD('Blockly', [{ - name: 'Blockly', - amd: './core-browser', - cjs: './core-browser', - },{ - name: 'En', - amd: './msg/en', - cjs: './msg/en', - },{ - name: 'BlocklyBlocks', - amd: './blocks', - cjs: './blocks', - },{ - name: 'BlocklyJS', - amd: './javascript', - cjs: './javascript', - }])) - .pipe(gulp.rename('browser.js')) - .pipe(gulp.dest(packageDistribution)); -}); - -/** - * This task wraps package/browser/core.js into a UMD module. - * By default, the module includes the Blockly core package and a - * helper method to set the locale. - * This module is configured (in package.json) to replaces the module - * built by package-node-core in browser environments. - * @example import * as Blockly from 'blockly/core'; - */ -gulp.task('package-core', function() { - return gulp.src('package/browser/core.js') - .pipe(packageUMD('Blockly', [{ - name: 'Blockly', - amd: './blockly', - cjs: './blockly', - }])) - .pipe(gulp.rename('core-browser.js')) - .pipe(gulp.dest(packageDistribution)); -}); - -/** - * This task wraps package/node/index.js into a CommonJS module for Node.js. - * By default, the module includes Blockly core and built-in blocks, - * as well as all the code generators and the English block localization files. - * This module is configured (in package.json) to be replaced by the module - * built by package-browser in browser environments. - * @example import * as Blockly from 'blockly/node'; - */ -gulp.task('package-node', function() { - return gulp.src('package/node/index.js') - .pipe(packageCommonJS('Blockly', [{ - name: 'Blockly', - cjs: './core', - },{ - name: 'En', - cjs: './msg/en', - },{ - name: 'BlocklyBlocks', - cjs: './blocks', - },{ - name: 'BlocklyJS', - cjs: './javascript', - },{ - name: 'BlocklyPython', - cjs: './python', - },{ - name: 'BlocklyPHP', - cjs: './php', - },{ - name: 'BlocklyLua', - cjs: './lua', - }, { - name: 'BlocklyDart', - cjs: './dart', - }])) - .pipe(gulp.rename('node.js')) - .pipe(gulp.dest(packageDistribution)); -}); - -/** - * This task wraps package/node/core.js into a CommonJS module for Node.js. - * By default, the module includes the Blockly core package for Node.js - * and a helper method to set the locale. - * This module is configured (in package.json) to be replaced by the module - * built by package-core in browser environments. - * @example import * as Blockly from 'blockly/core'; - */ -gulp.task('package-node-core', function() { - return gulp.src('package/node/core.js') - .pipe(packageCommonJS('Blockly', [{ - name: 'Blockly', - amd: './blockly-node', - cjs: './blockly-node', - }])) - .pipe(gulp.rename('core.js')) - .pipe(gulp.dest(packageDistribution)); -}); - -/** - * A helper method for packaging a Blockly code generator into a UMD module. - * @param {string} file Source file name. - * @param {string} rename Destination file name. - * @param {string} generator Generator export namespace. - */ -function packageGenerator(file, rename, generator) { - return gulp.src(file) - .pipe(packageUMD(generator, [{ - name: 'Blockly', - amd: './core', - cjs: './core', - }])) - .pipe(gulp.rename(rename)) - .pipe(gulp.dest(packageDistribution)); -}; - -/** - * This task wraps javascript_compressed.js into a UMD module. - * @example import 'blockly/javascript'; - */ -gulp.task('package-javascript', function() { - return packageGenerator('javascript_compressed.js', 'javascript.js', 'Blockly.JavaScript'); -}); - -/** - * This task wraps python_compressed.js into a UMD module. - * @example import 'blockly/python'; - */ -gulp.task('package-python', function() { - return packageGenerator('python_compressed.js', 'python.js', 'Blockly.Python'); -}); - -/** - * This task wraps lua_compressed.js into a UMD module. - * @example import 'blockly/lua'; - */ -gulp.task('package-lua', function() { - return packageGenerator('lua_compressed.js', 'lua.js', 'Blockly.Lua'); -}); - -/** - * This task wraps dart_compressed.js into a UMD module. - * @example import 'blockly/dart'; - */ -gulp.task('package-dart', function() { - return packageGenerator('dart_compressed.js', 'dart.js', 'Blockly.Dart'); -}); - -/** - * This task wraps php_compressed.js into a UMD module. - * @example import 'blockly/php'; - */ -gulp.task('package-php', function() { - return packageGenerator('php_compressed.js', 'php.js', 'Blockly.PHP'); -}); - -/** - * This task wraps each of the msg/js/* files into a UMD module. - * @example import * as En from 'blockly/msg/en'; - */ -gulp.task('package-locales', function() { - // Remove references to goog.provide and goog.require. - return gulp.src('msg/js/*.js') - .pipe(gulp.replace(/goog\.[^\n]+/g, '')) - .pipe(gulp.insert.prepend(` - var Blockly = {};Blockly.Msg={};`)) - .pipe(packageUMD('Blockly.Msg', [{ - name: 'Blockly', - amd: '../core', - cjs: '../core', - }])) - .pipe(gulp.dest(`${packageDistribution}/msg`)); -}); - -/** - * This task creates a UMD bundle of Blockly which includes the Blockly - * core files, the built-in blocks, the JavaScript code generator and the - * English localization files. - * @example - */ -gulp.task('package-umd-bundle', function() { - var srcs = [ - 'blockly_compressed.js', - 'msg/js/en.js', - 'blocks_compressed.js', - 'javascript_compressed.js' - ]; - return gulp.src(srcs) - .pipe(gulp.concat('blockly.min.js')) - .pipe(packageUMD('Blockly', [])) - .pipe(gulp.dest(`${packageDistribution}`)) -}); - -/** - * This task copies all the media/* files into the distribution directory. - */ -gulp.task('package-media', function() { - return gulp.src('./media/*') - .pipe(gulp.dest(`${packageDistribution}/media`)); -}); - -/** - * This task copies the package.json file into the distribution directory. - */ -gulp.task('package-json', function() { - return gulp.src('./package.json') - .pipe(gulp.dest(`${packageDistribution}`)) -}); - -/** - * This task copies the package/README.md file into the distribution directory. - * This file is what developers will see at https://www.npmjs.com/package/blockly. - */ -gulp.task('package-readme', function() { - return gulp.src('./package/README.md') - .pipe(gulp.dest(`${packageDistribution}`)) -}); - -/** - * This task copies the typings/blockly.d.ts TypeScript definition file into the - * distribution directory. - * The bundled declaration file is referenced in package.json in the types property. - */ -gulp.task('package-dts', function() { - return gulp.src('./typings/blockly.d.ts') - .pipe(gulp.dest(`${packageDistribution}`)) -}); - -/** - * This task prepares the NPM distribution files under the /dist directory. - */ -gulp.task('package', gulp.parallel( - 'package-index', - 'package-browser', - 'package-node', - 'package-core', - 'package-node-core', - 'package-blockly', - 'package-blockly-node', - 'package-blocks', - 'package-javascript', - 'package-python', - 'package-lua', - 'package-dart', - 'package-php', - 'package-locales', - 'package-media', - 'package-umd-bundle', - 'package-json', - 'package-readme', - 'package-dts' - )); - -// The default task builds Blockly. -gulp.task('default', gulp.series(['build'])); - - -// Stash current state, check out the named branch, and sync with -// google/blockly. -function syncBranch(branchName) { - return function(done) { - execSync('git stash save -m "Stash for sync"', { stdio: 'inherit' }); - execSync('git checkout ' + branchName, { stdio: 'inherit' }); - execSync('git pull ' + upstream_url + ' ' + branchName, - { stdio: 'inherit' }); - execSync('git push origin ' + branchName, { stdio: 'inherit' }); - done(); - } -} - -// Stash current state, check out develop, and sync with google/blockly. -gulp.task('git-sync-develop', syncBranch('develop')); - -// Stash current state, check out master, and sync with google/blockly. -gulp.task('git-sync-master', syncBranch('master')); - -// Helper function: get a name for a rebuild branch. Format: rebuild_mm_dd_yyyy. -function getRebuildBranchName() { - var date = new Date(); - var mm = date.getMonth() + 1; // Month, 0-11 - var dd = date.getDate(); // Day of the month, 1-31 - var yyyy = date.getFullYear(); - return 'rebuild_' + mm + '_' + dd + '_' + yyyy; -}; - -// Helper function: get a name for a rebuild branch. Format: rebuild_yyyy_mm. -function getRCBranchName() { - var date = new Date(); - var mm = date.getMonth() + 1; // Month, 0-11 - var yyyy = date.getFullYear(); - return 'rc_' + yyyy + '_' + mm; -}; - -// Recompile and push to origin. -gulp.task('git-recompile', gulp.series([ - 'git-sync-develop', - function(done) { - var branchName = getRebuildBranchName(); - console.log('make-rebuild-branch: creating branch ' + branchName); - execSync('git checkout -b ' + branchName, { stdio: 'inherit' }); - done(); - }, - 'build', - 'typings', - function(done) { - console.log('push-rebuild-branch: committing rebuild'); - execSync('git commit -am "Rebuild"', { stdio: 'inherit' }); - var branchName = getRebuildBranchName(); - execSync('git push origin ' + branchName, { stdio: 'inherit' }); - console.log('Branch ' + branchName + ' pushed to GitHub.'); - console.log('Next step: create a pull request against develop.'); - done(); - } - ]) -); - -// Create and push an RC branch. -// Note that this pushes to google/blockly. -gulp.task('git-create-rc', gulp.series([ - 'git-sync-develop', - function(done) { - var branchName = getRCBranchName(); - execSync('git checkout -b ' + branchName, { stdio: 'inherit' }); - execSync('git push ' + upstream_url + ' ' + branchName, - { stdio: 'inherit' }); - execSync('git checkout -b gh-pages'); - execSync('git push ' + upstream_url + ' gh-pages'); - done(); - }, - ]) -); +var typings = require('./scripts/gulpfiles/typings'); +var buildTasks = require('./scripts/gulpfiles/build_tasks'); +var packageTasks = require('./scripts/gulpfiles/package_tasks'); +var gitTasks = require('./scripts/gulpfiles/git_tasks'); +var licenseTasks = require('./scripts/gulpfiles/license_tasks'); // See https://docs.npmjs.com/cli/version. -gulp.task('preversion', gulp.series([ - 'git-sync-master', - function(done) { - // Create a branch named bump_version for the bump and rebuild. - execSync('git checkout -b bump_version', { stdio: 'inherit' }); - done(); - }, - ]) +const preversion = gulp.series( + gitTasks.syncMaster, + function(done) { + // Create a branch named bump_version for the bump and rebuild. + execSync('git checkout -b bump_version', { stdio: 'inherit' }); + done(); + }, ); // See https://docs.npmjs.com/cli/version -gulp.task('postversion', gulp.series([ - function(done) { - // Push both the branch and tag to google/blockly. - execSync('git push ' + upstream_url + ' bump_version', - { stdio: 'inherit' }); - var tagName = 'v' + packageJson.version; - execSync('git push ' + upstream_url + ' ' + tagName, - { stdio: 'inherit' }); - done(); - } - ]) -); +function postversion(done) { + // Push both the branch and tag to google/blockly. + execSync('git push ' + upstream_url + ' bump_version', + { stdio: 'inherit' }); + var tagName = 'v' + packageJson.version; + execSync('git push ' + upstream_url + ' ' + tagName, + { stdio: 'inherit' }); + done(); +}; + +module.exports = { + default: buildTasks.build, + build: buildTasks.build, + buildCore: buildTasks.core, + buildBlocks: buildTasks.blocks, + buildLangfiles: buildTasks.langfiles, + buildUncompressed: buildTasks.uncompressed, + buildCompressed: buildTasks.compressed, + buildGenerators: buildTasks.generators, + preversion: preversion, + postversion: postversion, + gitSyncDevelop: gitTasks.syncDevelop, + gitSyncMaster: gitTasks.syncMaster, + gitCreateRC: gitTasks.createRC, + gitRecompile: gitTasks.recompile, + gitUpdateGithubPages: gitTasks.updateGithubPages, + typings: typings.typings, + package: packageTasks.package, + checkLicenses: licenseTasks.checkLicenses +}; diff --git a/lua_compressed.js b/lua_compressed.js index 2551079e0..e8c844fcc 100644 --- a/lua_compressed.js +++ b/lua_compressed.js @@ -12,12 +12,12 @@ return d+b+c};Blockly.Lua.colour={};Blockly.Lua.colour_picker=function(a){return Blockly.Lua.colour_rgb=function(a){var b=Blockly.Lua.provideFunction_("colour_rgb",["function "+Blockly.Lua.FUNCTION_NAME_PLACEHOLDER_+"(r, g, b)"," r = math.floor(math.min(100, math.max(0, r)) * 2.55 + .5)"," g = math.floor(math.min(100, math.max(0, g)) * 2.55 + .5)"," b = math.floor(math.min(100, math.max(0, b)) * 2.55 + .5)",' return string.format("#%02x%02x%02x", r, g, b)',"end"]),c=Blockly.Lua.valueToCode(a,"RED",Blockly.Lua.ORDER_NONE)||0,d=Blockly.Lua.valueToCode(a,"GREEN",Blockly.Lua.ORDER_NONE)|| 0;a=Blockly.Lua.valueToCode(a,"BLUE",Blockly.Lua.ORDER_NONE)||0;return[b+"("+c+", "+d+", "+a+")",Blockly.Lua.ORDER_HIGH]}; Blockly.Lua.colour_blend=function(a){var b=Blockly.Lua.provideFunction_("colour_blend",["function "+Blockly.Lua.FUNCTION_NAME_PLACEHOLDER_+"(colour1, colour2, ratio)"," local r1 = tonumber(string.sub(colour1, 2, 3), 16)"," local r2 = tonumber(string.sub(colour2, 2, 3), 16)"," local g1 = tonumber(string.sub(colour1, 4, 5), 16)"," local g2 = tonumber(string.sub(colour2, 4, 5), 16)"," local b1 = tonumber(string.sub(colour1, 6, 7), 16)"," local b2 = tonumber(string.sub(colour2, 6, 7), 16)"," local ratio = math.min(1, math.max(0, ratio))", -" local r = math.floor(r1 * (1 - ratio) + r2 * ratio + .5)"," local g = math.floor(g1 * (1 - ratio) + g2 * ratio + .5)"," local b = math.floor(b1 * (1 - ratio) + b2 * ratio + .5)",' return string.format("#%02x%02x%02x", r, g, b)',"end"]),c=Blockly.Lua.valueToCode(a,"COLOUR1",Blockly.Lua.ORDER_NONE)||"'#000000'",d=Blockly.Lua.valueToCode(a,"COLOUR2",Blockly.Lua.ORDER_NONE)||"'#000000'";a=Blockly.Lua.valueToCode(a,"RATIO",Blockly.Lua.ORDER_NONE)||0;return[b+"("+c+", "+d+", "+a+")",Blockly.Lua.ORDER_HIGH]};Blockly.Lua.lists={};Blockly.Lua.lists_create_empty=function(a){return["{}",Blockly.Lua.ORDER_ATOMIC]};Blockly.Lua.lists_create_with=function(a){for(var b=Array(a.itemCount_),c=0;c", - "lastupdated": "2020-01-23 14:59:14.637552", + "lastupdated": "2020-04-02 16:01:48.114405", "locale": "en", "messagedocumentation" : "qqq" }, diff --git a/msg/json/ia.json b/msg/json/ia.json index 4f8460ed9..6fec39b21 100644 --- a/msg/json/ia.json +++ b/msg/json/ia.json @@ -7,6 +7,7 @@ ] }, "VARIABLES_DEFAULT_NAME": "cosa", + "UNNAMED_KEY": "sin nomine", "TODAY": "Hodie", "DUPLICATE_BLOCK": "Duplicar", "ADD_COMMENT": "Adder commento", diff --git a/msg/json/it.json b/msg/json/it.json index 2fe88f838..842b23708 100644 --- a/msg/json/it.json +++ b/msg/json/it.json @@ -12,7 +12,8 @@ "Samuele2002", "Greis", "Sarah Bernabei", - "Albe Albe 460" + "Albe Albe 460", + "Albe Albe460" ] }, "VARIABLES_DEFAULT_NAME": "elemento", @@ -354,5 +355,6 @@ "PROCEDURES_IFRETURN_HELPURL": "http://c2.com/cgi/wiki?GuardClause", "PROCEDURES_IFRETURN_WARNING": "Attenzioneː Questo blocco può essere usato solo all'interno di una definizione di funzione.", "WORKSPACE_COMMENT_DEFAULT_TEXT": "Scrivi qualcosa...", + "WORKSPACE_ARIA_LABEL": "Area di lavoro di Blockly", "COLLAPSED_WARNINGS_WARNING": "I blocchi compressi contengono avvertimenti." } diff --git a/msg/json/kab.json b/msg/json/kab.json index 522454452..ce5ccf9b4 100644 --- a/msg/json/kab.json +++ b/msg/json/kab.json @@ -4,7 +4,8 @@ "Amaziɣ maziɣ", "Belkacem77", "Alem", - "YubaWissin" + "YubaWissin", + "SlimaneAmiri" ] }, "VARIABLES_DEFAULT_NAME": "aferdis", @@ -343,5 +344,6 @@ "PROCEDURES_IFRETURN_TOOLTIP": "ma yella azal d idetti, ad d-yerr azal-nniḍen wis sin.", "PROCEDURES_IFRETURN_WARNING": "Ɣur-k: Iḥder-agi yezmer ur yettwaseqdac ara ala di tebadut n twuri-agi.", "WORKSPACE_COMMENT_DEFAULT_TEXT": "Ini kra...", + "WORKSPACE_ARIA_LABEL": "Tallunt n umahel Blockly", "COLLAPSED_WARNINGS_WARNING": "Iḥedran yettin gebren ilɣa." } diff --git a/msg/json/kn.json b/msg/json/kn.json new file mode 100644 index 000000000..f1b46a905 --- /dev/null +++ b/msg/json/kn.json @@ -0,0 +1,129 @@ +{ + "@metadata": { + "authors": [ + "Ananth subray", + "Nayvik", + "Niekiran", + "VASANTH S.N.", + "Anoop rao" + ] + }, + "VARIABLES_DEFAULT_NAME": "ವಸ್ತು", + "UNNAMED_KEY": "ಹೆಸರಿಡದ", + "TODAY": "ಇಂದು", + "DUPLICATE_BLOCK": "ನಕಲಿಸು", + "ADD_COMMENT": "ಟಿಪ್ಪಣಿ ಸೇರಿಸು", + "REMOVE_COMMENT": "ಟಿಪ್ಪಣಿ ಅಳಿಸು", + "DUPLICATE_COMMENT": "ಟಿಪ್ಪಣಿ ನಕಲಿಸು", + "EXTERNAL_INPUTS": "ಬಾಹ್ಯ ಒಳಾಂಶಗಳು", + "INLINE_INPUTS": "ಇನ್ಲೈನ್ ಒಳಾಂಶಗಳು", + "DELETE_BLOCK": "ಬ್ಲಾಕ್ ಅಳಿಸು", + "DELETE_X_BLOCKS": "%1 ಬ್ಲಾಕ್‍ಗಳನ್ನು ಅಳಿಸು", + "DELETE_ALL_BLOCKS": "ಎಲ್ಲ %1 ಬ್ಲಾಕ್‍ಗಳನ್ನು ಅಳಿಸುವುದೇ ?", + "CLEAN_UP": "ಬ್ಲಾಕ್‍ಗಳನ್ನು ಸ್ವಚ್ಛಗೊಳಿಸು", + "COLLAPSE_BLOCK": "ಬ್ಲಾಕ್ ಮುಚ್ಚು", + "COLLAPSE_ALL": "ಬ್ಲಾಕ್‍ಗಳನ್ನು ಮುಚ್ಚು", + "EXPAND_BLOCK": "ಬ್ಲಾಕ್ ವಿಸ್ತರಿಸು", + "EXPAND_ALL": "ಬ್ಲಾಕ್‍ಗಳನ್ನು ವಿಸ್ತರಿಸು", + "DISABLE_BLOCK": "ಬ್ಲಾಕ್ ನಿಷ್ಕ್ರಿಯಗೊಳಿಸು", + "ENABLE_BLOCK": "ಬ್ಲಾಕ್ ಸಕ್ರಿಯಗೊಳಿಸು", + "HELP": "ಸಹಾಯ", + "UNDO": "ಹಿಂದಿದ್ದ ಸ್ಥಿತಿಗೆ ಮರಳಿಸು", + "REDO": "ಮುಂದಿದ್ದ ಸ್ಥಿತಿಗೆ ಮರಳಿಸು", + "CHANGE_VALUE_TITLE": "ಮೌಲ್ಯ ಬದಲಾಯಿಸು:", + "RENAME_VARIABLE": "ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶ ಮರುಹೆಸರಿಸು...", + "RENAME_VARIABLE_TITLE": "ಎಲ್ಲ '%1' ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶಗಳನ್ನು ಮರುಹೆಸರಿಸು:", + "NEW_VARIABLE": "ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶ ಸೃಷ್ಟಿಸು ...", + "NEW_STRING_VARIABLE": "ಅಕ್ಷರ ಮಾಲೆ ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶ ಸೃಷ್ಟಿಸು...", + "NEW_NUMBER_VARIABLE": "ಸಂಖ್ಯೆ ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶ ಸೃಷ್ಟಿಸು ...", + "NEW_COLOUR_VARIABLE": "ಬಣ್ಣ ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶ ಸೃಷ್ಟಿಸು ...", + "NEW_VARIABLE_TYPE_TITLE": "ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶದ ಬಗೆ:", + "NEW_VARIABLE_TITLE": "ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶದ ಹೆಸರು:", + "VARIABLE_ALREADY_EXISTS": "'%1' ಎನ್ನುವ ಹೆಸರಿನ ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶ ಈಗಾಗಲೇ ಅಸ್ತಿತ್ವದಲ್ಲಿದೆ.", + "VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE": "%1' ಎನ್ನುವ ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶವು ಈಗಾಗಲೇ '%2' ಬಗೆಯಲ್ಲಿ ಅಸ್ತಿತ್ವದಲ್ಲಿದೆ.", + "DELETE_VARIABLE_CONFIRMATION": "'%2' ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶದ '%1' ಉಪಯೋಗಗಳನ್ನು ಅಳಿಸುವುದೇ ?", + "CANNOT_DELETE_VARIABLE_PROCEDURE": "%1' ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶವನ್ನು ಅಳಿಸಲು ಬರುವುದಿಲ್ಲ. ಏಕೆಂದರೆ ಅದು '%2' ಕೆಲಸದಲ್ಲಿ ಉಪಯೋಗಿಸಲ್ಪಟ್ಟಿದೆ", + "DELETE_VARIABLE": "'%1' ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶವನ್ನು ಅಳಿಸು", + "COLOUR_PICKER_HELPURL": "https://en.wikipedia.org/wiki/Color", + "COLOUR_PICKER_TOOLTIP": "ವರ್ಣಫಲಕದಿಂದ ಬಣ್ಣವನು ಆರಿಸು.", + "COLOUR_RANDOM_TITLE": "ಅಸಂಬದ್ದ ಬಣ್ಣ", + "COLOUR_RANDOM_TOOLTIP": "ಯಾವುದಾದರೂ ಒಂದು ಬಣ್ಣವನ್ನು ಆರಿಸು.", + "COLOUR_RGB_TITLE": "ಬಣ್ಣದೊಂದಿಗೆ", + "COLOUR_RGB_RED": "ಕೆಂಪು", + "COLOUR_RGB_GREEN": "ಹಸಿರು", + "COLOUR_RGB_BLUE": "ನೀಲಿ", + "COLOUR_RGB_TOOLTIP": "ನಿರ್ಧಿಷ್ಟವಾದ ಪ್ರಮಾಣದಲ್ಲಿ ಕೆಂಪು, ಹಸಿರು, ಮತ್ತು ನೀಲಿ ಯನ್ನು ಹೊಂದಿದ ಒಂದು ಬಣ್ಣವನ್ನು ರಚಿಸಿ. ಎಲ್ಲಾ ಮೌಲ್ಯಗಳು 0 ಮತ್ತು 100 ರ ನಡುವೆ ಇರಬೇಕು.", + "COLOUR_BLEND_TITLE": "ಮಿಶ್ರಣ", + "COLOUR_BLEND_COLOUR1": "ಬಣ್ಣ 1", + "COLOUR_BLEND_COLOUR2": "ಬಣ್ಣ 2", + "COLOUR_BLEND_RATIO": "ಅನುಪಾತ", + "COLOUR_BLEND_TOOLTIP": "ಕೊಟ್ಟಿರುವ ಅನುಪಾತದ (0.0 - 1.0) ಪ್ರಕಾರ ಎರಡು ಬಣ್ಣವನ್ನು ಮಿಶ್ರಣ ಮಾಡುತ್ತದೆ.", + "CONTROLS_REPEAT_HELPURL": "https://en.wikipedia.org/wiki/For_loop", + "CONTROLS_REPEAT_TITLE": "%1 ಬಾರಿ ಪುನರಾವರ್ತಿಸು", + "CONTROLS_REPEAT_INPUT_DO": "ಮಾಡು", + "CONTROLS_REPEAT_TOOLTIP": "ಕೆಲವು ಹೇಳಿಕೆಗಳನ್ನು ಹಲವಾರು ಬಾರಿ ಮಾಡು.", + "CONTROLS_WHILEUNTIL_OPERATOR_WHILE": "ಪುನರಾವರ್ತಿಸು ಇ ಸಮಯದಲ್ಲಿ", + "CONTROLS_WHILEUNTIL_OPERATOR_UNTIL": "ಪುನರಾವರ್ತಿಸು ಇ ತನಕ", + "CONTROLS_WHILEUNTIL_TOOLTIP_WHILE": "ಮೌಲ್ಯವು ನಿಜವಾಗಿರುವ ಸಮಯದಲ್ಲಿ, ಕೆಲವು ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡಿ.", + "CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL": "ಮೌಲ್ಯವು ಸುಳ್ಳಾಗಿರುವ ಸಮಯದಲ್ಲಿ, ಕೆಲವು ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡಿ.", + "CONTROLS_FOR_TOOLTIP": "'%1' ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶವು ಆರಂಭದ ಸಂಖ್ಯೆಯಿಂದ ಕೊನೆಯ ಸಂಖ್ಯೆಯ ತನಕ ಒಂದು ಮೌಲ್ಯವನ್ನು ಹೊಂದಿರಲಿ, ನಿಗದಿತ ಪ್ರಮಾಣದಲ್ಲಿ ಎಣಿಸುವುದನ್ನು ನಿರ್ಧರಿಸಿ, ನಿಗದಿಪಡಿಸಿದ ಬ್ಲಾಕ್‍ಗಳನ್ನು ಮಾಡಿ.", + "CONTROLS_FOR_TITLE": "%1 ಜೊತೆ ಎಣಿಸು %2 ಇಂದ %3 ತನಕ %4 ಪ್ರಮಾಣದಲ್ಲಿ", + "CONTROLS_FOREACH_TITLE": "ಪ್ರತಿ ವಸ್ತುವಿಗೆ %1 ಇ ಪಟ್ಟಿಯಲ್ಲಿ %2", + "CONTROLS_FOREACH_TOOLTIP": "ಪಟ್ಟಿಯಲ್ಲಿರುವ ಪ್ರತಿ ವಸ್ತುವಿಗೆ, ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶ '%1' ಅನ್ನು ವಸ್ತುವಿನೊಂದಿಗೆ ಹೊಂದಿಸಿ , ಆಮೇಲೆ ಕೆಲವು ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡಿ.", + "CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK": "ಸುತ್ತುವಿಕೆಯಿಂದ ಹೊರ ಬಾ", + "CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE": "ಸುತ್ತುವಿಕೆಯ ಮುಂದಿನ ಪುನರಾವರ್ತನೆಯೊಂದಿಗೆ ಮುಂದುವರಿಯಿರಿ", + "CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK": "ಒಳಗೊಂಡಿರುವ ಸುತ್ತುವಿಕೆಯಿಂದ ಹೊರಬನ್ನಿ.", + "CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE": "ಉಳಿದ ಸುತ್ತುವಿಕೆ ಬಿಟ್ಟು ಮುಂದೆ ಹೋಗಿ, ಮತ್ತು ಮುಂದಿನ ಪುನರಾವರ್ತನೆಯೊಂದಿಗೆ ಮುಂದುವರಿಯಿರಿ.", + "CONTROLS_FLOW_STATEMENTS_WARNING": "ಎಚ್ಚರಿಕೆ: ಈ ಬ್ಲಾಕ್ ಅನ್ನು ಸುತ್ತುವಿಕೆ ಒಳಗಡೆ ಮಾತ್ರ ಬಳಸಬಹುದಾಗಿದೆ.", + "CONTROLS_IF_TOOLTIP_1": "ಮೌಲ್ಯವು ನಿಜ ಆಗಿದ್ದರೆ , ಕೆಲವು ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡು.", + "CONTROLS_IF_TOOLTIP_2": "ಮೌಲ್ಯವು ನಿಜ ಆಗಿದ್ದರೆ, ಮೊದಲನೇ ವಿಭಾಗದ ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡು, ಇಲ್ಲವಾದರೆ, ಎರಡನೇ ವಿಭಾಗದ ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡು.", + "CONTROLS_IF_TOOLTIP_3": "ಮೊದಲನೆಯ ಮೌಲ್ಯವು ನಿಜ ಆಗಿದ್ದರೆ, ಮೊದಲ ವಿಭಾಗದ ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡು. ಇಲ್ಲವಾದರೆ, ಎರಡನೇ ಮೌಲ್ಯವು ನಿಜವಾಗಿದ್ದರೆ, ಎರಡನೇ ವಿಭಾಗದ ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡು.", + "CONTROLS_IF_TOOLTIP_4": "ಮೊದಲನೆಯ ಮೌಲ್ಯವು ನಿಜ ಆಗಿದ್ದರೆ, ಮೊದಲ ವಿಭಾಗದ ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡು. ಇಲ್ಲವಾದರೆ, ಎರಡನೇ ಮೌಲ್ಯವು ನಿಜವಾಗಿದ್ದರೆ, ಎರಡನೇ ವಿಭಾಗದ ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡು. ಒಂದುವೇಳೆ ಯಾವುದೇ ಮೌಲ್ಯವು ನಿಜವಾಗಿರದಿದ್ದರೆ, ಕೊನೆಯ ವಿಭಾಗದ ಹೇಳಿಕೆಗಳನ್ನು ಮಾಡು.", + "CONTROLS_IF_MSG_IF": "ಆಗಿದ್ದರೆ", + "CONTROLS_IF_MSG_ELSEIF": "ಆಗಿರದಿದ್ದರೆ ಆಗಿದ್ದರೆ", + "CONTROLS_IF_MSG_ELSE": "ಆಗಿರದಿದ್ದರೆ", + "CONTROLS_IF_IF_TOOLTIP": "ಆಗಿದ್ದರೆ ಬ್ಲಾಕ್ ಅನ್ನು ಮರುವಿನ್ಯಾಸ ಗೊಳಿಸಲು ಅದರ ಭಾಗಗಳನ್ನು ಸೇರಿಸು, ತೆಗೆ, ಅಥವಾ ಮರುಕ್ರಮಗೊಳಿಸು.", + "CONTROLS_IF_ELSEIF_TOOLTIP": "'ಆಗಿದ್ದರೆ' ಬ್ಲಾಕ್ ಗೆ ಒಂದು ನಿಯಮವನ್ನು ಸೇರಿಸು.", + "CONTROLS_IF_ELSE_TOOLTIP": "ಕೊನೆಯ, ಎಲ್ಲ-ಹಿಡಿ ನಿಯಮವನ್ನು 'ಆಗಿದ್ದರೆ' ಬ್ಲಾಕ್ ಗೆ ಸೇರಿಸು.", + "IOS_OK": "ಸರಿ", + "IOS_CANCEL": "ರದ್ದುಮಾಡು", + "IOS_ERROR": "ತಪ್ಪು", + "IOS_PROCEDURES_INPUTS": "ಒಳಾಂಶಗಳು", + "IOS_PROCEDURES_ADD_INPUT": "+ ಒಳಾಂಶವನ್ನು ಸೇರಿಸು", + "IOS_PROCEDURES_ALLOW_STATEMENTS": "ಹೇಳಿಕೆಗಳನ್ನು ಅನುಮತಿಸಿ", + "IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR": "ಈ ಕೆಲಸವು ನಕಲಿ ಒಳಾಂಶಗಳನ್ನು ಒಳಗೊಂಡಿರುತ್ತದೆ.", + "IOS_VARIABLES_ADD_VARIABLE": "+ ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶವನ್ನು ಸೇರಿಸು", + "IOS_VARIABLES_ADD_BUTTON": "ಸೇರಿಸು", + "IOS_VARIABLES_RENAME_BUTTON": "ಹೆಸರು ಬದಲಾಯಿಸು", + "IOS_VARIABLES_DELETE_BUTTON": "ಅಳಿಸು", + "IOS_VARIABLES_VARIABLE_NAME": "ಮಾರ್ಪಡಿಸಬಹುದಾದ ಮೂಲಾಂಶದ ಹೆಸರು", + "IOS_VARIABLES_EMPTY_NAME_ERROR": "ನೀವು ಖಾಲಿ ಮೂಲಾಂಶದ ಹೆಸರನ್ನು ಬಳಸಲಾಗುವುದಿಲ್ಲ.", + "LOGIC_COMPARE_HELPURL": "https://en.wikipedia.org/wiki/Inequality_(mathematics)", + "LOGIC_OPERATION_AND": "ಮತ್ತು", + "LOGIC_OPERATION_OR": "ಅಥವಾ", + "LOGIC_BOOLEAN_TRUE": "ನಿಜ", + "LOGIC_BOOLEAN_FALSE": "ತಪ್ಪು", + "LOGIC_NULL": "ಶೂನ್ಯ", + "LOGIC_TERNARY_CONDITION": "ಟೆಸ್ಟ್", + "MATH_NUMBER_TOOLTIP": "ಹಲವಾರು", + "MATH_SINGLE_OP_ROOT": "ವರ್ಗಮೂಲ", + "MATH_SINGLE_TOOLTIP_ROOT": "ಸಂಖ್ಯೆಯ ವರ್ಗಮೂಲ ಮರಳಿಸು.", + "MATH_SINGLE_OP_ABSOLUTE": "ಸಂಪೂರ್ಣ", + "MATH_SINGLE_TOOLTIP_ABS": "ಸಂಖ್ಯೆಯ ಪರಿಪೂರ್ಣ ಮೌಲ್ಯ ಮರಳಿಸು", + "MATH_ROUND_OPERATOR_ROUND": "ಸುತ್ತು", + "MATH_RANDOM_INT_HELPURL": "https://en.wikipedia.org/wiki/Random_number_generation", + "MATH_RANDOM_FLOAT_HELPURL": "https://en.wikipedia.org/wiki/Random_number_generation", + "TEXT_CREATE_JOIN_TITLE_JOIN": "ಸೇರಿಸಿ", + "TEXT_GET_SUBSTRING_INPUT_IN_TEXT": "ಪಠ್ಯದಲ್ಲಿ", + "TEXT_PRINT_TITLE": "ಮುದ್ರಣ %1", + "LISTS_CREATE_WITH_CONTAINER_TITLE_ADD": "ಪಟ್ಟಿ", + "LISTS_INLIST": "ಪಟ್ಟಿಯಲ್ಲಿ", + "LISTS_GET_INDEX_GET": "ಪಡೆಯಲು", + "LISTS_GET_INDEX_GET_REMOVE": "ಪಡೆಯಲು ಮತ್ತು ತೆಗೆಯಲು", + "LISTS_GET_INDEX_REMOVE": "ತೆಗೆ", + "LISTS_GET_INDEX_FROM_END": "ಕೊನೆಯಿಂದ", + "LISTS_GET_INDEX_FIRST": "ಮೊದಲ", + "LISTS_GET_INDEX_LAST": "ಕೊನೆಯ", + "PROCEDURES_BEFORE_PARAMS": "ಜೊತೆ:", + "PROCEDURES_CALL_BEFORE_PARAMS": "ಜೊತೆ:" +} diff --git a/msg/json/lv.json b/msg/json/lv.json index 65859303a..e3ed010a9 100644 --- a/msg/json/lv.json +++ b/msg/json/lv.json @@ -9,6 +9,7 @@ ] }, "VARIABLES_DEFAULT_NAME": "vienums", + "UNNAMED_KEY": "nenosaukts", "TODAY": "Šodiena", "DUPLICATE_BLOCK": "Dublēt", "ADD_COMMENT": "Pievienot komentāru", diff --git a/msg/json/nl.json b/msg/json/nl.json index 3e4892af5..f60798e0f 100644 --- a/msg/json/nl.json +++ b/msg/json/nl.json @@ -15,7 +15,8 @@ "Patio", "KlaasZ4usV", "Marcelhospers", - "Elroy" + "Elroy", + "Klaas van Buiten" ] }, "VARIABLES_DEFAULT_NAME": "item", diff --git a/msg/json/pl.json b/msg/json/pl.json index 9791bfa93..34d93bb82 100644 --- a/msg/json/pl.json +++ b/msg/json/pl.json @@ -20,7 +20,8 @@ "InternerowyGołąb", "Wojtas", "Stojex", - "Rail" + "Rail", + "Krzyz23" ] }, "VARIABLES_DEFAULT_NAME": "element", @@ -221,6 +222,7 @@ "MATH_RANDOM_FLOAT_HELPURL": "https://en.wikipedia.org/wiki/Random_number_generation", "MATH_RANDOM_FLOAT_TITLE_RANDOM": "losowy ułamek", "MATH_RANDOM_FLOAT_TOOLTIP": "Zwróć losowy ułamek między 0.0 (włącznie), a 1.0 (wyłącznie).", + "MATH_ATAN2_HELPURL": "https://en.wikipedia.org/wiki/Atan2", "TEXT_TEXT_HELPURL": "https://pl.wikipedia.org/wiki/Tekstowy_typ_danych", "TEXT_TEXT_TOOLTIP": "Litera, wyraz lub linia tekstu.", "TEXT_JOIN_TITLE_CREATEWITH": "utwórz tekst z", diff --git a/msg/json/sl.json b/msg/json/sl.json index 297fbdb80..07c990a65 100644 --- a/msg/json/sl.json +++ b/msg/json/sl.json @@ -99,7 +99,7 @@ "IOS_ERROR": "Napaka", "IOS_PROCEDURES_INPUTS": "VNOSI", "IOS_PROCEDURES_ADD_INPUT": "+ Dodaj vnos", - "IOS_PROCEDURES_ALLOW_STATEMENTS": "Dovoli izjave", + "IOS_PROCEDURES_ALLOW_STATEMENTS": "Vsebuje delčke", "IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR": "Ta funkcija ima podvojene vnose", "IOS_VARIABLES_ADD_VARIABLE": "+ Dodaj spremenljivko", "IOS_VARIABLES_ADD_BUTTON": "Dodaj", @@ -380,7 +380,7 @@ "PROCEDURES_DEFRETURN_HELPURL": "https://en.wikipedia.org/wiki/Procedure_%28computer_science%29", "PROCEDURES_DEFRETURN_RETURN": "vrni", "PROCEDURES_DEFRETURN_TOOLTIP": "Ustvari funkcijo z izhodom.", - "PROCEDURES_ALLOW_STATEMENTS": "dovoli korake", + "PROCEDURES_ALLOW_STATEMENTS": "vsebuje delčke", "PROCEDURES_DEF_DUPLICATE_WARNING": "Pozor: Ta funkcija ima podvojene parametre.", "PROCEDURES_CALLNORETURN_HELPURL": "https://en.wikipedia.org/wiki/Subroutine", "PROCEDURES_CALLNORETURN_TOOLTIP": "Izvede uporabniško funkcijo '%1'.", diff --git a/msg/json/tr.json b/msg/json/tr.json index 47f5fa4d5..a8a4441cd 100644 --- a/msg/json/tr.json +++ b/msg/json/tr.json @@ -130,15 +130,15 @@ "LOGIC_BOOLEAN_TRUE": "true", "LOGIC_BOOLEAN_FALSE": "false", "LOGIC_BOOLEAN_TOOLTIP": "True veya false değerini döndürür.", - "LOGIC_NULL_HELPURL": "https://en.wikipedia.org/wiki/Nullable_type", + "LOGIC_NULL_HELPURL": "https://tr.wikipedia.org/wiki/Sıfırlanabilir_tip", "LOGIC_NULL": "boş", "LOGIC_NULL_TOOLTIP": "Boş değerini döndürür.", - "LOGIC_TERNARY_HELPURL": "https://en.wikipedia.org/wiki/%3F:", + "LOGIC_TERNARY_HELPURL": "https://tr.wikipedia.org/wiki/%3F:", "LOGIC_TERNARY_CONDITION": "deneme", "LOGIC_TERNARY_IF_TRUE": "if true", "LOGIC_TERNARY_IF_FALSE": "if false", "LOGIC_TERNARY_TOOLTIP": "'test' durumunu kontrol edin. Koşul true olursa, 'if true' değerini döndürür; aksi takdirde 'if false' değerini döndürür.", - "MATH_NUMBER_HELPURL": "https://tr.wikipedia.org/wiki/Numara", + "MATH_NUMBER_HELPURL": "https://tr.wikipedia.org/wiki/Sayı", "MATH_NUMBER_TOOLTIP": "Sayı.", "MATH_ADDITION_SYMBOL": "+", "MATH_SUBTRACTION_SYMBOL": "tire", @@ -184,7 +184,7 @@ "MATH_IS_NEGATIVE": "negatif", "MATH_IS_DIVISIBLE_BY": "bölünebilir", "MATH_IS_TOOLTIP": "Bir sayının çift, tek, asal, bütün, pozitif, negatif veya belirli bir sayıya bölünebilir olup olmadığını kontrol edin. True veya false değerini döndürür.", - "MATH_CHANGE_HELPURL": "https://tr.wikipedia.org/wiki/Programlama_deyimi#Sayacı_artırma", + "MATH_CHANGE_HELPURL": "https://tr.wikipedia.org/wiki/Programlama_deyimi", "MATH_CHANGE_TITLE": "%1 %2 göre değiştir", "MATH_CHANGE_TOOLTIP": "'%1' değişkenine bir sayı ekle.", "MATH_ROUND_HELPURL": "https://tr.wikipedia.org/wiki/Yuvarlatma", @@ -372,9 +372,9 @@ "PROCEDURES_DEFRETURN_TOOLTIP": "Çıkışa sahip bir işlev oluşturur.", "PROCEDURES_ALLOW_STATEMENTS": "ifadelere izin ver", "PROCEDURES_DEF_DUPLICATE_WARNING": "Uyarı: Bu işlev yinelenen parametrelere sahiptir.", - "PROCEDURES_CALLNORETURN_HELPURL": "https://en.wikipedia.org/wiki/Alt program", + "PROCEDURES_CALLNORETURN_HELPURL": "https://tr.wikipedia.org/wiki/Alt_program", "PROCEDURES_CALLNORETURN_TOOLTIP": "Kullanıcı tanımlı '%1' işlevini çalıştırın.", - "PROCEDURES_CALLRETURN_HELPURL": "https://en.wikipedia.org/wiki/Alt program", + "PROCEDURES_CALLRETURN_HELPURL": "https://tr.wikipedia.org/wiki/Alt_program", "PROCEDURES_CALLRETURN_TOOLTIP": "Kullanıcı tanımlı '%1' işlevini çalıştırın ve çıkışını kullanın.", "PROCEDURES_MUTATORCONTAINER_TITLE": "girişler", "PROCEDURES_MUTATORCONTAINER_TOOLTIP": "Bu işleve giriş ekleyin, kaldırın veya yeniden sıralayın.", diff --git a/msg/messages.js b/msg/messages.js index ef3f46bd1..59b018e5c 100644 --- a/msg/messages.js +++ b/msg/messages.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/package-lock.json b/package-lock.json index 937808514..0e0db42f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "blockly", - "version": "3.20200123.1", + "version": "3.20200402.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -30,80 +30,203 @@ "integrity": "sha512-+o2q111WEx4srBs7L9eJmcwi655eD8sXniLqMB93TBK9GrNzGrxDWSjiqz2hLU0Ha8MTXFIP0yd9fNdP+m43ZQ==", "dev": true }, - "@wdio/config": { - "version": "5.13.0-alpha.0", - "resolved": "https://registry.npmjs.org/@wdio/config/-/config-5.13.0-alpha.0.tgz", - "integrity": "sha512-rcwtVtvmvN/F0HXhxVVv5YxPdJrrOODIZDmk/ftkwbwzpmPyIuP787YSGNgrVflLdXaDy0yIoew0rb5hPAq3bw==", + "@sindresorhus/is": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", + "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", + "dev": true + }, + "@szmarczak/http-timer": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", + "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", "dev": true, "requires": { - "@wdio/logger": "^5.12.1", + "defer-to-connect": "^1.0.1" + } + }, + "@types/caseless": { + "version": "0.12.2", + "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.2.tgz", + "integrity": "sha512-6ckxMjBBD8URvjB6J3NcnuAn5Pkl7t3TizAg+xdlzzQGSPSmBcXf8KoIH0ua/i+tio+ZRUHEXp0HEmvaR4kt0w==", + "dev": true + }, + "@types/color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", + "dev": true + }, + "@types/node": { + "version": "13.9.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.5.tgz", + "integrity": "sha512-hkzMMD3xu6BrJpGVLeQ3htQQNAcOrJjX7WFmtK8zWQpz2UJf13LCFF2ALA7c9OVdvc2vQJeDdjfR35M0sBCxvw==", + "dev": true + }, + "@types/request": { + "version": "2.48.4", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.4.tgz", + "integrity": "sha512-W1t1MTKYR8PxICH+A4HgEIPuAC3sbljoEVfyZbeFJJDbr30guDspJri2XOaM2E+Un7ZjrihaDi7cf6fPa2tbgw==", + "dev": true, + "requires": { + "@types/caseless": "*", + "@types/node": "*", + "@types/tough-cookie": "*", + "form-data": "^2.5.0" + }, + "dependencies": { + "form-data": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz", + "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + } + } + }, + "@types/tough-cookie": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.6.tgz", + "integrity": "sha512-wHNBMnkoEBiRAd3s8KTKwIuO9biFtTf0LehITzBhSco+HQI0xkXZbLOD55SW3Aqw3oUkHstkm5SPv58yaAdFPQ==", + "dev": true + }, + "@wdio/config": { + "version": "5.22.4", + "resolved": "https://registry.npmjs.org/@wdio/config/-/config-5.22.4.tgz", + "integrity": "sha512-i5dJQWb80darcRA//tfG0guMeQCeRUXroZNnHjGNb1qzvTRZmcIIhdxaD+DbK/5dWEx6aoMfoi6wjVp/CXwdAg==", + "dev": true, + "requires": { + "@wdio/logger": "5.16.10", "deepmerge": "^4.0.0", "glob": "^7.1.2" } }, "@wdio/logger": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-5.12.1.tgz", - "integrity": "sha512-KUmdS0Scj0T5UQGtcWFiQRqc0NpFLQ/vSvRxlDzzkoeGwwPINqTRkLT103KL7Lyitlm9uLfaFfYc2KSzynTung==", + "version": "5.16.10", + "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-5.16.10.tgz", + "integrity": "sha512-hRKhxgd9uB48Dtj2xe2ckxU4KwI/RO8IwguySuaI2SLFj6EDbdonwzpVkq111/fjBuq7R1NauAaNcm3AMEbIFA==", "dev": true, "requires": { - "chalk": "^2.3.0", + "chalk": "^3.0.0", "loglevel": "^1.6.0", "loglevel-plugin-prefix": "^0.8.4", - "strip-ansi": "^5.2.0" + "strip-ansi": "^6.0.0" }, "dependencies": { "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", + "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", + "dev": true + }, + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", + "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "dev": true, "requires": { - "ansi-regex": "^4.1.0" + "ansi-regex": "^5.0.0" + } + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" } } } }, "@wdio/protocols": { - "version": "5.13.0-alpha.0", - "resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-5.13.0-alpha.0.tgz", - "integrity": "sha512-1/7PhkRv3dCB8P+/yVVMXubus3xVcLh30wPcxSJS//rvcu9EU6hU4XEzJro3Ja0ixCFP4WIqnKda7Vre5EaOoQ==", + "version": "5.22.1", + "resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-5.22.1.tgz", + "integrity": "sha512-GdoWb/HTrb09Qb0S/7sLp1NU94LAhTsF1NnFj5sEFSUpecrl0S07pnhVg54pUImectN/woaqSl7uJGjlSGZcdQ==", "dev": true }, "@wdio/repl": { - "version": "5.13.0-alpha.0", - "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-5.13.0-alpha.0.tgz", - "integrity": "sha512-yjMMhfqX58Drha6OsQuFUGdRwx58F4E42zp8M4DLJU1sD9Mg0uqRjmF8TPSUoYn3QqUNCclhL+UHU5lEuAWlSg==", + "version": "5.18.6", + "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-5.18.6.tgz", + "integrity": "sha512-z9UPBk/Uee0l9g0ijnOatU3WP7TcpIyNtRj9AGsJVbYZFwqMWBqPkO4nblldyNQIuqdgXAPsDo8lPGDno12/oA==", "dev": true, "requires": { - "@wdio/config": "^5.13.0-alpha.0" + "@wdio/utils": "5.18.6" } }, "@wdio/utils": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-5.13.0.tgz", - "integrity": "sha512-SUzI694Vu8a8IMRgVpglyOlJ2JzSSrZT+YnbSgk+A1QpT/Azv1xnGJ6t48bpK3XrxpYBGOajADdOWoOydO86pg==", + "version": "5.18.6", + "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-5.18.6.tgz", + "integrity": "sha512-OVdK7P9Gne9tR6dl1GEKucwX4mtS47F26g4lH8r0HURvMegZLGtcchI1cqF6hjK7EpP737b+C3q4ooZSBdH9XQ==", "dev": true, "requires": { - "@wdio/logger": "^5.12.1", + "@wdio/logger": "5.16.10", "deepmerge": "^4.0.0" } }, "abab": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.1.tgz", - "integrity": "sha512-1zSbbCuoIjafKZ3mblY5ikvAb0ODUbqBnFuUb7f6uLeQhhGJ0vEV4ntmtxKLT2WgXCO94E07BjunsIw1jOMPZw==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", + "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==" + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dev": true, + "requires": { + "event-target-shim": "^5.0.0" + } }, "acorn": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", - "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==" + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==" }, "acorn-globals": { "version": "4.3.4", @@ -125,6 +248,15 @@ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-6.2.0.tgz", "integrity": "sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA==" }, + "agent-base": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz", + "integrity": "sha512-j1Q7cSCqN+AwrmDd+pzgqc0/NpC655x2bUf5ZjRIO77DcNBFmh+OgRNzF6OKdCC9RSCb19fGd99+bhXFdkRNqw==", + "dev": true, + "requires": { + "debug": "4" + } + }, "ajv": { "version": "6.10.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", @@ -216,18 +348,20 @@ }, "dependencies": { "bl": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.0.tgz", - "integrity": "sha512-EUAyP5UHU5hxF8BPT0LKW8gjYLhq1DQIcneOX/pL/m2Alo+OYDQAJlHq+yseMP50Os2nHXOSic6Ss3vSQeyf4A==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.0.2.tgz", + "integrity": "sha512-j4OH8f6Qg2bGuWfRiltT2HYGx0e1QcBTrK9KAHNMwMZdQnDZFk0ZSYIpADjYCB3U12nicC5tVJwSIhwOWjb4RQ==", "dev": true, "requires": { - "readable-stream": "^3.0.1" + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" } }, "readable-stream": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -236,12 +370,12 @@ } }, "tar-stream": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.0.tgz", - "integrity": "sha512-+DAn4Nb4+gz6WZigRzKEZl1QuJVOLtAwwF+WUxy1fJ6X63CaGaUAxJRD2KEn1OMfcbCjySTYpNC6WmfQoIEOdw==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.2.tgz", + "integrity": "sha512-UaF6FoJ32WqALZGOIAApXx+OdxhekNMChu6axLJR85zMMjXKWFGjbIRe+J6P4UnRGg9rAwWvbTT0oI7hD/Un7Q==", "dev": true, "requires": { - "bl": "^3.0.0", + "bl": "^4.0.1", "end-of-stream": "^1.4.1", "fs-constants": "^1.0.0", "inherits": "^2.0.3", @@ -335,9 +469,15 @@ }, "array-equal": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, "array-initial": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz", @@ -462,11 +602,6 @@ "integrity": "sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ==", "dev": true }, - "async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" - }, "async-settle": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/async-settle/-/async-settle-1.0.0.tgz", @@ -493,9 +628,9 @@ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" }, "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.9.1.tgz", + "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==" }, "bach": { "version": "1.2.0", @@ -657,9 +792,9 @@ } }, "browser-process-hrtime": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz", - "integrity": "sha512-bRFnI4NnjO6cnyLmOV/7PVoDEMJChlcfN0z4s1YMBY989/SvlfMI1lgCnkFUs53e9gQF+w7qu7XdllSTiSl8Aw==" + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", + "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==" }, "browser-stdout": { "version": "1.3.1", @@ -668,9 +803,9 @@ "dev": true }, "buffer": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz", - "integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.5.0.tgz", + "integrity": "sha512-9FTEDjLjwoAkEwyMGDjYJQN2gfRgOKBKRfiglhvibGbpeeU/pQn1bJxQqm32OD/AIeEuHxU9roxXxg34Byp/Ww==", "dev": true, "requires": { "base64-js": "^1.0.2", @@ -695,6 +830,12 @@ "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "dev": true }, + "builtins": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/builtins/-/builtins-1.0.3.tgz", + "integrity": "sha1-y5T662HIaWRR2zZTThQi+U8K7og=", + "dev": true + }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -712,6 +853,38 @@ "unset-value": "^1.0.0" } }, + "cacheable-request": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", + "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", + "dev": true, + "requires": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^3.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^4.1.0", + "responselike": "^1.0.2" + }, + "dependencies": { + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true + } + } + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -885,6 +1058,15 @@ "integrity": "sha1-4+JbIHrE5wGvch4staFnksrD3Fg=", "dev": true }, + "clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, "clone-stats": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", @@ -965,9 +1147,9 @@ } }, "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, "component-emitter": { @@ -1129,9 +1311,9 @@ }, "dependencies": { "readable-stream": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -1161,16 +1343,23 @@ "dev": true }, "cssom": { - "version": "0.3.8", - "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", - "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", + "integrity": "sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==" }, "cssstyle": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-1.4.0.tgz", - "integrity": "sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-2.2.0.tgz", + "integrity": "sha512-sEb3XFPx3jNnCAMtqrXPDeSgQr+jojtCeNf8cvMNMh1cG970+lljssvQDzPq6lmmJu2Vhqood/gtEomBiHOGnA==", "requires": { - "cssom": "0.3.x" + "cssom": "~0.3.6" + }, + "dependencies": { + "cssom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.8.tgz", + "integrity": "sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==" + } } }, "d": { @@ -1234,6 +1423,15 @@ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "dev": true, + "requires": { + "mimic-response": "^1.0.0" + } + }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", @@ -1243,15 +1441,21 @@ "type-detect": "^4.0.0" } }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" }, "deepmerge": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.0.0.tgz", - "integrity": "sha512-YZ1rOP5+kHor4hMAH+HRQnBQHg+wvS1un1hAOuIcxcBy0hzcUf6Jg2a1w65kpoOUnurOfZbERwjI1TfZxNjcww==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", "dev": true }, "default-compare": { @@ -1277,6 +1481,12 @@ "integrity": "sha1-vLgrqnKtebQmp2cy8aga1t8m1oQ=", "dev": true }, + "defer-to-connect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", + "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", + "dev": true + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -1354,9 +1564,9 @@ } }, "dom-serializer": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.1.tgz", - "integrity": "sha512-sK3ujri04WyjwQXVoK4PU3y8ula1stq10GJZpqHIUgoGZdsGzAGu65BnU3d08aTVSvO7mGPZUc0wTEDL+qGE0Q==", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.2.2.tgz", + "integrity": "sha512-2/xPb3ORsQ42nHYiSunXkDjPLBaEj/xTwUO4B7XCZQTRk7EBtTOPaygh10YAAh2OI1Qrp6NWfpAhzswj0ydt9g==", "dev": true, "requires": { "domelementtype": "^2.0.1", @@ -1410,6 +1620,12 @@ "domelementtype": "1" } }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, "duplexify": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", @@ -1464,7 +1680,7 @@ }, "entities": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", + "resolved": "http://registry.npmjs.org/entities/-/entities-1.0.0.tgz", "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", "dev": true }, @@ -1478,27 +1694,36 @@ } }, "es-abstract": { - "version": "1.14.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.2.tgz", - "integrity": "sha512-DgoQmbpFNOofkjJtKwr87Ma5EW4Dc8fWhD0R+ndq7Oc456ivUfGOOP6oAZTTKl5/CcNMP+EN+e3/iUzgE0veZg==", + "version": "1.17.5", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz", + "integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==", "dev": true, "requires": { - "es-to-primitive": "^1.2.0", + "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.0", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", - "object-inspect": "^1.6.0", + "has-symbols": "^1.0.1", + "is-callable": "^1.1.5", + "is-regex": "^1.0.5", + "object-inspect": "^1.7.0", "object-keys": "^1.1.1", - "string.prototype.trimleft": "^2.0.0", - "string.prototype.trimright": "^2.0.0" + "object.assign": "^4.1.0", + "string.prototype.trimleft": "^2.1.1", + "string.prototype.trimright": "^2.1.1" + }, + "dependencies": { + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + } } }, "es-to-primitive": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", - "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, "requires": { "is-callable": "^1.1.4", @@ -1610,12 +1835,29 @@ "strip-json-comments": "^2.0.1", "table": "^5.2.3", "text-table": "^0.2.0" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } } }, "eslint-plugin-es5": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-es5/-/eslint-plugin-es5-1.4.1.tgz", - "integrity": "sha512-kktkmkF2O7pnSZYgrMiYMbt3wCKRIiXePwILv8USDG95YgP0PzhIxSIROLLKmiQQ/Z6LuhDGWTHK04gnbXBvkg==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es5/-/eslint-plugin-es5-1.5.0.tgz", + "integrity": "sha512-Qxmfo7v2B7SGAEURJo0dpBweFf+JU15kSyALfiB2rXWcBuJ96r6X9kFHXFnhdopPHCaHjoQs1xQPUJVbGMb1AA==", "dev": true }, "eslint-scope": { @@ -1687,6 +1929,12 @@ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true + }, "execa": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", @@ -2001,9 +2249,9 @@ }, "dependencies": { "is-buffer": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz", - "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.4.tgz", + "integrity": "sha512-Kq1rokWXOPXWuaMAqZiJW4XxsmD9zGx9q4aePabbn3qCRGedtH7Cm+zV8WETitMfu1wdh+Rvd6w5egwSngUX2A==", "dev": true } } @@ -2085,12 +2333,6 @@ "map-cache": "^0.2.2" } }, - "fs": { - "version": "0.0.1-security", - "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", - "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=", - "dev": true - }, "fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", @@ -2685,6 +2927,27 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "dev": true }, + "gaxios": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-2.3.2.tgz", + "integrity": "sha512-K/+py7UvKRDaEwEKlLiRKrFr+wjGjsMz5qH7Vs549QJS7cpSCOT/BbWL7pzqECflc46FcNPipjSfB+V1m8PAhw==", + "dev": true, + "requires": { + "abort-controller": "^3.0.0", + "extend": "^3.0.2", + "https-proxy-agent": "^5.0.0", + "is-stream": "^2.0.0", + "node-fetch": "^2.3.0" + }, + "dependencies": { + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + } + } + }, "get-caller-file": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", @@ -2844,9 +3107,9 @@ }, "dependencies": { "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true } } @@ -2917,6 +3180,25 @@ } } }, + "got": { + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", + "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", + "dev": true, + "requires": { + "@sindresorhus/is": "^0.14.0", + "@szmarczak/http-timer": "^1.1.2", + "cacheable-request": "^6.0.0", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^4.1.0", + "lowercase-keys": "^1.0.1", + "mimic-response": "^1.0.1", + "p-cancelable": "^1.0.0", + "to-readable-stream": "^1.0.0", + "url-parse-lax": "^3.0.0" + } + }, "graceful-fs": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz", @@ -3042,7 +3324,7 @@ }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true, "requires": { @@ -3134,7 +3416,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -3146,7 +3428,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true } @@ -3330,7 +3612,7 @@ }, "htmlparser2": { "version": "3.8.3", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", + "resolved": "http://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", "dev": true, "requires": { @@ -3349,7 +3631,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -3361,12 +3643,18 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true } } }, + "http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", + "dev": true + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -3377,6 +3665,16 @@ "sshpk": "^1.7.0" } }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dev": true, + "requires": { + "agent-base": "6", + "debug": "4" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -3502,7 +3800,7 @@ }, "is-accessor-descriptor": { "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "resolved": "http://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, "requires": { @@ -3542,14 +3840,14 @@ "dev": true }, "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.5.tgz", + "integrity": "sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q==", "dev": true }, "is-data-descriptor": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "resolved": "http://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, "requires": { @@ -3568,9 +3866,9 @@ } }, "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "dev": true }, "is-descriptor": { @@ -3661,12 +3959,12 @@ "dev": true }, "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", + "integrity": "sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ==", "dev": true, "requires": { - "has": "^1.0.1" + "has": "^1.0.3" } }, "is-relative": { @@ -3685,12 +3983,20 @@ "dev": true }, "is-symbol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", - "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", + "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", "dev": true, "requires": { - "has-symbols": "^1.0.0" + "has-symbols": "^1.0.1" + }, + "dependencies": { + "has-symbols": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.1.tgz", + "integrity": "sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg==", + "dev": true + } } }, "is-typedarray": { @@ -3759,6 +4065,29 @@ "textextensions": "2" } }, + "js-green-licenses": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/js-green-licenses/-/js-green-licenses-1.1.0.tgz", + "integrity": "sha512-y2qezlUzR5p5BElSjJS3KqE+W91oEdCYDlRUm8WxlhGB9uxZatcLm7qy6zu1GJ0LNJItMyRTqjhHcfJrcvMIPw==", + "dev": true, + "requires": { + "argparse": "^1.0.10", + "gaxios": "^2.0.1", + "npm-package-arg": "^6.1.0", + "package-json": "^6.0.0", + "spdx-correct": "^3.0.0", + "spdx-satisfies": "^5.0.0", + "strip-json-comments": "^3.0.0" + }, + "dependencies": { + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", + "dev": true + } + } + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3825,6 +4154,21 @@ "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "dev": true }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "strip-json-comments": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", @@ -3834,21 +4178,21 @@ } }, "jsdom": { - "version": "15.1.1", - "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.1.1.tgz", - "integrity": "sha512-cQZRBB33arrDAeCrAEWn1U3SvrvC8XysBua9Oqg1yWrsY/gYcusloJC3RZJXuY5eehSCmws8f2YeliCqGSkrtQ==", + "version": "15.2.1", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-15.2.1.tgz", + "integrity": "sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g==", "requires": { "abab": "^2.0.0", - "acorn": "^6.1.1", + "acorn": "^7.1.0", "acorn-globals": "^4.3.2", "array-equal": "^1.0.0", - "cssom": "^0.3.6", - "cssstyle": "^1.2.2", + "cssom": "^0.4.1", + "cssstyle": "^2.0.0", "data-urls": "^1.1.0", "domexception": "^1.0.1", "escodegen": "^1.11.1", "html-encoding-sniffer": "^1.0.2", - "nwsapi": "^2.1.4", + "nwsapi": "^2.2.0", "parse5": "5.1.0", "pn": "^1.1.0", "request": "^2.88.0", @@ -3864,12 +4208,19 @@ "whatwg-url": "^7.0.0", "ws": "^7.0.0", "xml-name-validator": "^3.0.0" + }, + "dependencies": { + "acorn": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==" + } } }, "jshint": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.10.2.tgz", - "integrity": "sha512-e7KZgCSXMJxznE/4WULzybCMNXNAd/bf5TSrvVEq78Q/K8ZwFpmBqQeDtNiHc3l49nV4E/+YeHU/JZjSUIrLAA==", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.11.0.tgz", + "integrity": "sha512-ooaD/hrBPhu35xXW4gn+o3SOuzht73gdBuffgJzrZBJZPGgGiiTvJEgTyxFvBO2nz0+X1G6etF8SzUODTlLY6Q==", "dev": true, "requires": { "cli": "~1.0.0", @@ -3890,6 +4241,12 @@ } } }, + "json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "dev": true + }, "json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", @@ -3934,10 +4291,19 @@ "integrity": "sha1-h/zPrv/AtozRnVX2cilD+SnqNeo=", "dev": true }, + "keyv": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", + "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "dev": true, + "requires": { + "json-buffer": "3.0.0" + } + }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true }, "klaw": { @@ -4159,9 +4525,9 @@ } }, "loglevel": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.4.tgz", - "integrity": "sha512-p0b6mOGKcGa+7nnmKbpzR6qloPbrgLcnio++E+14Vo/XffOGwZtRpUhr8dTH/x2oCMmEoIU0Zwm3ZauhvYD17g==", + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.6.7.tgz", + "integrity": "sha512-cY2eLFrQSAfVPhCgH1s7JI73tMbg9YC3v3+ZHVW67sBS7UxWzNEk/ZBbSfLykBWHp33dqqtOv82gjhKEi81T/A==", "dev": true }, "loglevel-plugin-prefix": { @@ -4170,6 +4536,12 @@ "integrity": "sha512-WpG9CcFAOjz/FtNht+QJeGpvVl/cdR6P0z6OcXSkr8wFJOsV2GRj2j10JLfjuA4aYkcKCNIEqRGCyTife9R8/g==", "dev": true }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, "make-iterator": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", @@ -4310,16 +4682,16 @@ } }, "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" + "version": "1.43.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.43.0.tgz", + "integrity": "sha512-+5dsGEEovYbT8UY9yD7eE4XTc4UwJ1jBYlgaQQF38ENsKR3wj/8q8RFZrF9WIZpB2V1ArTVFUva8sAul1NzRzQ==" }, "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "version": "2.1.26", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.26.tgz", + "integrity": "sha512-01paPWYgLrkqAyrlDorC1uDwl2p3qZT7yl806vW7DvDoxwXi46jsjFbg+WdwotBIk6/MbEhO/dh5aZ5sNj/dWQ==", "requires": { - "mime-db": "1.40.0" + "mime-db": "1.43.0" } }, "mimic-fn": { @@ -4328,6 +4700,12 @@ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, + "mimic-response": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -4338,9 +4716,9 @@ } }, "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "dev": true }, "mixin-deep": { @@ -4365,18 +4743,15 @@ } }, "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - } + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.3.tgz", + "integrity": "sha512-6uCP4Qc0sWsgMLy1EOqqS/3rjDHOEnsStVr/4vtAIK2Y5i2kA7lFFejYrpIyiN9w0pYf4ckeCYT9f1r1P9KX5g==", + "dev": true }, "mocha": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.0.tgz", - "integrity": "sha512-qwfFgY+7EKAAUAdv7VYMZQknI7YJSGesxHyhn6qD52DV8UcSZs5XwCifcZGMVIE4a5fbmhvbotxC0DLQ0oKohQ==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.3.tgz", + "integrity": "sha512-0R/3FvjIGH3eEuG17ccFPk117XL2rWxatr81a57D+r/x2uTYZRbdZ4oVidEUMh2W2TJDa7MdAb12Lm2/qrKajg==", "dev": true, "requires": { "ansi-colors": "3.2.3", @@ -4391,7 +4766,7 @@ "js-yaml": "3.13.1", "log-symbols": "2.2.0", "minimatch": "3.0.4", - "mkdirp": "0.5.1", + "mkdirp": "0.5.4", "ms": "2.1.1", "node-environment-flags": "1.0.5", "object.assign": "4.1.0", @@ -4399,9 +4774,9 @@ "supports-color": "6.0.0", "which": "1.3.1", "wide-align": "1.1.3", - "yargs": "13.2.2", - "yargs-parser": "13.0.0", - "yargs-unparser": "1.5.0" + "yargs": "13.3.2", + "yargs-parser": "13.1.2", + "yargs-unparser": "1.6.0" }, "dependencies": { "ansi-colors": { @@ -4416,6 +4791,17 @@ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", + "dev": true, + "requires": { + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, "debug": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", @@ -4445,6 +4831,15 @@ "path-is-absolute": "^1.0.0" } }, + "mkdirp": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", @@ -4486,29 +4881,39 @@ "has-flag": "^3.0.0" } }, - "yargs": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.2.2.tgz", - "integrity": "sha512-WyEoxgyTD3w5XRpAQNYUB9ycVH/PQrToaTXdYXRdOXvEy1l19br+VJsc0vcO8PTGg5ro/l/GY7F/JMEBmI0BxA==", + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", "dev": true, "requires": { - "cliui": "^4.0.0", + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", "find-up": "^3.0.0", "get-caller-file": "^2.0.1", - "os-locale": "^3.1.0", "require-directory": "^2.1.1", "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.0.0" + "yargs-parser": "^13.1.2" } }, "yargs-parser": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz", - "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==", + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", "dev": true, "requires": { "camelcase": "^5.0.0", @@ -4589,6 +4994,12 @@ "semver": "^5.7.0" } }, + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", + "dev": true + }, "normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", @@ -4610,6 +5021,12 @@ "remove-trailing-separator": "^1.0.1" } }, + "normalize-url": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", + "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", + "dev": true + }, "now-and-later": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-2.0.1.tgz", @@ -4619,6 +5036,18 @@ "once": "^1.3.2" } }, + "npm-package-arg": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.1.tgz", + "integrity": "sha512-qBpssaL3IOZWi5vEKUKW0cO7kzLeT+EQO9W8RsLOZf76KF9E/K9+wH0C7t06HXPpaH8WH5xF1MExLuCwbTqRUg==", + "dev": true, + "requires": { + "hosted-git-info": "^2.7.1", + "osenv": "^0.1.5", + "semver": "^5.6.0", + "validate-npm-package-name": "^3.0.0" + } + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -4635,9 +5064,9 @@ "dev": true }, "nwsapi": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.1.4.tgz", - "integrity": "sha512-iGfd9Y6SFdTNldEy2L0GUhcarIutFmk+MPWIn9dmj8NMIup03G08uUF2KGbbmv/Ux4RT0VZJoP/sVbWA6d/VIw==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", + "integrity": "sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ==" }, "oauth-sign": { "version": "0.9.0", @@ -4682,9 +5111,9 @@ } }, "object-inspect": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", - "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", + "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", "dev": true }, "object-keys": { @@ -4727,13 +5156,13 @@ } }, "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", "dev": true, "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" } }, "object.map": { @@ -4813,6 +5242,12 @@ "readable-stream": "^2.0.1" } }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, "os-locale": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", @@ -4826,10 +5261,26 @@ }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "resolved": "http://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, + "osenv": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "p-cancelable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", + "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", + "dev": true + }, "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", @@ -4872,6 +5323,26 @@ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true }, + "package-json": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", + "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", + "dev": true, + "requires": { + "got": "^9.6.0", + "registry-auth-token": "^4.0.0", + "registry-url": "^5.0.0", + "semver": "^6.2.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -4939,7 +5410,7 @@ }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "resolved": "http://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, @@ -5076,9 +5547,15 @@ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" }, + "prepend-http": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", + "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", + "dev": true + }, "pretty-hrtime": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "resolved": "http://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", "dev": true }, @@ -5095,9 +5572,9 @@ "dev": true }, "psl": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", - "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==" + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" }, "pump": { "version": "3.0.0", @@ -5142,6 +5619,26 @@ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + } + } + }, "read-pkg": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz", @@ -5197,7 +5694,7 @@ }, "readable-stream": { "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { @@ -5254,6 +5751,24 @@ "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", "dev": true }, + "registry-auth-token": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.1.1.tgz", + "integrity": "sha512-9bKS7nTl9+/A1s7tnPeGrUpRcVY+LUh7bfFgzpndALdPfXQBfQV77rQVtqgUV3ti4vc/Ik81Ex8UJDWDQ12zQA==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, + "registry-url": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", + "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", + "dev": true, + "requires": { + "rc": "^1.2.8" + } + }, "remove-bom-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz", @@ -5334,9 +5849,9 @@ } }, "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", "requires": { "aws-sign2": "~0.7.0", "aws4": "^1.8.0", @@ -5345,7 +5860,7 @@ "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", - "har-validator": "~5.1.0", + "har-validator": "~5.1.3", "http-signature": "~1.2.0", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", @@ -5355,41 +5870,36 @@ "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", + "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", "uuid": "^3.3.2" }, "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - }, "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" + "psl": "^1.1.28", + "punycode": "^2.1.1" } } } }, "request-promise-core": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz", - "integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.3.tgz", + "integrity": "sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ==", "requires": { - "lodash": "^4.17.11" + "lodash": "^4.17.15" } }, "request-promise-native": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.7.tgz", - "integrity": "sha512-rIMnbBdgNViL37nZ1b3L/VfPOpSi0TqVDQPAvO6U14lMzOLrt5nilxCQqtDKhZeDiW0/hkCXGoQjhgJd/tCh6w==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.8.tgz", + "integrity": "sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ==", "requires": { - "request-promise-core": "1.1.2", + "request-promise-core": "1.1.3", "stealthy-require": "^1.1.1", "tough-cookie": "^2.3.3" }, @@ -5466,10 +5976,19 @@ "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", "dev": true }, + "responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "dev": true, + "requires": { + "lowercase-keys": "^1.0.0" + } + }, "resq": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/resq/-/resq-1.6.0.tgz", - "integrity": "sha512-8A4CsNY52RoSU4rpSfnEGPK2mkMO9kz0hi+SYhbKnSq7AFYxZFPTb2C7u6aEchD3vzFjotuCLnDfS81K/UsAmg==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/resq/-/resq-1.7.1.tgz", + "integrity": "sha512-09u9Q5SAuJfAW5UoVAmvRtLvCOMaKP+djiixTXsZvPaojGKhuvc0Nfvp84U1rIfopJWEOXi5ywpCFwCk7mj8Xw==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1" @@ -5492,9 +6011,9 @@ "dev": true }, "rgb2hex": { - "version": "0.1.9", - "resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.1.9.tgz", - "integrity": "sha512-32iuQzhOjyT+cv9aAFRBJ19JgHwzQwbjUhH3Fj2sWW2EEGAW8fpFrDFP5ndoKDxJaLO06x1hE3kyuIFrUQtybQ==", + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.1.10.tgz", + "integrity": "sha512-vKz+kzolWbL3rke/xeTE2+6vHmZnNxGyDnaVW4OckntAIcc7DcZzWkQSfxMDwqHS8vhgySnIFyBUH7lIk6PxvQ==", "dev": true }, "rimraf": { @@ -5531,7 +6050,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -5552,9 +6071,9 @@ } }, "selenium-standalone": { - "version": "6.16.0", - "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-6.16.0.tgz", - "integrity": "sha512-tl7HFH2FOxJD1is7Pzzsl0pY4vuePSdSWiJdPn+6ETBkpeJDiuzou8hBjvWYWpD+eIVcOrmy3L0R3GzkdHLzDw==", + "version": "6.17.0", + "resolved": "https://registry.npmjs.org/selenium-standalone/-/selenium-standalone-6.17.0.tgz", + "integrity": "sha512-5PSnDHwMiq+OCiAGlhwQ8BM9xuwFfvBOZ7Tfbw+ifkTnOy0PWbZmI1B9gPGuyGHpbQ/3J3CzIK7BYwrQ7EjtWQ==", "dev": true, "requires": { "async": "^2.6.2", @@ -5572,11 +6091,58 @@ "yauzl": "^2.10.0" }, "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "mkdirp": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", "dev": true + }, + "request": { + "version": "2.88.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", + "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", + "dev": true, + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.0", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.4.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + } + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } } } }, @@ -5596,12 +6162,12 @@ } }, "serialize-error": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-4.1.0.tgz", - "integrity": "sha512-5j9GgyGsP9vV9Uj1S0lDCvlsd+gc2LEPVK7HHHte7IyPwOD4lVQFeaX143gx3U5AnoCi+wbcb3mvaxVysjpxEw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-5.0.0.tgz", + "integrity": "sha512-/VtpuyzYf82mHYTtI4QKtwHa79vAdU5OQpNPAmE/0UDdlGT0ZxHwC+J6gXkw29wwoVI8fMPsfcVHOwXtUQYYQA==", "dev": true, "requires": { - "type-fest": "^0.3.0" + "type-fest": "^0.8.0" } }, "set-blocking": { @@ -5650,7 +6216,7 @@ }, "shelljs": { "version": "0.3.0", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", + "resolved": "http://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=", "dev": true }, @@ -5835,6 +6401,17 @@ "integrity": "sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=", "dev": true }, + "spdx-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/spdx-compare/-/spdx-compare-1.0.0.tgz", + "integrity": "sha512-C1mDZOX0hnu0ep9dfmuoi03+eOdDoz2yvK79RxbcrVEG1NO1Ph35yW102DHWKN4pk80nwCgeMmSY5L25VE4D9A==", + "dev": true, + "requires": { + "array-find-index": "^1.0.2", + "spdx-expression-parse": "^3.0.0", + "spdx-ranges": "^2.0.0" + } + }, "spdx-correct": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.0.tgz", @@ -5867,6 +6444,23 @@ "integrity": "sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q==", "dev": true }, + "spdx-ranges": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/spdx-ranges/-/spdx-ranges-2.1.1.tgz", + "integrity": "sha512-mcdpQFV7UDAgLpXEE/jOMqvK4LBoO0uTQg0uvXUewmEFhpiZx5yJSZITHB8w1ZahKdhfZqP5GPEOKLyEq5p8XA==", + "dev": true + }, + "spdx-satisfies": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/spdx-satisfies/-/spdx-satisfies-5.0.0.tgz", + "integrity": "sha512-/hGhwh20BeGmkA+P/lm06RvXD94JduwNxtx/oX3B5ClPt1/u/m5MCaDNo1tV3Y9laLkQr/NRde63b9lLMhlNfw==", + "dev": true, + "requires": { + "spdx-compare": "^1.0.0", + "spdx-expression-parse": "^3.0.0", + "spdx-ranges": "^2.0.0" + } + }, "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", @@ -5959,7 +6553,7 @@ }, "readable-stream": { "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", "dev": true, "requires": { @@ -5971,7 +6565,7 @@ }, "string_decoder": { "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "dev": true } @@ -5988,9 +6582,9 @@ } }, "string.prototype.trimleft": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", - "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz", + "integrity": "sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag==", "dev": true, "requires": { "define-properties": "^1.1.3", @@ -5998,9 +6592,9 @@ } }, "string.prototype.trimright": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", - "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz", + "integrity": "sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g==", "dev": true, "requires": { "define-properties": "^1.1.3", @@ -6009,7 +6603,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -6146,9 +6740,9 @@ }, "dependencies": { "readable-stream": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, "requires": { "inherits": "^2.0.3", @@ -6172,7 +6766,7 @@ }, "through": { "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -6252,6 +6846,12 @@ } } }, + "to-readable-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", + "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", + "dev": true + }, "to-regex": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", @@ -6359,9 +6959,9 @@ "dev": true }, "type-fest": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", + "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true }, "typedarray": { @@ -6509,9 +7109,9 @@ } }, "urijs": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.1.tgz", - "integrity": "sha512-xVrGVi94ueCJNrBSTjWqjvtgvl3cyOTThp2zaMaFNGp3F542TR6sM3f2o8RqZl+AwteClSVmoCyt0ka4RjQOQg==", + "version": "1.19.2", + "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.2.tgz", + "integrity": "sha512-s/UIq9ap4JPZ7H1EB5ULo/aOUbWqfDi7FKzMC2Nz+0Si8GiT1rIEaprt8hy3Vy2Ex2aJPpOQv4P4DuOZ+K1c6w==", "dev": true }, "urix": { @@ -6520,6 +7120,15 @@ "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", "dev": true }, + "url-parse-lax": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", + "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "dev": true, + "requires": { + "prepend-http": "^2.0.0" + } + }, "use": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", @@ -6533,9 +7142,9 @@ "dev": true }, "uuid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", - "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" }, "v8flags": { "version": "3.1.3", @@ -6556,6 +7165,15 @@ "spdx-expression-parse": "^3.0.0" } }, + "validate-npm-package-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz", + "integrity": "sha1-X6kS2B630MdK/BQN5zF/DKffQ34=", + "dev": true, + "requires": { + "builtins": "^1.0.3" + } + }, "value-or-function": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-3.0.0.tgz", @@ -6656,11 +7274,11 @@ } }, "w3c-hr-time": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", - "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", + "integrity": "sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==", "requires": { - "browser-process-hrtime": "^0.1.2" + "browser-process-hrtime": "^1.0.0" } }, "w3c-xmlserializer": { @@ -6674,29 +7292,30 @@ } }, "webdriver": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-5.13.1.tgz", - "integrity": "sha512-Gvsf2o8jrfZMgLWIC9C9bcT5T0OZvNHq7WO5PhNSB2pbg3ypSj4kk4zJZSyP331FTgib+qxneRtg7r/3Ea7mLw==", + "version": "5.22.4", + "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-5.22.4.tgz", + "integrity": "sha512-IrSb8UUt6MDgBIDaSWyh/kP4VJsHyqnubCTxKi2cEZjOQdxPwnxUfvbSQlMDCHXrcgsPaXwAPjRJVTEt6PzArQ==", "dev": true, "requires": { - "@wdio/config": "^5.13.0-alpha.0", - "@wdio/logger": "^5.12.1", - "@wdio/protocols": "^5.13.0-alpha.0", - "@wdio/utils": "^5.13.0", + "@types/request": "^2.48.4", + "@wdio/config": "5.22.4", + "@wdio/logger": "5.16.10", + "@wdio/protocols": "5.22.1", + "@wdio/utils": "5.18.6", "lodash.merge": "^4.6.1", "request": "^2.83.0" } }, "webdriverio": { - "version": "5.13.1", - "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-5.13.1.tgz", - "integrity": "sha512-Orx521tRUPqGGJH5fPbZLZ7ipm6RRpCg9s/puaFkl79cIQoNaO7wcbDCktr6jGNGbihNxwj8f6qaSmDYNE6Ang==", + "version": "5.22.4", + "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-5.22.4.tgz", + "integrity": "sha512-6/Qi1/N8wK5r7Mp2aEwB+1FkDQiyiuwQn8lm+dfYhrfWs3kLOKKt3MPeM4I6j2Yv2/mGpYf7WKu2xTj/vkJzBA==", "dev": true, "requires": { - "@wdio/config": "^5.13.0-alpha.0", - "@wdio/logger": "^5.12.1", - "@wdio/repl": "^5.13.0-alpha.0", - "@wdio/utils": "^5.13.0", + "@wdio/config": "5.22.4", + "@wdio/logger": "5.16.10", + "@wdio/repl": "5.18.6", + "@wdio/utils": "5.18.6", "archiver": "^3.0.0", "css-value": "^0.0.1", "grapheme-splitter": "^1.0.2", @@ -6706,8 +7325,8 @@ "lodash.zip": "^4.2.0", "resq": "^1.6.0", "rgb2hex": "^0.1.0", - "serialize-error": "^4.1.0", - "webdriver": "^5.13.1" + "serialize-error": "^5.0.0", + "webdriver": "5.22.4" } }, "webidl-conversions": { @@ -6729,9 +7348,9 @@ "integrity": "sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==" }, "whatwg-url": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.0.0.tgz", - "integrity": "sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ==", + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.1.0.tgz", + "integrity": "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==", "requires": { "lodash.sortby": "^4.7.0", "tr46": "^1.0.1", @@ -6827,15 +7446,29 @@ "dev": true, "requires": { "mkdirp": "^0.5.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + } } }, "ws": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.1.2.tgz", - "integrity": "sha512-gftXq3XI81cJCgkUiAVixA0raD9IVmXqsylCrjRygw4+UOOGzPoxnQ6r/CnVL9i+mDncJo94tSkyrtuuQVBmrg==", - "requires": { - "async-limiter": "^1.0.0" - } + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.3.tgz", + "integrity": "sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ==" }, "xml-name-validator": { "version": "3.0.0", @@ -6866,9 +7499,9 @@ "dev": true }, "yargs": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.0.0.tgz", - "integrity": "sha512-ssa5JuRjMeZEUjg7bEL99AwpitxU/zWGAGpdj0di41pOEmJti8NR6kyUIJBkR78DTYNPZOU08luUo0GTHuB+ow==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.3.tgz", + "integrity": "sha512-ZbotRWhF+lkjijC/VhmOT9wSgyBQ7+zr13+YLkhfsSiTriYsMzkTUFP18pFhWwBeMa5gUc1MzbhrO6/VB7c9Xg==", "dev": true, "requires": { "cliui": "^5.0.0", @@ -6881,7 +7514,7 @@ "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.1.1" + "yargs-parser": "^15.0.1" }, "dependencies": { "ansi-regex": { @@ -6945,9 +7578,9 @@ } }, "yargs-parser": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", - "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "version": "15.0.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.1.tgz", + "integrity": "sha512-0OAMV2mAZQrs3FkNpDQcBk1x5HXb8X4twADss4S0Iuk+2dGnLOE/fRHrsYm542GduMveyA77OF4wrNJuanRCWw==", "dev": true, "requires": { "camelcase": "^5.0.0", @@ -6967,34 +7600,102 @@ } }, "yargs-unparser": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.5.0.tgz", - "integrity": "sha512-HK25qidFTCVuj/D1VfNiEndpLIeJN78aqgR23nL3y4N0U/91cOAzqfHlF8n2BvoNDcZmJKin3ddNSvOxSr8flw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-1.6.0.tgz", + "integrity": "sha512-W9tKgmSn0DpSatfri0nx52Joq5hVXgeLiqR/5G0sZNDoLZFOr/xjBUDcShCOGNsBnEMNo1KAMBkTej1Hm62HTw==", "dev": true, "requires": { "flat": "^4.1.0", - "lodash": "^4.17.11", - "yargs": "^12.0.5" + "lodash": "^4.17.15", + "yargs": "^13.3.0" }, "dependencies": { - "yargs": { - "version": "12.0.5", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.5.tgz", - "integrity": "sha512-Lhz8TLaYnxq/2ObqHDql8dX8CJi97oHxrjUcYtzKbbykPtVW9WB+poxI+NM2UIzsMgNCZTIf0AQwsjK5yMAqZw==", + "ansi-regex": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", + "dev": true + }, + "cliui": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", + "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", "dev": true, "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.2.0", + "string-width": "^3.1.0", + "strip-ansi": "^5.2.0", + "wrap-ansi": "^5.1.0" + } + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "requires": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + } + }, + "strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, + "requires": { + "ansi-regex": "^4.1.0" + } + }, + "wrap-ansi": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", + "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.0", + "string-width": "^3.0.0", + "strip-ansi": "^5.0.0" + } + }, + "yargs": { + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", + "dev": true, + "requires": { + "cliui": "^5.0.0", "find-up": "^3.0.0", - "get-caller-file": "^1.0.1", - "os-locale": "^3.0.0", + "get-caller-file": "^2.0.1", "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", + "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", - "string-width": "^2.0.0", + "string-width": "^3.0.0", "which-module": "^2.0.0", - "y18n": "^3.2.1 || ^4.0.0", - "yargs-parser": "^11.1.1" + "y18n": "^4.0.0", + "yargs-parser": "^13.1.2" + } + }, + "yargs-parser": { + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" } } } @@ -7010,9 +7711,9 @@ } }, "zip-stream": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-2.1.2.tgz", - "integrity": "sha512-ykebHGa2+uzth/R4HZLkZh3XFJzivhVsjJt8bN3GvBzLaqqrUdRacu+c4QtnUgjkkQfsOuNE1JgLKMCPNmkKgg==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-2.1.3.tgz", + "integrity": "sha512-EkXc2JGcKhO5N5aZ7TmuNo45budRaFGHOmz24wtJR7znbNqDPmdZtUauKX6et8KAVseAMBOyWJqEpXcHTBsh7Q==", "dev": true, "requires": { "archiver-utils": "^2.1.0", @@ -7021,9 +7722,9 @@ }, "dependencies": { "readable-stream": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", - "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, "requires": { "inherits": "^2.0.3", diff --git a/package.json b/package.json index 4d6cde8c9..58146d7c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockly", - "version": "3.20200123.1", + "version": "3.20200402.0", "description": "Blockly is a library for building visual programming editors.", "keywords": [ "blockly" @@ -18,28 +18,30 @@ }, "scripts": { "build": "gulp build", - "build:blocks": "gulp build-blocks", - "build:compressed": "gulp build-compressed", - "build:core": "gulp build-core", - "build:debug": "gulp build-compressed --verbose --strict", + "build:blocks": "gulp buildBlocks", + "build:compressed": "gulp buildCompressed", + "build:core": "gulp buildCore", + "build:debug": "gulp buildCompressed --verbose --strict", "build:debug:log": "npm run build:debug > build-debug.log 2>&1 && tail -3 build-debug.log", - "build:generators": "gulp build-generators", - "build:langfiles": "gulp build-langfiles", - "build:uncompressed": "gulp build-uncompressed", + "build:generators": "gulp buildGenerators", + "build:langfiles": "gulp buildLangfiles", + "build:uncompressed": "gulp buildUncompressed", "bump": "npm version 3.$(date +'%Y%m%d').0", + "license": "gulp checkLicenses", "lint": "eslint .", "package": "gulp package", "postversion": "gulp postversion", "prepare": "npm run package", "preversion": "gulp preversion", - "prerelease": "gulp git-recompile", - "release": "gulp git-create-rc", + "prerelease": "gulp gitRecompile", + "release": "gulp gitCreateRC", "test": "concurrently 'npm run test:prepare' 'sleep 5 && npm run test:run'", "test:prepare": "npm run test:setupselenium && npm run test:startselenium", "test:run": "tests/run_all_tests.sh", "test:setupselenium": "selenium-standalone install --config=./tests/scripts/selenium-config.js", "test:startselenium": "selenium-standalone start --config=./tests/scripts/selenium-config.js", "typings": "gulp typings", + "updateGithubPages": "gulp gitUpdateGithubPages", "version": "gulp build && git add -A" }, "main": "./index.js", @@ -56,28 +58,28 @@ "chai": "^4.2.0", "concurrently": "^4.1.2", "eslint": "^5.13.0", - "eslint-plugin-es5": "^1.4.1", - "fs": "0.0.1-security", + "eslint-plugin-es5": "^1.5.0", "google-closure-compiler": "^20200101.0.0", "google-closure-deps": "^20200101.0.0", "gulp": "^4.0.2", "gulp-concat": "^2.6.1", "gulp-insert": "^0.5.0", - "gulp-series": "^1.0.2", - "gulp-shell": "^0.7.1", "gulp-rename": "^1.4.0", "gulp-replace": "^1.0.0", + "gulp-series": "^1.0.2", + "gulp-shell": "^0.7.1", "gulp-umd": "^2.0.0", - "jshint": "^2.10.2", - "mocha": "^6.1.4", + "js-green-licenses": "^1.1.0", + "jshint": "^2.11.0", + "mocha": "^6.2.3", "pixelmatch": "^4.0.2", "pngjs": "^3.4.0", - "selenium-standalone": "^6.16.0", "rimraf": "^2.6.3", + "selenium-standalone": "^6.17.0", "through2": "^3.0.1", "typescript-closure-tools": "^0.0.7", - "webdriverio": "^5.11.5", - "yargs": "^14.0.0" + "webdriverio": "^5.22.4", + "yargs": "^14.2.3" }, "jshintConfig": { "globalstrict": true, @@ -94,6 +96,6 @@ "unused": true }, "dependencies": { - "jsdom": "^15.1.1" + "jsdom": "^15.2.1" } } diff --git a/package/browser/core.js b/package/browser/core.js index 3dde18168..19463cd7e 100644 --- a/package/browser/core.js +++ b/package/browser/core.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/package/browser/index.js b/package/browser/index.js index 32fac243c..1b2f05e51 100644 --- a/package/browser/index.js +++ b/package/browser/index.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/package/index.js b/package/index.js index 0b5658e9b..f88c16e73 100644 --- a/package/index.js +++ b/package/index.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/package/node/core.js b/package/node/core.js index 41d6ff60c..a94b59c0a 100644 --- a/package/node/core.js +++ b/package/node/core.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/package/node/index.js b/package/node/index.js index 003e5bfcd..d50a92d60 100644 --- a/package/node/index.js +++ b/package/node/index.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/scripts/gulpfiles/build_tasks.js b/scripts/gulpfiles/build_tasks.js new file mode 100644 index 000000000..e03731a8e --- /dev/null +++ b/scripts/gulpfiles/build_tasks.js @@ -0,0 +1,460 @@ +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Gulp script to build Blockly for Node & NPM. + */ + +var gulp = require('gulp'); +gulp.replace = require('gulp-replace'); +gulp.rename = require('gulp-rename'); +gulp.insert = require('gulp-insert'); + +var path = require('path'); +var fs = require('fs'); +var execSync = require('child_process').execSync; +var through2 = require('through2'); + +var closureCompiler = require('google-closure-compiler').gulp(); +var closureDeps = require('google-closure-deps'); +var packageJson = require('../../package.json'); +var argv = require('yargs').argv; + + +//////////////////////////////////////////////////////////// +// Build // +//////////////////////////////////////////////////////////// + +const licenseRegex = `\\/\\*\\* + \\* @license + \\* (Copyright \\d+ (Google LLC|Massachusetts Institute of Technology)) +( \\* All rights reserved. +)? \\* SPDX-License-Identifier: Apache-2.0 + \\*\\/`; + +/** + * Helper method for stripping the Google's and MIT's Apache Licenses. + */ +function stripApacheLicense() { + // Strip out Google's and MIT's Apache licences. + // Closure Compiler preserves dozens of Apache licences in the Blockly code. + // Remove these if they belong to Google or MIT. + // MIT's permission to do this is logged in Blockly issue #2412. + return gulp.replace(new RegExp(licenseRegex, "g"), ''); +} + +/** + * Helper method for prepending the auto-generated header text. + */ +function prependHeader() { + return gulp.insert.prepend(`// Do not edit this file; automatically generated by gulp.\n`); +} + +/** + * Closure compiler warning groups used to treat warnings as errors. + * For a full list of closure compiler groups, consult: + * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/DiagnosticGroups.java#L113 + */ +var JSCOMP_ERROR = [ + 'accessControls', + 'checkPrototypalTypes', + 'checkRegExp', + 'checkTypes', + 'checkVars', + 'conformanceViolations', + 'const', + 'constantProperty', + 'deprecated', + 'deprecatedAnnotations', + 'duplicateMessage', + 'es5Strict', + 'externsValidation', + 'functionParams', + 'globalThis', + 'invalidCasts', + 'misplacedTypeAnnotation', + 'missingGetCssName', + // 'missingOverride', + 'missingPolyfill', + 'missingProperties', + 'missingProvide', + 'missingRequire', + 'missingReturn', + // 'missingSourcesWarnings', + 'moduleLoad', + 'msgDescriptions', + 'nonStandardJsDocs', + // 'polymer', + // 'reportUnknownTypes', + // 'strictCheckTypes', + // 'strictMissingProperties', + 'strictModuleDepCheck', + // 'strictPrimitiveOperators', + 'suspiciousCode', + 'typeInvalidation', + 'undefinedNames', + 'undefinedVars', + 'underscore', + 'unknownDefines', + 'unusedLocalVariables', + // 'unusedPrivateMembers', + 'useOfGoogBase', + 'uselessCode', + 'untranspilableFeatures', + 'visibility' +]; + +/** + * Helper method for calling the Closure compiler. + * @param {*} compilerOptions + * @param {boolean=} opt_verbose Optional option for verbose logging + * @param {boolean=} opt_warnings_as_error Optional option for treating warnings + * as errors. + */ +function compile(compilerOptions, opt_verbose, opt_warnings_as_error) { + compilerOptions = compilerOptions || {}; + compilerOptions.compilation_level = 'SIMPLE_OPTIMIZATIONS'; + compilerOptions.warning_level = opt_verbose ? 'VERBOSE' : 'DEFAULT'; + compilerOptions.language_in = + compilerOptions.language_in || 'ECMASCRIPT5_STRICT'; + compilerOptions.language_out = 'ECMASCRIPT5_STRICT'; + compilerOptions.rewrite_polyfills = false; + compilerOptions.hide_warnings_for = 'node_modules'; + if (opt_warnings_as_error) { + compilerOptions.jscomp_error = JSCOMP_ERROR; + } + + const platform = ['native', 'java', 'javascript']; + + return closureCompiler(compilerOptions, { platform }); +} + +/** + * Helper method for possibly adding the Closure library into a sources array. + * @param {Array.} srcs + */ +function maybeAddClosureLibrary(srcs) { + if (argv.closureLibrary) { + // If you require Google's Closure library, you can include it in your + // build by adding the --closure-library flag. + // You will also need to include the "google-closure-library" in your list + // of devDependencies. + console.log('Including the google-closure-library in your build.'); + if (!fs.existsSync('./node_modules/google-closure-library')) { + throw Error('You must add the google-closure-library to your ' + + 'devDependencies in package.json, and run `npm install`.'); + } + srcs.push('./node_modules/google-closure-library/closure/goog/**/**/*.js'); + } + return srcs; +} + +/** + * This task builds Blockly's core files. + * blockly_compressed.js + */ +function buildCompressed(cb) { + const defines = 'Blockly.VERSION="' + packageJson.version + '"'; + return gulp.src(maybeAddClosureLibrary(['core/**/**/*.js']), {base: './'}) + // Directories in Blockly are used to group similar files together + // but are not used to limit access with @package, instead the + // method means something is internal to Blockly and not a public + // API. + // Flatten all files so they're in the same directory, but ensure that + // files with the same name don't conflict. + .pipe(gulp.rename(function (p) { + var dirname = p.dirname.replace(new RegExp(path.sep, "g"), "-"); + p.dirname = ""; + p.basename = dirname + "-" + p.basename; + })) + .pipe(stripApacheLicense()) + .pipe(compile({ + dependency_mode: 'PRUNE', + entry_point: './core-requires.js', + js_output_file: 'blockly_compressed.js', + externs: ['./externs/svg-externs.js', './externs/goog-externs.js'], + define: defines, + language_in: + argv.closureLibrary ? 'ECMASCRIPT_2015' : 'ECMASCRIPT5_STRICT' + }, argv.verbose, argv.strict)) + .pipe(prependHeader()) + .pipe(gulp.dest('./')); +}; + +/** + * This task builds the Blockly's built in blocks. + * blocks_compressed.js + */ +function buildBlocks() { + // Add provides used throughout blocks/ in order to be compatible with the + // compiler. Anything added to this list must be removed from the compiled + // result using the remove regex steps below. + const provides = ` +goog.provide('Blockly'); +goog.provide('Blockly.Blocks'); +goog.provide('Blockly.Comment'); +goog.provide('Blockly.FieldCheckbox'); +goog.provide('Blockly.FieldColour'); +goog.provide('Blockly.FieldDropdown'); +goog.provide('Blockly.FieldImage'); +goog.provide('Blockly.FieldLabel'); +goog.provide('Blockly.FieldMultilineInput'); +goog.provide('Blockly.FieldNumber'); +goog.provide('Blockly.FieldTextInput'); +goog.provide('Blockly.FieldVariable'); +goog.provide('Blockly.Mutator'); +goog.provide('Blockly.Warning');`; + return gulp.src(['blocks/*.js'], {base: './'}) + // Add Blockly.Blocks to be compatible with the compiler. + .pipe(gulp.replace(`goog.provide('Blockly.Constants.Colour');`, + `${provides}goog.provide('Blockly.Constants.Colour');`)) + .pipe(stripApacheLicense()) + .pipe(compile({ + dependency_mode: 'NONE', + externs: ['./externs/goog-externs.js'], + js_output_file: 'blocks_compressed.js' + }, argv.verbose, argv.strict)) + .pipe(gulp.replace('\'use strict\';', '\'use strict\';\n\n\n')) + // Remove Blockly.Blocks to be compatible with Blockly. + .pipe(gulp.replace(/var Blockly=\{[^;]*\};\n?/, '')) + // Remove Blockly Fields to be compatible with Blockly. + .pipe(gulp.replace(/Blockly\.Field[^=\(]+=\{[^;]*\};/g, '')) + // Remove Blockly Warning, Comment & Mutator to be compatible with Blockly. + .pipe(gulp.replace(/Blockly\.(Comment|Warning|Mutator)=\{[^;]*\};/g, '')) + .pipe(prependHeader()) + .pipe(gulp.dest('./')); +}; + +/** + * A helper method for building a Blockly code generator. + * @param {string} language Generator language. + * @param {string} namespace Language namespace. + */ +function buildGenerator(language, namespace) { + var provides = ` +goog.provide('Blockly.Generator'); +goog.provide('Blockly.utils.global'); +goog.provide('Blockly.utils.string');`; + return gulp.src([`generators/${language}.js`, `generators/${language}/*.js`], {base: './'}) + .pipe(stripApacheLicense()) + // Add Blockly.Generator and Blockly.utils.string to be compatible with the compiler. + .pipe(gulp.replace(`goog.provide('Blockly.${namespace}');`, + `${provides}goog.provide('Blockly.${namespace}');`)) + .pipe(compile({ + dependency_mode: 'NONE', + externs: ['./externs/goog-externs.js'], + js_output_file: `${language}_compressed.js` + }, argv.verbose, argv.strict)) + .pipe(gulp.replace('\'use strict\';', '\'use strict\';\n\n\n')) + // Remove Blockly.Generator and Blockly.utils.string to be compatible with Blockly. + .pipe(gulp.replace(/var Blockly=\{[^;]*\};\s*Blockly.utils.global={};\s*Blockly.utils.string={};\n?/, '')) + .pipe(prependHeader()) + .pipe(gulp.dest('./')); +}; + +/** + * This task builds the javascript generator. + * javascript_compressed.js + */ +function buildJavascript() { + return buildGenerator('javascript', 'JavaScript'); +}; + +/** + * This task builds the python generator. + * python_compressed.js + */ +function buildPython() { + return buildGenerator('python', 'Python'); +}; + +/** + * This task builds the php generator. + * php_compressed.js + */ +function buildPHP() { + return buildGenerator('php', 'PHP'); +}; + +/** + * This task builds the lua generator. + * lua_compressed.js + */ +function buildLua() { + return buildGenerator('lua', 'Lua'); +}; + +/** + * This task builds the dart generator: + * dart_compressed.js + */ +function buildDart() { + return buildGenerator('dart', 'Dart'); +}; + +/** + * This tasks builds all the generators: + * javascript_compressed.js + * python_compressed.js + * php_compressed.js + * lua_compressed.js + * dart_compressed.js + */ +const buildGenerators = gulp.parallel( + buildJavascript, + buildPython, + buildPHP, + buildLua, + buildDart +); + +/** + * This task builds Blockly's uncompressed file. + * blockly_uncompressed.js + */ +function buildUncompressed() { + const closurePath = argv.closureLibrary ? + 'node_modules/google-closure-library/closure/goog' : + 'closure/goog'; + const header = `// Do not edit this file; automatically generated by gulp. +'use strict'; + +this.IS_NODE_JS = !!(typeof module !== 'undefined' && module.exports); + +this.BLOCKLY_DIR = (function(root) { + if (!root.IS_NODE_JS) { + // Find name of current directory. + var scripts = document.getElementsByTagName('script'); + var re = new RegExp('(.+)[\\\/]blockly_(.*)uncompressed\\\.js$'); + for (var i = 0, script; script = scripts[i]; i++) { + var match = re.exec(script.src); + if (match) { + return match[1]; + } + } + alert('Could not detect Blockly\\'s directory name.'); + } + return ''; +})(this); + +this.BLOCKLY_BOOT = function(root) { + // Execute after Closure has loaded. +`; + const footer = ` +delete root.BLOCKLY_DIR; +delete root.BLOCKLY_BOOT; +delete root.IS_NODE_JS; +}; + +if (this.IS_NODE_JS) { + this.BLOCKLY_BOOT(this); + module.exports = Blockly; +} else { + document.write(''); + document.write(''); +} +`; + +let deps = []; +return gulp.src(maybeAddClosureLibrary(['core/**/**/*.js'])) + .pipe(through2.obj((file, _enc, cb) => { + const result = closureDeps.parser.parseFile(file.path); + for (const dep of result.dependencies) { + deps.push(dep); + } + cb(null); + })) + .on('end', () => { + // Update the path to closure for any files that we don't know the full path + // of (parsed from a goog.addDependency call). + for (const dep of deps) { + dep.setClosurePath(closurePath); + } + + const addDependency = closureDeps.depFile.getDepFileText(closurePath, deps); + + const requires = `goog.addDependency("base.js", [], []); + +// Load Blockly. +goog.require('Blockly.requires') +`; + fs.writeFileSync('blockly_uncompressed.js', + header + + addDependency + + requires + + footer); + }); +}; + +/** + * This task builds Blockly's lang files. + * msg/*.js + */ +function buildLangfiles(done) { + // Run js_to_json.py + const jsToJsonCmd = `python ./i18n/js_to_json.py \ +--input_file ${path.join('msg', 'messages.js')} \ +--output_dir ${path.join('msg', 'json')} \ +--quiet`; + execSync(jsToJsonCmd, { stdio: 'inherit' }); + + // Run create_messages.py + let json_files = fs.readdirSync(path.join('msg', 'json')); + json_files = json_files.filter(file => file.endsWith('json') && + !(new RegExp(/(keys|synonyms|qqq|constants)\.json$/).test(file))); + json_files = json_files.map(file => path.join('msg', 'json', file)); + const createMessagesCmd = `python ./i18n/create_messages.py \ + --source_lang_file ${path.join('msg', 'json', 'en.json')} \ + --source_synonym_file ${path.join('msg', 'json', 'synonyms.json')} \ + --source_constants_file ${path.join('msg', 'json', 'constants.json')} \ + --key_file ${path.join('msg', 'json', 'keys.json')} \ + --output_dir ${path.join('msg', 'js')} \ + --quiet ${json_files.join(' ')}`; + execSync(createMessagesCmd, { stdio: 'inherit' }); + + done(); +}; + +/** + * This tasks builds Blockly's core files: + * blockly_compressed.js + * blocks_compressed.js + * blockly_uncompressed.js + */ +const buildCore = gulp.parallel( + buildCompressed, + buildBlocks, + buildUncompressed +); + +/** + * This task builds all of Blockly: + * blockly_compressed.js + * blocks_compressed.js + * javascript_compressed.js + * python_compressed.js + * php_compressed.js + * lua_compressed.js + * dart_compressed.js + * blockly_uncompressed.js + * msg/json/*.js + */ +const build = gulp.parallel( + buildCore, + buildGenerators, + buildLangfiles +); + +module.exports = { + build: build, + core: buildCore, + blocks: buildBlocks, + langfiles: buildLangfiles, + uncompressed: buildUncompressed, + compressed: buildCompressed, + generators: buildGenerators, +} diff --git a/scripts/gulpfiles/git_tasks.js b/scripts/gulpfiles/git_tasks.js new file mode 100644 index 000000000..63cbef780 --- /dev/null +++ b/scripts/gulpfiles/git_tasks.js @@ -0,0 +1,119 @@ +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Git-related gulp tasks for Blockly. + */ + +var gulp = require('gulp'); +var execSync = require('child_process').execSync; + +var typings = require('./typings'); +var buildTasks = require('./build_tasks'); + +const upstream_url = "https://github.com/google/blockly.git"; + +// Stash current state, check out the named branch, and sync with +// google/blockly. +function syncBranch(branchName) { + return function(done) { + execSync('git stash save -m "Stash for sync"', { stdio: 'inherit' }); + checkoutBranch(branchName); + execSync('git pull ' + upstream_url + ' ' + branchName, + { stdio: 'inherit' }); + execSync('git push origin ' + branchName, { stdio: 'inherit' }); + done(); + } +} + +// Stash current state, check out develop, and sync with google/blockly. +function syncDevelop() { + return syncBranch('develop'); +}; + +// Stash current state, check out master, and sync with google/blockly. +function syncMaster() { + return syncBranch('master'); +}; + +// Helper function: get a name for a rebuild branch. Format: rebuild_mm_dd_yyyy. +function getRebuildBranchName() { + var date = new Date(); + var mm = date.getMonth() + 1; // Month, 0-11 + var dd = date.getDate(); // Day of the month, 1-31 + var yyyy = date.getFullYear(); + return 'rebuild_' + mm + '_' + dd + '_' + yyyy; +}; + +// Helper function: get a name for a rebuild branch. Format: rebuild_yyyy_mm. +function getRCBranchName() { + var date = new Date(); + var mm = date.getMonth() + 1; // Month, 0-11 + var yyyy = date.getFullYear(); + return 'rc_' + yyyy + '_' + mm; +}; + +// If branch does not exist then create the branch. +// If branch exists switch to branch. +function checkoutBranch(branchName) { + execSync('git checkout ' + branchName + ' || git checkout -b ' + branchName, + { stdio: 'inherit' }); +} + +// Recompile and push to origin. +const recompile = gulp.series( + syncDevelop, + function(done) { + var branchName = getRebuildBranchName(); + console.log('make-rebuild-branch: creating branch ' + branchName); + execSync('git checkout -b ' + branchName, { stdio: 'inherit' }); + done(); + }, + buildTasks.build, + typings.typings, + function(done) { + console.log('push-rebuild-branch: committing rebuild'); + execSync('git commit -am "Rebuild"', { stdio: 'inherit' }); + var branchName = getRebuildBranchName(); + execSync('git push origin ' + branchName, { stdio: 'inherit' }); + console.log('Branch ' + branchName + ' pushed to GitHub.'); + console.log('Next step: create a pull request against develop.'); + done(); + } +); + +// Create and push an RC branch. +// Note that this pushes to google/blockly. +const createRC = gulp.series( + syncDevelop, + function(done) { + var branchName = getRCBranchName(); + execSync('git checkout -b ' + branchName, { stdio: 'inherit' }); + execSync('git push ' + upstream_url + ' ' + branchName, + { stdio: 'inherit' }); + execSync('git checkout -b gh-pages'); + execSync('git push ' + upstream_url + ' gh-pages'); + done(); + }, +); + +// Update github pages with what is currently in develop. +const updateGithubPages = gulp.series( + syncBranch('gh-pages'), + function(done) { + execSync('git pull ' + upstream_url + ' develop', { stdio: 'inherit' }); + execSync('git push ' + upstream_url + ' gh-pages', { stdio: 'inherit' }); + done(); + } +); + +module.exports = { + syncDevelop: syncDevelop, + syncMaster: syncMaster, + createRC: createRC, + recompile: recompile, + updateGithubPages: updateGithubPages +} diff --git a/scripts/gulpfiles/license_tasks.js b/scripts/gulpfiles/license_tasks.js new file mode 100644 index 000000000..3e6b93efb --- /dev/null +++ b/scripts/gulpfiles/license_tasks.js @@ -0,0 +1,21 @@ +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Gulp tasks to check the licenses of Blockly dependencies. + */ + +const jsgl = require('js-green-licenses'); + +function checkLicenses() { + const checker = new jsgl.LicenseChecker(); + checker.setDefaultHandlers(); + return checker.checkLocalDirectory('.'); +}; + +module.exports = { + checkLicenses: checkLicenses +}; diff --git a/scripts/gulpfiles/package_tasks.js b/scripts/gulpfiles/package_tasks.js new file mode 100644 index 000000000..c711231af --- /dev/null +++ b/scripts/gulpfiles/package_tasks.js @@ -0,0 +1,399 @@ +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Gulp tasks to package Blockly for distribution on NPM. + */ + +var gulp = require('gulp'); +gulp.concat = require('gulp-concat'); +gulp.replace = require('gulp-replace'); +gulp.rename = require('gulp-rename'); +gulp.insert = require('gulp-insert'); +gulp.umd = require('gulp-umd'); + +var path = require('path'); +var fs = require('fs'); + +var packageJson = require('../../package.json'); +var argv = require('yargs').argv; + +const upstream_url = "https://github.com/google/blockly.git"; + +const blocklyRoot = '../../'; + +// The destination path where all the NPM distribution files will go. +const packageDistribution = 'dist'; + + +/** + * A helper method for wrapping a file into a Universal Module Definition. + * @param {string} namespace The export namespace. + * @param {Array} dependencies An array of dependencies to inject. + */ +function packageUMD(namespace, dependencies) { + return gulp.umd({ + dependencies: function () { return dependencies; }, + namespace: function () { return namespace; }, + exports: function () { return namespace; }, + template: path.join(__dirname, `${blocklyRoot}/package/templates/umd.template`) + }); +}; + +/** + * A helper method for wrapping a file into a CommonJS module for Node.js. + * @param {string} namespace The export namespace. + * @param {Array} dependencies An array of dependencies to inject. + */ +function packageCommonJS(namespace, dependencies) { + return gulp.umd({ + dependencies: function () { return dependencies; }, + namespace: function () { return namespace; }, + exports: function () { return namespace; }, + template: path.join(__dirname, `${blocklyRoot}/package/templates/node.template`) + }); +}; + +/** + * This task wraps blockly_compressed.js into a UMD module. + * @example import 'blockly/blockly'; + */ +function packageBlockly() { + return gulp.src('blockly_compressed.js') + .pipe(packageUMD('Blockly', [])) + .pipe(gulp.rename('blockly.js')) + .pipe(gulp.dest(packageDistribution)); +}; + +/** + * This task wraps blocks_compressed.js into a CommonJS module for Node.js. + * This is an equivalent task to package-blockly but for Node.js. + * @example import 'blockly/blockly-node'; + */ +function packageBlocklyNode() { + // Override textToDomDocument, providing a Node.js alternative to DOMParser. + return gulp.src('blockly_compressed.js') + .pipe(gulp.insert.append(` + if (typeof DOMParser !== 'function') { + var DOMParser = require("jsdom/lib/jsdom/living").DOMParser; + var XMLSerializer = require("jsdom/lib/jsdom/living").XMLSerializer; + var doc = Blockly.utils.xml.textToDomDocument( + ''); + Blockly.utils.xml.document = function() { + return doc; + }; + }`)) + .pipe(packageCommonJS('Blockly', [])) + .pipe(gulp.rename('blockly-node.js')) + .pipe(gulp.dest(packageDistribution)); +}; + +/** + * This task wraps blocks_compressed.js into a UMD module. + * @example import 'blockly/blocks'; + */ +function packageBlocks() { + return gulp.src('blocks_compressed.js') + .pipe(gulp.insert.prepend(` + Blockly.Blocks={};`)) + .pipe(packageUMD('Blockly.Blocks', [{ + name: 'Blockly', + amd: './core', + cjs: './core', + }])) + .pipe(gulp.rename('blocks.js')) + .pipe(gulp.dest(packageDistribution)); +}; + +/** + * This task wraps package/index.js into a UMD module. + * We implicitly require the Node entry point in CommonJS environments, + * and the Browser entry point for AMD environments. + * @example import * as Blockly from 'blockly'; + */ +function packageIndex() { + return gulp.src('package/index.js') + .pipe(packageUMD('Blockly', [{ + name: 'Blockly', + amd: './browser', + cjs: './node', + }])) + .pipe(gulp.rename('index.js')) + .pipe(gulp.dest(packageDistribution)); +}; + +/** + * This task wraps package/browser/index.js into a UMD module. + * By default, the module includes Blockly core and built-in blocks, + * as well as the JavaScript code generator and the English block + * localization files. + * This module is configured (in package.json) to replaces the module + * built by package-node in browser environments. + * @example import * as Blockly from 'blockly/browser'; + */ +function packageBrowser() { + return gulp.src('package/browser/index.js') + .pipe(packageUMD('Blockly', [{ + name: 'Blockly', + amd: './core-browser', + cjs: './core-browser', + },{ + name: 'En', + amd: './msg/en', + cjs: './msg/en', + },{ + name: 'BlocklyBlocks', + amd: './blocks', + cjs: './blocks', + },{ + name: 'BlocklyJS', + amd: './javascript', + cjs: './javascript', + }])) + .pipe(gulp.rename('browser.js')) + .pipe(gulp.dest(packageDistribution)); +}; + +/** + * This task wraps package/browser/core.js into a UMD module. + * By default, the module includes the Blockly core package and a + * helper method to set the locale. + * This module is configured (in package.json) to replaces the module + * built by package-node-core in browser environments. + * @example import * as Blockly from 'blockly/core'; + */ +function packageCore() { + return gulp.src('package/browser/core.js') + .pipe(packageUMD('Blockly', [{ + name: 'Blockly', + amd: './blockly', + cjs: './blockly', + }])) + .pipe(gulp.rename('core-browser.js')) + .pipe(gulp.dest(packageDistribution)); +}; + +/** + * This task wraps package/node/index.js into a CommonJS module for Node.js. + * By default, the module includes Blockly core and built-in blocks, + * as well as all the code generators and the English block localization files. + * This module is configured (in package.json) to be replaced by the module + * built by package-browser in browser environments. + * @example import * as Blockly from 'blockly/node'; + */ +function packageNode() { + return gulp.src('package/node/index.js') + .pipe(packageCommonJS('Blockly', [{ + name: 'Blockly', + cjs: './core', + },{ + name: 'En', + cjs: './msg/en', + },{ + name: 'BlocklyBlocks', + cjs: './blocks', + },{ + name: 'BlocklyJS', + cjs: './javascript', + },{ + name: 'BlocklyPython', + cjs: './python', + },{ + name: 'BlocklyPHP', + cjs: './php', + },{ + name: 'BlocklyLua', + cjs: './lua', + }, { + name: 'BlocklyDart', + cjs: './dart', + }])) + .pipe(gulp.rename('node.js')) + .pipe(gulp.dest(packageDistribution)); +}; + +/** + * This task wraps package/node/core.js into a CommonJS module for Node.js. + * By default, the module includes the Blockly core package for Node.js + * and a helper method to set the locale. + * This module is configured (in package.json) to be replaced by the module + * built by package-core in browser environments. + * @example import * as Blockly from 'blockly/core'; + */ +function packageNodeCore() { + return gulp.src('package/node/core.js') + .pipe(packageCommonJS('Blockly', [{ + name: 'Blockly', + amd: './blockly-node', + cjs: './blockly-node', + }])) + .pipe(gulp.rename('core.js')) + .pipe(gulp.dest(packageDistribution)); +}; + +/** + * A helper method for packaging a Blockly code generator into a UMD module. + * @param {string} file Source file name. + * @param {string} rename Destination file name. + * @param {string} generator Generator export namespace. + */ +function packageGenerator(file, rename, generator) { + return gulp.src(file) + .pipe(packageUMD(generator, [{ + name: 'Blockly', + amd: './core', + cjs: './core', + }])) + .pipe(gulp.rename(rename)) + .pipe(gulp.dest(packageDistribution)); +}; + +/** + * This task wraps javascript_compressed.js into a UMD module. + * @example import 'blockly/javascript'; + */ +function packageJavascript() { + return packageGenerator('javascript_compressed.js', 'javascript.js', 'Blockly.JavaScript'); +}; + +/** + * This task wraps python_compressed.js into a UMD module. + * @example import 'blockly/python'; + */ +function packagePython() { + return packageGenerator('python_compressed.js', 'python.js', 'Blockly.Python'); +}; + +/** + * This task wraps lua_compressed.js into a UMD module. + * @example import 'blockly/lua'; + */ +function packageLua() { + return packageGenerator('lua_compressed.js', 'lua.js', 'Blockly.Lua'); +}; + +/** + * This task wraps dart_compressed.js into a UMD module. + * @example import 'blockly/dart'; + */ +function packageDart() { + return packageGenerator('dart_compressed.js', 'dart.js', 'Blockly.Dart'); +}; + +/** + * This task wraps php_compressed.js into a UMD module. + * @example import 'blockly/php'; + */ +function packagePHP() { + return packageGenerator('php_compressed.js', 'php.js', 'Blockly.PHP'); +}; + +/** + * This task wraps each of the msg/js/* files into a UMD module. + * @example import * as En from 'blockly/msg/en'; + */ +function packageLocales() { + // Remove references to goog.provide and goog.require. + return gulp.src('msg/js/*.js') + .pipe(gulp.replace(/goog\.[^\n]+/g, '')) + .pipe(gulp.insert.prepend(` + var Blockly = {};Blockly.Msg={};`)) + .pipe(packageUMD('Blockly.Msg', [{ + name: 'Blockly', + amd: '../core', + cjs: '../core', + }])) + .pipe(gulp.dest(`${packageDistribution}/msg`)); +}; + +/** + * This task creates a UMD bundle of Blockly which includes the Blockly + * core files, the built-in blocks, the JavaScript code generator and the + * English localization files. + * @example + */ +function packageUMDBundle() { + var srcs = [ + 'blockly_compressed.js', + 'msg/js/en.js', + 'blocks_compressed.js', + 'javascript_compressed.js' + ]; + return gulp.src(srcs) + .pipe(gulp.concat('blockly.min.js')) + .pipe(packageUMD('Blockly', [])) + .pipe(gulp.dest(`${packageDistribution}`)) +}; + +/** + * This task copies all the media/* files into the distribution directory. + */ +function packageMedia() { + return gulp.src('./media/*') + .pipe(gulp.dest(`${packageDistribution}/media`)); +}; + +/** + * This task copies the package.json file into the distribution directory. + */ +function packageJSON(cb) { + const json = Object.assign({}, packageJson); + delete json['scripts']; + if (!fs.existsSync(packageDistribution)) { + fs.mkdirSync(packageDistribution); + } + fs.writeFileSync(`${packageDistribution}/package.json`, + JSON.stringify(json, null, 2)); + cb(); +}; + +/** + * This task copies the package/README.md file into the distribution directory. + * This file is what developers will see at https://www.npmjs.com/package/blockly. + */ +function packageReadme() { + return gulp.src('./package/README.md') + .pipe(gulp.dest(`${packageDistribution}`)); +}; + +/** + * This task copies the typings/blockly.d.ts TypeScript definition file into the + * distribution directory. + * The bundled declaration file is referenced in package.json in the types property. + */ +function packageDTS() { + return gulp.src('./typings/blockly.d.ts') + .pipe(gulp.dest(`${packageDistribution}`)); +}; + +/** + * This task prepares the NPM distribution files under the /dist directory. + */ +const package = gulp.parallel( + packageIndex, + packageBrowser, + packageNode, + packageCore, + packageNodeCore, + packageBlockly, + packageBlocklyNode, + packageBlocks, + packageJavascript, + packagePython, + packageLua, + packageDart, + packagePHP, + packageLocales, + packageMedia, + packageUMDBundle, + packageJSON, + packageReadme, + packageDTS +); + +module.exports = { + package: package +}; diff --git a/scripts/gulpfiles/typings.js b/scripts/gulpfiles/typings.js new file mode 100644 index 000000000..86ba78b38 --- /dev/null +++ b/scripts/gulpfiles/typings.js @@ -0,0 +1,91 @@ +/** + * @license + * Copyright 2018 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * @fileoverview Gulp script to generate the Typescript definition file (d.ts) + * for Blockly. + */ + +var gulp = require('gulp'); +gulp.concat = require('gulp-concat'); + +var path = require('path'); +var fs = require('fs'); +var rimraf = require('rimraf'); +var execSync = require('child_process').execSync; + +// Generates the TypeScript definition file (d.ts) for Blockly. +// As well as generating the typings of each of the files under core/ and msg/, +// the script also pulls in a number of part files from typings/parts. +// This includes the header (incl License), additional useful interfaces +// including Blockly Options and Google Closure typings. +function typings() { + const tmpDir = './typings/tmp'; + const blocklySrcs = [ + "core/", + "core/components", + "core/components/tree", + "core/components/menu", + "core/keyboard_nav", + "core/renderers/common", + "core/renderers/measurables", + "core/theme", + "core/utils", + "msg/" + ]; + // Clean directory if exists. + if (fs.existsSync(tmpDir)) { + rimraf.sync(tmpDir); + } + fs.mkdirSync(tmpDir); + + // Find all files that will be included in the typings file. + let files = []; + blocklySrcs.forEach((src) => { + files = files.concat(fs.readdirSync(src) + .filter(fn => fn.endsWith('.js')) + .map(fn => path.join(src, fn))); + }); + + // Generate typings file for each file. + files.forEach((file) => { + const typescriptFileName = `${path.join(tmpDir, file)}.d.ts`; + if (file.indexOf('core/msg.js') > -1) { + return; + } + const cmd = `node ./node_modules/typescript-closure-tools/definition-generator/src/main.js ${file} ${typescriptFileName}`; + console.log(`Generating typings for ${file}`); + execSync(cmd, { stdio: 'inherit' }); + }); + + const srcs = [ + 'typings/parts/blockly-header.d.ts', + 'typings/parts/blockly-interfaces.d.ts', + `${tmpDir}/core/**`, + `${tmpDir}/core/components/**`, + `${tmpDir}/core/components/tree/**`, + `${tmpDir}/core/components/menu/**`, + `${tmpDir}/core/keyboard_nav/**`, + `${tmpDir}/core/renderers/common/**`, + `${tmpDir}/core/renderers/measurables/**`, + `${tmpDir}/core/utils/**`, + `${tmpDir}/core/theme/**`, + `${tmpDir}/msg/**` + ]; + return gulp.src(srcs) + .pipe(gulp.concat('blockly.d.ts')) + .pipe(gulp.dest('typings')) + .on('end', function () { + // Clean up tmp directory. + if (fs.existsSync(tmpDir)) { + rimraf.sync(tmpDir); + } + }); +}; + +module.exports = { + typings: typings +}; diff --git a/tests/blocks/logic_ternary_test.js b/tests/blocks/logic_ternary_test.js index 9e28c137b..81142c349 100644 --- a/tests/blocks/logic_ternary_test.js +++ b/tests/blocks/logic_ternary_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/blocks/test_blocks.js b/tests/blocks/test_blocks.js index ff9b8a08b..47b44317d 100644 --- a/tests/blocks/test_blocks.js +++ b/tests/blocks/test_blocks.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; @@ -1340,6 +1329,20 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT } ]); // END JSON EXTRACT (Do not delete this comment.) +Blockly.Blocks['test_images_clickhandler'] = { + init: function() { + this.appendDummyInput() + .appendField("Image click handler") + .appendField(new Blockly.FieldImage( + "https://blockly-demo.appspot.com/static/tests/media/a.png", 32, 32, + "image with click handler", this.onClick_), "IMAGE"); + this.setStyle('text_blocks'); + }, + onClick_: function() { + alert('Image clicked'); + } +}; + Blockly.Blocks['test_validators_text_null'] = { init: function() { this.appendDummyInput() @@ -1486,7 +1489,7 @@ Blockly.Blocks['test_validators_checkbox_not_match_null'] = { this.setCommentText('The validator for this block only works on the' + ' end-most checkbox. If the new value does not match the value of the' + ' start-most checkbox, it will return null (invalid), which means the' + - ' field value should not change. Therfore they should always match.'); + ' field value should not change. Therefore they should always match.'); }, validate: function(newValue) { @@ -1632,7 +1635,7 @@ Blockly.Blocks['test_validators_number_mult10_force'] = { .appendField("force mult of 10") .appendField(new Blockly.FieldNumber(123, null, null, null, this.validate), "INPUT"); this.setColour(230); - this.setCommentText('Theinput value will be rounded to the nearest' + + this.setCommentText('The input value will be rounded to the nearest' + ' multiple of 10. The field will display the input while the field is' + ' being edited, but the value should be the validated (rounded) value.' + ' Note: If you want to do rounding this is not the proper way, use the' + diff --git a/tests/compile/main.js b/tests/compile/main.js index 3f0ec2235..d15932c44 100644 --- a/tests/compile/main.js +++ b/tests/compile/main.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ goog.provide('Main'); diff --git a/tests/generators/golden/generated.dart b/tests/generators/golden/generated.dart index 6a1311cbd..4d438a074 100644 --- a/tests/generators/golden/generated.dart +++ b/tests/generators/golden/generated.dart @@ -1027,17 +1027,29 @@ void test_get_lists_simple() { unittest_assertequals(list[list.length - (0 + 3)], 'Kirk', 'get #-end order simple'); } +dynamic lists_get_from_end(List my_list, num x) { + x = my_list.length - x; + return my_list[x]; +} + +/// Tests the "get" block with create list call. +void test_get_lists_create_list() { + unittest_assertequals(['Kirk', 'Spock', 'McCoy'].first, 'Kirk', 'get first create list'); + unittest_assertequals(['Kirk', 'Spock', 'McCoy'].last, 'McCoy', 'get last simple'); + unittest_assertequals(['Kirk', 'Spock', 'McCoy'].indexOf(lists_get_random_item(['Kirk', 'Spock', 'McCoy'])) + 1 > 0, true, 'get random simple'); + unittest_assertequals(['Kirk', 'Spock', 'McCoy'][1], 'Spock', 'get # simple'); + unittest_assertequals(['Kirk', 'Spock', 'McCoy'][((true ? 2 : null) - 1)], 'Spock', 'get # order simple'); + unittest_assertequals(lists_get_from_end(['Kirk', 'Spock', 'McCoy'], 3), 'Kirk', 'get #-end simple'); + // The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index. + unittest_assertequals(lists_get_from_end(['Kirk', 'Spock', 'McCoy'], 0 + 3), 'Kirk', 'get #-end order simple'); +} + /// Creates a list for use with the get test. dynamic get_star_wars() { number_of_calls = (number_of_calls is num ? number_of_calls : 0) + 1; return ['Kirk', 'Spock', 'McCoy']; } -dynamic lists_get_from_end(List my_list, num x) { - x = my_list.length - x; - return my_list[x]; -} - /// Tests the "get" block with a function call. void test_get_lists_complex() { list = ['Kirk', 'Spock', 'McCoy']; @@ -1623,6 +1635,7 @@ main() { test_find_lists_simple(); test_find_lists_complex(); test_get_lists_simple(); + test_get_lists_create_list(); test_get_lists_complex(); test_getRemove(); test_remove(); diff --git a/tests/generators/golden/generated.js b/tests/generators/golden/generated.js index c9b80a7a7..424793112 100644 --- a/tests/generators/golden/generated.js +++ b/tests/generators/golden/generated.js @@ -1018,6 +1018,18 @@ function test_get_lists_simple() { assertEquals(list.slice((-(0 + 3)))[0], 'Kirk', 'get #-end order simple'); } +// Tests the "get" block with create list call. +function test_get_lists_create_list() { + assertEquals(['Kirk', 'Spock', 'McCoy'][0], 'Kirk', 'get first create list'); + assertEquals(['Kirk', 'Spock', 'McCoy'].slice(-1)[0], 'McCoy', 'get last simple'); + assertEquals(['Kirk', 'Spock', 'McCoy'].indexOf(listsGetRandomItem(['Kirk', 'Spock', 'McCoy'], false)) + 1 > 0, true, 'get random simple'); + assertEquals(['Kirk', 'Spock', 'McCoy'][1], 'Spock', 'get # simple'); + assertEquals(['Kirk', 'Spock', 'McCoy'][((true ? 2 : null) - 1)], 'Spock', 'get # order simple'); + assertEquals(['Kirk', 'Spock', 'McCoy'].slice(-3)[0], 'Kirk', 'get #-end simple'); + // The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index. + assertEquals(['Kirk', 'Spock', 'McCoy'].slice((-(0 + 3)))[0], 'Kirk', 'get #-end order simple'); +} + // Creates a list for use with the get test. function get_star_wars() { number_of_calls = (typeof number_of_calls == 'number' ? number_of_calls : 0) + 1; @@ -1557,6 +1569,7 @@ test_lists_length(); test_find_lists_simple(); test_find_lists_complex(); test_get_lists_simple(); +test_get_lists_create_list(); test_get_lists_complex(); test_getRemove(); test_remove(); diff --git a/tests/generators/golden/generated.lua b/tests/generators/golden/generated.lua index 9b6acfa8b..d96ad64a9 100644 --- a/tests/generators/golden/generated.lua +++ b/tests/generators/golden/generated.lua @@ -1123,13 +1123,6 @@ function test_get_lists_simple() end --- Creates a list for use with the get test. -function get_star_wars() - number_of_calls = number_of_calls + 1 - return {'Kirk', 'Spock', 'McCoy'} -end - - function list_get_last(t) return t[#t] end @@ -1142,6 +1135,26 @@ function list_get_from_end(t, at) return t[#t + 1 - at] end +-- Tests the "get" block with create list call. +function test_get_lists_create_list() + assertEquals(({'Kirk', 'Spock', 'McCoy'})[1], 'Kirk', 'get first create list') + assertEquals(list_get_last(({'Kirk', 'Spock', 'McCoy'})), 'McCoy', 'get last simple') + assertEquals(first_index({'Kirk', 'Spock', 'McCoy'}, list_get_random(({'Kirk', 'Spock', 'McCoy'}))) > 0, true, 'get random simple') + assertEquals(({'Kirk', 'Spock', 'McCoy'})[2], 'Spock', 'get # simple') + assertEquals(({'Kirk', 'Spock', 'McCoy'})[true and 2 or nil], 'Spock', 'get # order simple') + assertEquals(list_get_from_end(({'Kirk', 'Spock', 'McCoy'}), 3), 'Kirk', 'get #-end simple') + -- The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index. + assertEquals(list_get_from_end(({'Kirk', 'Spock', 'McCoy'}), 0 + 3), 'Kirk', 'get #-end order simple') +end + + +-- Creates a list for use with the get test. +function get_star_wars() + number_of_calls = number_of_calls + 1 + return {'Kirk', 'Spock', 'McCoy'} +end + + -- Tests the "get" block with a function call. function test_get_lists_complex() list = {'Kirk', 'Spock', 'McCoy'} @@ -1826,6 +1839,7 @@ test_lists_length() test_find_lists_simple() test_find_lists_complex() test_get_lists_simple() +test_get_lists_create_list() test_get_lists_complex() test_getRemove() test_remove() diff --git a/tests/generators/golden/generated.php b/tests/generators/golden/generated.php index a2d470de4..1b968b90d 100644 --- a/tests/generators/golden/generated.php +++ b/tests/generators/golden/generated.php @@ -1039,6 +1039,19 @@ function test_get_lists_simple() { assertEquals(array_slice($list2, (-(0 + 3)), 1)[0], 'Kirk', 'get #-end order simple'); } +// Tests the "get" block with create list call. +function test_get_lists_create_list() { + global $test_name, $naked, $proc_x, $proc_y, $func_x, $func_y, $func_a, $n, $ok, $log, $count, $varToChange, $rand, $item, $text, $number_of_calls, $list2, $proc_z, $func_z, $x, $proc_w, $func_c, $if2, $i, $loglist, $changing_list, $list_copy, $unittestResults; + assertEquals(array('Kirk', 'Spock', 'McCoy')[0], 'Kirk', 'get first create list'); + assertEquals(end(array('Kirk', 'Spock', 'McCoy')), 'McCoy', 'get last simple'); + assertEquals(indexOf(array('Kirk', 'Spock', 'McCoy'), lists_get_random_item(array('Kirk', 'Spock', 'McCoy'))) > 0, true, 'get random simple'); + assertEquals(array('Kirk', 'Spock', 'McCoy')[1], 'Spock', 'get # simple'); + assertEquals(array('Kirk', 'Spock', 'McCoy')[((true ? 2 : null) - 1)], 'Spock', 'get # order simple'); + assertEquals(array_slice(array('Kirk', 'Spock', 'McCoy'), -3, 1)[0], 'Kirk', 'get #-end simple'); + // The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index. + assertEquals(array_slice(array('Kirk', 'Spock', 'McCoy'), (-(0 + 3)), 1)[0], 'Kirk', 'get #-end order simple'); +} + // Creates a list for use with the get test. function get_star_wars() { global $test_name, $naked, $proc_x, $proc_y, $func_x, $func_y, $func_a, $n, $ok, $log, $count, $varToChange, $rand, $item, $text, $number_of_calls, $list2, $proc_z, $func_z, $x, $proc_w, $func_c, $if2, $i, $loglist, $changing_list, $list_copy, $unittestResults; @@ -1650,6 +1663,7 @@ test_lists_length(); test_find_lists_simple(); test_find_lists_complex(); test_get_lists_simple(); +test_get_lists_create_list(); test_get_lists_complex(); test_getRemove(); test_remove(); diff --git a/tests/generators/golden/generated.py b/tests/generators/golden/generated.py index b20142bb6..8120ae899 100644 --- a/tests/generators/golden/generated.py +++ b/tests/generators/golden/generated.py @@ -872,6 +872,18 @@ def test_get_lists_simple(): # The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index. assertEquals(list2[-int(0 + 3)], 'Kirk', 'get #-end order simple') +# Tests the "get" block with create list call. +def test_get_lists_create_list(): + global test_name, naked, proc_x, proc_y, func_x, func_y, func_a, n, ok, log, count, varToChange, rand, item, text, number_of_calls, list2, proc_z, func_z, x, proc_w, func_c, if2, i, loglist, changing_list, list_copy, unittestResults + assertEquals(['Kirk', 'Spock', 'McCoy'][0], 'Kirk', 'get first create list') + assertEquals(['Kirk', 'Spock', 'McCoy'][-1], 'McCoy', 'get last simple') + assertEquals(first_index(['Kirk', 'Spock', 'McCoy'], random.choice(['Kirk', 'Spock', 'McCoy'])) > 0, True, 'get random simple') + assertEquals(['Kirk', 'Spock', 'McCoy'][1], 'Spock', 'get # simple') + assertEquals(['Kirk', 'Spock', 'McCoy'][int((2 if True else None) - 1)], 'Spock', 'get # order simple') + assertEquals(['Kirk', 'Spock', 'McCoy'][-3], 'Kirk', 'get #-end simple') + # The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index. + assertEquals(['Kirk', 'Spock', 'McCoy'][-int(0 + 3)], 'Kirk', 'get #-end order simple') + # Creates a list for use with the get test. def get_star_wars(): global test_name, naked, proc_x, proc_y, func_x, func_y, func_a, n, ok, log, count, varToChange, rand, item, text, number_of_calls, list2, proc_z, func_z, x, proc_w, func_c, if2, i, loglist, changing_list, list_copy, unittestResults @@ -1395,6 +1407,7 @@ test_lists_length() test_find_lists_simple() test_find_lists_complex() test_get_lists_simple() +test_get_lists_create_list() test_get_lists_complex() test_getRemove() test_remove() diff --git a/tests/generators/lists.xml b/tests/generators/lists.xml index ccb76a946..ce8a14369 100644 --- a/tests/generators/lists.xml +++ b/tests/generators/lists.xml @@ -21,43 +21,48 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + @@ -97,7 +102,7 @@ - + @@ -133,7 +138,7 @@ - + test create lists Tests the "create list with" and "create empty list" blocks. @@ -289,7 +294,7 @@ - + get empty list Creates an empty list for use with the empty test. @@ -297,7 +302,7 @@ - + test lists empty Tests the "is empty" block. @@ -390,7 +395,7 @@ - + test lists length Tests the "length" block. @@ -524,7 +529,7 @@ - + test find lists simple Tests the "find" block with a variable. @@ -657,7 +662,7 @@ - + get names Creates a list for use with the find test. @@ -696,7 +701,7 @@ - + test find lists complex Tests the "find" block with a function call. @@ -1066,7 +1071,7 @@ - + test get lists simple Tests the "get" block with a variable. @@ -1356,7 +1361,392 @@ - + + test get lists create list + Tests the "get" block with create list call. + + + + + get first create list + + + + + + GET + FIRST + + + + + + Kirk + + + + + Spock + + + + + McCoy + + + + + + + + + Kirk + + + + + + + get last simple + + + + + + GET + LAST + + + + + + Kirk + + + + + Spock + + + + + McCoy + + + + + + + + + McCoy + + + + + TRUE + + + get random simple + + + + + GT + + + FIRST + + + + + + Kirk + + + + + Spock + + + + + McCoy + + + + + + + + GET + RANDOM + + + + + + Kirk + + + + + Spock + + + + + McCoy + + + + + + + + + + + + + -1 + + + + + + + + + + + get # simple + + + + + + GET + FROM_START + + + + + + Kirk + + + + + Spock + + + + + McCoy + + + + + + + + + 1 + + + + + + + + + Spock + + + + + + + get # order simple + + + + + + GET + FROM_START + + + + + + Kirk + + + + + Spock + + + + + McCoy + + + + + + + + + TRUE + + + + + + + 1 + + + + + + + + + + + + + + Spock + + + + + + + get #-end simple + + + + + + GET + FROM_END + + + + + + Kirk + + + + + Spock + + + + + McCoy + + + + + + + + + 2 + + + + + + + + + Kirk + + + + + + + get #-end order simple + + + + + + GET + FROM_END + The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index. + + + + + + Kirk + + + + + Spock + + + + + McCoy + + + + + + + ADD + + + 0 + + + + + + + 2 + + + + + + + + + + + Kirk + + + + + + + + + + + + + + + + + + get star wars Creates a list for use with the get test. @@ -1390,7 +1780,7 @@ - + test get lists complex Tests the "get" block with a function call. @@ -2058,7 +2448,7 @@ - + test getRemove Tests the "get and remove" block. @@ -3009,7 +3399,7 @@ - + test remove Tests the "remove" block. @@ -3780,7 +4170,7 @@ - + test set Tests the "set" block. @@ -4641,7 +5031,7 @@ - + test insert Tests the "insert" block. @@ -5542,7 +5932,7 @@ - + test sublist simple Tests the "get sub-list" block with a variable. @@ -6417,7 +6807,7 @@ - + get space shuttles Creates a list for use with the sublist test. @@ -6461,7 +6851,7 @@ - + test sublist complex Tests the "get sub-list" block with a function call. @@ -7557,7 +7947,7 @@ - + test join Tests the "join" block. @@ -7658,7 +8048,7 @@ - + test split Tests the "split" block. @@ -7774,7 +8164,7 @@ - + test sort alphabetic Tests the "alphabetic sort" block. @@ -7895,7 +8285,7 @@ - + test sort ignoreCase Tests the "alphabetic sort ignore case" block. @@ -8016,7 +8406,7 @@ - + test sort numeric Tests the "numeric sort" block. @@ -8137,7 +8527,7 @@ - + test lists reverse Tests the "list reverse" block. @@ -8282,4 +8672,4 @@ - + \ No newline at end of file diff --git a/tests/generators/run_generators_in_browser.js b/tests/generators/run_generators_in_browser.js index 02c6e7827..eb1504082 100644 --- a/tests/generators/run_generators_in_browser.js +++ b/tests/generators/run_generators_in_browser.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/generators/unittest.js b/tests/generators/unittest.js index 8e318a881..0c7c0319c 100644 --- a/tests/generators/unittest.js +++ b/tests/generators/unittest.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/generators/unittest_dart.js b/tests/generators/unittest_dart.js index 12c5892dd..7b8861351 100644 --- a/tests/generators/unittest_dart.js +++ b/tests/generators/unittest_dart.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/generators/unittest_javascript.js b/tests/generators/unittest_javascript.js index 4791fa2a7..f9a64bf9c 100644 --- a/tests/generators/unittest_javascript.js +++ b/tests/generators/unittest_javascript.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/generators/unittest_lua.js b/tests/generators/unittest_lua.js index 4f2532630..e72563f72 100644 --- a/tests/generators/unittest_lua.js +++ b/tests/generators/unittest_lua.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2016 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/generators/unittest_php.js b/tests/generators/unittest_php.js index d208045fc..e0685a9cf 100644 --- a/tests/generators/unittest_php.js +++ b/tests/generators/unittest_php.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2015 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/generators/unittest_python.js b/tests/generators/unittest_python.js index bafcb93d9..e00dc1b6f 100644 --- a/tests/generators/unittest_python.js +++ b/tests/generators/unittest_python.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/block_test.js b/tests/jsunit/block_test.js index 603b4fd14..3dff5d20e 100644 --- a/tests/jsunit/block_test.js +++ b/tests/jsunit/block_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/event_test.js b/tests/jsunit/event_test.js index d6452e009..1e2414a91 100644 --- a/tests/jsunit/event_test.js +++ b/tests/jsunit/event_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/extensions_test.js b/tests/jsunit/extensions_test.js index a465b4f8b..43bb66deb 100644 --- a/tests/jsunit/extensions_test.js +++ b/tests/jsunit/extensions_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/generator_test.js b/tests/jsunit/generator_test.js index 4cdae64fc..b7187991b 100644 --- a/tests/jsunit/generator_test.js +++ b/tests/jsunit/generator_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/jsunit/json_test.js b/tests/jsunit/json_test.js index f6127e23d..197b8b620 100644 --- a/tests/jsunit/json_test.js +++ b/tests/jsunit/json_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/jsunit/mocha_jsunit_test_runner.js b/tests/jsunit/mocha_jsunit_test_runner.js index 7de2401be..91a8e81c2 100644 --- a/tests/jsunit/mocha_jsunit_test_runner.js +++ b/tests/jsunit/mocha_jsunit_test_runner.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/run_jsunit_tests_in_browser.js b/tests/jsunit/run_jsunit_tests_in_browser.js index 90babadf7..fd291cae5 100644 --- a/tests/jsunit/run_jsunit_tests_in_browser.js +++ b/tests/jsunit/run_jsunit_tests_in_browser.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/test_utilities.js b/tests/jsunit/test_utilities.js index b47f341e4..81f78b23c 100644 --- a/tests/jsunit/test_utilities.js +++ b/tests/jsunit/test_utilities.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/utils_dom_test.js b/tests/jsunit/utils_dom_test.js index 8cb8d28a1..90c58a8a8 100644 --- a/tests/jsunit/utils_dom_test.js +++ b/tests/jsunit/utils_dom_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/jsunit/utils_math_test.js b/tests/jsunit/utils_math_test.js index 6e4f4a36d..6f56ec8b1 100644 --- a/tests/jsunit/utils_math_test.js +++ b/tests/jsunit/utils_math_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/jsunit/utils_string_test.js b/tests/jsunit/utils_string_test.js index bdd2a65c8..507368b8b 100644 --- a/tests/jsunit/utils_string_test.js +++ b/tests/jsunit/utils_string_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/jsunit/utils_test.js b/tests/jsunit/utils_test.js index 1edc696f5..6e701a385 100644 --- a/tests/jsunit/utils_test.js +++ b/tests/jsunit/utils_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2011 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/jsunit/variable_map_test.js b/tests/jsunit/variable_map_test.js index dc24abd3c..8f5b2f6ff 100644 --- a/tests/jsunit/variable_map_test.js +++ b/tests/jsunit/variable_map_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/variable_model_test.js b/tests/jsunit/variable_model_test.js index 4eb4cb046..58e32c9b6 100644 --- a/tests/jsunit/variable_model_test.js +++ b/tests/jsunit/variable_model_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/variables_test.js b/tests/jsunit/variables_test.js index 6d6515ff8..7041f3174 100644 --- a/tests/jsunit/variables_test.js +++ b/tests/jsunit/variables_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/widget_div_test.js b/tests/jsunit/widget_div_test.js index c064b5f71..db15dbe37 100644 --- a/tests/jsunit/widget_div_test.js +++ b/tests/jsunit/widget_div_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/jsunit/workspace_comment_test.js b/tests/jsunit/workspace_comment_test.js index e746dfa7d..9bb630252 100644 --- a/tests/jsunit/workspace_comment_test.js +++ b/tests/jsunit/workspace_comment_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/jsunit/workspace_test.js b/tests/jsunit/workspace_test.js index 916cbeead..6576f0346 100644 --- a/tests/jsunit/workspace_test.js +++ b/tests/jsunit/workspace_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2012 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/jsunit/workspace_undo_redo_test.js b/tests/jsunit/workspace_undo_redo_test.js index 9fc06d114..d9745d700 100644 --- a/tests/jsunit/workspace_undo_redo_test.js +++ b/tests/jsunit/workspace_undo_redo_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/jsunit/xml_test.js b/tests/jsunit/xml_test.js index afd3dc9c7..117cd4ed6 100644 --- a/tests/jsunit/xml_test.js +++ b/tests/jsunit/xml_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2014 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; @@ -29,7 +18,7 @@ var XML_TEXT = ['', ' ', ' item', ' ', - ' ', + ' ', ' ', ' ', ' ', diff --git a/tests/mocha/astnode_test.js b/tests/mocha/astnode_test.js index b172de82f..2d0b111a7 100644 --- a/tests/mocha/astnode_test.js +++ b/tests/mocha/astnode_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('ASTNode', function() { diff --git a/tests/mocha/block_test.js b/tests/mocha/block_test.js index 80dca0974..69a00b96e 100644 --- a/tests/mocha/block_test.js +++ b/tests/mocha/block_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Blocks', function() { diff --git a/tests/mocha/comment_test.js b/tests/mocha/comment_test.js index 901edd69e..a24f68c95 100644 --- a/tests/mocha/comment_test.js +++ b/tests/mocha/comment_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Comments', function() { diff --git a/tests/mocha/connection_db_test.js b/tests/mocha/connection_db_test.js index 9c9c1a242..99aabcda9 100644 --- a/tests/mocha/connection_db_test.js +++ b/tests/mocha/connection_db_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Connection Database', function() { diff --git a/tests/mocha/connection_test.js b/tests/mocha/connection_test.js index 5ea5d99f0..f78584cfa 100644 --- a/tests/mocha/connection_test.js +++ b/tests/mocha/connection_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Connections', function() { diff --git a/tests/mocha/cursor_test.js b/tests/mocha/cursor_test.js index 0afad6888..bc367e09b 100644 --- a/tests/mocha/cursor_test.js +++ b/tests/mocha/cursor_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Cursor', function() { diff --git a/tests/mocha/dropdowndiv_test.js b/tests/mocha/dropdowndiv_test.js index 0f7c89bb0..13880a11c 100644 --- a/tests/mocha/dropdowndiv_test.js +++ b/tests/mocha/dropdowndiv_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('DropDownDiv', function() { diff --git a/tests/mocha/event_test.js b/tests/mocha/event_test.js index cf8676971..4b157925f 100644 --- a/tests/mocha/event_test.js +++ b/tests/mocha/event_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Events', function() { diff --git a/tests/mocha/field_angle_test.js b/tests/mocha/field_angle_test.js index 08141c428..6bbc838a4 100644 --- a/tests/mocha/field_angle_test.js +++ b/tests/mocha/field_angle_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Angle Fields', function() { diff --git a/tests/mocha/field_checkbox_test.js b/tests/mocha/field_checkbox_test.js index d9c3aa899..edfdebee2 100644 --- a/tests/mocha/field_checkbox_test.js +++ b/tests/mocha/field_checkbox_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Checkbox Fields', function() { @@ -175,11 +164,21 @@ suite('Checkbox Fields', function() { suite('Check Character', function() { function assertCharacter(field, char) { field.fieldGroup_ = Blockly.utils.dom.createSvgElement('g', {}, null); + field.sourceBlock_ = { + RTL: false, + rendered: true, + workspace: { + keyboardAccessibilityMode: false + }, + render: function() { field.render_(); }, + bumpNeighbours: function() {} + }; field.constants_ = { FIELD_CHECKBOX_X_OFFSET: 2, FIELD_CHECKBOX_Y_OFFSET: 2 }; field.initView(); + field.render_(); chai.assert(field.textContent_.nodeValue, char); } test('Constant', function() { diff --git a/tests/mocha/field_colour_test.js b/tests/mocha/field_colour_test.js index d28620e82..16878c47e 100644 --- a/tests/mocha/field_colour_test.js +++ b/tests/mocha/field_colour_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Colour Fields', function() { diff --git a/tests/mocha/field_date_test.js b/tests/mocha/field_date_test.js index 852eed5f0..50fd781f5 100644 --- a/tests/mocha/field_date_test.js +++ b/tests/mocha/field_date_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /* If you want to run date tests add the date picker here: diff --git a/tests/mocha/field_dropdown_test.js b/tests/mocha/field_dropdown_test.js index 896e2ef55..0bbc36724 100644 --- a/tests/mocha/field_dropdown_test.js +++ b/tests/mocha/field_dropdown_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Dropdown Fields', function() { diff --git a/tests/mocha/field_image_test.js b/tests/mocha/field_image_test.js index 415faf8e0..e5113de1a 100644 --- a/tests/mocha/field_image_test.js +++ b/tests/mocha/field_image_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Image Fields', function() { diff --git a/tests/mocha/field_label_serializable_test.js b/tests/mocha/field_label_serializable_test.js index 911198038..fb490a6ee 100644 --- a/tests/mocha/field_label_serializable_test.js +++ b/tests/mocha/field_label_serializable_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Label Serializable Fields', function() { diff --git a/tests/mocha/field_label_test.js b/tests/mocha/field_label_test.js index 1e3578eb0..b2cf8be95 100644 --- a/tests/mocha/field_label_test.js +++ b/tests/mocha/field_label_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Label Fields', function() { diff --git a/tests/mocha/field_number_test.js b/tests/mocha/field_number_test.js index 081cfa737..91edca652 100644 --- a/tests/mocha/field_number_test.js +++ b/tests/mocha/field_number_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Number Fields', function() { diff --git a/tests/mocha/field_registry_test.js b/tests/mocha/field_registry_test.js index 574e6dfee..c8ea3bb2f 100644 --- a/tests/mocha/field_registry_test.js +++ b/tests/mocha/field_registry_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/mocha/field_test.js b/tests/mocha/field_test.js index f700fa19e..553122fce 100644 --- a/tests/mocha/field_test.js +++ b/tests/mocha/field_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Abstract Fields', function() { diff --git a/tests/mocha/field_textinput_test.js b/tests/mocha/field_textinput_test.js index 6598b0854..a3acdec61 100644 --- a/tests/mocha/field_textinput_test.js +++ b/tests/mocha/field_textinput_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Text Input Fields', function() { @@ -228,9 +217,15 @@ suite('Text Input Fields', function() { setup(function() { this.prepField = function(field) { var workspace = { - scale: 1, - getRenderer: function() { return {}; }, - getTheme: function() { return {}; }, + getScale: function() { + return 1; + }, + getRenderer: function() { return { + getClassName: function() { return ''; } + }; }, + getTheme: function() { return { + getClassName: function() { return ''; } + }; }, markFocused: function() {} }; field.sourceBlock_ = { diff --git a/tests/mocha/field_variable_test.js b/tests/mocha/field_variable_test.js index 0c6474289..c3f6bf3c0 100644 --- a/tests/mocha/field_variable_test.js +++ b/tests/mocha/field_variable_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Variable Fields', function() { diff --git a/tests/mocha/gesture_test.js b/tests/mocha/gesture_test.js index d3bcd1faa..974c7ec0e 100644 --- a/tests/mocha/gesture_test.js +++ b/tests/mocha/gesture_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/mocha/input_test.js b/tests/mocha/input_test.js index e2d181509..001c06969 100644 --- a/tests/mocha/input_test.js +++ b/tests/mocha/input_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Inputs', function() { diff --git a/tests/mocha/key_map_test.js b/tests/mocha/key_map_test.js index 4de012986..6683f9fc9 100644 --- a/tests/mocha/key_map_test.js +++ b/tests/mocha/key_map_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Key Map Tests', function() { diff --git a/tests/mocha/metrics_test.js b/tests/mocha/metrics_test.js index 486946817..1a646b3cd 100644 --- a/tests/mocha/metrics_test.js +++ b/tests/mocha/metrics_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/mocha/names_test.js b/tests/mocha/names_test.js index 5ec208ec3..18b1e5503 100644 --- a/tests/mocha/names_test.js +++ b/tests/mocha/names_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/mocha/navigation_modify_test.js b/tests/mocha/navigation_modify_test.js index 18e146c88..3cd5fdaf1 100644 --- a/tests/mocha/navigation_modify_test.js +++ b/tests/mocha/navigation_modify_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Insert/Modify', function() { diff --git a/tests/mocha/navigation_test.js b/tests/mocha/navigation_test.js index 9e04831b1..5a377b383 100644 --- a/tests/mocha/navigation_test.js +++ b/tests/mocha/navigation_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -56,7 +45,7 @@ suite('Navigation', function() { } }; - this.firstCategory_ = this.workspace.getToolbox().tree_.firstChild_; + this.firstCategory_ = this.workspace.getToolbox().tree_.getChildAt(0); this.secondCategory_ = this.firstCategory_.getNextShownNode(); }); @@ -259,7 +248,7 @@ suite('Navigation', function() { }]); this.workspace = createNavigationWorkspace(true); this.basicBlock = this.workspace.newBlock('basic_block'); - this.firstCategory_ = this.workspace.getToolbox().tree_.firstChild_; + this.firstCategory_ = this.workspace.getToolbox().tree_.getChildAt(0); this.mockEvent = { getModifierState: function() { return false; diff --git a/tests/mocha/procedures_test.js b/tests/mocha/procedures_test.js index 3bbb5cf80..8c6ce0e02 100644 --- a/tests/mocha/procedures_test.js +++ b/tests/mocha/procedures_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ goog.require('Blockly.Blocks.procedures'); diff --git a/tests/mocha/run_mocha_tests_in_browser.js b/tests/mocha/run_mocha_tests_in_browser.js index f7a2cb191..ed0c82943 100644 --- a/tests/mocha/run_mocha_tests_in_browser.js +++ b/tests/mocha/run_mocha_tests_in_browser.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/mocha/test_helpers.js b/tests/mocha/test_helpers.js index b65430e63..6ff98c327 100644 --- a/tests/mocha/test_helpers.js +++ b/tests/mocha/test_helpers.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /* exported assertEquals, assertNotEquals, assertArrayEquals, assertTrue, assertFalse, diff --git a/tests/mocha/theme_test.js b/tests/mocha/theme_test.js index 0676dbc87..cfe9aa376 100644 --- a/tests/mocha/theme_test.js +++ b/tests/mocha/theme_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/mocha/trashcan_test.js b/tests/mocha/trashcan_test.js index 7e0a0fd39..388e33405 100644 --- a/tests/mocha/trashcan_test.js +++ b/tests/mocha/trashcan_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite("Trashcan", function() { diff --git a/tests/mocha/utils_test.js b/tests/mocha/utils_test.js index eb22c28d8..9db5443ac 100644 --- a/tests/mocha/utils_test.js +++ b/tests/mocha/utils_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('Utils', function() { diff --git a/tests/mocha/xml_procedures_test.js b/tests/mocha/xml_procedures_test.js index fefa72aef..09d526362 100644 --- a/tests/mocha/xml_procedures_test.js +++ b/tests/mocha/xml_procedures_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ goog.require('Blockly.Blocks.procedures'); diff --git a/tests/mocha/xml_test.js b/tests/mocha/xml_test.js index 4d37a2872..51b39e684 100644 --- a/tests/mocha/xml_test.js +++ b/tests/mocha/xml_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ suite('XML', function() { diff --git a/tests/node/run_node_test.js b/tests/node/run_node_test.js index 2c3890348..930d83a4a 100644 --- a/tests/node/run_node_test.js +++ b/tests/node/run_node_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/playground.html b/tests/playground.html index 3523caa67..9f3d5cfd9 100644 --- a/tests/playground.html +++ b/tests/playground.html @@ -65,16 +65,23 @@ + - - @@ -34,10 +14,6 @@ goog.require('Blockly.zelos.Renderer'); // Blockly.blockRendering.startDebugger(); - // This stub is a workaround in order to load pxt-blockly blocks, as they - // rely on a setOutputShape method on the block. - Blockly.BlockSvg.prototype.setOutputShape = function() { }; - var blocklyDiv = document.getElementById('blocklyDiv'); var workspace; window.addEventListener('message', function (msg) { @@ -56,6 +32,11 @@ workspace = Blockly.inject(blocklyDiv, { renderer: 'zelos', + rendererOverrides: { + 'FIELD_TEXT_FONTFAMILY': '"Helvetica Neue", "Segoe UI", Helvetica, sans-serif', + 'FIELD_TEXT_FONTWEIGHT': 'bold', + 'FIELD_TEXT_FONTSIZE': 12 + }, move: { scrollbars: true, drag: true, @@ -66,10 +47,6 @@ startScale: 2, } }); - var constants = workspace.getRenderer().getConstants(); - constants.FIELD_TEXT_FONTSIZE = 12; - constants.FIELD_TEXT_FONTWEIGHT = 'bold'; - constants.FIELD_TEXT_FONTFAMILY = 'Helvetica Neue'; Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace); @@ -82,7 +59,7 @@ from: 'zelos', text: datauri }, '*'); - }, document.getElementById('blocklycss').innerText); + }); } catch (err) { console.error(err); } diff --git a/tests/rendering/zelos/scratchblocks/zelos.html b/tests/rendering/zelos/scratchblocks/zelos.html index 3cc6810a9..877c4f4cb 100644 --- a/tests/rendering/zelos/scratchblocks/zelos.html +++ b/tests/rendering/zelos/scratchblocks/zelos.html @@ -7,31 +7,6 @@ - - - - - - @@ -34,10 +14,6 @@ goog.require('Blockly.zelos.Renderer'); // Blockly.blockRendering.startDebugger(); - // This stub is a workaround in order to load pxt-blockly blocks, as they - // rely on a setOutputShape method on the block. - Blockly.BlockSvg.prototype.setOutputShape = function() { }; - var blocklyDiv = document.getElementById('blocklyDiv'); var workspace; window.addEventListener('message', function (msg) { @@ -56,6 +32,11 @@ workspace = Blockly.inject(blocklyDiv, { renderer: 'zelos', + rendererOverrides: { + 'FIELD_TEXT_FONTFAMILY': '"Helvetica Neue", "Segoe UI", Helvetica, sans-serif', + 'FIELD_TEXT_FONTWEIGHT': 'bold', + 'FIELD_TEXT_FONTSIZE': 12 + }, move: { scrollbars: true, drag: true, @@ -66,10 +47,6 @@ startScale: 2, } }); - var constants = workspace.getRenderer().getConstants(); - constants.FIELD_TEXT_FONTSIZE = 12; - constants.FIELD_TEXT_FONTWEIGHT = 'bold'; - constants.FIELD_TEXT_FONTFAMILY = 'Helvetica Neue'; Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace); @@ -82,7 +59,7 @@ from: 'zelos', text: datauri }, '*'); - }, document.getElementById('blocklycss').innerText); + }); } catch (err) { console.error(err); } diff --git a/tests/screenshot/diff-reporter.js b/tests/screenshot/diff-reporter.js index b8abced17..25a4b6929 100644 --- a/tests/screenshot/diff-reporter.js +++ b/tests/screenshot/diff-reporter.js @@ -3,18 +3,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/screenshot/diff_screenshots.js b/tests/screenshot/diff_screenshots.js index 512f34a4a..d4df57ad2 100644 --- a/tests/screenshot/diff_screenshots.js +++ b/tests/screenshot/diff_screenshots.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/screenshot/gen_screenshots.js b/tests/screenshot/gen_screenshots.js index fc938ea60..48af66d12 100644 --- a/tests/screenshot/gen_screenshots.js +++ b/tests/screenshot/gen_screenshots.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** diff --git a/tests/scripts/check_metadata.sh b/tests/scripts/check_metadata.sh index 9b36c4447..243b1f17d 100755 --- a/tests/scripts/check_metadata.sh +++ b/tests/scripts/check_metadata.sh @@ -21,8 +21,8 @@ ANSI_RESET='\033[0m' # Build the compressed files for core and blocks echo "Building files" npm install -gulp build-compressed -gulp build-blocks +gulp buildCompressed +gulp buildBlocks # GZip them for additional size comparisons echo "Zipping the compressed files" diff --git a/tests/themes/test_themes.js b/tests/themes/test_themes.js new file mode 100644 index 000000000..30792ae9e --- /dev/null +++ b/tests/themes/test_themes.js @@ -0,0 +1,64 @@ +/** + * @license + * Copyright 2020 Google LLC + * SPDX-License-Identifier: Apache-2.0 + */ +'use strict'; + +goog.provide('Blockly.TestThemes'); + + +/** + * A theme with classic colours but enables start hats. + */ +Blockly.Themes.TestHats = Blockly.Theme.defineTheme('testhats', { + 'base': Blockly.Themes.Classic +}); +Blockly.Themes.TestHats.setStartHats(true); + +/** + * A theme with classic colours but a different font. + */ +Blockly.Themes.TestFont = Blockly.Theme.defineTheme('testfont', { + 'base': Blockly.Themes.Classic +}); +Blockly.Themes.TestFont.setFontStyle({ + 'family': '"Times New Roman", Times, serif', + 'weight': null, // Use default font-weight + 'size': 16 +}); + +/** + * Holds the test theme name to Theme instance mapping. + * @type {!Object} + * @private + */ +Blockly.Themes.testThemes_ = { + 'Test Hats': Blockly.Themes.TestHats, + 'Test Font': Blockly.Themes.TestFont +}; + +/** + * Get a test theme by name. + * @param {string} value The theme name. + * @return {Blockly.Theme} A theme object or undefined if one doesn't exist. + * @package + */ +function getTestTheme(value) { + return Blockly.Themes.testThemes_[value]; +} + +/** + * Populate the theme changer dropdown to list the set of test themes. + * @package + */ +function populateTestThemes() { + var themeChanger = document.getElementById('themeChanger'); + var keys = Object.keys(Blockly.Themes.testThemes_); + for (var i = 0, key; (key = keys[i]); i++) { + var option = document.createElement('option'); + option.setAttribute('value', key); + option.textContent = key; + themeChanger.appendChild(option); + } +} diff --git a/tests/workspace_svg/event_svg_test.js b/tests/workspace_svg/event_svg_test.js index 46d48f98e..698a6fffe 100644 --- a/tests/workspace_svg/event_svg_test.js +++ b/tests/workspace_svg/event_svg_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/workspace_svg/procedure_svg_test.js b/tests/workspace_svg/procedure_svg_test.js index 1c27245d4..c3775dbb1 100644 --- a/tests/workspace_svg/procedure_svg_test.js +++ b/tests/workspace_svg/procedure_svg_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2018 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/tests/workspace_svg/workspace_svg_test.js b/tests/workspace_svg/workspace_svg_test.js index 56eccb64a..1a5e9fa4b 100644 --- a/tests/workspace_svg/workspace_svg_test.js +++ b/tests/workspace_svg/workspace_svg_test.js @@ -1,18 +1,7 @@ /** * @license * Copyright 2017 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ 'use strict'; diff --git a/typings/blockly.d.ts b/typings/blockly.d.ts index da6ebfd59..425ab3ff4 100644 --- a/typings/blockly.d.ts +++ b/typings/blockly.d.ts @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /** @@ -59,6 +48,7 @@ declare module Blockly { minScale?: number; scaleSpeed?: number; }; + renderer?: string; } interface BlocklyThemeOptions { @@ -196,6 +186,13 @@ declare module Blockly { */ hat: string|any /*undefined*/; + /** + * A count of statement inputs on the block. + * @type {number} + * @package + */ + statementInputCount: number; + /** @type {string} */ type: string; @@ -547,7 +544,7 @@ declare module Blockly { * initializer function. * @param {function(Blockly.Events.Abstract)} onchangeFn The callback to call * when the block's workspace changes. - * @throws {Error} if onchangeFn is not falsey or a function. + * @throws {Error} if onchangeFn is not falsey and not a function. */ setOnChange(onchangeFn: { (_0: Blockly.Events.Abstract): any /*missing*/ }): void; @@ -1423,6 +1420,36 @@ declare module Blockly { */ initSvg(): void; + /** + * Get the secondary colour of a block. + * @return {?string} #RRGGBB string. + */ + getColourSecondary(): string; + + /** + * Get the tertiary colour of a block. + * @return {?string} #RRGGBB string. + */ + getColourTertiary(): string; + + /** + * Get the shadow colour of a block. + * @return {?string} #RRGGBB string. + * @deprecated Use style.colourSecondary. (2020 January 21) + */ + getColourShadow(): string; + + /** + * Get the border colour(s) of a block. + * @return {{colourDark, colourLight, colourBorder}} An object containing + * colour values for the border(s) of the block. If the block is using a + * style the colourBorder will be defined and equal to the tertiary colour + * of the style (#RRGGBB string). Otherwise the colourDark and colourLight + * attributes will be defined (#RRGGBB strings). + * @deprecated Use style.colourTertiary. (2020 January 21) + */ + getColourBorder(): { colourDark: any /*missing*/; colourLight: any /*missing*/; colourBorder: any /*missing*/ }; + /** * Select this block. Highlight it visually. */ @@ -1533,7 +1560,7 @@ declare module Blockly { /** * Notify every input on this block to mark its fields as dirty. - * A dirty field is a field that needs to be re-rendererd. + * A dirty field is a field that needs to be re-rendered. */ markDirty(): void; @@ -1843,6 +1870,12 @@ declare module Blockly { */ render(opt_bubble?: boolean): void; + /** + * Redraw any attached marker or cursor svgs if needed. + * @protected + */ + updateMarkers_(): void; + /** * Add the cursor svg to this block's svg group. * @param {SVGElement} cursorSvg The svg root of the cursor to be added to the @@ -1874,7 +1907,7 @@ declare module Blockly { * @param {boolean} add True if highlighting should be added. * @package */ - highlightForReplacement(add: boolean): void; + fadeForReplacement(add: boolean): void; /** * Visual effect to show that if the dragging block is dropped it will connect @@ -1940,6 +1973,13 @@ declare module Blockly { */ var draggingConnections: Blockly.Connection[]; + /** + * Container element to render the WidgetDiv, DropDownDiv and Tooltip. + * @type {?Element} + * @package + */ + var parentContainer: Element; + /** * Blockly opaque event data used to unbind events when using * `Blockly.bindEvent_` and `Blockly.bindEventWithChecks_`. @@ -2096,6 +2136,15 @@ declare module Blockly { * @package */ function checkBlockColourConstants(): void; + + /** + * Set the parent container. This is the container element that the WidgetDiv, + * DropDownDiv, and Tooltip are rendered into the first time `Blockly.inject` + * is called. + * This method is a NOP if called after the first ``Blockly.inject``. + * @param {!Element} container The container element. + */ + function setParentContainer(container: Element): void; } @@ -2767,12 +2816,6 @@ declare module Blockly { */ var CURRENT_CONNECTION_PREFERENCE: any /*missing*/; - /** - * The main colour of insertion markers, in hex. The block is rendered a - * transparent grey by changing the fill opacity in CSS. - */ - var INSERTION_MARKER_COLOUR: any /*missing*/; - /** * Delay in ms between trigger and bumping unconnected block out of alignment. */ @@ -3642,7 +3685,7 @@ declare module Blockly.Extensions { * to the lookup table. * @param {!Object.} lookupTable The table of field values to * tooltip text. - * @return {Function} The extension function. + * @return {!Function} The extension function. */ function buildTooltipForDropdown(dropdownName: string, lookupTable: { [key: string]: string }): Function; @@ -3653,7 +3696,7 @@ declare module Blockly.Extensions { * @param {string} msgTemplate The template form to of the message text, with * %1 placeholder. * @param {string} fieldName The field with the replacement text. - * @return {Function} The extension function. + * @return {!Function} The extension function. */ function buildTooltipWithFieldText(msgTemplate: string, fieldName: string): Function; } @@ -3798,7 +3841,7 @@ declare module Blockly { * clicked. Blockly will automatically set the field as clickable if this * method is defined. * @param {Event=} opt_e Optional mouse event that triggered the field to open, - * or undefined if triggered programatically. + * or undefined if triggered programmatically. * @return {void} * @protected */ @@ -3834,6 +3877,13 @@ declare module Blockly { */ setSourceBlock(block: Blockly.Block): void; + /** + * Get the renderer constant provider. + * @return {?Blockly.blockRendering.ConstantProvider} The renderer constant + * provider. + */ + getConstants(): Blockly.blockRendering.ConstantProvider; + /** * Get the block this field is attached to. * @return {Blockly.Block} The block containing this field. @@ -4014,7 +4064,7 @@ declare module Blockly { /** * Show an editor when the field is clicked only if the field is clickable. * @param {Event=} opt_e Optional mouse event that triggered the field to open, - * or undefined if triggered programatically. + * or undefined if triggered programmatically. * @package */ showEditor(opt_e?: Event): void; @@ -4029,9 +4079,25 @@ declare module Blockly { /** * Updates the size of the field based on the text. + * @param {number=} opt_margin margin to use when positioning the text element. * @protected */ - updateSize_(): void; + updateSize_(opt_margin?: number): void; + + /** + * Position a field's text element after a size change. This handles both LTR + * and RTL positioning. + * @param {number} xOffset x offset to use when positioning the text element. + * @param {number} contentWidth The content width. + * @protected + */ + positionTextElement_(xOffset: number, contentWidth: number): void; + + /** + * Position a field's border rect after a size change. + * @protected + */ + positionBorderRect_(): void; /** * Returns the height and width of the field. @@ -4122,7 +4188,7 @@ declare module Blockly { doValueUpdate_(newValue: any): void; /** - * Used to notify the field an invalid value was input. Can be overidden by + * Used to notify the field an invalid value was input. Can be overridden by * subclasses, see FieldTextInput. * No-op by default. * @param {*} _invalidValue The input value that was determined to be invalid. @@ -4214,6 +4280,12 @@ declare module Blockly { * @package */ setMarkerSvg(markerSvg: SVGElement): void; + + /** + * Redraw any attached marker or cursor svgs if needed. + * @protected + */ + updateMarkers_(): void; } } @@ -4373,15 +4445,6 @@ declare module Blockly { */ CURSOR: any /*missing*/; - /** - * Used to tell if the field needs to be rendered the next time the block is - * rendered. Checkbox fields are statically sized, and only need to be - * rendered at initialization. - * @type {boolean} - * @protected - */ - isDirty_: boolean; - /** * Create the block UI for this checkbox. * @package @@ -5133,12 +5196,6 @@ declare module Blockly { */ updateSize_(): void; - /** - * Resize the editor to fit the text. - * @protected - */ - resizeEditor_(): void; - /** * Create the text input editor widget. * @return {!HTMLTextAreaElement} The newly created text input editor. @@ -5159,13 +5216,6 @@ declare module Blockly { declare module Blockly.FieldMultilineInput { - /** - * The default height of a single line of text. - * @type {number} - * @const - */ - var LINE_HEIGHT: number; - /** * Construct a FieldMultilineInput from a JSON arg object, * dereferencing any string table references. @@ -5441,7 +5491,7 @@ declare module Blockly { /** * Show the inline free-text editor on top of the text. * @param {Event=} _opt_e Optional mouse event that triggered the field to open, - * or undefined if triggered programatically. + * or undefined if triggered programmatically. * @param {boolean=} opt_quietInput True if editor should be created without * focus. Defaults to false. * @protected @@ -5470,13 +5520,6 @@ declare module Blockly { */ onHtmlInputKeyDown_(e: Event): void; - /** - * Handle blur for the editor. - * @param {!Event} _e Focus event. - * @protected - */ - onHtmlInputBlur_(_e: Event): void; - /** * Set the html input value and the field's internal value. The difference * between this and ``setValue`` is that this also updates the html input @@ -5961,8 +6004,8 @@ declare module Blockly { /** * Create a copy of this block on the workspace. * @param {!Blockly.BlockSvg} originalBlock The block to copy from the flyout. - * @return {Blockly.BlockSvg} The newly created block, or null if something - * went wrong with deserialization. + * @return {!Blockly.BlockSvg} The newly created block. + * @throws {Error} if something went wrong with deserialization. * @package */ createBlock(originalBlock: Blockly.BlockSvg): Blockly.BlockSvg; @@ -6098,9 +6141,14 @@ declare module Blockly { declare module Blockly.FlyoutButton { /** - * The margin around the text in the button. + * The horizontal margin around the text in the button. */ - var MARGIN: any /*missing*/; + var MARGIN_X: any /*missing*/; + + /** + * The vertical margin around the text in the button. + */ + var MARGIN_Y: any /*missing*/; } @@ -6724,7 +6772,7 @@ declare module Blockly { * Move the grid to a new x and y position, and make sure that change is * visible. * @param {number} x The new x position of the grid (in px). - * @param {number} y The new y position ofthe grid (in px). + * @param {number} y The new y position of the grid (in px). * @package */ moveTo(x: number, y: number): void; @@ -7034,7 +7082,7 @@ declare module Blockly { applyConnections(): void; /** - * Update highlighted connections based on the most recent move location. + * Update connections based on the most recent move location. * @param {!Blockly.utils.Coordinate} dxy Position relative to drag start, * in workspace units. * @param {?number} deleteArea One of {@link Blockly.DELETE_AREA_TRASH}, @@ -7055,6 +7103,16 @@ declare module Blockly { } +declare module Blockly.InsertionMarkerManager { + + /** + * An enum describing different kinds of previews the InsertionMarkerManager + * could display. + * @enum {number} + */ + enum PREVIEW_TYPE { INSERTION_MARKER, INPUT_OUTLINE, REPLACEMENT_FADE } +} + declare module Blockly { @@ -7119,6 +7177,12 @@ declare module Blockly { */ setMarkerSvg(markerSvg: SVGElement): void; + /** + * Redraw the attached cursor svg if needed. + * @package + */ + updateMarkers(): void; + /** * Dispose of the marker manager. * Go through and delete all markers associated with this marker manager. @@ -7813,21 +7877,20 @@ declare module Blockly { /** * Class for a theme. * @param {string} name Theme name. - * @param {!Object.} blockStyles A map from - * style names (strings) to objects with style attributes for blocks. - * @param {!Object.} categoryStyles A map - * from style names (strings) to objects with style attributes for + * @param {!Object.=} opt_blockStyles A map + * from style names (strings) to objects with style attributes for blocks. + * @param {!Object.=} opt_categoryStyles A + * map from style names (strings) to objects with style attributes for * categories. - * @param {!Object.=} opt_componentStyles A map of Blockly component - * names to style value. + * @param {!Blockly.Theme.ComponentStyle=} opt_componentStyles A map of Blockly + * component names to style value. * @constructor */ - constructor(name: string, blockStyles: { [key: string]: Blockly.Theme.BlockStyle }, categoryStyles: { [key: string]: Blockly.Theme.CategoryStyle }, opt_componentStyles?: { [key: string]: any }); + constructor(name: string, opt_blockStyles?: { [key: string]: Blockly.Theme.BlockStyle }, opt_categoryStyles?: { [key: string]: Blockly.Theme.CategoryStyle }, opt_componentStyles?: Blockly.Theme.ComponentStyle); /** * The theme name. This can be used to reference a specific theme in CSS. * @type {string} - * @package */ name: string; @@ -7845,6 +7908,49 @@ declare module Blockly { */ categoryStyles: { [key: string]: Blockly.Theme.CategoryStyle }; + /** + * The UI components styles map. + * @type {!Blockly.Theme.ComponentStyle} + * @package + */ + componentStyles: Blockly.Theme.ComponentStyle; + + /** + * The font style. + * @type {!Blockly.Theme.FontStyle} + * @package + */ + fontStyle: Blockly.Theme.FontStyle; + + /** + * Whether or not to add a 'hat' on top of all blocks with no previous or + * output connections. + * @type {?boolean} + * @package + */ + startHats: boolean; + + /** + * Gets the class name that identifies this theme. + * @return {string} The CSS class name. + * @package + */ + getClassName(): string; + + /** + * Overrides or adds a style to the blockStyles map. + * @param {string} blockStyleName The name of the block style. + * @param {Blockly.Theme.BlockStyle} blockStyle The block style. + */ + setBlockStyle(blockStyleName: string, blockStyle: Blockly.Theme.BlockStyle): void; + + /** + * Overrides or adds a style to the categoryStyles map. + * @param {string} categoryStyleName The name of the category style. + * @param {Blockly.Theme.CategoryStyle} categoryStyle The category style. + */ + setCategoryStyle(categoryStyleName: string, categoryStyle: Blockly.Theme.CategoryStyle): void; + /** * Gets the style for a given Blockly UI component. If the style value is a * string, we attempt to find the value of any named references. @@ -7859,6 +7965,19 @@ declare module Blockly { * @param {*} styleValue The style value. */ setComponentStyle(componentName: string, styleValue: any): void; + + /** + * Configure a theme's font style. + * @param {Blockly.Theme.FontStyle} fontStyle The font style. + */ + setFontStyle(fontStyle: Blockly.Theme.FontStyle): void; + + /** + * Configure a theme's start hats. + * @param {boolean} startHats True if the theme enables start hats, false + * otherwise. + */ + setStartHats(startHats: boolean): void; } } @@ -7868,12 +7987,12 @@ declare module Blockly.Theme { /** * A block style. * @typedef {{ - * colourPrimary:string, - * colourSecondary:string, - * colourTertiary:string, - * hat:string - * }} - */ + * colourPrimary:string, + * colourSecondary:string, + * colourTertiary:string, + * hat:string + * }} + */ interface BlockStyle { colourPrimary: string; colourSecondary: string; @@ -7884,12 +8003,74 @@ declare module Blockly.Theme { /** * A category style. * @typedef {{ - * colour:string - * }} - */ + * colour:string + * }} + */ interface CategoryStyle { colour: string } + + /** + * A component style. + * @typedef {{ + * workspaceBackgroundColour:string?, + * toolboxBackgroundColour:string?, + * toolboxForegroundColour:string?, + * flyoutBackgroundColour:string?, + * flyoutForegroundColour:string?, + * flyoutOpacity:number?, + * scrollbarColour:string?, + * scrollbarOpacity:number?, + * insertionMarkerColour:string?, + * insertionMarkerOpacity:number?, + * markerColour:string?, + * cursorColour:string?, + * selectedGlowColour:string?, + * selectedGlowOpacity:number?, + * replacementGlowColour:string?, + * replacementGlowOpacity:number? + * }} + */ + interface ComponentStyle { + workspaceBackgroundColour: string; + toolboxBackgroundColour: string; + toolboxForegroundColour: string; + flyoutBackgroundColour: string; + flyoutForegroundColour: string; + flyoutOpacity: number; + scrollbarColour: string; + scrollbarOpacity: number; + insertionMarkerColour: string; + insertionMarkerOpacity: number; + markerColour: string; + cursorColour: string; + selectedGlowColour: string; + selectedGlowOpacity: number; + replacementGlowColour: string; + replacementGlowOpacity: number + } + + /** + * A font style. + * @typedef {{ + * family:string?, + * weight:string?, + * size:number? + * }} + */ + interface FontStyle { + family: string; + weight: string; + size: number + } + + /** + * Define a new Blockly theme. + * @param {string} name The name of the theme. + * @param {!Object} themeObj An object containing theme properties. + * @return {!Blockly.Theme} A new Blockly theme. + */ + function defineTheme(name: string, themeObj: Object): Blockly.Theme; } @@ -8196,6 +8377,18 @@ declare module Blockly.Tooltip { */ function bindMouseEvents(element: Element): void; + /** + * Unbinds tooltip mouse events from the SVG element. + * @param {!Element} element SVG element onto which tooltip is bound. + */ + function unbindMouseEvents(element: Element): void; + + /** + * Dispose of the tooltip. + * @package + */ + function dispose(): void; + /** * Hide the tooltip. */ @@ -8494,6 +8687,18 @@ declare module Blockly { */ dispose(): void; + /** + * Returns true if the trashcan contents-flyout is currently open. + * @return {boolean} True if the trashcan contents-flyout is currently open. + */ + contentsIsOpen(): boolean; + + /** + * Empties the trashcan's contents. If the contents-flyout is currently open + * it will be closed. + */ + emptyContents(): void; + /** * Position the trashcan. * It is positioned in the opposite corner to the corner the @@ -8529,6 +8734,24 @@ declare module Blockly { } +declare module CustomDialog { + + /** Hides any currently visible dialog. */ + function hide(): void; + + /** + * Shows the dialog. + * Allowed options: + * - showOkay: Whether to show the OK button. + * - showCancel: Whether to show the Cancel button. + * - showInput: Whether to show the text input field. + * - onOkay: Callback to handle the okay button. + * - onCancel: Callback to handle the cancel button and backdrop clicks. + */ + function show(title: any /* jsdoc error */, message: any /* jsdoc error */, options: any /* jsdoc error */): void; +} + + declare module Blockly.Events { class Ui extends Ui__Class { } @@ -8751,7 +8974,7 @@ declare module Blockly.utils { * Converts screen coordinates to workspace coordinates. * @param {Blockly.WorkspaceSvg} ws The workspace to find the coordinates on. * @param {Blockly.utils.Coordinate} screenCoordinates The screen coordinates to - * be converted to workspace coordintaes + * be converted to workspace coordinates * @return {Blockly.utils.Coordinate} The workspace coordinates. * @package */ @@ -10584,7 +10807,6 @@ declare module Blockly { /** * True if keyboard accessibility mode is on, false otherwise. * @type {boolean} - * @package */ keyboardAccessibilityMode: boolean; @@ -10708,8 +10930,9 @@ declare module Blockly { * Developers may define this function to add custom menu options to the * workspace's context menu or edit the workspace-created set of menu options. * @param {!Array.} options List of menu options to add to. + * @param {!Event} e The right-click event that triggered the context menu. */ - configureContextMenu(options: Object[]): void; + configureContextMenu(options: Object[], e: Event): void; /** * In a flyout, the target workspace where blocks should be placed after a drag. @@ -11226,6 +11449,13 @@ declare module Blockly { */ setScale(newScale: number): void; + /** + * Get the workspace's zoom factor. If the workspace has a parent, we call into + * the parent to get the workspace scale. + * @return {number} The workspace zoom factor. Units: (pixels / workspaceUnit). + */ + getScale(): number; + /** * Scroll the workspace to a specified offset (in pixels), keeping in the * workspace bounds. See comment on workspaceSvg.scrollX for more detail on @@ -11782,6 +12012,13 @@ declare module Blockly { */ constructor(); + /** + * Whether the component is rendered right-to-left. + * @type {boolean} + * @protected + */ + rightToLeft_: boolean; + /** * Gets the unique ID for the instance of this component. If the instance * doesn't already have an ID, generates one on the fly. @@ -11979,15 +12216,6 @@ declare module Blockly { */ getContentElement(): Element; - /** - * Returns true if the component is rendered right-to-left, false otherwise. - * The first time this function is invoked, the right-to-left rendering property - * is set if it has not been already. - * @return {boolean} Whether the control is rendered right-to-left. - * @protected - */ - isRightToLeft(): boolean; - /** * Set is right-to-left. This function should be used if the component needs * to know the rendering direction during DOM creation (i.e. before @@ -12100,7 +12328,7 @@ declare module Blockly { * It is recommended that you use one of the createNode methods instead of * creating a node directly. * @param {string} type The type of the location. - * Must be in Bockly.ASTNode.types. + * Must be in Blockly.ASTNode.types. * @param {!(Blockly.Block|Blockly.Connection|Blockly.Field|Blockly.Workspace)} * location The position in the AST. * @param {!Object=} opt_params Optional dictionary of options. @@ -12716,25 +12944,25 @@ declare module Blockly.navigation { var ACTION_TOGGLE_KEYBOARD_NAV: Blockly.Action; /** - * The action to move the cursor to the keft on a worksapce. + * The action to move the cursor to the left on a workspace. * @type {!Blockly.Action} */ var ACTION_MOVE_WS_CURSOR_LEFT: Blockly.Action; /** - * The action to move the cursor to the right on a worksapce. + * The action to move the cursor to the right on a workspace. * @type {!Blockly.Action} */ var ACTION_MOVE_WS_CURSOR_RIGHT: Blockly.Action; /** - * The action to move the cursor up on a worksapce. + * The action to move the cursor up on a workspace. * @type {!Blockly.Action} */ var ACTION_MOVE_WS_CURSOR_UP: Blockly.Action; /** - * The action to move the cursor down on a worksapce. + * The action to move the cursor down on a workspace. * @type {!Blockly.Action} */ var ACTION_MOVE_WS_CURSOR_DOWN: Blockly.Action; @@ -13092,6 +13320,30 @@ declare module Blockly.utils.dom { * @return {number} Width of element. */ function getFastTextWidth(textElement: Element, fontSize: number, fontWeight: string, fontFamily: string): number; + + /** + * Gets the width of a text element using a faster method than `getTextWidth`. + * This method requires that we know the text element's font family and size in + * advance. Similar to `getTextWidth`, we cache the width we compute. + * This method is similar to ``getFastTextWidth`` but expects the font size + * parameter to be a string. + * @param {!Element} textElement An SVG 'text' element. + * @param {string} fontSize The font size to use. + * @param {string} fontWeight The font weight to use. + * @param {string} fontFamily The font family to use. + * @return {number} Width of element. + */ + function getFastTextWidthWithSizeString(textElement: Element, fontSize: string, fontWeight: string, fontFamily: string): number; + + /** + * Measure a font's metrics. The height and baseline values. + * @param {string} text Text to measure the font dimensions of. + * @param {string} fontSize The font size to use. + * @param {string} fontWeight The font weight to use. + * @param {string} fontFamily The font family to use. + * @return {{height: number, baseline: number}} Font measurements. + */ + function measureFontMetrics(text: string, fontSize: string, fontWeight: string, fontFamily: string): { height: number; baseline: number }; } @@ -13182,6 +13434,14 @@ declare module Blockly.utils.object { */ function mixin(target: Object, source: Object): void; + /** + * Complete a deep merge of all members of a source object with a target object. + * @param {!Object} target Target. + * @param {!Object} source Source. + * @return {!Object} The resulting object. + */ + function deepMerge(target: Object, source: Object): Object; + /** * Returns an array of a given object's own enumerable property values. * @param {!Object} obj Object containing values. @@ -13453,7 +13713,7 @@ declare module Blockly.utils.svgPaths { function point(x: number, y: number): string; /** - * Draw a curbic or quadratic curve. See + * Draw a cubic or quadratic curve. See * developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#Cubic_B%C3%A9zier_Curve * These coordinates are unitless and hence in the user coordinate system. * @param {string} command The command to use. @@ -13619,12 +13879,59 @@ declare module Blockly.tree { */ constructor(content: string, config: Blockly.tree.BaseNode.Config); + /** + * Text content of the node label. + * @type {string} + * @package + */ + content: string; + + /** + * @type {string} + * @package + */ + iconClass: string; + + /** + * @type {string} + * @package + */ + expandedIconClass: string; + + /** + * The configuration for the tree. + * @type {!Blockly.tree.BaseNode.Config} + * @protected + */ + config_: Blockly.tree.BaseNode.Config; + /** * @type {Blockly.tree.TreeControl} * @protected */ tree: Blockly.tree.TreeControl; + /** + * Whether the tree item is selected. + * @type {boolean} + * @protected + */ + selected_: boolean; + + /** + * Whether the tree node is expanded. + * @type {boolean} + * @protected + */ + expanded_: boolean; + + /** + * Whether to allow user to collapse this node. + * @type {boolean} + * @protected + */ + isUserCollapsible_: boolean; + /** * Adds roles and states. * @protected @@ -13677,18 +13984,6 @@ declare module Blockly.tree { */ getChildren(): Blockly.tree.BaseNode[]; - /** - * @return {Blockly.tree.BaseNode} The first child of this node. - * @protected - */ - getFirstChild(): Blockly.tree.BaseNode; - - /** - * @return {Blockly.tree.BaseNode} The last child of this node. - * @protected - */ - getLastChild(): Blockly.tree.BaseNode; - /** * @return {Blockly.tree.BaseNode} The previous sibling of this node. * @protected @@ -13719,31 +14014,12 @@ declare module Blockly.tree { */ select(): void; - /** - * Selects the first node. - * @protected - */ - selectFirst(): void; - /** * Called from the tree to instruct the node change its selection state. * @param {boolean} selected The new selection state. * @protected */ - setSelectedInternal(selected: boolean): void; - - /** - * @return {boolean} Whether the node is expanded. - * @protected - */ - getExpanded(): boolean; - - /** - * Sets the node to be expanded internally, without state change events. - * @param {boolean} expanded Whether to expand or close the node. - * @protected - */ - setExpandedInternal(expanded: boolean): void; + setSelected(selected: boolean): void; /** * Sets the node to be expanded. @@ -13754,14 +14030,14 @@ declare module Blockly.tree { /** * Used to notify a node of that we have expanded it. - * Can be overidden by subclasses, see Blockly.tree.TreeNode. + * Can be overridden by subclasses, see Blockly.tree.TreeNode. * @protected */ doNodeExpanded(): void; /** * Used to notify a node that we have collapsed it. - * Can be overidden by subclasses, see Blockly.tree.TreeNode. + * Can be overridden by subclasses, see Blockly.tree.TreeNode. * @protected */ doNodeCollapsed(): void; @@ -13772,12 +14048,6 @@ declare module Blockly.tree { */ toggle(): void; - /** - * @return {boolean} Whether the node is collapsible by user actions. - * @protected - */ - isUserCollapsible(): boolean; - /** * Creates HTML Element for the node. * @return {!Element} HTML element @@ -13846,35 +14116,6 @@ declare module Blockly.tree { */ getChildrenElement(): Element; - /** - * Gets the icon class for the node. - * @return {string} s The icon source. - * @protected - */ - getIconClass(): string; - - /** - * Gets the icon class for when the node is expanded. - * @return {string} The class. - * @protected - */ - getExpandedIconClass(): string; - - /** - * Sets the text of the label. - * @param {string} s The plain text of the label. - * @protected - */ - setText(s: string): void; - - /** - * Returns the text of the label. If the text was originally set as HTML, the - * return value is unspecified. - * @return {string} The plain text of the label. - * @package - */ - getText(): string; - /** * Updates the row styles. * @protected @@ -13957,12 +14198,6 @@ declare module Blockly.tree { */ getPreviousShownNode(): Blockly.tree.BaseNode; - /** - * @return {!Blockly.tree.BaseNode.Config} The configuration for the tree. - * @protected - */ - getConfig(): Blockly.tree.BaseNode.Config; - /** * Internal method that is used to set the tree control on the node. * @param {Blockly.tree.TreeControl} tree The tree control. @@ -14432,11 +14667,13 @@ declare module Blockly.blockRendering { /** * Initialize anything needed for rendering (constants, etc). * @param {!string} name Name of the renderer to initialize. + * @param {!Blockly.Theme} theme The workspace theme object. + * @param {Object=} opt_rendererOverrides Rendering constant overrides. * @return {!Blockly.blockRendering.Renderer} The new instance of a renderer. * Already initialized. * @package */ - function init(name: string): Blockly.blockRendering.Renderer; + function init(name: string, theme: Blockly.Theme, opt_rendererOverrides?: Object): Blockly.blockRendering.Renderer; } @@ -14648,12 +14885,6 @@ declare module Blockly.blockRendering { */ FIELD_TEXT_FONTSIZE: number; - /** - * Height of text. - * @type {number} - */ - FIELD_TEXT_HEIGHT: number; - /** * Text font weight. * @type {string} @@ -14666,6 +14897,20 @@ declare module Blockly.blockRendering { */ FIELD_TEXT_FONTFAMILY: string; + /** + * Height of text. This constant is dynamically set in ``setFontConstants_`` + * to be the height of the text based on the font used. + * @type {number} + */ + FIELD_TEXT_HEIGHT: number; + + /** + * Text baseline. This constant is dynamically set in ``setFontConstants_`` + * to be the baseline of the text based on the font used. + * @type {number} + */ + FIELD_TEXT_BASELINE: number; + /** * A field's border rect corner radius. * @type {number} @@ -14697,19 +14942,6 @@ declare module Blockly.blockRendering { */ FIELD_BORDER_RECT_COLOUR: string; - /** - * Field text baseline. - * This is only used if `FIELD_TEXT_BASELINE_CENTER` is false. - * @type {number} - */ - FIELD_TEXT_BASELINE_Y: number; - - /** - * An text offset adjusting the Y position of text after positioning. - * @type {number} - */ - FIELD_TEXT_Y_OFFSET: number; - /** * A field's text element's dominant baseline. * @type {boolean} @@ -14792,25 +15024,13 @@ declare module Blockly.blockRendering { */ FIELD_CHECKBOX_X_OFFSET: number; - /** - * A checkbox field's Y offset. - * @type {number} - */ - FIELD_CHECKBOX_Y_OFFSET: number; - - /** - * A checkbox field's default width. - * @type {number} - */ - FIELD_CHECKBOX_DEFAULT_WIDTH: number; - /** * A random identifier used to ensure a unique ID is used for each * filter/pattern for the case of multiple Blockly instances on a page. * @type {string} - * @protected + * @package */ - randomIdentifier_: string; + randomIdentifier: string; /** * The ID of the emboss filter, or the empty string if no filter is set. @@ -14826,6 +15046,13 @@ declare module Blockly.blockRendering { */ disabledPatternId: string; + /** + * The ID of the debug filter, or the empty string if no pattern is set. + * @type {string} + * @package + */ + debugFilterId: string; + /** * Cursor colour. * @type {string} @@ -14882,6 +15109,21 @@ declare module Blockly.blockRendering { */ FULL_BLOCK_FIELDS: boolean; + /** + * The main colour of insertion markers, in hex. The block is rendered a + * transparent grey by changing the fill opacity in CSS. + * @type {string} + * @package + */ + INSERTION_MARKER_COLOUR: string; + + /** + * The insertion marker opacity. + * @type {number} + * @package + */ + INSERTION_MARKER_OPACITY: number; + /** * Enum for connection shapes. * @enum {number} @@ -14936,7 +15178,7 @@ declare module Blockly.blockRendering { * @param {!Blockly.Theme} theme The current workspace theme. * @package */ - refreshTheme(theme: Blockly.Theme): void; + setTheme(theme: Blockly.Theme): void; /** * The block styles map. @@ -14945,6 +15187,27 @@ declare module Blockly.blockRendering { */ blockStyles: { [key: string]: Blockly.Theme.BlockStyle }; + /** + * Sets dynamic properties that depend on other values or theme properties. + * @param {!Blockly.Theme} theme The current workspace theme. + * @protected + */ + setDynamicProperties_(theme: Blockly.Theme): void; + + /** + * Set constants related to fonts. + * @param {!Blockly.Theme} theme The current workspace theme. + * @protected + */ + setFontConstants_(theme: Blockly.Theme): void; + + /** + * Set constants from a theme's component styles. + * @param {!Blockly.Theme} theme The current workspace theme. + * @protected + */ + setComponentConstants_(theme: Blockly.Theme): void; + /** * Get or create a block style based on a single colour value. Generate a name * for the style based on the colour. @@ -15066,24 +15329,28 @@ declare module Blockly.blockRendering { /** * Create any DOM elements that this renderer needs (filters, patterns, etc). * @param {!SVGElement} svg The root of the workspace's SVG. + * @param {string} tagName The name to use for the CSS style tag. + * @param {string} selector The CSS selector to use. + * @suppress {strictModuleDepCheck} Debug renderer only included in playground. * @package */ - createDom(svg: SVGElement): void; + createDom(svg: SVGElement, tagName: string, selector: string): void; /** * Inject renderer specific CSS into the page. - * @param {string} name Name of the renderer. - * @package + * @param {string} tagName The name of the style tag to use. + * @param {string} selector The CSS selector to use. + * @protected */ - injectCSS(name: string): void; + injectCSS_(tagName: string, selector: string): void; /** * Get any renderer specific CSS to inject when the renderer is initialized. - * @param {string} name Name of the renderer. + * @param {string} selector CSS selector to use. * @return {!Array.} Array of CSS strings. * @protected */ - getCSS_(name: string): string[]; + getCSS_(selector: string): string[]; } } @@ -15097,10 +15364,12 @@ declare module Blockly.blockRendering { /** * An object that renders rectangles and dots for debugging rendering code. + * @param {!Blockly.blockRendering.ConstantProvider} constants The renderer's + * constants. * @package * @constructor */ - constructor(); + constructor(constants: Blockly.blockRendering.ConstantProvider); /** * Remove all elements the this object created on the last pass. @@ -15179,6 +15448,13 @@ declare module Blockly.blockRendering { * @package */ drawDebug(block: Blockly.BlockSvg, info: Blockly.blockRendering.RenderInfo): void; + + /** + * Show a debug filter to highlight that a block has been rendered. + * @param {!SVGElement} svgPath The block's svg path. + * @package + */ + drawRender(svgPath: SVGElement): void; } } @@ -15469,7 +15745,7 @@ declare module Blockly.blockRendering { * @param {boolean} enable True if styling should be added. * @package */ - updateReplacementHighlight(enable: boolean): void; + updateReplacementFade(enable: boolean): void; } } @@ -15573,11 +15849,10 @@ declare module Blockly.blockRendering { rows: Blockly.blockRendering.Row[]; /** - * The total number of input rows added onto the block. - * @type {number} - * @protected + * An array of input rows on the block. + * @type {!Array.} */ - inputRowNum_: number; + inputRows: Blockly.blockRendering.InputRow[]; /** * An array of measurable objects containing hidden icons. @@ -15952,6 +16227,12 @@ declare module Blockly.blockRendering { */ createDomInternal_(): Element; + /** + * Apply the marker's colour. + * @protected + */ + applyColour_(): void; + /** * Dispose of this marker. * @package @@ -16008,9 +16289,9 @@ declare module Blockly.blockRendering { /** * The renderer's constant provider. * @type {!Blockly.blockRendering.ConstantProvider} - * @protected + * @package */ - constants_: Blockly.blockRendering.ConstantProvider; + constants: Blockly.blockRendering.ConstantProvider; /** * The primary path of the block. @@ -16026,6 +16307,22 @@ declare module Blockly.blockRendering { */ style: Blockly.Theme.BlockStyle; + /** + * Holds the cursors svg element when the cursor is attached to the block. + * This is null if there is no cursor on the block. + * @type {SVGElement} + * @package + */ + cursorSvg: SVGElement; + + /** + * Holds the markers svg element when the marker is attached to the block. + * This is null if there is no marker on the block. + * @type {SVGElement} + * @package + */ + markerSvg: SVGElement; + /** * Set the path generated by the renderer onto the respective SVG element. * @param {string} pathString The path. @@ -16138,7 +16435,7 @@ declare module Blockly.blockRendering { * @param {boolean} enable True if styling should be added. * @package */ - updateReplacementHighlight(enable: boolean): void; + updateReplacementFade(enable: boolean): void; /** * Add or remove styling that shows that if the dragging block is dropped, this @@ -16175,10 +16472,49 @@ declare module Blockly.blockRendering { name: string; /** - * Initialize the renderer. + * Rendering constant overrides, passed in through options. + * @type {?Object} * @package */ - init(): void; + overrides: Object; + + /** + * Gets the class name that identifies this renderer. + * @return {string} The CSS class name. + * @package + */ + getClassName(): string; + + /** + * Initialize the renderer. + * @param {!Blockly.Theme} theme The workspace theme object. + * @param {Object=} opt_rendererOverrides Rendering constant overrides. + * @package + */ + init(theme: Blockly.Theme, opt_rendererOverrides?: Object): void; + + /** + * Create any DOM elements that this renderer needs. + * @param {!SVGElement} svg The root of the workspace's SVG. + * @param {!Blockly.Theme} theme The workspace theme object. + * @package + */ + createDom(svg: SVGElement, theme: Blockly.Theme): void; + + /** + * Refresh the renderer after a theme change. + * @param {!SVGElement} svg The root of the workspace's SVG. + * @param {!Blockly.Theme} theme The workspace theme object. + * @package + */ + refreshDom(svg: SVGElement, theme: Blockly.Theme): void; + + /** + * Dispose of this renderer. + * Delete all DOM elements that this renderer and its constants created. + * @package + */ + dispose(): void; /** * Create a new instance of the renderer's constant provider. @@ -16251,13 +16587,32 @@ declare module Blockly.blockRendering { shouldHighlightConnection(_conn: Blockly.Connection): boolean; /** - * Determine whether or not to insert a dragged block into a stack. - * @param {!Blockly.Block} block The target block. - * @param {!Blockly.Connection} conn The closest connection. - * @return {boolean} True if we should insert the dragged block into the stack. + * Checks if an orphaned block can connect to the "end" of the topBlock's + * block-clump. If the clump is a row the end is the last input. If the clump + * is a stack, the end is the last next connection. If the clump is neither, + * then this returns false. + * @param {!Blockly.BlockSvg} topBlock The top block of the block clump we want to try and + * connect to. + * @param {!Blockly.BlockSvg} orphanBlock The orphan block that wants to find + * a home. + * @param {number} localType The type of the connection being dragged. + * @return {boolean} Whether there is a home for the orphan or not. * @package */ - shouldInsertDraggedBlock(block: Blockly.Block, conn: Blockly.Connection): boolean; + orphanCanConnectAtEnd(topBlock: Blockly.BlockSvg, orphanBlock: Blockly.BlockSvg, localType: number): boolean; + + /** + * Chooses a connection preview method based on the available connection, the + * current dragged connection, and the block being dragged. + * @param {!Blockly.RenderedConnection} closest The available connection. + * @param {!Blockly.RenderedConnection} local The connection currently being + * dragged. + * @param {!Blockly.BlockSvg} topBlock The block currently being dragged. + * @return {!Blockly.InsertionMarkerManager.PREVIEW_TYPE} The preview type + * to display. + * @package + */ + getConnectionPreviewMethod(closest: Blockly.RenderedConnection, local: Blockly.RenderedConnection, topBlock: Blockly.BlockSvg): Blockly.InsertionMarkerManager.PREVIEW_TYPE; /** * Render the block. @@ -16967,7 +17322,7 @@ declare module Blockly.blockRendering.Types { /** * Get the enum flag value of an existing type or register a new type. * @param {!string} type The name of the type. - * @return {!number} The enum flag value assosiated with that type. + * @return {!number} The enum flag value associated with that type. * @package */ function getType(type: string): number; diff --git a/typings/parts/blockly-header.d.ts b/typings/parts/blockly-header.d.ts index df410339e..15bcf14dd 100644 --- a/typings/parts/blockly-header.d.ts +++ b/typings/parts/blockly-header.d.ts @@ -1,18 +1,7 @@ /** * @license * Copyright 2019 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ /**