Make project build using esbuild

This commit is contained in:
Matei Adriel 2023-10-29 04:54:24 +01:00
parent fed8fdcf86
commit 243360dd70
No known key found for this signature in database
42 changed files with 2522 additions and 2239 deletions

View file

@ -1,7 +0,0 @@
module.exports = {
semi: false,
trailingComma: 'none',
singleQuote: true,
printWidth: 80,
tabWidth: 4
}

7
.prettierrc.json Normal file
View file

@ -0,0 +1,7 @@
{
"semi": false,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 4
}

View file

@ -1,6 +0,0 @@
{
"editor.formatOnSave": true,
"prettier.eslintIntegration": true,
"explorer.autoReveal": false,
"typescript.tsdk": "node_modules/typescript/lib"
}

View file

@ -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
View 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

View file

@ -1,160 +1,15 @@
{ {
"nodes": { "nodes": {
"all-cabal-json": { "flake-utils": {
"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": {
"inputs": { "inputs": {
"all-cabal-json": "all-cabal-json", "systems": "systems"
"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"
}, },
"locked": { "locked": {
"lastModified": 1681981547, "lastModified": 1694529238,
"narHash": "sha256-HiDkvZ9FyRC14nsgZ9DQjDpQF7XaqtTSFVrxIk+8ASY=", "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"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=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -163,161 +18,38 @@
"type": "github" "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1665580254, "lastModified": 1695360818,
"narHash": "sha256-hO61XPkp1Hphl4HGNzj1VvDH5URt7LI6LaY/385Eul4=", "narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=",
"owner": "NixOS", "path": "/nix/store/09yvj6yyxspzfivv91bcxwrjxawpk1g2-source",
"repo": "nixpkgs", "rev": "e35dcc04a3853da485a396bdd332217d0ac9054f",
"rev": "f634d427b0224a5f531ea5aa10c3960ba6ec5f0f", "type": "path"
"type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect" "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": { "root": {
"inputs": { "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"
} }
} }
}, },

View file

@ -1,12 +1,21 @@
{ {
inputs.dream2nix.url = "github:nix-community/dream2nix"; description = "Logic gate simulator";
outputs = inputs: inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.dream2nix.lib.makeFlakeOutputs {
systems = [ "x86_64-linux" ]; outputs = { nixpkgs, flake-utils, ... }:
config.projectRoot = ./.; flake-utils.lib.eachDefaultSystem
source = ./.; (system:
projects = ./projects.toml; let pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default =
pkgs.mkShell {
buildInputs = with pkgs; with nodePackages_latest; [
nodejs
];
}; };
}
);
# {{{ Caching and whatnot # {{{ Caching and whatnot
nixConfig = { nixConfig = {

2344
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -3,19 +3,19 @@
"version": "1.0.0", "version": "1.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "build": "node ./build.js",
"build": "vite build", "check": "tsc"
"check": "tsc",
"preview": "vite preview"
}, },
"devDependencies": { "devDependencies": {
"@craftamap/esbuild-plugin-html": "^0.6.1",
"@types/deepmerge": "^2.2.0", "@types/deepmerge": "^2.2.0",
"@types/mainloop.js": "^1.0.5", "@types/mainloop.js": "^1.0.5",
"@types/node": "^1.0.5", "@types/node": "^20.8.9",
"@types/react-dom": "^18.2.14",
"@types/react-router-dom": "^4.3.4", "@types/react-router-dom": "^4.3.4",
"@vitejs/plugin-react": "^4.0.0-beta.0", "esbuild": "^0.19.5",
"typescript": "^5.0.2", "esbuild-sass-plugin": "^2.16.0",
"vite": "^4.3.0" "typescript": "^5.0.2"
}, },
"dependencies": { "dependencies": {
"@eix-js/utils": "0.0.6", "@eix-js/utils": "0.0.6",

View file

@ -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]

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Logic gate simulator</title> <title>Erratic gate</title>
<meta name="pinterest" content="nopin" /> <meta name="pinterest" content="nopin" />
@ -9,30 +9,35 @@
rel="stylesheet" rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" 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 <link
rel="stylesheet" rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons" href="https://fonts.googleapis.com/icon?family=Material+Icons"
/> />
<meta <meta
name="viewport" name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no"
/> />
<link <meta property="og:title" content="Erratic gate" />
href="https://fonts.googleapis.com/css?family=Righteous&display=swap" <meta
rel="stylesheet" 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 <meta
name="Description" name="Description"
content="A logic gate simulator made for infoeducatie 2019" content="A logic gate simulator made for infoeducatie 2019"
/> />
<link rel="icon" href="/favicon.ico" />
<meta charset="UTF-8" /> <meta charset="UTF-8" />
</head> </head>
@ -57,8 +62,5 @@
<!--In case someone tries to laod this with js disabled--> <!--In case someone tries to laod this with js disabled-->
<noscript> JavaScript must be enabled to run this app. </noscript> <noscript> JavaScript must be enabled to run this app. </noscript>
</div> </div>
<script type="module" src="/src/index.ts"></script>
</body> </body>
</html> </html>

View file

@ -1,4 +1,3 @@
import React from 'react'
import App from './modules/core/components/App' import App from './modules/core/components/App'
import { render } from 'react-dom' import { render } from 'react-dom'

View file

@ -1,20 +1,19 @@
import '../styles/reset' import '../styles/reset.scss'
import './App.scss' import './App.scss'
import './Scrollbars.scss' import './Scrollbars.scss'
import 'react-toastify/dist/ReactToastify.css' import 'react-toastify/dist/ReactToastify.css'
import { ToastContainer } from 'react-toastify' import { ToastContainer } from 'react-toastify'
import { theme as muiTheme } from '../constants' 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 CssBaseline from '@material-ui/core/CssBaseline'
import Theme from '@material-ui/styles/ThemeProvider' import Theme from '@material-ui/styles/ThemeProvider'
import Sidebar from './Sidebar' import Sidebar from './Sidebar'
import Root from './Root' import Root from './Root'
import LogicGatePage from '../../logic-gates/components/LogicGatesPage' import LogicGatePage from '../../logic-gates/components/LogicGatesPage'
import { loadSubject } from '../subjects/loadedSubject' import { loadSubject } from '../subjects/loadedSubject'
import { CustomRouter } from './CustomRouter'
import LogicGateInfoPage from '../../logic-gate-info/components/LogicGateInfoPage' import LogicGateInfoPage from '../../logic-gate-info/components/LogicGateInfoPage'
const App = () => { const App = () => {
@ -27,13 +26,13 @@ const App = () => {
<CssBaseline /> <CssBaseline />
<Theme theme={muiTheme}> <Theme theme={muiTheme}>
<CustomRouter> <BrowserRouter>
<Sidebar /> <Sidebar />
<Route path="/" component={Root} exact /> <Route path="/" component={Root} exact />
<Route path="/gates" component={LogicGatePage} /> <Route path="/gates" component={LogicGatePage} />
<Route path="/info/:name" component={LogicGateInfoPage} /> <Route path="/info/:name" component={LogicGateInfoPage} />
</CustomRouter> </BrowserRouter>
</Theme> </Theme>
<ToastContainer <ToastContainer

View file

@ -1,6 +0,0 @@
import { BrowserRouter } from 'react-router-dom'
import { history } from '../constants'
export class CustomRouter extends BrowserRouter {
public history = history
}

View file

@ -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 { red, deepPurple } from '@material-ui/core/colors'
import { simulationMode } from '../saving/types/SimulationSave' import { simulationMode } from '../saving/types/SimulationSave'
import { createBrowserHistory } from 'history'
export const theme = createMuiTheme({ export const theme = createTheme({
palette: { palette: {
type: 'dark', type: 'dark',
primary: deepPurple, primary: deepPurple,
@ -32,8 +31,3 @@ export const icons: IconInterface = {
* The width of the sidebar * The width of the sidebar
*/ */
export const sidebarWidth = 240 export const sidebarWidth = 240
/**
* The history to be used by the router
*/
export const history = createBrowserHistory()

View file

@ -169,8 +169,6 @@ audio,
canvas, canvas,
video { video {
display: inline-block; display: inline-block;
*display: inline;
*zoom: 1;
max-width: 100%; max-width: 100%;
} }
@ -269,7 +267,7 @@ legend {
border: 0; /* 1 */ border: 0; /* 1 */
padding: 0; padding: 0;
white-space: normal; /* 2 */ white-space: normal; /* 2 */
*margin-left: -7px; /* 3 */ margin-left: -7px; /* 3 */
} }
/** /**
@ -286,7 +284,6 @@ textarea {
font-size: 100%; /* 1 */ font-size: 100%; /* 1 */
margin: 0; /* 2 */ margin: 0; /* 2 */
vertical-align: baseline; /* 3 */ vertical-align: baseline; /* 3 */
*vertical-align: middle; /* 3 */
} }
/** /**
@ -327,7 +324,7 @@ input[type="reset"],
input[type="submit"] { input[type="submit"] {
-webkit-appearance: button; /* 2 */ -webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */ cursor: pointer; /* 3 */
*overflow: visible; /* 4 */ overflow: visible; /* 4 */
} }
/** /**
@ -350,8 +347,8 @@ input[type='checkbox'],
input[type='radio'] { input[type='radio'] {
box-sizing: border-box; /* 1 */ box-sizing: border-box; /* 1 */
padding: 0; /* 2 */ padding: 0; /* 2 */
*height: 13px; /* 3 */ height: 13px; /* 3 */
*width: 13px; /* 3 */ width: 13px; /* 3 */
} }
/** /**

View file

@ -59,7 +59,7 @@ export const compileIc = (state: SimulationState, log = false) => {
category: categories.ic, category: categories.ic,
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/ic') fill: require('../../../assets/ic.svg')
}, },
properties: { properties: {
enabled: !!props.length, enabled: !!props.length,

View file

@ -1,7 +1,4 @@
import { import { CurrentLanguage } from '../stores/currentLanguage'
CurrentLanguage,
CurrentLanguageLocalStore
} from '../stores/currentLanguage'
import { allSupportedLanguages } from '../constants' import { allSupportedLanguages } from '../constants'
/** /**

View file

@ -12,6 +12,7 @@ import LogicGate from './LogicGate'
const LogicGatePage = () => { const LogicGatePage = () => {
const gates = useObservable(() => LogicGateList, []) const gates = useObservable(() => LogicGateList, [])
const renderer = getRendererSafely() const renderer = getRendererSafely()
console.log('got this far')
return ( return (
<main> <main>
@ -20,7 +21,7 @@ const LogicGatePage = () => {
{gates {gates
.map(getTemplateSafely) .map(getTemplateSafely)
.sort((a, b) => a.category - b.category) .sort((a, b) => a.category - b.category)
.filter(template => { .filter((template) => {
return ( return (
renderer.simulation.mode === 'project' || renderer.simulation.mode === 'project' ||
template.metadata.name !== template.metadata.name !==

View file

@ -1,8 +1,8 @@
@import '../../core/styles/indexes.scss'; @import '../../../core/styles/indexes.scss';
@import '../../core/styles/colors.scss'; @import '../../../core/styles/colors.scss';
@import '../../core/styles/mixins/flex.scss'; @import '../../../core/styles/mixins/flex.scss';
@import '../../core/styles/mixins/full-screen.scss'; @import '../../../core/styles/mixins/full-screen.scss';
@import '../../core/styles/mixins/visibility.scss'; @import '../../../core/styles/mixins/visibility.scss';
@mixin modal-container { @mixin modal-container {
@include flex(); @include flex();

View file

@ -25,7 +25,7 @@ const _4bitDecoderTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/4decoder') fill: require('../../../assets/4decoder.svg')
}, },
shape: { shape: {
scale: _4BitScale scale: _4BitScale

View file

@ -24,7 +24,7 @@ const _4bitEncoderTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/4encoder') fill: require('../../../assets/4encoder.svg')
}, },
shape: { shape: {
scale: _4BitScale scale: _4BitScale

View file

@ -9,7 +9,7 @@ const andTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/and') fill: require('../../../assets/and.svg')
}, },
code: { code: {
activation: ` activation: `

View file

@ -24,7 +24,7 @@ const bitMergerTemplate: PartialTemplate = {
category: categories.compressing, category: categories.compressing,
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/merger') fill: require('../../../assets/merger.svg')
} }
} }

View file

@ -27,7 +27,7 @@ const bitSplitterTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/splitter') fill: require('../../../assets/splitter.svg')
}, },
category: categories.compressing, category: categories.compressing,
pins: { pins: {

View file

@ -11,7 +11,7 @@ const fullAdderTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/full-adder') fill: require('../../../assets/full-adder.svg')
}, },
code: { code: {
activation: adderActivation(true) activation: adderActivation(true)

View file

@ -11,7 +11,7 @@ const halfAdderTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/half-adder') fill: require('../../../assets/half-adder.svg')
}, },
code: { code: {
activation: adderActivation(false) activation: adderActivation(false)

View file

@ -9,7 +9,7 @@ const nandTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/nand') fill: require('../../../assets/nand.svg')
}, },
code: { code: {
activation: ` activation: `

View file

@ -9,7 +9,7 @@ const norTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/nor') fill: require('../../../assets/nor.svg')
}, },
code: { code: {
activation: ` activation: `

View file

@ -9,7 +9,7 @@ const notTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/not') fill: require('../../../assets/not.svg')
}, },
code: { code: {
activation: ` activation: `

View file

@ -9,7 +9,7 @@ const orTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/or') fill: require('../../../assets/or.svg')
}, },
code: { code: {
activation: ` activation: `

View file

@ -11,7 +11,7 @@ const parallelDelayerTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/parallel') fill: require('../../../assets/parallel.svg')
}, },
code: { code: {
activation: ` activation: `

View file

@ -11,7 +11,7 @@ const sequentialDelayerTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/sequential') fill: require('../../../assets/sequential.svg')
}, },
code: { code: {
activation: ` activation: `

View file

@ -9,7 +9,7 @@ const xnorTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/xnor') fill: require('../../../assets/xnor.svg')
}, },
code: { code: {
activation: ` activation: `

View file

@ -9,7 +9,7 @@ const xorTemplate: PartialTemplate = {
}, },
material: { material: {
type: 'image', type: 'image',
fill: require('../../../assets/xor') fill: require('../../../assets/xor.svg')
}, },
code: { code: {
activation: ` activation: `

View file

@ -1,6 +1,3 @@
import { CacheInstancesByKey } from '@eix-js/utils'
@CacheInstancesByKey(Infinity)
export class LocalStore<T> { export class LocalStore<T> {
public constructor(public name: string) { public constructor(public name: string) {
if (!localStorage.getItem(name)) { if (!localStorage.getItem(name)) {
@ -13,9 +10,7 @@ export class LocalStore<T> {
if (!raw) if (!raw)
throw new Error( throw new Error(
`An error occured when accesing ${ `An error occured when accesing ${this.name} in the local storage!`
this.name
} in the local storage!`
) )
else { else {
return JSON.parse(raw) return JSON.parse(raw)

1
src/vite-env.d.ts vendored
View file

@ -1 +0,0 @@
/// <reference types="vite/client" />

View file

@ -1,10 +1,13 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ESNext", "target": "ESNext",
"lib": [ "DOM", "DOM.Iterable", "ESNext" ], "lib": [
"DOM",
"DOM.Iterable",
"ESNext"
],
"module": "ESNext", "module": "ESNext",
"skipLibCheck": true, "skipLibCheck": true,
/* Bundler mode */ /* Bundler mode */
"moduleResolution": "bundler", "moduleResolution": "bundler",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
@ -12,7 +15,6 @@
"isolatedModules": true, "isolatedModules": true,
"noEmit": true, "noEmit": true,
"jsx": "react-jsx", "jsx": "react-jsx",
/* Features */ /* Features */
"experimentalDecorators": true, "experimentalDecorators": true,
"downlevelIteration": true, "downlevelIteration": true,
@ -21,9 +23,4 @@
"include": [ "include": [
"src" "src"
], ],
"references": [
{
"path": "./tsconfig.node.json"
}
]
} }

View file

@ -1,12 +0,0 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": [
"vite.config.ts"
]
}

View file

@ -1,7 +0,0 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})