Browse Source

Initial commit.

gwillz 2 years ago
commit
e5bd1429b8
15 changed files with 7814 additions and 0 deletions
  1. 4 0
      .gitignore
  2. 27 0
      app.js
  3. 21 0
      css/index.css
  4. 4 0
      css/indexStyle.ts
  5. 7501 0
      package-lock.json
  6. 52 0
      package.json
  7. 37 0
      postcss.config.js
  8. 19 0
      public/index.html
  9. 14 0
      src/editor.tsx
  10. 25 0
      src/index.tsx
  11. 14 0
      src/presentation.tsx
  12. 5 0
      src/styles.ts
  13. 14 0
      src/toolbar.tsx
  14. 27 0
      tsconfig.json
  15. 50 0
      webpack.config.js

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+node_modules
+cache
+public/*
+!public/index.html

+ 27 - 0
app.js

@@ -0,0 +1,27 @@
+// @ts-check
+const path = require('path');
+const express = require('express');
+
+const PORT = 5000;
+const PATH = path.resolve(__dirname, "public");
+
+function main() {
+    express()
+    
+    .use(express.static(PATH))
+    
+    .get("/", (req, res) => {
+        res.sendFile(path.resolve(PATH, "index.html"));
+    })
+    
+    .listen(PORT, err => {
+        if (err) console.error(err);
+        console.log('serving:', PATH);
+        console.log('listening on port:', PORT);
+        console.log('Press Ctrl+C to quit.');
+    });
+}
+
+if (require.main === module) {
+    main();
+}

+ 21 - 0
css/index.css

@@ -0,0 +1,21 @@
+
+
+@import "reset.css";
+
+html, body {
+    box-sizing: border-box;
+    height: 100%;
+    width: 100%;
+    margin: 0;
+    padding: 0;
+}
+
+*, *::before, *::after {
+    box-sizing: inherit;
+}
+
+#root {
+    height: 100%;
+    width: 100%;
+}
+

+ 4 - 0
css/indexStyle.ts

@@ -0,0 +1,4 @@
+export const indexStyle = {
+  root: 'root'
+,
+};

File diff suppressed because it is too large
+ 7501 - 0
package-lock.json


+ 52 - 0
package.json

@@ -0,0 +1,52 @@
+{
+  "name": "slides",
+  "version": "1.0.0",
+  "description": "",
+  "main": "index.js",
+  "scripts": {
+    "start": "node app.js",
+    "webpack": "webpack --progress",
+    "postcss": "postcss --verbose -o public/index.css css/index.css",
+    "clean": "rm public/*.{js,map,css}",
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "author": "",
+  "license": "ISC",
+  "dependencies": {
+    "@fortawesome/fontawesome-svg-core": "^1.2.12",
+    "@fortawesome/free-solid-svg-icons": "^5.6.3",
+    "@fortawesome/react-fontawesome": "^0.1.3",
+    "draft-js": "^0.10.5",
+    "express": "^4.16.4",
+    "react": "^16.7.0",
+    "react-dom": "^16.7.0",
+    "react-redux": "^6.0.0",
+    "redux": "^4.0.1",
+    "reset.css": "^2.0.2",
+    "showdown": "^1.9.0"
+  },
+  "devDependencies": {
+    "@types/classnames": "^2.2.7",
+    "@types/draft-js": "^0.10.27",
+    "@types/react": "^16.7.18",
+    "@types/react-dom": "^16.0.11",
+    "@types/react-redux": "^6.0.12",
+    "@types/redux": "^3.6.0",
+    "@types/showdown": "^1.9.1",
+    "autoprefixer": "^9.4.4",
+    "classnames": "^2.2.6",
+    "cssnano": "^4.1.8",
+    "fork-ts-checker-webpack-plugin": "^0.5.2",
+    "postcss": "^7.0.7",
+    "postcss-cli": "^6.1.1",
+    "postcss-import": "^12.0.1",
+    "postcss-modules": "^1.4.1",
+    "postcss-preset-env": "^6.5.0",
+    "postcss-typescript-css": "^0.2.1",
+    "ts-loader": "^5.3.3",
+    "tslint": "^5.12.0",
+    "typescript": "^3.2.2",
+    "webpack": "^4.28.3",
+    "webpack-cli": "^3.2.1"
+  }
+}

+ 37 - 0
postcss.config.js

@@ -0,0 +1,37 @@
+
+const typescriptCss = require('postcss-typescript-css');
+const isProduction = (process.env.NODE_ENV === 'production');
+
+module.exports = {
+    map: !isProduction,
+    plugins: {
+        'postcss-import': {},
+        'postcss-preset-env': {
+            stage: 0,
+            features: {
+                'custom-properties': {
+                    preserve: false,
+                },
+            },
+        },
+        'autoprefixer': {},
+        'postcss-modules': {
+            generateScopedName: isProduction ? 'gt[sha1:hash:hex:4]' : '[local]',
+            getJSON: (cssFileName, content) => {
+                typescriptCss({
+                    cssFileName,
+                    content,
+                })();
+            },
+        }
+    }
+}
+
+if (isProduction) {
+    module.exports.plugins =
+    Object.assign(module.exports.plugins, {
+        'cssnano': {
+            preset: 'default',
+        },
+    })
+}

+ 19 - 0
public/index.html

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Slides</title>
+    <meta charset="utf-8">
+    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
+    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
+    
+    <link rel="shortcut icon" href="/favicon.ico">
+    <link rel="apple-touch-icon" href="/img/apple-touch-icon.png">
+    
+    <script type="text/javascript" src="/vendors~index.js"></script>
+    <link rel="stylesheet" type="text/css" href="/index.css">
+</head>
+<body>
+    <div id="root"></div>
+    <script type="text/javascript" src="/index.js"></script>
+</body>
+</html>

+ 14 - 0
src/editor.tsx

@@ -0,0 +1,14 @@
+
+import * as React from 'react';
+import styles from './styles';
+
+
+export class Editor extends React.Component {
+    render() {
+        return (
+            <div className={styles('editor')}>
+                editor
+            </div>
+        )
+    }
+}

+ 25 - 0
src/index.tsx

@@ -0,0 +1,25 @@
+
+import * as React from 'react';
+import { render } from 'react-dom';
+import style from './styles';
+
+import {Toolbar} from './toolbar'
+import {Editor} from './editor'
+import {Presentation} from './presentation'
+
+
+class App extends React.Component {
+    render() {
+        return (
+            <div id={style("root")}>
+                <Toolbar/>
+                <div className={style("split-view")}>
+                    <Editor/>
+                    <Presentation/>
+                </div>
+            </div>
+        )
+    }
+}
+
+render(<App/>, document.getElementById("root") as HTMLElement)

+ 14 - 0
src/presentation.tsx

@@ -0,0 +1,14 @@
+
+import * as React from 'react';
+import styles from './styles';
+
+
+export class Presentation extends React.Component {
+    render() {
+        return (
+            <div className={styles('present')}>
+                present
+            </div>
+        )
+    }
+}

+ 5 - 0
src/styles.ts

@@ -0,0 +1,5 @@
+
+import cn from 'classnames/bind'
+import {indexStyle} from '../css/indexStyle'
+
+export default cn.bind(indexStyle);

+ 14 - 0
src/toolbar.tsx

@@ -0,0 +1,14 @@
+
+import * as React from 'react';
+import styles from './styles';
+
+
+export class Toolbar extends React.Component {
+    render() {
+        return (
+            <div className={styles('toolbar')}>
+                toolbar
+            </div>
+        )
+    }
+}

+ 27 - 0
tsconfig.json

@@ -0,0 +1,27 @@
+{
+    "compilerOptions": {
+        "module": "esnext",
+        "target": "es5",
+        "lib": ["es6", "es2017", "dom"],
+        "sourceMap": true,
+        "importHelpers": true,
+        "jsx": "react",
+        "moduleResolution": "node",
+        "forceConsistentCasingInFileNames": false,
+        "noImplicitReturns": true,
+        "noImplicitThis": false,
+        "noImplicitAny": true,
+        "strictNullChecks": true,
+        "suppressImplicitAnyIndexErrors": false,
+        "noUnusedLocals": false
+    },
+    "include": [
+        "./src/*",
+        "./css/*",
+        "./types/*"
+    ],
+    "exclude": [
+        "node_modules",
+        "public"
+    ]
+}

+ 50 - 0
webpack.config.js

@@ -0,0 +1,50 @@
+// @ts-check
+const path = require('path')
+const presetMode = process.env.NODE_ENV || 'development';
+const isProduction = (presetMode === 'production');
+
+module.exports = {
+    entry: {
+        'index': path.resolve(__dirname, 'src/index.tsx'),
+    },
+    output: {
+        // filename: isProduction ? '[id].[chunkhash].js' : '[id].js',
+        filename: '[id].js',
+        path: path.resolve(__dirname, 'public'),
+        publicPath: "/",
+        pathinfo: false,
+    },
+    mode: presetMode,
+    devtool: isProduction ? false : 'cheap-module-source-map',
+    optimization: {
+        removeAvailableModules: false,
+        removeEmptyChunks: false,
+        splitChunks: {
+            chunks: 'initial',
+        },
+    },
+    performance: {
+        maxAssetSize: 3000000, // 3mb
+        maxEntrypointSize: 3000000, // 3mb
+    },
+    module: {
+        rules: [
+            {
+                test: /\.(js|json|ts|tsx)$/,
+                include: path.resolve(__dirname, 'src'),
+                loader: 'ts-loader',
+                options: {
+                    transpileOnly: false,
+                    experimentalWatchApi: true,
+                    configFile: path.resolve(__dirname, 'tsconfig.json'),
+                },
+            },
+        ],
+    },
+    resolve: {
+        extensions: [
+            '.js', '.json',
+            '.ts', '.ts.d', '.tsx',
+        ],
+    },
+}