diff --git a/blockly_compressed.js b/blockly_compressed.js index d79833ed9..8fdab6f2c 100644 --- a/blockly_compressed.js +++ b/blockly_compressed.js @@ -117,8 +117,8 @@ Blockly.Xml.cloneShadow_=function(a,b){for(var c=a=a.cloneNode(!0),d;c;)if(b&&"s 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};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();var c=Blockly.Xml.domToWorkspace(a,b);b.setResizesEnabled(!0);return c}; 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=a.childNodes.length,f=Blockly.Events.getGroup();f||Blockly.Events.setGroup(!0);b.setResizesEnabled&&b.setResizesEnabled(!1);var g=!0;try{for(var h=0;h>>/g,d);d=document.createElement("style");c=document.createTextNode(c);d.appendChild(c);document.head.insertBefore(d,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")}; Blockly.Css.CONTENT=[".blocklySvg {","background-color: #fff;","outline: none;","overflow: hidden;","position: absolute;","display: block;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","overflow: hidden;","touch-action: none;","}",".blocklyNonSelectable {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyWsDragSurface {","display: none;","position: absolute;","top: 0;", "left: 0;","}",".blocklyWsDragSurface.blocklyOverflowVisible {","overflow: visible;","}",".blocklyBlockDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;","bottom: 0;","overflow: visible !important;","z-index: 50;","}",".blocklyBlockCanvas.blocklyCanvasTransitioning,",".blocklyBubbleCanvas.blocklyCanvasTransitioning {","transition: transform .5s;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);", @@ -815,14 +815,13 @@ Blockly.tree.BaseNode.prototype.getNextSibling=function(){return this.nextSiblin 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.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=this.getLineStyle();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="padding-"+(this.isRightToLeft()?"right":"left")+":"+this.getPixelIndent_()+"px",b=document.createElement("div");b.className=this.getRowClassName();b.style=a;b.appendChild(this.getIconDom());b.appendChild(this.getLabelDom());return b};Blockly.tree.BaseNode.prototype.getRowClassName=function(){var a="";this.isSelected()&&(a=" "+(this.config_.cssSelectedRow||""));return this.config_.cssTreeRow+a}; +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");}; -Blockly.tree.BaseNode.prototype.getLineStyle=function(){var a=this.getExpanded()&&this.hasChildren();return"background-position: "+this.getBackgroundPosition()+"; "+(a?"":"display: none")};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.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}; @@ -1202,10 +1201,10 @@ Blockly.Css.register([".blocklyToolboxDelete {",'cursor: url("<<>>/handdel "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 {", "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.hasBlocks_=!1;this.contents_=[];if(!(0>=this.workspace_.options.maxTrashcanContents)){a={scrollbars:!0,disabledPatternId:this.workspace_.options.disabledPatternId,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_())}}; -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_=[];if(!(0>=this.workspace_.options.maxTrashcanContents)){a={scrollbars:!0,disabledPatternId:this.workspace_.options.disabledPatternId,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; 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_}; @@ -1214,10 +1213,10 @@ Blockly.Trashcan.prototype.dispose=function(){this.svgGroup_&&(Blockly.utils.dom Blockly.Trashcan.prototype.position=function(){if(this.verticalSpacing_){var a=this.workspace_.getMetrics();a&&(this.left_=a.toolboxPosition==Blockly.TOOLBOX_AT_LEFT||this.workspace_.horizontalLayout&&!this.workspace_.RTL?a.viewWidth+a.absoluteLeft-this.WIDTH_-this.MARGIN_SIDE_-Blockly.Scrollbar.scrollbarThickness:this.MARGIN_SIDE_+Blockly.Scrollbar.scrollbarThickness,this.top_=a.toolboxPosition==Blockly.TOOLBOX_AT_BOTTOM?this.verticalSpacing_:a.viewHeight+a.absoluteTop-(this.BODY_HEIGHT_+this.LID_HEIGHT_)- this.verticalSpacing_,this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")"))}};Blockly.Trashcan.prototype.getClientRect=function(){if(!this.svgGroup_)return null;var a=this.svgGroup_.getBoundingClientRect(),b=a.top+this.SPRITE_TOP_-this.MARGIN_HOTSPOT_;a=a.left+this.SPRITE_LEFT_-this.MARGIN_HOTSPOT_;return new Blockly.utils.Rect(b,b+this.LID_HEIGHT_+this.BODY_HEIGHT_+2*this.MARGIN_HOTSPOT_,a,a+this.WIDTH_+2*this.MARGIN_HOTSPOT_)}; Blockly.Trashcan.prototype.setOpen_=function(a){this.isOpen!=a&&(clearTimeout(this.lidTask_),this.isOpen=a,this.animateLid_())};Blockly.Trashcan.prototype.animateLid_=function(){this.lidOpen_+=this.isOpen?.2:-.2;this.lidOpen_=Math.min(Math.max(this.lidOpen_,this.minOpenness_),1);this.setLidAngle_(45*this.lidOpen_);this.svgGroup_.style.opacity=.4+.4*this.lidOpen_;this.lidOpen_>this.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.hasBlocks_){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.hasBlocks_&&this.setOpen_(!0)};Blockly.Trashcan.prototype.mouseOut_=function(){this.setOpen_(!1)}; -Blockly.Trashcan.prototype.onDelete_=function(){var a=this;return function(b){0>=a.workspace_.options.maxTrashcanContents||b.type!=Blockly.Events.BLOCK_DELETE||"shadow"==b.oldXml.tagName.toLowerCase()||(b=a.cleanBlockXML_(b.oldXml),-1==a.contents_.indexOf(b)&&(a.contents_.unshift(b),a.contents_.length>a.workspace_.options.maxTrashcanContents&&a.contents_.splice(a.workspace_.options.maxTrashcanContents,a.contents_.length-a.workspace_.options.maxTrashcanContents),a.hasBlocks_=!0,a.minOpenness_=a.HAS_BLOCKS_LID_ANGLE, -a.setLidAngle_(45*a.minOpenness_)))}};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"));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(),null,"String")};Blockly.VariablesDynamic.onCreateVariableButtonClick_Number=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),null,"Number")};Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),null,"Colour")}; +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.cleanBlockXML_=function(a){for(var b=a=a.cloneNode(!0);b;){b.removeAttribute&&(b.removeAttribute("x"),b.removeAttribute("y"),b.removeAttribute("id"));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(),null,"String")};Blockly.VariablesDynamic.onCreateVariableButtonClick_Number=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),null,"Number")};Blockly.VariablesDynamic.onCreateVariableButtonClick_Colour=function(a){Blockly.Variables.createVariableButtonHandler(a.getTargetWorkspace(),null,"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)}; Blockly.VariablesDynamic.flyoutCategoryBlocks=function(a){a=a.getAllVariables();var b=[];if(0image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}"]);Blockly.requires={}; \ No newline at end of file +Blockly.Css.register([".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}"]);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.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"}};Blockly.Themes.Dark=new Blockly.Theme(Blockly.Themes.Dark.defaultBlockStyles,Blockly.Themes.Dark.categoryStyles); +Blockly.Themes.Dark.setComponentStyle("workspace","#1e1e1e");Blockly.Themes.Dark.setComponentStyle("toolbox","#333");Blockly.Themes.Dark.setComponentStyle("toolboxText","#fff");Blockly.Themes.Dark.setComponentStyle("flyout","#252526");Blockly.Themes.Dark.setComponentStyle("flyoutText","#ccc");Blockly.Themes.Dark.setComponentStyle("flyoutOpacity",1);Blockly.Themes.Dark.setComponentStyle("scrollbar","#797979");Blockly.Themes.Dark.setComponentStyle("scrollbarOpacity",.4);Blockly.Themes.HighContrast={}; +Blockly.Themes.HighContrast.defaultBlockStyles={colour_blocks:{colourPrimary:"#a52714",colourSecondary:"#FB9B8C",colourTertiary:"#FBE1DD"},list_blocks:{colourPrimary:"#4a148c",colourSecondary:"#AD7BE9",colourTertiary:"#CDB6E9"},logic_blocks:{colourPrimary:"#01579b",colourSecondary:"#64C7FF",colourTertiary:"#C5EAFF"},loop_blocks:{colourPrimary:"#33691e",colourSecondary:"#9AFF78",colourTertiary:"#E1FFD7"},math_blocks:{colourPrimary:"#1a237e",colourSecondary:"#8A9EFF",colourTertiary:"#DCE2FF"},procedure_blocks:{colourPrimary:"#006064", +colourSecondary:"#77E6EE",colourTertiary:"#CFECEE"},text_blocks:{colourPrimary:"#004d40",colourSecondary:"#5ae27c",colourTertiary:"#D2FFDD"},variable_blocks:{colourPrimary:"#880e4f",colourSecondary:"#FF73BE",colourTertiary:"#FFD4EB"},variable_dynamic_blocks:{colourPrimary:"#880e4f",colourSecondary:"#FF73BE",colourTertiary:"#FFD4EB"},hat_blocks:{colourPrimary:"#880e4f",colourSecondary:"#FF73BE",colourTertiary:"#FFD4EB",hat:"cap"}}; +Blockly.Themes.HighContrast.categoryStyles={colour_category:{colour:"#a52714"},list_category:{colour:"#4a148c"},logic_category:{colour:"#01579b"},loop_category:{colour:"#33691e"},math_category:{colour:"#1a237e"},procedure_category:{colour:"#006064"},text_category:{colour:"#004d40"},variable_category:{colour:"#880e4f"},variable_dynamic_category:{colour:"#880e4f"}};Blockly.Themes.HighContrast=new Blockly.Theme(Blockly.Themes.HighContrast.defaultBlockStyles,Blockly.Themes.HighContrast.categoryStyles);Blockly.Themes.Modern={}; +Blockly.Themes.Modern.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.Modern.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"}};Blockly.Themes.Modern=new Blockly.Theme(Blockly.Themes.Modern.defaultBlockStyles,Blockly.Themes.Modern.categoryStyles);Blockly.requires={}; \ No newline at end of file diff --git a/blockly_uncompressed.js b/blockly_uncompressed.js index e4a9b3a0c..07bb92a79 100644 --- a/blockly_uncompressed.js +++ b/blockly_uncompressed.js @@ -116,7 +116,7 @@ goog.addDependency("../../core/renderers/zelos/drawer.js", ['Blockly.zelos.Drawe goog.addDependency("../../core/renderers/zelos/info.js", ['Blockly.zelos', 'Blockly.zelos.RenderInfo'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.ExternalValueInput', 'Blockly.blockRendering.InlineInput', 'Blockly.blockRendering.InputRow', 'Blockly.blockRendering.Measurable', 'Blockly.blockRendering.NextConnection', 'Blockly.blockRendering.OutputConnection', 'Blockly.blockRendering.PreviousConnection', 'Blockly.blockRendering.RenderInfo', 'Blockly.blockRendering.RoundCorner', 'Blockly.blockRendering.Row', 'Blockly.blockRendering.SquareCorner', 'Blockly.blockRendering.SpacerRow', 'Blockly.blockRendering.StatementInput', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.Types', 'Blockly.utils.object', 'Blockly.zelos.AfterStatementSpacerRow', 'Blockly.zelos.BeforeStatementSpacerRow', 'Blockly.zelos.BottomRow', 'Blockly.zelos.TopRow']); goog.addDependency("../../core/renderers/zelos/measurables/rows.js", ['Blockly.zelos.BottomRow', 'Blockly.zelos.TopRow', 'Blockly.zelos.AfterStatementSpacerRow', 'Blockly.zelos.BeforeStatementSpacerRow'], ['Blockly.blockRendering.BottomRow', 'Blockly.blockRendering.TopRow', 'Blockly.blockRendering.SpacerRow', 'Blockly.utils.object']); goog.addDependency("../../core/renderers/zelos/renderer.js", ['Blockly.zelos.Renderer'], ['Blockly.blockRendering', 'Blockly.blockRendering.Renderer', 'Blockly.utils.object', 'Blockly.zelos.ConstantProvider', 'Blockly.zelos.Drawer', 'Blockly.zelos.RenderInfo']); -goog.addDependency("../../core/requires.js", ['Blockly.requires'], ['Blockly', 'Blockly.Comment', 'Blockly.HorizontalFlyout', 'Blockly.VerticalFlyout', 'Blockly.FlyoutButton', 'Blockly.Generator', 'Blockly.Toolbox', 'Blockly.Trashcan', 'Blockly.VariablesDynamic', 'Blockly.ZoomControls', 'Blockly.Mutator', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldLabelSerializable', 'Blockly.FieldImage', 'Blockly.FieldTextInput', 'Blockly.FieldMultilineInput', 'Blockly.FieldNumber', 'Blockly.FieldVariable', 'Blockly.geras.Renderer']); +goog.addDependency("../../core/requires.js", ['Blockly.requires'], ['Blockly', 'Blockly.Comment', 'Blockly.HorizontalFlyout', 'Blockly.VerticalFlyout', 'Blockly.FlyoutButton', 'Blockly.Generator', 'Blockly.Toolbox', 'Blockly.Trashcan', 'Blockly.VariablesDynamic', 'Blockly.ZoomControls', 'Blockly.Mutator', 'Blockly.FieldAngle', 'Blockly.FieldCheckbox', 'Blockly.FieldColour', 'Blockly.FieldDropdown', 'Blockly.FieldLabelSerializable', 'Blockly.FieldImage', 'Blockly.FieldTextInput', 'Blockly.FieldMultilineInput', 'Blockly.FieldNumber', 'Blockly.FieldVariable', 'Blockly.geras.Renderer', 'Blockly.Themes.Classic', 'Blockly.Themes.Dark', 'Blockly.Themes.HighContrast', 'Blockly.Themes.Modern']); goog.addDependency("../../core/scrollbar.js", ['Blockly.Scrollbar', 'Blockly.ScrollbarPair'], ['Blockly.Touch', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.dom']); goog.addDependency("../../core/theme.js", ['Blockly.Theme'], []); goog.addDependency("../../core/theme/classic.js", ['Blockly.Themes.Classic'], ['Blockly.Theme']); @@ -170,192 +170,7 @@ goog.addDependency("../../core/zoom_controls.js", ['Blockly.ZoomControls'], ['Bl goog.addDependency("base.js", [], []); // Load Blockly. -goog.require('Blockly'); -goog.require('Blockly.ASTNode'); -goog.require('Blockly.Action'); -goog.require('Blockly.Block'); -goog.require('Blockly.BlockDragSurfaceSvg'); -goog.require('Blockly.BlockDragger'); -goog.require('Blockly.BlockSvg'); -goog.require('Blockly.BlockSvg.render'); -goog.require('Blockly.Blocks'); -goog.require('Blockly.Bubble'); -goog.require('Blockly.BubbleDragger'); -goog.require('Blockly.Comment'); -goog.require('Blockly.Component'); -goog.require('Blockly.Component.Error'); -goog.require('Blockly.Connection'); -goog.require('Blockly.ConnectionDB'); -goog.require('Blockly.ContextMenu'); -goog.require('Blockly.Css'); -goog.require('Blockly.Cursor'); -goog.require('Blockly.CursorSvg'); -goog.require('Blockly.DropDownDiv'); -goog.require('Blockly.Events'); -goog.require('Blockly.Events.Abstract'); -goog.require('Blockly.Events.BlockBase'); -goog.require('Blockly.Events.BlockChange'); -goog.require('Blockly.Events.BlockCreate'); -goog.require('Blockly.Events.BlockDelete'); -goog.require('Blockly.Events.BlockMove'); -goog.require('Blockly.Events.Change'); -goog.require('Blockly.Events.CommentBase'); -goog.require('Blockly.Events.CommentChange'); -goog.require('Blockly.Events.CommentCreate'); -goog.require('Blockly.Events.CommentDelete'); -goog.require('Blockly.Events.CommentMove'); -goog.require('Blockly.Events.Create'); -goog.require('Blockly.Events.Delete'); -goog.require('Blockly.Events.FinishedLoading'); -goog.require('Blockly.Events.Move'); -goog.require('Blockly.Events.Ui'); -goog.require('Blockly.Events.VarBase'); -goog.require('Blockly.Events.VarCreate'); -goog.require('Blockly.Events.VarDelete'); -goog.require('Blockly.Events.VarRename'); -goog.require('Blockly.Extensions'); -goog.require('Blockly.Field'); -goog.require('Blockly.FieldAngle'); -goog.require('Blockly.FieldCheckbox'); -goog.require('Blockly.FieldColour'); -goog.require('Blockly.FieldDropdown'); -goog.require('Blockly.FieldImage'); -goog.require('Blockly.FieldLabel'); -goog.require('Blockly.FieldLabelSerializable'); -goog.require('Blockly.FieldMultilineInput'); -goog.require('Blockly.FieldNumber'); -goog.require('Blockly.FieldTextInput'); -goog.require('Blockly.FieldVariable'); -goog.require('Blockly.Flyout'); -goog.require('Blockly.FlyoutButton'); -goog.require('Blockly.FlyoutCursor'); -goog.require('Blockly.FlyoutDragger'); -goog.require('Blockly.Generator'); -goog.require('Blockly.Gesture'); -goog.require('Blockly.Grid'); -goog.require('Blockly.HorizontalFlyout'); -goog.require('Blockly.Icon'); -goog.require('Blockly.Input'); -goog.require('Blockly.InsertionMarkerManager'); -goog.require('Blockly.MarkerCursor'); -goog.require('Blockly.Menu'); -goog.require('Blockly.MenuItem'); -goog.require('Blockly.Msg'); -goog.require('Blockly.Mutator'); -goog.require('Blockly.Names'); -goog.require('Blockly.Options'); -goog.require('Blockly.Procedures'); -goog.require('Blockly.RenderedConnection'); -goog.require('Blockly.Scrollbar'); -goog.require('Blockly.ScrollbarPair'); -goog.require('Blockly.Theme'); -goog.require('Blockly.ThemeManager'); -goog.require('Blockly.Themes.Classic'); -goog.require('Blockly.Themes.Dark'); -goog.require('Blockly.Themes.HighContrast'); -goog.require('Blockly.Themes.Modern'); -goog.require('Blockly.Toolbox'); -goog.require('Blockly.Tooltip'); -goog.require('Blockly.Touch'); -goog.require('Blockly.TouchGesture'); -goog.require('Blockly.Trashcan'); -goog.require('Blockly.VariableMap'); -goog.require('Blockly.VariableModel'); -goog.require('Blockly.Variables'); -goog.require('Blockly.VariablesDynamic'); -goog.require('Blockly.VerticalFlyout'); -goog.require('Blockly.Warning'); -goog.require('Blockly.WidgetDiv'); -goog.require('Blockly.Workspace'); -goog.require('Blockly.WorkspaceAudio'); -goog.require('Blockly.WorkspaceComment'); -goog.require('Blockly.WorkspaceCommentSvg'); -goog.require('Blockly.WorkspaceCommentSvg.render'); -goog.require('Blockly.WorkspaceDragSurfaceSvg'); -goog.require('Blockly.WorkspaceDragger'); -goog.require('Blockly.WorkspaceSvg'); -goog.require('Blockly.Xml'); -goog.require('Blockly.ZoomControls'); -goog.require('Blockly.blockAnimations'); -goog.require('Blockly.blockRendering'); -goog.require('Blockly.blockRendering.BottomRow'); -goog.require('Blockly.blockRendering.Connection'); -goog.require('Blockly.blockRendering.ConstantProvider'); -goog.require('Blockly.blockRendering.Debug'); -goog.require('Blockly.blockRendering.Drawer'); -goog.require('Blockly.blockRendering.ExternalValueInput'); -goog.require('Blockly.blockRendering.Field'); -goog.require('Blockly.blockRendering.Hat'); -goog.require('Blockly.blockRendering.IPathObject'); -goog.require('Blockly.blockRendering.Icon'); -goog.require('Blockly.blockRendering.InRowSpacer'); -goog.require('Blockly.blockRendering.InlineInput'); -goog.require('Blockly.blockRendering.InputConnection'); -goog.require('Blockly.blockRendering.InputRow'); -goog.require('Blockly.blockRendering.JaggedEdge'); -goog.require('Blockly.blockRendering.Measurable'); -goog.require('Blockly.blockRendering.NextConnection'); -goog.require('Blockly.blockRendering.OutputConnection'); -goog.require('Blockly.blockRendering.PathObject'); -goog.require('Blockly.blockRendering.PreviousConnection'); -goog.require('Blockly.blockRendering.RenderInfo'); -goog.require('Blockly.blockRendering.Renderer'); -goog.require('Blockly.blockRendering.RoundCorner'); -goog.require('Blockly.blockRendering.Row'); -goog.require('Blockly.blockRendering.SpacerRow'); -goog.require('Blockly.blockRendering.SquareCorner'); -goog.require('Blockly.blockRendering.StatementInput'); -goog.require('Blockly.blockRendering.TopRow'); -goog.require('Blockly.blockRendering.Types'); -goog.require('Blockly.constants'); -goog.require('Blockly.fieldRegistry'); -goog.require('Blockly.geras'); -goog.require('Blockly.geras.ConstantProvider'); -goog.require('Blockly.geras.Drawer'); -goog.require('Blockly.geras.HighlightConstantProvider'); -goog.require('Blockly.geras.Highlighter'); -goog.require('Blockly.geras.InlineInput'); -goog.require('Blockly.geras.PathObject'); -goog.require('Blockly.geras.RenderInfo'); -goog.require('Blockly.geras.Renderer'); -goog.require('Blockly.geras.StatementInput'); -goog.require('Blockly.inject'); -goog.require('Blockly.navigation'); -goog.require('Blockly.requires'); -goog.require('Blockly.thrasos'); -goog.require('Blockly.thrasos.RenderInfo'); -goog.require('Blockly.thrasos.Renderer'); -goog.require('Blockly.tree.BaseNode'); -goog.require('Blockly.tree.TreeControl'); -goog.require('Blockly.tree.TreeNode'); -goog.require('Blockly.user.keyMap'); -goog.require('Blockly.utils'); -goog.require('Blockly.utils.Coordinate'); -goog.require('Blockly.utils.IdGenerator'); -goog.require('Blockly.utils.KeyCodes'); -goog.require('Blockly.utils.Rect'); -goog.require('Blockly.utils.Size'); -goog.require('Blockly.utils.aria'); -goog.require('Blockly.utils.colour'); -goog.require('Blockly.utils.dom'); -goog.require('Blockly.utils.global'); -goog.require('Blockly.utils.math'); -goog.require('Blockly.utils.object'); -goog.require('Blockly.utils.string'); -goog.require('Blockly.utils.style'); -goog.require('Blockly.utils.svgPaths'); -goog.require('Blockly.utils.uiMenu'); -goog.require('Blockly.utils.userAgent'); -goog.require('Blockly.utils.xml'); -goog.require('Blockly.zelos'); -goog.require('Blockly.zelos.AfterStatementSpacerRow'); -goog.require('Blockly.zelos.BeforeStatementSpacerRow'); -goog.require('Blockly.zelos.BottomRow'); -goog.require('Blockly.zelos.ConstantProvider'); -goog.require('Blockly.zelos.Drawer'); -goog.require('Blockly.zelos.RenderInfo'); -goog.require('Blockly.zelos.Renderer'); -goog.require('Blockly.zelos.TopRow'); +goog.require('Blockly.requires') delete root.BLOCKLY_DIR; delete root.BLOCKLY_BOOT; diff --git a/build.py b/build.py index 92ca4f1ed..bff0b5cb8 100755 --- a/build.py +++ b/build.py @@ -129,17 +129,9 @@ this.BLOCKLY_BOOT = function(root) { add_dependency = '\n'.join(add_dependency) f.write(add_dependency + '\n') - provides = [] - # Exclude field_date.js as it still has a dependency on the closure library - # see issue #2890. - for dep in calcdeps.BuildDependenciesFromFiles(self.search_paths): - if not dep.filename.startswith('closure') and not dep.filename.startswith('core/field_date.js'): - provides.extend(dep.provides) - provides.sort() # Deterministic build. f.write('\n') f.write('// Load Blockly.\n') - for provide in provides: - f.write("goog.require('%s');\n" % provide) + f.write('goog.require(\'Blockly.requires\')\n') f.write(""" delete root.BLOCKLY_DIR; diff --git a/gulpfile.js b/gulpfile.js index a69c353d9..f7614dc1f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -262,12 +262,6 @@ this.BLOCKLY_DIR = (function(root) { })(this); this.BLOCKLY_BOOT = function(root) { - var dir = ''; - if (root.IS_NODE_JS) { - dir = 'blockly'; - } else { - dir = this.BLOCKLY_DIR.match(/[^\\/]+$/)[0]; - } // Execute after Closure has loaded. `; const footer = ` @@ -284,7 +278,7 @@ if (this.IS_NODE_JS) { document.write(''); // Load fresh Closure Library. document.write(''); + '/closure/goog/base.js">'); document.write(''); } `; @@ -294,15 +288,7 @@ if (this.IS_NODE_JS) { --root_with_prefix="./core ../core" > ${file}`; execSync(cmd, { stdio: 'inherit' }); - let providesBuilder = `\n// Load Blockly.\n`; - const provides = new Set(); - const dependencies = fs.readFileSync(file, "utf8"); - const re = /\'(Blockly[^\']*)\'/gi; - let m; - while (m = re.exec(dependencies)) { - provides.add(`goog.require('${m[1]}');`); - } - providesBuilder += Array.from(provides).sort().join('\n') + '\n'; + const requires = `\n// Load Blockly.\ngoog.require('Blockly.requires');\n`; return gulp.src(file) // Remove comments so we're compatible with the build.py script @@ -312,8 +298,8 @@ if (this.IS_NODE_JS) { // Find the Blockly directory name and replace it with a JS variable. // This allows blockly_uncompressed.js to be compiled on one computer and be // used on another, even if the directory name differs. - .pipe(gulp.replace(/\.\.\/core/gm, `../../" + dir + "/core`)) - .pipe(gulp.insert.wrap(header, providesBuilder + footer)) + .pipe(gulp.replace(/\.\.\/core/gm, `../../core`)) + .pipe(gulp.insert.wrap(header, requires + footer)) .pipe(gulp.dest('./')); }); diff --git a/tests/playground.html b/tests/playground.html index 5e3a35a38..b1c4f5689 100644 --- a/tests/playground.html +++ b/tests/playground.html @@ -66,6 +66,12 @@ +