Skip to content
Draft
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
762 changes: 470 additions & 292 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@
"@ffmpeg/ffmpeg": "^0.12.15",
"@ffmpeg/util": "^0.12.2",
"@microbit/microbit-universal-hex": "0.2.2",
"@monaco-editor/loader": "^1.3.2",
"@monaco-editor/react": "^4.5.0",
"@turbowarp/jszip": "^3.11.1",
"@turbowarp/nanolog": "^1.0.1",
"@turbowarp/scratch-l10n": "^3.1001.0-202401241456-994097a5",
"@turbowarp/scratch-storage": "^0.0.202505311821",
"@turbowarp/scratch-svg-renderer": "github:OmniBlocks/omniblocks-svg-renderer#develop",
"@turbowarp/startaudiocontext": "^1.0.0",
"@xterm/addon-fit": "^0.11.0",
"@xterm/xterm": "^6.0.0",
"arraybuffer-loader": "^1.0.6",
"autoprefixer": "^9.0.1",
"balance-text": "3.3.1",
Expand Down Expand Up @@ -73,6 +77,7 @@
"postcss-loader": "^3.0.0",
"postcss-simple-vars": "^5.0.1",
"prop-types": "^15.5.10",
"pyodide": "^0.29.0",
"query-string": "^5.1.1",
"raw-loader": "^0.5.1",
"react": "^16.0.0",
Expand Down Expand Up @@ -102,7 +107,10 @@
"text-encoding": "0.7.0",
"to-style": "1.3.3",
"wav-encoder": "1.3.0",
"xhr": "2.5.0"
"xhr": "2.5.0",
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0",
"xterminal": "^2.1.13"
},
"peerDependencies": {
"react": "^16.0.0",
Expand All @@ -120,6 +128,7 @@
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"babel-loader": "8.3.0",
"baseline-browser-mapping": "^2.9.11",
"chromedriver": "117.0.3",
"enzyme": "3.10.0",
"enzyme-adapter-react-16": "1.15.7",
Expand Down
99 changes: 99 additions & 0 deletions src/components/code-editor/code-editor.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
@import "../../css/units.css";
@import "../../css/colors.css";
@import "../../css/z-index.css";

.blocks {
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;
}

.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;
}

[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;
}

.blocks :global(.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 :global(.blocklyToolboxDiv::-webkit-scrollbar) {
display: none;
}

.blocks :global(.blocklyFlyout) {
border-right: 1px solid $ui-black-transparent;
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 */
}

/*
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 :global(.blocklyMinimalBody) {
min-width: auto;
min-height: auto;
}
27 changes: 27 additions & 0 deletions src/components/code-editor/code-editor.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import PropTypes from 'prop-types';
import classNames from 'classnames';
import React from 'react';
import Box from '../box/box.jsx';
import styles from './code-editor.css';

const BlocksComponent = props => {
const {
containerRef,
dragOver,
...componentProps
} = props;
return (
<Box
className={classNames(styles.blocks, {
[styles.dragOver]: dragOver
})}
{...componentProps}
componentRef={containerRef}
/>
);
};
BlocksComponent.propTypes = {
containerRef: PropTypes.func,
dragOver: PropTypes.bool
};
export default BlocksComponent;
12 changes: 9 additions & 3 deletions src/components/gui/gui.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import MediaQuery from 'react-responsive';
import {Tab, Tabs, TabList, TabPanel} from 'react-tabs';
import tabStyles from 'react-tabs/style/react-tabs.css';
import VM from 'scratch-vm';

import Blocks from '../../containers/blocks.jsx';
// nanoscript will ebe added tomorrow trust me
//67
import BlockComponent from '../../containers/blocks.jsx';
import CodeEditor from '../../containers/code-editor.jsx';
import CostumeTab from '../../containers/costume-tab.jsx';
import TargetPane from '../../containers/target-pane.jsx';
import SoundTab from '../../containers/sound-tab.jsx';
Expand All @@ -19,7 +21,7 @@ import Box from '../box/box.jsx';
import MenuBar from '../menu-bar/menu-bar.jsx';
import CostumeLibrary from '../../containers/costume-library.jsx';
import BackdropLibrary from '../../containers/backdrop-library.jsx';
import Watermark from '../../containers/watermark.jsx';
import Watermark from '../../containers/watermark.jsx';
import SongsTab from '../../containers/songs-tab.jsx';
import Backpack from '../../containers/backpack.jsx';
import BrowserModal from '../browser-modal/browser-modal.jsx';
Expand Down Expand Up @@ -87,6 +89,7 @@ const GUIComponent = props => {
blocksId,
blocksTabVisible,
cardsVisible,
codingStyle = "blocks",
canChangeLanguage,
canChangeTheme,
canCreateNew,
Expand Down Expand Up @@ -165,6 +168,8 @@ const GUIComponent = props => {
vm,
...componentProps
} = omit(props, 'dispatch');
const Blocks = codingStyle === "blocks" ? BlockComponent : CodeEditor;
console.log(codingStyle);
if (children) {
return <Box {...componentProps}>{children}</Box>;
}
Expand Down Expand Up @@ -574,6 +579,7 @@ GUIComponent.defaultProps = {
canManageFiles: true,
canRemix: false,
canSave: false,
codingStyle: 'blocks',
canCreateCopy: false,
canShare: false,
canUseCloud: false,
Expand Down
2 changes: 1 addition & 1 deletion src/components/gui/icon--code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/language-selector/language-selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const LanguageSelector = ({currentLocale, label, onChange}) => (

LanguageSelector.propTypes = {
currentLocale: PropTypes.string,
label: PropTypes.string,
label: PropTypes.string,
onChange: PropTypes.func
};

Expand Down
2 changes: 0 additions & 2 deletions src/components/loader/loader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ const funFacts = [
"Did you know??? Boxy is a CLANKER.",
'Preparing emojis...',
'Herding cats...',
'Growing apples...',
'Removing dangos...',
'Modifying features...',
'Converting legacy lists...',
'Reticulating splines...',
'Constructing Boxys...',
'Breathing air...',
Expand Down
4 changes: 2 additions & 2 deletions src/containers/blocks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import VM from 'scratch-vm';

import log from '../lib/log.js';
import Prompt from './prompt.jsx';
import BlocksComponent from '../components/blocks/blocks.jsx';
import BlockComponent from '../components/blocks/blocks.jsx';
import ExtensionLibrary from './extension-library.jsx';
import extensionData from '../lib/libraries/extensions/index.jsx';
import CustomProcedures from './custom-procedures.jsx';
Expand Down Expand Up @@ -84,7 +84,7 @@ const addFunctionListener = (object, property, callback) => {

const DroppableBlocks = DropAreaHOC([
DragConstants.BACKPACK_CODE
])(BlocksComponent);
])(BlockComponent);

class Blocks extends React.Component {
constructor (props) {
Expand Down
Loading
Loading