diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ca578b4..ac6bc54f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Major changes and resolved issues +## 2023-10-18 +- [App - Fix Spinner #273](https://github.com/Convex-Dev/convex-web/issues/273) +- Change sitemap layout +- [Update to Convex 0.7.12 when released #252](https://github.com/Convex-Dev/convex-web/issues/252) +- Update ShadowCLJS +- Update Radix UI Tooltip +- [Show docs for macros in Sandbox #221](https://github.com/Convex-Dev/convex-web/issues/221) +- Remove NEWS banner + ## 2023-09-11 - [Internal API - Get Accounts - Don't log/error #271](https://github.com/Convex-Dev/convex-web/issues/271) - [Code block missing content in Markdown #272](https://github.com/Convex-Dev/convex-web/issues/272) diff --git a/deps.edn b/deps.edn index 13561250..9f998e02 100644 --- a/deps.edn +++ b/deps.edn @@ -8,6 +8,8 @@ org.clojure/data.json {:mvn/version "2.4.0"} com.cognitect/transit-clj {:mvn/version "1.0.333"} com.cognitect/anomalies {:mvn/version "0.1.12"} + + world.convex/convex-peer {:mvn/version "0.7.12"} world.convex/net {:deps/root "module/net" :git/sha "7cd357f" @@ -95,7 +97,7 @@ ;; -- Site dev :site-dev {:extra-deps - {thheller/shadow-cljs {:mvn/version "2.25.3"} + {thheller/shadow-cljs {:mvn/version "2.25.7"} org.slf4j/slf4j-nop {:mvn/version "2.0.6"} binaryage/devtools {:mvn/version "1.0.7"} re-frisk/re-frisk {:mvn/version "1.6.0"}}} @@ -114,7 +116,7 @@ ;; -- Kaocha test runner :kaocha - {:extra-deps {lambdaisland/kaocha {:mvn/version "1.85.1342"}}} + {:extra-deps {lambdaisland/kaocha {:mvn/version "1.87.1366"}}} ;; -- Cognitect test runner @@ -152,7 +154,7 @@ ;; clj -M:outdated :outdated {:replace-deps - {com.github.liquidz/antq {:mvn/version "2.5.1095"} + {com.github.liquidz/antq {:mvn/version "2.7.1133"} org.slf4j/slf4j-nop {:mvn/version "1.7.32"}} :main-opts ["-m" "antq.core"]}}} diff --git a/package-lock.json b/package-lock.json index abac5e33..aa92517f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@headlessui/react": "^1.7.16", "@heroicons/react": "^1.0.5", - "@radix-ui/react-tooltip": "^1.0.6", + "@radix-ui/react-tooltip": "^1.0.7", "@types/react": "^17.0.33", "codemirror": "^5.65.14", "highlight.js": "^11.2.0", @@ -26,7 +26,7 @@ }, "devDependencies": { "@tailwindcss/typography": "^0.5.9", - "shadow-cljs": "^2.25.3", + "shadow-cljs": "^2.25.7", "tailwindcss": "^3.3.3" } }, @@ -54,28 +54,28 @@ } }, "node_modules/@floating-ui/core": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.4.1.tgz", - "integrity": "sha512-jk3WqquEJRlcyu7997NtR5PibI+y5bi+LS3hPmguVClypenMsCY3CBa3LAQnozRCtCrYWSEtAdiskpamuJRFOQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.5.0.tgz", + "integrity": "sha512-kK1h4m36DQ0UHGj5Ah4db7R0rHemTqqO0QLvUqi1/mUUp3LuAWbWxdxSIf/XsnH9VS6rRVPLJCncjRzUvyCLXg==", "dependencies": { - "@floating-ui/utils": "^0.1.1" + "@floating-ui/utils": "^0.1.3" } }, "node_modules/@floating-ui/dom": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.5.1.tgz", - "integrity": "sha512-KwvVcPSXg6mQygvA1TjbN/gh///36kKtllIF8SUm0qpFj8+rvYrpvlYdL1JoA71SHpDqgSSdGOSoQ0Mp3uY5aw==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.5.3.tgz", + "integrity": "sha512-ClAbQnEqJAKCJOEbbLo5IUlZHkNszqhuxS4fHAVxRPXPya6Ysf2G8KypnYcOTpx6I8xcgF9bbHb6g/2KpbV8qA==", "dependencies": { - "@floating-ui/core": "^1.4.1", - "@floating-ui/utils": "^0.1.1" + "@floating-ui/core": "^1.4.2", + "@floating-ui/utils": "^0.1.3" } }, "node_modules/@floating-ui/react-dom": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.1.tgz", - "integrity": "sha512-rZtAmSht4Lry6gdhAJDrCp/6rKN7++JnL1/Anbr/DdeyYXQPxvg/ivrbYvJulbRf4vL8b212suwMM2lxbv+RQA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.2.tgz", + "integrity": "sha512-5qhlDvjaLmAst/rKb3VdlCinwTF4EYMiVxuuc/HVUjs46W0zgtbMmAZ1UTsDrRTxRmUEzl92mOtWbeeXL26lSQ==", "dependencies": { - "@floating-ui/dom": "^1.3.0" + "@floating-ui/dom": "^1.5.1" }, "peerDependencies": { "react": ">=16.8.0", @@ -83,9 +83,9 @@ } }, "node_modules/@floating-ui/utils": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.1.tgz", - "integrity": "sha512-m0G6wlnhm/AX0H12IOWtK8gASEMffnX08RtKkCgTdHb9JpHKGloI7icFfLg9ZmQeavcvR0PKmzxClyuFPSjKWw==" + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.4.tgz", + "integrity": "sha512-qprfWkn82Iw821mcKofJ5Pk9wgioHicxcQMxx+5zt5GSKoqdWvgG5AxVmpmUUjzTLPVSH5auBrhI93Deayn/DA==" }, "node_modules/@headlessui/react": { "version": "1.7.16", @@ -259,9 +259,9 @@ } }, "node_modules/@radix-ui/react-dismissable-layer": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.4.tgz", - "integrity": "sha512-7UpBa/RKMoHJYjie1gkF1DlK8l1fdU/VKDpoS3rCCo8YBJR294GwcEHyxHw72yvphJ7ld0AXEcSLAzY2F/WyCg==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.5.tgz", + "integrity": "sha512-aJeDjQhywg9LBu2t/At58hCvr7pEm0o2Ke1x33B+MhjNmmZ17sy4KImo0KPLgsnc/zN7GPdce8Cnn0SWvwZO7g==", "dependencies": { "@babel/runtime": "^7.13.10", "@radix-ui/primitive": "1.0.1", @@ -304,9 +304,9 @@ } }, "node_modules/@radix-ui/react-popper": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.1.2.tgz", - "integrity": "sha512-1CnGGfFi/bbqtJZZ0P/NQY20xdG3E0LALJaLUEoKwPLwl6PPPfbeiCqMVQnhoFRAxjJj4RpBRJzDmUgsex2tSg==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.1.3.tgz", + "integrity": "sha512-cKpopj/5RHZWjrbF2846jBNacjQVwkP068DfmgrNJXpvVWrOvlAmE9xSiy5OqeE+Gi8D9fP+oDhUnPqNMY8/5w==", "dependencies": { "@babel/runtime": "^7.13.10", "@floating-ui/react-dom": "^2.0.0", @@ -336,9 +336,9 @@ } }, "node_modules/@radix-ui/react-portal": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.0.3.tgz", - "integrity": "sha512-xLYZeHrWoPmA5mEKEfZZevoVRK/Q43GfzRXkWV6qawIWWK8t6ifIiLQdd7rmQ4Vk1bmI21XhqF9BN3jWf+phpA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.0.4.tgz", + "integrity": "sha512-Qki+C/EuGUVCQTOTD5vzJzJuMUlewbzuKyUy+/iHM2uwGiru9gZeBJtHAPKAEkB5KWGi9mP/CHKcY0wt1aW45Q==", "dependencies": { "@babel/runtime": "^7.13.10", "@radix-ui/react-primitive": "1.0.3" @@ -424,18 +424,18 @@ } }, "node_modules/@radix-ui/react-tooltip": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.0.6.tgz", - "integrity": "sha512-DmNFOiwEc2UDigsYj6clJENma58OelxD24O4IODoZ+3sQc3Zb+L8w1EP+y9laTuKCLAysPw4fD6/v0j4KNV8rg==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.0.7.tgz", + "integrity": "sha512-lPh5iKNFVQ/jav/j6ZrWq3blfDJ0OH9R6FlNUHPMqdLuQ9vwDgFsRxvl8b7Asuy5c8xmoojHUxKHQSOAvMHxyw==", "dependencies": { "@babel/runtime": "^7.13.10", "@radix-ui/primitive": "1.0.1", "@radix-ui/react-compose-refs": "1.0.1", "@radix-ui/react-context": "1.0.1", - "@radix-ui/react-dismissable-layer": "1.0.4", + "@radix-ui/react-dismissable-layer": "1.0.5", "@radix-ui/react-id": "1.0.1", - "@radix-ui/react-popper": "1.1.2", - "@radix-ui/react-portal": "1.0.3", + "@radix-ui/react-popper": "1.1.3", + "@radix-ui/react-portal": "1.0.4", "@radix-ui/react-presence": "1.0.1", "@radix-ui/react-primitive": "1.0.3", "@radix-ui/react-slot": "1.0.2", @@ -3099,9 +3099,9 @@ } }, "node_modules/shadow-cljs": { - "version": "2.25.3", - "resolved": "https://registry.npmjs.org/shadow-cljs/-/shadow-cljs-2.25.3.tgz", - "integrity": "sha512-vqziimWfQl6WbVq/mJbbIO7W9pg8tZrKxtehoA2kS713ro1PlZxGrZoKfrxCw9T03zgHrO/Zmh/y8GLtqKUbLQ==", + "version": "2.25.7", + "resolved": "https://registry.npmjs.org/shadow-cljs/-/shadow-cljs-2.25.7.tgz", + "integrity": "sha512-5ZYxrabzGblKnAs4C4/L7zDRr+gBPiyxYc1oYbSzd6B31p341vBMaAWZffohSooci8txzXTpe2rVhAsLtCmiOg==", "dev": true, "dependencies": { "node-libs-browser": "^2.2.1", @@ -3609,34 +3609,34 @@ } }, "@floating-ui/core": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.4.1.tgz", - "integrity": "sha512-jk3WqquEJRlcyu7997NtR5PibI+y5bi+LS3hPmguVClypenMsCY3CBa3LAQnozRCtCrYWSEtAdiskpamuJRFOQ==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.5.0.tgz", + "integrity": "sha512-kK1h4m36DQ0UHGj5Ah4db7R0rHemTqqO0QLvUqi1/mUUp3LuAWbWxdxSIf/XsnH9VS6rRVPLJCncjRzUvyCLXg==", "requires": { - "@floating-ui/utils": "^0.1.1" + "@floating-ui/utils": "^0.1.3" } }, "@floating-ui/dom": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.5.1.tgz", - "integrity": "sha512-KwvVcPSXg6mQygvA1TjbN/gh///36kKtllIF8SUm0qpFj8+rvYrpvlYdL1JoA71SHpDqgSSdGOSoQ0Mp3uY5aw==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.5.3.tgz", + "integrity": "sha512-ClAbQnEqJAKCJOEbbLo5IUlZHkNszqhuxS4fHAVxRPXPya6Ysf2G8KypnYcOTpx6I8xcgF9bbHb6g/2KpbV8qA==", "requires": { - "@floating-ui/core": "^1.4.1", - "@floating-ui/utils": "^0.1.1" + "@floating-ui/core": "^1.4.2", + "@floating-ui/utils": "^0.1.3" } }, "@floating-ui/react-dom": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.1.tgz", - "integrity": "sha512-rZtAmSht4Lry6gdhAJDrCp/6rKN7++JnL1/Anbr/DdeyYXQPxvg/ivrbYvJulbRf4vL8b212suwMM2lxbv+RQA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.0.2.tgz", + "integrity": "sha512-5qhlDvjaLmAst/rKb3VdlCinwTF4EYMiVxuuc/HVUjs46W0zgtbMmAZ1UTsDrRTxRmUEzl92mOtWbeeXL26lSQ==", "requires": { - "@floating-ui/dom": "^1.3.0" + "@floating-ui/dom": "^1.5.1" } }, "@floating-ui/utils": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.1.tgz", - "integrity": "sha512-m0G6wlnhm/AX0H12IOWtK8gASEMffnX08RtKkCgTdHb9JpHKGloI7icFfLg9ZmQeavcvR0PKmzxClyuFPSjKWw==" + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.4.tgz", + "integrity": "sha512-qprfWkn82Iw821mcKofJ5Pk9wgioHicxcQMxx+5zt5GSKoqdWvgG5AxVmpmUUjzTLPVSH5auBrhI93Deayn/DA==" }, "@headlessui/react": { "version": "1.7.16", @@ -3751,9 +3751,9 @@ } }, "@radix-ui/react-dismissable-layer": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.4.tgz", - "integrity": "sha512-7UpBa/RKMoHJYjie1gkF1DlK8l1fdU/VKDpoS3rCCo8YBJR294GwcEHyxHw72yvphJ7ld0AXEcSLAzY2F/WyCg==", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.0.5.tgz", + "integrity": "sha512-aJeDjQhywg9LBu2t/At58hCvr7pEm0o2Ke1x33B+MhjNmmZ17sy4KImo0KPLgsnc/zN7GPdce8Cnn0SWvwZO7g==", "requires": { "@babel/runtime": "^7.13.10", "@radix-ui/primitive": "1.0.1", @@ -3773,9 +3773,9 @@ } }, "@radix-ui/react-popper": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.1.2.tgz", - "integrity": "sha512-1CnGGfFi/bbqtJZZ0P/NQY20xdG3E0LALJaLUEoKwPLwl6PPPfbeiCqMVQnhoFRAxjJj4RpBRJzDmUgsex2tSg==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.1.3.tgz", + "integrity": "sha512-cKpopj/5RHZWjrbF2846jBNacjQVwkP068DfmgrNJXpvVWrOvlAmE9xSiy5OqeE+Gi8D9fP+oDhUnPqNMY8/5w==", "requires": { "@babel/runtime": "^7.13.10", "@floating-ui/react-dom": "^2.0.0", @@ -3791,9 +3791,9 @@ } }, "@radix-ui/react-portal": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.0.3.tgz", - "integrity": "sha512-xLYZeHrWoPmA5mEKEfZZevoVRK/Q43GfzRXkWV6qawIWWK8t6ifIiLQdd7rmQ4Vk1bmI21XhqF9BN3jWf+phpA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.0.4.tgz", + "integrity": "sha512-Qki+C/EuGUVCQTOTD5vzJzJuMUlewbzuKyUy+/iHM2uwGiru9gZeBJtHAPKAEkB5KWGi9mP/CHKcY0wt1aW45Q==", "requires": { "@babel/runtime": "^7.13.10", "@radix-ui/react-primitive": "1.0.3" @@ -3828,18 +3828,18 @@ } }, "@radix-ui/react-tooltip": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.0.6.tgz", - "integrity": "sha512-DmNFOiwEc2UDigsYj6clJENma58OelxD24O4IODoZ+3sQc3Zb+L8w1EP+y9laTuKCLAysPw4fD6/v0j4KNV8rg==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@radix-ui/react-tooltip/-/react-tooltip-1.0.7.tgz", + "integrity": "sha512-lPh5iKNFVQ/jav/j6ZrWq3blfDJ0OH9R6FlNUHPMqdLuQ9vwDgFsRxvl8b7Asuy5c8xmoojHUxKHQSOAvMHxyw==", "requires": { "@babel/runtime": "^7.13.10", "@radix-ui/primitive": "1.0.1", "@radix-ui/react-compose-refs": "1.0.1", "@radix-ui/react-context": "1.0.1", - "@radix-ui/react-dismissable-layer": "1.0.4", + "@radix-ui/react-dismissable-layer": "1.0.5", "@radix-ui/react-id": "1.0.1", - "@radix-ui/react-popper": "1.1.2", - "@radix-ui/react-portal": "1.0.3", + "@radix-ui/react-popper": "1.1.3", + "@radix-ui/react-portal": "1.0.4", "@radix-ui/react-presence": "1.0.1", "@radix-ui/react-primitive": "1.0.3", "@radix-ui/react-slot": "1.0.2", @@ -5780,9 +5780,9 @@ } }, "shadow-cljs": { - "version": "2.25.3", - "resolved": "https://registry.npmjs.org/shadow-cljs/-/shadow-cljs-2.25.3.tgz", - "integrity": "sha512-vqziimWfQl6WbVq/mJbbIO7W9pg8tZrKxtehoA2kS713ro1PlZxGrZoKfrxCw9T03zgHrO/Zmh/y8GLtqKUbLQ==", + "version": "2.25.7", + "resolved": "https://registry.npmjs.org/shadow-cljs/-/shadow-cljs-2.25.7.tgz", + "integrity": "sha512-5ZYxrabzGblKnAs4C4/L7zDRr+gBPiyxYc1oYbSzd6B31p341vBMaAWZffohSooci8txzXTpe2rVhAsLtCmiOg==", "dev": true, "requires": { "node-libs-browser": "^2.2.1", diff --git a/package.json b/package.json index fb6c58c0..8288f09c 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "dependencies": { "@headlessui/react": "^1.7.16", "@heroicons/react": "^1.0.5", - "@radix-ui/react-tooltip": "^1.0.6", + "@radix-ui/react-tooltip": "^1.0.7", "@types/react": "^17.0.33", "codemirror": "^5.65.14", "highlight.js": "^11.2.0", @@ -29,7 +29,7 @@ }, "devDependencies": { "@tailwindcss/typography": "^0.5.9", - "shadow-cljs": "^2.25.3", + "shadow-cljs": "^2.25.7", "tailwindcss": "^3.3.3" }, "overrides": { diff --git a/src/dev/clojure/dev.clj b/src/dev/clojure/dev.clj index 169c7455..90aa206b 100644 --- a/src/dev/clojure/dev.clj +++ b/src/dev/clojure/dev.clj @@ -37,21 +37,12 @@ (component/system :dev))) -;; FIXME -(def context - nil - #_(Context/createFake - (Init/createState (AInitConfig/create)) Init/RESERVED_ADDRESS)) +(defn convex-world-context [] + (system/convex-world-context system)) (defn peer ^Peer [] (system/convex-peer system)) -(defmacro execute [form] - `(convex/execute context ~form)) - -(defn execute-string [source] - (convex/execute-string context source)) - (defn db [] @(system/db-conn system)) @@ -65,6 +56,9 @@ (stop) + (def ctx (convex-world-context)) + + (test/run-all-tests #"convex-web.*") @@ -128,18 +122,33 @@ ;; -- Execute - (execute-string "(nth 0xFF 0)") - - (instance? convex.core.lang.AFn (execute-string "inc")) - (instance? convex.core.lang.impl.Fn (execute-string "inc")) - (instance? convex.core.lang.impl.Fn (execute-string "(fn [x] x)")) + (convex/execute-string ctx "(nth 0xFF 0)") + + (type (convex/execute-string ctx "if")) + ;; => convex.core.lang.impl.Fn + + (type (convex/execute-string ctx "loop")) + ;; => convex.core.data.Symbol + + (type (convex/execute-string ctx "inc")) + ;; => convex.core.lang.Core$75 + + (= true (instance? convex.core.lang.AFn (convex/execute-string ctx "inc"))) + (= true (instance? convex.core.lang.impl.CoreFn (convex/execute-string ctx "inc"))) + + (= true (instance? convex.core.lang.AFn (convex/execute-string ctx "defn"))) + (= false (instance? convex.core.lang.impl.CoreFn (convex/execute-string ctx "defn"))) + + (= true (instance? convex.core.lang.AFn (convex/execute-string ctx "(fn [x] x)"))) + (= false (instance? convex.core.lang.impl.CoreFn (convex/execute-string ctx "(fn [x] x)"))) + ;; Library metadata. (convex/library-metadata (system/convex-world-context system) "convex.trust") ;; `convex.core.lang.impl.Fn/getParams` returns AVector - (def params (.getParams (execute-string "(fn [x y] (+ x y))"))) + (def params (.getParams (convex/execute-string ctx "(fn [x y] (+ x y))"))) ;; Parameters data. (map @@ -157,13 +166,16 @@ ;; Lookup metadata. (convex/datafy (or - (.lookupMeta context Init/HERO (Symbol/create "map")) - (.lookupMeta context (Symbol/create "map")))) + (.lookupMeta ctx Init/HERO (Symbol/create "map")) + (.lookupMeta ctx (Symbol/create "map")))) (try (Reader/read "(]") (catch Throwable e (println (.getMessage (stacktrace/root-cause e))))) + + (type (Reader/read "when-not")) + ;; => convex.core.data.Symbol ;; -- diff --git a/src/main/clojure/convex_web/command.clj b/src/main/clojure/convex_web/command.clj index f947cb99..a46d712f 100644 --- a/src/main/clojure/convex_web/command.clj +++ b/src/main/clojure/convex_web/command.clj @@ -58,7 +58,7 @@ (str result-value))))) -;; TODO Merge with `value-kind`. +;; TODO: Delete (defn result-metadata [result-value & [{:keys [source lang]}]] (let [source-form (try (when (and source (= :convex-lisp lang)) @@ -240,10 +240,11 @@ (log/debug "Command returned an error:" result-error-code result-value)) ;; Command status. - command' (if result + command' (cond + result (merge #:convex-web.command - {:result (convex/result-data result) + {:result (convex/result-data (source command) result) :status (if result-error-code :convex-web.command.status/error @@ -256,6 +257,7 @@ :message (convex/datafy result-value) :trace (convex/datafy result-trace)}})) + :else ;; If there isn't a Result, `error` won't have a code, ;; and the Exception's message will be used as its message. #:convex-web.command diff --git a/src/main/clojure/convex_web/convex.clj b/src/main/clojure/convex_web/convex.clj index be41767e..a1fa74b9 100644 --- a/src/main/clojure/convex_web/convex.clj +++ b/src/main/clojure/convex_web/convex.clj @@ -8,8 +8,8 @@ [cognitect.anomalies :as anomalies] [convex-web.site.sandbox.hiccup :as hiccup] - [convex.write :as $.write] - ) + [convex.write :as $.write]) + (:import (convex.peer Server) (convex.core.init Init) @@ -350,40 +350,54 @@ :else x)) -(defn result-data [^Result result] - (let [^ACell result-id (.getID result) - ^ACell result-error-code (.getErrorCode result) - ^ACell result-value (.getValue result) - ^AVector result-trace (.getTrace result)] - (merge #:convex-web.result {:id (datafy result-id) - :type (or (some-> result-value .getType .toString) "Nil") - :value (or (some-> result-value $.write/string str) "nil")} - - ;; Interactive Syntax. - (when (instance? Syntax result-value) - (let [syntax-meta (datafy (.getMeta ^Syntax result-value)) - - {:keys [interact?]} syntax-meta] - - (merge {:convex-web.result/metadata syntax-meta} - (when interact? - (let [element (datafy result-value) - element (coerce-element element) - element (if-not (s/valid? ::hiccup/element element) - [:v-box - [:text "Sorry. This syntax is not valid in the Interactive Sandbox:"] - [:code (str element)]] - - ;; Else; valid element. - element)] - {:convex-web.result/interactive (s/conform ::hiccup/element element)}))))) - - (when (instance? CoreFn result-value) - {:convex-web.result/metadata (datafy (metadata (.getSymbol ^CoreFn result-value)))}) - - (when result-error-code - {:convex-web.result/error-code (datafy result-error-code) - :convex-web.result/trace (datafy result-trace)})))) +(defn result-data + ([^Result result] + (result-data nil result)) + ([^String source ^Result result] + (let [^ACell result-id (.getID result) + ^ACell result-error-code (.getErrorCode result) + ^ACell result-value (.getValue result) + ^AVector result-trace (.getTrace result) + + source (try + (Reader/read source) + (catch Exception _ + nil)) + + result-metadata (when (instance? convex.core.data.Symbol source) + (metadata source))] + + (merge #:convex-web.result {:id (datafy result-id) + :type (or (some-> result-value .getType .toString) "Nil") + :value (or (some-> result-value $.write/string str) "nil")} + + ;; -- Interactive Syntax + (when (instance? Syntax result-value) + (let [syntax-meta (datafy (.getMeta ^Syntax result-value)) + + {:keys [interact?]} syntax-meta] + + (merge {:convex-web.result/metadata syntax-meta} + (when interact? + (let [element (datafy result-value) + element (coerce-element element) + element (if-not (s/valid? ::hiccup/element element) + [:v-box + [:text "Sorry. This syntax is not valid in the Interactive Sandbox:"] + [:code (str element)]] + + ;; Else; valid element. + element)] + {:convex-web.result/interactive (s/conform ::hiccup/element element)}))))) + + ;; -- Metadata + (when result-metadata + {:convex-web.result/metadata (datafy result-metadata)}) + + ;; -- Error + (when result-error-code + {:convex-web.result/error-code (datafy result-error-code) + :convex-web.result/trace (datafy result-trace)}))))) (defn transaction-result-data [^ATransaction atransaction ^Result result] (let [tx (cond diff --git a/src/main/clojure/convex_web/site/app.cljs b/src/main/clojure/convex_web/site/app.cljs index 45968568..488e5073 100644 --- a/src/main/clojure/convex_web/site/app.cljs +++ b/src/main/clojure/convex_web/site/app.cljs @@ -784,7 +784,7 @@ ;; ========================= [:div.w-full.flex.justify-center {:class "bg-convex-dark-blue"} - [marketing/Sitemap]] + [marketing/Sitemap2]] ;; Copyright ;; ========================= diff --git a/src/main/clojure/convex_web/site/gui.cljs b/src/main/clojure/convex_web/site/gui.cljs index d729b7e5..dac2c96c 100644 --- a/src/main/clojure/convex_web/site/gui.cljs +++ b/src/main/clojure/convex_web/site/gui.cljs @@ -846,10 +846,10 @@ ;; ---------------------------------------------------- (defn SpinnerSmall [] - [:div.spinner.ease-linear.rounded-full.border-2.border-t-2.border-gray-200.h-4.w-4]) + [:div.spinner.ease-linear.rounded-full.border-2.border-t-2.h-4.w-4]) (defn Spinner [] - [:div.spinner.ease-linear.rounded-full.border-4.border-t-4.border-gray-200.h-10.w-10]) + [:div.spinner.ease-linear.rounded-full.border-4.border-t-4.h-10.w-10]) (defn ClipboardCopy [text & [{:keys [color background-color hover margin]}]] (let [id (str (random-uuid))] diff --git a/src/main/clojure/convex_web/site/gui/marketing.cljs b/src/main/clojure/convex_web/site/gui/marketing.cljs index 8dd818d1..71c1859f 100644 --- a/src/main/clojure/convex_web/site/gui/marketing.cljs +++ b/src/main/clojure/convex_web/site/gui/marketing.cljs @@ -88,7 +88,8 @@ :href (rfe/href :route-name/convex-foundation)}]}}) (defn sitemap [] - [{:text "TECHNOLOGY" + [{:name :technology + :text "TECHNOLOGY" :items [(let [section "Convergent Proof of Stake"] {:text section @@ -105,7 +106,8 @@ {:text "Convex Architecture Documents (CAD)" :href (rfe/href :route-name/technology {} {:section "CADs"})}]} - {:text "USE CASES" + {:name :use-cases + :text "USE CASES" :items [(let [section "NFTs"] {:text section @@ -127,7 +129,8 @@ {:text section :href (rfe/href :route-name/use-cases {} {:section section})})]} - {:text "ECOSYSTEM" + {:name :ecosystem + :text "ECOSYSTEM" :items [(let [section "Builders"] {:text section @@ -141,7 +144,8 @@ {:text section :href (rfe/href :route-name/ecosystem {} {:section section})})]} - {:text "INFORMATION" + {:name :information + :text "INFORMATION" :items [{:text "Privacy Policy" :href (rfe/href :route-name/privacy-policy)} @@ -152,7 +156,8 @@ {:text "Trademark Policy" :href (rfe/href :route-name/trademark-policy)}]} - {:text "ABOUT" + {:name :about + :text "ABOUT" :items [(let [section "Foundation"] {:text section @@ -271,29 +276,29 @@ ;; -- News - [:div.flex.flex-col.justify-center - {:class "min-h-[156px] bg-[#93D500]"} + #_[:div.flex.flex-col.justify-center + {:class "min-h-[156px] bg-[#93D500]"} - [:div.w-full.max-w-5xl.mx-auto + [:div.w-full.max-w-5xl.mx-auto - [:div.flex.flex-col.md:flex-row.md:items-center.md:justify-between + [:div.flex.flex-col.md:flex-row.md:items-center.md:justify-between - [:div.flex.flex-col.p-8.md:p-0 - [:span.uppercase.text-convex-dark-blue.font-extrabold.text-3xl - "News:"] + [:div.flex.flex-col.p-8.md:p-0 + [:span.uppercase.text-convex-dark-blue.font-extrabold.text-3xl + "News:"] - [:span.text-convex-dark-blue.font-bold.text-2xl.mt-4 - "Convex selected as a DLT for Next Gen Internet"] + [:span.text-convex-dark-blue.font-bold.text-2xl.mt-4 + "Convex selected as a DLT for Next Gen Internet"] - [:span.text-convex-dark-blue.text-xl - "EU Next Generation Internet... " - [:a.underline - {:target "_black" - :href "https://ontochain.ngi.eu/content/convex-global-dlt-convex-hosting-infrastructure-and-decentralised-ledger-next-generation"} - "READ MORE"]]] + [:span.text-convex-dark-blue.text-xl + "EU Next Generation Internet... " + [:a.underline + {:target "_black" + :href "https://ontochain.ngi.eu/content/convex-global-dlt-convex-hosting-infrastructure-and-decentralised-ledger-next-generation"} + "READ MORE"]]] - [:img.hidden.md:block - {:src "/images/ngi_onto_chain.png"}]]]] + [:img.hidden.md:block + {:src "/images/ngi_onto_chain.png"}]]]] [:div.flex.flex-col.bg-convex-dark-blue @@ -392,6 +397,34 @@ [BottomNavMenuSocial]]]) +(defn Sitemap2 [] + (let [sitemap-indexed (into {} (map (juxt :name identity)) (sitemap))] + [:div.lg:flex.lg:space-x-32.p-12 + {:class "bg-convex-dark-blue"} + + ;; -- Technology & Use Cases + [:div.flex.flex-col + [BottomNavMenu + (sitemap-indexed :technology)] + + [BottomNavMenu + (sitemap-indexed :use-cases)]] + + ;; -- Ecosystem & Information + [:div.flex.flex-col + [BottomNavMenu + (sitemap-indexed :ecosystem)] + + [BottomNavMenu + (sitemap-indexed :information)]] + + ;; -- About + [BottomNavMenu + (sitemap-indexed :about)] + + ;; -- Social Media + [BottomNavMenuSocial]])) + (defn Copyrigth [] [:div.flex.flex-col.items-center.space-y-4.p-2 {:class "bg-convex-dark-blue"} diff --git a/src/main/clojure/convex_web/site/gui/sandbox.cljs b/src/main/clojure/convex_web/site/gui/sandbox.cljs index 15444c0e..66dc22c7 100644 --- a/src/main/clojure/convex_web/site/gui/sandbox.cljs +++ b/src/main/clojure/convex_web/site/gui/sandbox.cljs @@ -404,6 +404,13 @@ :show-examples? false}]] [gui/Highlight result-value])) + result-metadata + [:div.flex.flex-1.bg-white.rounded.shadow + [gui/SymbolMeta + {:symbol result-value + :metadata result-metadata + :show-examples? false}]] + :else [:code.text-xs result-value]))) diff --git a/src/main/clojure/convex_web/site/welcome.cljs b/src/main/clojure/convex_web/site/welcome.cljs index c0a00733..d7495e87 100644 --- a/src/main/clojure/convex_web/site/welcome.cljs +++ b/src/main/clojure/convex_web/site/welcome.cljs @@ -433,7 +433,7 @@ [:div.w-screen.flex.justify-center {:class "bg-convex-dark-blue"} - [marketing/Sitemap (marketing/sitemap)]] + [marketing/Sitemap2]] ;; -- Copyright diff --git a/src/test/clojure/convex_web/command_test.clj b/src/test/clojure/convex_web/command_test.clj index 71a20ad0..029c75bb 100644 --- a/src/test/clojure/convex_web/command_test.clj +++ b/src/test/clojure/convex_web/command_test.clj @@ -146,6 +146,22 @@ :convex-web.result/value "{:description \"Increments the given Long value by 1.\",:signature [{:return Long,:params [num]}],:errors {:CAST \"If the actor argument is not castable to Long.\"},:examples [{:code \"(inc 10)\"}]}"} (select-keys result [:convex-web.result/type :convex-web.result/value]))))) + + (testing "Metadata" + (let [execute (fn [source] + (c/execute system {::c/id (java.util.UUID/randomUUID) + ::c/timestamp 1 + ::c/mode :convex-web.command.mode/query + ::c/signer {:convex-web.account/address 9} + ::c/query + {:convex-web.query/source source + :convex-web.query/language :convex-lisp}})) + + result-metadata (fn [command] + (get-in command [:convex-web.command/result :convex-web.result/metadata]))] + + (is (= true (contains? (result-metadata (execute "inc")) :doc))) + (is (= true (contains? (result-metadata (execute "loop")) :doc))))) (testing "Syntax error" (let [command (c/execute system {::c/id (java.util.UUID/randomUUID) diff --git a/src/test/clojure/convex_web/convex_test.clj b/src/test/clojure/convex_web/convex_test.clj index cfeb71af..78c97ac3 100644 --- a/src/test/clojure/convex_web/convex_test.clj +++ b/src/test/clojure/convex_web/convex_test.clj @@ -282,7 +282,7 @@ :convex-web.result/type "Function", :convex-web.result/value "map"} - (convex/result-data (Result/create (CVMLong/create 1) Core/MAP)))))) + (convex/result-data "map" (Result/create (CVMLong/create 1) Core/MAP)))))) (deftest account-key-from-hex-test (testing "Invalid Address"