mirror of
https://github.com/google/blockly.git
synced 2025-12-16 06:10:12 +01:00
@@ -26,8 +26,8 @@ goog.require('Blockly.fieldRegistry');
|
||||
goog.require('Blockly.Input');
|
||||
goog.require('Blockly.Tooltip');
|
||||
goog.require('Blockly.utils');
|
||||
goog.require('Blockly.utils.deprecation');
|
||||
goog.require('Blockly.utils.Coordinate');
|
||||
goog.require('Blockly.utils.deprecation');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.utils.Size');
|
||||
goog.require('Blockly.utils.string');
|
||||
|
||||
@@ -17,6 +17,7 @@ goog.require('Blockly.utils.Svg');
|
||||
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
|
||||
|
||||
/**
|
||||
* PID of disconnect UI animation. There can only be one at a time.
|
||||
* @type {number}
|
||||
|
||||
@@ -15,8 +15,8 @@ goog.provide('Blockly.BlockDragger');
|
||||
goog.require('Blockly.blockAnimations');
|
||||
goog.require('Blockly.constants');
|
||||
goog.require('Blockly.Events');
|
||||
goog.require('Blockly.Events.BlockMove');
|
||||
goog.require('Blockly.Events.BlockDrag');
|
||||
goog.require('Blockly.Events.BlockMove');
|
||||
goog.require('Blockly.InsertionMarkerManager');
|
||||
goog.require('Blockly.utils.Coordinate');
|
||||
goog.require('Blockly.utils.dom');
|
||||
|
||||
@@ -29,8 +29,8 @@ goog.require('Blockly.TabNavigateCursor');
|
||||
goog.require('Blockly.Tooltip');
|
||||
goog.require('Blockly.Touch');
|
||||
goog.require('Blockly.utils');
|
||||
goog.require('Blockly.utils.deprecation');
|
||||
goog.require('Blockly.utils.Coordinate');
|
||||
goog.require('Blockly.utils.deprecation');
|
||||
goog.require('Blockly.utils.dom');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.utils.Rect');
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
*/
|
||||
goog.provide('Blockly');
|
||||
|
||||
goog.require('Blockly.constants');
|
||||
goog.require('Blockly.browserEvents');
|
||||
goog.require('Blockly.constants');
|
||||
goog.require('Blockly.Events');
|
||||
goog.require('Blockly.Events.BlockCreate');
|
||||
goog.require('Blockly.Events.FinishedLoading');
|
||||
goog.require('Blockly.Events.VarCreate');
|
||||
goog.require('Blockly.Events.Ui');
|
||||
goog.require('Blockly.Events.UiBase');
|
||||
goog.require('Blockly.Events.VarCreate');
|
||||
goog.require('Blockly.inject');
|
||||
goog.require('Blockly.Procedures');
|
||||
goog.require('Blockly.ShortcutRegistry');
|
||||
|
||||
@@ -21,6 +21,7 @@ goog.require('Blockly.Events');
|
||||
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
|
||||
|
||||
/** Option to undo previous action. */
|
||||
Blockly.ContextMenuItems.registerUndo = function() {
|
||||
/** @type {!Blockly.ContextMenuRegistry.RegistryItem} */
|
||||
|
||||
@@ -17,6 +17,7 @@ goog.require('Blockly.Events.UiBase');
|
||||
goog.require('Blockly.registry');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
|
||||
/**
|
||||
* Class for a selected event.
|
||||
* @param {?string=} opt_oldElementId The id of the previously selected
|
||||
|
||||
@@ -17,6 +17,7 @@ goog.require('Blockly.Events.UiBase');
|
||||
goog.require('Blockly.registry');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
|
||||
/**
|
||||
* Class for a theme change event.
|
||||
* @param {string=} opt_themeName The theme name. Undefined for a blank event.
|
||||
|
||||
@@ -17,6 +17,7 @@ goog.require('Blockly.Events.UiBase');
|
||||
goog.require('Blockly.registry');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
|
||||
/**
|
||||
* Class for a toolbox item select event.
|
||||
* @param {?string=} opt_oldItem The previously selected toolbox item. Undefined
|
||||
|
||||
@@ -17,6 +17,7 @@ goog.require('Blockly.Events.UiBase');
|
||||
goog.require('Blockly.registry');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
|
||||
/**
|
||||
* Class for a trashcan open event.
|
||||
* @param {boolean=} opt_isOpen Whether the trashcan flyout is opening (false if
|
||||
|
||||
@@ -17,6 +17,7 @@ goog.require('Blockly.Events.UiBase');
|
||||
goog.require('Blockly.registry');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
|
||||
/**
|
||||
* Class for a viewport change event.
|
||||
* @param {number=} opt_top Top-edge of the visible portion of the workspace,
|
||||
|
||||
@@ -29,6 +29,7 @@ goog.require('Blockly.utils.Size');
|
||||
|
||||
goog.requireType('Blockly.ShortcutRegistry');
|
||||
|
||||
|
||||
/**
|
||||
* Class for a colour input field.
|
||||
* @param {string=} opt_value The initial value of the field. Should be in
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
goog.provide('Blockly.Generator');
|
||||
|
||||
goog.require('Blockly.constants');
|
||||
goog.require('Blockly.Block');
|
||||
goog.require('Blockly.constants');
|
||||
|
||||
goog.requireType('Blockly.Names');
|
||||
goog.requireType('Blockly.Workspace');
|
||||
|
||||
@@ -15,8 +15,8 @@ goog.provide('Blockly.IFlyout');
|
||||
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
goog.requireType('Blockly.IRegistrable');
|
||||
goog.requireType('Blockly.utils.dom');
|
||||
goog.requireType('Blockly.utils.Coordinate');
|
||||
goog.requireType('Blockly.utils.dom');
|
||||
goog.requireType('Blockly.utils.Svg');
|
||||
goog.requireType('Blockly.utils.toolbox');
|
||||
goog.requireType('Blockly.WorkspaceSvg');
|
||||
|
||||
@@ -17,9 +17,9 @@ goog.requireType('Blockly.IFlyout');
|
||||
goog.requireType('Blockly.IToolbox');
|
||||
goog.requireType('Blockly.MetricsManager');
|
||||
goog.requireType('Blockly.utils.Metrics');
|
||||
goog.requireType('Blockly.utils.Size');
|
||||
goog.requireType('Blockly.utils.toolbox');
|
||||
|
||||
goog.requireType('Blockly.utils.Size');
|
||||
|
||||
/**
|
||||
* Interface for a metrics manager.
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
|
||||
goog.provide('Blockly.Options');
|
||||
|
||||
goog.require('Blockly.registry');
|
||||
goog.require('Blockly.Theme');
|
||||
goog.require('Blockly.Themes.Classic');
|
||||
goog.require('Blockly.registry');
|
||||
goog.require('Blockly.utils.IdGenerator');
|
||||
goog.require('Blockly.utils.Metrics');
|
||||
goog.require('Blockly.utils.toolbox');
|
||||
|
||||
@@ -14,16 +14,15 @@
|
||||
goog.provide('Blockly.registry');
|
||||
|
||||
goog.requireType('Blockly.blockRendering.Renderer');
|
||||
goog.requireType('Blockly.Cursor');
|
||||
goog.requireType('Blockly.Events.Abstract');
|
||||
goog.requireType('Blockly.Field');
|
||||
goog.requireType('Blockly.IConnectionChecker');
|
||||
goog.requireType('Blockly.IFlyout');
|
||||
goog.requireType('Blockly.IToolbox');
|
||||
goog.requireType('Blockly.Theme');
|
||||
|
||||
goog.requireType('Blockly.Cursor');
|
||||
goog.requireType('Blockly.MetricsManager');
|
||||
goog.requireType('Blockly.Options');
|
||||
goog.requireType('Blockly.Theme');
|
||||
goog.requireType('Blockly.ToolboxItem');
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ goog.requireType('Blockly.blockRendering.Debug');
|
||||
goog.requireType('Blockly.RenderedConnection');
|
||||
goog.requireType('Blockly.Theme');
|
||||
|
||||
|
||||
/**
|
||||
* An object that provides constants for rendering blocks.
|
||||
* @constructor
|
||||
|
||||
@@ -23,9 +23,9 @@ goog.require('Blockly.blockRendering.Types');
|
||||
goog.require('Blockly.utils.svgPaths');
|
||||
|
||||
goog.requireType('Blockly.blockRendering.ConstantProvider');
|
||||
goog.requireType('Blockly.blockRendering.Field');
|
||||
goog.requireType('Blockly.blockRendering.Icon');
|
||||
goog.requireType('Blockly.blockRendering.InlineInput');
|
||||
goog.requireType('Blockly.blockRendering.Field');
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
|
||||
goog.provide('Blockly.blockRendering.IPathObject');
|
||||
|
||||
goog.requireType('Blockly.Block');
|
||||
goog.requireType('Blockly.blockRendering.ConstantProvider');
|
||||
goog.requireType('Blockly.Theme');
|
||||
goog.requireType('Blockly.Block');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,8 +16,8 @@ goog.require('Blockly.blockRendering.BottomRow');
|
||||
goog.require('Blockly.blockRendering.ExternalValueInput');
|
||||
goog.require('Blockly.blockRendering.Hat');
|
||||
goog.require('Blockly.blockRendering.InlineInput');
|
||||
goog.require('Blockly.blockRendering.InRowSpacer');
|
||||
goog.require('Blockly.blockRendering.InputRow');
|
||||
goog.require('Blockly.blockRendering.InRowSpacer');
|
||||
goog.require('Blockly.blockRendering.Measurable');
|
||||
goog.require('Blockly.blockRendering.NextConnection');
|
||||
goog.require('Blockly.blockRendering.OutputConnection');
|
||||
@@ -25,8 +25,8 @@ goog.require('Blockly.blockRendering.PreviousConnection');
|
||||
goog.require('Blockly.blockRendering.RoundCorner');
|
||||
goog.require('Blockly.blockRendering.Row');
|
||||
goog.require('Blockly.blockRendering.SpacerRow');
|
||||
goog.require('Blockly.blockRendering.StatementInput');
|
||||
goog.require('Blockly.blockRendering.SquareCorner');
|
||||
goog.require('Blockly.blockRendering.StatementInput');
|
||||
goog.require('Blockly.blockRendering.TopRow');
|
||||
goog.require('Blockly.blockRendering.Types');
|
||||
goog.require('Blockly.constants');
|
||||
|
||||
@@ -15,8 +15,8 @@ goog.provide('Blockly.blockRendering.Renderer');
|
||||
goog.require('Blockly.blockRendering.ConstantProvider');
|
||||
goog.require('Blockly.blockRendering.Debug');
|
||||
goog.require('Blockly.blockRendering.Drawer');
|
||||
goog.require('Blockly.blockRendering.MarkerSvg');
|
||||
goog.require('Blockly.blockRendering.IPathObject');
|
||||
goog.require('Blockly.blockRendering.MarkerSvg');
|
||||
goog.require('Blockly.blockRendering.PathObject');
|
||||
goog.require('Blockly.blockRendering.RenderInfo');
|
||||
goog.require('Blockly.constants');
|
||||
|
||||
@@ -19,8 +19,8 @@ goog.require('Blockly.geras.RenderInfo');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.utils.svgPaths');
|
||||
|
||||
goog.requireType('Blockly.geras.PathObject');
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
goog.requireType('Blockly.geras.PathObject');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,29 +15,29 @@ goog.provide('Blockly.geras');
|
||||
goog.provide('Blockly.geras.RenderInfo');
|
||||
|
||||
goog.require('Blockly.blockRendering.BottomRow');
|
||||
goog.require('Blockly.blockRendering.BottomRow');
|
||||
goog.require('Blockly.blockRendering.ExternalValueInput');
|
||||
goog.require('Blockly.blockRendering.InputRow');
|
||||
goog.require('Blockly.blockRendering.InputRow');
|
||||
goog.require('Blockly.blockRendering.InRowSpacer');
|
||||
goog.require('Blockly.blockRendering.Measurable');
|
||||
goog.require('Blockly.blockRendering.NextConnection');
|
||||
goog.require('Blockly.blockRendering.OutputConnection');
|
||||
goog.require('Blockly.blockRendering.PreviousConnection');
|
||||
goog.require('Blockly.blockRendering.RenderInfo');
|
||||
goog.require('Blockly.blockRendering.BottomRow');
|
||||
goog.require('Blockly.blockRendering.InputRow');
|
||||
goog.require('Blockly.blockRendering.Measurable');
|
||||
goog.require('Blockly.blockRendering.NextConnection');
|
||||
goog.require('Blockly.blockRendering.NextConnection');
|
||||
goog.require('Blockly.blockRendering.OutputConnection');
|
||||
goog.require('Blockly.blockRendering.OutputConnection');
|
||||
goog.require('Blockly.blockRendering.PreviousConnection');
|
||||
goog.require('Blockly.blockRendering.PreviousConnection');
|
||||
goog.require('Blockly.blockRendering.RenderInfo');
|
||||
goog.require('Blockly.blockRendering.Types');
|
||||
goog.require('Blockly.blockRendering.ExternalValueInput');
|
||||
goog.require('Blockly.constants');
|
||||
goog.require('Blockly.geras.InlineInput');
|
||||
goog.require('Blockly.geras.StatementInput');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
goog.requireType('Blockly.geras.Renderer');
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
goog.requireType('Blockly.blockRendering.Field');
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
goog.requireType('Blockly.geras.Renderer');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
goog.provide('Blockly.geras.InlineInput');
|
||||
goog.provide('Blockly.geras.StatementInput');
|
||||
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.blockRendering.InlineInput');
|
||||
goog.require('Blockly.blockRendering.StatementInput');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
goog.requireType('Blockly.blockRendering.ConstantProvider');
|
||||
goog.requireType('Blockly.Input');
|
||||
|
||||
@@ -21,13 +21,12 @@ goog.require('Blockly.geras.PathObject');
|
||||
goog.require('Blockly.geras.RenderInfo');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
goog.requireType('Blockly.blockRendering.RenderInfo');
|
||||
goog.requireType('Blockly.blockRendering.ConstantProvider');
|
||||
goog.requireType('Blockly.blockRendering.RenderInfo');
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
goog.requireType('Blockly.Theme');
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The geras renderer.
|
||||
* @param {string} name The renderer name.
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
goog.provide('Blockly.minimalist.Drawer');
|
||||
|
||||
goog.require('Blockly.blockRendering.Drawer');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.minimalist.RenderInfo');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,10 +13,10 @@ goog.provide('Blockly.minimalist.Renderer');
|
||||
|
||||
goog.require('Blockly.blockRendering');
|
||||
goog.require('Blockly.blockRendering.Renderer');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.minimalist.ConstantProvider');
|
||||
goog.require('Blockly.minimalist.Drawer');
|
||||
goog.require('Blockly.minimalist.RenderInfo');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,8 +17,8 @@ goog.provide('Blockly.thrasos.RenderInfo');
|
||||
goog.require('Blockly.blockRendering.BottomRow');
|
||||
goog.require('Blockly.blockRendering.ExternalValueInput');
|
||||
goog.require('Blockly.blockRendering.InlineInput');
|
||||
goog.require('Blockly.blockRendering.InRowSpacer');
|
||||
goog.require('Blockly.blockRendering.InputRow');
|
||||
goog.require('Blockly.blockRendering.InRowSpacer');
|
||||
goog.require('Blockly.blockRendering.Measurable');
|
||||
goog.require('Blockly.blockRendering.NextConnection');
|
||||
goog.require('Blockly.blockRendering.OutputConnection');
|
||||
|
||||
@@ -19,8 +19,8 @@ goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.utils.svgPaths');
|
||||
goog.require('Blockly.zelos.RenderInfo');
|
||||
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
goog.requireType('Blockly.blockRendering.Row');
|
||||
goog.requireType('Blockly.BlockSvg');
|
||||
goog.requireType('Blockly.zelos.PathObject');
|
||||
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ goog.require('Blockly.blockRendering.PreviousConnection');
|
||||
goog.require('Blockly.blockRendering.RenderInfo');
|
||||
goog.require('Blockly.blockRendering.RoundCorner');
|
||||
goog.require('Blockly.blockRendering.Row');
|
||||
goog.require('Blockly.blockRendering.SquareCorner');
|
||||
goog.require('Blockly.blockRendering.SpacerRow');
|
||||
goog.require('Blockly.blockRendering.SquareCorner');
|
||||
goog.require('Blockly.blockRendering.TopRow');
|
||||
goog.require('Blockly.blockRendering.Types');
|
||||
goog.require('Blockly.constants');
|
||||
|
||||
@@ -15,8 +15,8 @@ goog.provide('Blockly.zelos.BottomRow');
|
||||
goog.provide('Blockly.zelos.TopRow');
|
||||
|
||||
goog.require('Blockly.blockRendering.BottomRow');
|
||||
goog.require('Blockly.blockRendering.TopRow');
|
||||
goog.require('Blockly.blockRendering.SpacerRow');
|
||||
goog.require('Blockly.blockRendering.TopRow');
|
||||
goog.require('Blockly.utils.object');
|
||||
|
||||
goog.requireType('Blockly.blockRendering.ConstantProvider');
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
goog.provide('Blockly.zelos.PathObject');
|
||||
|
||||
goog.require('Blockly.blockRendering.PathObject');
|
||||
goog.require('Blockly.zelos.ConstantProvider');
|
||||
goog.require('Blockly.utils.dom');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.utils.Svg');
|
||||
goog.require('Blockly.zelos.ConstantProvider');
|
||||
|
||||
goog.requireType('Blockly.Theme');
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ goog.require('Blockly.InsertionMarkerManager');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.zelos.ConstantProvider');
|
||||
goog.require('Blockly.zelos.Drawer');
|
||||
goog.require('Blockly.zelos.MarkerSvg');
|
||||
goog.require('Blockly.zelos.PathObject');
|
||||
goog.require('Blockly.zelos.RenderInfo');
|
||||
goog.require('Blockly.zelos.MarkerSvg');
|
||||
|
||||
goog.requireType('Blockly.blockRendering.MarkerSvg');
|
||||
goog.requireType('Blockly.blockRendering.RenderInfo');
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
goog.provide('Blockly.ToolboxCategory');
|
||||
|
||||
goog.require('Blockly.registry');
|
||||
goog.require('Blockly.ToolboxItem');
|
||||
goog.require('Blockly.utils');
|
||||
goog.require('Blockly.utils.aria');
|
||||
goog.require('Blockly.utils.dom');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.utils.toolbox');
|
||||
goog.require('Blockly.ToolboxItem');
|
||||
|
||||
goog.requireType('Blockly.ICollapsibleToolboxItem');
|
||||
goog.requireType('Blockly.IToolbox');
|
||||
|
||||
@@ -14,12 +14,12 @@ goog.provide('Blockly.CollapsibleToolboxCategory');
|
||||
|
||||
goog.require('Blockly.registry');
|
||||
goog.require('Blockly.ToolboxCategory');
|
||||
goog.require('Blockly.ToolboxItem');
|
||||
goog.require('Blockly.ToolboxSeparator');
|
||||
goog.require('Blockly.utils.aria');
|
||||
goog.require('Blockly.utils.dom');
|
||||
goog.require('Blockly.utils.object');
|
||||
goog.require('Blockly.utils.toolbox');
|
||||
goog.require('Blockly.ToolboxItem');
|
||||
|
||||
goog.requireType('Blockly.ICollapsibleToolboxItem');
|
||||
goog.requireType('Blockly.IToolbox');
|
||||
|
||||
@@ -26,10 +26,10 @@ goog.require('Blockly.utils.dom');
|
||||
goog.require('Blockly.utils.Rect');
|
||||
goog.require('Blockly.utils.toolbox');
|
||||
|
||||
goog.requireType('Blockly.IKeyboardAccessible');
|
||||
goog.requireType('Blockly.ICollapsibleToolboxItem');
|
||||
goog.requireType('Blockly.IDeleteArea');
|
||||
goog.requireType('Blockly.IFlyout');
|
||||
goog.requireType('Blockly.IKeyboardAccessible');
|
||||
goog.requireType('Blockly.ISelectableToolboxItem');
|
||||
goog.requireType('Blockly.IStyleable');
|
||||
goog.requireType('Blockly.IToolbox');
|
||||
|
||||
@@ -18,6 +18,7 @@ goog.requireType('Blockly.IToolboxItem');
|
||||
goog.requireType('Blockly.utils.toolbox');
|
||||
goog.requireType('Blockly.WorkspaceSvg');
|
||||
|
||||
|
||||
/**
|
||||
* Class for an item in the toolbox.
|
||||
* @param {!Blockly.utils.toolbox.ToolboxItemInfo} toolboxItemDef The JSON defining the
|
||||
|
||||
@@ -24,6 +24,7 @@ goog.provide('Blockly.Tooltip');
|
||||
goog.require('Blockly.browserEvents');
|
||||
goog.require('Blockly.utils.string');
|
||||
|
||||
|
||||
/**
|
||||
* A type which can define a tooltip.
|
||||
* Either a string, an object containing a tooltip property, or a function which
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
*/
|
||||
goog.provide('Blockly.utils');
|
||||
|
||||
goog.require('Blockly.Msg');
|
||||
goog.require('Blockly.constants');
|
||||
goog.require('Blockly.Msg');
|
||||
goog.require('Blockly.utils.colour');
|
||||
goog.require('Blockly.utils.Coordinate');
|
||||
goog.require('Blockly.utils.global');
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
goog.provide('Blockly.VariablesDynamic');
|
||||
|
||||
goog.require('Blockly.Variables');
|
||||
goog.require('Blockly.Blocks');
|
||||
goog.require('Blockly.Msg');
|
||||
goog.require('Blockly.utils.xml');
|
||||
goog.require('Blockly.VariableModel');
|
||||
goog.require('Blockly.Variables');
|
||||
|
||||
goog.requireType('Blockly.Workspace');
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ goog.requireType('Blockly.IBoundedElement');
|
||||
goog.requireType('Blockly.IBubble');
|
||||
goog.requireType('Blockly.ICopyable');
|
||||
|
||||
|
||||
/**
|
||||
* Class for a workspace comment's SVG representation.
|
||||
* @param {!Blockly.Workspace} workspace The block's workspace.
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
|
||||
goog.provide('Blockly.WorkspaceSvg');
|
||||
|
||||
goog.require('Blockly.BlockSvg');
|
||||
goog.require('Blockly.blockRendering');
|
||||
goog.require('Blockly.BlockSvg');
|
||||
goog.require('Blockly.browserEvents');
|
||||
goog.require('Blockly.ConnectionDB');
|
||||
goog.require('Blockly.constants');
|
||||
goog.require('Blockly.ContextMenuRegistry');
|
||||
goog.require('Blockly.browserEvents');
|
||||
goog.require('Blockly.Events');
|
||||
goog.require('Blockly.Events.BlockCreate');
|
||||
goog.require('Blockly.Events.ThemeChange');
|
||||
|
||||
@@ -28,8 +28,8 @@ goog.requireType('Blockly.Block');
|
||||
goog.requireType('Blockly.Comment');
|
||||
goog.requireType('Blockly.Connection');
|
||||
goog.requireType('Blockly.Field');
|
||||
goog.requireType('Blockly.Workspace');
|
||||
goog.requireType('Blockly.VariableModel');
|
||||
goog.requireType('Blockly.Workspace');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,6 +24,7 @@ goog.require('Blockly.utils.Svg');
|
||||
|
||||
goog.requireType('Blockly.WorkspaceSvg');
|
||||
|
||||
|
||||
/**
|
||||
* Class for a zoom controls.
|
||||
* @param {!Blockly.WorkspaceSvg} workspace The workspace to sit in.
|
||||
|
||||
@@ -18,6 +18,7 @@ var gitTasks = require('./scripts/gulpfiles/git_tasks');
|
||||
var licenseTasks = require('./scripts/gulpfiles/license_tasks');
|
||||
var appengineTasks = require('./scripts/gulpfiles/appengine_tasks');
|
||||
var releaseTasks = require('./scripts/gulpfiles/release_tasks');
|
||||
var cleanupTasks = require('./scripts/gulpfiles/cleanup_tasks');
|
||||
|
||||
module.exports = {
|
||||
deployDemos: appengineTasks.deployDemos,
|
||||
@@ -40,4 +41,5 @@ module.exports = {
|
||||
recompile: releaseTasks.recompile,
|
||||
publish: releaseTasks.publish,
|
||||
publishBeta: releaseTasks.publishBeta,
|
||||
sortRequires: cleanupTasks.sortRequires,
|
||||
};
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
"bump": "npm --no-git-tag-version version 4.$(date +'%Y%m%d').0",
|
||||
"deployDemos": "gulp deployDemos",
|
||||
"format": "git-clang-format",
|
||||
"format:sortrequires": "gulp sortRequires",
|
||||
"license": "gulp checkLicenses",
|
||||
"lint": "eslint .",
|
||||
"package": "gulp package",
|
||||
|
||||
85
scripts/gulpfiles/cleanup_tasks.js
Normal file
85
scripts/gulpfiles/cleanup_tasks.js
Normal file
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2018 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @fileoverview Gulp tasks to complete various clean up tasks.
|
||||
*/
|
||||
|
||||
const gulp = require('gulp');
|
||||
const path = require('path');
|
||||
const through2 = require('through2');
|
||||
|
||||
/**
|
||||
* Sorts goog.requires in core, blocks and generators.
|
||||
*/
|
||||
function sortRequires() {
|
||||
const srcs = ['core/**/**/*.js', 'blocks/*.js', 'generators/**/*.js'];
|
||||
const excludes = ['core/requires.js'];
|
||||
return gulp.src(srcs, {base: './'})
|
||||
.pipe(through2.obj((file, _enc, next) => {
|
||||
if (file.isNull() || file.isDirectory()) {
|
||||
next(null, file);
|
||||
return;
|
||||
}
|
||||
|
||||
if (file.extname !== '.js' && path.extname(file.history[0]) !== '.js') {
|
||||
next(null, file);
|
||||
return;
|
||||
}
|
||||
|
||||
const relPath = path.relative(path.join(file.cwd, file.base), file.path);
|
||||
if (excludes.indexOf(relPath) > -1) {
|
||||
next(null, file);
|
||||
return;
|
||||
}
|
||||
|
||||
const contents = file.contents.toString();
|
||||
|
||||
// Capture requires.
|
||||
const re = /goog\.(require|requireType)\('(.*)'\);/gm;
|
||||
const requiresList = [];
|
||||
const requireTypesList = [];
|
||||
let firstIndex;
|
||||
let lastIndex;
|
||||
while ((match = re.exec(contents)) != null) {
|
||||
if (match[1] == 'require') requiresList.push(match[2]);
|
||||
if (match[1] == 'requireType') requireTypesList.push(match[2]);
|
||||
if (firstIndex == undefined) {
|
||||
firstIndex = match.index;
|
||||
} else {
|
||||
lastIndex = re.lastIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort requires.
|
||||
requiresList.sort(
|
||||
(a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
||||
requireTypesList.sort(
|
||||
(a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
||||
|
||||
// Replace in file.
|
||||
const requiresSection = requiresList.length ?
|
||||
requiresList.map(r => `goog.require('${r}');`).join('\n') + '\n\n' :
|
||||
'';
|
||||
const requireTypesSection = requireTypesList.length ?
|
||||
requireTypesList.map(r => `goog.requireType('${r}');`).join('\n') +
|
||||
'\n\n' :
|
||||
'';
|
||||
const requires = `${requiresSection}${requireTypesSection}\n`;
|
||||
|
||||
if (firstIndex != undefined & lastIndex != undefined) {
|
||||
file.contents = Buffer.from(
|
||||
contents.substring(0, firstIndex) + requires +
|
||||
contents.substring(lastIndex).trimStart());
|
||||
}
|
||||
next(null, file);
|
||||
}))
|
||||
.pipe(gulp.dest('./'));
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
sortRequires: sortRequires
|
||||
};
|
||||
Reference in New Issue
Block a user