Skip to content

Commit a173405

Browse files
author
Ray Schamp
committedSep 15, 2016
Initial commit
0 parents  commit a173405

16 files changed

+256
-0
lines changed
 

‎.editorconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
charset = utf-8
7+
indent_size = 4
8+
trim_trailing_whitespace = true
9+
10+
[*.{js,html}]
11+
indent_style = space

‎.eslintignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/*
2+
build/*

‎.eslintrc

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"parser": "babel-eslint",
3+
"rules": {
4+
"curly": [2, "multi-line"],
5+
"eol-last": [2],
6+
"indent": [2, 4],
7+
"linebreak-style": [2, "unix"],
8+
"max-len": [2, 120, 4],
9+
"no-trailing-spaces": [2, { "skipBlankLines": true }],
10+
"no-unused-vars": [2, {"args": "after-used", "varsIgnorePattern": "^_"}],
11+
"quotes": [2, "single"],
12+
"semi": [2, "always"],
13+
"space-before-function-paren": [2, "always"],
14+
"strict": [2, "never"]
15+
},
16+
"env": {
17+
"browser": true,
18+
"es6": true,
19+
"node": true
20+
},
21+
"plugins": [
22+
"react"
23+
],
24+
"extends": ["eslint:recommended", "plugin:react/recommended"]
25+
}

‎.gitignore

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Mac OS
2+
.DS_Store
3+
4+
# NPM
5+
/node_modules
6+
npm-*
7+
8+
# Testing
9+
/.nyc_output
10+
/coverage

‎LICENSE

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Copyright (c) 2016, Massachusetts Institute of Technology
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5+
6+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7+
8+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9+
10+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11+
12+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

‎Makefile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
ESLINT=./node_modules/.bin/eslint
2+
NODE=node
3+
WEBPACK=./node_modules/.bin/webpack --progress --colors
4+
WEBPACK_DEV_SERVER=./node_modules/.bin/webpack-dev-server
5+
6+
# ------------------------------------------------------------------------------
7+
8+
build:
9+
$(WEBPACK)
10+
11+
watch:
12+
$(WEBPACK) --watch
13+
14+
serve:
15+
$(WEBPACK_DEV_SERVER) --port 8601 --config playground.config.js
16+
17+
# ------------------------------------------------------------------------------
18+
19+
lint:
20+
$(ESLINT) . --ext .js,.jsx
21+
22+
test:
23+
@make lint
24+
@make build
25+
26+
.PHONY: build watch serve lint

‎README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# scratch-gui
2+
#### Scratch GUI is a set of React components that comprise the interface for creating and running Scratch 3.0 projects
3+
4+
## Installation
5+
This requires you to have Git and Node.js installed.
6+
7+
In your own node environment/application:
8+
```bash
9+
npm install https://github.com/LLK/scratch-gui.git
10+
```
11+
If you want to edit/play yourself:
12+
```bash
13+
git clone git@github.com:LLK/scratch-gui.git
14+
cd scratch-gui
15+
npm install
16+
```
17+
18+
## Playground
19+
This requires Node.js to be installed.
20+
21+
## Running the Playground
22+
Open a Command Prompt or Terminal in the repository and run:
23+
```bash
24+
npm start
25+
```
26+
Then go to [http://localhost:8601/](http://localhost:8601/) - the playground outputs the default GUI component
27+
28+
## Testing
29+
```bash
30+
make test
31+
```
32+
33+
## Donate
34+
We provide [Scratch](https://scratch.mit.edu) free of charge, and want to keep it that way! Please consider making a [donation](https://secure.donationpay.org/scratchfoundation/) to support our continued engineering, design, community, and resource development efforts. Donations of any size are appreciated. Thank you!

‎TRADEMARK

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The Scratch trademarks, including the Scratch name, logo, the Scratch Cat, Gobo, Pico, Nano, Tera and Giga graphics (the "Marks"), are property of the Massachusetts Institute of Technology (MIT), and the use of the Marks is governed by this policy.
2+
3+
You may use the Marks to refer to Scratch in Substantially Unmodified form.
4+
5+
"Substantially Unmodified" means the source code provided by MIT, possibly with minor modifications including but not limited to: bug fixes (including security), changing the locations of files for better integration with the host operating system, adding documentation, and changes to the dynamic linking of libraries.
6+
7+
A version is not "Substantially Unmodified" if it incorporates features not present in a release of Scratch by MIT. If you do make a substantial modification, to avoid confusion with versions of Scratch produced by MIT you must remove all Marks from your version of the software and refrain from using any of the Marks to refer to your version.

‎index.html

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Scratch GUI Playground</title>
6+
</head>
7+
<body>
8+
<div id="app"></div>
9+
<script type="text/javascript" src="playground.js"></script>
10+
</body>
11+
</html>

‎package.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "scratch-gui",
3+
"version": "0.1.0",
4+
"description": "GraphicaL User Interface for creating and running Scratch 3.0 projects",
5+
"main": "./src/index.js",
6+
"scripts": {
7+
"start": "make serve"
8+
},
9+
"author": "Massachusetts Institute of Technology",
10+
"license": "BSD-3-Clause",
11+
"homepage": "https://github.com/LLK/scratch-gui#readme",
12+
"repository": {
13+
"type": "git",
14+
"url": "git+ssh://git@github.com/LLK/scratch-gui.git"
15+
},
16+
"devDependencies": {
17+
"babel-core": "6.14.0",
18+
"babel-eslint": "6.1.2",
19+
"babel-loader": "6.2.5",
20+
"babel-preset-es2015": "6.14.0",
21+
"babel-preset-react": "6.11.1",
22+
"eslint": "3.5.0",
23+
"eslint-plugin-react": "6.2.1",
24+
"exports-loader": "0.6.3",
25+
"imports-loader": "0.6.5",
26+
"json-loader": "0.5.4",
27+
"react": "15.3.1",
28+
"react-dom": "15.3.1",
29+
"scratch-blocks": "github:llk/scratch-blocks#develop",
30+
"scratch-render": "github:llk/scratch-render#develop",
31+
"scratch-vm": "github:llk/scratch-vm#develop",
32+
"webpack": "1.13.2",
33+
"webpack-dev-server": "1.15.2"
34+
}
35+
}

‎playground.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var config = require('./webpack.config');
2+
module.exports = Object.assign({}, config, {
3+
entry: {
4+
playground: './src/playground.jsx'
5+
},
6+
});

‎src/components/blocks.jsx

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
import ScratchBlocks from 'scratch-blocks/blocks_compressed_vertical';
3+
4+
export default class Blocks extends React.Component {
5+
mountBlocks (component) {
6+
ScratchBlocks.inject(component, {});
7+
}
8+
render () {
9+
return (
10+
<div
11+
className="scratch-blocks"
12+
ref={this.mountBlocks} />
13+
);
14+
}
15+
}

‎src/components/gui.jsx

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import VM from 'scratch-vm';
3+
import Blocks from './blocks.jsx';
4+
5+
export default class GUI extends React.Component {
6+
render () {
7+
return (
8+
<div className="scratch-gui">
9+
<Blocks />
10+
</div>
11+
);
12+
}
13+
}
14+
15+
GUI.defaultProps = {
16+
vm: new VM()
17+
};

‎src/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import GUIComponent from './components/gui.jsx';
2+
import BlocksComponent from './components/blocks.jsx';
3+
4+
export const GUI = GUIComponent;
5+
export const Blocks = BlocksComponent;

‎src/playground.jsx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
import ReactDOM from 'react-dom';
3+
import {GUI} from '.';
4+
5+
ReactDOM.render(
6+
<GUI />,
7+
document.getElementById('app'));

‎webpack.config.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
var path = require('path');
2+
module.exports = {
3+
entry: {
4+
gui: './src/index.js'
5+
},
6+
output: {
7+
library: 'ScratchGUI',
8+
path: __dirname,
9+
filename: '[name].js'
10+
},
11+
module: {
12+
loaders: [{
13+
test: /\.jsx?$/,
14+
loader: 'babel-loader',
15+
include: path.resolve(__dirname, 'src'),
16+
query: {
17+
presets: ['es2015', 'react']
18+
}
19+
}, {
20+
test: /\.json$/,
21+
loader: 'json-loader'
22+
}, {
23+
test: require.resolve('scratch-blocks/blockly_compressed_vertical'),
24+
loader: 'exports?Blockly'
25+
}, {
26+
test: require.resolve('scratch-blocks/blocks_compressed'),
27+
loader: 'imports?Blockly=scratch-blocks/blockly_compressed_vertical!exports?Blockly'
28+
}, {
29+
test: require.resolve('scratch-blocks/blocks_compressed_vertical'),
30+
loader: 'imports?Blockly=scratch-blocks/blocks_compressed!exports?Blockly'
31+
}]
32+
}
33+
};

0 commit comments

Comments
 (0)
Please sign in to comment.