Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions core/block_animations.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
goog.module('Blockly.blockAnimations');
goog.module.declareLegacyNamespace();

/* eslint-disable-next-line no-unused-vars */
const BlockSvg = goog.requireType('Blockly.BlockSvg');
const dom = goog.require('Blockly.utils.dom');
const Svg = goog.require('Blockly.utils.Svg');
const dom = goog.require('Blockly.utils.dom');


/**
Expand All @@ -34,7 +35,7 @@ let disconnectGroup = null;
* Play some UI effects (sound, animation) when disposing of a block.
* @param {!BlockSvg} block The block being disposed of.
*/
function disposeUiEffect(block) {
const disposeUiEffect = function(block) {
const workspace = block.workspace;
const svgGroup = block.getSvgRoot();
workspace.getAudioManager().play('delete');
Expand All @@ -49,7 +50,7 @@ function disposeUiEffect(block) {
clone.bBox_ = clone.getBBox();
// Start the animation.
disposeUiStep(clone, workspace.RTL, new Date, workspace.scale);
}
};
/** @package */
exports.disposeUiEffect = disposeUiEffect;

Expand All @@ -62,7 +63,7 @@ exports.disposeUiEffect = disposeUiEffect;
* @param {!Date} start Date of animation's start.
* @param {number} workspaceScale Scale of workspace.
*/
function disposeUiStep(clone, rtl, start, workspaceScale) {
const disposeUiStep = function(clone, rtl, start, workspaceScale) {
const ms = new Date - start;
const percent = ms / 150;
if (percent > 1) {
Expand All @@ -78,13 +79,13 @@ function disposeUiStep(clone, rtl, start, workspaceScale) {
' scale(' + scale + ')');
setTimeout(disposeUiStep, 10, clone, rtl, start, workspaceScale);
}
}
};

/**
* Play some UI effects (sound, ripple) after a connection has been established.
* @param {!BlockSvg} block The block being connected.
*/
function connectionUiEffect(block) {
const connectionUiEffect = function(block) {
const workspace = block.workspace;
const scale = workspace.scale;
workspace.getAudioManager().play('click');
Expand Down Expand Up @@ -113,7 +114,7 @@ function connectionUiEffect(block) {
workspace.getParentSvg());
// Start the animation.
connectionUiStep(ripple, new Date, scale);
}
};
/** @package */
exports.connectionUiEffect = connectionUiEffect;

Expand All @@ -123,7 +124,7 @@ exports.connectionUiEffect = connectionUiEffect;
* @param {!Date} start Date of animation's start.
* @param {number} scale Scale of workspace.
*/
function connectionUiStep(ripple, start, scale) {
const connectionUiStep = function(ripple, start, scale) {
const ms = new Date - start;
const percent = ms / 150;
if (percent > 1) {
Expand All @@ -133,13 +134,13 @@ function connectionUiStep(ripple, start, scale) {
ripple.style.opacity = 1 - percent;
disconnectPid = setTimeout(connectionUiStep, 10, ripple, start, scale);
}
}
};

/**
* Play some UI effects (sound, animation) when disconnecting a block.
* @param {!BlockSvg} block The block being disconnected.
*/
function disconnectUiEffect(block) {
const disconnectUiEffect = function(block) {
block.workspace.getAudioManager().play('disconnect');
if (block.workspace.scale < 1) {
return; // Too small to care about visual effects.
Expand All @@ -154,7 +155,7 @@ function disconnectUiEffect(block) {
}
// Start the animation.
disconnectUiStep(block.getSvgRoot(), magnitude, new Date);
}
};
/** @package */
exports.disconnectUiEffect = disconnectUiEffect;

Expand All @@ -164,7 +165,7 @@ exports.disconnectUiEffect = disconnectUiEffect;
* @param {number} magnitude Maximum degrees skew (reversed for RTL).
* @param {!Date} start Date of animation's start.
*/
function disconnectUiStep(group, magnitude, start) {
const disconnectUiStep = function(group, magnitude, start) {
const DURATION = 200; // Milliseconds.
const WIGGLES = 3; // Half oscillations.

Expand All @@ -181,19 +182,19 @@ function disconnectUiStep(group, magnitude, start) {
disconnectPid = setTimeout(disconnectUiStep, 10, group, magnitude, start);
}
group.setAttribute('transform', group.translate_ + group.skew_);
}
};

/**
* Stop the disconnect UI animation immediately.
*/
function disconnectUiStop() {
const disconnectUiStop = function() {
if (disconnectGroup) {
clearTimeout(disconnectPid);
const group = disconnectGroup;
group.skew_ = '';
group.setAttribute('transform', group.translate_);
disconnectGroup = null;
}
}
};
/** @package */
exports.disconnectUiStop = disconnectUiStop;
2 changes: 1 addition & 1 deletion core/block_drag_surface.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ goog.module.declareLegacyNamespace();

const Coordinate = goog.require('Blockly.utils.Coordinate');
const {G, SVG} = goog.require('Blockly.utils.Svg');
const {getRelativeXY} = goog.require('Blockly.utils');
const {createSvgElement, HTML_NS, setCssTransform, SVG_NS, XLINK_NS} = goog.require('Blockly.utils.dom');
const {getRelativeXY} = goog.require('Blockly.utils');


/**
Expand Down
11 changes: 8 additions & 3 deletions core/bubble_dragger.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,26 @@
goog.module('Blockly.BubbleDragger');
goog.module.declareLegacyNamespace();

/* eslint-disable-next-line no-unused-vars */
const BlockDragSurfaceSvg = goog.requireType('Blockly.BlockDragSurfaceSvg');
const ComponentManager = goog.require('Blockly.ComponentManager');
const Coordinate = goog.require('Blockly.utils.Coordinate');
const Events = goog.require('Blockly.Events');
/* eslint-disable-next-line no-unused-vars */
const IBubble = goog.requireType('Blockly.IBubble');
/* eslint-disable-next-line no-unused-vars */
const IDeleteArea = goog.requireType('Blockly.IDeleteArea');
/* eslint-disable-next-line no-unused-vars */
const IDragTarget = goog.requireType('Blockly.IDragTarget');
const utils = goog.require('Blockly.utils');
/* eslint-disable-next-line no-unused-vars */
const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg');
const utils = goog.require('Blockly.utils');
/** @suppress {extraRequire} */
goog.require('Blockly.Bubble');
/** @suppress {extraRequire} */
goog.require('Blockly.constants');
/** @suppress {extraRequire} */
goog.require('Blockly.Events.CommentMove');
/** @suppress {extraRequire} */
goog.require('Blockly.constants');


/**
Expand Down
6 changes: 6 additions & 0 deletions core/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,22 @@
goog.module('Blockly.Comment');
goog.module.declareLegacyNamespace();

/* eslint-disable-next-line no-unused-vars */
const Block = goog.requireType('Blockly.Block');
/* eslint-disable-next-line no-unused-vars */
const BlockSvg = goog.requireType('Blockly.BlockSvg');
const Bubble = goog.require('Blockly.Bubble');
/* eslint-disable-next-line no-unused-vars */
const Coordinate = goog.requireType('Blockly.utils.Coordinate');
const Events = goog.require('Blockly.Events');
const Icon = goog.require('Blockly.Icon');
/* eslint-disable-next-line no-unused-vars */
const Size = goog.requireType('Blockly.utils.Size');
const Svg = goog.require('Blockly.utils.Svg');
/* eslint-disable-next-line no-unused-vars */
const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg');
const userAgent = goog.require('Blockly.utils.userAgent');
/* eslint-disable-next-line no-unused-vars */
const {conditionalBind, Data, unbind} = goog.require('Blockly.browserEvents');
const {createSvgElement, HTML_NS} = goog.require('Blockly.utils.dom');
const {inherits} = goog.require('Blockly.utils.object');
Expand Down
5 changes: 5 additions & 0 deletions core/component_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@
goog.module('Blockly.ComponentManager');
goog.module.declareLegacyNamespace();

/* eslint-disable-next-line no-unused-vars */
const IAutoHideable = goog.requireType('Blockly.IAutoHideable');
/* eslint-disable-next-line no-unused-vars */
const IComponent = goog.requireType('Blockly.IComponent');
/* eslint-disable-next-line no-unused-vars */
const IDeleteArea = goog.requireType('Blockly.IDeleteArea');
/* eslint-disable-next-line no-unused-vars */
const IDragTarget = goog.requireType('Blockly.IDragTarget');
/* eslint-disable-next-line no-unused-vars */
const IPositionable = goog.requireType('Blockly.IPositionable');


Expand Down
8 changes: 6 additions & 2 deletions core/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@
goog.module('Blockly.Connection');
goog.module.declareLegacyNamespace();

const connectionTypes = goog.require('Blockly.connectionTypes');
/* eslint-disable-next-line no-unused-vars */
const Block = goog.requireType('Blockly.Block');
const deprecation = goog.require('Blockly.utils.deprecation');
const Events = goog.require('Blockly.Events');
/* eslint-disable-next-line no-unused-vars */
const IASTNodeLocationWithBlock = goog.require('Blockly.IASTNodeLocationWithBlock');
/* eslint-disable-next-line no-unused-vars */
const IConnectionChecker = goog.requireType('Blockly.IConnectionChecker');
/* eslint-disable-next-line no-unused-vars */
const Input = goog.requireType('Blockly.Input');
const Xml = goog.require('Blockly.Xml');
const connectionTypes = goog.require('Blockly.connectionTypes');
const deprecation = goog.require('Blockly.utils.deprecation');
/** @suppress {extraRequire} */
goog.require('Blockly.constants');
/** @suppress {extraRequire} */
Expand Down
2 changes: 2 additions & 0 deletions core/connection_checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ goog.module('Blockly.ConnectionChecker');
goog.module.declareLegacyNamespace();

const Connection = goog.require('Blockly.Connection');
/* eslint-disable-next-line no-unused-vars */
const IConnectionChecker = goog.require('Blockly.IConnectionChecker');
/* eslint-disable-next-line no-unused-vars */
const RenderedConnection = goog.requireType('Blockly.RenderedConnection');
const connectionTypes = goog.require('Blockly.connectionTypes');
const registry = goog.require('Blockly.registry');
Expand Down
3 changes: 3 additions & 0 deletions core/connection_db.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
goog.module('Blockly.ConnectionDB');
goog.module.declareLegacyNamespace();

/* eslint-disable-next-line no-unused-vars */
const Coordinate = goog.requireType('Blockly.utils.Coordinate');
/* eslint-disable-next-line no-unused-vars */
const IConnectionChecker = goog.requireType('Blockly.IConnectionChecker');
/* eslint-disable-next-line no-unused-vars */
const RenderedConnection = goog.require('Blockly.RenderedConnection');
const connectionTypes = goog.require('Blockly.connectionTypes');
/** @suppress {extraRequire} */
Expand Down
9 changes: 3 additions & 6 deletions core/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const register = function(cssArray) {
Array.prototype.push.apply(CONTENT, cssArray);
cssArray.length = 0; // Garbage collect provided CSS content.
};
exports.register = register;

/**
* Inject the CSS into the DOM. This is preferable over using a regular CSS
Expand Down Expand Up @@ -72,6 +73,7 @@ const inject = function(hasCss, pathToMedia) {
cssNode.appendChild(cssTextNode);
document.head.insertBefore(cssNode, document.head.firstChild);
};
exports.inject = inject;

/**
* Array making up the CSS content for Blockly.
Expand Down Expand Up @@ -553,9 +555,4 @@ const CONTENT = [
margin-right: -24px;
}`,
];

exports = {
register,
inject,
CONTENT
};
exports.CONTENT = CONTENT;
20 changes: 9 additions & 11 deletions core/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
goog.module('Blockly.Extensions');
goog.module.declareLegacyNamespace();

/* eslint-disable-next-line no-unused-vars */
const Block = goog.requireType('Blockly.Block');
const {checkMessageReferences, replaceMessageReferences, runAfterPageLoad} = goog.require('Blockly.utils');

Expand All @@ -29,6 +30,7 @@ const {checkMessageReferences, replaceMessageReferences, runAfterPageLoad} = goo
* @private
*/
const allExtensions = Object.create(null);
exports.ALL_ = allExtensions;

/**
* Registers a new extension function. Extensions are functions that help
Expand All @@ -52,6 +54,7 @@ const register = function(name, initFn) {
}
allExtensions[name] = initFn;
};
exports.register = register;

/**
* Registers a new extension function that adds all key/value of mixinObj.
Expand All @@ -68,6 +71,7 @@ const registerMixin = function(name, mixinObj) {
this.mixin(mixinObj);
});
};
exports.registerMixin = registerMixin;

/**
* Registers a new extension function that adds a mutator to the block.
Expand Down Expand Up @@ -111,6 +115,7 @@ const registerMutator = function(name, mixinObj, opt_helperFn, opt_blockList) {
}
});
};
exports.registerMutator = registerMutator;

/**
* Unregisters the extension registered with the given name.
Expand All @@ -124,6 +129,7 @@ const unregister = function(name) {
'No extension mapping for name "' + name + '" found to unregister');
}
};
exports.unregister = unregister;

/**
* Applies an extension method to a block. This should only be called during
Expand Down Expand Up @@ -161,6 +167,7 @@ const apply = function(name, block, isMutator) {
}
}
};
exports.apply = apply;

/**
* Check that the given value is a function.
Expand Down Expand Up @@ -366,6 +373,7 @@ const buildTooltipForDropdown = function(dropdownName, lookupTable) {
};
return extensionFn;
};
exports.buildTooltipForDropdown = buildTooltipForDropdown;

/**
* Checks all options keys are present in the provided string lookup table.
Expand Down Expand Up @@ -425,6 +433,7 @@ const buildTooltipWithFieldText = function(msgTemplate, fieldName) {
};
return extensionFn;
};
exports.buildTooltipWithFieldText = buildTooltipWithFieldText;

/**
* Configures the tooltip to mimic the parent block when connected. Otherwise,
Expand All @@ -443,14 +452,3 @@ const extensionParentTooltip = function() {
}.bind(this));
};
register('parent_tooltip_when_inline', extensionParentTooltip);

exports = {
ALL_: allExtensions,
register,
registerMixin,
registerMutator,
unregister,
apply,
buildTooltipForDropdown,
buildTooltipWithFieldText
};
1 change: 1 addition & 0 deletions core/interfaces/i_ast_node_location_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
goog.module('Blockly.IASTNodeLocationSvg');
goog.module.declareLegacyNamespace();

/* eslint-disable-next-line no-unused-vars */
const IASTNodeLocation = goog.require('Blockly.IASTNodeLocation');


Expand Down
2 changes: 2 additions & 0 deletions core/interfaces/i_ast_node_location_with_block.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
goog.module('Blockly.IASTNodeLocationWithBlock');
goog.module.declareLegacyNamespace();

/* eslint-disable-next-line no-unused-vars */
const Block = goog.requireType('Blockly.Block');
/* eslint-disable-next-line no-unused-vars */
const IASTNodeLocation = goog.require('Blockly.IASTNodeLocation');


Expand Down
1 change: 1 addition & 0 deletions core/interfaces/i_autohideable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
goog.module('Blockly.IAutoHideable');
goog.module.declareLegacyNamespace();

/* eslint-disable-next-line no-unused-vars */
const IComponent = goog.require('Blockly.IComponent');


Expand Down
Loading