blockly 10.4.1 → 10.4.2
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 +11 -11
- package/blockly_compressed.js +11 -11
- package/blockly_compressed.js.map +1 -1
- package/core/block_dragger.d.ts +15 -0
- package/package.json +2 -2
package/blockly.min.js
CHANGED
|
@@ -1257,16 +1257,16 @@ this.startXY_)}dispose(){this.dragIconData_.length=0;this.connectionPreviewer.di
|
|
|
1257
1257
|
let c;null==(c=this.workspace_.getLayerManager())||c.moveToDragLayer(this.draggingBlock_)}shouldDisconnect_(a){return!!(this.draggingBlock_.getParent()||a&&this.draggingBlock_.nextConnection&&this.draggingBlock_.nextConnection.targetBlock())}disconnectBlock_(a,b){this.draggingBlock_.unplug(a);a=this.pixelsToWorkspaceUnits_(b);a=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startXY_,a);this.draggingBlock_.translate(a.x,a.y);disconnectUiEffect$$module$build$src$core$block_animations(this.draggingBlock_)}fireDragStartEvent_(){const a=
|
|
1258
1258
|
new (get$$module$build$src$core$events$utils(BLOCK_DRAG$$module$build$src$core$events$utils))(this.draggingBlock_,!0,this.draggingBlock_.getDescendants(!1));fire$$module$build$src$core$events$utils(a)}drag(a,b){const c=this.draggingBlock_;this.moveBlock(c,b);this.updateDragTargets(a,c);this.wouldDeleteBlock_=this.wouldDeleteBlock(a,c,b);this.updateCursorDuringBlockDrag_();this.updateConnectionPreview(c,b)}moveBlock(a,b){b=this.pixelsToWorkspaceUnits_(b);b=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startXY_,
|
|
1259
1259
|
b);a.moveDuringDrag(b)}updateDragTargets(a,b){a=this.workspace_.getDragTarget(a);if(this.dragTarget_!==a){let c;null==(c=this.dragTarget_)||c.onDragExit(b);null==a||a.onDragEnter(b)}null==a||a.onDragOver(b);this.dragTarget_=a}wouldDeleteBlock(a,b,c){return(a=this.workspace_.getDragTarget(a))&&this.workspace_.getComponentManager().hasCapability(a.id,ComponentManager$$module$build$src$core$component_manager.Capability.DELETE_AREA)?a.wouldDelete(b,!!this.getConnectionCandidate(b,c)):!1}updateConnectionPreview(a,
|
|
1260
|
-
b){const c=this.connectionCandidate,d=this.getConnectionCandidate(a,b);if(d){this.connectionCandidate=b=c&&this.currCandidateIsBetter(c,b,d)?c:d;var {local:e,neighbour:f}=b;e.type!==ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE&&e.type!==ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT||!f.isConnected()||f.targetBlock().isInsertionMarker()||this.orphanCanConnectAtEnd(a,f.targetBlock(),e.type)?this.connectionPreviewer.previewConnection(e,
|
|
1261
|
-
f,f.targetBlock())}else this.connectionPreviewer.hidePreview(),this.connectionCandidate=null}orphanCanConnectAtEnd(a,b,c){return!!Connection$$module$build$src$core$connection.getConnectionForOrphanedConnection(a,c===ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE?b.outputConnection:b.previousConnection)}currCandidateIsBetter(a,b,c){const {local:d,neighbour:e}=a;a=new Coordinate$$module$build$src$core$utils$coordinate(d.x,d.y);const f=
|
|
1262
|
-
e.y);b=Coordinate$$module$build$src$core$utils$coordinate.distance(Coordinate$$module$build$src$core$utils$coordinate.sum(a,b),f);return c.distance>b-$.config$$module$build$src$core$config.currentConnectionPreference}getConnectionCandidate(a,b){a=this.getLocalConnections(a);let c
|
|
1263
|
-
c=a.lastConnectionInStack(!0);c&&c!==a.nextConnection&&b.push(c);return b}endDrag(a,b){this.drag(a,b);this.fireDragEndEvent_();stopTextWidthCache$$module$build$src$core$utils$dom();disconnectUiStop$$module$build$src$core$block_animations();this.connectionPreviewer.hidePreview();a=null;this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.draggingBlock_)||(a=this.getNewLocationAfterDrag_(b).delta);
|
|
1264
|
-
null==(c=this.workspace_.getLayerManager())||c.moveOffDragLayer(this.draggingBlock_,BLOCK$$module$build$src$core$layers);this.draggingBlock_.setDragging(!1);a?this.updateBlockAfterMove_():bumpObjectIntoBounds$$module$build$src$core$bump_objects(this.draggingBlock_.workspace,this.workspace_.getMetricsManager().getScrollMetrics(!0),this.draggingBlock_)}this.connectionPreviewer.dispose();this.workspace_.setResizesEnabled(!0)
|
|
1265
|
-
this.pixelsToWorkspaceUnits_(a);const b=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startXY_,a);return{delta:a,newLocation:b}}maybeDeleteBlock_(){return this.wouldDeleteBlock_?(this.fireMoveEvent_(),this.draggingBlock_.dispose(!1,!0),draggingConnections$$module$build$src$core$common.length=0,!0):!1}updateBlockAfterMove_(){this.fireMoveEvent_();this.connectionCandidate?this.applyConnections(this.connectionCandidate):
|
|
1266
|
-
neighbour:c}=a;b.connect(c);if(this.draggingBlock_.rendered){const d=b.isSuperior()?c:b,e=this.draggingBlock_.getRootBlock();finishQueuedRenders$$module$build$src$core$render_management().then(()=>{connectionUiEffect$$module$build$src$core$block_animations(d.getSourceBlock());setTimeout(()=>{e.bringToFront()},0)})}}fireDragEndEvent_(){const a=new (get$$module$build$src$core$events$utils(BLOCK_DRAG$$module$build$src$core$events$utils))(this.draggingBlock_
|
|
1267
|
-
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):a||"function"!==typeof b.addStyle||b.addStyle(c)}}fireMoveEvent_(){if(!this.draggingBlock_.isDeadOrDying()){var a=new (get$$module$build$src$core$events$utils($.MOVE$$module$build$src$core$events$utils))(this.draggingBlock_);
|
|
1268
|
-
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&&a.scale(1/this.workspace_.options.parentWorkspace.scale);return a}dragIcons_(){warn$$module$build$src$core$utils$deprecation("Blockly.BlockDragger.prototype.dragIcons_",
|
|
1269
|
-
"v11")}getInsertionMarkers(){return this.workspace_.getAllBlocks().filter(a=>a.isInsertionMarker())}};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 module$build$src$core$bubbles={};module$build$src$core$bubbles.Bubble=Bubble$$module$build$src$core$bubbles$bubble;module$build$src$core$bubbles.MiniWorkspaceBubble=MiniWorkspaceBubble$$module$build$src$core$bubbles$mini_workspace_bubble;module$build$src$core$bubbles.TextBubble=TextBubble$$module$build$src$core$bubbles$text_bubble;module$build$src$core$bubbles.TextInputBubble=TextInputBubble$$module$build$src$core$bubbles$textinput_bubble;var BlockFieldIntermediateChange$$module$build$src$core$events$events_block_field_intermediate_change=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a,b,c,d){super(a);this.type=BLOCK_FIELD_INTERMEDIATE_CHANGE$$module$build$src$core$events$utils;this.recordUndo=!1;a&&(this.name=b,this.oldValue=c,this.newValue=d)}toJson(){const a=super.toJson();if(!this.name)throw Error("The changed field name is undefined. Either pass a name to the constructor, or call fromJson.");
|
|
1260
|
+
b){b=this.pixelsToWorkspaceUnits_(b);const c=this.connectionCandidate,d=this.getConnectionCandidate(a,b);if(d){this.connectionCandidate=b=c&&this.currCandidateIsBetter(c,b,d)?c:d;var {local:e,neighbour:f}=b;e.type!==ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE&&e.type!==ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT||!f.isConnected()||f.targetBlock().isInsertionMarker()||this.orphanCanConnectAtEnd(a,f.targetBlock(),e.type)?this.connectionPreviewer.previewConnection(e,
|
|
1261
|
+
f):this.connectionPreviewer.previewReplacement(e,f,f.targetBlock())}else this.connectionPreviewer.hidePreview(),this.connectionCandidate=null}orphanCanConnectAtEnd(a,b,c){return!!Connection$$module$build$src$core$connection.getConnectionForOrphanedConnection(a,c===ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE?b.outputConnection:b.previousConnection)}currCandidateIsBetter(a,b,c){const {local:d,neighbour:e}=a;a=new Coordinate$$module$build$src$core$utils$coordinate(d.x,d.y);const f=
|
|
1262
|
+
new Coordinate$$module$build$src$core$utils$coordinate(e.x,e.y);b=Coordinate$$module$build$src$core$utils$coordinate.distance(Coordinate$$module$build$src$core$utils$coordinate.sum(a,b),f);return c.distance>b-$.config$$module$build$src$core$config.currentConnectionPreference}getConnectionCandidate(a,b){a=this.getLocalConnections(a);let c=this.connectionCandidate?$.config$$module$build$src$core$config.connectingSnapRadius:$.config$$module$build$src$core$config.snapRadius,d=null;for(const e of a){const {connection:f,
|
|
1263
|
+
radius:g}=e.closest(c,b);f&&(d={local:e,neighbour:f,distance:g},c=g)}return d}getLocalConnections(a){const b=a.getConnections_(!1),c=a.lastConnectionInStack(!0);c&&c!==a.nextConnection&&b.push(c);return b}endDrag(a,b){this.drag(a,b);this.fireDragEndEvent_();stopTextWidthCache$$module$build$src$core$utils$dom();disconnectUiStop$$module$build$src$core$block_animations();this.connectionPreviewer.hidePreview();a=null;this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.draggingBlock_)||(a=this.getNewLocationAfterDrag_(b).delta);
|
|
1264
|
+
if(this.dragTarget_)this.dragTarget_.onDrop(this.draggingBlock_);if(!this.maybeDeleteBlock_()){let c;null==(c=this.workspace_.getLayerManager())||c.moveOffDragLayer(this.draggingBlock_,BLOCK$$module$build$src$core$layers);this.draggingBlock_.setDragging(!1);a?this.updateBlockAfterMove_():bumpObjectIntoBounds$$module$build$src$core$bump_objects(this.draggingBlock_.workspace,this.workspace_.getMetricsManager().getScrollMetrics(!0),this.draggingBlock_)}this.connectionPreviewer.dispose();this.workspace_.setResizesEnabled(!0);
|
|
1265
|
+
$.setGroup$$module$build$src$core$events$utils(!1)}getNewLocationAfterDrag_(a){a=this.pixelsToWorkspaceUnits_(a);const b=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startXY_,a);return{delta:a,newLocation:b}}maybeDeleteBlock_(){return this.wouldDeleteBlock_?(this.fireMoveEvent_(),this.draggingBlock_.dispose(!1,!0),draggingConnections$$module$build$src$core$common.length=0,!0):!1}updateBlockAfterMove_(){this.fireMoveEvent_();this.connectionCandidate?this.applyConnections(this.connectionCandidate):
|
|
1266
|
+
this.draggingBlock_.queueRender();this.draggingBlock_.scheduleSnapAndBump()}applyConnections(a){const {local:b,neighbour:c}=a;b.connect(c);if(this.draggingBlock_.rendered){const d=b.isSuperior()?c:b,e=this.draggingBlock_.getRootBlock();finishQueuedRenders$$module$build$src$core$render_management().then(()=>{connectionUiEffect$$module$build$src$core$block_animations(d.getSourceBlock());setTimeout(()=>{e.bringToFront()},0)})}}fireDragEndEvent_(){const a=new (get$$module$build$src$core$events$utils(BLOCK_DRAG$$module$build$src$core$events$utils))(this.draggingBlock_,
|
|
1267
|
+
!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):a||"function"!==typeof b.addStyle||b.addStyle(c)}}fireMoveEvent_(){if(!this.draggingBlock_.isDeadOrDying()){var a=new (get$$module$build$src$core$events$utils($.MOVE$$module$build$src$core$events$utils))(this.draggingBlock_);
|
|
1268
|
+
a.setReason(["drag"]);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&&a.scale(1/this.workspace_.options.parentWorkspace.scale);return a}dragIcons_(){warn$$module$build$src$core$utils$deprecation("Blockly.BlockDragger.prototype.dragIcons_",
|
|
1269
|
+
"v10","v11")}getInsertionMarkers(){return this.workspace_.getAllBlocks().filter(a=>a.isInsertionMarker())}};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 module$build$src$core$bubbles={};module$build$src$core$bubbles.Bubble=Bubble$$module$build$src$core$bubbles$bubble;module$build$src$core$bubbles.MiniWorkspaceBubble=MiniWorkspaceBubble$$module$build$src$core$bubbles$mini_workspace_bubble;module$build$src$core$bubbles.TextBubble=TextBubble$$module$build$src$core$bubbles$text_bubble;module$build$src$core$bubbles.TextInputBubble=TextInputBubble$$module$build$src$core$bubbles$textinput_bubble;var BlockFieldIntermediateChange$$module$build$src$core$events$events_block_field_intermediate_change=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a,b,c,d){super(a);this.type=BLOCK_FIELD_INTERMEDIATE_CHANGE$$module$build$src$core$events$utils;this.recordUndo=!1;a&&(this.name=b,this.oldValue=c,this.newValue=d)}toJson(){const a=super.toJson();if(!this.name)throw Error("The changed field name is undefined. Either pass a name to the constructor, or call fromJson.");
|
|
1270
1270
|
a.name=this.name;a.oldValue=this.oldValue;a.newValue=this.newValue;return a}static fromJson(a,b,c){b=super.fromJson(a,b,null!=c?c:new BlockFieldIntermediateChange$$module$build$src$core$events$events_block_field_intermediate_change);b.name=a.name;b.oldValue=a.oldValue;b.newValue=a.newValue;return b}isNull(){return this.oldValue===this.newValue}run(a){var b=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");
|
|
1271
1271
|
b=b.getBlockById(this.blockId);if(!b)throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");a=a?this.newValue:this.oldValue;(b=b.getField(this.name))?b.setValue(a):console.warn("Can't set non-existent field: "+this.name)}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,BLOCK_FIELD_INTERMEDIATE_CHANGE$$module$build$src$core$events$utils,BlockFieldIntermediateChange$$module$build$src$core$events$events_block_field_intermediate_change);
|
|
1272
1272
|
var module$build$src$core$events$events_block_field_intermediate_change={};module$build$src$core$events$events_block_field_intermediate_change.BlockFieldIntermediateChange=BlockFieldIntermediateChange$$module$build$src$core$events$events_block_field_intermediate_change;var BlockMove$$module$build$src$core$events$events_block_move=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a){super(a);this.type=$.MOVE$$module$build$src$core$events$utils;a&&(a.isShadow()&&(this.recordUndo=!1),a=this.currentLocation_(),this.oldParentId=a.parentId,this.oldInputName=a.inputName,this.oldCoordinate=a.coordinate)}toJson(){const a=super.toJson();a.oldParentId=this.oldParentId;a.oldInputName=this.oldInputName;this.oldCoordinate&&(a.oldCoordinate=`${Math.round(this.oldCoordinate.x)}, `+
|
|
@@ -1644,7 +1644,7 @@ let d=b&&b.getName();a===b&&(d=null);a=new (get$$module$build$src$core$events$ut
|
|
|
1644
1644
|
!this.selectedItem_.isCollapsible())return!1;const a=this.selectedItem_;a.isExpanded()?this.selectNext_():a.toggleExpanded();return!0}selectNext_(){if(!this.selectedItem_)return!1;let a=this.contents_.indexOf(this.selectedItem_)+1;if(-1<a&&a<this.contents_.length){let b=this.contents_[a];for(;b&&!b.isSelectable();)b=this.contents_[++a];if(b&&b.isSelectable())return this.setSelectedItem(b),!0}return!1}selectPrevious_(){if(!this.selectedItem_)return!1;let a=this.contents_.indexOf(this.selectedItem_)-
|
|
1645
1645
|
1;if(-1<a&&a<this.contents_.length){let b=this.contents_[a];for(;b&&!b.isSelectable();)b=this.contents_[--a];if(b&&b.isSelectable())return this.setSelectedItem(b),!0}return!1}dispose(){this.workspace_.getComponentManager().removeComponent("toolbox");this.flyout_.dispose();for(var a=0;a<this.contents_.length;a++)this.contents_[a].dispose();for(a=0;a<this.boundEvents_.length;a++)unbind$$module$build$src$core$browser_events(this.boundEvents_[a]);this.boundEvents_=[];this.contents_=[];this.HtmlDiv&&(this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),
|
|
1646
1646
|
removeNode$$module$build$src$core$utils$dom(this.HtmlDiv))}};register$$module$build$src$core$css('\n.blocklyToolboxDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolboxDiv {\n background-color: #ddd;\n overflow-x: visible;\n overflow-y: auto;\n padding: 4px 0 4px 0;\n position: absolute;\n z-index: 70; /* so blocks go under toolbox when dragging */\n -webkit-tap-highlight-color: transparent; /* issue #1345 */\n}\n\n.blocklyToolboxContents {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxContents:focus {\n outline: none;\n}\n');
|
|
1647
|
-
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX,DEFAULT$$module$build$src$core$registry,Toolbox$$module$build$src$core$toolbox$toolbox);var module$build$src$core$toolbox$toolbox={};module$build$src$core$toolbox$toolbox.Toolbox=Toolbox$$module$build$src$core$toolbox$toolbox;var VERSION$$module$build$src$core$blockly="10.4.
|
|
1647
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX,DEFAULT$$module$build$src$core$registry,Toolbox$$module$build$src$core$toolbox$toolbox);var module$build$src$core$toolbox$toolbox={};module$build$src$core$toolbox$toolbox.Toolbox=Toolbox$$module$build$src$core$toolbox$toolbox;var VERSION$$module$build$src$core$blockly="10.4.2",ALIGN_LEFT$$module$build$src$core$blockly=$.Align$$module$build$src$core$inputs$align.LEFT,ALIGN_CENTRE$$module$build$src$core$blockly=$.Align$$module$build$src$core$inputs$align.CENTRE,ALIGN_RIGHT$$module$build$src$core$blockly=$.Align$$module$build$src$core$inputs$align.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,
|
|
1648
1648
|
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$inputs$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,
|
|
1649
1649
|
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=
|
|
1650
1650
|
defineBlocksWithJsonArray$$module$build$src$core$common,setParentContainer$$module$build$src$core$blockly=setParentContainer$$module$build$src$core$common,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=OPPOSITE_TYPE$$module$build$src$core$internal_constants,RENAME_VARIABLE_ID$$module$build$src$core$blockly=
|
package/blockly_compressed.js
CHANGED
|
@@ -1257,16 +1257,16 @@ this.startXY_)}dispose(){this.dragIconData_.length=0;this.connectionPreviewer.di
|
|
|
1257
1257
|
let c;null==(c=this.workspace_.getLayerManager())||c.moveToDragLayer(this.draggingBlock_)}shouldDisconnect_(a){return!!(this.draggingBlock_.getParent()||a&&this.draggingBlock_.nextConnection&&this.draggingBlock_.nextConnection.targetBlock())}disconnectBlock_(a,b){this.draggingBlock_.unplug(a);a=this.pixelsToWorkspaceUnits_(b);a=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startXY_,a);this.draggingBlock_.translate(a.x,a.y);disconnectUiEffect$$module$build$src$core$block_animations(this.draggingBlock_)}fireDragStartEvent_(){const a=
|
|
1258
1258
|
new (get$$module$build$src$core$events$utils(BLOCK_DRAG$$module$build$src$core$events$utils))(this.draggingBlock_,!0,this.draggingBlock_.getDescendants(!1));fire$$module$build$src$core$events$utils(a)}drag(a,b){const c=this.draggingBlock_;this.moveBlock(c,b);this.updateDragTargets(a,c);this.wouldDeleteBlock_=this.wouldDeleteBlock(a,c,b);this.updateCursorDuringBlockDrag_();this.updateConnectionPreview(c,b)}moveBlock(a,b){b=this.pixelsToWorkspaceUnits_(b);b=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startXY_,
|
|
1259
1259
|
b);a.moveDuringDrag(b)}updateDragTargets(a,b){a=this.workspace_.getDragTarget(a);if(this.dragTarget_!==a){let c;null==(c=this.dragTarget_)||c.onDragExit(b);null==a||a.onDragEnter(b)}null==a||a.onDragOver(b);this.dragTarget_=a}wouldDeleteBlock(a,b,c){return(a=this.workspace_.getDragTarget(a))&&this.workspace_.getComponentManager().hasCapability(a.id,ComponentManager$$module$build$src$core$component_manager.Capability.DELETE_AREA)?a.wouldDelete(b,!!this.getConnectionCandidate(b,c)):!1}updateConnectionPreview(a,
|
|
1260
|
-
b){const c=this.connectionCandidate,d=this.getConnectionCandidate(a,b);if(d){this.connectionCandidate=b=c&&this.currCandidateIsBetter(c,b,d)?c:d;var {local:e,neighbour:f}=b;e.type!==ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE&&e.type!==ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT||!f.isConnected()||f.targetBlock().isInsertionMarker()||this.orphanCanConnectAtEnd(a,f.targetBlock(),e.type)?this.connectionPreviewer.previewConnection(e,
|
|
1261
|
-
f,f.targetBlock())}else this.connectionPreviewer.hidePreview(),this.connectionCandidate=null}orphanCanConnectAtEnd(a,b,c){return!!Connection$$module$build$src$core$connection.getConnectionForOrphanedConnection(a,c===ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE?b.outputConnection:b.previousConnection)}currCandidateIsBetter(a,b,c){const {local:d,neighbour:e}=a;a=new Coordinate$$module$build$src$core$utils$coordinate(d.x,d.y);const f=
|
|
1262
|
-
e.y);b=Coordinate$$module$build$src$core$utils$coordinate.distance(Coordinate$$module$build$src$core$utils$coordinate.sum(a,b),f);return c.distance>b-$.config$$module$build$src$core$config.currentConnectionPreference}getConnectionCandidate(a,b){a=this.getLocalConnections(a);let c
|
|
1263
|
-
c=a.lastConnectionInStack(!0);c&&c!==a.nextConnection&&b.push(c);return b}endDrag(a,b){this.drag(a,b);this.fireDragEndEvent_();stopTextWidthCache$$module$build$src$core$utils$dom();disconnectUiStop$$module$build$src$core$block_animations();this.connectionPreviewer.hidePreview();a=null;this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.draggingBlock_)||(a=this.getNewLocationAfterDrag_(b).delta);
|
|
1264
|
-
null==(c=this.workspace_.getLayerManager())||c.moveOffDragLayer(this.draggingBlock_,BLOCK$$module$build$src$core$layers);this.draggingBlock_.setDragging(!1);a?this.updateBlockAfterMove_():bumpObjectIntoBounds$$module$build$src$core$bump_objects(this.draggingBlock_.workspace,this.workspace_.getMetricsManager().getScrollMetrics(!0),this.draggingBlock_)}this.connectionPreviewer.dispose();this.workspace_.setResizesEnabled(!0)
|
|
1265
|
-
this.pixelsToWorkspaceUnits_(a);const b=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startXY_,a);return{delta:a,newLocation:b}}maybeDeleteBlock_(){return this.wouldDeleteBlock_?(this.fireMoveEvent_(),this.draggingBlock_.dispose(!1,!0),draggingConnections$$module$build$src$core$common.length=0,!0):!1}updateBlockAfterMove_(){this.fireMoveEvent_();this.connectionCandidate?this.applyConnections(this.connectionCandidate):
|
|
1266
|
-
neighbour:c}=a;b.connect(c);if(this.draggingBlock_.rendered){const d=b.isSuperior()?c:b,e=this.draggingBlock_.getRootBlock();finishQueuedRenders$$module$build$src$core$render_management().then(()=>{connectionUiEffect$$module$build$src$core$block_animations(d.getSourceBlock());setTimeout(()=>{e.bringToFront()},0)})}}fireDragEndEvent_(){const a=new (get$$module$build$src$core$events$utils(BLOCK_DRAG$$module$build$src$core$events$utils))(this.draggingBlock_
|
|
1267
|
-
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):a||"function"!==typeof b.addStyle||b.addStyle(c)}}fireMoveEvent_(){if(!this.draggingBlock_.isDeadOrDying()){var a=new (get$$module$build$src$core$events$utils($.MOVE$$module$build$src$core$events$utils))(this.draggingBlock_);
|
|
1268
|
-
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&&a.scale(1/this.workspace_.options.parentWorkspace.scale);return a}dragIcons_(){warn$$module$build$src$core$utils$deprecation("Blockly.BlockDragger.prototype.dragIcons_",
|
|
1269
|
-
"v11")}getInsertionMarkers(){return this.workspace_.getAllBlocks().filter(a=>a.isInsertionMarker())}};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 module$build$src$core$bubbles={};module$build$src$core$bubbles.Bubble=Bubble$$module$build$src$core$bubbles$bubble;module$build$src$core$bubbles.MiniWorkspaceBubble=MiniWorkspaceBubble$$module$build$src$core$bubbles$mini_workspace_bubble;module$build$src$core$bubbles.TextBubble=TextBubble$$module$build$src$core$bubbles$text_bubble;module$build$src$core$bubbles.TextInputBubble=TextInputBubble$$module$build$src$core$bubbles$textinput_bubble;var BlockFieldIntermediateChange$$module$build$src$core$events$events_block_field_intermediate_change=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a,b,c,d){super(a);this.type=BLOCK_FIELD_INTERMEDIATE_CHANGE$$module$build$src$core$events$utils;this.recordUndo=!1;a&&(this.name=b,this.oldValue=c,this.newValue=d)}toJson(){const a=super.toJson();if(!this.name)throw Error("The changed field name is undefined. Either pass a name to the constructor, or call fromJson.");
|
|
1260
|
+
b){b=this.pixelsToWorkspaceUnits_(b);const c=this.connectionCandidate,d=this.getConnectionCandidate(a,b);if(d){this.connectionCandidate=b=c&&this.currCandidateIsBetter(c,b,d)?c:d;var {local:e,neighbour:f}=b;e.type!==ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE&&e.type!==ConnectionType$$module$build$src$core$connection_type.PREVIOUS_STATEMENT||!f.isConnected()||f.targetBlock().isInsertionMarker()||this.orphanCanConnectAtEnd(a,f.targetBlock(),e.type)?this.connectionPreviewer.previewConnection(e,
|
|
1261
|
+
f):this.connectionPreviewer.previewReplacement(e,f,f.targetBlock())}else this.connectionPreviewer.hidePreview(),this.connectionCandidate=null}orphanCanConnectAtEnd(a,b,c){return!!Connection$$module$build$src$core$connection.getConnectionForOrphanedConnection(a,c===ConnectionType$$module$build$src$core$connection_type.OUTPUT_VALUE?b.outputConnection:b.previousConnection)}currCandidateIsBetter(a,b,c){const {local:d,neighbour:e}=a;a=new Coordinate$$module$build$src$core$utils$coordinate(d.x,d.y);const f=
|
|
1262
|
+
new Coordinate$$module$build$src$core$utils$coordinate(e.x,e.y);b=Coordinate$$module$build$src$core$utils$coordinate.distance(Coordinate$$module$build$src$core$utils$coordinate.sum(a,b),f);return c.distance>b-$.config$$module$build$src$core$config.currentConnectionPreference}getConnectionCandidate(a,b){a=this.getLocalConnections(a);let c=this.connectionCandidate?$.config$$module$build$src$core$config.connectingSnapRadius:$.config$$module$build$src$core$config.snapRadius,d=null;for(const e of a){const {connection:f,
|
|
1263
|
+
radius:g}=e.closest(c,b);f&&(d={local:e,neighbour:f,distance:g},c=g)}return d}getLocalConnections(a){const b=a.getConnections_(!1),c=a.lastConnectionInStack(!0);c&&c!==a.nextConnection&&b.push(c);return b}endDrag(a,b){this.drag(a,b);this.fireDragEndEvent_();stopTextWidthCache$$module$build$src$core$utils$dom();disconnectUiStop$$module$build$src$core$block_animations();this.connectionPreviewer.hidePreview();a=null;this.dragTarget_&&this.dragTarget_.shouldPreventMove(this.draggingBlock_)||(a=this.getNewLocationAfterDrag_(b).delta);
|
|
1264
|
+
if(this.dragTarget_)this.dragTarget_.onDrop(this.draggingBlock_);if(!this.maybeDeleteBlock_()){let c;null==(c=this.workspace_.getLayerManager())||c.moveOffDragLayer(this.draggingBlock_,BLOCK$$module$build$src$core$layers);this.draggingBlock_.setDragging(!1);a?this.updateBlockAfterMove_():bumpObjectIntoBounds$$module$build$src$core$bump_objects(this.draggingBlock_.workspace,this.workspace_.getMetricsManager().getScrollMetrics(!0),this.draggingBlock_)}this.connectionPreviewer.dispose();this.workspace_.setResizesEnabled(!0);
|
|
1265
|
+
$.setGroup$$module$build$src$core$events$utils(!1)}getNewLocationAfterDrag_(a){a=this.pixelsToWorkspaceUnits_(a);const b=Coordinate$$module$build$src$core$utils$coordinate.sum(this.startXY_,a);return{delta:a,newLocation:b}}maybeDeleteBlock_(){return this.wouldDeleteBlock_?(this.fireMoveEvent_(),this.draggingBlock_.dispose(!1,!0),draggingConnections$$module$build$src$core$common.length=0,!0):!1}updateBlockAfterMove_(){this.fireMoveEvent_();this.connectionCandidate?this.applyConnections(this.connectionCandidate):
|
|
1266
|
+
this.draggingBlock_.queueRender();this.draggingBlock_.scheduleSnapAndBump()}applyConnections(a){const {local:b,neighbour:c}=a;b.connect(c);if(this.draggingBlock_.rendered){const d=b.isSuperior()?c:b,e=this.draggingBlock_.getRootBlock();finishQueuedRenders$$module$build$src$core$render_management().then(()=>{connectionUiEffect$$module$build$src$core$block_animations(d.getSourceBlock());setTimeout(()=>{e.bringToFront()},0)})}}fireDragEndEvent_(){const a=new (get$$module$build$src$core$events$utils(BLOCK_DRAG$$module$build$src$core$events$utils))(this.draggingBlock_,
|
|
1267
|
+
!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):a||"function"!==typeof b.addStyle||b.addStyle(c)}}fireMoveEvent_(){if(!this.draggingBlock_.isDeadOrDying()){var a=new (get$$module$build$src$core$events$utils($.MOVE$$module$build$src$core$events$utils))(this.draggingBlock_);
|
|
1268
|
+
a.setReason(["drag"]);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&&a.scale(1/this.workspace_.options.parentWorkspace.scale);return a}dragIcons_(){warn$$module$build$src$core$utils$deprecation("Blockly.BlockDragger.prototype.dragIcons_",
|
|
1269
|
+
"v10","v11")}getInsertionMarkers(){return this.workspace_.getAllBlocks().filter(a=>a.isInsertionMarker())}};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 module$build$src$core$bubbles={};module$build$src$core$bubbles.Bubble=Bubble$$module$build$src$core$bubbles$bubble;module$build$src$core$bubbles.MiniWorkspaceBubble=MiniWorkspaceBubble$$module$build$src$core$bubbles$mini_workspace_bubble;module$build$src$core$bubbles.TextBubble=TextBubble$$module$build$src$core$bubbles$text_bubble;module$build$src$core$bubbles.TextInputBubble=TextInputBubble$$module$build$src$core$bubbles$textinput_bubble;var BlockFieldIntermediateChange$$module$build$src$core$events$events_block_field_intermediate_change=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a,b,c,d){super(a);this.type=BLOCK_FIELD_INTERMEDIATE_CHANGE$$module$build$src$core$events$utils;this.recordUndo=!1;a&&(this.name=b,this.oldValue=c,this.newValue=d)}toJson(){const a=super.toJson();if(!this.name)throw Error("The changed field name is undefined. Either pass a name to the constructor, or call fromJson.");
|
|
1270
1270
|
a.name=this.name;a.oldValue=this.oldValue;a.newValue=this.newValue;return a}static fromJson(a,b,c){b=super.fromJson(a,b,null!=c?c:new BlockFieldIntermediateChange$$module$build$src$core$events$events_block_field_intermediate_change);b.name=a.name;b.oldValue=a.oldValue;b.newValue=a.newValue;return b}isNull(){return this.oldValue===this.newValue}run(a){var b=this.getEventWorkspace_();if(!this.blockId)throw Error("The block ID is undefined. Either pass a block to the constructor, or call fromJson");
|
|
1271
1271
|
b=b.getBlockById(this.blockId);if(!b)throw Error("The associated block is undefined. Either pass a block to the constructor, or call fromJson");a=a?this.newValue:this.oldValue;(b=b.getField(this.name))?b.setValue(a):console.warn("Can't set non-existent field: "+this.name)}};register$$module$build$src$core$registry(Type$$module$build$src$core$registry.EVENT,BLOCK_FIELD_INTERMEDIATE_CHANGE$$module$build$src$core$events$utils,BlockFieldIntermediateChange$$module$build$src$core$events$events_block_field_intermediate_change);
|
|
1272
1272
|
var module$build$src$core$events$events_block_field_intermediate_change={};module$build$src$core$events$events_block_field_intermediate_change.BlockFieldIntermediateChange=BlockFieldIntermediateChange$$module$build$src$core$events$events_block_field_intermediate_change;var BlockMove$$module$build$src$core$events$events_block_move=class extends BlockBase$$module$build$src$core$events$events_block_base{constructor(a){super(a);this.type=$.MOVE$$module$build$src$core$events$utils;a&&(a.isShadow()&&(this.recordUndo=!1),a=this.currentLocation_(),this.oldParentId=a.parentId,this.oldInputName=a.inputName,this.oldCoordinate=a.coordinate)}toJson(){const a=super.toJson();a.oldParentId=this.oldParentId;a.oldInputName=this.oldInputName;this.oldCoordinate&&(a.oldCoordinate=`${Math.round(this.oldCoordinate.x)}, `+
|
|
@@ -1644,7 +1644,7 @@ let d=b&&b.getName();a===b&&(d=null);a=new (get$$module$build$src$core$events$ut
|
|
|
1644
1644
|
!this.selectedItem_.isCollapsible())return!1;const a=this.selectedItem_;a.isExpanded()?this.selectNext_():a.toggleExpanded();return!0}selectNext_(){if(!this.selectedItem_)return!1;let a=this.contents_.indexOf(this.selectedItem_)+1;if(-1<a&&a<this.contents_.length){let b=this.contents_[a];for(;b&&!b.isSelectable();)b=this.contents_[++a];if(b&&b.isSelectable())return this.setSelectedItem(b),!0}return!1}selectPrevious_(){if(!this.selectedItem_)return!1;let a=this.contents_.indexOf(this.selectedItem_)-
|
|
1645
1645
|
1;if(-1<a&&a<this.contents_.length){let b=this.contents_[a];for(;b&&!b.isSelectable();)b=this.contents_[--a];if(b&&b.isSelectable())return this.setSelectedItem(b),!0}return!1}dispose(){this.workspace_.getComponentManager().removeComponent("toolbox");this.flyout_.dispose();for(var a=0;a<this.contents_.length;a++)this.contents_[a].dispose();for(a=0;a<this.boundEvents_.length;a++)unbind$$module$build$src$core$browser_events(this.boundEvents_[a]);this.boundEvents_=[];this.contents_=[];this.HtmlDiv&&(this.workspace_.getThemeManager().unsubscribe(this.HtmlDiv),
|
|
1646
1646
|
removeNode$$module$build$src$core$utils$dom(this.HtmlDiv))}};register$$module$build$src$core$css('\n.blocklyToolboxDelete {\n cursor: url("<<<PATH>>>/handdelete.cur"), auto;\n}\n\n.blocklyToolboxGrab {\n cursor: url("<<<PATH>>>/handclosed.cur"), auto;\n cursor: grabbing;\n cursor: -webkit-grabbing;\n}\n\n/* Category tree in Toolbox. */\n.blocklyToolboxDiv {\n background-color: #ddd;\n overflow-x: visible;\n overflow-y: auto;\n padding: 4px 0 4px 0;\n position: absolute;\n z-index: 70; /* so blocks go under toolbox when dragging */\n -webkit-tap-highlight-color: transparent; /* issue #1345 */\n}\n\n.blocklyToolboxContents {\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.blocklyToolboxContents:focus {\n outline: none;\n}\n');
|
|
1647
|
-
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX,DEFAULT$$module$build$src$core$registry,Toolbox$$module$build$src$core$toolbox$toolbox);var module$build$src$core$toolbox$toolbox={};module$build$src$core$toolbox$toolbox.Toolbox=Toolbox$$module$build$src$core$toolbox$toolbox;var VERSION$$module$build$src$core$blockly="10.4.
|
|
1647
|
+
register$$module$build$src$core$registry(Type$$module$build$src$core$registry.TOOLBOX,DEFAULT$$module$build$src$core$registry,Toolbox$$module$build$src$core$toolbox$toolbox);var module$build$src$core$toolbox$toolbox={};module$build$src$core$toolbox$toolbox.Toolbox=Toolbox$$module$build$src$core$toolbox$toolbox;var VERSION$$module$build$src$core$blockly="10.4.2",ALIGN_LEFT$$module$build$src$core$blockly=$.Align$$module$build$src$core$inputs$align.LEFT,ALIGN_CENTRE$$module$build$src$core$blockly=$.Align$$module$build$src$core$inputs$align.CENTRE,ALIGN_RIGHT$$module$build$src$core$blockly=$.Align$$module$build$src$core$inputs$align.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,
|
|
1648
1648
|
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$inputs$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,
|
|
1649
1649
|
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=
|
|
1650
1650
|
defineBlocksWithJsonArray$$module$build$src$core$common,setParentContainer$$module$build$src$core$blockly=setParentContainer$$module$build$src$core$common,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=OPPOSITE_TYPE$$module$build$src$core$internal_constants,RENAME_VARIABLE_ID$$module$build$src$core$blockly=
|