Skip to content

Commit

Permalink
codeformat
Browse files Browse the repository at this point in the history
  • Loading branch information
felixroos committed Jan 2, 2025
1 parent 6bbd3da commit 3b4dc7d
Show file tree
Hide file tree
Showing 14 changed files with 898 additions and 567 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:

# Allow one concurrent deployment
concurrency:
group: "pages"
group: 'pages'
cancel-in-progress: true

jobs:
Expand All @@ -31,7 +31,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 20
cache: "pnpm"
cache: 'pnpm'
- name: Install Dependencies
run: pnpm install

Expand All @@ -45,7 +45,7 @@ jobs:
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: "./dist"
path: './dist'

- name: Deploy to GitHub Pages
id: deployment
Expand Down
38 changes: 19 additions & 19 deletions hydra.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<body style="background-color: #111; margin:0">
<style>
<body style="background-color: #111; margin: 0">
<style>
#canvas {
width: 100%;
height: 100%;
image-rendering: pixelated;
width: 100%;
height: 100%;
image-rendering: pixelated;
}
</style>
<script>
window.global = window;
</script>
</style>
<script>
window.global = window;
</script>
<script type="module">
// this is expected to run in an iframe
// this way, hydra runs in an iframe
Expand All @@ -19,39 +19,39 @@
// the js here is only for plumbing postMessages
// + creating the hydra session

import { HydraSession } from "./src/hydra";
import { HydraSession } from './src/hydra';
function send(type, msg) {
window.parent.postMessage({ type, msg });
}

const hydra = new HydraSession({
onError: (...args) => send("onError", args),
canvas: document.getElementById("canvas"),
onError: (...args) => send('onError', args),
canvas: document.getElementById('canvas'),
onHighlight: (...args) => {
send("onHighlight", [docId, phase]);
send('onHighlight', [docId, phase]);
},
});

window.parent.hydra = hydra;

window.addEventListener("message", (event) => {
window.addEventListener('message', (event) => {
if (event.origin !== window.location.origin) {
return;
}
if (event.data.type === "eval") {
if (event.data.type === 'eval') {
hydra.eval(event.data.msg);
}
});

let resizeDebounce;
window.addEventListener("resize", () => {
window.addEventListener('resize', () => {
clearTimeout(resizeDebounce);
resizeDebounce = setTimeout(() => hydra.resize(), 200);
});

console.log("hydra iframe loaded", hydra);
console.log('hydra iframe loaded', hydra);
</script>
<canvas id="canvas" />
/>
/>
</body>
</html>
9 changes: 2 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down Expand Up @@ -106,12 +106,7 @@ <h1>Settings</h1>
<p>
<label for="settings-username">
<span>Username:</span>
<input
type="text"
id="settings-username"
data-1p-ignore
spellcheck="false"
/>
<input type="text" id="settings-username" data-1p-ignore spellcheck="false" />
</label>
<br />
</p>
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
"preview": "vite preview",
"codeformat": "prettier --write ."
},
"devDependencies": {
"vite": "^5.0.12",
Expand Down
Loading

0 comments on commit 3b4dc7d

Please sign in to comment.