blockly 9.1.0-beta.0 → 9.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/blockly.min.js +12 -12
- package/blockly_compressed.js +12 -12
- package/blockly_compressed.js.map +1 -1
- package/core/mutator.d.ts +6 -2
- package/package.json +1 -1
package/blockly.min.js
CHANGED
|
@@ -550,20 +550,20 @@ null!=(w=a.parentWorkspace)?w:null;this.plugins=y}static parseMoveOptions_(a,b){
|
|
|
550
550
|
"object"===typeof d.scrollbars;d.drag=d.scrollbars?void 0===c.drag?!0:!!c.drag:!1;return d}static parseZoomOptions_(a){a=a.zoom||{};const 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;
|
|
551
551
|
return b}static parseGridOptions_(a){a=a.grid||{};const 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<b.spacing&&!!a.snap;return b}static parseThemeOptions_(a){a=a.theme||Classic$$module$build$src$core$theme$classic;return"string"===typeof a?getObject$$module$build$src$core$registry(Type$$module$build$src$core$registry.THEME,a):a instanceof Theme$$module$build$src$core$theme?a:Theme$$module$build$src$core$theme.defineTheme(a.name||
|
|
552
552
|
"builtin"+getNextUniqueId$$module$build$src$core$utils$idgenerator(),a)}},module$build$src$core$options={};module$build$src$core$options.Options=Options$$module$build$src$core$options;var module$build$src$core$mutator;
|
|
553
|
-
$.Mutator$$module$build$src$core$mutator=class extends Icon$$module$build$src$core$icon{constructor(a,b){b||warn$$module$build$src$core$utils$deprecation("Calling the Mutator constructor without passing the block it is attached to","version 9","version 10","the constructor by passing the list of subblocks and the block instance to attach the mutator to");super(null!=b?b:null);this.
|
|
554
|
-
this.svgDialog=null;this.quarkNames=a}setBlock(a){this.block_=a}getWorkspace(){return this.
|
|
553
|
+
$.Mutator$$module$build$src$core$mutator=class extends Icon$$module$build$src$core$icon{constructor(a,b){b||warn$$module$build$src$core$utils$deprecation("Calling the Mutator constructor without passing the block it is attached to","version 9","version 10","the constructor by passing the list of subblocks and the block instance to attach the mutator to");super(null!=b?b:null);this.workspace_=null;this.workspaceHeight=this.workspaceWidth=0;this.updateWorkspacePid=this.sourceListener=this.rootBlock=
|
|
554
|
+
this.svgDialog=null;this.quarkNames=a}setBlock(a){this.block_=a}getWorkspace(){return this.workspace_}drawIcon_(a){createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.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"},
|
|
555
555
|
a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)}iconClick_(a){this.getBlock().isEditable()&&super.iconClick_(a)}createEditor(){this.svgDialog=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.SVG,{x:Bubble$$module$build$src$core$bubble.BORDER_WIDTH,y:Bubble$$module$build$src$core$bubble.BORDER_WIDTH});if(this.quarkNames.length){var a=createElement$$module$build$src$core$utils$xml("xml");
|
|
556
556
|
for(let d=0,e;e=this.quarkNames[d];d++){var b=createElement$$module$build$src$core$utils$xml("block");b.setAttribute("type",e);a.appendChild(b)}}else a=null;var c=this.getBlock();b=new Options$$module$build$src$core$options({disable:!1,parentWorkspace:c.workspace,media:c.workspace.options.pathToMedia,rtl:c.RTL,horizontalLayout:!1,renderer:c.workspace.options.renderer,rendererOverrides:c.workspace.options.rendererOverrides});b.toolboxPosition=c.RTL?Position$$module$build$src$core$utils$toolbox.RIGHT:
|
|
557
|
-
Position$$module$build$src$core$utils$toolbox.LEFT;if(c=!!a)b.languageTree=convertToolboxDefToJson$$module$build$src$core$utils$toolbox(a);this.
|
|
558
|
-
return this.svgDialog}newWorkspaceSvg(a){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts");}updateEditable(){super.updateEditable();this.getBlock().isInFlyout||(this.getBlock().isEditable()?this.iconGroup_&&removeClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&addClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly")))}resizeBubble(){if(this.
|
|
559
|
-
2*Bubble$$module$build$src$core$bubble.BORDER_WIDTH,b=this.
|
|
560
|
-
this.svgDialog.setAttribute("height",`${e}`),this.
|
|
561
|
-
this.createEditor(),b.pathObject.svgPath,this.iconXY_,null,null);a=this.
|
|
562
|
-
c);if(b.saveConnections){const e=this.rootBlock;b.saveConnections(e);this.sourceListener=()=>{const f=this.getBlock();f.saveConnections&&f.saveConnections(e)};b.workspace.addChangeListener(this.sourceListener)}this.resizeBubble();a.addChangeListener(this.workspaceChanged.bind(this));this.updateWorkspace();this.applyColour()}else this.svgDialog=null,this.
|
|
563
|
-
0,this.sourceListener&&(b.workspace.removeChangeListener(this.sourceListener),this.sourceListener=null)}}workspaceChanged(a){this.shouldIgnoreMutatorEvent_(a)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout(()=>{this.updateWorkspacePid=null;this.updateWorkspace()},0))}shouldIgnoreMutatorEvent_(a){return a.isUiEvent||a.type===CREATE$$module$build$src$core$events$utils||a.type===CHANGE$$module$build$src$core$events$utils&&"disabled"===a.element}updateWorkspace(){if(!this.
|
|
564
|
-
this.
|
|
557
|
+
Position$$module$build$src$core$utils$toolbox.LEFT;if(c=!!a)b.languageTree=convertToolboxDefToJson$$module$build$src$core$utils$toolbox(a);this.workspace_=this.newWorkspaceSvg(b);this.workspace_.internalIsMutator=!0;this.workspace_.addChangeListener(disableOrphans$$module$build$src$core$events$utils);a=c?this.workspace_.addFlyout(Svg$$module$build$src$core$utils$svg.G):null;b=this.workspace_.createDom("blocklyMutatorBackground");a&&b.insertBefore(a,this.workspace_.svgBlockCanvas_);this.svgDialog.appendChild(b);
|
|
558
|
+
return this.svgDialog}newWorkspaceSvg(a){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts");}updateEditable(){super.updateEditable();this.getBlock().isInFlyout||(this.getBlock().isEditable()?this.iconGroup_&&removeClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&addClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly")))}resizeBubble(){if(this.workspace_){var a=
|
|
559
|
+
2*Bubble$$module$build$src$core$bubble.BORDER_WIDTH,b=this.workspace_.getCanvas(),c=b.getBBox(),d=c.width+c.x,e=c.height+3*a,f=this.workspace_.getFlyout();if(f){const g=f.getWorkspace().getMetricsManager().getScrollMetrics();e=Math.max(e,g.height+20);d+=f.getWidth()}(f=this.getBlock().RTL)&&(d=-c.x);d+=3*a;if(Math.abs(this.workspaceWidth-d)>a||Math.abs(this.workspaceHeight-e)>a)this.workspaceWidth=d,this.workspaceHeight=e,this.bubble_.setBubbleSize(d+a,e+a),this.svgDialog.setAttribute("width",`${d}`),
|
|
560
|
+
this.svgDialog.setAttribute("height",`${e}`),this.workspace_.setCachedParentSvgSize(d,e);f&&b.setAttribute("transform",`translate(${this.workspaceWidth}, 0)`);this.workspace_.resize()}}onBubbleMove(){this.workspace_&&this.workspace_.recordDragTargets()}setVisible(a){if(a!==this.isVisible()){var b=this.getBlock();fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(BUBBLE_OPEN$$module$build$src$core$events$utils))(b,a,"mutator"));if(a){this.bubble_=new Bubble$$module$build$src$core$bubble(b.workspace,
|
|
561
|
+
this.createEditor(),b.pathObject.svgPath,this.iconXY_,null,null);a=this.workspace_;this.bubble_.setSvgId(b.id);this.bubble_.registerMoveEvent(this.onBubbleMove.bind(this));var c=a.options.languageTree,d=a.getFlyout();c&&(d.init(a),d.show(c));this.rootBlock=b.decompose(a);c=this.rootBlock.getDescendants(!1);for(let e=0,f;f=c[e];e++)f.render();this.rootBlock.setMovable(!1);this.rootBlock.setDeletable(!1);d?(c=2*d.CORNER_RADIUS,d=this.rootBlock.RTL?d.getWidth()+c:c):d=c=16;b.RTL&&(d=-d);this.rootBlock.moveBy(d,
|
|
562
|
+
c);if(b.saveConnections){const e=this.rootBlock;b.saveConnections(e);this.sourceListener=()=>{const f=this.getBlock();f.saveConnections&&f.saveConnections(e)};b.workspace.addChangeListener(this.sourceListener)}this.resizeBubble();a.addChangeListener(this.workspaceChanged.bind(this));this.updateWorkspace();this.applyColour()}else this.svgDialog=null,this.workspace_.dispose(),this.rootBlock=this.workspace_=null,null==(d=this.bubble_)||d.dispose(),this.bubble_=null,this.workspaceHeight=this.workspaceWidth=
|
|
563
|
+
0,this.sourceListener&&(b.workspace.removeChangeListener(this.sourceListener),this.sourceListener=null)}}workspaceChanged(a){this.shouldIgnoreMutatorEvent_(a)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout(()=>{this.updateWorkspacePid=null;this.updateWorkspace()},0))}shouldIgnoreMutatorEvent_(a){return a.isUiEvent||a.type===CREATE$$module$build$src$core$events$utils||a.type===CHANGE$$module$build$src$core$events$utils&&"disabled"===a.element}updateWorkspace(){if(!this.workspace_.isDragging()){var a=
|
|
564
|
+
this.workspace_.getTopBlocks(!1);for(let d=0,e;e=a[d];d++){var b=e.getRelativeToSurfaceXY();20>b.y&&e.moveBy(0,20-b.y);if(e.RTL){var c=-20;const f=this.workspace_.getFlyout();f&&(c-=f.getWidth());b.x>c&&e.moveBy(c-b.x,0)}else 20>b.x&&e.moveBy(20-b.x,0)}}if(this.rootBlock&&this.rootBlock.workspace===this.workspace_){(a=getGroup$$module$build$src$core$events$utils())||setGroup$$module$build$src$core$events$utils(!0);const d=this.getBlock();b=BlockChange$$module$build$src$core$events$events_block_change.getExtraBlockState_(d);
|
|
565
565
|
c=d.rendered;d.rendered=!1;d.compose(this.rootBlock);d.rendered=c;d.initSvg();d.rendered&&d.render();c=BlockChange$$module$build$src$core$events$events_block_change.getExtraBlockState_(d);if(b!==c){fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(d,"mutation",null,b,c));const e=getGroup$$module$build$src$core$events$utils();setTimeout(function(){const f=getGroup$$module$build$src$core$events$utils();setGroup$$module$build$src$core$events$utils(e);
|
|
566
|
-
d.bumpNeighbours();setGroup$$module$build$src$core$events$utils(f)},$.config$$module$build$src$core$config.bumpDelay)}this.
|
|
566
|
+
d.bumpNeighbours();setGroup$$module$build$src$core$events$utils(f)},$.config$$module$build$src$core$config.bumpDelay)}this.workspace_.isDragging()||setTimeout(()=>this.resizeBubble(),0);setGroup$$module$build$src$core$events$utils(a)}}dispose(){this.getBlock().mutator=null;super.dispose()}updateBlockStyle(){var a=this.workspace_;if(a&&a.getAllBlocks(!1)){const b=a.getAllBlocks(!1);for(let c=0,d;d=b[c];c++)d.setStyle(d.getStyleName());if(a=a.getFlyout()){a=a.getWorkspace().getAllBlocks(!1);for(let c=
|
|
567
567
|
0,d;d=a[c];c++)d.setStyle(d.getStyleName())}}}static reconnect(a,b,c){if(!a||!a.getSourceBlock().workspace)return!1;c=b.getInput(c).connection;const d=a.targetBlock();return d&&d!==b||!c||c.targetConnection===a?!1:(c.isConnected()&&c.disconnect(),c.connect(a),!0)}static findParentWs(a){let b=null;if(a&&a.options){const c=a.options.parentWorkspace;a.isFlyout?c&&c.options&&(b=c.options.parentWorkspace):c&&(b=c)}return b}};module$build$src$core$mutator={};module$build$src$core$mutator.Mutator=$.Mutator$$module$build$src$core$mutator;var allExtensions$$module$build$src$core$extensions=Object.create(null),TEST_ONLY$$module$build$src$core$extensions={allExtensions:allExtensions$$module$build$src$core$extensions};register$$module$build$src$core$extensions("parent_tooltip_when_inline",extensionParentTooltip$$module$build$src$core$extensions);$.module$build$src$core$extensions={};$.module$build$src$core$extensions.TEST_ONLY=TEST_ONLY$$module$build$src$core$extensions;$.module$build$src$core$extensions.apply=apply$$module$build$src$core$extensions;
|
|
568
568
|
$.module$build$src$core$extensions.buildTooltipForDropdown=buildTooltipForDropdown$$module$build$src$core$extensions;$.module$build$src$core$extensions.buildTooltipWithFieldText=buildTooltipWithFieldText$$module$build$src$core$extensions;$.module$build$src$core$extensions.isRegistered=isRegistered$$module$build$src$core$extensions;$.module$build$src$core$extensions.register=register$$module$build$src$core$extensions;$.module$build$src$core$extensions.registerMixin=registerMixin$$module$build$src$core$extensions;
|
|
569
569
|
$.module$build$src$core$extensions.registerMutator=registerMutator$$module$build$src$core$extensions;$.module$build$src$core$extensions.runAfterPageLoad=runAfterPageLoad$$module$build$src$core$extensions;$.module$build$src$core$extensions.unregister=unregister$$module$build$src$core$extensions;var module$build$src$core$utils$array={};module$build$src$core$utils$array.removeElem=removeElem$$module$build$src$core$utils$array;var module$build$src$core$utils$svg_paths={};module$build$src$core$utils$svg_paths.arc=arc$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.curve=curve$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.line=line$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.lineOnAxis=lineOnAxis$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.lineTo=lineTo$$module$build$src$core$utils$svg_paths;
|
|
@@ -1491,7 +1491,7 @@ this.pixelsToWorkspaceUnits_(a);const b=Coordinate$$module$build$src$core$utils$
|
|
|
1491
1491
|
this.draggingBlock_.render();this.draggingBlock_.scheduleSnapAndBump()}fireDragEndEvent_(){const a=new (get$$module$build$src$core$events$utils(BLOCK_DRAG$$module$build$src$core$events$utils))(this.draggingBlock_,!1,this.draggingBlock_.getDescendants(!1));fire$$module$build$src$core$events$utils(a)}updateToolboxStyle_(a){const b=this.workspace_.getToolbox();if(b){const c=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";a&&"function"===typeof b.removeStyle?b.removeStyle(c):
|
|
1492
1492
|
a||"function"!==typeof b.addStyle||b.addStyle(c)}}fireMoveEvent_(){const a=new (get$$module$build$src$core$events$utils(MOVE$$module$build$src$core$events$utils))(this.draggingBlock_);a.oldCoordinate=this.startXY_;a.recordNew();fire$$module$build$src$core$events$utils(a)}updateCursorDuringBlockDrag_(){this.draggingBlock_.setDeleteStyle(this.wouldDeleteBlock_)}pixelsToWorkspaceUnits_(a){a=new Coordinate$$module$build$src$core$utils$coordinate(a.x/this.workspace_.scale,a.y/this.workspace_.scale);this.workspace_.isMutator&&
|
|
1493
1493
|
a.scale(1/this.workspace_.options.parentWorkspace.scale);return a}dragIcons_(a){for(let b=0;b<this.dragIconData_.length;b++){const c=this.dragIconData_[b];c.icon.setIconLocation(Coordinate$$module$build$src$core$utils$coordinate.sum(c.location,a))}}getInsertionMarkers(){return this.draggedConnectionManager_&&this.draggedConnectionManager_.getInsertionMarkers?this.draggedConnectionManager_.getInsertionMarkers():[]}};
|
|
1494
|
-
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.BLOCK_DRAGGER,DEFAULT$$module$build$src$core$registry,BlockDragger$$module$build$src$core$block_dragger);var module$build$src$core$block_dragger={};module$build$src$core$block_dragger.BlockDragger=BlockDragger$$module$build$src$core$block_dragger;var VERSION$$module$build$src$core$blockly="9.1.
|
|
1494
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.BLOCK_DRAGGER,DEFAULT$$module$build$src$core$registry,BlockDragger$$module$build$src$core$block_dragger);var module$build$src$core$block_dragger={};module$build$src$core$block_dragger.BlockDragger=BlockDragger$$module$build$src$core$block_dragger;var VERSION$$module$build$src$core$blockly="9.1.1",ALIGN_LEFT$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.LEFT,ALIGN_CENTRE$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.CENTRE,ALIGN_RIGHT$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.RIGHT,INPUT_VALUE$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE,OUTPUT_VALUE$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE,
|
|
1495
1495
|
NEXT_STATEMENT$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT,PREVIOUS_STATEMENT$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT,DUMMY_INPUT$$module$build$src$core$blockly=inputTypes$$module$build$src$core$input_types.DUMMY,TOOLBOX_AT_TOP$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.TOP,TOOLBOX_AT_BOTTOM$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.BOTTOM,
|
|
1496
1496
|
TOOLBOX_AT_LEFT$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.LEFT,TOOLBOX_AT_RIGHT$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.RIGHT,svgResize$$module$build$src$core$blockly=svgResize$$module$build$src$core$common,getMainWorkspace$$module$build$src$core$blockly=getMainWorkspace$$module$build$src$core$common,getSelected$$module$build$src$core$blockly=getSelected$$module$build$src$core$common,defineBlocksWithJsonArray$$module$build$src$core$blockly=
|
|
1497
1497
|
defineBlocksWithJsonArray$$module$build$src$core$common,setParentContainer$$module$build$src$core$blockly=setParentContainer$$module$build$src$core$common,resizeSvgContents$$module$build$src$core$blockly=resizeSvgContentsLocal$$module$build$src$core$blockly,COLLAPSE_CHARS$$module$build$src$core$blockly=COLLAPSE_CHARS$$module$build$src$core$internal_constants,DRAG_STACK$$module$build$src$core$blockly=DRAG_STACK$$module$build$src$core$internal_constants,OPPOSITE_TYPE$$module$build$src$core$blockly=
|
package/blockly_compressed.js
CHANGED
|
@@ -550,20 +550,20 @@ null!=(w=a.parentWorkspace)?w:null;this.plugins=y}static parseMoveOptions_(a,b){
|
|
|
550
550
|
"object"===typeof d.scrollbars;d.drag=d.scrollbars?void 0===c.drag?!0:!!c.drag:!1;return d}static parseZoomOptions_(a){a=a.zoom||{};const 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;
|
|
551
551
|
return b}static parseGridOptions_(a){a=a.grid||{};const 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<b.spacing&&!!a.snap;return b}static parseThemeOptions_(a){a=a.theme||Classic$$module$build$src$core$theme$classic;return"string"===typeof a?getObject$$module$build$src$core$registry(Type$$module$build$src$core$registry.THEME,a):a instanceof Theme$$module$build$src$core$theme?a:Theme$$module$build$src$core$theme.defineTheme(a.name||
|
|
552
552
|
"builtin"+getNextUniqueId$$module$build$src$core$utils$idgenerator(),a)}},module$build$src$core$options={};module$build$src$core$options.Options=Options$$module$build$src$core$options;var module$build$src$core$mutator;
|
|
553
|
-
$.Mutator$$module$build$src$core$mutator=class extends Icon$$module$build$src$core$icon{constructor(a,b){b||warn$$module$build$src$core$utils$deprecation("Calling the Mutator constructor without passing the block it is attached to","version 9","version 10","the constructor by passing the list of subblocks and the block instance to attach the mutator to");super(null!=b?b:null);this.
|
|
554
|
-
this.svgDialog=null;this.quarkNames=a}setBlock(a){this.block_=a}getWorkspace(){return this.
|
|
553
|
+
$.Mutator$$module$build$src$core$mutator=class extends Icon$$module$build$src$core$icon{constructor(a,b){b||warn$$module$build$src$core$utils$deprecation("Calling the Mutator constructor without passing the block it is attached to","version 9","version 10","the constructor by passing the list of subblocks and the block instance to attach the mutator to");super(null!=b?b:null);this.workspace_=null;this.workspaceHeight=this.workspaceWidth=0;this.updateWorkspacePid=this.sourceListener=this.rootBlock=
|
|
554
|
+
this.svgDialog=null;this.quarkNames=a}setBlock(a){this.block_=a}getWorkspace(){return this.workspace_}drawIcon_(a){createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.RECT,{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.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"},
|
|
555
555
|
a);createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.CIRCLE,{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)}iconClick_(a){this.getBlock().isEditable()&&super.iconClick_(a)}createEditor(){this.svgDialog=createSvgElement$$module$build$src$core$utils$dom(Svg$$module$build$src$core$utils$svg.SVG,{x:Bubble$$module$build$src$core$bubble.BORDER_WIDTH,y:Bubble$$module$build$src$core$bubble.BORDER_WIDTH});if(this.quarkNames.length){var a=createElement$$module$build$src$core$utils$xml("xml");
|
|
556
556
|
for(let d=0,e;e=this.quarkNames[d];d++){var b=createElement$$module$build$src$core$utils$xml("block");b.setAttribute("type",e);a.appendChild(b)}}else a=null;var c=this.getBlock();b=new Options$$module$build$src$core$options({disable:!1,parentWorkspace:c.workspace,media:c.workspace.options.pathToMedia,rtl:c.RTL,horizontalLayout:!1,renderer:c.workspace.options.renderer,rendererOverrides:c.workspace.options.rendererOverrides});b.toolboxPosition=c.RTL?Position$$module$build$src$core$utils$toolbox.RIGHT:
|
|
557
|
-
Position$$module$build$src$core$utils$toolbox.LEFT;if(c=!!a)b.languageTree=convertToolboxDefToJson$$module$build$src$core$utils$toolbox(a);this.
|
|
558
|
-
return this.svgDialog}newWorkspaceSvg(a){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts");}updateEditable(){super.updateEditable();this.getBlock().isInFlyout||(this.getBlock().isEditable()?this.iconGroup_&&removeClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&addClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly")))}resizeBubble(){if(this.
|
|
559
|
-
2*Bubble$$module$build$src$core$bubble.BORDER_WIDTH,b=this.
|
|
560
|
-
this.svgDialog.setAttribute("height",`${e}`),this.
|
|
561
|
-
this.createEditor(),b.pathObject.svgPath,this.iconXY_,null,null);a=this.
|
|
562
|
-
c);if(b.saveConnections){const e=this.rootBlock;b.saveConnections(e);this.sourceListener=()=>{const f=this.getBlock();f.saveConnections&&f.saveConnections(e)};b.workspace.addChangeListener(this.sourceListener)}this.resizeBubble();a.addChangeListener(this.workspaceChanged.bind(this));this.updateWorkspace();this.applyColour()}else this.svgDialog=null,this.
|
|
563
|
-
0,this.sourceListener&&(b.workspace.removeChangeListener(this.sourceListener),this.sourceListener=null)}}workspaceChanged(a){this.shouldIgnoreMutatorEvent_(a)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout(()=>{this.updateWorkspacePid=null;this.updateWorkspace()},0))}shouldIgnoreMutatorEvent_(a){return a.isUiEvent||a.type===CREATE$$module$build$src$core$events$utils||a.type===CHANGE$$module$build$src$core$events$utils&&"disabled"===a.element}updateWorkspace(){if(!this.
|
|
564
|
-
this.
|
|
557
|
+
Position$$module$build$src$core$utils$toolbox.LEFT;if(c=!!a)b.languageTree=convertToolboxDefToJson$$module$build$src$core$utils$toolbox(a);this.workspace_=this.newWorkspaceSvg(b);this.workspace_.internalIsMutator=!0;this.workspace_.addChangeListener(disableOrphans$$module$build$src$core$events$utils);a=c?this.workspace_.addFlyout(Svg$$module$build$src$core$utils$svg.G):null;b=this.workspace_.createDom("blocklyMutatorBackground");a&&b.insertBefore(a,this.workspace_.svgBlockCanvas_);this.svgDialog.appendChild(b);
|
|
558
|
+
return this.svgDialog}newWorkspaceSvg(a){throw Error("The implementation of newWorkspaceSvg should be monkey-patched in by blockly.ts");}updateEditable(){super.updateEditable();this.getBlock().isInFlyout||(this.getBlock().isEditable()?this.iconGroup_&&removeClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly"):(this.setVisible(!1),this.iconGroup_&&addClass$$module$build$src$core$utils$dom(this.iconGroup_,"blocklyIconGroupReadonly")))}resizeBubble(){if(this.workspace_){var a=
|
|
559
|
+
2*Bubble$$module$build$src$core$bubble.BORDER_WIDTH,b=this.workspace_.getCanvas(),c=b.getBBox(),d=c.width+c.x,e=c.height+3*a,f=this.workspace_.getFlyout();if(f){const g=f.getWorkspace().getMetricsManager().getScrollMetrics();e=Math.max(e,g.height+20);d+=f.getWidth()}(f=this.getBlock().RTL)&&(d=-c.x);d+=3*a;if(Math.abs(this.workspaceWidth-d)>a||Math.abs(this.workspaceHeight-e)>a)this.workspaceWidth=d,this.workspaceHeight=e,this.bubble_.setBubbleSize(d+a,e+a),this.svgDialog.setAttribute("width",`${d}`),
|
|
560
|
+
this.svgDialog.setAttribute("height",`${e}`),this.workspace_.setCachedParentSvgSize(d,e);f&&b.setAttribute("transform",`translate(${this.workspaceWidth}, 0)`);this.workspace_.resize()}}onBubbleMove(){this.workspace_&&this.workspace_.recordDragTargets()}setVisible(a){if(a!==this.isVisible()){var b=this.getBlock();fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(BUBBLE_OPEN$$module$build$src$core$events$utils))(b,a,"mutator"));if(a){this.bubble_=new Bubble$$module$build$src$core$bubble(b.workspace,
|
|
561
|
+
this.createEditor(),b.pathObject.svgPath,this.iconXY_,null,null);a=this.workspace_;this.bubble_.setSvgId(b.id);this.bubble_.registerMoveEvent(this.onBubbleMove.bind(this));var c=a.options.languageTree,d=a.getFlyout();c&&(d.init(a),d.show(c));this.rootBlock=b.decompose(a);c=this.rootBlock.getDescendants(!1);for(let e=0,f;f=c[e];e++)f.render();this.rootBlock.setMovable(!1);this.rootBlock.setDeletable(!1);d?(c=2*d.CORNER_RADIUS,d=this.rootBlock.RTL?d.getWidth()+c:c):d=c=16;b.RTL&&(d=-d);this.rootBlock.moveBy(d,
|
|
562
|
+
c);if(b.saveConnections){const e=this.rootBlock;b.saveConnections(e);this.sourceListener=()=>{const f=this.getBlock();f.saveConnections&&f.saveConnections(e)};b.workspace.addChangeListener(this.sourceListener)}this.resizeBubble();a.addChangeListener(this.workspaceChanged.bind(this));this.updateWorkspace();this.applyColour()}else this.svgDialog=null,this.workspace_.dispose(),this.rootBlock=this.workspace_=null,null==(d=this.bubble_)||d.dispose(),this.bubble_=null,this.workspaceHeight=this.workspaceWidth=
|
|
563
|
+
0,this.sourceListener&&(b.workspace.removeChangeListener(this.sourceListener),this.sourceListener=null)}}workspaceChanged(a){this.shouldIgnoreMutatorEvent_(a)||this.updateWorkspacePid||(this.updateWorkspacePid=setTimeout(()=>{this.updateWorkspacePid=null;this.updateWorkspace()},0))}shouldIgnoreMutatorEvent_(a){return a.isUiEvent||a.type===CREATE$$module$build$src$core$events$utils||a.type===CHANGE$$module$build$src$core$events$utils&&"disabled"===a.element}updateWorkspace(){if(!this.workspace_.isDragging()){var a=
|
|
564
|
+
this.workspace_.getTopBlocks(!1);for(let d=0,e;e=a[d];d++){var b=e.getRelativeToSurfaceXY();20>b.y&&e.moveBy(0,20-b.y);if(e.RTL){var c=-20;const f=this.workspace_.getFlyout();f&&(c-=f.getWidth());b.x>c&&e.moveBy(c-b.x,0)}else 20>b.x&&e.moveBy(20-b.x,0)}}if(this.rootBlock&&this.rootBlock.workspace===this.workspace_){(a=getGroup$$module$build$src$core$events$utils())||setGroup$$module$build$src$core$events$utils(!0);const d=this.getBlock();b=BlockChange$$module$build$src$core$events$events_block_change.getExtraBlockState_(d);
|
|
565
565
|
c=d.rendered;d.rendered=!1;d.compose(this.rootBlock);d.rendered=c;d.initSvg();d.rendered&&d.render();c=BlockChange$$module$build$src$core$events$events_block_change.getExtraBlockState_(d);if(b!==c){fire$$module$build$src$core$events$utils(new (get$$module$build$src$core$events$utils(CHANGE$$module$build$src$core$events$utils))(d,"mutation",null,b,c));const e=getGroup$$module$build$src$core$events$utils();setTimeout(function(){const f=getGroup$$module$build$src$core$events$utils();setGroup$$module$build$src$core$events$utils(e);
|
|
566
|
-
d.bumpNeighbours();setGroup$$module$build$src$core$events$utils(f)},$.config$$module$build$src$core$config.bumpDelay)}this.
|
|
566
|
+
d.bumpNeighbours();setGroup$$module$build$src$core$events$utils(f)},$.config$$module$build$src$core$config.bumpDelay)}this.workspace_.isDragging()||setTimeout(()=>this.resizeBubble(),0);setGroup$$module$build$src$core$events$utils(a)}}dispose(){this.getBlock().mutator=null;super.dispose()}updateBlockStyle(){var a=this.workspace_;if(a&&a.getAllBlocks(!1)){const b=a.getAllBlocks(!1);for(let c=0,d;d=b[c];c++)d.setStyle(d.getStyleName());if(a=a.getFlyout()){a=a.getWorkspace().getAllBlocks(!1);for(let c=
|
|
567
567
|
0,d;d=a[c];c++)d.setStyle(d.getStyleName())}}}static reconnect(a,b,c){if(!a||!a.getSourceBlock().workspace)return!1;c=b.getInput(c).connection;const d=a.targetBlock();return d&&d!==b||!c||c.targetConnection===a?!1:(c.isConnected()&&c.disconnect(),c.connect(a),!0)}static findParentWs(a){let b=null;if(a&&a.options){const c=a.options.parentWorkspace;a.isFlyout?c&&c.options&&(b=c.options.parentWorkspace):c&&(b=c)}return b}};module$build$src$core$mutator={};module$build$src$core$mutator.Mutator=$.Mutator$$module$build$src$core$mutator;var allExtensions$$module$build$src$core$extensions=Object.create(null),TEST_ONLY$$module$build$src$core$extensions={allExtensions:allExtensions$$module$build$src$core$extensions};register$$module$build$src$core$extensions("parent_tooltip_when_inline",extensionParentTooltip$$module$build$src$core$extensions);$.module$build$src$core$extensions={};$.module$build$src$core$extensions.TEST_ONLY=TEST_ONLY$$module$build$src$core$extensions;$.module$build$src$core$extensions.apply=apply$$module$build$src$core$extensions;
|
|
568
568
|
$.module$build$src$core$extensions.buildTooltipForDropdown=buildTooltipForDropdown$$module$build$src$core$extensions;$.module$build$src$core$extensions.buildTooltipWithFieldText=buildTooltipWithFieldText$$module$build$src$core$extensions;$.module$build$src$core$extensions.isRegistered=isRegistered$$module$build$src$core$extensions;$.module$build$src$core$extensions.register=register$$module$build$src$core$extensions;$.module$build$src$core$extensions.registerMixin=registerMixin$$module$build$src$core$extensions;
|
|
569
569
|
$.module$build$src$core$extensions.registerMutator=registerMutator$$module$build$src$core$extensions;$.module$build$src$core$extensions.runAfterPageLoad=runAfterPageLoad$$module$build$src$core$extensions;$.module$build$src$core$extensions.unregister=unregister$$module$build$src$core$extensions;var module$build$src$core$utils$array={};module$build$src$core$utils$array.removeElem=removeElem$$module$build$src$core$utils$array;var module$build$src$core$utils$svg_paths={};module$build$src$core$utils$svg_paths.arc=arc$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.curve=curve$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.line=line$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.lineOnAxis=lineOnAxis$$module$build$src$core$utils$svg_paths;module$build$src$core$utils$svg_paths.lineTo=lineTo$$module$build$src$core$utils$svg_paths;
|
|
@@ -1491,7 +1491,7 @@ this.pixelsToWorkspaceUnits_(a);const b=Coordinate$$module$build$src$core$utils$
|
|
|
1491
1491
|
this.draggingBlock_.render();this.draggingBlock_.scheduleSnapAndBump()}fireDragEndEvent_(){const a=new (get$$module$build$src$core$events$utils(BLOCK_DRAG$$module$build$src$core$events$utils))(this.draggingBlock_,!1,this.draggingBlock_.getDescendants(!1));fire$$module$build$src$core$events$utils(a)}updateToolboxStyle_(a){const b=this.workspace_.getToolbox();if(b){const c=this.draggingBlock_.isDeletable()?"blocklyToolboxDelete":"blocklyToolboxGrab";a&&"function"===typeof b.removeStyle?b.removeStyle(c):
|
|
1492
1492
|
a||"function"!==typeof b.addStyle||b.addStyle(c)}}fireMoveEvent_(){const a=new (get$$module$build$src$core$events$utils(MOVE$$module$build$src$core$events$utils))(this.draggingBlock_);a.oldCoordinate=this.startXY_;a.recordNew();fire$$module$build$src$core$events$utils(a)}updateCursorDuringBlockDrag_(){this.draggingBlock_.setDeleteStyle(this.wouldDeleteBlock_)}pixelsToWorkspaceUnits_(a){a=new Coordinate$$module$build$src$core$utils$coordinate(a.x/this.workspace_.scale,a.y/this.workspace_.scale);this.workspace_.isMutator&&
|
|
1493
1493
|
a.scale(1/this.workspace_.options.parentWorkspace.scale);return a}dragIcons_(a){for(let b=0;b<this.dragIconData_.length;b++){const c=this.dragIconData_[b];c.icon.setIconLocation(Coordinate$$module$build$src$core$utils$coordinate.sum(c.location,a))}}getInsertionMarkers(){return this.draggedConnectionManager_&&this.draggedConnectionManager_.getInsertionMarkers?this.draggedConnectionManager_.getInsertionMarkers():[]}};
|
|
1494
|
-
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.BLOCK_DRAGGER,DEFAULT$$module$build$src$core$registry,BlockDragger$$module$build$src$core$block_dragger);var module$build$src$core$block_dragger={};module$build$src$core$block_dragger.BlockDragger=BlockDragger$$module$build$src$core$block_dragger;var VERSION$$module$build$src$core$blockly="9.1.
|
|
1494
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.BLOCK_DRAGGER,DEFAULT$$module$build$src$core$registry,BlockDragger$$module$build$src$core$block_dragger);var module$build$src$core$block_dragger={};module$build$src$core$block_dragger.BlockDragger=BlockDragger$$module$build$src$core$block_dragger;var VERSION$$module$build$src$core$blockly="9.1.1",ALIGN_LEFT$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.LEFT,ALIGN_CENTRE$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.CENTRE,ALIGN_RIGHT$$module$build$src$core$blockly=$.Align$$module$build$src$core$input.RIGHT,INPUT_VALUE$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.INPUT_VALUE,OUTPUT_VALUE$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE,
|
|
1495
1495
|
NEXT_STATEMENT$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.NEXT_STATEMENT,PREVIOUS_STATEMENT$$module$build$src$core$blockly=ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT,DUMMY_INPUT$$module$build$src$core$blockly=inputTypes$$module$build$src$core$input_types.DUMMY,TOOLBOX_AT_TOP$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.TOP,TOOLBOX_AT_BOTTOM$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.BOTTOM,
|
|
1496
1496
|
TOOLBOX_AT_LEFT$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.LEFT,TOOLBOX_AT_RIGHT$$module$build$src$core$blockly=Position$$module$build$src$core$utils$toolbox.RIGHT,svgResize$$module$build$src$core$blockly=svgResize$$module$build$src$core$common,getMainWorkspace$$module$build$src$core$blockly=getMainWorkspace$$module$build$src$core$common,getSelected$$module$build$src$core$blockly=getSelected$$module$build$src$core$common,defineBlocksWithJsonArray$$module$build$src$core$blockly=
|
|
1497
1497
|
defineBlocksWithJsonArray$$module$build$src$core$common,setParentContainer$$module$build$src$core$blockly=setParentContainer$$module$build$src$core$common,resizeSvgContents$$module$build$src$core$blockly=resizeSvgContentsLocal$$module$build$src$core$blockly,COLLAPSE_CHARS$$module$build$src$core$blockly=COLLAPSE_CHARS$$module$build$src$core$internal_constants,DRAG_STACK$$module$build$src$core$blockly=DRAG_STACK$$module$build$src$core$internal_constants,OPPOSITE_TYPE$$module$build$src$core$blockly=
|