initial commit
This commit is contained in:
commit
0cd7ccdc6d
|
@ -0,0 +1,9 @@
|
|||
root = true
|
||||
|
||||
[*.{css,html,js}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.json]
|
||||
indent_style = space
|
||||
indent_size = 2
|
|
@ -0,0 +1,141 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
.stylelintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
.output
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
.temp
|
||||
.cache
|
||||
|
||||
# Sveltekit cache directory
|
||||
.svelte-kit/
|
||||
|
||||
# vitepress build output
|
||||
**/.vitepress/dist
|
||||
|
||||
# vitepress cache directory
|
||||
**/.vitepress/cache
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# Firebase cache directory
|
||||
.firebase/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
# yarn v3
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/sdks
|
||||
!.yarn/versions
|
||||
|
||||
# Vite files
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
.vite/
|
|
@ -0,0 +1,37 @@
|
|||
import Hydra from "hydra-synth";
|
||||
|
||||
const h = new Hydra();
|
||||
|
||||
class App {
|
||||
constructor() {
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", this.init);
|
||||
} else {
|
||||
this.init();
|
||||
}
|
||||
}
|
||||
|
||||
init() {
|
||||
window.addEventListener("resize", (event) => {
|
||||
setResolution(window.innerWidth, window.innerHeight);
|
||||
});
|
||||
|
||||
this.ws = new WebSocket("ws://localhost:8765");
|
||||
this.ws.addEventListener("error", console.error);
|
||||
this.ws.addEventListener("message", ({data}) => {
|
||||
this.onMessage(data);
|
||||
});
|
||||
}
|
||||
|
||||
onMessage(data) {
|
||||
console.log(data);
|
||||
|
||||
try {
|
||||
eval?.(`"use strict";(async () => {${data}})();`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const app = new App();
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Hydra</title>
|
||||
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script type="module" src="app.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
vim.keymap.set('v', '<M-Enter>', function ()
|
||||
local start_pos = vim.fn.getpos('.')
|
||||
local end_pos = vim.fn.getpos('v')
|
||||
local selection = vim.fn.getregion(
|
||||
start_pos,
|
||||
end_pos,
|
||||
{ type = vim.fn.mode() }
|
||||
)
|
||||
|
||||
local code = selection[1]
|
||||
for i = 2, #selection do
|
||||
code = code .. '\n' .. selection[i]
|
||||
end
|
||||
|
||||
local tmp = os.tmpname()
|
||||
local f = io.open(tmp, 'w')
|
||||
f:write(code)
|
||||
f:flush()
|
||||
f:close()
|
||||
|
||||
vim.system({
|
||||
'curl',
|
||||
'http://localhost:8000',
|
||||
'--data-urlencode',
|
||||
'code@' .. tmp
|
||||
}):wait()
|
||||
|
||||
os.remove(tmp)
|
||||
end)
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"hydra-synth": "^1.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite": "^7.1.6"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
from aiohttp import web
|
||||
from websockets.asyncio.server import broadcast, serve
|
||||
from websockets.exceptions import ConnectionClosed
|
||||
|
||||
connected = set()
|
||||
|
||||
|
||||
async def index(request):
|
||||
data = await request.post()
|
||||
|
||||
try:
|
||||
broadcast(connected, data["code"])
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
return web.Response()
|
||||
|
||||
|
||||
async def handle(ws):
|
||||
connected.add(ws)
|
||||
print("connected", file=sys.stderr)
|
||||
|
||||
try:
|
||||
async for message in ws:
|
||||
pass
|
||||
except ConnectionClosed:
|
||||
pass
|
||||
finally:
|
||||
connected.remove(ws)
|
||||
print("disconnected", file=sys.stderr)
|
||||
|
||||
|
||||
async def main():
|
||||
app = web.Application()
|
||||
app.add_routes([web.post("/", index)])
|
||||
|
||||
runner = web.AppRunner(app)
|
||||
await runner.setup()
|
||||
|
||||
site = web.TCPSite(runner, "localhost", 8000)
|
||||
await site.start()
|
||||
|
||||
try:
|
||||
async with serve(handle, "localhost", 8765) as server:
|
||||
await server.serve_forever()
|
||||
except asyncio.CancelledError:
|
||||
print(file=sys.stderr)
|
||||
print("bye", file=sys.stderr)
|
||||
|
||||
await runner.cleanup()
|
||||
|
||||
|
||||
asyncio.run(main())
|
|
@ -0,0 +1,9 @@
|
|||
* {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
import { defineConfig } from "vite";
|
||||
|
||||
export default defineConfig({
|
||||
define: {
|
||||
global: {},
|
||||
},
|
||||
});
|
Loading…
Reference in New Issue