diff --git a/packages/scratch-gui/src/components/blocks/blocks.css b/packages/scratch-gui/src/components/blocks/blocks.css
index 583f587f79..3aba7c3c92 100644
--- a/packages/scratch-gui/src/components/blocks/blocks.css
+++ b/packages/scratch-gui/src/components/blocks/blocks.css
@@ -3,97 +3,70 @@
@import "../../css/z-index.css";
.blocks {
- height: 100%;
+ height: 100%;
}
-.drag-over:after {
- content: '';
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- opacity: 0.75;
- background-color: $drop-highlight;
- transition: all 0.25s ease;
+.drag-over::after {
+ content: '';
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ opacity: 0.75;
+ background-color: rgba(0, 191, 255, 0.2); /* antes $drop-highlight */
+ transition: all 0.25s ease;
}
-.blocks :global(.injectionDiv){
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
- border: 1px solid $ui-black-transparent;
- border-top-right-radius: $space;
- border-bottom-right-radius: $space;
+.blocks .injectionDiv {
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ border: 1px solid rgba(0,0,0,0.2); /* antes $ui-black-transparent */
+ border-top-right-radius: 0.25rem; /* antes $space */
+ border-bottom-right-radius: 0.25rem;
}
-[dir="rtl"] .blocks :global(.injectionDiv) {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
- border-top-left-radius: $space;
- border-bottom-left-radius: $space;
+[dir="rtl"] .blocks .injectionDiv {
+ border-top-right-radius: 0;
+ border-bottom-right-radius: 0;
+ border-top-left-radius: 0.25rem;
+ border-bottom-left-radius: 0.25rem;
}
-.blocks :global(.blocklyMainBackground) {
- stroke: none;
+.blocks .blocklyMainBackground {
+ stroke: none;
}
-.blocks :global(.blocklyToolboxDiv) {
- border-right: 1px solid $ui-black-transparent;
- border-bottom: 1px solid $ui-black-transparent;
- box-sizing: content-box;
- height: calc(100% - 3.25rem) !important;
-
- /*
- For now, the layout cannot support scrollbars in the category menu.
- The line below works for Edge, the `::-webkit-scrollbar` line
- below that is for webkit browsers. It isn't possible to do the
- same for Firefox, so a different solution may be needed for them.
- */
- -ms-overflow-style: none;
-}
-
-[dir="rtl"] .blocks :global(.blocklyToolboxDiv) {
- border-right: none;
- border-left: 1px solid $ui-black-transparent;
+.blocks .blocklyToolboxDiv {
+ border-right: 1px solid rgba(0,0,0,0.2);
+ border-bottom: 1px solid rgba(0,0,0,0.2);
+ box-sizing: content-box;
+ height: calc(100% - 3.25rem) !important;
+ -ms-overflow-style: none;
}
-.blocks :global(.blocklyToolboxDiv::-webkit-scrollbar) {
- display: none;
+.blocks .blocklyToolboxDiv::-webkit-scrollbar {
+ display: none;
}
-.blocks :global(.blocklyFlyout) {
- border-right: 1px solid $ui-black-transparent;
- box-sizing: content-box;
+.blocks .blocklyFlyout {
+ border-right: 1px solid rgba(0,0,0,0.2);
+ box-sizing: content-box;
}
-[dir="rtl"] .blocks :global(.blocklyFlyout) {
- border-right: none;
- border-left: 1px solid $ui-black-transparent;
-}
-
-
-.blocks :global(.blocklyBlockDragSurface) {
- /*
- Fix an issue where the drag surface was preventing hover events for sharing blocks.
- This does not prevent user interaction on the blocks themselves.
- */
- pointer-events: none;
- z-index: $z-index-drag-layer; /* make blocks match gui drag layer */
+.blocks .blocklyBlockDragSurface {
+ pointer-events: none;
+ z-index: 200; /* antes $z-index-drag-layer */
}
-/*
- Shrink category font to fit "My Blocks" for now.
- Probably will need different solutions for language support later, so
- make the change here instead of in scratch-blocks.
-*/
-.blocks :global(.scratchCategoryMenuItemLabel) {
- font-size: 0.65rem;
+.blocks .scratchCategoryMenuItemLabel {
+ font-size: 0.65rem;
}
-.blocks :global(.blocklyMinimalBody) {
- min-width: auto;
- min-height: auto;
+.blocks .blocklyMinimalBody {
+ min-width: auto;
+ min-height: auto;
}
diff --git a/packages/scratch-gui/src/components/gui/gui.jsx b/packages/scratch-gui/src/components/gui/gui.jsx
index 171ef06cca..0de0c41a85 100644
--- a/packages/scratch-gui/src/components/gui/gui.jsx
+++ b/packages/scratch-gui/src/components/gui/gui.jsx
@@ -44,6 +44,8 @@ import soundsIcon from './icon--sounds.svg';
import DebugModal from '../debug-modal/debug-modal.jsx';
import {setPlatform} from '../../reducers/platform.js';
import {PLATFORM} from '../../lib/platform.js';
+import VisionPreview from '../../containers/vision-preview.jsx';
+
const messages = defineMessages({
addExtension: {
@@ -398,7 +400,6 @@ const GUIComponent = props => {
) : null}
-
{
onNewBackdropClick={onNewLibraryBackdropClick}
/>
+
diff --git a/packages/scratch-gui/src/components/stage-wrapper/stage-wrapper.css b/packages/scratch-gui/src/components/stage-wrapper/stage-wrapper.css
index be106ebf8c..692582b369 100644
--- a/packages/scratch-gui/src/components/stage-wrapper/stage-wrapper.css
+++ b/packages/scratch-gui/src/components/stage-wrapper/stage-wrapper.css
@@ -13,18 +13,43 @@
.stage-wrapper.full-screen {
position: fixed;
- top: $stage-menu-height;
+ top: stage-menu-height;
left: 0;
right: 0;
bottom: 0;
- z-index: $z-index-stage-wrapper-overlay;
- background-color: $ui-white;
+ z-index: z-index-stage-wrapper-overlay;
+ background-color: ui-white;
/* spacing between stage and control bar (on the top), or between
stage and window edges (on left/right/bottom) */
- padding: $stage-full-screen-stage-padding;
+ padding: stage-full-screen-stage-padding;
/* this centers the stage */
display: flex;
flex-direction: column;
align-items: center;
}
+
+.vision-viewer {
+ margin-top: 10px;
+ height: 240px; /* ajusta según necesites */
+ background: #fff;
+}
+
+.visionFullScreen {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background-color: #000; /* Fondo negro */
+}
+
+.visionFullScreen canvas,
+.visionFullScreen img,
+.visionFullScreen video {
+ max-width: 100%;
+ max-height: 100%;
+ object-fit: contain;
+ border-radius: 8px;
+}
+
diff --git a/packages/scratch-gui/src/components/stage-wrapper/stage-wrapper.jsx b/packages/scratch-gui/src/components/stage-wrapper/stage-wrapper.jsx
index 109f0981a2..15cee5e0f3 100644
--- a/packages/scratch-gui/src/components/stage-wrapper/stage-wrapper.jsx
+++ b/packages/scratch-gui/src/components/stage-wrapper/stage-wrapper.jsx
@@ -4,25 +4,28 @@ import classNames from 'classnames';
import VM from '@scratch/scratch-vm';
import Box from '../box/box.jsx';
-import {STAGE_DISPLAY_SIZES} from '../../lib/layout-constants.js';
-import StageHeader from '../../containers/stage-header.jsx';
-import Stage from '../../containers/stage.jsx';
import Loader from '../loader/loader.jsx';
-
+import VisionViewer from '../../lib/vision-viewer';
import styles from './stage-wrapper.css';
-const StageWrapperComponent = function (props) {
- const {
- isFullScreen,
- isRtl,
- isRendererSupported,
- loading,
- manuallySaveThumbnails,
- onUpdateProjectThumbnail,
- stageSize,
- vm
- } = props;
-
+/**
+ * StageWrapperComponent
+ *
+ * Componente que reemplaza el escenario estándar de Scratch por la vista del Vision Kit.
+ *
+ * @param {object} props - Propiedades del componente.
+ * @param {boolean} props.isFullScreen - Indica si está en modo pantalla completa.
+ * @param {boolean} props.isRtl - Define la orientación del texto (derecha a izquierda).
+ * @param {boolean} props.loading - Muestra el loader si está cargando.
+ * @param {VM} props.vm - Instancia del Virtual Machine (VM) de Scratch.
+ * @returns {JSX.Element} El componente visual del escenario Vision Kit.
+ */
+const StageWrapperComponent = function ({
+ isFullScreen,
+ isRtl,
+ loading,
+ vm
+}) {
return (
-
-
-
-
- {
- isRendererSupported ?
- :
- null
- }
-
- {loading ? (
-
- ) : null}
+ {/* 🔹 Reemplazamos el escenario normal por la vista de Vision Kit */}
+
+
+
+
+ {loading ? : null}
);
};
StageWrapperComponent.propTypes = {
isFullScreen: PropTypes.bool,
- isRendererSupported: PropTypes.bool.isRequired,
isRtl: PropTypes.bool.isRequired,
loading: PropTypes.bool,
- manuallySaveThumbnails: PropTypes.bool,
- onUpdateProjectThumbnail: PropTypes.func,
- stageSize: PropTypes.oneOf(Object.keys(STAGE_DISPLAY_SIZES)).isRequired,
vm: PropTypes.instanceOf(VM).isRequired
};
diff --git a/packages/scratch-gui/src/components/vision-preview/vision-preview.jsx b/packages/scratch-gui/src/components/vision-preview/vision-preview.jsx
new file mode 100644
index 0000000000..4330736936
--- /dev/null
+++ b/packages/scratch-gui/src/components/vision-preview/vision-preview.jsx
@@ -0,0 +1,38 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+
+class VisionPreview extends React.Component{
+ constructor (props) {
+ super(props);
+ this.state = {dataURL: null};
+ }
+ componentDidMount (){
+ const {vm} = this.props;
+ this._handler = dataURL => this.setState({dataURL});
+ vm.on('VISION_IMAGE', this._handler);
+ }
+ componentWillUnmount (){
+ const {vm} = this.props;
+ if (this._handler) vm.off('VISION_IMAGE', this._handler);
+ }
+ render (){
+ return (
+
+
{'Vista previa (Vision Kit)'}
+ {this.state.dataURL ? (
+

+ ) : (
+
+ {'Aún no hay imagen procesada…'}
+
+ )}
+
+ );
+ }
+}
+VisionPreview.propTypes = {vm: PropTypes.object.isRequired};
+export default VisionPreview;
diff --git a/packages/scratch-gui/src/containers/vision-preview.jsx b/packages/scratch-gui/src/containers/vision-preview.jsx
new file mode 100644
index 0000000000..a797e21f0b
--- /dev/null
+++ b/packages/scratch-gui/src/containers/vision-preview.jsx
@@ -0,0 +1,22 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+import VisionPreview from '../components/vision-preview/vision-preview';
+
+/**
+ * Contenedor del componente VisionPreview.
+ * Renderiza la vista previa del Vision Kit y recibe la instancia de VM como prop.
+ *
+ * @component
+ * @param {object} props - Propiedades del componente
+ * @param {object} props.vm - Instancia de scratch-vm que maneja la lógica del proyecto
+ * @returns {JSX.Element} El componente VisionPreview con la prop vm
+ */
+const VisionPreviewContainer = ({vm}) => (
+
+);
+
+VisionPreviewContainer.propTypes = {
+ vm: PropTypes.object.isRequired
+};
+
+export default VisionPreviewContainer;
diff --git a/packages/scratch-gui/src/lib/libraries/extensions/index.jsx b/packages/scratch-gui/src/lib/libraries/extensions/index.jsx
index b1163e466c..f894e2ab06 100644
--- a/packages/scratch-gui/src/lib/libraries/extensions/index.jsx
+++ b/packages/scratch-gui/src/lib/libraries/extensions/index.jsx
@@ -1,393 +1,66 @@
import React from 'react';
import {FormattedMessage} from 'react-intl';
-
-import musicIconURL from './music/music.png';
-import musicInsetIconURL from './music/music-small.svg';
-
-import penIconURL from './pen/pen.png';
-import penInsetIconURL from './pen/pen-small.svg';
-
-import videoSensingIconURL from './videoSensing/video-sensing.png';
-import videoSensingInsetIconURL from './videoSensing/video-sensing-small.svg';
-
-import text2speechIconURL from './text2speech/text2speech.png';
-import text2speechInsetIconURL from './text2speech/text2speech-small.svg';
-
-import translateIconURL from './translate/translate.png';
-import translateInsetIconURL from './translate/translate-small.png';
-
-import makeymakeyIconURL from './makeymakey/makeymakey.png';
-import makeymakeyInsetIconURL from './makeymakey/makeymakey-small.svg';
-
-import microbitIconURL from './microbit/microbit.png';
-import microbitInsetIconURL from './microbit/microbit-small.svg';
-import microbitConnectionIconURL from './microbit/microbit-illustration.svg';
-import microbitConnectionSmallIconURL from './microbit/microbit-small.svg';
-
-import ev3IconURL from './ev3/ev3.png';
-import ev3InsetIconURL from './ev3/ev3-small.svg';
-import ev3ConnectionIconURL from './ev3/ev3-hub-illustration.svg';
-import ev3ConnectionSmallIconURL from './ev3/ev3-small.svg';
-
-import wedo2IconURL from './wedo2/wedo.png'; // TODO: Rename file names to match variable/prop names?
-import wedo2InsetIconURL from './wedo2/wedo-small.svg';
-import wedo2ConnectionIconURL from './wedo2/wedo-illustration.svg';
-import wedo2ConnectionSmallIconURL from './wedo2/wedo-small.svg';
-import wedo2ConnectionTipIconURL from './wedo2/wedo-button-illustration.svg';
-
-import boostIconURL from './boost/boost.png';
-import boostInsetIconURL from './boost/boost-small.svg';
-import boostConnectionIconURL from './boost/boost-illustration.svg';
-import boostConnectionSmallIconURL from './boost/boost-small.svg';
-import boostConnectionTipIconURL from './boost/boost-button-illustration.svg';
-
-import gdxforIconURL from './gdxfor/gdxfor.png';
-import gdxforInsetIconURL from './gdxfor/gdxfor-small.svg';
-import gdxforConnectionIconURL from './gdxfor/gdxfor-illustration.svg';
-import gdxforConnectionSmallIconURL from './gdxfor/gdxfor-small.svg';
+import visionIconURL from './vision/vision.png';
export default [
{
- name: (
-
- ),
- extensionId: 'music',
- iconURL: musicIconURL,
- insetIconURL: musicInsetIconURL,
- description: (
-
- ),
- featured: true
- },
- {
- name: (
-
- ),
- extensionId: 'pen',
- iconURL: penIconURL,
- insetIconURL: penInsetIconURL,
- description: (
-
- ),
- featured: true
- },
- {
- name: (
-
- ),
- extensionId: 'videoSensing',
- iconURL: videoSensingIconURL,
- insetIconURL: videoSensingInsetIconURL,
- description: (
-
- ),
- featured: true
- },
- {
- name: (
-
- ),
- extensionId: 'text2speech',
- collaborator: 'Amazon Web Services',
- iconURL: text2speechIconURL,
- insetIconURL: text2speechInsetIconURL,
- description: (
-
- ),
- featured: true,
- internetConnectionRequired: true
- },
- {
- name: (
-
- ),
- extensionId: 'translate',
- collaborator: 'Google',
- iconURL: translateIconURL,
- insetIconURL: translateInsetIconURL,
- description: (
-
- ),
- featured: true,
- internetConnectionRequired: true
- },
- {
- name: 'Makey Makey',
- extensionId: 'makeymakey',
- collaborator: 'JoyLabz',
- iconURL: makeymakeyIconURL,
- insetIconURL: makeymakeyInsetIconURL,
+ name: 'Vision Acciones',
+ extensionId: 'visionactions',
+ iconURL: visionIconURL,
+ insetIconURL: visionIconURL,
description: (
- ),
- featured: true
- },
- {
- name: 'micro:bit',
- extensionId: 'microbit',
- collaborator: 'micro:bit',
- iconURL: microbitIconURL,
- insetIconURL: microbitInsetIconURL,
- description: (
-
),
featured: true,
- disabled: false,
- bluetoothRequired: true,
- internetConnectionRequired: true,
- launchPeripheralConnectionFlow: true,
- useAutoScan: false,
- connectionIconURL: microbitConnectionIconURL,
- connectionSmallIconURL: microbitConnectionSmallIconURL,
- prescanMessage: (
-
- ),
- scanBeginMessage: (
-
- ),
- connectingMessage: (
-
- ),
- helpLink: 'https://scratch.mit.edu/microbit'
- },
- {
- name: 'Go Direct Force & Acceleration',
- extensionId: 'gdxfor',
- collaborator: 'Vernier',
- iconURL: gdxforIconURL,
- insetIconURL: gdxforInsetIconURL,
- description: (
-
- ),
- featured: true,
- disabled: false,
- bluetoothRequired: true,
- internetConnectionRequired: true,
- launchPeripheralConnectionFlow: true,
- useAutoScan: false,
- connectionIconURL: gdxforConnectionIconURL,
- connectionSmallIconURL: gdxforConnectionSmallIconURL,
- prescanMessage: (
-
- ),
- scanBeginMessage: (
-
- ),
- connectingMessage: (
-
- ),
- helpLink: 'https://scratch.mit.edu/vernier'
+ collaborator: 'OpenCV + Scratch EDU',
+ tags: ['visión', 'imagen', 'acciones']
},
{
- name: 'LEGO MINDSTORMS EV3',
- extensionId: 'ev3',
- collaborator: 'LEGO',
- iconURL: ev3IconURL,
- insetIconURL: ev3InsetIconURL,
+ name: 'Vision Básico',
+ extensionId: 'visionbasic',
+ iconURL: visionIconURL,
+ insetIconURL: visionIconURL,
description: (
),
featured: true,
- disabled: false,
- bluetoothRequired: true,
- internetConnectionRequired: true,
- launchPeripheralConnectionFlow: true,
- useAutoScan: false,
- connectionIconURL: ev3ConnectionIconURL,
- connectionSmallIconURL: ev3ConnectionSmallIconURL,
- prescanMessage: (
-
- ),
- scanBeginMessage: (
-
- ),
- connectingMessage: (
-
- ),
- helpLink: 'https://scratch.mit.edu/ev3'
+ collaborator: 'OpenCV + Scratch EDU',
+ tags: ['visión', 'imagen', 'básico']
},
{
- name: 'LEGO BOOST',
- extensionId: 'boost',
- collaborator: 'LEGO',
- iconURL: boostIconURL,
- insetIconURL: boostInsetIconURL,
+ name: 'Vision Intermedio',
+ extensionId: 'visionintermediate',
+ iconURL: visionIconURL,
+ insetIconURL: visionIconURL,
description: (
),
featured: true,
- disabled: false,
- bluetoothRequired: true,
- internetConnectionRequired: true,
- launchPeripheralConnectionFlow: true,
- useAutoScan: true,
- connectionIconURL: boostConnectionIconURL,
- connectionSmallIconURL: boostConnectionSmallIconURL,
- connectionTipIconURL: boostConnectionTipIconURL,
- prescanMessage: (
-
- ),
- scanBeginMessage: (
-
- ),
- connectingMessage: (
-
- ),
- helpLink: 'https://scratch.mit.edu/boost'
+ collaborator: 'OpenCV + Scratch EDU',
+ tags: ['visión', 'imagen', 'intermedio']
},
{
- name: 'LEGO Education WeDo 2.0',
- extensionId: 'wedo2',
- collaborator: 'LEGO',
- iconURL: wedo2IconURL,
- insetIconURL: wedo2InsetIconURL,
+ name: 'Vision Avanzado',
+ extensionId: 'visionadvanced',
+ iconURL: visionIconURL,
+ insetIconURL: visionIconURL,
description: (
),
featured: true,
- disabled: false,
- bluetoothRequired: true,
- internetConnectionRequired: true,
- launchPeripheralConnectionFlow: true,
- useAutoScan: true,
- connectionIconURL: wedo2ConnectionIconURL,
- connectionSmallIconURL: wedo2ConnectionSmallIconURL,
- connectionTipIconURL: wedo2ConnectionTipIconURL,
- prescanMessage: (
-
- ),
- scanBeginMessage: (
-
- ),
- connectingMessage: (
-
- ),
- helpLink: 'https://scratch.mit.edu/wedo'
+ collaborator: 'OpenCV + Scratch EDU',
+ tags: ['visión', 'imagen', 'avanzado']
}
];
diff --git a/packages/scratch-gui/src/lib/libraries/extensions/vision-extensions.jsx b/packages/scratch-gui/src/lib/libraries/extensions/vision-extensions.jsx
new file mode 100644
index 0000000000..f894e2ab06
--- /dev/null
+++ b/packages/scratch-gui/src/lib/libraries/extensions/vision-extensions.jsx
@@ -0,0 +1,66 @@
+import React from 'react';
+import {FormattedMessage} from 'react-intl';
+import visionIconURL from './vision/vision.png';
+
+export default [
+ {
+ name: 'Vision Acciones',
+ extensionId: 'visionactions',
+ iconURL: visionIconURL,
+ insetIconURL: visionIconURL,
+ description: (
+
+ ),
+ featured: true,
+ collaborator: 'OpenCV + Scratch EDU',
+ tags: ['visión', 'imagen', 'acciones']
+ },
+ {
+ name: 'Vision Básico',
+ extensionId: 'visionbasic',
+ iconURL: visionIconURL,
+ insetIconURL: visionIconURL,
+ description: (
+
+ ),
+ featured: true,
+ collaborator: 'OpenCV + Scratch EDU',
+ tags: ['visión', 'imagen', 'básico']
+ },
+ {
+ name: 'Vision Intermedio',
+ extensionId: 'visionintermediate',
+ iconURL: visionIconURL,
+ insetIconURL: visionIconURL,
+ description: (
+
+ ),
+ featured: true,
+ collaborator: 'OpenCV + Scratch EDU',
+ tags: ['visión', 'imagen', 'intermedio']
+ },
+ {
+ name: 'Vision Avanzado',
+ extensionId: 'visionadvanced',
+ iconURL: visionIconURL,
+ insetIconURL: visionIconURL,
+ description: (
+
+ ),
+ featured: true,
+ collaborator: 'OpenCV + Scratch EDU',
+ tags: ['visión', 'imagen', 'avanzado']
+ }
+];
diff --git a/packages/scratch-gui/src/lib/libraries/extensions/vision/vision.png b/packages/scratch-gui/src/lib/libraries/extensions/vision/vision.png
new file mode 100644
index 0000000000..1f3f297aa1
Binary files /dev/null and b/packages/scratch-gui/src/lib/libraries/extensions/vision/vision.png differ
diff --git a/packages/scratch-gui/src/lib/make-toolbox-xml.js b/packages/scratch-gui/src/lib/make-toolbox-xml.js
index 8d356e442d..92cb7feb20 100644
--- a/packages/scratch-gui/src/lib/make-toolbox-xml.js
+++ b/packages/scratch-gui/src/lib/make-toolbox-xml.js
@@ -1,811 +1,120 @@
-import ScratchBlocks from 'scratch-blocks';
+/* eslint-disable quote-props */
+/* global ScratchBlocks */
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 `
-
- ${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.