Make project build using esbuild
This commit is contained in:
parent
fed8fdcf86
commit
243360dd70
|
@ -1,7 +0,0 @@
|
|||
module.exports = {
|
||||
semi: false,
|
||||
trailingComma: 'none',
|
||||
singleQuote: true,
|
||||
printWidth: 80,
|
||||
tabWidth: 4
|
||||
}
|
7
.prettierrc.json
Normal file
7
.prettierrc.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"semi": false,
|
||||
"trailingComma": "none",
|
||||
"singleQuote": true,
|
||||
"printWidth": 80,
|
||||
"tabWidth": 4
|
||||
}
|
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"editor.formatOnSave": true,
|
||||
"prettier.eslintIntegration": true,
|
||||
"explorer.autoReveal": false,
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
15
.vscode/template.code-snippets
vendored
15
.vscode/template.code-snippets
vendored
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"Gate template": {
|
||||
"prefix": "template",
|
||||
"body": [
|
||||
"import { PartialTemplate } from '../types/PartialTemplate'",
|
||||
"",
|
||||
"/**",
|
||||
" * The template of the ${1:and} gate",
|
||||
" */",
|
||||
"const ${1}Template: PartialTemplate = ${2:[]}",
|
||||
"",
|
||||
"export default ${1}Template"
|
||||
]
|
||||
}
|
||||
}
|
40
build.js
Normal file
40
build.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
import * as esbuild from 'esbuild'
|
||||
import { htmlPlugin } from '@craftamap/esbuild-plugin-html'
|
||||
import { sassPlugin } from 'esbuild-sass-plugin'
|
||||
|
||||
const production = process.env.NODE_ENV === 'production'
|
||||
const serve = process.env.ESBUILD_SERVE === '1'
|
||||
|
||||
const ctx = await esbuild.context({
|
||||
entryPoints: ['src/index.ts'],
|
||||
bundle: production,
|
||||
// minify: production,
|
||||
outdir: 'dist',
|
||||
metafile: true,
|
||||
splitting: true,
|
||||
format: 'esm',
|
||||
target: ['chrome100', 'firefox100'],
|
||||
loader: {
|
||||
'.svg': 'file'
|
||||
},
|
||||
plugins: [
|
||||
htmlPlugin({
|
||||
files: [
|
||||
{
|
||||
filename: 'index.html',
|
||||
entryPoints: ['src/index.ts'],
|
||||
favicon: 'public/favicon.ico',
|
||||
htmlTemplate: 'public/index.html',
|
||||
scriptLoading: 'module'
|
||||
// inline: { js: true }
|
||||
}
|
||||
]
|
||||
}),
|
||||
sassPlugin({})
|
||||
]
|
||||
})
|
||||
|
||||
if (serve) {
|
||||
const { port, host } = await ctx.serve({ servedir: 'dist' })
|
||||
console.log(`Serving on ${host}:${port}`)
|
||||
}
|
File diff suppressed because it is too large
Load diff
322
flake.lock
322
flake.lock
|
@ -1,160 +1,15 @@
|
|||
{
|
||||
"nodes": {
|
||||
"all-cabal-json": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1665552503,
|
||||
"narHash": "sha256-r14RmRSwzv5c+bWKUDaze6pXM7nOsiz1H8nvFHJvufc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "all-cabal-json",
|
||||
"rev": "d7c0434eebffb305071404edcf9d5cd99703878e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "hackage",
|
||||
"repo": "all-cabal-json",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crane": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1670900067,
|
||||
"narHash": "sha256-VXVa+KBfukhmWizaiGiHRVX/fuk66P8dgSFfkVN4/MY=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "59b31b41a589c0a65e4a1f86b0e5eac68081468b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"devshell": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1663445644,
|
||||
"narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"dream2nix": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"all-cabal-json": "all-cabal-json",
|
||||
"crane": "crane",
|
||||
"devshell": "devshell",
|
||||
"drv-parts": "drv-parts",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-utils-pre-commit": "flake-utils-pre-commit",
|
||||
"ghc-utils": "ghc-utils",
|
||||
"gomod2nix": "gomod2nix",
|
||||
"mach-nix": "mach-nix",
|
||||
"nix-pypi-fetcher": "nix-pypi-fetcher",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgsV1": "nixpkgsV1",
|
||||
"poetry2nix": "poetry2nix",
|
||||
"pre-commit-hooks": "pre-commit-hooks",
|
||||
"pruned-racket-catalog": "pruned-racket-catalog"
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1681981547,
|
||||
"narHash": "sha256-HiDkvZ9FyRC14nsgZ9DQjDpQF7XaqtTSFVrxIk+8ASY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "dream2nix",
|
||||
"rev": "5982515961d9d9d39c15fb161770ba989bb90781",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "dream2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"drv-parts": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"dream2nix",
|
||||
"flake-compat"
|
||||
],
|
||||
"flake-parts": [
|
||||
"dream2nix",
|
||||
"flake-parts"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"dream2nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1680698112,
|
||||
"narHash": "sha256-FgnobN/DvCjEsc0UAZEAdPLkL4IZi2ZMnu2K2bUaElc=",
|
||||
"owner": "davhau",
|
||||
"repo": "drv-parts",
|
||||
"rev": "e8c2ec1157dc1edb002989669a0dbd935f430201",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "davhau",
|
||||
"repo": "drv-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"dream2nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1675933616,
|
||||
"narHash": "sha256-/rczJkJHtx16IFxMmAWu5nNYcSXNg1YYXTHoGjLrLUA=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "47478a4a003e745402acf63be7f9a092d51b83d7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils-pre-commit": {
|
||||
"locked": {
|
||||
"lastModified": 1644229661,
|
||||
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
|
||||
"lastModified": 1694529238,
|
||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
|
||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -163,161 +18,38 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ghc-utils": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1662774800,
|
||||
"narHash": "sha256-1Rd2eohGUw/s1tfvkepeYpg8kCEXiIot0RijapUjAkE=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "bb3a2d3dc52ff0253fb9c2812bd7aa2da03e0fea",
|
||||
"revCount": 1072,
|
||||
"type": "git",
|
||||
"url": "https://gitlab.haskell.org/bgamari/ghc-utils"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://gitlab.haskell.org/bgamari/ghc-utils"
|
||||
}
|
||||
},
|
||||
"gomod2nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1627572165,
|
||||
"narHash": "sha256-MFpwnkvQpauj799b4QTBJQFEddbD02+Ln5k92QyHOSk=",
|
||||
"owner": "tweag",
|
||||
"repo": "gomod2nix",
|
||||
"rev": "67f22dd738d092c6ba88e420350ada0ed4992ae8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "tweag",
|
||||
"repo": "gomod2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mach-nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1634711045,
|
||||
"narHash": "sha256-m5A2Ty88NChLyFhXucECj6+AuiMZPHXNbw+9Kcs7F6Y=",
|
||||
"owner": "DavHau",
|
||||
"repo": "mach-nix",
|
||||
"rev": "4433f74a97b94b596fa6cd9b9c0402104aceef5d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "mach-nix",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nix-pypi-fetcher": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1669065297,
|
||||
"narHash": "sha256-UStjXjNIuIm7SzMOWvuYWIHBkPUKQ8Id63BMJjnIDoA=",
|
||||
"owner": "DavHau",
|
||||
"repo": "nix-pypi-fetcher",
|
||||
"rev": "a9885ac6a091576b5195d547ac743d45a2a615ac",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "DavHau",
|
||||
"repo": "nix-pypi-fetcher",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1665580254,
|
||||
"narHash": "sha256-hO61XPkp1Hphl4HGNzj1VvDH5URt7LI6LaY/385Eul4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f634d427b0224a5f531ea5aa10c3960ba6ec5f0f",
|
||||
"type": "github"
|
||||
"lastModified": 1695360818,
|
||||
"narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=",
|
||||
"path": "/nix/store/09yvj6yyxspzfivv91bcxwrjxawpk1g2-source",
|
||||
"rev": "e35dcc04a3853da485a396bdd332217d0ac9054f",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgsV1": {
|
||||
"locked": {
|
||||
"lastModified": 1678500271,
|
||||
"narHash": "sha256-tRBLElf6f02HJGG0ZR7znMNFv/Uf7b2fFInpTHiHaSE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5eb98948b66de29f899c7fe27ae112a47964baf8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-22.11",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"poetry2nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1666918719,
|
||||
"narHash": "sha256-BkK42fjAku+2WgCOv2/1NrPa754eQPV7gPBmoKQBWlc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"rev": "289efb187123656a116b915206e66852f038720e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "1.36.0",
|
||||
"repo": "poetry2nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"dream2nix",
|
||||
"flake-utils-pre-commit"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"dream2nix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1646153636,
|
||||
"narHash": "sha256-AlWHMzK+xJ1mG267FdT8dCq/HvLCA6jwmx2ZUy5O8tY=",
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"rev": "b6bc0b21e1617e2b07d8205e7fae7224036dfa4b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "pre-commit-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pruned-racket-catalog": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1672537287,
|
||||
"narHash": "sha256-SuOvXVcLfakw18oJB/PuRMyvGyGG1+CQD3R+TGHIv44=",
|
||||
"owner": "nix-community",
|
||||
"repo": "pruned-racket-catalog",
|
||||
"rev": "c8b89557fb53b36efa2ee48a769c7364df0f6262",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "catalog",
|
||||
"repo": "pruned-racket-catalog",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"dream2nix": "dream2nix"
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
25
flake.nix
25
flake.nix
|
@ -1,12 +1,21 @@
|
|||
{
|
||||
inputs.dream2nix.url = "github:nix-community/dream2nix";
|
||||
outputs = inputs:
|
||||
inputs.dream2nix.lib.makeFlakeOutputs {
|
||||
systems = [ "x86_64-linux" ];
|
||||
config.projectRoot = ./.;
|
||||
source = ./.;
|
||||
projects = ./projects.toml;
|
||||
};
|
||||
description = "Logic gate simulator";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { nixpkgs, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
(system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
devShells.default =
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; with nodePackages_latest; [
|
||||
nodejs
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
# {{{ Caching and whatnot
|
||||
nixConfig = {
|
||||
|
|
2344
package-lock.json
generated
Normal file
2344
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
62
package.json
62
package.json
|
@ -1,33 +1,33 @@
|
|||
{
|
||||
"name": "erratic-gate",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"check": "tsc",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/deepmerge": "^2.2.0",
|
||||
"@types/mainloop.js": "^1.0.5",
|
||||
"@types/node": "^1.0.5",
|
||||
"@types/react-router-dom": "^4.3.4",
|
||||
"@vitejs/plugin-react": "^4.0.0-beta.0",
|
||||
"typescript": "^5.0.2",
|
||||
"vite": "^4.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@eix-js/utils": "0.0.6",
|
||||
"@material-ui/core": "^4.2.1",
|
||||
"deepmerge": "^4.0.0",
|
||||
"keycode": "^2.2.0",
|
||||
"mainloop.js": "^1.0.4",
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-router-dom": "^5.0.1",
|
||||
"react-toastify": "^5.3.2",
|
||||
"rxjs": "^6.5.2",
|
||||
"rxjs-hooks": "^0.5.1"
|
||||
}
|
||||
"name": "erratic-gate",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "node ./build.js",
|
||||
"check": "tsc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@craftamap/esbuild-plugin-html": "^0.6.1",
|
||||
"@types/deepmerge": "^2.2.0",
|
||||
"@types/mainloop.js": "^1.0.5",
|
||||
"@types/node": "^20.8.9",
|
||||
"@types/react-dom": "^18.2.14",
|
||||
"@types/react-router-dom": "^4.3.4",
|
||||
"esbuild": "^0.19.5",
|
||||
"esbuild-sass-plugin": "^2.16.0",
|
||||
"typescript": "^5.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@eix-js/utils": "0.0.6",
|
||||
"@material-ui/core": "^4.2.1",
|
||||
"deepmerge": "^4.0.0",
|
||||
"keycode": "^2.2.0",
|
||||
"mainloop.js": "^1.0.4",
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-router-dom": "^5.0.1",
|
||||
"react-toastify": "^5.3.2",
|
||||
"rxjs": "^6.5.2",
|
||||
"rxjs-hooks": "^0.5.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
# projects.toml file describing inputs for dream2nix
|
||||
#
|
||||
# To re-generate this file, run:
|
||||
# nix run .#detect-projects $source
|
||||
# ... where `$source` points to the source of your project.
|
||||
#
|
||||
# If the local flake is unavailable, alternatively execute the app from the
|
||||
# upstream dream2nix flake:
|
||||
# nix run github:nix-community/dream2nix#detect-projects $source
|
||||
|
||||
[erratic-gate]
|
||||
name = "erratic-gate"
|
||||
relPath = ""
|
||||
subsystem = "nodejs"
|
||||
translator = "package-json"
|
||||
builder = "strict-builder"
|
||||
|
||||
[erratic-gate.subsystemInfo]
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Logic gate simulator</title>
|
||||
<title>Erratic gate</title>
|
||||
|
||||
<meta name="pinterest" content="nopin" />
|
||||
|
||||
|
@ -9,30 +9,35 @@
|
|||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css?family=Righteous&display=swap"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
/>
|
||||
|
||||
<meta
|
||||
name="viewport"
|
||||
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no"
|
||||
/>
|
||||
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css?family=Righteous&display=swap"
|
||||
rel="stylesheet"
|
||||
<meta property="og:title" content="Erratic gate" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="A logic gate simulator made for infoeducatie 2019"
|
||||
/>
|
||||
<meta
|
||||
property="og:url"
|
||||
content="https://mateiadrielrafael.github.io/erratic-gate/"
|
||||
/>
|
||||
|
||||
<meta property="og:title" content="Logic gate simulator" />
|
||||
<meta property="og:description" content="A logic gate simulator made for infoeducatie 2019" />
|
||||
<meta property="og:url" content="https://mateiadrielrafael.github.io/logic-gate-simulator/" />
|
||||
|
||||
<meta
|
||||
name="Description"
|
||||
content="A logic gate simulator made for infoeducatie 2019"
|
||||
/>
|
||||
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta charset="UTF-8" />
|
||||
</head>
|
||||
|
||||
|
@ -57,8 +62,5 @@
|
|||
<!--In case someone tries to laod this with js disabled-->
|
||||
<noscript> JavaScript must be enabled to run this app. </noscript>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="module" src="/src/index.ts"></script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,4 +1,3 @@
|
|||
import React from 'react'
|
||||
import App from './modules/core/components/App'
|
||||
|
||||
import { render } from 'react-dom'
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
import '../styles/reset'
|
||||
import '../styles/reset.scss'
|
||||
import './App.scss'
|
||||
import './Scrollbars.scss'
|
||||
import 'react-toastify/dist/ReactToastify.css'
|
||||
|
||||
import { ToastContainer } from 'react-toastify'
|
||||
import { theme as muiTheme } from '../constants'
|
||||
import { Route } from 'react-router-dom'
|
||||
import { BrowserRouter, Route } from 'react-router-dom'
|
||||
|
||||
import React, { useEffect } from 'react'
|
||||
import { useEffect } from 'react'
|
||||
import CssBaseline from '@material-ui/core/CssBaseline'
|
||||
import Theme from '@material-ui/styles/ThemeProvider'
|
||||
import Sidebar from './Sidebar'
|
||||
import Root from './Root'
|
||||
import LogicGatePage from '../../logic-gates/components/LogicGatesPage'
|
||||
import { loadSubject } from '../subjects/loadedSubject'
|
||||
import { CustomRouter } from './CustomRouter'
|
||||
import LogicGateInfoPage from '../../logic-gate-info/components/LogicGateInfoPage'
|
||||
|
||||
const App = () => {
|
||||
|
@ -27,13 +26,13 @@ const App = () => {
|
|||
<CssBaseline />
|
||||
|
||||
<Theme theme={muiTheme}>
|
||||
<CustomRouter>
|
||||
<BrowserRouter>
|
||||
<Sidebar />
|
||||
|
||||
<Route path="/" component={Root} exact />
|
||||
<Route path="/gates" component={LogicGatePage} />
|
||||
<Route path="/info/:name" component={LogicGateInfoPage} />
|
||||
</CustomRouter>
|
||||
</BrowserRouter>
|
||||
</Theme>
|
||||
|
||||
<ToastContainer
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import { BrowserRouter } from 'react-router-dom'
|
||||
import { history } from '../constants'
|
||||
|
||||
export class CustomRouter extends BrowserRouter {
|
||||
public history = history
|
||||
}
|
|
@ -1,9 +1,8 @@
|
|||
import { createMuiTheme } from '@material-ui/core/styles'
|
||||
import { createTheme } from '@material-ui/core/styles'
|
||||
import { red, deepPurple } from '@material-ui/core/colors'
|
||||
import { simulationMode } from '../saving/types/SimulationSave'
|
||||
import { createBrowserHistory } from 'history'
|
||||
|
||||
export const theme = createMuiTheme({
|
||||
export const theme = createTheme({
|
||||
palette: {
|
||||
type: 'dark',
|
||||
primary: deepPurple,
|
||||
|
@ -32,8 +31,3 @@ export const icons: IconInterface = {
|
|||
* The width of the sidebar
|
||||
*/
|
||||
export const sidebarWidth = 240
|
||||
|
||||
/**
|
||||
* The history to be used by the router
|
||||
*/
|
||||
export const history = createBrowserHistory()
|
||||
|
|
|
@ -169,8 +169,6 @@ audio,
|
|||
canvas,
|
||||
video {
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
*zoom: 1;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
|
@ -269,7 +267,7 @@ legend {
|
|||
border: 0; /* 1 */
|
||||
padding: 0;
|
||||
white-space: normal; /* 2 */
|
||||
*margin-left: -7px; /* 3 */
|
||||
margin-left: -7px; /* 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -286,7 +284,6 @@ textarea {
|
|||
font-size: 100%; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
vertical-align: baseline; /* 3 */
|
||||
*vertical-align: middle; /* 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -327,7 +324,7 @@ input[type="reset"],
|
|||
input[type="submit"] {
|
||||
-webkit-appearance: button; /* 2 */
|
||||
cursor: pointer; /* 3 */
|
||||
*overflow: visible; /* 4 */
|
||||
overflow: visible; /* 4 */
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -350,8 +347,8 @@ input[type='checkbox'],
|
|||
input[type='radio'] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
*height: 13px; /* 3 */
|
||||
*width: 13px; /* 3 */
|
||||
height: 13px; /* 3 */
|
||||
width: 13px; /* 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,7 +59,7 @@ export const compileIc = (state: SimulationState, log = false) => {
|
|||
category: categories.ic,
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/ic')
|
||||
fill: require('../../../assets/ic.svg')
|
||||
},
|
||||
properties: {
|
||||
enabled: !!props.length,
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
CurrentLanguage,
|
||||
CurrentLanguageLocalStore
|
||||
} from '../stores/currentLanguage'
|
||||
import { CurrentLanguage } from '../stores/currentLanguage'
|
||||
import { allSupportedLanguages } from '../constants'
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,7 @@ import LogicGate from './LogicGate'
|
|||
const LogicGatePage = () => {
|
||||
const gates = useObservable(() => LogicGateList, [])
|
||||
const renderer = getRendererSafely()
|
||||
console.log('got this far')
|
||||
|
||||
return (
|
||||
<main>
|
||||
|
@ -20,7 +21,7 @@ const LogicGatePage = () => {
|
|||
{gates
|
||||
.map(getTemplateSafely)
|
||||
.sort((a, b) => a.category - b.category)
|
||||
.filter(template => {
|
||||
.filter((template) => {
|
||||
return (
|
||||
renderer.simulation.mode === 'project' ||
|
||||
template.metadata.name !==
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
@import '../../core/styles/indexes.scss';
|
||||
@import '../../core/styles/colors.scss';
|
||||
@import '../../core/styles/mixins/flex.scss';
|
||||
@import '../../core/styles/mixins/full-screen.scss';
|
||||
@import '../../core/styles/mixins/visibility.scss';
|
||||
@import '../../../core/styles/indexes.scss';
|
||||
@import '../../../core/styles/colors.scss';
|
||||
@import '../../../core/styles/mixins/flex.scss';
|
||||
@import '../../../core/styles/mixins/full-screen.scss';
|
||||
@import '../../../core/styles/mixins/visibility.scss';
|
||||
|
||||
@mixin modal-container {
|
||||
@include flex();
|
||||
|
|
|
@ -25,7 +25,7 @@ const _4bitDecoderTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/4decoder')
|
||||
fill: require('../../../assets/4decoder.svg')
|
||||
},
|
||||
shape: {
|
||||
scale: _4BitScale
|
||||
|
|
|
@ -24,7 +24,7 @@ const _4bitEncoderTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/4encoder')
|
||||
fill: require('../../../assets/4encoder.svg')
|
||||
},
|
||||
shape: {
|
||||
scale: _4BitScale
|
||||
|
|
|
@ -9,7 +9,7 @@ const andTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/and')
|
||||
fill: require('../../../assets/and.svg')
|
||||
},
|
||||
code: {
|
||||
activation: `
|
||||
|
|
|
@ -24,7 +24,7 @@ const bitMergerTemplate: PartialTemplate = {
|
|||
category: categories.compressing,
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/merger')
|
||||
fill: require('../../../assets/merger.svg')
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ const bitSplitterTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/splitter')
|
||||
fill: require('../../../assets/splitter.svg')
|
||||
},
|
||||
category: categories.compressing,
|
||||
pins: {
|
||||
|
|
|
@ -11,7 +11,7 @@ const fullAdderTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/full-adder')
|
||||
fill: require('../../../assets/full-adder.svg')
|
||||
},
|
||||
code: {
|
||||
activation: adderActivation(true)
|
||||
|
|
|
@ -11,7 +11,7 @@ const halfAdderTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/half-adder')
|
||||
fill: require('../../../assets/half-adder.svg')
|
||||
},
|
||||
code: {
|
||||
activation: adderActivation(false)
|
||||
|
|
|
@ -9,7 +9,7 @@ const nandTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/nand')
|
||||
fill: require('../../../assets/nand.svg')
|
||||
},
|
||||
code: {
|
||||
activation: `
|
||||
|
|
|
@ -9,7 +9,7 @@ const norTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/nor')
|
||||
fill: require('../../../assets/nor.svg')
|
||||
},
|
||||
code: {
|
||||
activation: `
|
||||
|
|
|
@ -9,7 +9,7 @@ const notTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/not')
|
||||
fill: require('../../../assets/not.svg')
|
||||
},
|
||||
code: {
|
||||
activation: `
|
||||
|
|
|
@ -9,7 +9,7 @@ const orTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/or')
|
||||
fill: require('../../../assets/or.svg')
|
||||
},
|
||||
code: {
|
||||
activation: `
|
||||
|
|
|
@ -11,7 +11,7 @@ const parallelDelayerTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/parallel')
|
||||
fill: require('../../../assets/parallel.svg')
|
||||
},
|
||||
code: {
|
||||
activation: `
|
||||
|
|
|
@ -11,7 +11,7 @@ const sequentialDelayerTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/sequential')
|
||||
fill: require('../../../assets/sequential.svg')
|
||||
},
|
||||
code: {
|
||||
activation: `
|
||||
|
|
|
@ -9,7 +9,7 @@ const xnorTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/xnor')
|
||||
fill: require('../../../assets/xnor.svg')
|
||||
},
|
||||
code: {
|
||||
activation: `
|
||||
|
|
|
@ -9,7 +9,7 @@ const xorTemplate: PartialTemplate = {
|
|||
},
|
||||
material: {
|
||||
type: 'image',
|
||||
fill: require('../../../assets/xor')
|
||||
fill: require('../../../assets/xor.svg')
|
||||
},
|
||||
code: {
|
||||
activation: `
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import { CacheInstancesByKey } from '@eix-js/utils'
|
||||
|
||||
@CacheInstancesByKey(Infinity)
|
||||
export class LocalStore<T> {
|
||||
public constructor(public name: string) {
|
||||
if (!localStorage.getItem(name)) {
|
||||
|
@ -13,9 +10,7 @@ export class LocalStore<T> {
|
|||
|
||||
if (!raw)
|
||||
throw new Error(
|
||||
`An error occured when accesing ${
|
||||
this.name
|
||||
} in the local storage!`
|
||||
`An error occured when accesing ${this.name} in the local storage!`
|
||||
)
|
||||
else {
|
||||
return JSON.parse(raw)
|
||||
|
|
1
src/vite-env.d.ts
vendored
1
src/vite-env.d.ts
vendored
|
@ -1 +0,0 @@
|
|||
/// <reference types="vite/client" />
|
|
@ -1,10 +1,13 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"lib": [ "DOM", "DOM.Iterable", "ESNext" ],
|
||||
"lib": [
|
||||
"DOM",
|
||||
"DOM.Iterable",
|
||||
"ESNext"
|
||||
],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
|
@ -12,7 +15,6 @@
|
|||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Features */
|
||||
"experimentalDecorators": true,
|
||||
"downlevelIteration": true,
|
||||
|
@ -21,9 +23,4 @@
|
|||
"include": [
|
||||
"src"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"skipLibCheck": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": [
|
||||
"vite.config.ts"
|
||||
]
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
})
|
Loading…
Reference in a new issue