diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f9d8b4e..0000000 --- a/LICENSE +++ /dev/null @@ -1,29 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2017, PROPHESSOR -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* 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. - -* 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. - -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. diff --git a/README.md b/README.md deleted file mode 100644 index 93d06ba..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# JsMB-IDE -Desktop IDE for JsMobileBasic diff --git a/config/env.js b/config/env.js deleted file mode 100644 index 8b39b6c..0000000 --- a/config/env.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -const fs = require('fs'); -const path = require('path'); -const paths = require('./paths'); - -// Make sure that including paths.js after env.js will read .env variables. -delete require.cache[require.resolve('./paths')]; - -const NODE_ENV = process.env.NODE_ENV; -if (!NODE_ENV) { - throw new Error( - 'The NODE_ENV environment variable is required but was not specified.' - ); -} - -// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use -var dotenvFiles = [ - `${paths.dotenv}.${NODE_ENV}.local`, - `${paths.dotenv}.${NODE_ENV}`, - // Don't include `.env.local` for `test` environment - // since normally you expect tests to produce the same - // results for everyone - NODE_ENV !== 'test' && `${paths.dotenv}.local`, - paths.dotenv, -].filter(Boolean); - -// Load environment variables from .env* files. Suppress warnings using silent -// if this file is missing. dotenv will never modify any environment variables -// that have already been set. -// https://github.com/motdotla/dotenv -dotenvFiles.forEach(dotenvFile => { - if (fs.existsSync(dotenvFile)) { - require('dotenv').config({ - path: dotenvFile, - }); - } -}); - -// We support resolving modules according to `NODE_PATH`. -// This lets you use absolute paths in imports inside large monorepos: -// https://github.com/facebookincubator/create-react-app/issues/253. -// It works similar to `NODE_PATH` in Node itself: -// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders -// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. -// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. -// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421 -// We also resolve them to make sure all tools using them work consistently. -const appDirectory = fs.realpathSync(process.cwd()); -process.env.NODE_PATH = (process.env.NODE_PATH || '') - .split(path.delimiter) - .filter(folder => folder && !path.isAbsolute(folder)) - .map(folder => path.resolve(appDirectory, folder)) - .join(path.delimiter); - -// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be -// injected into the application via DefinePlugin in Webpack configuration. -const REACT_APP = /^REACT_APP_/i; - -function getClientEnvironment(publicUrl) { - const raw = Object.keys(process.env) - .filter(key => REACT_APP.test(key)) - .reduce( - (env, key) => { - env[key] = process.env[key]; - return env; - }, - { - // Useful for determining whether we’re running in production mode. - // Most importantly, it switches React into the correct mode. - NODE_ENV: process.env.NODE_ENV || 'development', - // Useful for resolving the correct path to static assets in `public`. - // For example, . - // This should only be used as an escape hatch. Normally you would put - // images into the `src` and `import` them in code to get their paths. - PUBLIC_URL: publicUrl, - } - ); - // Stringify all values so we can feed into Webpack DefinePlugin - const stringified = { - 'process.env': Object.keys(raw).reduce((env, key) => { - env[key] = JSON.stringify(raw[key]); - return env; - }, {}), - }; - - return { raw, stringified }; -} - -module.exports = getClientEnvironment; diff --git a/config/jest/cssTransform.js b/config/jest/cssTransform.js deleted file mode 100644 index f1534f6..0000000 --- a/config/jest/cssTransform.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -// This is a custom Jest transformer turning style imports into empty objects. -// http://facebook.github.io/jest/docs/tutorial-webpack.html - -module.exports = { - process() { - return 'module.exports = {};'; - }, - getCacheKey() { - // The output is always the same. - return 'cssTransform'; - }, -}; diff --git a/config/jest/fileTransform.js b/config/jest/fileTransform.js deleted file mode 100644 index ffce0da..0000000 --- a/config/jest/fileTransform.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -const path = require('path'); - -// This is a custom Jest transformer turning file imports into filenames. -// http://facebook.github.io/jest/docs/tutorial-webpack.html - -module.exports = { - process(src, filename) { - return `module.exports = ${JSON.stringify(path.basename(filename))};`; - }, -}; diff --git a/config/paths.js b/config/paths.js deleted file mode 100644 index 14bb494..0000000 --- a/config/paths.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -const path = require('path'); -const fs = require('fs'); -const url = require('url'); - -// Make sure any symlinks in the project folder are resolved: -// https://github.com/facebookincubator/create-react-app/issues/637 -const appDirectory = fs.realpathSync(process.cwd()); -const resolveApp = relativePath => path.resolve(appDirectory, relativePath); - -const envPublicUrl = process.env.PUBLIC_URL; - -function ensureSlash(path, needsSlash) { - const hasSlash = path.endsWith('/'); - if (hasSlash && !needsSlash) { - return path.substr(path, path.length - 1); - } else if (!hasSlash && needsSlash) { - return `${path}/`; - } else { - return path; - } -} - -const getPublicUrl = appPackageJson => - envPublicUrl || require(appPackageJson).homepage; - -// We use `PUBLIC_URL` environment variable or "homepage" field to infer -// "public path" at which the app is served. -// Webpack needs to know it to put the right - -
- - - - \ No newline at end of file diff --git a/public/package.json b/public/package.json deleted file mode 100644 index 98c32fd..0000000 --- a/public/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "jsmb-ide", - "version": "0.1.0", - "main": "index.html", - "window": { - "width": 1024, - "height": 768 - } -} \ No newline at end of file diff --git a/scripts/build.js b/scripts/build.js deleted file mode 100644 index 5709f48..0000000 --- a/scripts/build.js +++ /dev/null @@ -1,150 +0,0 @@ -'use strict'; - -// Do this as the first thing so that any code reading it knows the right env. -process.env.BABEL_ENV = 'production'; -process.env.NODE_ENV = 'production'; - -// Makes the script crash on unhandled rejections instead of silently -// ignoring them. In the future, promise rejections that are not handled will -// terminate the Node.js process with a non-zero exit code. -process.on('unhandledRejection', err => { - throw err; -}); - -// Ensure environment variables are read. -require('../config/env'); - -const path = require('path'); -const chalk = require('chalk'); -const fs = require('fs-extra'); -const webpack = require('webpack'); -const config = require('../config/webpack.config.prod'); -const paths = require('../config/paths'); -const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); -const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages'); -const printHostingInstructions = require('react-dev-utils/printHostingInstructions'); -const FileSizeReporter = require('react-dev-utils/FileSizeReporter'); -const printBuildError = require('react-dev-utils/printBuildError'); - -const measureFileSizesBeforeBuild = - FileSizeReporter.measureFileSizesBeforeBuild; -const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild; -const useYarn = fs.existsSync(paths.yarnLockFile); - -// These sizes are pretty large. We'll warn for bundles exceeding them. -const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024; -const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024; - -// Warn and crash if required files are missing -if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { - process.exit(1); -} - -// First, read the current file sizes in build directory. -// This lets us display how much they changed later. -measureFileSizesBeforeBuild(paths.appBuild) - .then(previousFileSizes => { - // Remove all content but keep the directory so that - // if you're in it, you don't end up in Trash - fs.emptyDirSync(paths.appBuild); - // Merge with the public folder - copyPublicFolder(); - // Start the webpack build - return build(previousFileSizes); - }) - .then( - ({ stats, previousFileSizes, warnings }) => { - if (warnings.length) { - console.log(chalk.yellow('Compiled with warnings.\n')); - console.log(warnings.join('\n\n')); - console.log( - '\nSearch for the ' + - chalk.underline(chalk.yellow('keywords')) + - ' to learn more about each warning.' - ); - console.log( - 'To ignore, add ' + - chalk.cyan('// eslint-disable-next-line') + - ' to the line before.\n' - ); - } else { - console.log(chalk.green('Compiled successfully.\n')); - } - - console.log('File sizes after gzip:\n'); - printFileSizesAfterBuild( - stats, - previousFileSizes, - paths.appBuild, - WARN_AFTER_BUNDLE_GZIP_SIZE, - WARN_AFTER_CHUNK_GZIP_SIZE - ); - console.log(); - - const appPackage = require(paths.appPackageJson); - const publicUrl = paths.publicUrl; - const publicPath = config.output.publicPath; - const buildFolder = path.relative(process.cwd(), paths.appBuild); - printHostingInstructions( - appPackage, - publicUrl, - publicPath, - buildFolder, - useYarn - ); - }, - err => { - console.log(chalk.red('Failed to compile.\n')); - printBuildError(err); - process.exit(1); - } - ); - -// Create the production build and print the deployment instructions. -function build(previousFileSizes) { - console.log('Creating an optimized production build...'); - - let compiler = webpack(config); - return new Promise((resolve, reject) => { - compiler.run((err, stats) => { - if (err) { - return reject(err); - } - const messages = formatWebpackMessages(stats.toJson({}, true)); - if (messages.errors.length) { - // Only keep the first error. Others are often indicative - // of the same problem, but confuse the reader with noise. - if (messages.errors.length > 1) { - messages.errors.length = 1; - } - return reject(new Error(messages.errors.join('\n\n'))); - } - if ( - process.env.CI && - (typeof process.env.CI !== 'string' || - process.env.CI.toLowerCase() !== 'false') && - messages.warnings.length - ) { - console.log( - chalk.yellow( - '\nTreating warnings as errors because process.env.CI = true.\n' + - 'Most CI servers set it automatically.\n' - ) - ); - return reject(new Error(messages.warnings.join('\n\n'))); - } - return resolve({ - stats, - previousFileSizes, - warnings: messages.warnings, - }); - }); - }); -} - -function copyPublicFolder() { - fs.copySync(paths.appPublic, paths.appBuild, { - dereference: true, - filter: file => file !== paths.appHtml, - }); -} diff --git a/scripts/start.js b/scripts/start.js deleted file mode 100644 index 2686e7f..0000000 --- a/scripts/start.js +++ /dev/null @@ -1,92 +0,0 @@ -'use strict'; - -// Do this as the first thing so that any code reading it knows the right env. -process.env.BABEL_ENV = 'development'; -process.env.NODE_ENV = 'development'; - -// Makes the script crash on unhandled rejections instead of silently -// ignoring them. In the future, promise rejections that are not handled will -// terminate the Node.js process with a non-zero exit code. -process.on('unhandledRejection', err => { - throw err; -}); - -// Ensure environment variables are read. -require('../config/env'); - -const fs = require('fs'); -const chalk = require('chalk'); -const webpack = require('webpack'); -const WebpackDevServer = require('webpack-dev-server'); -const clearConsole = require('react-dev-utils/clearConsole'); -const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles'); -const { - choosePort, - createCompiler, - prepareProxy, - prepareUrls, -} = require('react-dev-utils/WebpackDevServerUtils'); -const openBrowser = require('react-dev-utils/openBrowser'); -const paths = require('../config/paths'); -const config = require('../config/webpack.config.dev'); -const createDevServerConfig = require('../config/webpackDevServer.config'); - -const useYarn = fs.existsSync(paths.yarnLockFile); -const isInteractive = process.stdout.isTTY; - -// Warn and crash if required files are missing -if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { - process.exit(1); -} - -// Tools like Cloud9 rely on this. -const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000; -const HOST = process.env.HOST || '0.0.0.0'; - -// We attempt to use the default port but if it is busy, we offer the user to -// run on a different port. `detect()` Promise resolves to the next free port. -choosePort(HOST, DEFAULT_PORT) - .then(port => { - if (port == null) { - // We have not found a port. - return; - } - const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'; - const appName = require(paths.appPackageJson).name; - const urls = prepareUrls(protocol, HOST, port); - // Create a webpack compiler that is configured with custom messages. - const compiler = createCompiler(webpack, config, appName, urls, useYarn); - // Load proxy config - const proxySetting = require(paths.appPackageJson).proxy; - const proxyConfig = prepareProxy(proxySetting, paths.appPublic); - // Serve webpack assets generated by the compiler over a web sever. - const serverConfig = createDevServerConfig( - proxyConfig, - urls.lanUrlForConfig - ); - const devServer = new WebpackDevServer(compiler, serverConfig); - // Launch WebpackDevServer. - devServer.listen(port, HOST, err => { - if (err) { - return console.log(err); - } - if (isInteractive) { - clearConsole(); - } - console.log(chalk.cyan('Starting the development server...\n')); - openBrowser(urls.localUrlForBrowser); - }); - - ['SIGINT', 'SIGTERM'].forEach(function(sig) { - process.on(sig, function() { - devServer.close(); - process.exit(); - }); - }); - }) - .catch(err => { - if (err && err.message) { - console.log(err.message); - } - process.exit(1); - }); diff --git a/scripts/test.js b/scripts/test.js deleted file mode 100644 index 399bfd3..0000000 --- a/scripts/test.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; - -// Do this as the first thing so that any code reading it knows the right env. -process.env.BABEL_ENV = 'test'; -process.env.NODE_ENV = 'test'; -process.env.PUBLIC_URL = ''; - -// Makes the script crash on unhandled rejections instead of silently -// ignoring them. In the future, promise rejections that are not handled will -// terminate the Node.js process with a non-zero exit code. -process.on('unhandledRejection', err => { - throw err; -}); - -// Ensure environment variables are read. -require('../config/env'); - -const jest = require('jest'); -const argv = process.argv.slice(2); - -// Watch unless on CI or in coverage mode -if (!process.env.CI && argv.indexOf('--coverage') < 0) { - argv.push('--watch'); -} - - -jest.run(argv); diff --git a/src/Backend/File.js b/src/Backend/File.js deleted file mode 100644 index 80636af..0000000 --- a/src/Backend/File.js +++ /dev/null @@ -1,21 +0,0 @@ -import fs from "fs"; - -class File { - static create(file, data) { - try { - return !fs.writeFileSync(file, data, "utf-8"); - } catch (e) { - return !!console.error(e); - } - } - - static createFolder(folder) { - try { - return !fs.mkdirSync(folder); - }catch(e){ - return !!console.error(e); - } - } -} - -export default File; \ No newline at end of file diff --git a/src/Backend/Project.js b/src/Backend/Project.js deleted file mode 100644 index 40553e4..0000000 --- a/src/Backend/Project.js +++ /dev/null @@ -1,56 +0,0 @@ -import File from "./File"; - -class Project { - static create(name = "Project", props = {}) { - let Package = { - "name": props.name || name.toLowerCase() || "project", - "version": "1.0.0", - "description": props.description || "Simple JsMobileBasic App", - "author": props.author || "JsMB-Developer", - "main": "index.html", - "repository": { - "type": "git", - "url": "https://github.com/PROPHESSOR/JsMB-IDE.org" - }, - "keywords": [ - "JsMB", - "JsMobileBasic" - ], - "private": true, - "license": "MIT", - JsMB: { - version: "alpha 10" - }, - window:{ - //TODO: Write me... - } - }; - - let Autorun = -`//########## JsMobileBasic Script##########\\\\ - -function Main(){ - println($JsMobileBasic.name); - println($JsMobileBasic.version); -}`; - - File.createFolder(name); - File.create(`${name}/package.json`, JSON.stringify(Package, null, 4)); - File.create(`${name}/Autorun.bas`); - - return true; - } - - static open(){ - //TODO: Write me... - return false; - } - - static save(){ - //TODO: Write me... - return false; - } - -} - -export default Project; \ No newline at end of file diff --git a/src/components/Sidebar/Icons.css b/src/components/Sidebar/Icons.css deleted file mode 100644 index 472b8cf..0000000 --- a/src/components/Sidebar/Icons.css +++ /dev/null @@ -1,15 +0,0 @@ -file:before { - background: url("./icons/hz.svg") left center no-repeat; - background-size: 16px; - padding-left: 16px; - content: " "; - margin-right: 8px; -} - -file[icon=bas]:before { - background: url("./icons/react.svg") left center no-repeat; -} - -file[icon=js]:before { - background: url("./icons/js.svg") left center no-repeat; -} \ No newline at end of file diff --git a/src/components/Sidebar/PlusBtn/index.jsx b/src/components/Sidebar/PlusBtn/index.jsx deleted file mode 100644 index 155e2d2..0000000 --- a/src/components/Sidebar/PlusBtn/index.jsx +++ /dev/null @@ -1,15 +0,0 @@ -import React, { Component } from 'react'; - -export default class PlusBtn extends Component { - constructor(props) { - super(props); - this.click = this.click.bind(this); - } - click() { - const filename = prompt("Filename: "); - this.props.handleClick(filename); - } - render() { - return - } -}; diff --git a/src/components/Sidebar/PlusBtn/styles.css b/src/components/Sidebar/PlusBtn/styles.css deleted file mode 100644 index d146a39..0000000 --- a/src/components/Sidebar/PlusBtn/styles.css +++ /dev/null @@ -1,6 +0,0 @@ -button { - color: #a0a0a0; - background: #404040; - border: 0; - border-radius: 3px; -} diff --git a/src/components/Sidebar/PlusBtn/styles.min.css b/src/components/Sidebar/PlusBtn/styles.min.css deleted file mode 100644 index ff3b970..0000000 --- a/src/components/Sidebar/PlusBtn/styles.min.css +++ /dev/null @@ -1 +0,0 @@ -button{color:#a0a0a0;background:#404040;border:0;border-radius:3px} diff --git a/src/components/Sidebar/PlusBtn/styles.scss b/src/components/Sidebar/PlusBtn/styles.scss deleted file mode 100644 index d60e7b9..0000000 --- a/src/components/Sidebar/PlusBtn/styles.scss +++ /dev/null @@ -1,6 +0,0 @@ -button { - color: #a0a0a0; - background: #404040; - border: 0; - border-radius: 3px; -} \ No newline at end of file diff --git a/src/components/Sidebar/Sidebar.css b/src/components/Sidebar/Sidebar.css deleted file mode 100644 index aa25726..0000000 --- a/src/components/Sidebar/Sidebar.css +++ /dev/null @@ -1,31 +0,0 @@ -aside { - min-width: 256px; - background: #202020; - box-shadow: 0 0 2px 0 #000; -} - -file { - color: #fff; - padding: 2px; - width: 100%; - /*text-align: center;*/ - background: #3A3A3A; - display: block; - box-sizing: border-box; -} - -file:hover { - background: #4A4A4A; - cursor: pointer; -} - -file.active { - background: #5A5A5A; -} - -header { - padding: 15px; - font-style: italic; - background: #303030; - color: #a0a0a0; -} \ No newline at end of file diff --git a/src/components/Sidebar/Sidebar.min.css b/src/components/Sidebar/Sidebar.min.css deleted file mode 100644 index dc693b7..0000000 --- a/src/components/Sidebar/Sidebar.min.css +++ /dev/null @@ -1 +0,0 @@ -aside{min-width:256px;background:#202020;box-shadow:0 0 2px 0 #000}file{color:#fff;padding:2px;width:100%;background:#3A3A3A;display:block;box-sizing:border-box}file:hover{background:#4A4A4A;cursor:pointer}file.active{background:#5A5A5A}header{padding:15px;font-style:italic;background:#303030;color:#a0a0a0}button{color:#a0a0a0;background:#404040;border:0;border-radius:3px} diff --git a/src/components/Sidebar/Sidebar.scss b/src/components/Sidebar/Sidebar.scss deleted file mode 100644 index aced58a..0000000 --- a/src/components/Sidebar/Sidebar.scss +++ /dev/null @@ -1,38 +0,0 @@ -aside { - min-width: 256px; - background: #202020; - box-shadow: 0 0 2px 0 #000; -} - -file { - color: #fff; - padding: 2px; - width: 100%; - /*text-align: center;*/ - background: #3A3A3A; - display: block; - box-sizing: border-box; - - &:hover { - background: #4A4A4A; - cursor: pointer; - } - - &.active { - background: #5A5A5A; - } -} - -header { - padding: 15px; - font-style: italic; - background: #303030; - color: #a0a0a0; -} - -button { - color: #a0a0a0; - background: #404040; - border: 0; - border-radius: 3px; -} \ No newline at end of file diff --git a/src/components/Sidebar/icons/folder.svg b/src/components/Sidebar/icons/folder.svg deleted file mode 100644 index c6f9b03..0000000 --- a/src/components/Sidebar/icons/folder.svg +++ /dev/null @@ -1 +0,0 @@ -default_folder \ No newline at end of file diff --git a/src/components/Sidebar/icons/html.svg b/src/components/Sidebar/icons/html.svg deleted file mode 100644 index a0152d8..0000000 --- a/src/components/Sidebar/icons/html.svg +++ /dev/null @@ -1 +0,0 @@ -file_type_html \ No newline at end of file diff --git a/src/components/Sidebar/icons/hz.svg b/src/components/Sidebar/icons/hz.svg deleted file mode 100644 index 629c95b..0000000 --- a/src/components/Sidebar/icons/hz.svg +++ /dev/null @@ -1 +0,0 @@ -default_file \ No newline at end of file diff --git a/src/components/Sidebar/icons/js.svg b/src/components/Sidebar/icons/js.svg deleted file mode 100644 index bcfade4..0000000 --- a/src/components/Sidebar/icons/js.svg +++ /dev/null @@ -1 +0,0 @@ -file_type_js_official \ No newline at end of file diff --git a/src/components/Sidebar/icons/module.svg b/src/components/Sidebar/icons/module.svg deleted file mode 100644 index 1ccf80b..0000000 --- a/src/components/Sidebar/icons/module.svg +++ /dev/null @@ -1 +0,0 @@ -file_type_cmake \ No newline at end of file diff --git a/src/components/Sidebar/icons/npm.svg b/src/components/Sidebar/icons/npm.svg deleted file mode 100644 index 02e6209..0000000 --- a/src/components/Sidebar/icons/npm.svg +++ /dev/null @@ -1 +0,0 @@ -file_type_npm \ No newline at end of file diff --git a/src/components/Sidebar/icons/react.svg b/src/components/Sidebar/icons/react.svg deleted file mode 100644 index dfb268a..0000000 --- a/src/components/Sidebar/icons/react.svg +++ /dev/null @@ -1 +0,0 @@ -file_type_reactjs \ No newline at end of file diff --git a/src/components/Sidebar/index.jsx b/src/components/Sidebar/index.jsx deleted file mode 100644 index 67d8250..0000000 --- a/src/components/Sidebar/index.jsx +++ /dev/null @@ -1,62 +0,0 @@ -import React, { Component } from 'react'; - -import PlusBtn from './PlusBtn'; - -import "./Sidebar.min.css"; -import "./Icons.css"; - -class File extends Component { - // constructor(props) { - // super(props); - // // this.handleClick = this.handleClick.bind(this); - // } - - handleClick(e) { - console.log(`You was click ${this.props.file.name}`); - } - - render() { - let filename = this.props.file.name; - return {filename} - } -} - -class Sidebar extends Component { - constructor(props) { - super(props); - this.handleClick = this.handleClick.bind(this); - // this.handleAddFile = this.handleAddFile.bind(this); - this.state = { - files: [{ - name: "Autorun.bas", - }] - }; - } - - handleClick(filename) { - if (!filename) return; - console.log(this.state); - const {files} = this.state; - this.setState({ - files: files.concat({ - //FIXME: this.state.files = undefined - name: filename - }) - }); - } - - render() { - return ( - - ); - } -} - -export default Sidebar; \ No newline at end of file diff --git a/src/components/Topbar/Topbar.jsx b/src/components/Topbar/Topbar.jsx deleted file mode 100644 index e87bd9a..0000000 --- a/src/components/Topbar/Topbar.jsx +++ /dev/null @@ -1,2 +0,0 @@ -import React, { Component } from 'react'; - diff --git a/src/containers/App/App.css b/src/containers/App/App.css deleted file mode 100644 index 4f6184c..0000000 --- a/src/containers/App/App.css +++ /dev/null @@ -1,13 +0,0 @@ -.App { - display: flex; - height: 100vh; - background: #303030; -} - -.codemirror { - width: 100%; -} - -.CodeMirror { - height: 100vh !important; -} diff --git a/src/containers/App/App.jsx b/src/containers/App/App.jsx deleted file mode 100644 index b183e92..0000000 --- a/src/containers/App/App.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React, { Component } from 'react'; -import Sidebar from '../../components/Sidebar'; -import './App.min.css'; -import CodeMirror from 'react-codemirror'; -import 'codemirror/lib/codemirror.css'; -import 'codemirror/theme/monokai.css'; - -//require('../MobileBasic'); - -import 'codemirror/mode/javascript/javascript'; - -import '../../menubar'; - -require('../../other/jsmb') - -class App extends Component { - render() { - return ( -
- - -
- ); - } -} - -export default App; \ No newline at end of file diff --git a/src/containers/App/App.min.css b/src/containers/App/App.min.css deleted file mode 100644 index dd17415..0000000 --- a/src/containers/App/App.min.css +++ /dev/null @@ -1 +0,0 @@ -.App{display:flex;height:100vh;background:#303030}.codemirror{width:100%}.CodeMirror{height:100vh !important} diff --git a/src/containers/App/App.scss b/src/containers/App/App.scss deleted file mode 100644 index 58f251d..0000000 --- a/src/containers/App/App.scss +++ /dev/null @@ -1,13 +0,0 @@ -.App { - display: flex; - height: 100vh; - background: #303030; -} - -.codemirror { - width: 100%; -} - -.CodeMirror { - height: 100vh !important; -} \ No newline at end of file diff --git a/src/containers/App/App.test.js b/src/containers/App/App.test.js deleted file mode 100644 index b84af98..0000000 --- a/src/containers/App/App.test.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; - -it('renders without crashing', () => { - const div = document.createElement('div'); - ReactDOM.render(, div); -}); diff --git a/src/index.css b/src/index.css deleted file mode 100644 index b4cc725..0000000 --- a/src/index.css +++ /dev/null @@ -1,5 +0,0 @@ -body { - margin: 0; - padding: 0; - font-family: sans-serif; -} diff --git a/src/index.jsx b/src/index.jsx deleted file mode 100644 index 7ce14c1..0000000 --- a/src/index.jsx +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import './index.css'; -import App from './containers/App/App'; -import registerServiceWorker from './registerServiceWorker'; - -ReactDOM.render(, document.getElementById('root')); -registerServiceWorker(); diff --git a/src/menubar.js b/src/menubar.js deleted file mode 100644 index 4224c30..0000000 --- a/src/menubar.js +++ /dev/null @@ -1,5 +0,0 @@ -/* global menuAdd, menuBarAdd, menuBarShow */ - -menuAdd("file", "Создать проект", /* Bar.File.createProject() */alert); -menuBarAdd("bar", "Файл", "file"); -menuBarShow("bar"); \ No newline at end of file diff --git a/src/other/jsmb.js b/src/other/jsmb.js deleted file mode 100644 index b7e5bf3..0000000 --- a/src/other/jsmb.js +++ /dev/null @@ -1,895 +0,0 @@ -// Copyright (c) PROPHESSOR 2018 -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE -import CodeMirror from 'codemirror' - - -CodeMirror.defineMode("jsmb", function (config, parserConfig) { - var indentUnit = config.indentUnit; - var statementIndent = parserConfig.statementIndent; - var jsonldMode = parserConfig.jsonld; - var jsonMode = parserConfig.json || jsonldMode; - var isTS = parserConfig.typescript; - var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; - - // Tokenizer - - var keywords = function () { - function kw(type) { return { type: type, style: "keyword" }; } - function fnc(type) { return { type: type, style: "builtin" }; } - var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); - var operator = kw("operator"), number = { type: "atom", style: "atom" }; - - const G = fnc('graphics'); - const S = { type: "object", style: "string" }; - - var jsmb = { - "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, - "return": C, "break": C, "continue": C, "new": kw("new"), "delete": C, "throw": C, "debugger": C, - "var": kw("var"), "const": kw("var"), "let": kw("var"), - "function": kw("function"), "catch": kw("catch"), - "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), - "in": operator, "typeof": operator, "instanceof": operator, - "true": number, "false": number, "null": number, "undefined": number, "NaN": number, "Infinity": number, - "this": kw("this"), "class": kw("class"), "super": kw("atom"), - "yield": C, "extends": C, - - // JsMB Bindings - "JsMB": S, - "$JsMobileBasic": S, - - "setColor": G, - "sqrt": G, - "sin": G, - "cos": G, - "tan": G, - "asin": G, - "acos": G, - "atan": G, - "abs": G, - "pow": G, - "ln": G, - "exp": G, - "min": G, - "max": G, - "chr": G, - "setLineWidth": G, - "fillRect": G, - "fullScreen": G, - "cls": G, - "fillScreen": G, - "drawRect": G, - "drawPlot": G, - "clearRect": G, - "drawLine": G, - "drawCube": G, - "drawArc": G, - "fillArc": G, - "fillRect4": G, - "drawRect4": G, - "fillTriangle": G, - "drawNangle": G, - "fillNangle": G, - "drawTriangle": G, - "drawString": G, - "repaint": G, - "setFontSize": G, - "setFont": G, - "makeLinearGradient": G, - "makeRadialGradient": G, - "setGradientColor": G, - "rgb": G, - "rgba": G, - "gelLoad": G, - "spriteGel": G, - "drawGel": G, - "drawSprite": G, - "gelSize": G, - "drawGelFragment": G, - "makeTexture": G, - "input": G, - "println": G, - "playSound": G, - "pauseSound": G, - "random": G, - "ctg": G, - "mod": G, - "limit": G, - "rad": G, - "deg": G, - "len": G, - "str": G, - "val": G, - "int": G, - "float": G, - "upper": G, - "lower": G, - "mid": G, - "asc": G, - "split": G, - "replace": G, - "localSaveData": G, - "localReadData": G, - "parseJSON": G, - "toJSON": G, - "toPSON": G, - "include": G, - "screenWidth": G, - "screenHeight": G, - "getMouseX": G, - "getMouseY": G, - "getLeftClicksCount": G, - "getRightClicksCount": G, - "log": G, - "debug": G, - "exit": G, - }; - - return jsmb; - }(); - - var isOperatorChar = /[+\-*&%=<>!?|~^@]/; - var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/; - - function readRegexp(stream) { - var escaped = false, next, inSet = false; - while ((next = stream.next()) != null) { - if (!escaped) { - if (next === "/" && !inSet) return; - if (next === "[") inSet = true; - else if (inSet && next === "]") inSet = false; - } - escaped = !escaped && next === "\\"; - } - } - - // Used as scratch variables to communicate multiple values without - // consing up tons of objects. - var type, content; - function ret(tp, style, cont) { - type = tp; content = cont; - return style; - } - function tokenBase(stream, state) { - var ch = stream.next(); - if (ch === '"' || ch === "'") { - state.tokenize = tokenString(ch); - return state.tokenize(stream, state); - } else if (ch === "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) { - return ret("number", "number"); - } else if (ch === "." && stream.match("..")) { - return ret("spread", "meta"); - } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) { - return ret(ch); - } else if (ch === "=" && stream.eat(">")) { - return ret("=>", "operator"); - } else if (ch === "0" && stream.eat(/x/i)) { - stream.eatWhile(/[\da-f]/i); - return ret("number", "number"); - } else if (ch === "0" && stream.eat(/o/i)) { - stream.eatWhile(/[0-7]/i); - return ret("number", "number"); - } else if (ch === "0" && stream.eat(/b/i)) { - stream.eatWhile(/[01]/i); - return ret("number", "number"); - } else if (/\d/.test(ch)) { - stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); - return ret("number", "number"); - } else if (ch === "/") { - if (stream.eat("*")) { - state.tokenize = tokenComment; - return tokenComment(stream, state); - } else if (stream.eat("/")) { - stream.skipToEnd(); - return ret("comment", "comment"); - } else if (expressionAllowed(stream, state, 1)) { - readRegexp(stream); - stream.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/); - return ret("regexp", "string-2"); - } else { - stream.eatWhile(isOperatorChar); - return ret("operator", "operator", stream.current()); - } - } else if (ch === "`") { - state.tokenize = tokenQuasi; - return tokenQuasi(stream, state); - } else if (ch === "#") { - stream.skipToEnd(); - return ret("error", "error"); - } else if (isOperatorChar.test(ch)) { - if (ch != ">" || !state.lexical || state.lexical.type != ">") - stream.eatWhile(isOperatorChar); - return ret("operator", "operator", stream.current()); - } else if (wordRE.test(ch)) { - stream.eatWhile(wordRE); - var word = stream.current() - if (state.lastType != ".") { - if (keywords.propertyIsEnumerable(word)) { - var kw = keywords[word] - return ret(kw.type, kw.style, word) - } - if (word === "async" && stream.match(/^\s*[\(\w]/, false)) - return ret("async", "keyword", word) - } - return ret("variable", "variable", word) - } - } - - function tokenString(quote) { - return function (stream, state) { - var escaped = false, next; - if (jsonldMode && stream.peek() === "@" && stream.match(isJsonldKeyword)) { - state.tokenize = tokenBase; - return ret("jsonld-keyword", "meta"); - } - while ((next = stream.next()) != null) { - if (next === quote && !escaped) break; - escaped = !escaped && next === "\\"; - } - if (!escaped) state.tokenize = tokenBase; - return ret("string", "string"); - }; - } - - function tokenComment(stream, state) { - var maybeEnd = false, ch; - while (ch = stream.next()) { - if (ch === "/" && maybeEnd) { - state.tokenize = tokenBase; - break; - } - maybeEnd = (ch === "*"); - } - return ret("comment", "comment"); - } - - function tokenQuasi(stream, state) { - var escaped = false, next; - while ((next = stream.next()) != null) { - if (!escaped && (next === "`" || next === "$" && stream.eat("{"))) { - state.tokenize = tokenBase; - break; - } - escaped = !escaped && next === "\\"; - } - return ret("quasi", "string-2", stream.current()); - } - - var brackets = "([{}])"; - // This is a crude lookahead trick to try and notice that we're - // parsing the argument patterns for a fat-arrow function before we - // actually hit the arrow token. It only works if the arrow is on - // the same line as the arguments and there's no strange noise - // (comments) in between. Fallback is to only notice when we hit the - // arrow, and not declare the arguments as locals for the arrow - // body. - function findFatArrow(stream, state) { - if (state.fatArrowAt) state.fatArrowAt = null; - var arrow = stream.string.indexOf("=>", stream.start); - if (arrow < 0) return; - - if (isTS) { // Try to skip TypeScript return type declarations after the arguments - var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow)) - if (m) arrow = m.index - } - - var depth = 0, sawSomething = false; - for (var pos = arrow - 1; pos >= 0; --pos) { - var ch = stream.string.charAt(pos); - var bracket = brackets.indexOf(ch); - if (bracket >= 0 && bracket < 3) { - if (!depth) { ++pos; break; } - if (--depth === 0) { if (ch === "(") sawSomething = true; break; } - } else if (bracket >= 3 && bracket < 6) { - ++depth; - } else if (wordRE.test(ch)) { - sawSomething = true; - } else if (/["'\/]/.test(ch)) { - return; - } else if (sawSomething && !depth) { - ++pos; - break; - } - } - if (sawSomething && !depth) state.fatArrowAt = pos; - } - - // Parser - - var atomicTypes = { "atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true }; - - function JSLexical(indented, column, type, align, prev, info) { - this.indented = indented; - this.column = column; - this.type = type; - this.prev = prev; - this.info = info; - if (align != null) this.align = align; - } - - function inScope(state, varname) { - for (var v = state.localVars; v; v = v.next) - if (v.name === varname) return true; - for (var cx = state.context; cx; cx = cx.prev) { - for (var v = cx.vars; v; v = v.next) - if (v.name === varname) return true; - } - } - - function parseJS(state, style, type, content, stream) { - var cc = state.cc; - // Communicate our context to the combinators. - // (Less wasteful than consing up a hundred closures on every call.) - cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style; - - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = true; - - while (true) { - var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement; - if (combinator(type, content)) { - while (cc.length && cc[cc.length - 1].lex) - cc.pop()(); - if (cx.marked) return cx.marked; - if (type === "variable" && inScope(state, content)) return "variable-2"; - return style; - } - } - } - - // Combinator utils - - var cx = { state: null, column: null, marked: null, cc: null }; - function pass() { - for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); - } - function cont() { - pass.apply(null, arguments); - return true; - } - function register(varname) { - function inList(list) { - for (var v = list; v; v = v.next) - if (v.name === varname) return true; - return false; - } - var state = cx.state; - cx.marked = "def"; - if (state.context) { - if (inList(state.localVars)) return; - state.localVars = { name: varname, next: state.localVars }; - } else { - if (inList(state.globalVars)) return; - if (parserConfig.globalVars) - state.globalVars = { name: varname, next: state.globalVars }; - } - } - - // Combinators - - var defaultVars = { name: "this", next: { name: "arguments" } }; - function pushcontext() { - cx.state.context = { prev: cx.state.context, vars: cx.state.localVars }; - cx.state.localVars = defaultVars; - } - function popcontext() { - cx.state.localVars = cx.state.context.vars; - cx.state.context = cx.state.context.prev; - } - function pushlex(type, info) { - var result = function () { - var state = cx.state, indent = state.indented; - if (state.lexical.type === "stat") indent = state.lexical.indented; - else for (var outer = state.lexical; outer && outer.type === ")" && outer.align; outer = outer.prev) - indent = outer.indented; - state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info); - }; - result.lex = true; - return result; - } - function poplex() { - var state = cx.state; - if (state.lexical.prev) { - if (state.lexical.type === ")") - state.indented = state.lexical.indented; - state.lexical = state.lexical.prev; - } - } - poplex.lex = true; - - function expect(wanted) { - function exp(type) { - if (type === wanted) return cont(); - else if (wanted === ";") return pass(); - else return cont(exp); - }; - return exp; - } - - function statement(type, value) { - if (type === "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex); - if (type === "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex); - if (type === "keyword b") return cont(pushlex("form"), statement, poplex); - if (type === "{") return cont(pushlex("}"), block, poplex); - if (type === ";") return cont(); - if (type === "if") { - if (cx.state.lexical.info === "else" && cx.state.cc[cx.state.cc.length - 1] === poplex) - cx.state.cc.pop()(); - return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse); - } - if (type === "function") return cont(functiondef); - if (type === "for") return cont(pushlex("form"), forspec, statement, poplex); - if (type === "variable") { - if (isTS && value === "type") { - cx.marked = "keyword" - return cont(typeexpr, expect("operator"), typeexpr, expect(";")); - } if (isTS && value === "declare") { - cx.marked = "keyword" - return cont(statement) - } else { - return cont(pushlex("stat"), maybelabel); - } - } - if (type === "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), - block, poplex, poplex); - if (type === "case") return cont(expression, expect(":")); - if (type === "default") return cont(expect(":")); - if (type === "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), - statement, poplex, popcontext); - if (type === "class") return cont(pushlex("form"), className, poplex); - if (type === "export") return cont(pushlex("stat"), afterExport, poplex); - if (type === "import") return cont(pushlex("stat"), afterImport, poplex); - if (type === "module") return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex) - if (type === "async") return cont(statement) - if (value === "@") return cont(expression, statement) - return pass(pushlex("stat"), expression, expect(";"), poplex); - } - function expression(type) { - return expressionInner(type, false); - } - function expressionNoComma(type) { - return expressionInner(type, true); - } - function parenExpr(type) { - if (type != "(") return pass() - return cont(pushlex(")"), expression, expect(")"), poplex) - } - function expressionInner(type, noComma) { - if (cx.state.fatArrowAt === cx.stream.start) { - var body = noComma ? arrowBodyNoComma : arrowBody; - if (type === "(") return cont(pushcontext, pushlex(")"), commasep(pattern, ")"), poplex, expect("=>"), body, popcontext); - else if (type === "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext); - } - - var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma; - if (atomicTypes.hasOwnProperty(type)) return cont(maybeop); - if (type === "function") return cont(functiondef, maybeop); - if (type === "class") return cont(pushlex("form"), classExpression, poplex); - if (type === "keyword c" || type === "async") return cont(noComma ? maybeexpressionNoComma : maybeexpression); - if (type === "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop); - if (type === "operator" || type === "spread") return cont(noComma ? expressionNoComma : expression); - if (type === "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop); - if (type === "{") return contCommasep(objprop, "}", null, maybeop); - if (type === "quasi") return pass(quasi, maybeop); - if (type === "new") return cont(maybeTarget(noComma)); - return cont(); - } - function maybeexpression(type) { - if (type.match(/[;\}\)\],]/)) return pass(); - return pass(expression); - } - function maybeexpressionNoComma(type) { - if (type.match(/[;\}\)\],]/)) return pass(); - return pass(expressionNoComma); - } - - function maybeoperatorComma(type, value) { - if (type === ",") return cont(expression); - return maybeoperatorNoComma(type, value, false); - } - function maybeoperatorNoComma(type, value, noComma) { - var me = noComma === false ? maybeoperatorComma : maybeoperatorNoComma; - var expr = noComma === false ? expression : expressionNoComma; - if (type === "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext); - if (type === "operator") { - if (/\+\+|--/.test(value) || isTS && value === "!") return cont(me); - if (value === "?") return cont(expression, expect(":"), expr); - return cont(expr); - } - if (type === "quasi") { return pass(quasi, me); } - if (type === ";") return; - if (type === "(") return contCommasep(expressionNoComma, ")", "call", me); - if (type === ".") return cont(property, me); - if (type === "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me); - if (isTS && value === "as") { cx.marked = "keyword"; return cont(typeexpr, me) } - } - function quasi(type, value) { - if (type != "quasi") return pass(); - if (value.slice(value.length - 2) != "${") return cont(quasi); - return cont(expression, continueQuasi); - } - function continueQuasi(type) { - if (type === "}") { - cx.marked = "string-2"; - cx.state.tokenize = tokenQuasi; - return cont(quasi); - } - } - function arrowBody(type) { - findFatArrow(cx.stream, cx.state); - return pass(type === "{" ? statement : expression); - } - function arrowBodyNoComma(type) { - findFatArrow(cx.stream, cx.state); - return pass(type === "{" ? statement : expressionNoComma); - } - function maybeTarget(noComma) { - return function (type) { - if (type === ".") return cont(noComma ? targetNoComma : target); - else if (type === "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma) - else return pass(noComma ? expressionNoComma : expression); - }; - } - function target(_, value) { - if (value === "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); } - } - function targetNoComma(_, value) { - if (value === "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); } - } - function maybelabel(type) { - if (type === ":") return cont(poplex, statement); - return pass(maybeoperatorComma, expect(";"), poplex); - } - function property(type) { - if (type === "variable") { cx.marked = "property"; return cont(); } - } - function objprop(type, value) { - if (type === "async") { - cx.marked = "property"; - return cont(objprop); - } else if (type === "variable" || cx.style === "keyword") { - cx.marked = "property"; - if (value === "get" || value === "set") return cont(getterSetter); - return cont(afterprop); - } else if (type === "number" || type === "string") { - cx.marked = jsonldMode ? "property" : (cx.style + " property"); - return cont(afterprop); - } else if (type === "jsonld-keyword") { - return cont(afterprop); - } else if (type === "modifier") { - return cont(objprop) - } else if (type === "[") { - return cont(expression, expect("]"), afterprop); - } else if (type === "spread") { - return cont(expression, afterprop); - } else if (type === ":") { - return pass(afterprop) - } - } - function getterSetter(type) { - if (type != "variable") return pass(afterprop); - cx.marked = "property"; - return cont(functiondef); - } - function afterprop(type) { - if (type === ":") return cont(expressionNoComma); - if (type === "(") return pass(functiondef); - } - function commasep(what, end, sep) { - function proceed(type, value) { - if (sep ? sep.indexOf(type) > -1 : type === ",") { - var lex = cx.state.lexical; - if (lex.info === "call") lex.pos = (lex.pos || 0) + 1; - return cont(function (type, value) { - if (type === end || value === end) return pass() - return pass(what) - }, proceed); - } - if (type === end || value === end) return cont(); - return cont(expect(end)); - } - return function (type, value) { - if (type === end || value === end) return cont(); - return pass(what, proceed); - }; - } - function contCommasep(what, end, info) { - for (var i = 3; i < arguments.length; i++) - cx.cc.push(arguments[i]); - return cont(pushlex(end, info), commasep(what, end), poplex); - } - function block(type) { - if (type === "}") return cont(); - return pass(statement, block); - } - function maybetype(type, value) { - if (isTS) { - if (type === ":") return cont(typeexpr); - if (value === "?") return cont(maybetype); - } - } - function typeexpr(type, value) { - if (type === "variable") { - if (value === "keyof") { - cx.marked = "keyword" - return cont(typeexpr) - } else { - cx.marked = "type" - return cont(afterType) - } - } - if (type === "string" || type === "number" || type === "atom") return cont(afterType); - if (type === "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType) - if (type === "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType) - if (type === "(") return cont(commasep(typearg, ")"), maybeReturnType) - } - function maybeReturnType(type) { - if (type === "=>") return cont(typeexpr) - } - function typeprop(type, value) { - if (type === "variable" || cx.style === "keyword") { - cx.marked = "property" - return cont(typeprop) - } else if (value === "?") { - return cont(typeprop) - } else if (type === ":") { - return cont(typeexpr) - } else if (type === "[") { - return cont(expression, maybetype, expect("]"), typeprop) - } - } - function typearg(type) { - if (type === "variable") return cont(typearg) - else if (type === ":") return cont(typeexpr) - } - function afterType(type, value) { - if (value === "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType) - if (value === "|" || type === ".") return cont(typeexpr) - if (type === "[") return cont(expect("]"), afterType) - if (value === "extends") return cont(typeexpr) - } - function maybeTypeArgs(_, value) { - if (value === "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType) - } - function vardef() { - return pass(pattern, maybetype, maybeAssign, vardefCont); - } - function pattern(type, value) { - if (type === "modifier") return cont(pattern) - if (type === "variable") { register(value); return cont(); } - if (type === "spread") return cont(pattern); - if (type === "[") return contCommasep(pattern, "]"); - if (type === "{") return contCommasep(proppattern, "}"); - } - function proppattern(type, value) { - if (type === "variable" && !cx.stream.match(/^\s*:/, false)) { - register(value); - return cont(maybeAssign); - } - if (type === "variable") cx.marked = "property"; - if (type === "spread") return cont(pattern); - if (type === "}") return pass(); - return cont(expect(":"), pattern, maybeAssign); - } - function maybeAssign(_type, value) { - if (value === "=") return cont(expressionNoComma); - } - function vardefCont(type) { - if (type === ",") return cont(vardef); - } - function maybeelse(type, value) { - if (type === "keyword b" && value === "else") return cont(pushlex("form", "else"), statement, poplex); - } - function forspec(type) { - if (type === "(") return cont(pushlex(")"), forspec1, expect(")"), poplex); - } - function forspec1(type) { - if (type === "var") return cont(vardef, expect(";"), forspec2); - if (type === ";") return cont(forspec2); - if (type === "variable") return cont(formaybeinof); - return pass(expression, expect(";"), forspec2); - } - function formaybeinof(_type, value) { - if (value === "in" || value === "of") { cx.marked = "keyword"; return cont(expression); } - return cont(maybeoperatorComma, forspec2); - } - function forspec2(type, value) { - if (type === ";") return cont(forspec3); - if (value === "in" || value === "of") { cx.marked = "keyword"; return cont(expression); } - return pass(expression, expect(";"), forspec3); - } - function forspec3(type) { - if (type != ")") cont(expression); - } - function functiondef(type, value) { - if (value === "*") { cx.marked = "keyword"; return cont(functiondef); } - if (type === "variable") { register(value); return cont(functiondef); } - if (type === "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext); - if (isTS && value === "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, functiondef) - } - function funarg(type) { - if (type === "spread" || type === "modifier") return cont(funarg); - return pass(pattern, maybetype, maybeAssign); - } - function classExpression(type, value) { - // Class expressions may have an optional name. - if (type === "variable") return className(type, value); - return classNameAfter(type, value); - } - function className(type, value) { - if (type === "variable") { register(value); return cont(classNameAfter); } - } - function classNameAfter(type, value) { - if (value === "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, classNameAfter) - if (value === "extends" || value === "implements" || (isTS && type === ",")) - return cont(isTS ? typeexpr : expression, classNameAfter); - if (type === "{") return cont(pushlex("}"), classBody, poplex); - } - function classBody(type, value) { - if (type === "modifier" || type === "async" || - (type === "variable" && - (value === "static" || value === "get" || value === "set") && - cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) { - cx.marked = "keyword"; - return cont(classBody); - } - if (type === "variable") { - cx.marked = "property"; - return cont(isTS ? classfield : functiondef, classBody); - } - if (type === "[") - return cont(expression, expect("]"), isTS ? classfield : functiondef, classBody) - if (value === "*") { - cx.marked = "keyword"; - return cont(classBody); - } - if (type === ";") return cont(classBody); - if (type === "}") return cont(); - if (value === "@") return cont(expression, classBody) - } - function classfield(type, value) { - if (value === "?") return cont(classfield) - if (type === ":") return cont(typeexpr, maybeAssign) - if (value === "=") return cont(expressionNoComma) - return pass(functiondef) - } - function afterExport(type, value) { - if (value === "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); } - if (value === "default") { cx.marked = "keyword"; return cont(expression, expect(";")); } - if (type === "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";")); - return pass(statement); - } - function exportField(type, value) { - if (value === "as") { cx.marked = "keyword"; return cont(expect("variable")); } - if (type === "variable") return pass(expressionNoComma, exportField); - } - function afterImport(type) { - if (type === "string") return cont(); - return pass(importSpec, maybeMoreImports, maybeFrom); - } - function importSpec(type, value) { - if (type === "{") return contCommasep(importSpec, "}"); - if (type === "variable") register(value); - if (value === "*") cx.marked = "keyword"; - return cont(maybeAs); - } - function maybeMoreImports(type) { - if (type === ",") return cont(importSpec, maybeMoreImports) - } - function maybeAs(_type, value) { - if (value === "as") { cx.marked = "keyword"; return cont(importSpec); } - } - function maybeFrom(_type, value) { - if (value === "from") { cx.marked = "keyword"; return cont(expression); } - } - function arrayLiteral(type) { - if (type === "]") return cont(); - return pass(commasep(expressionNoComma, "]")); - } - - function isContinuedStatement(state, textAfter) { - return state.lastType === "operator" || state.lastType === "," || - isOperatorChar.test(textAfter.charAt(0)) || - /[,.]/.test(textAfter.charAt(0)); - } - - function expressionAllowed(stream, state, backUp) { - return state.tokenize === tokenBase && - /^(?:operator|sof|keyword c|case|new|export|default|[\[{}\(,;:]|=>)$/.test(state.lastType) || - (state.lastType === "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0)))) - } - - // Interface - - return { - startState: function (basecolumn) { - var state = { - tokenize: tokenBase, - lastType: "sof", - cc: [], - lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), - localVars: parserConfig.localVars, - context: parserConfig.localVars && { vars: parserConfig.localVars }, - indented: basecolumn || 0 - }; - if (parserConfig.globalVars && typeof parserConfig.globalVars === "object") - state.globalVars = parserConfig.globalVars; - return state; - }, - - token: function (stream, state) { - if (stream.sol()) { - if (!state.lexical.hasOwnProperty("align")) - state.lexical.align = false; - state.indented = stream.indentation(); - findFatArrow(stream, state); - } - if (state.tokenize != tokenComment && stream.eatSpace()) return null; - var style = state.tokenize(stream, state); - if (type === "comment") return style; - state.lastType = type === "operator" && (content === "++" || content === "--") ? "incdec" : type; - return parseJS(state, style, type, content, stream); - }, - - indent: function (state, textAfter) { - if (state.tokenize === tokenComment) return CodeMirror.Pass; - if (state.tokenize != tokenBase) return 0; - var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top - // Kludge to prevent 'maybelse' from blocking lexical scope pops - if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { - var c = state.cc[i]; - if (c === poplex) lexical = lexical.prev; - else if (c != maybeelse) break; - } - while ((lexical.type === "stat" || lexical.type === "form") && - (firstChar === "}" || ((top = state.cc[state.cc.length - 1]) && - (top === maybeoperatorComma || top === maybeoperatorNoComma) && - !/^[,\.=+\-*:?[\(]/.test(textAfter)))) - lexical = lexical.prev; - if (statementIndent && lexical.type === ")" && lexical.prev.type === "stat") - lexical = lexical.prev; - var type = lexical.type, closing = firstChar === type; - - if (type === "vardef") return lexical.indented + (state.lastType === "operator" || state.lastType === "," ? lexical.info + 1 : 0); - else if (type === "form" && firstChar === "{") return lexical.indented; - else if (type === "form") return lexical.indented + indentUnit; - else if (type === "stat") - return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0); - else if (lexical.info === "switch" && !closing && parserConfig.doubleIndentSwitch != false) - return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); - else if (lexical.align) return lexical.column + (closing ? 0 : 1); - else return lexical.indented + (closing ? 0 : indentUnit); - }, - - electricInput: /^\s*(?:case .*?:|default:|\{|\})$/, - blockCommentStart: jsonMode ? null : "/*", - blockCommentEnd: jsonMode ? null : "*/", - lineComment: jsonMode ? null : "//", - fold: "brace", - closeBrackets: "()[]{}''\"\"``", - - helperType: jsonMode ? "json" : "javascript", - jsonldMode: jsonldMode, - jsonMode: jsonMode, - - expressionAllowed: expressionAllowed, - - skipExpression: function (state) { - var top = state.cc[state.cc.length - 1] - if (top === expression || top === expressionNoComma) state.cc.pop() - } - }; -}); - -CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/); - -CodeMirror.defineMIME("text/javascript", "javascript"); -CodeMirror.defineMIME("text/ecmascript", "javascript"); -CodeMirror.defineMIME("application/javascript", "javascript"); -CodeMirror.defineMIME("application/x-javascript", "javascript"); -CodeMirror.defineMIME("application/ecmascript", "javascript"); -CodeMirror.defineMIME("application/json", { name: "javascript", json: true }); -CodeMirror.defineMIME("application/x-json", { name: "javascript", json: true }); -CodeMirror.defineMIME("application/ld+json", { name: "javascript", jsonld: true }); -CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true }); -CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true }); \ No newline at end of file diff --git a/src/registerServiceWorker.js b/src/registerServiceWorker.js deleted file mode 100644 index 4a3ccf0..0000000 --- a/src/registerServiceWorker.js +++ /dev/null @@ -1,108 +0,0 @@ -// In production, we register a service worker to serve assets from local cache. - -// This lets the app load faster on subsequent visits in production, and gives -// it offline capabilities. However, it also means that developers (and users) -// will only see deployed updates on the "N+1" visit to a page, since previously -// cached resources are updated in the background. - -// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. -// This link also includes instructions on opting out of this behavior. - -const isLocalhost = Boolean( - window.location.hostname === 'localhost' || - // [::1] is the IPv6 localhost address. - window.location.hostname === '[::1]' || - // 127.0.0.1/8 is considered localhost for IPv4. - window.location.hostname.match( - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ - ) -); - -export default function register() { - if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { - // The URL constructor is available in all browsers that support SW. - const publicUrl = new URL(process.env.PUBLIC_URL, window.location); - if (publicUrl.origin !== window.location.origin) { - // Our service worker won't work if PUBLIC_URL is on a different origin - // from what our page is served on. This might happen if a CDN is used to - // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374 - return; - } - - window.addEventListener('load', () => { - const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; - - if (!isLocalhost) { - // Is not local host. Just register service worker - registerValidSW(swUrl); - } else { - // This is running on localhost. Lets check if a service worker still exists or not. - checkValidServiceWorker(swUrl); - } - }); - } -} - -function registerValidSW(swUrl) { - navigator.serviceWorker - .register(swUrl) - .then(registration => { - registration.onupdatefound = () => { - const installingWorker = registration.installing; - installingWorker.onstatechange = () => { - if (installingWorker.state === 'installed') { - if (navigator.serviceWorker.controller) { - // At this point, the old content will have been purged and - // the fresh content will have been added to the cache. - // It's the perfect time to display a "New content is - // available; please refresh." message in your web app. - console.log('New content is available; please refresh.'); - } else { - // At this point, everything has been precached. - // It's the perfect time to display a - // "Content is cached for offline use." message. - console.log('Content is cached for offline use.'); - } - } - }; - }; - }) - .catch(error => { - console.error('Error during service worker registration:', error); - }); -} - -function checkValidServiceWorker(swUrl) { - // Check if the service worker can be found. If it can't reload the page. - fetch(swUrl) - .then(response => { - // Ensure service worker exists, and that we really are getting a JS file. - if ( - response.status === 404 || - response.headers.get('content-type').indexOf('javascript') === -1 - ) { - // No service worker found. Probably a different app. Reload the page. - navigator.serviceWorker.ready.then(registration => { - registration.unregister().then(() => { - window.location.reload(); - }); - }); - } else { - // Service worker found. Proceed as normal. - registerValidSW(swUrl); - } - }) - .catch(() => { - console.log( - 'No internet connection found. App is running in offline mode.' - ); - }); -} - -export function unregister() { - if ('serviceWorker' in navigator) { - navigator.serviceWorker.ready.then(registration => { - registration.unregister(); - }); - } -}