From 6db9469d8e2745d155884308057d41dfca7a627e Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Wed, 7 Feb 2024 11:48:25 -0600 Subject: [PATCH] update --- biome.json | 13 +++ package.json | 11 +-- pnpm-lock.yaml | 123 ++++++++++++++++++++++++++++- src-tauri/src/lib.rs | 9 +++ src/App.css | 7 -- src/App.module.scss | 6 ++ src/App.tsx | 47 ++--------- src/components/NodeContainer.tsx | 3 + src/components/Sidebar.module.scss | 7 ++ src/components/Sidebar.tsx | 9 +++ src/index.tsx | 2 +- src/styles.css | 109 ------------------------- src/styles.scss | 23 ++++++ 13 files changed, 202 insertions(+), 167 deletions(-) create mode 100644 biome.json delete mode 100644 src/App.css create mode 100644 src/App.module.scss create mode 100644 src/components/NodeContainer.tsx create mode 100644 src/components/Sidebar.module.scss create mode 100644 src/components/Sidebar.tsx delete mode 100644 src/styles.css create mode 100644 src/styles.scss diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..e068b7c --- /dev/null +++ b/biome.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.4.1/schema.json", + "organizeImports": { + "enabled": true + }, + "formatter": { "indentWidth": 2, "indentStyle": "space" }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + } +} diff --git a/package.json b/package.json index 9eab0d2..80251c2 100644 --- a/package.json +++ b/package.json @@ -12,15 +12,16 @@ }, "license": "MIT", "dependencies": { - "solid-js": "^1.7.8", "@tauri-apps/api": "^2.0.0-alpha.11", - "@tauri-apps/plugin-shell": "^2.0.0-alpha.3" + "@tauri-apps/plugin-shell": "^2.0.0-alpha.3", + "solid-js": "^1.7.8" }, "devDependencies": { + "@tauri-apps/cli": "^2.0.0-alpha.17", + "internal-ip": "^7.0.0", + "sass": "^1.70.0", "typescript": "^5.0.2", "vite": "^4.4.4", - "vite-plugin-solid": "^2.7.0", - "@tauri-apps/cli": "^2.0.0-alpha.17", - "internal-ip": "^7.0.0" + "vite-plugin-solid": "^2.7.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a14a2f4..bddf4eb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,12 +22,15 @@ devDependencies: internal-ip: specifier: ^7.0.0 version: 7.0.0 + sass: + specifier: ^1.70.0 + version: 1.70.0 typescript: specifier: ^5.0.2 version: 5.2.2 vite: specifier: ^4.4.4 - version: 4.5.0 + version: 4.5.0(sass@1.70.0) vite-plugin-solid: specifier: ^2.7.0 version: 2.7.2(solid-js@1.8.5)(vite@4.5.0) @@ -744,6 +747,14 @@ packages: color-convert: 1.9.3 dev: true + /anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + dev: true + /babel-plugin-jsx-dom-expressions@0.37.8(@babel/core@7.23.3): resolution: {integrity: sha512-nVHH6g7541aaAQJAsyWHvjH7GCXZ+8tuF3Qu4y9W9aKwonRbcJL+yyMatDJLvjC54iIuGowiiZM6Rm3AVJczGg==} peerDependencies: @@ -766,6 +777,18 @@ packages: babel-plugin-jsx-dom-expressions: 0.37.8(@babel/core@7.23.3) dev: true + /binary-extensions@2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + + /braces@3.0.2: + resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} + engines: {node: '>=8'} + dependencies: + fill-range: 7.0.1 + dev: true + /browserslist@4.22.1: resolution: {integrity: sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} @@ -790,6 +813,21 @@ packages: supports-color: 5.5.0 dev: true + /chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + dev: true + /color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: @@ -894,6 +932,13 @@ packages: strip-final-newline: 2.0.0 dev: true + /fill-range@7.0.1: + resolution: {integrity: sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==} + engines: {node: '>=8'} + dependencies: + to-regex-range: 5.0.1 + dev: true + /fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -912,6 +957,13 @@ packages: engines: {node: '>=10'} dev: true + /glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + dependencies: + is-glob: 4.0.3 + dev: true + /globals@11.12.0: resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} engines: {node: '>=4'} @@ -931,6 +983,10 @@ packages: engines: {node: '>=10.17.0'} dev: true + /immutable@4.3.5: + resolution: {integrity: sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw==} + dev: true + /internal-ip@7.0.0: resolution: {integrity: sha512-qE4TeD4brqC45Vq/+VASeMiS1KRyfBkR6HT2sh9pZVVCzSjPkaCEfKFU+dL0PRv7NHJtvoKN2r82G6wTfzorkw==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -951,6 +1007,25 @@ packages: engines: {node: '>= 10'} dev: true + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + + /is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + dev: true + + /is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + dependencies: + is-extglob: 2.1.1 + dev: true + /is-ip@3.1.0: resolution: {integrity: sha512-35vd5necO7IitFPjd/YBeqwWnyDWbuLH9ZXQdMfDA8TEo7pv5X8yfrvVO3xbJbLUlERCMvf6X0hTUamQxCYJ9Q==} engines: {node: '>=8'} @@ -958,6 +1033,11 @@ packages: ip-regex: 4.3.0 dev: true + /is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + dev: true + /is-stream@2.0.1: resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} engines: {node: '>=8'} @@ -1024,6 +1104,11 @@ packages: resolution: {integrity: sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==} dev: true + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true + /npm-run-path@4.0.1: resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} engines: {node: '>=8'} @@ -1066,6 +1151,11 @@ packages: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} dev: true + /picomatch@2.3.1: + resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} + engines: {node: '>=8.6'} + dev: true + /postcss@8.4.31: resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} engines: {node: ^10 || ^12 || >=14} @@ -1075,6 +1165,13 @@ packages: source-map-js: 1.0.2 dev: true + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + /rollup@3.29.4: resolution: {integrity: sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==} engines: {node: '>=14.18.0', npm: '>=8.0.0'} @@ -1083,6 +1180,16 @@ packages: fsevents: 2.3.3 dev: true + /sass@1.70.0: + resolution: {integrity: sha512-uUxNQ3zAHeAx5nRFskBnrWzDUJrrvpCPD5FNAoRvTi0WwremlheES3tg+56PaVtCs5QDRX5CBLxxKMDJMEa1WQ==} + engines: {node: '>=14.0.0'} + hasBin: true + dependencies: + chokidar: 3.6.0 + immutable: 4.3.5 + source-map-js: 1.0.2 + dev: true + /semver@6.3.1: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true @@ -1147,6 +1254,13 @@ packages: engines: {node: '>=4'} dev: true + /to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + dependencies: + is-number: 7.0.0 + dev: true + /typescript@5.2.2: resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} engines: {node: '>=14.17'} @@ -1181,13 +1295,13 @@ packages: merge-anything: 5.1.7 solid-js: 1.8.5 solid-refresh: 0.5.3(solid-js@1.8.5) - vite: 4.5.0 + vite: 4.5.0(sass@1.70.0) vitefu: 0.2.5(vite@4.5.0) transitivePeerDependencies: - supports-color dev: true - /vite@4.5.0: + /vite@4.5.0(sass@1.70.0): resolution: {integrity: sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -1218,6 +1332,7 @@ packages: esbuild: 0.18.20 postcss: 8.4.31 rollup: 3.29.4 + sass: 1.70.0 optionalDependencies: fsevents: 2.3.3 dev: true @@ -1230,7 +1345,7 @@ packages: vite: optional: true dependencies: - vite: 4.5.0 + vite: 4.5.0(sass@1.70.0) dev: true /which@2.0.2: diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 5f48bdb..d03af91 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,3 +1,5 @@ +use cozo::{DbInstance, ScriptMutability}; + // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command #[tauri::command] fn greet(name: &str) -> String { @@ -6,6 +8,13 @@ fn greet(name: &str) -> String { #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { + let db = DbInstance::new("mem", "", Default::default()).unwrap(); + let script = "?[a] := a in [1, 2, 3]"; + let result = db + .run_script(script, Default::default(), ScriptMutability::Immutable) + .unwrap(); + println!("{:?}", result); + tauri::Builder::default() .plugin(tauri_plugin_window::init()) .plugin(tauri_plugin_shell::init()) diff --git a/src/App.css b/src/App.css deleted file mode 100644 index 46d328a..0000000 --- a/src/App.css +++ /dev/null @@ -1,7 +0,0 @@ -.logo.vite:hover { - filter: drop-shadow(0 0 2em #747bff); -} - -.logo.solid:hover { - filter: drop-shadow(0 0 2em #2f5d90); -} diff --git a/src/App.module.scss b/src/App.module.scss new file mode 100644 index 0000000..9e1c6d7 --- /dev/null +++ b/src/App.module.scss @@ -0,0 +1,6 @@ +.container { + display: flex; + flex-direction: column; + + align-items: stretch; +} diff --git a/src/App.tsx b/src/App.tsx index 0f0d84d..0f3509c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,47 +1,12 @@ -import { createSignal } from "solid-js"; -import { invoke } from "@tauri-apps/api/primitives"; -import "./App.css"; +import NodeContainer from "./components/NodeContainer"; +import Sidebar from "./components/Sidebar"; +import styles from "./App.module.scss"; function App() { - const [greetMsg, setGreetMsg] = createSignal(""); - const [name, setName] = createSignal(""); - - async function greet() { - // Learn more about Tauri commands at https://tauri.app/v1/guides/features/command - setGreetMsg(await invoke("greet", { name: name() })); - } - return ( -
-

Welcome to Tauri!

- - - -

Click on the Tauri, Vite, and Solid logos to learn more.

- -
{ - e.preventDefault(); - greet(); - }} - > - setName(e.currentTarget.value)} - placeholder="Enter a name..." - /> - -
- -

{greetMsg()}

+
+ +
); } diff --git a/src/components/NodeContainer.tsx b/src/components/NodeContainer.tsx new file mode 100644 index 0000000..4f3f573 --- /dev/null +++ b/src/components/NodeContainer.tsx @@ -0,0 +1,3 @@ +export default function NodeContainer({}) { + return <>; +} diff --git a/src/components/Sidebar.module.scss b/src/components/Sidebar.module.scss new file mode 100644 index 0000000..6eb0645 --- /dev/null +++ b/src/components/Sidebar.module.scss @@ -0,0 +1,7 @@ +.sidebar { + background-color: #ccffcc; + display: flex; + flex-grow: 1; + + width: 18rem; +} diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx new file mode 100644 index 0000000..26fc076 --- /dev/null +++ b/src/components/Sidebar.tsx @@ -0,0 +1,9 @@ +import styles from "./Sidebar.module.scss"; + +export default function Sidebar() { + return ( +
+

Panorama

+
+ ); +} diff --git a/src/index.tsx b/src/index.tsx index adf4f16..ff0c8d5 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,7 +1,7 @@ /* @refresh reload */ import { render } from "solid-js/web"; -import "./styles.css"; +import "./styles.scss"; import App from "./App"; render(() => , document.getElementById("root") as HTMLElement); diff --git a/src/styles.css b/src/styles.css deleted file mode 100644 index f7de85b..0000000 --- a/src/styles.css +++ /dev/null @@ -1,109 +0,0 @@ -:root { - font-family: Inter, Avenir, Helvetica, Arial, sans-serif; - font-size: 16px; - line-height: 24px; - font-weight: 400; - - color: #0f0f0f; - background-color: #f6f6f6; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - -webkit-text-size-adjust: 100%; -} - -.container { - margin: 0; - padding-top: 10vh; - display: flex; - flex-direction: column; - justify-content: center; - text-align: center; -} - -.logo { - height: 6em; - padding: 1.5em; - will-change: filter; - transition: 0.75s; -} - -.logo.tauri:hover { - filter: drop-shadow(0 0 2em #24c8db); -} - -.row { - display: flex; - justify-content: center; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} - -a:hover { - color: #535bf2; -} - -h1 { - text-align: center; -} - -input, -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - color: #0f0f0f; - background-color: #ffffff; - transition: border-color 0.25s; - box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2); -} - -button { - cursor: pointer; -} - -button:hover { - border-color: #396cd8; -} -button:active { - border-color: #396cd8; - background-color: #e8e8e8; -} - -input, -button { - outline: none; -} - -#greet-input { - margin-right: 5px; -} - -@media (prefers-color-scheme: dark) { - :root { - color: #f6f6f6; - background-color: #2f2f2f; - } - - a:hover { - color: #24c8db; - } - - input, - button { - color: #ffffff; - background-color: #0f0f0f98; - } - button:active { - background-color: #0f0f0f69; - } -} diff --git a/src/styles.scss b/src/styles.scss new file mode 100644 index 0000000..e050418 --- /dev/null +++ b/src/styles.scss @@ -0,0 +1,23 @@ +html, +body, +#root { + margin: 0; + padding: 0; + + display: flex; + width: 100%; + height: 100%; + + overflow: hidden; + + font-family: Arial, Helvetica, sans-serif; +} + +h1, +h2, +h3, +h4, +h5, +h6 { + margin: 0; +}