import ScratchBlocks from 'scratch-blocks';
import {defaultColors} from './themes';
const categorySeparator = '';
const blockSeparator = ''; // At default scale, about 28px
/* eslint-disable no-unused-vars */
const motion = function (isInitialSetup, isStage, targetId, colors) {
const stageSelected = ScratchBlocks.ScratchMsgs.translate(
'MOTION_STAGE_SELECTED',
'Stage selected: no motion blocks'
);
// Note: the category's secondaryColour matches up with the blocks' tertiary color, both used for border color.
return `
${isStage ? `
` : `
10
15
15
${blockSeparator}
0
0
1
1
0
0
${blockSeparator}
90
${blockSeparator}
10
0
10
0
${blockSeparator}
${blockSeparator}
${blockSeparator}
`}
${categorySeparator}
`;
};
const xmlEscape = function (unsafe) {
return unsafe.replace(/[<>&'"]/g, c => {
switch (c) {
case '<': return '<';
case '>': return '>';
case '&': return '&';
case '\'': return ''';
case '"': return '"';
}
});
};
const looks = function (isInitialSetup, isStage, targetId, costumeName, backdropName, colors) {
const hello = ScratchBlocks.ScratchMsgs.translate('LOOKS_HELLO', 'Hello!');
const hmm = ScratchBlocks.ScratchMsgs.translate('LOOKS_HMM', 'Hmm...');
// Note: the category's secondaryColour matches up with the blocks' tertiary color, both used for border color.
return `
${hello}
${blockSeparator}
${isStage ? '' : `
${hello}
2
${hello}
${hmm}
2
${hmm}
${blockSeparator}
`}
${isStage ? `
${backdropName}
${backdropName}
` : `
${costumeName}
${backdropName}
${blockSeparator}
10
100
`}
${blockSeparator}
25
0
${blockSeparator}
${isStage ? '' : `
${blockSeparator}
1
`}
${isStage ? `
` : `
`}
${categorySeparator}
`;
};
const sound = function (isInitialSetup, isStage, targetId, soundName, colors) {
// Note: the category's secondaryColour matches up with the blocks' tertiary color, both used for border color.
return `
${soundName}
${soundName}
${blockSeparator}
10
100
${blockSeparator}
-10
100
${categorySeparator}
`;
};
const events = function (isInitialSetup, isStage, targetId, colors) {
// Note: the category's secondaryColour matches up with the blocks' tertiary color, both used for border color.
return `
${isStage ? `
` : `
`}
${blockSeparator}
10
${blockSeparator}
${categorySeparator}
`;
};
const control = function (isInitialSetup, isStage, targetId, colors) {
// Note: the category's secondaryColour matches up with the blocks' tertiary color, both used for border color.
return `
1
${blockSeparator}
10
${blockSeparator}
${blockSeparator}
${blockSeparator}
${isStage ? `
` : `
`}
${categorySeparator}
`;
};
const sensing = function (isInitialSetup, isStage, targetId, colors) {
const name = ScratchBlocks.ScratchMsgs.translate('SENSING_ASK_TEXT', 'What\'s your name?');
// Note: the category's secondaryColour matches up with the blocks' tertiary color, both used for border color.
return `
${isStage ? '' : `
${blockSeparator}
`}
${isInitialSetup ? '' : `
${name}
`}
${blockSeparator}
${isStage ? '' : `
${blockSeparator}
''+
${blockSeparator}
`}
${blockSeparator}
${blockSeparator}
${blockSeparator}
${blockSeparator}
${blockSeparator}
${categorySeparator}
`;
};
const operators = function (isInitialSetup, isStage, targetId, colors) {
const apple = ScratchBlocks.ScratchMsgs.translate('OPERATORS_JOIN_APPLE', 'apple');
const banana = ScratchBlocks.ScratchMsgs.translate('OPERATORS_JOIN_BANANA', 'banana');
const letter = ScratchBlocks.ScratchMsgs.translate('OPERATORS_LETTEROF_APPLE', 'a');
// Note: the category's secondaryColour matches up with the blocks' tertiary color, both used for border color.
return `
${blockSeparator}
1
10
${blockSeparator}
50
50
50
${blockSeparator}
${blockSeparator}
${isInitialSetup ? '' : `
${apple}
${banana}
1
${apple}
${apple}
${apple}
${letter}
`}
${blockSeparator}
${blockSeparator}
${categorySeparator}
`;
};
const variables = function (isInitialSetup, isStage, targetId, colors) {
// Note: the category's secondaryColour matches up with the blocks' tertiary color, both used for border color.
return `
`;
};
const myBlocks = function (isInitialSetup, isStage, targetId, colors) {
// Note: the category's secondaryColour matches up with the blocks' tertiary color, both used for border color.
return `
`;
};
/* eslint-enable no-unused-vars */
const xmlOpen = '';
const xmlClose = '';
/**
* @param {!boolean} isInitialSetup - Whether the toolbox is for initial setup. If the mode is "initial setup",
* blocks with localized default parameters (e.g. ask and wait) should not be loaded. (LLK/scratch-gui#5445)
* @param {?boolean} isStage - Whether the toolbox is for a stage-type target. This is always set to true
* when isInitialSetup is true.
* @param {?string} targetId - The current editing target
* @param {?Array.