🔥 WIP solid.js version of the editor

main
Shad Amethyst 2 years ago
parent 461abcac43
commit 167a7747db
Signed by: amethyst
GPG Key ID: D970C8DD1D6DEE36

@ -0,0 +1,4 @@
node_modules
dist
stackline-wasm
font

@ -0,0 +1,34 @@
## Usage
Those templates dependencies are maintained via [pnpm](https://pnpm.io) via `pnpm up -Lri`.
This is the reason you see a `pnpm-lock.yaml`. That being said, any package manager will work. This file can be safely be removed once you clone a template.
```bash
$ npm install # or pnpm install or yarn install
```
### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs)
## Available Scripts
In the project directory, you can run:
### `npm dev` or `npm start`
Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br>
### `npm run build`
Builds the app for production to the `dist` folder.<br>
It correctly bundles Solid in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!
## Deployment
You can deploy the `dist` folder to any static host provider (netlify, surge, now, etc.)

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!-- <link rel="shortcut icon" type="image/ico" href="/src/assets/favicon.ico" /> -->
<title>Stackline web Editor</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app, sowwy :(</noscript>
<div id="root"></div>
<script src="/src/index.jsx" type="module"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,19 @@
{
"name": "vite-template-solid",
"version": "0.0.0",
"description": "",
"scripts": {
"start": "vite",
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"license": "MIT",
"devDependencies": {
"vite": "^3.0.0",
"vite-plugin-solid": "^2.3.0"
},
"dependencies": {
"solid-js": "^1.4.7"
}
}

@ -0,0 +1,887 @@
lockfileVersion: 5.4
specifiers:
solid-js: ^1.4.7
vite: ^3.0.0
vite-plugin-solid: ^2.3.0
dependencies:
solid-js: 1.4.7
devDependencies:
vite: 3.0.0
vite-plugin-solid: 2.3.0_solid-js@1.4.7+vite@3.0.0
packages:
/@ampproject/remapping/2.2.0:
resolution: {integrity: sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==}
engines: {node: '>=6.0.0'}
dependencies:
'@jridgewell/gen-mapping': 0.1.1
'@jridgewell/trace-mapping': 0.3.14
dev: true
/@babel/code-frame/7.18.6:
resolution: {integrity: sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/highlight': 7.18.6
dev: true
/@babel/compat-data/7.18.8:
resolution: {integrity: sha512-HSmX4WZPPK3FUxYp7g2T6EyO8j96HlZJlxmKPSh6KAcqwyDrfx7hKjXpAW/0FhFfTJsR0Yt4lAjLI2coMptIHQ==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/core/7.18.6:
resolution: {integrity: sha512-cQbWBpxcbbs/IUredIPkHiAGULLV8iwgNRMFzvbhEXISp4f3rUUXE5+TIw6KwUWUR3DwyI6gmBRnmAtYaWehwQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@ampproject/remapping': 2.2.0
'@babel/code-frame': 7.18.6
'@babel/generator': 7.18.7
'@babel/helper-compilation-targets': 7.18.6_@babel+core@7.18.6
'@babel/helper-module-transforms': 7.18.8
'@babel/helpers': 7.18.6
'@babel/parser': 7.18.8
'@babel/template': 7.18.6
'@babel/traverse': 7.18.8
'@babel/types': 7.18.8
convert-source-map: 1.8.0
debug: 4.3.4
gensync: 1.0.0-beta.2
json5: 2.2.1
semver: 6.3.0
transitivePeerDependencies:
- supports-color
dev: true
/@babel/generator/7.18.7:
resolution: {integrity: sha512-shck+7VLlY72a2w9c3zYWuE1pwOKEiQHV7GTUbSnhyl5eu3i04t30tBY82ZRWrDfo3gkakCFtevExnxbkf2a3A==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
'@jridgewell/gen-mapping': 0.3.2
jsesc: 2.5.2
dev: true
/@babel/helper-annotate-as-pure/7.18.6:
resolution: {integrity: sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
dev: true
/@babel/helper-compilation-targets/7.18.6_@babel+core@7.18.6:
resolution: {integrity: sha512-vFjbfhNCzqdeAtZflUFrG5YIFqGTqsctrtkZ1D/NB0mDW9TwW3GmmUepYY4G9wCET5rY5ugz4OGTcLd614IzQg==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/compat-data': 7.18.8
'@babel/core': 7.18.6
'@babel/helper-validator-option': 7.18.6
browserslist: 4.21.2
semver: 6.3.0
dev: true
/@babel/helper-create-class-features-plugin/7.18.6_@babel+core@7.18.6:
resolution: {integrity: sha512-YfDzdnoxHGV8CzqHGyCbFvXg5QESPFkXlHtvdCkesLjjVMT2Adxe4FGUR5ChIb3DxSaXO12iIOCWoXdsUVwnqw==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/core': 7.18.6
'@babel/helper-annotate-as-pure': 7.18.6
'@babel/helper-environment-visitor': 7.18.6
'@babel/helper-function-name': 7.18.6
'@babel/helper-member-expression-to-functions': 7.18.6
'@babel/helper-optimise-call-expression': 7.18.6
'@babel/helper-replace-supers': 7.18.6
'@babel/helper-split-export-declaration': 7.18.6
transitivePeerDependencies:
- supports-color
dev: true
/@babel/helper-environment-visitor/7.18.6:
resolution: {integrity: sha512-8n6gSfn2baOY+qlp+VSzsosjCVGFqWKmDF0cCWOybh52Dw3SEyoWR1KrhMJASjLwIEkkAufZ0xvr+SxLHSpy2Q==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helper-function-name/7.18.6:
resolution: {integrity: sha512-0mWMxV1aC97dhjCah5U5Ua7668r5ZmSC2DLfH2EZnf9c3/dHZKiFa5pRLMH5tjSl471tY6496ZWk/kjNONBxhw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.18.6
'@babel/types': 7.18.8
dev: true
/@babel/helper-hoist-variables/7.18.6:
resolution: {integrity: sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
dev: true
/@babel/helper-member-expression-to-functions/7.18.6:
resolution: {integrity: sha512-CeHxqwwipekotzPDUuJOfIMtcIHBuc7WAzLmTYWctVigqS5RktNMQ5bEwQSuGewzYnCtTWa3BARXeiLxDTv+Ng==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
dev: true
/@babel/helper-module-imports/7.16.0:
resolution: {integrity: sha512-kkH7sWzKPq0xt3H1n+ghb4xEMP8k0U7XV3kkB+ZGy69kDk2ySFW1qPi06sjKzFY3t1j6XbJSqr4mF9L7CYVyhg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
dev: true
/@babel/helper-module-imports/7.18.6:
resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
dev: true
/@babel/helper-module-transforms/7.18.8:
resolution: {integrity: sha512-che3jvZwIcZxrwh63VfnFTUzcAM9v/lznYkkRxIBGMPt1SudOKHAEec0SIRCfiuIzTcF7VGj/CaTT6gY4eWxvA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-environment-visitor': 7.18.6
'@babel/helper-module-imports': 7.18.6
'@babel/helper-simple-access': 7.18.6
'@babel/helper-split-export-declaration': 7.18.6
'@babel/helper-validator-identifier': 7.18.6
'@babel/template': 7.18.6
'@babel/traverse': 7.18.8
'@babel/types': 7.18.8
transitivePeerDependencies:
- supports-color
dev: true
/@babel/helper-optimise-call-expression/7.18.6:
resolution: {integrity: sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
dev: true
/@babel/helper-plugin-utils/7.18.6:
resolution: {integrity: sha512-gvZnm1YAAxh13eJdkb9EWHBnF3eAub3XTLCZEehHT2kWxiKVRL64+ae5Y6Ivne0mVHmMYKT+xWgZO+gQhuLUBg==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helper-replace-supers/7.18.6:
resolution: {integrity: sha512-fTf7zoXnUGl9gF25fXCWE26t7Tvtyn6H4hkLSYhATwJvw2uYxd3aoXplMSe0g9XbwK7bmxNes7+FGO0rB/xC0g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-environment-visitor': 7.18.6
'@babel/helper-member-expression-to-functions': 7.18.6
'@babel/helper-optimise-call-expression': 7.18.6
'@babel/traverse': 7.18.8
'@babel/types': 7.18.8
transitivePeerDependencies:
- supports-color
dev: true
/@babel/helper-simple-access/7.18.6:
resolution: {integrity: sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
dev: true
/@babel/helper-split-export-declaration/7.18.6:
resolution: {integrity: sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.18.8
dev: true
/@babel/helper-validator-identifier/7.18.6:
resolution: {integrity: sha512-MmetCkz9ej86nJQV+sFCxoGGrUbU3q02kgLciwkrt9QqEB7cP39oKEY0PakknEO0Gu20SskMRi+AYZ3b1TpN9g==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helper-validator-option/7.18.6:
resolution: {integrity: sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helpers/7.18.6:
resolution: {integrity: sha512-vzSiiqbQOghPngUYt/zWGvK3LAsPhz55vc9XNN0xAl2gV4ieShI2OQli5duxWHD+72PZPTKAcfcZDE1Cwc5zsQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.18.6
'@babel/traverse': 7.18.8
'@babel/types': 7.18.8
transitivePeerDependencies:
- supports-color
dev: true
/@babel/highlight/7.18.6:
resolution: {integrity: sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-validator-identifier': 7.18.6
chalk: 2.4.2
js-tokens: 4.0.0
dev: true
/@babel/parser/7.18.8:
resolution: {integrity: sha512-RSKRfYX20dyH+elbJK2uqAkVyucL+xXzhqlMD5/ZXx+dAAwpyB7HsvnHe/ZUGOF+xLr5Wx9/JoXVTj6BQE2/oA==}
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
'@babel/types': 7.18.8
dev: true
/@babel/plugin-syntax-jsx/7.18.6_@babel+core@7.18.6:
resolution: {integrity: sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.18.6
'@babel/helper-plugin-utils': 7.18.6
dev: true
/@babel/plugin-syntax-typescript/7.18.6_@babel+core@7.18.6:
resolution: {integrity: sha512-mAWAuq4rvOepWCBid55JuRNvpTNf2UGVgoz4JV0fXEKolsVZDzsa4NqCef758WZJj/GDu0gVGItjKFiClTAmZA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.18.6
'@babel/helper-plugin-utils': 7.18.6
dev: true
/@babel/plugin-transform-typescript/7.18.8_@babel+core@7.18.6:
resolution: {integrity: sha512-p2xM8HI83UObjsZGofMV/EdYjamsDm6MoN3hXPYIT0+gxIoopE+B7rPYKAxfrz9K9PK7JafTTjqYC6qipLExYA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.18.6
'@babel/helper-create-class-features-plugin': 7.18.6_@babel+core@7.18.6
'@babel/helper-plugin-utils': 7.18.6
'@babel/plugin-syntax-typescript': 7.18.6_@babel+core@7.18.6
transitivePeerDependencies:
- supports-color
dev: true
/@babel/preset-typescript/7.18.6_@babel+core@7.18.6:
resolution: {integrity: sha512-s9ik86kXBAnD760aybBucdpnLsAt0jK1xqJn2juOn9lkOvSHV60os5hxoVJsPzMQxvnUJFAlkont2DvvaYEBtQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.18.6
'@babel/helper-plugin-utils': 7.18.6
'@babel/helper-validator-option': 7.18.6
'@babel/plugin-transform-typescript': 7.18.8_@babel+core@7.18.6
transitivePeerDependencies:
- supports-color
dev: true
/@babel/template/7.18.6:
resolution: {integrity: sha512-JoDWzPe+wgBsTTgdnIma3iHNFC7YVJoPssVBDjiHfNlyt4YcunDtcDOUmfVDfCK5MfdsaIoX9PkijPhjH3nYUw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.18.6
'@babel/parser': 7.18.8
'@babel/types': 7.18.8
dev: true
/@babel/traverse/7.18.8:
resolution: {integrity: sha512-UNg/AcSySJYR/+mIcJQDCv00T+AqRO7j/ZEJLzpaYtgM48rMg5MnkJgyNqkzo88+p4tfRvZJCEiwwfG6h4jkRg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.18.6
'@babel/generator': 7.18.7
'@babel/helper-environment-visitor': 7.18.6
'@babel/helper-function-name': 7.18.6
'@babel/helper-hoist-variables': 7.18.6
'@babel/helper-split-export-declaration': 7.18.6
'@babel/parser': 7.18.8
'@babel/types': 7.18.8
debug: 4.3.4
globals: 11.12.0
transitivePeerDependencies:
- supports-color
dev: true
/@babel/types/7.18.8:
resolution: {integrity: sha512-qwpdsmraq0aJ3osLJRApsc2ouSJCdnMeZwB0DhbtHAtRpZNZCdlbRnHIgcRKzdE1g0iOGg644fzjOBcdOz9cPw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-validator-identifier': 7.18.6
to-fast-properties: 2.0.0
dev: true
/@jridgewell/gen-mapping/0.1.1:
resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==}
engines: {node: '>=6.0.0'}
dependencies:
'@jridgewell/set-array': 1.1.2
'@jridgewell/sourcemap-codec': 1.4.14
dev: true
/@jridgewell/gen-mapping/0.3.2:
resolution: {integrity: sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==}
engines: {node: '>=6.0.0'}
dependencies:
'@jridgewell/set-array': 1.1.2
'@jridgewell/sourcemap-codec': 1.4.14
'@jridgewell/trace-mapping': 0.3.14
dev: true
/@jridgewell/resolve-uri/3.1.0:
resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==}
engines: {node: '>=6.0.0'}
dev: true
/@jridgewell/set-array/1.1.2:
resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==}
engines: {node: '>=6.0.0'}
dev: true
/@jridgewell/sourcemap-codec/1.4.14:
resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==}
dev: true
/@jridgewell/trace-mapping/0.3.14:
resolution: {integrity: sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ==}
dependencies:
'@jridgewell/resolve-uri': 3.1.0
'@jridgewell/sourcemap-codec': 1.4.14
dev: true
/ansi-styles/3.2.1:
resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==}
engines: {node: '>=4'}
dependencies:
color-convert: 1.9.3
dev: true
/babel-plugin-jsx-dom-expressions/0.33.12_@babel+core@7.18.6:
resolution: {integrity: sha512-FQeNcBvC+PrPYGpeUztI7AiiAqJL2H8e7mL4L6qHZ7B4wZfbgyREsHZwKmmDqxAehlyAUolTdhDNk9xfyHdIZw==}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/core': 7.18.6
'@babel/helper-module-imports': 7.16.0
'@babel/plugin-syntax-jsx': 7.18.6_@babel+core@7.18.6
'@babel/types': 7.18.8
html-entities: 2.3.2
dev: true
/babel-preset-solid/1.4.6_@babel+core@7.18.6:
resolution: {integrity: sha512-5n+nm1zgj7BK9cv0kYu0p+kbsXgGbrxLmA5bv5WT0V5WnqRgshWILInPWLJNZbvP5gBj+huDKwk3J4RhhbFlhA==}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/core': 7.18.6
babel-plugin-jsx-dom-expressions: 0.33.12_@babel+core@7.18.6
dev: true
/browserslist/4.21.2:
resolution: {integrity: sha512-MonuOgAtUB46uP5CezYbRaYKBNt2LxP0yX+Pmj4LkcDFGkn9Cbpi83d9sCjwQDErXsIJSzY5oKGDbgOlF/LPAA==}
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
dependencies:
caniuse-lite: 1.0.30001366
electron-to-chromium: 1.4.189
node-releases: 2.0.6
update-browserslist-db: 1.0.4_browserslist@4.21.2
dev: true
/caniuse-lite/1.0.30001366:
resolution: {integrity: sha512-yy7XLWCubDobokgzudpkKux8e0UOOnLHE6mlNJBzT3lZJz6s5atSEzjoL+fsCPkI0G8MP5uVdDx1ur/fXEWkZA==}
dev: true
/chalk/2.4.2:
resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==}
engines: {node: '>=4'}
dependencies:
ansi-styles: 3.2.1
escape-string-regexp: 1.0.5
supports-color: 5.5.0
dev: true
/color-convert/1.9.3:
resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==}
dependencies:
color-name: 1.1.3
dev: true
/color-name/1.1.3:
resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==}
dev: true
/convert-source-map/1.8.0:
resolution: {integrity: sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==}
dependencies:
safe-buffer: 5.1.2
dev: true
/debug/4.3.4:
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
engines: {node: '>=6.0'}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
dependencies:
ms: 2.1.2
dev: true
/electron-to-chromium/1.4.189:
resolution: {integrity: sha512-dQ6Zn4ll2NofGtxPXaDfY2laIa6NyCQdqXYHdwH90GJQW0LpJJib0ZU/ERtbb0XkBEmUD2eJtagbOie3pdMiPg==}
dev: true
/esbuild-android-64/0.14.49:
resolution: {integrity: sha512-vYsdOTD+yi+kquhBiFWl3tyxnj2qZJsl4tAqwhT90ktUdnyTizgle7TjNx6Ar1bN7wcwWqZ9QInfdk2WVagSww==}
engines: {node: '>=12'}
cpu: [x64]
os: [android]
requiresBuild: true
dev: true
optional: true
/esbuild-android-arm64/0.14.49:
resolution: {integrity: sha512-g2HGr/hjOXCgSsvQZ1nK4nW/ei8JUx04Li74qub9qWrStlysaVmadRyTVuW32FGIpLQyc5sUjjZopj49eGGM2g==}
engines: {node: '>=12'}
cpu: [arm64]
os: [android]
requiresBuild: true
dev: true
optional: true
/esbuild-darwin-64/0.14.49:
resolution: {integrity: sha512-3rvqnBCtX9ywso5fCHixt2GBCUsogNp9DjGmvbBohh31Ces34BVzFltMSxJpacNki96+WIcX5s/vum+ckXiLYg==}
engines: {node: '>=12'}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/esbuild-darwin-arm64/0.14.49:
resolution: {integrity: sha512-XMaqDxO846srnGlUSJnwbijV29MTKUATmOLyQSfswbK/2X5Uv28M9tTLUJcKKxzoo9lnkYPsx2o8EJcTYwCs/A==}
engines: {node: '>=12'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/esbuild-freebsd-64/0.14.49:
resolution: {integrity: sha512-NJ5Q6AjV879mOHFri+5lZLTp5XsO2hQ+KSJYLbfY9DgCu8s6/Zl2prWXVANYTeCDLlrIlNNYw8y34xqyLDKOmQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [freebsd]
requiresBuild: true
dev: true
optional: true
/esbuild-freebsd-arm64/0.14.49:
resolution: {integrity: sha512-lFLtgXnAc3eXYqj5koPlBZvEbBSOSUbWO3gyY/0+4lBdRqELyz4bAuamHvmvHW5swJYL7kngzIZw6kdu25KGOA==}
engines: {node: '>=12'}
cpu: [arm64]
os: [freebsd]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-32/0.14.49:
resolution: {integrity: sha512-zTTH4gr2Kb8u4QcOpTDVn7Z8q7QEIvFl/+vHrI3cF6XOJS7iEI1FWslTo3uofB2+mn6sIJEQD9PrNZKoAAMDiA==}
engines: {node: '>=12'}
cpu: [ia32]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-64/0.14.49:
resolution: {integrity: sha512-hYmzRIDzFfLrB5c1SknkxzM8LdEUOusp6M2TnuQZJLRtxTgyPnZZVtyMeCLki0wKgYPXkFsAVhi8vzo2mBNeTg==}
engines: {node: '>=12'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-arm/0.14.49:
resolution: {integrity: sha512-iE3e+ZVv1Qz1Sy0gifIsarJMQ89Rpm9mtLSRtG3AH0FPgAzQ5Z5oU6vYzhc/3gSPi2UxdCOfRhw2onXuFw/0lg==}
engines: {node: '>=12'}
cpu: [arm]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-arm64/0.14.49:
resolution: {integrity: sha512-KLQ+WpeuY+7bxukxLz5VgkAAVQxUv67Ft4DmHIPIW+2w3ObBPQhqNoeQUHxopoW/aiOn3m99NSmSV+bs4BSsdA==}
engines: {node: '>=12'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-mips64le/0.14.49:
resolution: {integrity: sha512-n+rGODfm8RSum5pFIqFQVQpYBw+AztL8s6o9kfx7tjfK0yIGF6tm5HlG6aRjodiiKkH2xAiIM+U4xtQVZYU4rA==}
engines: {node: '>=12'}
cpu: [mips64el]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-ppc64le/0.14.49:
resolution: {integrity: sha512-WP9zR4HX6iCBmMFH+XHHng2LmdoIeUmBpL4aL2TR8ruzXyT4dWrJ5BSbT8iNo6THN8lod6GOmYDLq/dgZLalGw==}
engines: {node: '>=12'}
cpu: [ppc64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-riscv64/0.14.49:
resolution: {integrity: sha512-h66ORBz+Dg+1KgLvzTVQEA1LX4XBd1SK0Fgbhhw4akpG/YkN8pS6OzYI/7SGENiN6ao5hETRDSkVcvU9NRtkMQ==}
engines: {node: '>=12'}
cpu: [riscv64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-s390x/0.14.49:
resolution: {integrity: sha512-DhrUoFVWD+XmKO1y7e4kNCqQHPs6twz6VV6Uezl/XHYGzM60rBewBF5jlZjG0nCk5W/Xy6y1xWeopkrhFFM0sQ==}
engines: {node: '>=12'}
cpu: [s390x]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-netbsd-64/0.14.49:
resolution: {integrity: sha512-BXaUwFOfCy2T+hABtiPUIpWjAeWK9P8O41gR4Pg73hpzoygVGnj0nI3YK4SJhe52ELgtdgWP/ckIkbn2XaTxjQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [netbsd]
requiresBuild: true
dev: true
optional: true
/esbuild-openbsd-64/0.14.49:
resolution: {integrity: sha512-lP06UQeLDGmVPw9Rg437Btu6J9/BmyhdoefnQ4gDEJTtJvKtQaUcOQrhjTq455ouZN4EHFH1h28WOJVANK41kA==}
engines: {node: '>=12'}
cpu: [x64]
os: [openbsd]
requiresBuild: true
dev: true
optional: true
/esbuild-sunos-64/0.14.49:
resolution: {integrity: sha512-4c8Zowp+V3zIWje329BeLbGh6XI9c/rqARNaj5yPHdC61pHI9UNdDxT3rePPJeWcEZVKjkiAS6AP6kiITp7FSw==}
engines: {node: '>=12'}
cpu: [x64]
os: [sunos]
requiresBuild: true
dev: true
optional: true
/esbuild-windows-32/0.14.49:
resolution: {integrity: sha512-q7Rb+J9yHTeKr9QTPDYkqfkEj8/kcKz9lOabDuvEXpXuIcosWCJgo5Z7h/L4r7rbtTH4a8U2FGKb6s1eeOHmJA==}
engines: {node: '>=12'}
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: true
optional: true
/esbuild-windows-64/0.14.49:
resolution: {integrity: sha512-+Cme7Ongv0UIUTniPqfTX6mJ8Deo7VXw9xN0yJEN1lQMHDppTNmKwAM3oGbD/Vqff+07K2gN0WfNkMohmG+dVw==}
engines: {node: '>=12'}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/esbuild-windows-arm64/0.14.49:
resolution: {integrity: sha512-v+HYNAXzuANrCbbLFJ5nmO3m5y2PGZWLe3uloAkLt87aXiO2mZr3BTmacZdjwNkNEHuH3bNtN8cak+mzVjVPfA==}
engines: {node: '>=12'}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/esbuild/0.14.49:
resolution: {integrity: sha512-/TlVHhOaq7Yz8N1OJrjqM3Auzo5wjvHFLk+T8pIue+fhnhIMpfAzsG6PLVMbFveVxqD2WOp3QHei+52IMUNmCw==}
engines: {node: '>=12'}
hasBin: true
requiresBuild: true
optionalDependencies:
esbuild-android-64: 0.14.49
esbuild-android-arm64: 0.14.49
esbuild-darwin-64: 0.14.49
esbuild-darwin-arm64: 0.14.49
esbuild-freebsd-64: 0.14.49
esbuild-freebsd-arm64: 0.14.49
esbuild-linux-32: 0.14.49
esbuild-linux-64: 0.14.49
esbuild-linux-arm: 0.14.49
esbuild-linux-arm64: 0.14.49
esbuild-linux-mips64le: 0.14.49
esbuild-linux-ppc64le: 0.14.49
esbuild-linux-riscv64: 0.14.49
esbuild-linux-s390x: 0.14.49
esbuild-netbsd-64: 0.14.49
esbuild-openbsd-64: 0.14.49
esbuild-sunos-64: 0.14.49
esbuild-windows-32: 0.14.49
esbuild-windows-64: 0.14.49
esbuild-windows-arm64: 0.14.49
dev: true
/escalade/3.1.1:
resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
engines: {node: '>=6'}
dev: true
/escape-string-regexp/1.0.5:
resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==}
engines: {node: '>=0.8.0'}
dev: true
/fsevents/2.3.2:
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
requiresBuild: true
dev: true
optional: true
/function-bind/1.1.1:
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
dev: true
/gensync/1.0.0-beta.2:
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'}
dev: true
/globals/11.12.0:
resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==}
engines: {node: '>=4'}
dev: true
/has-flag/3.0.0:
resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==}
engines: {node: '>=4'}
dev: true
/has/1.0.3:
resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==}
engines: {node: '>= 0.4.0'}
dependencies:
function-bind: 1.1.1
dev: true
/html-entities/2.3.2:
resolution: {integrity: sha512-c3Ab/url5ksaT0WyleslpBEthOzWhrjQbg75y7XUsfSzi3Dgzt0l8w5e7DylRn15MTlMMD58dTfzddNS2kcAjQ==}
dev: true
/is-core-module/2.9.0:
resolution: {integrity: sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==}
dependencies:
has: 1.0.3
dev: true
/is-what/4.1.7:
resolution: {integrity: sha512-DBVOQNiPKnGMxRMLIYSwERAS5MVY1B7xYiGnpgctsOFvVDz9f9PFXXxMcTOHuoqYp4NK9qFYQaIC1NRRxLMpBQ==}
engines: {node: '>=12.13'}
dev: true
/js-tokens/4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
dev: true
/jsesc/2.5.2:
resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
engines: {node: '>=4'}
hasBin: true
dev: true
/json5/2.2.1:
resolution: {integrity: sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==}
engines: {node: '>=6'}
hasBin: true
dev: true
/merge-anything/5.0.2:
resolution: {integrity: sha512-POPQBWkBC0vxdgzRJ2Mkj4+2NTKbvkHo93ih+jGDhNMLzIw+rYKjO7949hOQM2X7DxMHH1uoUkwWFLIzImw7gA==}
engines: {node: '>=12.13'}
dependencies:
is-what: 4.1.7
ts-toolbelt: 9.6.0
dev: true
/ms/2.1.2:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
dev: true
/nanoid/3.3.4:
resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
dev: true
/node-releases/2.0.6:
resolution: {integrity: sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==}
dev: true
/path-parse/1.0.7:
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
dev: true
/picocolors/1.0.0:
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
dev: true
/postcss/8.4.14:
resolution: {integrity: sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==}
engines: {node: ^10 || ^12 || >=14}
dependencies:
nanoid: 3.3.4
picocolors: 1.0.0
source-map-js: 1.0.2
dev: true
/resolve/1.22.1:
resolution: {integrity: sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==}
hasBin: true
dependencies:
is-core-module: 2.9.0
path-parse: 1.0.7
supports-preserve-symlinks-flag: 1.0.0
dev: true
/rollup/2.76.0:
resolution: {integrity: sha512-9jwRIEY1jOzKLj3nsY/yot41r19ITdQrhs+q3ggNWhr9TQgduHqANvPpS32RNpzGklJu3G1AJfvlZLi/6wFgWA==}
engines: {node: '>=10.0.0'}
hasBin: true
optionalDependencies:
fsevents: 2.3.2
dev: true
/safe-buffer/5.1.2:
resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
dev: true
/semver/6.3.0:
resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==}
hasBin: true
dev: true
/solid-js/1.4.7:
resolution: {integrity: sha512-u3hoe5w3xseAc/8zLwYaQVGanWXknMMQkzryNz7lOPy2ygW6DhCtfMseun4kLflRNRzrUUpTV3W5p7j2SGcHCQ==}
/solid-refresh/0.4.1_solid-js@1.4.7:
resolution: {integrity: sha512-v3tD/OXQcUyXLrWjPW1dXZyeWwP7/+GQNs8YTL09GBq+5FguA6IejJWUvJDrLIA4M0ho9/5zK2e9n+uy+4488g==}
peerDependencies:
solid-js: ^1.3
dependencies:
'@babel/generator': 7.18.7
'@babel/helper-module-imports': 7.18.6
'@babel/types': 7.18.8
solid-js: 1.4.7
dev: true
/source-map-js/1.0.2:
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
engines: {node: '>=0.10.0'}
dev: true
/supports-color/5.5.0:
resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==}
engines: {node: '>=4'}
dependencies:
has-flag: 3.0.0
dev: true
/supports-preserve-symlinks-flag/1.0.0:
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
dev: true
/to-fast-properties/2.0.0:
resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==}
engines: {node: '>=4'}
dev: true
/ts-toolbelt/9.6.0:
resolution: {integrity: sha512-nsZd8ZeNUzukXPlJmTBwUAuABDe/9qtVDelJeT/qW0ow3ZS3BsQJtNkan1802aM9Uf68/Y8ljw86Hu0h5IUW3w==}
dev: true
/update-browserslist-db/1.0.4_browserslist@4.21.2:
resolution: {integrity: sha512-jnmO2BEGUjsMOe/Fg9u0oczOe/ppIDZPebzccl1yDWGLFP16Pa1/RM5wEoKYPG2zstNcDuAStejyxsOuKINdGA==}
hasBin: true
peerDependencies:
browserslist: '>= 4.21.0'
dependencies:
browserslist: 4.21.2
escalade: 3.1.1
picocolors: 1.0.0
dev: true
/vite-plugin-solid/2.3.0_solid-js@1.4.7+vite@3.0.0:
resolution: {integrity: sha512-N2sa54C3UZC2nN5vpj5o6YP+XdIAZW6n6xv8OasxNAcAJPFeZT7EOVvumL0V4c8hBz1yuYniMWdESY8807fVSg==}
peerDependencies:
solid-js: ^1.3.17
vite: ^3.0.0
dependencies:
'@babel/core': 7.18.6
'@babel/preset-typescript': 7.18.6_@babel+core@7.18.6
babel-preset-solid: 1.4.6_@babel+core@7.18.6
merge-anything: 5.0.2
solid-js: 1.4.7
solid-refresh: 0.4.1_solid-js@1.4.7
vite: 3.0.0
transitivePeerDependencies:
- supports-color
dev: true
/vite/3.0.0:
resolution: {integrity: sha512-M7phQhY3+fRZa0H+1WzI6N+/onruwPTBTMvaj7TzgZ0v2TE+N2sdLKxJOfOv9CckDWt5C4HmyQP81xB4dwRKzA==}
engines: {node: '>=14.18.0'}
hasBin: true
peerDependencies:
less: '*'
sass: '*'
stylus: '*'
terser: ^5.4.0
peerDependenciesMeta:
less:
optional: true
sass:
optional: true
stylus:
optional: true
terser:
optional: true
dependencies:
esbuild: 0.14.49
postcss: 8.4.14
resolve: 1.22.1
rollup: 2.76.0
optionalDependencies:
fsevents: 2.3.2
dev: true

@ -0,0 +1,49 @@
import {
createSignal,
} from "solid-js";
import {createStore} from "solid-js/store";
import styles from "./Editor.module.css";
import LeftPane from "./LeftPane.jsx";
import MiddlePane from "./MiddlePane.jsx";
import RightPane from "./RightPane.jsx";
import {World} from "../stackline-wasm/stackline_wasm.js";
let json = await (await fetch("/stackline-wasm/prime.json")).json();
export default function Editor() {
let [world, setWorld] = createSignal(World.deserialize(json), {equals: false});
let [settings, setSettings] = createStore({
time: performance.now(),
cx: 0,
cy: 0,
zoom: 0,
grid: true,
get zoom_factor() {
return Math.ceil(Math.pow(2, this.zoom));
},
get tile_size() {
return 10 * this.zoom_factor;
}
});
world().init();
setWorld((world) => {
world.init();
console.log(world.toString());
return world;
});
return (
<div class={styles.Editor}>
<LeftPane />
<MiddlePane settings={settings} world={world} setSettings={setSettings} />
<RightPane />
</div>
);
}

@ -0,0 +1,8 @@
.Editor {
width: 100vw;
height: 100vh;
display: flex;
flex-direction: row;
align-items: stretch;
overflow-y: hidden;
}

@ -0,0 +1,5 @@
export default function LeftPane(props) {
return (<div id="left-pane">
</div>);
}

@ -0,0 +1,302 @@
import {createEffect, createSignal, createMemo, untrack} from "solid-js";
import {createStore} from "solid-js/store";
import styles from "./MiddlePane.module.css";
// TODO: use something like a Semaphore to only draw when needed
const ZOOM_STRENGTH = -0.005;
export default function MiddlePane(props) {
let {settings, setSettings, world} = props;
let mounted = true;
let [canvas, setCanvas] = createStore({
width: 100,
height: 100,
element: null,
ctx: null,
});
let [view, setView] = createStore({
from_x: 0,
to_x: 0,
from_y: 0,
to_y: 0,
get width() {
return this.to_x - this.from_x + 1;
},
get height() {
return this.to_y - this.from_y + 1;
}
});
let [mouse, setMouse] = createStore({
x: 0,
y: 0,
click_x: 0,
click_y: 0,
hovering: false
});
createEffect(() => {
let from_y = Math.floor((-settings.cy - canvas.height / 2) / settings.tile_size);
let to_y = Math.ceil((-settings.cy + canvas.height / 2) / settings.tile_size);
let from_x = Math.floor((-settings.cx - canvas.width / 2) / settings.tile_size);
let to_x = Math.ceil((-settings.cx + canvas.width / 2) / settings.tile_size);
// effect automatically batches
setView("from_x", from_x);
setView("from_y", from_y);
setView("to_x", to_x);
setView("to_y", to_y);
});
let getSurface = createMemo(() => {
let _ = settings.time;
world().set_blink_duration(settings.time / 1000.0);
return world().draw(-view.from_x, -view.from_y, view.width, view.height);
}, {equals: false});
let getPanes = createMemo(() => {
let panes = [];
for (let name of world().panes()) {
let pane = world().get_pane(name);
panes.push({
x: pane.x,
y: pane.y,
width: pane.width,
height: pane.height
});
pane.free();
}
return panes;
});
// Draw
function draw() {
if (!canvas.ctx) return;
let surface = getSurface();
let {tile_size, zoom_factor, cx, cy} = settings;
let {width, height, ctx} = canvas;
let {from_x, to_x, from_y, to_y} = view;
let view_width = view.width;
let view_height = view.height;
let panes = getPanes();
function stroke_rect(x, y, w, h) {
ctx.lineWidth = zoom_factor;
ctx.strokeRect(
Math.round(x * tile_size + cx + width / 2) - zoom_factor * 1.5,
Math.round(y * tile_size + cy + height / 2) - zoom_factor * 1.5,
Math.round(w * tile_size) + zoom_factor * 2,
Math.round(h * tile_size) + zoom_factor * 2,
);
}
function fill_rect(x, y, w, h) {
ctx.fillRect(
Math.round(x * tile_size + cx + width / 2) - zoom_factor * 1,
Math.round(y * tile_size + cy + height / 2) - zoom_factor * 1,
Math.round(w * tile_size) + zoom_factor * 1,
Math.round(h * tile_size) + zoom_factor * 1,
);
}
ctx.fillStyle = "#202027";
ctx.fillRect(0, 0, width, height);
ctx.textAlign = "left";
ctx.textBaseline = "top";
ctx.font = `${tile_size}px Stackline Classic`;
ctx.strokeStyle = "rgba(128, 128, 128, 0.5)";
for (let pane of panes) {
stroke_rect(
pane.x,
pane.y,
pane.width,
pane.height,
);
}
for (let y = from_y; y <= to_y; y++) {
for (let x = from_x; x <= to_x; x++) {
let x2 = x * tile_size + cx + width / 2;
let y2 = y * tile_size + cy + height / 2;
let index = 3 * (view_width * (y - from_y) + x - from_x);
let ch = String.fromCharCode(surface[index]);
if (ch !== " ") {
let fg = to_color(surface[index + 1]);
let bg = surface[index + 2] === 0 ? null : to_color(surface[index + 2]);
if (bg) {
ctx.fillStyle = `rgba(${bg.join(",")})`;
ctx.fillRect(
Math.round(x2),
Math.round(y2),
Math.round(x2 + tile_size) - Math.round(x2),
Math.round(y2 + tile_size) - Math.round(y2),
);
}
ctx.fillStyle = `rgba(${fg.join(",")})`;
ctx.fillText(
ch,
Math.round(x2),
Math.round(y2),
);
} else if (settings.grid) {
// Draw grid
let inside = false;
for (let pane of panes) {
if (x >= pane.x && x < pane.x + pane.width && y >= pane.y && y < pane.y + pane.height) {
inside = true;
break;
}
}
if (inside || view_width < 100 && view_height < 100) {
ctx.fillStyle = inside ? "#404040" : "#303030";
ctx.fillRect(
Math.round(x2 + tile_size / 2) - zoom_factor,
Math.round(y2 + tile_size / 2) - zoom_factor,
zoom_factor,
zoom_factor
);
}
}
}
}
if (mouse.hovering) {
let [x, y] = get_hovered();
ctx.strokeStyle = "rgba(230, 255, 230, 0.2)";
ctx.fillStyle = "rgba(230, 255, 230, 0.07)";
stroke_rect(x, y, 1, 1);
fill_rect(x, y, 1, 1);
}
if (mounted) {
window.requestAnimationFrame(() => {
draw();
});
}
}
let resize_listener = () => {
if (!canvas.element) return;
setCanvas((obj) => {
return {
...obj,
width: obj.element.width = canvas.element.clientWidth,
height: obj.element.height = canvas.element.clientHeight,
};
});
}
createEffect(() => {
resize_listener();
untrack(draw);
});
function get_hovered() {
let x = Math.floor((mouse.x - canvas.width / 2 - settings.cx) / settings.tile_size);
let y = Math.floor((mouse.y - canvas.height / 2 - settings.cy) / settings.tile_size);
return [x, y];
}
let _canvas;
return (<div
class={styles.MiddlePane}
onMount={window.addEventListener("resize", resize_listener)}
onCleanup={window.removeEventListener("resize", resize_listener)}
>
<canvas
ref={(el) => {
setCanvas("element", el);
setCanvas("ctx", el.getContext("2d"));
}}
class={styles.canvas}
width={canvas.width}
height={canvas.height}
onMount={() => {mounted = true}}
onCleanup={() => {mounted = false}}
onMouseDown={(evt) => {
let mouse_x = evt.clientX - canvas.element.offsetLeft;
let mouse_y = evt.clientY - canvas.element.offsetTop;
setMouse((mouse) => {
return {
...mouse,
x: mouse_x,
y: mouse_y,
click_x: mouse_x,
click_y: mouse_x,
hovering: true,
down: true,
}
});
}}
onMouseMove={(evt) => {
setMouse("hovering", true);
if (mouse.down) {
// TODO: numerically stable solution
setSettings("cx", settings.cx + (evt.clientX - canvas.element.offsetLeft) - mouse.x);
setSettings("cy", settings.cy + (evt.clientY - canvas.element.offsetTop) - mouse.y);
}
setMouse("x", evt.clientX - canvas.element.offsetLeft);
setMouse("y", evt.clientY - canvas.element.offsetTop);
}}
onMouseUp={(evt) => {
setMouse("down", false);
let dist = Math.sqrt((mouse.x - mouse.click_x) ** 2 + (mouse.y - mouse.click_y) ** 2);
if (dist < 10) {
// TODO
// select(...get_hovered());
}
}}
onMouseEnter={() => {
setMouse("hovering", true);
}}
onMouseLeave={() => {
setMouse("down", false);
setMouse("hovering", false);
}}
onWheel={(evt) => {
let old_zoom = settings.zoom;
let zoom = settings.zoom + event.deltaY * ZOOM_STRENGTH;
zoom = Math.min(Math.max(zoom, 0.0), 4.0);
setSettings("zoom", zoom);
let delta = Math.ceil(Math.pow(2, zoom)) / Math.ceil(Math.pow(2, old_zoom));
setSettings("cx", settings.cx * delta);
setSettings("cy", settings.cy * delta);
}}
>
Sowwy, your browser does not support canvases.
</canvas>
</div>);
}
export function to_color(num) {
let alpha = (num >> 24) & 0xff;
let red = (num >> 16) & 0xff;
let green = (num >> 8) & 0xff;
let blue = num & 0xff;
return [red, green, blue, alpha];
}

@ -0,0 +1,8 @@
.MiddlePane {
flex-grow: 1;
}
.canvas {
width: 100%;
height: 100vh;
}

@ -0,0 +1,7 @@
export default function RightPane(props) {
return (<div id="right-pane">
</div>);
}

@ -0,0 +1,4 @@
body {
margin: 0;
height: 100vh;
}

@ -0,0 +1,13 @@
/* @refresh reload */
import { render } from 'solid-js/web';
import './index.css';
import Editor from './Editor';
import init from "../stackline-wasm/stackline_wasm.js";
await init();
let font = await (new FontFace("Stackline Classic", "url(\"/font/StacklineClassic-Medium.otf\")")).load();
document.fonts.add(font);
render(() => <Editor />, document.getElementById('root'));

@ -0,0 +1,13 @@
import { defineConfig } from 'vite';
import solidPlugin from 'vite-plugin-solid';
export default defineConfig({
plugins: [solidPlugin()],
server: {
port: 3000,
},
build: {
target: 'esnext',
},
clearScreen: false,
});
Loading…
Cancel
Save