blockly 7.20211209.3 → 8.0.1-beta.0
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.d.ts +18963 -18432
- package/blockly.min.js +582 -546
- package/blockly_compressed.js +448 -416
- package/blockly_compressed.js.map +1 -1
- package/blocks/blocks.js +47 -0
- package/blocks/colour.js +13 -3
- package/blocks/lists.js +33 -18
- package/blocks/logic.js +24 -8
- package/blocks/loops.js +20 -7
- package/blocks/math.js +12 -3
- package/blocks/procedures.js +41 -27
- package/blocks/text.js +33 -18
- package/blocks/variables.js +14 -3
- package/blocks/variables_dynamic.js +13 -3
- package/blocks_compressed.js +129 -126
- package/blocks_compressed.js.map +1 -1
- package/core/block.js +1869 -1814
- package/core/block_drag_surface.js +201 -200
- package/core/block_dragger.js +377 -373
- package/core/block_svg.js +1593 -1479
- package/core/blockly.js +8 -22
- package/core/blocks.js +9 -2
- package/core/browser_events.js +22 -5
- package/core/bubble.js +841 -797
- package/core/bubble_dragger.js +213 -206
- package/core/bump_objects.js +2 -2
- package/core/clipboard.js +9 -9
- package/core/comment.js +353 -332
- package/core/common.js +46 -17
- package/core/component_manager.js +181 -174
- package/core/config.js +87 -0
- package/core/connection.js +595 -584
- package/core/connection_checker.js +242 -244
- package/core/connection_db.js +235 -230
- package/core/contextmenu.js +9 -6
- package/core/contextmenu_items.js +1 -2
- package/core/contextmenu_registry.js +93 -89
- package/core/css.js +474 -474
- package/core/delete_area.js +45 -42
- package/core/drag_target.js +57 -56
- package/core/dropdowndiv.js +153 -163
- package/core/events/events.js +2 -2
- package/core/events/events_abstract.js +89 -77
- package/core/events/events_block_base.js +37 -36
- package/core/events/events_block_change.js +130 -124
- package/core/events/events_block_create.js +73 -71
- package/core/events/events_block_delete.js +84 -82
- package/core/events/events_block_drag.js +50 -49
- package/core/events/events_block_move.js +147 -140
- package/core/events/events_bubble_open.js +51 -50
- package/core/events/events_click.js +48 -44
- package/core/events/events_comment_base.js +72 -69
- package/core/events/events_comment_change.js +63 -61
- package/core/events/events_comment_create.js +44 -42
- package/core/events/events_comment_delete.js +42 -40
- package/core/events/events_comment_move.js +106 -104
- package/core/events/events_marker_move.js +65 -64
- package/core/events/events_selected.js +46 -45
- package/core/events/events_theme_change.js +36 -35
- package/core/events/events_toolbox_item_select.js +46 -45
- package/core/events/events_trashcan_open.js +37 -36
- package/core/events/events_ui.js +47 -46
- package/core/events/events_ui_base.js +30 -29
- package/core/events/events_var_base.js +37 -36
- package/core/events/events_var_create.js +50 -48
- package/core/events/events_var_delete.js +50 -48
- package/core/events/events_var_rename.js +51 -49
- package/core/events/events_viewport.js +66 -65
- package/core/events/utils.js +29 -14
- package/core/events/workspace_events.js +49 -55
- package/core/extensions.js +4 -3
- package/core/field.js +1061 -997
- package/core/field_angle.js +462 -442
- package/core/field_checkbox.js +194 -182
- package/core/field_colour.js +519 -505
- package/core/field_dropdown.js +617 -598
- package/core/field_image.js +229 -220
- package/core/field_label.js +102 -91
- package/core/field_label_serializable.js +42 -41
- package/core/field_multilineinput.js +372 -358
- package/core/field_number.js +272 -253
- package/core/field_textinput.js +499 -467
- package/core/field_variable.js +458 -420
- package/core/flyout_base.js +1005 -952
- package/core/flyout_button.js +277 -260
- package/core/flyout_horizontal.js +304 -302
- package/core/flyout_metrics_manager.js +64 -64
- package/core/flyout_vertical.js +306 -300
- package/core/generator.js +459 -446
- package/core/gesture.js +829 -813
- package/core/grid.js +166 -163
- package/core/icon.js +168 -159
- package/core/inject.js +7 -5
- package/core/input.js +257 -248
- package/core/insertion_marker_manager.js +655 -624
- package/core/internal_constants.js +0 -129
- package/core/keyboard_nav/ast_node.js +605 -596
- package/core/keyboard_nav/basic_cursor.js +166 -165
- package/core/keyboard_nav/cursor.js +99 -97
- package/core/keyboard_nav/marker.js +83 -79
- package/core/keyboard_nav/tab_navigate_cursor.js +18 -23
- package/core/marker_manager.js +153 -141
- package/core/menu.js +377 -372
- package/core/menuitem.js +223 -217
- package/core/metrics_manager.js +403 -390
- package/core/mutator.js +468 -437
- package/core/names.js +229 -188
- package/core/options.js +290 -284
- package/core/procedures.js +29 -17
- package/core/registry.js +19 -16
- package/core/rendered_connection.js +482 -463
- package/core/renderers/common/block_rendering.js +9 -3
- package/core/renderers/common/constants.js +1119 -1112
- package/core/renderers/common/debug.js +14 -0
- package/core/renderers/common/debugger.js +338 -316
- package/core/renderers/common/drawer.js +380 -370
- package/core/renderers/common/i_path_object.js +2 -2
- package/core/renderers/common/info.js +626 -618
- package/core/renderers/common/marker_svg.js +579 -541
- package/core/renderers/common/path_object.js +203 -200
- package/core/renderers/common/renderer.js +220 -218
- package/core/renderers/geras/constants.js +36 -36
- package/core/renderers/geras/drawer.js +155 -147
- package/core/renderers/geras/highlight_constants.js +244 -238
- package/core/renderers/geras/highlighter.js +231 -179
- package/core/renderers/geras/info.js +392 -369
- package/core/renderers/geras/measurables/inline_input.js +25 -19
- package/core/renderers/geras/measurables/statement_input.js +23 -17
- package/core/renderers/geras/path_object.js +106 -121
- package/core/renderers/geras/renderer.js +96 -98
- package/core/renderers/measurables/base.js +30 -18
- package/core/renderers/measurables/bottom_row.js +83 -80
- package/core/renderers/measurables/connection.js +22 -15
- package/core/renderers/measurables/external_value_input.js +35 -22
- package/core/renderers/measurables/field.js +35 -20
- package/core/renderers/measurables/hat.js +18 -13
- package/core/renderers/measurables/icon.js +24 -17
- package/core/renderers/measurables/in_row_spacer.js +15 -13
- package/core/renderers/measurables/inline_input.js +43 -33
- package/core/renderers/measurables/input_connection.js +41 -28
- package/core/renderers/measurables/input_row.js +50 -44
- package/core/renderers/measurables/jagged_edge.js +14 -12
- package/core/renderers/measurables/next_connection.js +16 -14
- package/core/renderers/measurables/output_connection.js +26 -20
- package/core/renderers/measurables/previous_connection.js +16 -15
- package/core/renderers/measurables/round_corner.js +20 -18
- package/core/renderers/measurables/row.js +184 -168
- package/core/renderers/measurables/spacer_row.js +38 -23
- package/core/renderers/measurables/square_corner.js +18 -16
- package/core/renderers/measurables/statement_input.js +23 -20
- package/core/renderers/measurables/top_row.js +88 -85
- package/core/renderers/minimalist/constants.js +8 -7
- package/core/renderers/minimalist/drawer.js +11 -10
- package/core/renderers/minimalist/info.js +18 -18
- package/core/renderers/minimalist/renderer.js +40 -39
- package/core/renderers/thrasos/info.js +258 -248
- package/core/renderers/thrasos/renderer.js +20 -20
- package/core/renderers/zelos/constants.js +898 -873
- package/core/renderers/zelos/drawer.js +186 -169
- package/core/renderers/zelos/info.js +502 -479
- package/core/renderers/zelos/marker_svg.js +129 -115
- package/core/renderers/zelos/measurables/bottom_row.js +31 -30
- package/core/renderers/zelos/measurables/inputs.js +22 -21
- package/core/renderers/zelos/measurables/row_elements.js +14 -13
- package/core/renderers/zelos/measurables/top_row.js +34 -33
- package/core/renderers/zelos/path_object.js +181 -180
- package/core/renderers/zelos/renderer.js +91 -92
- package/core/scrollbar.js +759 -713
- package/core/scrollbar_pair.js +250 -245
- package/core/serialization/blocks.js +20 -10
- package/core/serialization/workspaces.js +3 -2
- package/core/shortcut_registry.js +286 -277
- package/core/sprites.js +31 -0
- package/core/theme.js +135 -141
- package/core/theme_manager.js +147 -143
- package/core/toolbox/category.js +602 -576
- package/core/toolbox/collapsible_category.js +226 -227
- package/core/toolbox/separator.js +70 -61
- package/core/toolbox/toolbox.js +934 -927
- package/core/toolbox/toolbox_item.js +115 -99
- package/core/tooltip.js +108 -35
- package/core/touch.js +8 -3
- package/core/touch_gesture.js +254 -251
- package/core/trashcan.js +606 -595
- package/core/utils/coordinate.js +97 -95
- package/core/utils/dom.js +2 -2
- package/core/utils/global.js +2 -0
- package/core/utils/rect.js +41 -37
- package/core/utils/sentinel.js +25 -0
- package/core/utils/size.js +30 -27
- package/core/utils/svg.js +18 -16
- package/core/utils/toolbox.js +1 -1
- package/core/variable_map.js +325 -341
- package/core/variable_model.js +55 -54
- package/core/variables.js +9 -2
- package/core/variables_dynamic.js +3 -1
- package/core/warning.js +126 -120
- package/core/widgetdiv.js +4 -4
- package/core/workspace.js +685 -664
- package/core/workspace_audio.js +124 -118
- package/core/workspace_comment.js +308 -298
- package/core/workspace_comment_svg.js +1029 -951
- package/core/workspace_drag_surface_svg.js +147 -140
- package/core/workspace_dragger.js +70 -71
- package/core/workspace_svg.js +2322 -2297
- package/core/xml.js +30 -20
- package/core/zoom_controls.js +431 -439
- package/dart_compressed.js +5 -4
- package/dart_compressed.js.map +1 -1
- package/generators/dart/colour.js +56 -64
- package/generators/dart/lists.js +61 -50
- package/generators/dart/math.js +160 -148
- package/generators/dart/text.js +83 -61
- package/generators/javascript/colour.js +37 -34
- package/generators/javascript/lists.js +50 -43
- package/generators/javascript/math.js +123 -139
- package/generators/javascript/text.js +67 -81
- package/generators/lua/colour.js +25 -23
- package/generators/lua/lists.js +97 -69
- package/generators/lua/logic.js +1 -2
- package/generators/lua/math.js +182 -144
- package/generators/lua/text.js +116 -99
- package/generators/php/colour.js +38 -32
- package/generators/php/lists.js +109 -89
- package/generators/php/math.js +90 -81
- package/generators/php/text.js +63 -61
- package/generators/python/colour.js +18 -18
- package/generators/python/lists.js +38 -30
- package/generators/python/loops.js +12 -8
- package/generators/python/math.js +104 -106
- package/generators/python/text.js +34 -30
- package/javascript_compressed.js +5 -4
- package/javascript_compressed.js.map +1 -1
- package/lua_compressed.js +5 -4
- package/lua_compressed.js.map +1 -1
- package/msg/ab.js +1 -2
- package/msg/ace.js +1 -2
- package/msg/af.js +1 -2
- package/msg/am.js +1 -2
- package/msg/ar.js +1 -2
- package/msg/ast.js +1 -2
- package/msg/az.js +3 -4
- package/msg/ba.js +1 -2
- package/msg/bcc.js +1 -2
- package/msg/be-tarask.js +1 -2
- package/msg/be.js +5 -6
- package/msg/bg.js +1 -2
- package/msg/bn.js +1 -2
- package/msg/br.js +1 -2
- package/msg/bs.js +1 -2
- package/msg/ca.js +1 -2
- package/msg/cdo.js +1 -2
- package/msg/cs.js +16 -17
- package/msg/da.js +1 -2
- package/msg/de.js +2 -3
- package/msg/diq.js +2 -3
- package/msg/dty.js +1 -2
- package/msg/ee.js +1 -2
- package/msg/el.js +1 -2
- package/msg/en-gb.js +1 -2
- package/msg/en.js +1 -2
- package/msg/eo.js +2 -3
- package/msg/es.js +2 -3
- package/msg/et.js +1 -2
- package/msg/eu.js +1 -2
- package/msg/fa.js +2 -3
- package/msg/fi.js +1 -2
- package/msg/fo.js +1 -2
- package/msg/fr.js +5 -6
- package/msg/frr.js +1 -2
- package/msg/gl.js +1 -2
- package/msg/gn.js +1 -2
- package/msg/gor.js +1 -2
- package/msg/ha.js +1 -2
- package/msg/hak.js +1 -2
- package/msg/he.js +2 -3
- package/msg/hi.js +1 -2
- package/msg/hr.js +3 -4
- package/msg/hrx.js +1 -2
- package/msg/hu.js +1 -2
- package/msg/hy.js +3 -4
- package/msg/ia.js +1 -2
- package/msg/id.js +13 -14
- package/msg/ig.js +1 -2
- package/msg/inh.js +15 -16
- package/msg/is.js +1 -2
- package/msg/it.js +1 -2
- package/msg/ja.js +8 -9
- package/msg/ka.js +1 -2
- package/msg/kab.js +1 -2
- package/msg/kbd-cyrl.js +1 -2
- package/msg/km.js +1 -2
- package/msg/kn.js +1 -2
- package/msg/ko.js +1 -2
- package/msg/ksh.js +1 -2
- package/msg/ku-latn.js +1 -2
- package/msg/ky.js +1 -2
- package/msg/la.js +1 -2
- package/msg/lb.js +1 -2
- package/msg/lki.js +1 -2
- package/msg/lo.js +1 -2
- package/msg/lrc.js +1 -2
- package/msg/lt.js +1 -2
- package/msg/lv.js +30 -31
- package/msg/mg.js +1 -2
- package/msg/mk.js +1 -2
- package/msg/ml.js +1 -2
- package/msg/mnw.js +1 -2
- package/msg/ms.js +1 -2
- package/msg/my.js +1 -2
- package/msg/mzn.js +1 -2
- package/msg/nb.js +1 -2
- package/msg/ne.js +1 -2
- package/msg/nl.js +1 -2
- package/msg/oc.js +1 -2
- package/msg/olo.js +1 -2
- package/msg/pa.js +4 -5
- package/msg/pl.js +1 -2
- package/msg/pms.js +1 -2
- package/msg/ps.js +1 -2
- package/msg/pt-br.js +1 -2
- package/msg/pt.js +1 -2
- package/msg/ro.js +1 -2
- package/msg/ru.js +1 -2
- package/msg/sc.js +1 -2
- package/msg/sco.js +1 -2
- package/msg/sd.js +1 -2
- package/msg/shn.js +1 -2
- package/msg/si.js +1 -2
- package/msg/sk.js +1 -2
- package/msg/skr-arab.js +1 -2
- package/msg/sl.js +1 -2
- package/msg/smn.js +435 -0
- package/msg/sq.js +1 -2
- package/msg/sr-latn.js +1 -2
- package/msg/sr.js +1 -2
- package/msg/sv.js +1 -2
- package/msg/sw.js +1 -2
- package/msg/ta.js +1 -2
- package/msg/tcy.js +1 -2
- package/msg/te.js +2 -3
- package/msg/th.js +1 -2
- package/msg/ti.js +1 -2
- package/msg/tl.js +1 -2
- package/msg/tlh.js +1 -2
- package/msg/tr.js +1 -2
- package/msg/ug-arab.js +1 -2
- package/msg/uk.js +1 -2
- package/msg/ur.js +1 -2
- package/msg/uz.js +1 -2
- package/msg/vi.js +1 -2
- package/msg/xmf.js +1 -2
- package/msg/yo.js +1 -2
- package/msg/yue.js +2 -3
- package/msg/zgh.js +1 -2
- package/msg/zh-hans.js +4 -5
- package/msg/zh-hant.js +4 -5
- package/package.json +7 -6
- package/php_compressed.js +5 -4
- package/php_compressed.js.map +1 -1
- package/python_compressed.js +5 -4
- package/python_compressed.js.map +1 -1
- package/blocks/all.js +0 -36
|
@@ -28,204 +28,220 @@ const {Types} = goog.require('Blockly.blockRendering.Types');
|
|
|
28
28
|
/**
|
|
29
29
|
* An object representing a single row on a rendered block and all of its
|
|
30
30
|
* subcomponents.
|
|
31
|
-
* @param {!ConstantProvider} constants The rendering
|
|
32
|
-
* constants provider.
|
|
33
|
-
* @package
|
|
34
|
-
* @constructor
|
|
35
31
|
* @alias Blockly.blockRendering.Row
|
|
36
32
|
*/
|
|
37
|
-
|
|
33
|
+
class Row {
|
|
38
34
|
/**
|
|
39
|
-
*
|
|
35
|
+
* @param {!ConstantProvider} constants The rendering
|
|
36
|
+
* constants provider.
|
|
40
37
|
* @package
|
|
41
|
-
* @type {number}
|
|
42
38
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
39
|
+
constructor(constants) {
|
|
40
|
+
/**
|
|
41
|
+
* The type of this rendering object.
|
|
42
|
+
* @package
|
|
43
|
+
* @type {number}
|
|
44
|
+
*/
|
|
45
|
+
this.type = Types.ROW;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An array of elements contained in this row.
|
|
49
|
+
* @package
|
|
50
|
+
* @type {!Array<!Measurable>}
|
|
51
|
+
*/
|
|
52
|
+
this.elements = [];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The height of the row.
|
|
56
|
+
* @package
|
|
57
|
+
* @type {number}
|
|
58
|
+
*/
|
|
59
|
+
this.height = 0;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The width of the row, from the left edge of the block to the right.
|
|
63
|
+
* Does not include child blocks unless they are inline.
|
|
64
|
+
* @package
|
|
65
|
+
* @type {number}
|
|
66
|
+
*/
|
|
67
|
+
this.width = 0;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The minimum height of the row.
|
|
71
|
+
* @package
|
|
72
|
+
* @type {number}
|
|
73
|
+
*/
|
|
74
|
+
this.minHeight = 0;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The minimum width of the row, from the left edge of the block to the
|
|
78
|
+
* right. Does not include child blocks unless they are inline.
|
|
79
|
+
* @package
|
|
80
|
+
* @type {number}
|
|
81
|
+
*/
|
|
82
|
+
this.minWidth = 0;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The width of the row, from the left edge of the block to the edge of the
|
|
86
|
+
* block or any connected child blocks.
|
|
87
|
+
* @package
|
|
88
|
+
* @type {number}
|
|
89
|
+
*/
|
|
90
|
+
this.widthWithConnectedBlocks = 0;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The Y position of the row relative to the origin of the block's svg
|
|
94
|
+
* group.
|
|
95
|
+
* @package
|
|
96
|
+
* @type {number}
|
|
97
|
+
*/
|
|
98
|
+
this.yPos = 0;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The X position of the row relative to the origin of the block's svg
|
|
102
|
+
* group.
|
|
103
|
+
* @package
|
|
104
|
+
* @type {number}
|
|
105
|
+
*/
|
|
106
|
+
this.xPos = 0;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Whether the row has any external inputs.
|
|
110
|
+
* @package
|
|
111
|
+
* @type {boolean}
|
|
112
|
+
*/
|
|
113
|
+
this.hasExternalInput = false;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Whether the row has any statement inputs.
|
|
117
|
+
* @package
|
|
118
|
+
* @type {boolean}
|
|
119
|
+
*/
|
|
120
|
+
this.hasStatement = false;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Where the left edge of all of the statement inputs on the block should
|
|
124
|
+
* be. This makes sure that statement inputs which are proceded by fields
|
|
125
|
+
* of varius widths are all aligned.
|
|
126
|
+
* @type {number}
|
|
127
|
+
*/
|
|
128
|
+
this.statementEdge = 0;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Whether the row has any inline inputs.
|
|
132
|
+
* @package
|
|
133
|
+
* @type {boolean}
|
|
134
|
+
*/
|
|
135
|
+
this.hasInlineInput = false;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Whether the row has any dummy inputs.
|
|
139
|
+
* @package
|
|
140
|
+
* @type {boolean}
|
|
141
|
+
*/
|
|
142
|
+
this.hasDummyInput = false;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Whether the row has a jagged edge.
|
|
146
|
+
* @package
|
|
147
|
+
* @type {boolean}
|
|
148
|
+
*/
|
|
149
|
+
this.hasJaggedEdge = false;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The renderer's constant provider.
|
|
153
|
+
* @type {!ConstantProvider}
|
|
154
|
+
* @protected
|
|
155
|
+
*/
|
|
156
|
+
this.constants_ = constants;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @type {number}
|
|
160
|
+
*/
|
|
161
|
+
this.notchOffset = this.constants_.NOTCH_OFFSET_LEFT;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Alignment of the row.
|
|
165
|
+
* @package
|
|
166
|
+
* @type {?number}
|
|
167
|
+
*/
|
|
168
|
+
this.align = null;
|
|
169
|
+
}
|
|
103
170
|
|
|
104
171
|
/**
|
|
105
|
-
*
|
|
172
|
+
* Get the last input on this row, if it has one.
|
|
173
|
+
* @return {InputConnection} The last input on the row,
|
|
174
|
+
* or null.
|
|
106
175
|
* @package
|
|
107
|
-
* @type {boolean}
|
|
108
176
|
*/
|
|
109
|
-
|
|
177
|
+
getLastInput() {
|
|
178
|
+
// TODO: Consider moving this to InputRow, if possible.
|
|
179
|
+
for (let i = this.elements.length - 1; i >= 0; i--) {
|
|
180
|
+
const elem = this.elements[i];
|
|
181
|
+
if (Types.isInput(elem)) {
|
|
182
|
+
return /** @type {InputConnection} */ (elem);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
110
187
|
|
|
111
188
|
/**
|
|
112
|
-
*
|
|
189
|
+
* Inspect all subcomponents and populate all size properties on the row.
|
|
113
190
|
* @package
|
|
114
|
-
* @type {boolean}
|
|
115
191
|
*/
|
|
116
|
-
|
|
192
|
+
measure() {
|
|
193
|
+
throw Error('Unexpected attempt to measure a base Row.');
|
|
194
|
+
}
|
|
117
195
|
|
|
118
196
|
/**
|
|
119
|
-
*
|
|
197
|
+
* Determines whether this row should start with an element spacer.
|
|
198
|
+
* @return {boolean} Whether the row should start with a spacer.
|
|
120
199
|
* @package
|
|
121
|
-
* @type {boolean}
|
|
122
200
|
*/
|
|
123
|
-
|
|
201
|
+
startsWithElemSpacer() {
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
124
204
|
|
|
125
205
|
/**
|
|
126
|
-
*
|
|
206
|
+
* Determines whether this row should end with an element spacer.
|
|
207
|
+
* @return {boolean} Whether the row should end with a spacer.
|
|
127
208
|
* @package
|
|
128
|
-
* @type {boolean}
|
|
129
209
|
*/
|
|
130
|
-
|
|
210
|
+
endsWithElemSpacer() {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
131
213
|
|
|
132
214
|
/**
|
|
133
|
-
*
|
|
215
|
+
* Convenience method to get the first spacer element on this row.
|
|
216
|
+
* @return {InRowSpacer} The first spacer element on
|
|
217
|
+
* this row.
|
|
134
218
|
* @package
|
|
135
|
-
* @type {boolean}
|
|
136
219
|
*/
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
this.notchOffset = this.constants_.NOTCH_OFFSET_LEFT;
|
|
220
|
+
getFirstSpacer() {
|
|
221
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
222
|
+
const elem = this.elements[i];
|
|
223
|
+
if (Types.isSpacer(elem)) {
|
|
224
|
+
return /** @type {InRowSpacer} */ (elem);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
147
229
|
|
|
148
230
|
/**
|
|
149
|
-
*
|
|
231
|
+
* Convenience method to get the last spacer element on this row.
|
|
232
|
+
* @return {InRowSpacer} The last spacer element on
|
|
233
|
+
* this row.
|
|
150
234
|
* @package
|
|
151
|
-
* @type {?number}
|
|
152
235
|
*/
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
* or null.
|
|
160
|
-
* @package
|
|
161
|
-
*/
|
|
162
|
-
// TODO: Consider moving this to InputRow, if possible.
|
|
163
|
-
Row.prototype.getLastInput = function() {
|
|
164
|
-
for (let i = this.elements.length - 1; i >= 0; i--) {
|
|
165
|
-
const elem = this.elements[i];
|
|
166
|
-
if (Types.isInput(elem)) {
|
|
167
|
-
return /** @type {InputConnection} */ (elem);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
return null;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Inspect all subcomponents and populate all size properties on the row.
|
|
175
|
-
* @package
|
|
176
|
-
*/
|
|
177
|
-
Row.prototype.measure = function() {
|
|
178
|
-
throw Error('Unexpected attempt to measure a base Row.');
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* Determines whether this row should start with an element spacer.
|
|
183
|
-
* @return {boolean} Whether the row should start with a spacer.
|
|
184
|
-
* @package
|
|
185
|
-
*/
|
|
186
|
-
Row.prototype.startsWithElemSpacer = function() {
|
|
187
|
-
return true;
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Determines whether this row should end with an element spacer.
|
|
192
|
-
* @return {boolean} Whether the row should end with a spacer.
|
|
193
|
-
* @package
|
|
194
|
-
*/
|
|
195
|
-
Row.prototype.endsWithElemSpacer = function() {
|
|
196
|
-
return true;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Convenience method to get the first spacer element on this row.
|
|
201
|
-
* @return {InRowSpacer} The first spacer element on
|
|
202
|
-
* this row.
|
|
203
|
-
* @package
|
|
204
|
-
*/
|
|
205
|
-
Row.prototype.getFirstSpacer = function() {
|
|
206
|
-
for (let i = 0; i < this.elements.length; i++) {
|
|
207
|
-
const elem = this.elements[i];
|
|
208
|
-
if (Types.isSpacer(elem)) {
|
|
209
|
-
return /** @type {InRowSpacer} */ (elem);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return null;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Convenience method to get the last spacer element on this row.
|
|
217
|
-
* @return {InRowSpacer} The last spacer element on
|
|
218
|
-
* this row.
|
|
219
|
-
* @package
|
|
220
|
-
*/
|
|
221
|
-
Row.prototype.getLastSpacer = function() {
|
|
222
|
-
for (let i = this.elements.length - 1; i >= 0; i--) {
|
|
223
|
-
const elem = this.elements[i];
|
|
224
|
-
if (Types.isSpacer(elem)) {
|
|
225
|
-
return /** @type {InRowSpacer} */ (elem);
|
|
236
|
+
getLastSpacer() {
|
|
237
|
+
for (let i = this.elements.length - 1; i >= 0; i--) {
|
|
238
|
+
const elem = this.elements[i];
|
|
239
|
+
if (Types.isSpacer(elem)) {
|
|
240
|
+
return /** @type {InRowSpacer} */ (elem);
|
|
241
|
+
}
|
|
226
242
|
}
|
|
243
|
+
return null;
|
|
227
244
|
}
|
|
228
|
-
|
|
229
|
-
};
|
|
245
|
+
}
|
|
230
246
|
|
|
231
247
|
exports.Row = Row;
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
goog.module('Blockly.blockRendering.SpacerRow');
|
|
16
16
|
|
|
17
|
-
const object = goog.require('Blockly.utils.object');
|
|
18
17
|
/* eslint-disable-next-line no-unused-vars */
|
|
19
18
|
const {ConstantProvider} = goog.requireType('Blockly.blockRendering.ConstantProvider');
|
|
20
19
|
const {InRowSpacer} = goog.require('Blockly.blockRendering.InRowSpacer');
|
|
@@ -24,31 +23,47 @@ const {Types} = goog.require('Blockly.blockRendering.Types');
|
|
|
24
23
|
|
|
25
24
|
/**
|
|
26
25
|
* An object containing information about a spacer between two rows.
|
|
27
|
-
* @param {!ConstantProvider} constants The rendering
|
|
28
|
-
* constants provider.
|
|
29
|
-
* @param {number} height The height of the spacer.
|
|
30
|
-
* @param {number} width The width of the spacer.
|
|
31
|
-
* @package
|
|
32
|
-
* @constructor
|
|
33
26
|
* @extends {Row}
|
|
27
|
+
* @struct
|
|
34
28
|
* @alias Blockly.blockRendering.SpacerRow
|
|
35
29
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
class SpacerRow extends Row {
|
|
31
|
+
/**
|
|
32
|
+
* @param {!ConstantProvider} constants The rendering
|
|
33
|
+
* constants provider.
|
|
34
|
+
* @param {number} height The height of the spacer.
|
|
35
|
+
* @param {number} width The width of the spacer.
|
|
36
|
+
* @package
|
|
37
|
+
*/
|
|
38
|
+
constructor(constants, height, width) {
|
|
39
|
+
super(constants);
|
|
40
|
+
this.type |= Types.SPACER | Types.BETWEEN_ROW_SPACER;
|
|
46
41
|
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
/** @type {number} */
|
|
43
|
+
this.width = width;
|
|
44
|
+
|
|
45
|
+
/** @type {number} */
|
|
46
|
+
this.height = height;
|
|
47
|
+
|
|
48
|
+
/** @type {boolean} */
|
|
49
|
+
this.followsStatement = false;
|
|
50
|
+
|
|
51
|
+
/** @type {boolean} */
|
|
52
|
+
this.precedesStatement = false;
|
|
53
|
+
|
|
54
|
+
/** @type {number} */
|
|
55
|
+
this.widthWithConnectedBlocks = 0;
|
|
56
|
+
|
|
57
|
+
/** @type {!Array.<!InRowSpacer>} */
|
|
58
|
+
this.elements = [new InRowSpacer(this.constants_, width)];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @override
|
|
63
|
+
*/
|
|
64
|
+
measure() {
|
|
65
|
+
// NOP. Width and height were set at creation.
|
|
66
|
+
}
|
|
67
|
+
}
|
|
53
68
|
|
|
54
69
|
exports.SpacerRow = SpacerRow;
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
goog.module('Blockly.blockRendering.SquareCorner');
|
|
18
18
|
|
|
19
|
-
const object = goog.require('Blockly.utils.object');
|
|
20
19
|
/* eslint-disable-next-line no-unused-vars */
|
|
21
20
|
const {ConstantProvider} = goog.requireType('Blockly.blockRendering.ConstantProvider');
|
|
22
21
|
const {Measurable} = goog.require('Blockly.blockRendering.Measurable');
|
|
@@ -26,23 +25,26 @@ const {Types} = goog.require('Blockly.blockRendering.Types');
|
|
|
26
25
|
/**
|
|
27
26
|
* An object containing information about the space a square corner takes up
|
|
28
27
|
* during rendering.
|
|
29
|
-
* @param {!ConstantProvider} constants The rendering
|
|
30
|
-
* constants provider.
|
|
31
|
-
* @param {string=} opt_position The position of this corner.
|
|
32
|
-
* @package
|
|
33
|
-
* @constructor
|
|
34
28
|
* @extends {Measurable}
|
|
29
|
+
* @struct
|
|
35
30
|
* @alias Blockly.blockRendering.SquareCorner
|
|
36
31
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
class SquareCorner extends Measurable {
|
|
33
|
+
/**
|
|
34
|
+
* @param {!ConstantProvider} constants The rendering
|
|
35
|
+
* constants provider.
|
|
36
|
+
* @param {string=} opt_position The position of this corner.
|
|
37
|
+
* @package
|
|
38
|
+
*/
|
|
39
|
+
constructor(constants, opt_position) {
|
|
40
|
+
super(constants);
|
|
41
|
+
this.type = ((!opt_position || opt_position === 'left') ?
|
|
42
|
+
Types.LEFT_SQUARE_CORNER :
|
|
43
|
+
Types.RIGHT_SQUARE_CORNER) |
|
|
44
|
+
Types.CORNER;
|
|
45
|
+
this.height = this.constants_.NO_PADDING;
|
|
46
|
+
this.width = this.constants_.NO_PADDING;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
47
49
|
|
|
48
50
|
exports.SquareCorner = SquareCorner;
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
*/
|
|
17
17
|
goog.module('Blockly.blockRendering.StatementInput');
|
|
18
18
|
|
|
19
|
-
const object = goog.require('Blockly.utils.object');
|
|
20
19
|
/* eslint-disable-next-line no-unused-vars */
|
|
21
20
|
const {ConstantProvider} = goog.requireType('Blockly.blockRendering.ConstantProvider');
|
|
22
21
|
const {InputConnection} = goog.require('Blockly.blockRendering.InputConnection');
|
|
@@ -28,29 +27,33 @@ const {Types} = goog.require('Blockly.blockRendering.Types');
|
|
|
28
27
|
/**
|
|
29
28
|
* An object containing information about the space a statement input takes up
|
|
30
29
|
* during rendering
|
|
31
|
-
* @
|
|
32
|
-
* constants provider.
|
|
33
|
-
* @param {!Input} input The statement input to measure and store
|
|
34
|
-
* information for.
|
|
35
|
-
* @package
|
|
36
|
-
* @constructor
|
|
30
|
+
* @struct
|
|
37
31
|
* @extends {InputConnection}
|
|
38
32
|
* @alias Blockly.blockRendering.StatementInput
|
|
39
33
|
*/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
class StatementInput extends InputConnection {
|
|
35
|
+
/**
|
|
36
|
+
* @param {!ConstantProvider} constants The rendering
|
|
37
|
+
* constants provider.
|
|
38
|
+
* @param {!Input} input The statement input to measure and store
|
|
39
|
+
* information for.
|
|
40
|
+
* @package
|
|
41
|
+
*/
|
|
42
|
+
constructor(constants, input) {
|
|
43
|
+
super(constants, input);
|
|
44
|
+
this.type |= Types.STATEMENT_INPUT;
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
if (!this.connectedBlock) {
|
|
47
|
+
this.height = this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT;
|
|
48
|
+
} else {
|
|
49
|
+
// We allow the dark path to show on the parent block so that the child
|
|
50
|
+
// block looks embossed. This takes up an extra pixel in both x and y.
|
|
51
|
+
this.height =
|
|
52
|
+
this.connectedBlockHeight + this.constants_.STATEMENT_BOTTOM_SPACER;
|
|
53
|
+
}
|
|
54
|
+
this.width =
|
|
55
|
+
this.constants_.STATEMENT_INPUT_NOTCH_OFFSET + this.shape.width;
|
|
51
56
|
}
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
object.inherits(StatementInput, InputConnection);
|
|
57
|
+
}
|
|
55
58
|
|
|
56
59
|
exports.StatementInput = StatementInput;
|