mirror of
https://github.com/google/blockly.git
synced 2026-01-07 09:00:11 +01:00
Changes Css.register API to accept string param (#5472)
* Chnages Css.register API to accept string param * Address self review comments and nits * Fix code-comment * Address minor review comments and nits * Allow passing an array of strings when registering CSS * Fix lint errors Co-authored-by: Aaron Dodson <adodson@google.com>
This commit is contained in:
@@ -402,12 +402,17 @@ Comment.prototype.dispose = function() {
|
|||||||
/**
|
/**
|
||||||
* CSS for block comment. See css.js for use.
|
* CSS for block comment. See css.js for use.
|
||||||
*/
|
*/
|
||||||
Css.register([
|
Css.register(`
|
||||||
/* eslint-disable indent */
|
.blocklyCommentTextarea {
|
||||||
'.blocklyCommentTextarea {', 'background-color: #fef49c;', 'border: 0;',
|
background-color: #fef49c;
|
||||||
'outline: 0;', 'margin: 0;', 'padding: 3px;', 'resize: none;',
|
border: 0;
|
||||||
'display: block;', 'text-overflow: hidden;', '}'
|
display: block;
|
||||||
/* eslint-enable indent */
|
margin: 0;
|
||||||
]);
|
outline: 0;
|
||||||
|
padding: 3px;
|
||||||
|
resize: none;
|
||||||
|
text-overflow: hidden;
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
|
||||||
exports = Comment;
|
exports = Comment;
|
||||||
|
|||||||
806
core/css.js
806
core/css.js
@@ -16,6 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
goog.module('Blockly.Css');
|
goog.module('Blockly.Css');
|
||||||
|
|
||||||
|
const deprecation = goog.require('Blockly.utils.deprecation');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has CSS already been injected?
|
* Has CSS already been injected?
|
||||||
@@ -27,17 +29,24 @@ let injected = false;
|
|||||||
/**
|
/**
|
||||||
* Add some CSS to the blob that will be injected later. Allows optional
|
* Add some CSS to the blob that will be injected later. Allows optional
|
||||||
* components such as fields and the toolbox to store separate CSS.
|
* components such as fields and the toolbox to store separate CSS.
|
||||||
* The provided array of CSS will be destroyed by this function.
|
* @param {string|!Array<string>} cssContent Multiline CSS string or an array of
|
||||||
* @param {!Array<string>} cssArray Array of CSS strings.
|
* single lines of CSS.
|
||||||
* @alias Blockly.Css.register
|
* @alias Blockly.Css.register
|
||||||
*/
|
*/
|
||||||
const register = function(cssArray) {
|
const register = function(cssContent) {
|
||||||
if (injected) {
|
if (injected) {
|
||||||
throw Error('CSS already injected');
|
throw Error('CSS already injected');
|
||||||
}
|
}
|
||||||
// Concatenate cssArray onto CONTENT.
|
|
||||||
Array.prototype.push.apply(CONTENT, cssArray);
|
if (Array.isArray(cssContent)) {
|
||||||
cssArray.length = 0; // Garbage collect provided CSS content.
|
deprecation.warn(
|
||||||
|
'Registering CSS by passing an array of strings', 'September 2021',
|
||||||
|
'September 2022', 'css.register passing a multiline string');
|
||||||
|
content += ('\n' + cssContent.join('\n'));
|
||||||
|
} else {
|
||||||
|
// Add new cssContent in the global content.
|
||||||
|
content += ('\n' + cssContent);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
exports.register = register;
|
exports.register = register;
|
||||||
|
|
||||||
@@ -58,502 +67,503 @@ const inject = function(hasCss, pathToMedia) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
injected = true;
|
injected = true;
|
||||||
let text = CONTENT.join('\n');
|
|
||||||
CONTENT.length = 0; // Garbage collect CSS content.
|
|
||||||
if (!hasCss) {
|
if (!hasCss) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Strip off any trailing slash (either Unix or Windows).
|
// Strip off any trailing slash (either Unix or Windows).
|
||||||
const mediaPath = pathToMedia.replace(/[\\/]$/, '');
|
const mediaPath = pathToMedia.replace(/[\\/]$/, '');
|
||||||
text = text.replace(/<<<PATH>>>/g, mediaPath);
|
let cssContent = content.replace(/<<<PATH>>>/g, mediaPath);
|
||||||
|
// Cleanup the collected css content after injecting it to the DOM.
|
||||||
|
content = '';
|
||||||
|
|
||||||
// Inject CSS tag at start of head.
|
// Inject CSS tag at start of head.
|
||||||
const cssNode = document.createElement('style');
|
const cssNode = document.createElement('style');
|
||||||
cssNode.id = 'blockly-common-style';
|
cssNode.id = 'blockly-common-style';
|
||||||
const cssTextNode = document.createTextNode(text);
|
const cssTextNode = document.createTextNode(cssContent);
|
||||||
cssNode.appendChild(cssTextNode);
|
cssNode.appendChild(cssTextNode);
|
||||||
document.head.insertBefore(cssNode, document.head.firstChild);
|
document.head.insertBefore(cssNode, document.head.firstChild);
|
||||||
};
|
};
|
||||||
exports.inject = inject;
|
exports.inject = inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array making up the CSS content for Blockly.
|
* The CSS content for Blockly.
|
||||||
* @alias Blockly.Css.CONTENT
|
* @alias Blockly.Css.content
|
||||||
*/
|
*/
|
||||||
const CONTENT = [
|
let content = (`
|
||||||
`.blocklySvg {
|
.blocklySvg {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
outline: none;
|
outline: none;
|
||||||
overflow: hidden; /* IE overflows by default. */
|
overflow: hidden; /* IE overflows by default. */
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: block;
|
display: block;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyWidgetDiv {
|
.blocklyWidgetDiv {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 99999; /* big value for bootstrap3 compatibility */
|
z-index: 99999; /* big value for bootstrap3 compatibility */
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.injectionDiv {
|
.injectionDiv {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden; /* So blocks in drag surface disappear at edges */
|
overflow: hidden; /* So blocks in drag surface disappear at edges */
|
||||||
touch-action: none;
|
touch-action: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyNonSelectable {
|
.blocklyNonSelectable {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyWsDragSurface {
|
.blocklyWsDragSurface {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
/* Added as a separate rule with multiple classes to make it more specific
|
/* Added as a separate rule with multiple classes to make it more specific
|
||||||
than a bootstrap rule that selects svg:root. See issue #1275 for context.
|
than a bootstrap rule that selects svg:root. See issue #1275 for context.
|
||||||
*/
|
*/
|
||||||
`.blocklyWsDragSurface.blocklyOverflowVisible {
|
.blocklyWsDragSurface.blocklyOverflowVisible {
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyBlockDragSurface {
|
.blocklyBlockDragSurface {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
overflow: visible !important;
|
overflow: visible !important;
|
||||||
z-index: 50; /* Display below toolbox, but above everything else. */
|
z-index: 50; /* Display below toolbox, but above everything else. */
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyBlockCanvas.blocklyCanvasTransitioning,
|
.blocklyBlockCanvas.blocklyCanvasTransitioning,
|
||||||
.blocklyBubbleCanvas.blocklyCanvasTransitioning {
|
.blocklyBubbleCanvas.blocklyCanvasTransitioning {
|
||||||
transition: transform .5s;
|
transition: transform .5s;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyTooltipDiv {
|
.blocklyTooltipDiv {
|
||||||
background-color: #ffffc7;
|
background-color: #ffffc7;
|
||||||
border: 1px solid #ddc;
|
border: 1px solid #ddc;
|
||||||
box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);
|
box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);
|
||||||
color: #000;
|
color: #000;
|
||||||
display: none;
|
display: none;
|
||||||
font: 9pt sans-serif;
|
font: 9pt sans-serif;
|
||||||
opacity: .9;
|
opacity: .9;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 100000; /* big value for bootstrap3 compatibility */
|
z-index: 100000; /* big value for bootstrap3 compatibility */
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyDropDownDiv {
|
.blocklyDropDownDiv {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
display: none;
|
display: none;
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
border-color: #dadce0;
|
border-color: #dadce0;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
|
box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyDropDownDiv.blocklyFocused {
|
.blocklyDropDownDiv.blocklyFocused {
|
||||||
box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
|
box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
|
||||||
}`,
|
}
|
||||||
`.blocklyDropDownContent {
|
|
||||||
max-height: 300px;
|
|
||||||
overflow: auto;
|
|
||||||
overflow-x: hidden;
|
|
||||||
position: relative;
|
|
||||||
}`,
|
|
||||||
|
|
||||||
`.blocklyDropDownArrow {
|
.blocklyDropDownContent {
|
||||||
position: absolute;
|
max-height: 300px; // @todo: spec for maximum height.
|
||||||
left: 0;
|
overflow: auto;
|
||||||
top: 0;
|
overflow-x: hidden;
|
||||||
width: 16px;
|
position: relative;
|
||||||
height: 16px;
|
}
|
||||||
z-index: -1;
|
|
||||||
background-color: inherit;
|
|
||||||
border-color: inherit;
|
|
||||||
}`,
|
|
||||||
|
|
||||||
`.blocklyDropDownButton {
|
.blocklyDropDownArrow {
|
||||||
display: inline-block;
|
position: absolute;
|
||||||
float: left;
|
left: 0;
|
||||||
padding: 0;
|
top: 0;
|
||||||
margin: 4px;
|
width: 16px;
|
||||||
border-radius: 4px;
|
height: 16px;
|
||||||
outline: none;
|
z-index: -1;
|
||||||
border: 1px solid;
|
background-color: inherit;
|
||||||
transition: box-shadow .1s;
|
border-color: inherit;
|
||||||
cursor: pointer;
|
}
|
||||||
}`,
|
|
||||||
|
|
||||||
`.blocklyArrowTop {
|
.blocklyDropDownButton {
|
||||||
border-top: 1px solid;
|
display: inline-block;
|
||||||
border-left: 1px solid;
|
float: left;
|
||||||
border-top-left-radius: 4px;
|
padding: 0;
|
||||||
border-color: inherit;
|
margin: 4px;
|
||||||
}`,
|
border-radius: 4px;
|
||||||
|
outline: none;
|
||||||
|
border: 1px solid;
|
||||||
|
transition: box-shadow .1s;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
`.blocklyArrowBottom {
|
.blocklyArrowTop {
|
||||||
border-bottom: 1px solid;
|
border-top: 1px solid;
|
||||||
border-right: 1px solid;
|
border-left: 1px solid;
|
||||||
border-bottom-right-radius: 4px;
|
border-top-left-radius: 4px;
|
||||||
border-color: inherit;
|
border-color: inherit;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyResizeSE {
|
.blocklyArrowBottom {
|
||||||
cursor: se-resize;
|
border-bottom: 1px solid;
|
||||||
fill: #aaa;
|
border-right: 1px solid;
|
||||||
}`,
|
border-bottom-right-radius: 4px;
|
||||||
|
border-color: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
`.blocklyResizeSW {
|
.blocklyResizeSE {
|
||||||
cursor: sw-resize;
|
cursor: se-resize;
|
||||||
fill: #aaa;
|
fill: #aaa;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyResizeLine {
|
.blocklyResizeSW {
|
||||||
stroke: #515A5A;
|
cursor: sw-resize;
|
||||||
stroke-width: 1;
|
fill: #aaa;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyHighlightedConnectionPath {
|
.blocklyResizeLine {
|
||||||
fill: none;
|
stroke: #515A5A;
|
||||||
stroke: #fc3;
|
stroke-width: 1;
|
||||||
stroke-width: 4px;
|
}
|
||||||
}`,
|
|
||||||
|
|
||||||
`.blocklyPathLight {
|
.blocklyHighlightedConnectionPath {
|
||||||
fill: none;
|
fill: none;
|
||||||
stroke-linecap: round;
|
stroke: #fc3;
|
||||||
stroke-width: 1;
|
stroke-width: 4px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklySelected>.blocklyPathLight {
|
.blocklyPathLight {
|
||||||
display: none;
|
fill: none;
|
||||||
}`,
|
stroke-linecap: round;
|
||||||
|
stroke-width: 1;
|
||||||
|
}
|
||||||
|
|
||||||
`.blocklyDraggable {
|
.blocklySelected>.blocklyPathLight {
|
||||||
/* backup for browsers (e.g. IE11) that don't support grab */
|
display: none;
|
||||||
cursor: url("<<<PATH>>>/handopen.cur"), auto;
|
}
|
||||||
cursor: grab;
|
|
||||||
cursor: -webkit-grab;
|
|
||||||
}`,
|
|
||||||
|
|
||||||
/* backup for browsers (e.g. IE11) that don't support grabbing */
|
.blocklyDraggable {
|
||||||
`.blocklyDragging {
|
/* backup for browsers (e.g. IE11) that don't support grab */
|
||||||
/* backup for browsers (e.g. IE11) that don't support grabbing */
|
cursor: url("<<<PATH>>>/handopen.cur"), auto;
|
||||||
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
|
cursor: grab;
|
||||||
cursor: grabbing;
|
cursor: -webkit-grab;
|
||||||
cursor: -webkit-grabbing;
|
}
|
||||||
}`,
|
|
||||||
|
|
||||||
/* Changes cursor on mouse down. Not effective in Firefox because of
|
/* backup for browsers (e.g. IE11) that don't support grabbing */
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */
|
.blocklyDragging {
|
||||||
`.blocklyDraggable:active {
|
/* backup for browsers (e.g. IE11) that don't support grabbing */
|
||||||
/* backup for browsers (e.g. IE11) that don't support grabbing */
|
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
|
||||||
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
|
cursor: grabbing;
|
||||||
cursor: grabbing;
|
cursor: -webkit-grabbing;
|
||||||
cursor: -webkit-grabbing;
|
}
|
||||||
}`,
|
|
||||||
|
/* Changes cursor on mouse down. Not effective in Firefox because of
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=771241 */
|
||||||
|
.blocklyDraggable:active {
|
||||||
|
/* backup for browsers (e.g. IE11) that don't support grabbing */
|
||||||
|
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
|
||||||
|
cursor: grabbing;
|
||||||
|
cursor: -webkit-grabbing;
|
||||||
|
}
|
||||||
|
|
||||||
/* Change the cursor on the whole drag surface in case the mouse gets
|
/* Change the cursor on the whole drag surface in case the mouse gets
|
||||||
ahead of block during a drag. This way the cursor is still a closed hand.
|
ahead of block during a drag. This way the cursor is still a closed hand.
|
||||||
*/
|
*/
|
||||||
`.blocklyBlockDragSurface .blocklyDraggable {
|
.blocklyBlockDragSurface .blocklyDraggable {
|
||||||
/* backup for browsers (e.g. IE11) that don't support grabbing */
|
/* backup for browsers (e.g. IE11) that don't support grabbing */
|
||||||
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
|
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
|
||||||
cursor: grabbing;
|
cursor: grabbing;
|
||||||
cursor: -webkit-grabbing;
|
cursor: -webkit-grabbing;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyDragging.blocklyDraggingDelete {
|
.blocklyDragging.blocklyDraggingDelete {
|
||||||
cursor: url("<<<PATH>>>/handdelete.cur"), auto;
|
cursor: url("<<<PATH>>>/handdelete.cur"), auto;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyDragging>.blocklyPath,
|
.blocklyDragging>.blocklyPath,
|
||||||
.blocklyDragging>.blocklyPathLight {
|
.blocklyDragging>.blocklyPathLight {
|
||||||
fill-opacity: .8;
|
fill-opacity: .8;
|
||||||
stroke-opacity: .8;
|
stroke-opacity: .8;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyDragging>.blocklyPathDark {
|
.blocklyDragging>.blocklyPathDark {
|
||||||
display: none;
|
display: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyDisabled>.blocklyPath {
|
.blocklyDisabled>.blocklyPath {
|
||||||
fill-opacity: .5;
|
fill-opacity: .5;
|
||||||
stroke-opacity: .5;
|
stroke-opacity: .5;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyDisabled>.blocklyPathLight,
|
.blocklyDisabled>.blocklyPathLight,
|
||||||
.blocklyDisabled>.blocklyPathDark {
|
.blocklyDisabled>.blocklyPathDark {
|
||||||
display: none;
|
display: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyInsertionMarker>.blocklyPath,
|
.blocklyInsertionMarker>.blocklyPath,
|
||||||
.blocklyInsertionMarker>.blocklyPathLight,
|
.blocklyInsertionMarker>.blocklyPathLight,
|
||||||
.blocklyInsertionMarker>.blocklyPathDark {
|
.blocklyInsertionMarker>.blocklyPathDark {
|
||||||
fill-opacity: .2;
|
fill-opacity: .2;
|
||||||
stroke: none;
|
stroke: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyMultilineText {
|
.blocklyMultilineText {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyNonEditableText>text {
|
.blocklyNonEditableText>text {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyFlyout {
|
.blocklyFlyout {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyText text {
|
.blocklyText text {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Don't allow users to select text. It gets annoying when trying to
|
Don't allow users to select text. It gets annoying when trying to
|
||||||
drag a block and selected text moves instead.
|
drag a block and selected text moves instead.
|
||||||
*/
|
*/
|
||||||
`.blocklySvg text,
|
.blocklySvg text,
|
||||||
.blocklyBlockDragSurface text {
|
.blocklyBlockDragSurface text {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
cursor: inherit;
|
cursor: inherit;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyHidden {
|
.blocklyHidden {
|
||||||
display: none;
|
display: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyFieldDropdown:not(.blocklyHidden) {
|
.blocklyFieldDropdown:not(.blocklyHidden) {
|
||||||
display: block;
|
display: block;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyIconGroup {
|
.blocklyIconGroup {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyIconGroup:not(:hover),
|
.blocklyIconGroup:not(:hover),
|
||||||
.blocklyIconGroupReadonly {
|
.blocklyIconGroupReadonly {
|
||||||
opacity: .6;
|
opacity: .6;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyIconShape {
|
.blocklyIconShape {
|
||||||
fill: #00f;
|
fill: #00f;
|
||||||
stroke: #fff;
|
stroke: #fff;
|
||||||
stroke-width: 1px;
|
stroke-width: 1px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyIconSymbol {
|
.blocklyIconSymbol {
|
||||||
fill: #fff;
|
fill: #fff;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyMinimalBody {
|
.blocklyMinimalBody {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyHtmlInput {
|
.blocklyHtmlInput {
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
outline: none;
|
outline: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
display: block;
|
display: block;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
/* Edge and IE introduce a close icon when the input value is longer than a
|
/* Edge and IE introduce a close icon when the input value is longer than a
|
||||||
certain length. This affects our sizing calculations of the text input.
|
certain length. This affects our sizing calculations of the text input.
|
||||||
Hiding the close icon to avoid that. */
|
Hiding the close icon to avoid that. */
|
||||||
`.blocklyHtmlInput::-ms-clear {
|
.blocklyHtmlInput::-ms-clear {
|
||||||
display: none;
|
display: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyMainBackground {
|
.blocklyMainBackground {
|
||||||
stroke-width: 1;
|
stroke-width: 1;
|
||||||
stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */
|
stroke: #c6c6c6; /* Equates to #ddd due to border being off-pixel. */
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyMutatorBackground {
|
.blocklyMutatorBackground {
|
||||||
fill: #fff;
|
fill: #fff;
|
||||||
stroke: #ddd;
|
stroke: #ddd;
|
||||||
stroke-width: 1;
|
stroke-width: 1;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyFlyoutBackground {
|
.blocklyFlyoutBackground {
|
||||||
fill: #ddd;
|
fill: #ddd;
|
||||||
fill-opacity: .8;
|
fill-opacity: .8;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyMainWorkspaceScrollbar {
|
.blocklyMainWorkspaceScrollbar {
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyFlyoutScrollbar {
|
.blocklyFlyoutScrollbar {
|
||||||
z-index: 30;
|
z-index: 30;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyScrollbarHorizontal,
|
.blocklyScrollbarHorizontal,
|
||||||
.blocklyScrollbarVertical {
|
.blocklyScrollbarVertical {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
outline: none;
|
outline: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyScrollbarBackground {
|
.blocklyScrollbarBackground {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyScrollbarHandle {
|
.blocklyScrollbarHandle {
|
||||||
fill: #ccc;
|
fill: #ccc;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
|
.blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
|
||||||
.blocklyScrollbarHandle:hover {
|
.blocklyScrollbarHandle:hover {
|
||||||
fill: #bbb;
|
fill: #bbb;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
/* Darken flyout scrollbars due to being on a grey background. */
|
/* Darken flyout scrollbars due to being on a grey background. */
|
||||||
/* By contrast, workspace scrollbars are on a white background. */
|
/* By contrast, workspace scrollbars are on a white background. */
|
||||||
`.blocklyFlyout .blocklyScrollbarHandle {
|
.blocklyFlyout .blocklyScrollbarHandle {
|
||||||
fill: #bbb;
|
fill: #bbb;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
|
.blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,
|
||||||
.blocklyFlyout .blocklyScrollbarHandle:hover {
|
.blocklyFlyout .blocklyScrollbarHandle:hover {
|
||||||
fill: #aaa;
|
fill: #aaa;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyInvalidInput {
|
.blocklyInvalidInput {
|
||||||
background: #faa;
|
background: #faa;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyVerticalMarker {
|
.blocklyVerticalMarker {
|
||||||
stroke-width: 3px;
|
stroke-width: 3px;
|
||||||
fill: rgba(255,255,255,.5);
|
fill: rgba(255,255,255,.5);
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyComputeCanvas {
|
.blocklyComputeCanvas {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 0;
|
width: 0;
|
||||||
height: 0;
|
height: 0;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyNoPointerEvents {
|
.blocklyNoPointerEvents {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyContextMenu {
|
.blocklyContextMenu {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyDropdownMenu {
|
.blocklyDropdownMenu {
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyDropdownMenu .blocklyMenuItem {
|
.blocklyDropdownMenu .blocklyMenuItem {
|
||||||
/* 28px on the left for icon or checkbox. */
|
/* 28px on the left for icon or checkbox. */
|
||||||
padding-left: 28px;
|
padding-left: 28px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
/* BiDi override for the resting state. */
|
/* BiDi override for the resting state. */
|
||||||
`.blocklyDropdownMenu .blocklyMenuItemRtl {
|
.blocklyDropdownMenu .blocklyMenuItemRtl {
|
||||||
/* Flip left/right padding for BiDi. */
|
/* Flip left/right padding for BiDi. */
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
padding-right: 28px;
|
padding-right: 28px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyWidgetDiv .blocklyMenu {
|
.blocklyWidgetDiv .blocklyMenu {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
|
box-shadow: 0 0 3px 1px rgba(0,0,0,.3);
|
||||||
font: normal 13px Arial, sans-serif;
|
font: normal 13px Arial, sans-serif;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
outline: none;
|
outline: none;
|
||||||
padding: 4px 0;
|
padding: 4px 0;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
z-index: 20000; /* Arbitrary, but some apps depend on it... */
|
z-index: 20000; /* Arbitrary, but some apps depend on it... */
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyWidgetDiv .blocklyMenu.blocklyFocused {
|
.blocklyWidgetDiv .blocklyMenu.blocklyFocused {
|
||||||
box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
|
box-shadow: 0 0 6px 1px rgba(0,0,0,.3);
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyDropDownDiv .blocklyMenu {
|
.blocklyDropDownDiv .blocklyMenu {
|
||||||
background: inherit; /* Compatibility with gapi, reset from goog-menu */
|
background: inherit; /* Compatibility with gapi, reset from goog-menu */
|
||||||
border: inherit; /* Compatibility with gapi, reset from goog-menu */
|
border: inherit; /* Compatibility with gapi, reset from goog-menu */
|
||||||
font: normal 13px "Helvetica Neue", Helvetica, sans-serif;
|
font: normal 13px "Helvetica Neue", Helvetica, sans-serif;
|
||||||
outline: none;
|
outline: none;
|
||||||
position: relative; /* Compatibility with gapi, reset from goog-menu */
|
position: relative; /* Compatibility with gapi, reset from goog-menu */
|
||||||
z-index: 20000; /* Arbitrary, but some apps depend on it... */
|
z-index: 20000; /* Arbitrary, but some apps depend on it... */
|
||||||
}`,
|
}
|
||||||
|
|
||||||
/* State: resting. */
|
/* State: resting. */
|
||||||
`.blocklyMenuItem {
|
.blocklyMenuItem {
|
||||||
border: none;
|
border: none;
|
||||||
color: #000;
|
color: #000;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
/* 7em on the right for shortcut. */
|
/* 7em on the right for shortcut. */
|
||||||
min-width: 7em;
|
min-width: 7em;
|
||||||
padding: 6px 15px;
|
padding: 6px 15px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
/* State: disabled. */
|
/* State: disabled. */
|
||||||
`.blocklyMenuItemDisabled {
|
.blocklyMenuItemDisabled {
|
||||||
color: #ccc;
|
color: #ccc;
|
||||||
cursor: inherit;
|
cursor: inherit;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
/* State: hover. */
|
/* State: hover. */
|
||||||
`.blocklyMenuItemHighlight {
|
.blocklyMenuItemHighlight {
|
||||||
background-color: rgba(0,0,0,.1);
|
background-color: rgba(0,0,0,.1);
|
||||||
}`,
|
}
|
||||||
|
|
||||||
/* State: selected/checked. */
|
/* State: selected/checked. */
|
||||||
`.blocklyMenuItemCheckbox {
|
.blocklyMenuItemCheckbox {
|
||||||
height: 16px;
|
height: 16px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyMenuItemSelected .blocklyMenuItemCheckbox {
|
.blocklyMenuItemSelected .blocklyMenuItemCheckbox {
|
||||||
background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;
|
background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;
|
||||||
float: left;
|
float: left;
|
||||||
margin-left: -24px;
|
margin-left: -24px;
|
||||||
position: static; /* Scroll with the menu. */
|
position: static; /* Scroll with the menu. */
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyMenuItemRtl .blocklyMenuItemCheckbox {
|
.blocklyMenuItemRtl .blocklyMenuItemCheckbox {
|
||||||
float: right;
|
float: right;
|
||||||
margin-right: -24px;
|
margin-right: -24px;
|
||||||
}`,
|
}
|
||||||
];
|
`);
|
||||||
exports.CONTENT = CONTENT;
|
exports.content = content;
|
||||||
|
|||||||
@@ -540,29 +540,32 @@ FieldAngle.prototype.wrapValue_ = function(value) {
|
|||||||
/**
|
/**
|
||||||
* CSS for angle field. See css.js for use.
|
* CSS for angle field. See css.js for use.
|
||||||
*/
|
*/
|
||||||
Css.register([
|
Css.register(`
|
||||||
`.blocklyAngleCircle {
|
.blocklyAngleCircle {
|
||||||
stroke: #444;
|
stroke: #444;
|
||||||
stroke-width: 1;
|
stroke-width: 1;
|
||||||
fill: #ddd;
|
fill: #ddd;
|
||||||
fill-opacity: .8;
|
fill-opacity: .8;
|
||||||
}`,
|
}
|
||||||
`.blocklyAngleMarks {
|
|
||||||
stroke: #444;
|
.blocklyAngleMarks {
|
||||||
stroke-width: 1;
|
stroke: #444;
|
||||||
}`,
|
stroke-width: 1;
|
||||||
`.blocklyAngleGauge {
|
}
|
||||||
fill: #f88;
|
|
||||||
fill-opacity: .8;
|
.blocklyAngleGauge {
|
||||||
pointer-events: none;
|
fill: #f88;
|
||||||
}`,
|
fill-opacity: .8;
|
||||||
`.blocklyAngleLine {
|
pointer-events: none;
|
||||||
stroke: #f00;
|
}
|
||||||
stroke-width: 2;
|
|
||||||
stroke-linecap: round;
|
.blocklyAngleLine {
|
||||||
pointer-events: none;
|
stroke: #f00;
|
||||||
}`
|
stroke-width: 2;
|
||||||
]);
|
stroke-linecap: round;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
|
||||||
fieldRegistry.register('field_angle', FieldAngle);
|
fieldRegistry.register('field_angle', FieldAngle);
|
||||||
|
|
||||||
|
|||||||
@@ -608,38 +608,36 @@ FieldColour.prototype.dropdownDispose_ = function() {
|
|||||||
/**
|
/**
|
||||||
* CSS for colour picker. See css.js for use.
|
* CSS for colour picker. See css.js for use.
|
||||||
*/
|
*/
|
||||||
Css.register([
|
Css.register(`
|
||||||
/* eslint-disable indent */
|
.blocklyColourTable {
|
||||||
'.blocklyColourTable {',
|
border-collapse: collapse;
|
||||||
'border-collapse: collapse;',
|
display: block;
|
||||||
'display: block;',
|
outline: none;
|
||||||
'outline: none;',
|
padding: 1px;
|
||||||
'padding: 1px;',
|
}
|
||||||
'}',
|
|
||||||
|
|
||||||
'.blocklyColourTable>tr>td {',
|
.blocklyColourTable>tr>td {
|
||||||
'border: .5px solid #888;',
|
border: .5px solid #888;
|
||||||
'box-sizing: border-box;',
|
box-sizing: border-box;
|
||||||
'cursor: pointer;',
|
cursor: pointer;
|
||||||
'display: inline-block;',
|
display: inline-block;
|
||||||
'height: 20px;',
|
height: 20px;
|
||||||
'padding: 0;',
|
padding: 0;
|
||||||
'width: 20px;',
|
width: 20px;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyColourTable>tr>td.blocklyColourHighlighted {',
|
.blocklyColourTable>tr>td.blocklyColourHighlighted {
|
||||||
'border-color: #eee;',
|
border-color: #eee;
|
||||||
'box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);',
|
box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);
|
||||||
'position: relative;',
|
position: relative;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyColourSelected, .blocklyColourSelected:hover {',
|
.blocklyColourSelected, .blocklyColourSelected:hover {
|
||||||
'border-color: #eee !important;',
|
border-color: #eee !important;
|
||||||
'outline: 1px solid #333;',
|
outline: 1px solid #333;
|
||||||
'position: relative;',
|
position: relative;
|
||||||
'}'
|
}
|
||||||
/* eslint-enable indent */
|
`);
|
||||||
]);
|
|
||||||
|
|
||||||
fieldRegistry.register('field_colour', FieldColour);
|
fieldRegistry.register('field_colour', FieldColour);
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ FieldDropdown.prototype.showEditor_ = function(opt_e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove any pre-existing elements in the dropdown.
|
// Remove any pre-existing elements in the dropdown.
|
||||||
Blockly.DropDownDiv.clearContent();
|
DropDownDiv.clearContent();
|
||||||
// Element gets created in render.
|
// Element gets created in render.
|
||||||
this.menu_.render(DropDownDiv.getContentDiv());
|
this.menu_.render(DropDownDiv.getContentDiv());
|
||||||
const menuElement = /** @type {!Element} */ (this.menu_.getElement());
|
const menuElement = /** @type {!Element} */ (this.menu_.getElement());
|
||||||
|
|||||||
@@ -433,19 +433,19 @@ FieldMultilineInput.prototype.onHtmlInputKeyDown_ = function(e) {
|
|||||||
/**
|
/**
|
||||||
* CSS for multiline field. See css.js for use.
|
* CSS for multiline field. See css.js for use.
|
||||||
*/
|
*/
|
||||||
Css.register([
|
Css.register(`
|
||||||
`.blocklyHtmlTextAreaInput {
|
.blocklyHtmlTextAreaInput {
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
resize: none;
|
resize: none;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}`,
|
}
|
||||||
`.blocklyHtmlTextAreaInputOverflowedY {
|
|
||||||
overflow-y: scroll;
|
|
||||||
}`
|
|
||||||
]);
|
|
||||||
|
|
||||||
|
.blocklyHtmlTextAreaInputOverflowedY {
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
|
||||||
fieldRegistry.register('field_multilinetext', FieldMultilineInput);
|
fieldRegistry.register('field_multilinetext', FieldMultilineInput);
|
||||||
|
|
||||||
|
|||||||
@@ -312,31 +312,29 @@ FlyoutButton.prototype.onMouseUp_ = function(e) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CSS for buttons and labels. See css.js for use.
|
* CSS for buttons and labels. See css.js for use.
|
||||||
*/
|
*/
|
||||||
Css.register([
|
Css.register(`
|
||||||
/* eslint-disable indent */
|
.blocklyFlyoutButton {
|
||||||
'.blocklyFlyoutButton {',
|
fill: #888;
|
||||||
'fill: #888;',
|
cursor: default;
|
||||||
'cursor: default;',
|
}
|
||||||
'}',
|
|
||||||
|
|
||||||
'.blocklyFlyoutButtonShadow {',
|
.blocklyFlyoutButtonShadow {
|
||||||
'fill: #666;',
|
fill: #666;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyFlyoutButton:hover {',
|
.blocklyFlyoutButton:hover {
|
||||||
'fill: #aaa;',
|
fill: #aaa;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyFlyoutLabel {',
|
.blocklyFlyoutLabel {
|
||||||
'cursor: default;',
|
cursor: default;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyFlyoutLabelBackground {',
|
.blocklyFlyoutLabelBackground {
|
||||||
'opacity: 0;',
|
opacity: 0;
|
||||||
'}',
|
}
|
||||||
/* eslint-enable indent */
|
`);
|
||||||
]);
|
|
||||||
|
|
||||||
exports = FlyoutButton;
|
exports = FlyoutButton;
|
||||||
|
|||||||
@@ -645,79 +645,79 @@ ToolboxCategory.prototype.dispose = function() {
|
|||||||
/**
|
/**
|
||||||
* CSS for Toolbox. See css.js for use.
|
* CSS for Toolbox. See css.js for use.
|
||||||
*/
|
*/
|
||||||
Css.register([
|
Css.register(`
|
||||||
`.blocklyTreeRow:not(.blocklyTreeSelected):hover {
|
.blocklyTreeRow:not(.blocklyTreeSelected):hover {
|
||||||
background-color: rgba(255, 255, 255, 0.2);
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyToolboxDiv[layout="h"] .blocklyToolboxCategory {
|
.blocklyToolboxDiv[layout="h"] .blocklyToolboxCategory {
|
||||||
margin: 1px 5px 1px 0;
|
margin: 1px 5px 1px 0;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyToolboxDiv[dir="RTL"][layout="h"] .blocklyToolboxCategory {
|
.blocklyToolboxDiv[dir="RTL"][layout="h"] .blocklyToolboxCategory {
|
||||||
margin: 1px 0 1px 5px;
|
margin: 1px 0 1px 5px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyTreeRow {
|
.blocklyTreeRow {
|
||||||
height: 22px;
|
height: 22px;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
margin-bottom: 3px;
|
margin-bottom: 3px;
|
||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {
|
.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyTreeIcon {
|
.blocklyTreeIcon {
|
||||||
background-image: url(<<<PATH>>>/sprites.png);
|
background-image: url(<<<PATH>>>/sprites.png);
|
||||||
height: 16px;
|
height: 16px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyTreeIconClosed {
|
.blocklyTreeIconClosed {
|
||||||
background-position: -32px -1px;
|
background-position: -32px -1px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {
|
.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {
|
||||||
background-position: 0 -1px;
|
background-position: 0 -1px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyTreeSelected>.blocklyTreeIconClosed {
|
.blocklyTreeSelected>.blocklyTreeIconClosed {
|
||||||
background-position: -32px -17px;
|
background-position: -32px -17px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {
|
.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {
|
||||||
background-position: 0 -17px;
|
background-position: 0 -17px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyTreeIconOpen {
|
.blocklyTreeIconOpen {
|
||||||
background-position: -16px -1px;
|
background-position: -16px -1px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyTreeSelected>.blocklyTreeIconOpen {
|
.blocklyTreeSelected>.blocklyTreeIconOpen {
|
||||||
background-position: -16px -17px;
|
background-position: -16px -17px;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyTreeLabel {
|
.blocklyTreeLabel {
|
||||||
cursor: default;
|
cursor: default;
|
||||||
font: 16px sans-serif;
|
font: 16px sans-serif;
|
||||||
padding: 0 3px;
|
padding: 0 3px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyToolboxDelete .blocklyTreeLabel {
|
.blocklyToolboxDelete .blocklyTreeLabel {
|
||||||
cursor: url("<<<PATH>>>/handdelete.cur"), auto;
|
cursor: url("<<<PATH>>>/handdelete.cur"), auto;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyTreeSelected .blocklyTreeLabel {
|
.blocklyTreeSelected .blocklyTreeLabel {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}`
|
}
|
||||||
]);
|
`);
|
||||||
|
|
||||||
registry.register(
|
registry.register(
|
||||||
registry.Type.TOOLBOX_ITEM, ToolboxCategory.registrationName,
|
registry.Type.TOOLBOX_ITEM, ToolboxCategory.registrationName,
|
||||||
|
|||||||
@@ -102,21 +102,22 @@ ToolboxSeparator.prototype.dispose = function() {
|
|||||||
/**
|
/**
|
||||||
* CSS for Toolbox. See css.js for use.
|
* CSS for Toolbox. See css.js for use.
|
||||||
*/
|
*/
|
||||||
Css.register([
|
Css.register(`
|
||||||
`.blocklyTreeSeparator {
|
.blocklyTreeSeparator {
|
||||||
border-bottom: solid #e5e5e5 1px;
|
border-bottom: solid #e5e5e5 1px;
|
||||||
height: 0;
|
height: 0;
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
}`,
|
}
|
||||||
`.blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {
|
|
||||||
border-right: solid #e5e5e5 1px;
|
.blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {
|
||||||
border-bottom: none;
|
border-right: solid #e5e5e5 1px;
|
||||||
height: auto;
|
border-bottom: none;
|
||||||
margin: 0 5px 0 5px;
|
height: auto;
|
||||||
padding: 5px 0;
|
margin: 0 5px 0 5px;
|
||||||
width: 0;
|
padding: 5px 0;
|
||||||
}`,
|
width: 0;
|
||||||
]);
|
}
|
||||||
|
`);
|
||||||
|
|
||||||
registry.register(
|
registry.register(
|
||||||
registry.Type.TOOLBOX_ITEM, ToolboxSeparator.registrationName,
|
registry.Type.TOOLBOX_ITEM, ToolboxSeparator.registrationName,
|
||||||
|
|||||||
@@ -1116,27 +1116,38 @@ Toolbox.prototype.dispose = function() {
|
|||||||
/**
|
/**
|
||||||
* CSS for Toolbox. See css.js for use.
|
* CSS for Toolbox. See css.js for use.
|
||||||
*/
|
*/
|
||||||
Css.register([
|
Css.register(`
|
||||||
/* eslint-disable indent */
|
.blocklyToolboxDelete {
|
||||||
'.blocklyToolboxDelete {', 'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',
|
cursor: url("<<<PATH>>>/handdelete.cur"), auto;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyToolboxGrab {', 'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',
|
.blocklyToolboxGrab {
|
||||||
'cursor: grabbing;', 'cursor: -webkit-grabbing;', '}',
|
cursor: url("<<<PATH>>>/handclosed.cur"), auto;
|
||||||
|
cursor: grabbing;
|
||||||
|
cursor: -webkit-grabbing;
|
||||||
|
}
|
||||||
|
|
||||||
/* Category tree in Toolbox. */
|
/* Category tree in Toolbox. */
|
||||||
'.blocklyToolboxDiv {', 'background-color: #ddd;', 'overflow-x: visible;',
|
.blocklyToolboxDiv {
|
||||||
'overflow-y: auto;', 'padding: 4px 0 4px 0;', 'position: absolute;',
|
background-color: #ddd;
|
||||||
'z-index: 70;', /* so blocks go under toolbox when dragging */
|
overflow-x: visible;
|
||||||
'-webkit-tap-highlight-color: transparent;', /* issue #1345 */
|
overflow-y: auto;
|
||||||
'}',
|
padding: 4px 0 4px 0;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 70; /* so blocks go under toolbox when dragging */
|
||||||
|
-webkit-tap-highlight-color: transparent; /* issue #1345 */
|
||||||
|
}
|
||||||
|
|
||||||
'.blocklyToolboxContents {', 'display: flex;', 'flex-wrap: wrap;',
|
.blocklyToolboxContents {
|
||||||
'flex-direction: column;', '}',
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
'.blocklyToolboxContents:focus {', 'outline: none;', '}',
|
.blocklyToolboxContents:focus {
|
||||||
/* eslint-enable indent */
|
outline: none;
|
||||||
]);
|
}
|
||||||
|
`);
|
||||||
|
|
||||||
registry.register(registry.Type.TOOLBOX, registry.DEFAULT, Toolbox);
|
registry.register(registry.Type.TOOLBOX, registry.DEFAULT, Toolbox);
|
||||||
|
|
||||||
|
|||||||
@@ -1080,68 +1080,64 @@ WorkspaceCommentSvg.prototype.blurFocus = function() {
|
|||||||
/**
|
/**
|
||||||
* CSS for workspace comment. See css.js for use.
|
* CSS for workspace comment. See css.js for use.
|
||||||
*/
|
*/
|
||||||
Css.register([
|
Css.register(`
|
||||||
// clang-format off
|
.blocklyCommentForeignObject {
|
||||||
/* eslint-disable indent */
|
position: relative;
|
||||||
'.blocklyCommentForeignObject {',
|
z-index: 0;
|
||||||
'position: relative;',
|
}
|
||||||
'z-index: 0;',
|
|
||||||
'}',
|
|
||||||
|
|
||||||
'.blocklyCommentRect {',
|
.blocklyCommentRect {
|
||||||
'fill: #E7DE8E;',
|
fill: #E7DE8E;
|
||||||
'stroke: #bcA903;',
|
stroke: #bcA903;
|
||||||
'stroke-width: 1px;',
|
stroke-width: 1px;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyCommentTarget {',
|
.blocklyCommentTarget {
|
||||||
'fill: transparent;',
|
fill: transparent;
|
||||||
'stroke: #bcA903;',
|
stroke: #bcA903;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyCommentTargetFocused {',
|
.blocklyCommentTargetFocused {
|
||||||
'fill: none;',
|
fill: none;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyCommentHandleTarget {',
|
.blocklyCommentHandleTarget {
|
||||||
'fill: none;',
|
fill: none;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyCommentHandleTargetFocused {',
|
.blocklyCommentHandleTargetFocused {
|
||||||
'fill: transparent;',
|
fill: transparent;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyFocused>.blocklyCommentRect {',
|
.blocklyFocused>.blocklyCommentRect {
|
||||||
'fill: #B9B272;',
|
fill: #B9B272;
|
||||||
'stroke: #B9B272;',
|
stroke: #B9B272;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklySelected>.blocklyCommentTarget {',
|
.blocklySelected>.blocklyCommentTarget {
|
||||||
'stroke: #fc3;',
|
stroke: #fc3;
|
||||||
'stroke-width: 3px;',
|
stroke-width: 3px;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyCommentDeleteIcon {',
|
.blocklyCommentDeleteIcon {
|
||||||
'cursor: pointer;',
|
cursor: pointer;
|
||||||
'fill: #000;',
|
fill: #000;
|
||||||
'display: none;',
|
display: none;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklySelected > .blocklyCommentDeleteIcon {',
|
.blocklySelected > .blocklyCommentDeleteIcon {
|
||||||
'display: block;',
|
display: block;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyDeleteIconShape {',
|
.blocklyDeleteIconShape {
|
||||||
'fill: #000;',
|
fill: #000;
|
||||||
'stroke: #000;',
|
stroke: #000;
|
||||||
'stroke-width: 1px;',
|
stroke-width: 1px;
|
||||||
'}',
|
}
|
||||||
|
|
||||||
'.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {',
|
.blocklyDeleteIconShape.blocklyDeleteIconHighlighted {
|
||||||
'stroke: #fc3;',
|
stroke: #fc3;
|
||||||
'}'
|
}
|
||||||
/* eslint-enable indent */
|
`);
|
||||||
// clang-format on
|
|
||||||
]);
|
|
||||||
|
|
||||||
exports = WorkspaceCommentSvg;
|
exports = WorkspaceCommentSvg;
|
||||||
|
|||||||
@@ -499,18 +499,18 @@ ZoomControls.prototype.fireZoomEvent_ = function() {
|
|||||||
/**
|
/**
|
||||||
* CSS for zoom controls. See css.js for use.
|
* CSS for zoom controls. See css.js for use.
|
||||||
*/
|
*/
|
||||||
Css.register([
|
Css.register(`
|
||||||
`.blocklyZoom>image, .blocklyZoom>svg>image {
|
.blocklyZoom>image, .blocklyZoom>svg>image {
|
||||||
opacity: .4;
|
opacity: .4;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {
|
.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {
|
||||||
opacity: .6;
|
opacity: .6;
|
||||||
}`,
|
}
|
||||||
|
|
||||||
`.blocklyZoom>image:active, .blocklyZoom>svg>image:active {
|
.blocklyZoom>image:active, .blocklyZoom>svg>image:active {
|
||||||
opacity: .8;
|
opacity: .8;
|
||||||
}`
|
}
|
||||||
]);
|
`);
|
||||||
|
|
||||||
exports = ZoomControls;
|
exports = ZoomControls;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ goog.addDependency('../../core/constants.js', ['Blockly.constants'], [], {'lang'
|
|||||||
goog.addDependency('../../core/contextmenu.js', ['Blockly.ContextMenu'], ['Blockly.Events.BlockCreate', 'Blockly.Events.utils', 'Blockly.Menu', 'Blockly.MenuItem', 'Blockly.Msg', 'Blockly.WidgetDiv', 'Blockly.Xml', 'Blockly.browserEvents', 'Blockly.clipboard', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.aria', 'Blockly.utils.deprecation', 'Blockly.utils.dom', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/contextmenu.js', ['Blockly.ContextMenu'], ['Blockly.Events.BlockCreate', 'Blockly.Events.utils', 'Blockly.Menu', 'Blockly.MenuItem', 'Blockly.Msg', 'Blockly.WidgetDiv', 'Blockly.Xml', 'Blockly.browserEvents', 'Blockly.clipboard', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.aria', 'Blockly.utils.deprecation', 'Blockly.utils.dom', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/contextmenu_items.js', ['Blockly.ContextMenuItems'], ['Blockly.ContextMenuRegistry', 'Blockly.Events.utils', 'Blockly.Msg', 'Blockly.clipboard', 'Blockly.dialog', 'Blockly.inputTypes', 'Blockly.utils.idGenerator', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/contextmenu_items.js', ['Blockly.ContextMenuItems'], ['Blockly.ContextMenuRegistry', 'Blockly.Events.utils', 'Blockly.Msg', 'Blockly.clipboard', 'Blockly.dialog', 'Blockly.inputTypes', 'Blockly.utils.idGenerator', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/contextmenu_registry.js', ['Blockly.ContextMenuRegistry'], [], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/contextmenu_registry.js', ['Blockly.ContextMenuRegistry'], [], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/css.js', ['Blockly.Css'], [], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/css.js', ['Blockly.Css'], ['Blockly.utils.deprecation'], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/delete_area.js', ['Blockly.DeleteArea'], ['Blockly.BlockSvg', 'Blockly.DragTarget', 'Blockly.IDeleteArea', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/delete_area.js', ['Blockly.DeleteArea'], ['Blockly.BlockSvg', 'Blockly.DragTarget', 'Blockly.IDeleteArea', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/dialog.js', ['Blockly.dialog'], [], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/dialog.js', ['Blockly.dialog'], [], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/drag_target.js', ['Blockly.DragTarget'], ['Blockly.IDragTarget'], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/drag_target.js', ['Blockly.DragTarget'], ['Blockly.IDragTarget'], {'lang': 'es6', 'module': 'goog'});
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ goog.addDependency('../../core/constants.js', ['Blockly.constants'], [], {'lang'
|
|||||||
goog.addDependency('../../core/contextmenu.js', ['Blockly.ContextMenu'], ['Blockly.Events.BlockCreate', 'Blockly.Events.utils', 'Blockly.Menu', 'Blockly.MenuItem', 'Blockly.Msg', 'Blockly.WidgetDiv', 'Blockly.Xml', 'Blockly.browserEvents', 'Blockly.clipboard', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.aria', 'Blockly.utils.deprecation', 'Blockly.utils.dom', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/contextmenu.js', ['Blockly.ContextMenu'], ['Blockly.Events.BlockCreate', 'Blockly.Events.utils', 'Blockly.Menu', 'Blockly.MenuItem', 'Blockly.Msg', 'Blockly.WidgetDiv', 'Blockly.Xml', 'Blockly.browserEvents', 'Blockly.clipboard', 'Blockly.internalConstants', 'Blockly.utils', 'Blockly.utils.Coordinate', 'Blockly.utils.Rect', 'Blockly.utils.aria', 'Blockly.utils.deprecation', 'Blockly.utils.dom', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/contextmenu_items.js', ['Blockly.ContextMenuItems'], ['Blockly.ContextMenuRegistry', 'Blockly.Events.utils', 'Blockly.Msg', 'Blockly.clipboard', 'Blockly.dialog', 'Blockly.inputTypes', 'Blockly.utils.idGenerator', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/contextmenu_items.js', ['Blockly.ContextMenuItems'], ['Blockly.ContextMenuRegistry', 'Blockly.Events.utils', 'Blockly.Msg', 'Blockly.clipboard', 'Blockly.dialog', 'Blockly.inputTypes', 'Blockly.utils.idGenerator', 'Blockly.utils.userAgent'], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/contextmenu_registry.js', ['Blockly.ContextMenuRegistry'], [], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/contextmenu_registry.js', ['Blockly.ContextMenuRegistry'], [], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/css.js', ['Blockly.Css'], [], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/css.js', ['Blockly.Css'], ['Blockly.utils.deprecation'], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/delete_area.js', ['Blockly.DeleteArea'], ['Blockly.BlockSvg', 'Blockly.DragTarget', 'Blockly.IDeleteArea', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/delete_area.js', ['Blockly.DeleteArea'], ['Blockly.BlockSvg', 'Blockly.DragTarget', 'Blockly.IDeleteArea', 'Blockly.utils.object'], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/dialog.js', ['Blockly.dialog'], [], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/dialog.js', ['Blockly.dialog'], [], {'lang': 'es6', 'module': 'goog'});
|
||||||
goog.addDependency('../../core/drag_target.js', ['Blockly.DragTarget'], ['Blockly.IDragTarget'], {'lang': 'es6', 'module': 'goog'});
|
goog.addDependency('../../core/drag_target.js', ['Blockly.DragTarget'], ['Blockly.IDragTarget'], {'lang': 'es6', 'module': 'goog'});
|
||||||
|
|||||||
Reference in New Issue
Block a user