From 44f352743b419a40693364cf516c911f249365af Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Wed, 31 Aug 2022 23:26:01 +0800 Subject: [PATCH] new webui --- README.md | 4 +- cozo_webui/.gitignore | 24 - cozo_webui/.vscode/extensions.json | 3 - cozo_webui/README.md | 48 - cozo_webui/index.html | 13 - cozo_webui/jsconfig.json | 34 - cozo_webui/package.json | 18 - cozo_webui/public/vite.svg | 1 - cozo_webui/src/App.svelte | 133 - cozo_webui/src/app.css | 0 cozo_webui/src/assets/svelte.svg | 1 - cozo_webui/src/lib/Counter.svelte | 10 - cozo_webui/src/main.js | 8 - cozo_webui/src/vite-env.d.ts | 2 - cozo_webui/vite.config.js | 7 - cozo_webui/yarn.lock | 312 - cozohttp/build.rs | 4 +- cozowebui/.gitignore | 23 + cozowebui/README.md | 70 + cozowebui/package.json | 40 + cozowebui/public/index.html | 43 + cozowebui/public/manifest.json | 8 + cozowebui/public/robots.txt | 3 + cozowebui/src/App.css | 15 + cozowebui/src/App.js | 107 + cozowebui/src/App.test.js | 8 + cozowebui/src/index.css | 13 + cozowebui/src/index.js | 17 + cozowebui/src/reportWebVitals.js | 13 + cozowebui/src/setupTests.js | 5 + cozowebui/yarn.lock | 9313 ++++++++++++++++++++++++++++ src/algo/label_propagation.rs | 107 + src/algo/louvain.rs | 2 +- src/algo/mod.rs | 4 + 34 files changed, 9794 insertions(+), 619 deletions(-) delete mode 100644 cozo_webui/.gitignore delete mode 100644 cozo_webui/.vscode/extensions.json delete mode 100644 cozo_webui/README.md delete mode 100644 cozo_webui/index.html delete mode 100644 cozo_webui/jsconfig.json delete mode 100644 cozo_webui/package.json delete mode 100644 cozo_webui/public/vite.svg delete mode 100644 cozo_webui/src/App.svelte delete mode 100644 cozo_webui/src/app.css delete mode 100644 cozo_webui/src/assets/svelte.svg delete mode 100644 cozo_webui/src/lib/Counter.svelte delete mode 100644 cozo_webui/src/main.js delete mode 100644 cozo_webui/src/vite-env.d.ts delete mode 100644 cozo_webui/vite.config.js delete mode 100644 cozo_webui/yarn.lock create mode 100644 cozowebui/.gitignore create mode 100644 cozowebui/README.md create mode 100644 cozowebui/package.json create mode 100644 cozowebui/public/index.html create mode 100644 cozowebui/public/manifest.json create mode 100644 cozowebui/public/robots.txt create mode 100644 cozowebui/src/App.css create mode 100644 cozowebui/src/App.js create mode 100644 cozowebui/src/App.test.js create mode 100644 cozowebui/src/index.css create mode 100644 cozowebui/src/index.js create mode 100644 cozowebui/src/reportWebVitals.js create mode 100644 cozowebui/src/setupTests.js create mode 100644 cozowebui/yarn.lock create mode 100644 src/algo/label_propagation.rs diff --git a/README.md b/README.md index 0b6be64f..bf3a518b 100644 --- a/README.md +++ b/README.md @@ -19,8 +19,8 @@ * [x] triangle counting * [x] strongly connected components * [x] connected components - * [ ] label propagation - * [ ] louvain modularity + * [x] label propagation + * [x] louvain modularity * [x] direct loading of data * [ ] serial agg function * [ ] random function \ No newline at end of file diff --git a/cozo_webui/.gitignore b/cozo_webui/.gitignore deleted file mode 100644 index a547bf36..00000000 --- a/cozo_webui/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* -lerna-debug.log* - -node_modules -dist -dist-ssr -*.local - -# Editor directories and files -.vscode/* -!.vscode/extensions.json -.idea -.DS_Store -*.suo -*.ntvs* -*.njsproj -*.sln -*.sw? diff --git a/cozo_webui/.vscode/extensions.json b/cozo_webui/.vscode/extensions.json deleted file mode 100644 index bdef8201..00000000 --- a/cozo_webui/.vscode/extensions.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "recommendations": ["svelte.svelte-vscode"] -} diff --git a/cozo_webui/README.md b/cozo_webui/README.md deleted file mode 100644 index 50ea7ed3..00000000 --- a/cozo_webui/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Svelte + Vite - -This template should help get you started developing with Svelte in Vite. - -## Recommended IDE Setup - -[VS Code](https://code.visualstudio.com/) + [Svelte](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode). - -## Need an official Svelte framework? - -Check out [SvelteKit](https://github.com/sveltejs/kit#readme), which is also powered by Vite. Deploy anywhere with its serverless-first approach and adapt to various platforms, with out of the box support for TypeScript, SCSS, and Less, and easily-added support for mdsvex, GraphQL, PostCSS, Tailwind CSS, and more. - -## Technical considerations - -**Why use this over SvelteKit?** - -- It brings its own routing solution which might not be preferable for some users. -- It is first and foremost a framework that just happens to use Vite under the hood, not a Vite app. - `vite dev` and `vite build` wouldn't work in a SvelteKit environment, for example. - -This template contains as little as possible to get started with Vite + Svelte, while taking into account the developer experience with regards to HMR and intellisense. It demonstrates capabilities on par with the other `create-vite` templates and is a good starting point for beginners dipping their toes into a Vite + Svelte project. - -Should you later need the extended capabilities and extensibility provided by SvelteKit, the template has been structured similarly to SvelteKit so that it is easy to migrate. - -**Why `global.d.ts` instead of `compilerOptions.types` inside `jsconfig.json` or `tsconfig.json`?** - -Setting `compilerOptions.types` shuts out all other types not explicitly listed in the configuration. Using triple-slash references keeps the default TypeScript setting of accepting type information from the entire workspace, while also adding `svelte` and `vite/client` type information. - -**Why include `.vscode/extensions.json`?** - -Other templates indirectly recommend extensions via the README, but this file allows VS Code to prompt the user to install the recommended extension upon opening the project. - -**Why enable `checkJs` in the JS template?** - -It is likely that most cases of changing variable types in runtime are likely to be accidental, rather than deliberate. This provides advanced typechecking out of the box. Should you like to take advantage of the dynamically-typed nature of JavaScript, it is trivial to change the configuration. - -**Why is HMR not preserving my local component state?** - -HMR state preservation comes with a number of gotchas! It has been disabled by default in both `svelte-hmr` and `@sveltejs/vite-plugin-svelte` due to its often surprising behavior. You can read the details [here](https://github.com/rixo/svelte-hmr#svelte-hmr). - -If you have state that's important to retain within a component, consider creating an external store which would not be replaced by HMR. - -```js -// store.js -// An extremely simple external store -import { writable } from 'svelte/store' -export default writable(0) -``` diff --git a/cozo_webui/index.html b/cozo_webui/index.html deleted file mode 100644 index 26c29c45..00000000 --- a/cozo_webui/index.html +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - Vite + Svelte - - -
- - - diff --git a/cozo_webui/jsconfig.json b/cozo_webui/jsconfig.json deleted file mode 100644 index ee5e92f2..00000000 --- a/cozo_webui/jsconfig.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "compilerOptions": { - "moduleResolution": "Node", - "target": "ESNext", - "module": "ESNext", - /** - * svelte-preprocess cannot figure out whether you have - * a value or a type, so tell TypeScript to enforce using - * `import type` instead of `import` for Types. - */ - "importsNotUsedAsValues": "error", - "isolatedModules": true, - "resolveJsonModule": true, - /** - * To have warnings / errors of the Svelte compiler at the - * correct position, enable source maps by default. - */ - "sourceMap": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "baseUrl": ".", - /** - * Typecheck JS in `.svelte` and `.js` files by default. - * Disable this if you'd like to use dynamic types. - */ - "checkJs": true - }, - /** - * Use global.d.ts instead of compilerOptions.types - * to avoid limiting type declarations. - */ - "include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.svelte"] -} diff --git a/cozo_webui/package.json b/cozo_webui/package.json deleted file mode 100644 index a1e81bd3..00000000 --- a/cozo_webui/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "cozo_webui", - "private": true, - "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview" - }, - "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^1.0.1", - "carbon-components-svelte": "^0.70.1", - "carbon-icons-svelte": "^11.2.0", - "svelte": "^3.49.0", - "vite": "^3.0.7" - } -} diff --git a/cozo_webui/public/vite.svg b/cozo_webui/public/vite.svg deleted file mode 100644 index e7b8dfb1..00000000 --- a/cozo_webui/public/vite.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/cozo_webui/src/App.svelte b/cozo_webui/src/App.svelte deleted file mode 100644 index 23d6b314..00000000 --- a/cozo_webui/src/App.svelte +++ /dev/null @@ -1,133 +0,0 @@ - - -
-
-
- -
-
- {#if inProgress} - - {:else if statusMessage} - - {/if} -
-
- -
-
- -
- {#if errorMessage} -
{errorMessage}
- {/if} - {#if queryResults} - {#if queryResults.headers && queryResults.rows} - - {:else} -
{JSON.stringify(queryResults, null, 2)}
- {/if} - {/if} - -
-
- - \ No newline at end of file diff --git a/cozo_webui/src/app.css b/cozo_webui/src/app.css deleted file mode 100644 index e69de29b..00000000 diff --git a/cozo_webui/src/assets/svelte.svg b/cozo_webui/src/assets/svelte.svg deleted file mode 100644 index c5e08481..00000000 --- a/cozo_webui/src/assets/svelte.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/cozo_webui/src/lib/Counter.svelte b/cozo_webui/src/lib/Counter.svelte deleted file mode 100644 index e45f9031..00000000 --- a/cozo_webui/src/lib/Counter.svelte +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/cozo_webui/src/main.js b/cozo_webui/src/main.js deleted file mode 100644 index 26f9393d..00000000 --- a/cozo_webui/src/main.js +++ /dev/null @@ -1,8 +0,0 @@ -import "carbon-components-svelte/css/white.css"; -import App from './App.svelte' - -const app = new App({ - target: document.getElementById('app') -}) - -export default app diff --git a/cozo_webui/src/vite-env.d.ts b/cozo_webui/src/vite-env.d.ts deleted file mode 100644 index 4078e747..00000000 --- a/cozo_webui/src/vite-env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/cozo_webui/vite.config.js b/cozo_webui/vite.config.js deleted file mode 100644 index 401b4d4b..00000000 --- a/cozo_webui/vite.config.js +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import { svelte } from '@sveltejs/vite-plugin-svelte' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [svelte()] -}) diff --git a/cozo_webui/yarn.lock b/cozo_webui/yarn.lock deleted file mode 100644 index bb570e11..00000000 --- a/cozo_webui/yarn.lock +++ /dev/null @@ -1,312 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@esbuild/linux-loong64@0.14.54": - version "0.14.54" - resolved "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.14.54.tgz#de2a4be678bd4d0d1ffbb86e6de779cde5999028" - integrity sha512-bZBrLAIX1kpWelV0XemxBZllyRmM6vgFQQG2GdNb+r3Fkp0FOh1NJSvekXDs7jq70k4euu1cryLMfU+mTXlEpw== - -"@rollup/pluginutils@^4.2.1": - version "4.2.1" - resolved "https://registry.npmmirror.com/@rollup/pluginutils/-/pluginutils-4.2.1.tgz#e6c6c3aba0744edce3fb2074922d3776c0af2a6d" - integrity sha512-iKnFXr7NkdZAIHiIWE+BX5ULi/ucVFYWD6TbAV+rZctiRTY2PL6tsIKhoIOaoskiWAkgu+VsbXgUVDNLHf+InQ== - dependencies: - estree-walker "^2.0.1" - picomatch "^2.2.2" - -"@sveltejs/vite-plugin-svelte@^1.0.1": - version "1.0.2" - resolved "https://registry.npmmirror.com/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.0.2.tgz#d9997e9f1aeca7b5f72634e774c4f0c7207134b3" - integrity sha512-8tTVbNuraeDchBaArNbwaZLpO0feM7BRSdZU5yeM4Clasx2p1p1CYBoWh+VgxZlxiark49HXummkHqKztbl8lA== - dependencies: - "@rollup/pluginutils" "^4.2.1" - debug "^4.3.4" - deepmerge "^4.2.2" - kleur "^4.1.5" - magic-string "^0.26.2" - svelte-hmr "^0.14.12" - -carbon-components-svelte@^0.70.1: - version "0.70.1" - resolved "https://registry.npmmirror.com/carbon-components-svelte/-/carbon-components-svelte-0.70.1.tgz#893090e3d3f43d3481812a0e007d44836ba2665c" - integrity sha512-9uZo1RexGcnMhzom62Kh6zsLZ24nc0eHnT4uNYRyDvi9OqMIiUvzb/p5ytCO9UwIrDJnUqiRQvV2woJO9PirhA== - dependencies: - flatpickr "4.6.9" - -carbon-icons-svelte@^11.2.0: - version "11.2.0" - resolved "https://registry.npmmirror.com/carbon-icons-svelte/-/carbon-icons-svelte-11.2.0.tgz#4b791c5cdb9b3b8b52758475a5b2e4ca96062639" - integrity sha512-nbqCEKoZA5EzT2Lr8vNYnfWcDl5GnFFLnbD861U32g9cNe7D7nmQKx4T+goFp5AoY60OyAgKUNJov8LwNEkhbg== - -debug@^4.3.4: - version "4.3.4" - resolved "https://registry.npmmirror.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" - integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== - dependencies: - ms "2.1.2" - -deepmerge@^4.2.2: - version "4.2.2" - resolved "https://registry.npmmirror.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" - integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== - -esbuild-android-64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-android-64/-/esbuild-android-64-0.14.54.tgz#505f41832884313bbaffb27704b8bcaa2d8616be" - integrity sha512-Tz2++Aqqz0rJ7kYBfz+iqyE3QMycD4vk7LBRyWaAVFgFtQ/O8EJOnVmTOiDWYZ/uYzB4kvP+bqejYdVKzE5lAQ== - -esbuild-android-arm64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.54.tgz#8ce69d7caba49646e009968fe5754a21a9871771" - integrity sha512-F9E+/QDi9sSkLaClO8SOV6etqPd+5DgJje1F9lOWoNncDdOBL2YF59IhsWATSt0TLZbYCf3pNlTHvVV5VfHdvg== - -esbuild-darwin-64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.54.tgz#24ba67b9a8cb890a3c08d9018f887cc221cdda25" - integrity sha512-jtdKWV3nBviOd5v4hOpkVmpxsBy90CGzebpbO9beiqUYVMBtSc0AL9zGftFuBon7PNDcdvNCEuQqw2x0wP9yug== - -esbuild-darwin-arm64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.54.tgz#3f7cdb78888ee05e488d250a2bdaab1fa671bf73" - integrity sha512-OPafJHD2oUPyvJMrsCvDGkRrVCar5aVyHfWGQzY1dWnzErjrDuSETxwA2HSsyg2jORLY8yBfzc1MIpUkXlctmw== - -esbuild-freebsd-64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.54.tgz#09250f997a56ed4650f3e1979c905ffc40bbe94d" - integrity sha512-OKwd4gmwHqOTp4mOGZKe/XUlbDJ4Q9TjX0hMPIDBUWWu/kwhBAudJdBoxnjNf9ocIB6GN6CPowYpR/hRCbSYAg== - -esbuild-freebsd-arm64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.54.tgz#bafb46ed04fc5f97cbdb016d86947a79579f8e48" - integrity sha512-sFwueGr7OvIFiQT6WeG0jRLjkjdqWWSrfbVwZp8iMP+8UHEHRBvlaxL6IuKNDwAozNUmbb8nIMXa7oAOARGs1Q== - -esbuild-linux-32@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-linux-32/-/esbuild-linux-32-0.14.54.tgz#e2a8c4a8efdc355405325033fcebeb941f781fe5" - integrity sha512-1ZuY+JDI//WmklKlBgJnglpUL1owm2OX+8E1syCD6UAxcMM/XoWd76OHSjl/0MR0LisSAXDqgjT3uJqT67O3qw== - -esbuild-linux-64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-linux-64/-/esbuild-linux-64-0.14.54.tgz#de5fdba1c95666cf72369f52b40b03be71226652" - integrity sha512-EgjAgH5HwTbtNsTqQOXWApBaPVdDn7XcK+/PtJwZLT1UmpLoznPd8c5CxqsH2dQK3j05YsB3L17T8vE7cp4cCg== - -esbuild-linux-arm64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.54.tgz#dae4cd42ae9787468b6a5c158da4c84e83b0ce8b" - integrity sha512-WL71L+0Rwv+Gv/HTmxTEmpv0UgmxYa5ftZILVi2QmZBgX3q7+tDeOQNqGtdXSdsL8TQi1vIaVFHUPDe0O0kdig== - -esbuild-linux-arm@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.54.tgz#a2c1dff6d0f21dbe8fc6998a122675533ddfcd59" - integrity sha512-qqz/SjemQhVMTnvcLGoLOdFpCYbz4v4fUo+TfsWG+1aOu70/80RV6bgNpR2JCrppV2moUQkww+6bWxXRL9YMGw== - -esbuild-linux-mips64le@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.54.tgz#d9918e9e4cb972f8d6dae8e8655bf9ee131eda34" - integrity sha512-qTHGQB8D1etd0u1+sB6p0ikLKRVuCWhYQhAHRPkO+OF3I/iSlTKNNS0Lh2Oc0g0UFGguaFZZiPJdJey3AGpAlw== - -esbuild-linux-ppc64le@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.54.tgz#3f9a0f6d41073fb1a640680845c7de52995f137e" - integrity sha512-j3OMlzHiqwZBDPRCDFKcx595XVfOfOnv68Ax3U4UKZ3MTYQB5Yz3X1mn5GnodEVYzhtZgxEBidLWeIs8FDSfrQ== - -esbuild-linux-riscv64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.54.tgz#618853c028178a61837bc799d2013d4695e451c8" - integrity sha512-y7Vt7Wl9dkOGZjxQZnDAqqn+XOqFD7IMWiewY5SPlNlzMX39ocPQlOaoxvT4FllA5viyV26/QzHtvTjVNOxHZg== - -esbuild-linux-s390x@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.54.tgz#d1885c4c5a76bbb5a0fe182e2c8c60eb9e29f2a6" - integrity sha512-zaHpW9dziAsi7lRcyV4r8dhfG1qBidQWUXweUjnw+lliChJqQr+6XD71K41oEIC3Mx1KStovEmlzm+MkGZHnHA== - -esbuild-netbsd-64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.54.tgz#69ae917a2ff241b7df1dbf22baf04bd330349e81" - integrity sha512-PR01lmIMnfJTgeU9VJTDY9ZerDWVFIUzAtJuDHwwceppW7cQWjBBqP48NdeRtoP04/AtO9a7w3viI+PIDr6d+w== - -esbuild-openbsd-64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.54.tgz#db4c8495287a350a6790de22edea247a57c5d47b" - integrity sha512-Qyk7ikT2o7Wu76UsvvDS5q0amJvmRzDyVlL0qf5VLsLchjCa1+IAvd8kTBgUxD7VBUUVgItLkk609ZHUc1oCaw== - -esbuild-sunos-64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.54.tgz#54287ee3da73d3844b721c21bc80c1dc7e1bf7da" - integrity sha512-28GZ24KmMSeKi5ueWzMcco6EBHStL3B6ubM7M51RmPwXQGLe0teBGJocmWhgwccA1GeFXqxzILIxXpHbl9Q/Kw== - -esbuild-windows-32@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-windows-32/-/esbuild-windows-32-0.14.54.tgz#f8aaf9a5667630b40f0fb3aa37bf01bbd340ce31" - integrity sha512-T+rdZW19ql9MjS7pixmZYVObd9G7kcaZo+sETqNH4RCkuuYSuv9AGHUVnPoP9hhuE1WM1ZimHz1CIBHBboLU7w== - -esbuild-windows-64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-windows-64/-/esbuild-windows-64-0.14.54.tgz#bf54b51bd3e9b0f1886ffdb224a4176031ea0af4" - integrity sha512-AoHTRBUuYwXtZhjXZbA1pGfTo8cJo3vZIcWGLiUcTNgHpJJMC1rVA44ZereBHMJtotyN71S8Qw0npiCIkW96cQ== - -esbuild-windows-arm64@0.14.54: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.54.tgz#937d15675a15e4b0e4fafdbaa3a01a776a2be982" - integrity sha512-M0kuUvXhot1zOISQGXwWn6YtS+Y/1RT9WrVIOywZnJHo3jCDyewAc79aKNQWFCQm+xNHVTq9h8dZKvygoXQQRg== - -esbuild@^0.14.47: - version "0.14.54" - resolved "https://registry.npmmirror.com/esbuild/-/esbuild-0.14.54.tgz#8b44dcf2b0f1a66fc22459943dccf477535e9aa2" - integrity sha512-Cy9llcy8DvET5uznocPyqL3BFRrFXSVqbgpMJ9Wz8oVjZlh/zUSNbPRbov0VX7VxN2JH1Oa0uNxZ7eLRb62pJA== - optionalDependencies: - "@esbuild/linux-loong64" "0.14.54" - esbuild-android-64 "0.14.54" - esbuild-android-arm64 "0.14.54" - esbuild-darwin-64 "0.14.54" - esbuild-darwin-arm64 "0.14.54" - esbuild-freebsd-64 "0.14.54" - esbuild-freebsd-arm64 "0.14.54" - esbuild-linux-32 "0.14.54" - esbuild-linux-64 "0.14.54" - esbuild-linux-arm "0.14.54" - esbuild-linux-arm64 "0.14.54" - esbuild-linux-mips64le "0.14.54" - esbuild-linux-ppc64le "0.14.54" - esbuild-linux-riscv64 "0.14.54" - esbuild-linux-s390x "0.14.54" - esbuild-netbsd-64 "0.14.54" - esbuild-openbsd-64 "0.14.54" - esbuild-sunos-64 "0.14.54" - esbuild-windows-32 "0.14.54" - esbuild-windows-64 "0.14.54" - esbuild-windows-arm64 "0.14.54" - -estree-walker@^2.0.1: - version "2.0.2" - resolved "https://registry.npmmirror.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" - integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== - -flatpickr@4.6.9: - version "4.6.9" - resolved "https://registry.npmmirror.com/flatpickr/-/flatpickr-4.6.9.tgz#9a13383e8a6814bda5d232eae3fcdccb97dc1499" - integrity sha512-F0azNNi8foVWKSF+8X+ZJzz8r9sE1G4hl06RyceIaLvyltKvDl6vqk9Lm/6AUUCi5HWaIjiUbk7UpeE/fOXOpw== - -fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== - -has@^1.0.3: - version "1.0.3" - resolved "https://registry.npmmirror.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== - dependencies: - function-bind "^1.1.1" - -is-core-module@^2.9.0: - version "2.10.0" - resolved "https://registry.npmmirror.com/is-core-module/-/is-core-module-2.10.0.tgz#9012ede0a91c69587e647514e1d5277019e728ed" - integrity sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg== - dependencies: - has "^1.0.3" - -kleur@^4.1.5: - version "4.1.5" - resolved "https://registry.npmmirror.com/kleur/-/kleur-4.1.5.tgz#95106101795f7050c6c650f350c683febddb1780" - integrity sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ== - -magic-string@^0.26.2: - version "0.26.2" - resolved "https://registry.npmmirror.com/magic-string/-/magic-string-0.26.2.tgz#5331700e4158cd6befda738bb6b0c7b93c0d4432" - integrity sha512-NzzlXpclt5zAbmo6h6jNc8zl2gNRGHvmsZW4IvZhTC4W7k4OlLP+S5YLussa/r3ixNT66KOQfNORlXHSOy/X4A== - dependencies: - sourcemap-codec "^1.4.8" - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.npmmirror.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -nanoid@^3.3.4: - version "3.3.4" - resolved "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" - integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw== - -path-parse@^1.0.7: - version "1.0.7" - resolved "https://registry.npmmirror.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -picocolors@^1.0.0: - version "1.0.0" - resolved "https://registry.npmmirror.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" - integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== - -picomatch@^2.2.2: - version "2.3.1" - resolved "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -postcss@^8.4.16: - version "8.4.16" - resolved "https://registry.npmmirror.com/postcss/-/postcss-8.4.16.tgz#33a1d675fac39941f5f445db0de4db2b6e01d43c" - integrity sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ== - dependencies: - nanoid "^3.3.4" - picocolors "^1.0.0" - source-map-js "^1.0.2" - -resolve@^1.22.1: - version "1.22.1" - resolved "https://registry.npmmirror.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" - integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== - dependencies: - is-core-module "^2.9.0" - path-parse "^1.0.7" - supports-preserve-symlinks-flag "^1.0.0" - -"rollup@>=2.75.6 <2.77.0 || ~2.77.0": - version "2.77.3" - resolved "https://registry.npmmirror.com/rollup/-/rollup-2.77.3.tgz#8f00418d3a2740036e15deb653bed1a90ee0cc12" - integrity sha512-/qxNTG7FbmefJWoeeYJFbHehJ2HNWnjkAFRKzWN/45eNBBF/r8lo992CwcJXEzyVxs5FmfId+vTSTQDb+bxA+g== - optionalDependencies: - fsevents "~2.3.2" - -source-map-js@^1.0.2: - version "1.0.2" - resolved "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" - integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== - -sourcemap-codec@^1.4.8: - version "1.4.8" - resolved "https://registry.npmmirror.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" - integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== - -supports-preserve-symlinks-flag@^1.0.0: - version "1.0.0" - resolved "https://registry.npmmirror.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" - integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== - -svelte-hmr@^0.14.12: - version "0.14.12" - resolved "https://registry.npmmirror.com/svelte-hmr/-/svelte-hmr-0.14.12.tgz#a127aec02f1896500b10148b2d4d21ddde39973f" - integrity sha512-4QSW/VvXuqVcFZ+RhxiR8/newmwOCTlbYIezvkeN6302YFRE8cXy0naamHcjz8Y9Ce3ITTZtrHrIL0AGfyo61w== - -svelte@^3.49.0: - version "3.49.0" - resolved "https://registry.npmmirror.com/svelte/-/svelte-3.49.0.tgz#5baee3c672306de1070c3b7888fc2204e36a4029" - integrity sha512-+lmjic1pApJWDfPCpUUTc1m8azDqYCG1JN9YEngrx/hUyIcFJo6VZhj0A1Ai0wqoHcEIuQy+e9tk+4uDgdtsFA== - -vite@^3.0.7: - version "3.0.9" - resolved "https://registry.npmmirror.com/vite/-/vite-3.0.9.tgz#45fac22c2a5290a970f23d66c1aef56a04be8a30" - integrity sha512-waYABTM+G6DBTCpYAxvevpG50UOlZuynR0ckTK5PawNVt7ebX6X7wNXHaGIO6wYYFXSM7/WcuFuO2QzhBB6aMw== - dependencies: - esbuild "^0.14.47" - postcss "^8.4.16" - resolve "^1.22.1" - rollup ">=2.75.6 <2.77.0 || ~2.77.0" - optionalDependencies: - fsevents "~2.3.2" diff --git a/cozohttp/build.rs b/cozohttp/build.rs index d55a88de..19ce7fc6 100644 --- a/cozohttp/build.rs +++ b/cozohttp/build.rs @@ -1,6 +1,6 @@ use static_files::resource_dir; fn main() -> std::io::Result<()> { - println!("cargo:rerun-if-changed=../cozo_webui/src/App.svelte"); - resource_dir("../cozo_webui/dist").build() + println!("cargo:rerun-if-changed=../cozowebui/build/asset-manifest.json"); + resource_dir("../cozowebui/build").build() } diff --git a/cozowebui/.gitignore b/cozowebui/.gitignore new file mode 100644 index 00000000..4d29575d --- /dev/null +++ b/cozowebui/.gitignore @@ -0,0 +1,23 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* diff --git a/cozowebui/README.md b/cozowebui/README.md new file mode 100644 index 00000000..58beeacc --- /dev/null +++ b/cozowebui/README.md @@ -0,0 +1,70 @@ +# Getting Started with Create React App + +This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). + +## Available Scripts + +In the project directory, you can run: + +### `npm start` + +Runs the app in the development mode.\ +Open [http://localhost:3000](http://localhost:3000) to view it in your browser. + +The page will reload when you make changes.\ +You may also see any lint errors in the console. + +### `npm test` + +Launches the test runner in the interactive watch mode.\ +See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. + +### `npm run build` + +Builds the app for production to the `build` folder.\ +It correctly bundles React in production mode and optimizes the build for the best performance. + +The build is minified and the filenames include the hashes.\ +Your app is ready to be deployed! + +See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. + +### `npm run eject` + +**Note: this is a one-way operation. Once you `eject`, you can't go back!** + +If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. + +Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. + +You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. + +## Learn More + +You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). + +To learn React, check out the [React documentation](https://reactjs.org/). + +### Code Splitting + +This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) + +### Analyzing the Bundle Size + +This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) + +### Making a Progressive Web App + +This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) + +### Advanced Configuration + +This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) + +### Deployment + +This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) + +### `npm run build` fails to minify + +This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) diff --git a/cozowebui/package.json b/cozowebui/package.json new file mode 100644 index 00000000..fa76e9fa --- /dev/null +++ b/cozowebui/package.json @@ -0,0 +1,40 @@ +{ + "name": "cozowebui", + "version": "0.1.0", + "private": true, + "dependencies": { + "@blueprintjs/core": "^4.9.3", + "@blueprintjs/table": "^4.6.4", + "@testing-library/jest-dom": "^5.16.5", + "@testing-library/react": "^13.3.0", + "@testing-library/user-event": "^13.5.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-scripts": "5.0.1", + "web-vitals": "^2.1.4" + }, + "scripts": { + "start": "react-scripts start", + "build": "react-scripts build", + "test": "react-scripts test", + "eject": "react-scripts eject" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/cozowebui/public/index.html b/cozowebui/public/index.html new file mode 100644 index 00000000..6ecca3d5 --- /dev/null +++ b/cozowebui/public/index.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + + Cozo WebUI + + + +
+ + + diff --git a/cozowebui/public/manifest.json b/cozowebui/public/manifest.json new file mode 100644 index 00000000..7e4a1f7a --- /dev/null +++ b/cozowebui/public/manifest.json @@ -0,0 +1,8 @@ +{ + "short_name": "CozoWebUI", + "name": "Cozo WebUI", + "start_url": ".", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/cozowebui/public/robots.txt b/cozowebui/public/robots.txt new file mode 100644 index 00000000..e9e57dc4 --- /dev/null +++ b/cozowebui/public/robots.txt @@ -0,0 +1,3 @@ +# https://www.robotstxt.org/robotstxt.html +User-agent: * +Disallow: diff --git a/cozowebui/src/App.css b/cozowebui/src/App.css new file mode 100644 index 00000000..2991797f --- /dev/null +++ b/cozowebui/src/App.css @@ -0,0 +1,15 @@ +@import "~normalize.css"; +@import "~@blueprintjs/core/lib/css/blueprint.css"; +@import "~@blueprintjs/icons/lib/css/blueprint-icons.css"; +@import "~@blueprintjs/table/lib/css/table.css"; + +#error-message, #other-results { + padding: 10px; + overflow: scroll; + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; +} + +#query-box { + font-family: Menlo, Monaco, Consolas, "Courier New", monospace; + font-size: 100%; +} \ No newline at end of file diff --git a/cozowebui/src/App.js b/cozowebui/src/App.js new file mode 100644 index 00000000..3fb5ea51 --- /dev/null +++ b/cozowebui/src/App.js @@ -0,0 +1,107 @@ +import {Button, Intent, Tag, TextArea} from "@blueprintjs/core"; +import React, {useState} from 'react'; +import './App.css'; +import {Cell, Column, Table2} from "@blueprintjs/table"; + +function App() { + const [queryText, setQueryText] = useState(''); + const [inProgress, setInProgress] = useState(false); + const [statusMessage, setStatusMessage] = useState(''); + const [errorMessage, setErrorMessage] = useState(''); + const [queryResults, setQueryResults] = useState(null); + + + function handleKeyDown(e) { + if (e.key === 'Enter' && e.shiftKey) { + e.preventDefault(); + e.stopPropagation(); + handleQuery(); + } + } + + const renderCell = (colIdx) => (rowIdx) => + {queryResults.rows[rowIdx][colIdx]} + + + async function handleQuery() { + const query = queryText.trim(); + if (query) { + let started = performance.now(); + setInProgress(true); + setErrorMessage(''); + setStatusMessage(''); + setQueryResults(null); + try { + const response = await fetch('/text-query', { + method: 'POST', + body: query + }); + + if (!response.ok) { + throw await response.text(); + } + let res = await response.json(); + if (res.rows) { + setStatusMessage(`finished ${res.rows.length} rows in ${res.time_taken}ms`); + if (!res.headers) { + res.headers = []; + if (res.rows.length) { + for (let i = 0; i < res.rows[0].length; i++) { + res.headers.push('?' + i); + } + } + } + } else { + setStatusMessage(`finished in ${res.time_taken}ms`); + } + setQueryResults(res); + } catch (e) { + let time = Math.round(performance.now() - started); + setStatusMessage(`finished in ${time}ms`); + setErrorMessage('' + e); + } finally { + setInProgress(false); + } + } + } + + return ( +
+
+