From c27e1aa057dd7cb65d3f5591ba61f7141175ff58 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Sat, 7 Jun 2025 16:10:29 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20pmme-ui:=20Commit=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pmme-ui/.gitignore | 20 +++ pmme-ui/package-lock.json | 194 +++++++++++++++++++++++++++++ pmme-ui/package.json | 8 ++ pmme-ui/public/index.html | 12 ++ pmme-ui/shadow-cljs.edn | 19 +++ pmme-ui/src/main/pmme_ui/core.cljs | 32 +++++ 6 files changed, 285 insertions(+) create mode 100644 pmme-ui/.gitignore create mode 100644 pmme-ui/package-lock.json create mode 100644 pmme-ui/package.json create mode 100644 pmme-ui/public/index.html create mode 100644 pmme-ui/shadow-cljs.edn create mode 100644 pmme-ui/src/main/pmme_ui/core.cljs diff --git a/pmme-ui/.gitignore b/pmme-ui/.gitignore new file mode 100644 index 0000000..295a9c8 --- /dev/null +++ b/pmme-ui/.gitignore @@ -0,0 +1,20 @@ +node_modules/ +public/js + +/target +/checkouts +/src/gen + +pom.xml +pom.xml.asc +*.iml +*.jar +*.log +.shadow-cljs +.idea +.lein-* +.nrepl-* +.DS_Store + +.hgignore +.hg/ diff --git a/pmme-ui/package-lock.json b/pmme-ui/package-lock.json new file mode 100644 index 0000000..b70dbaa --- /dev/null +++ b/pmme-ui/package-lock.json @@ -0,0 +1,194 @@ +{ + "name": "pmme-ui", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "pmme-ui", + "version": "0.0.1", + "devDependencies": { + "shadow-cljs": "3.1.5" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/readline-sync": { + "version": "1.4.10", + "resolved": "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.10.tgz", + "integrity": "sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/shadow-cljs": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/shadow-cljs/-/shadow-cljs-3.1.5.tgz", + "integrity": "sha512-0uOUTt/iBe1grXuA/u9PHgLBYyjRcuTOMm80c+iVVvvHPngz2e6yRFfWJcU9h9dYmJAIafQhKLgnxfaoKefpfQ==", + "dev": true, + "dependencies": { + "buffer": "^6.0.3", + "process": "^0.11.10", + "readline-sync": "^1.4.10", + "shadow-cljs-jar": "1.3.4", + "source-map-support": "^0.5.21", + "which": "^5.0.0", + "ws": "^8.18.1" + }, + "bin": { + "shadow-cljs": "cli/runner.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/shadow-cljs-jar": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/shadow-cljs-jar/-/shadow-cljs-jar-1.3.4.tgz", + "integrity": "sha512-cZB2pzVXBnhpJ6PQdsjO+j/MksR28mv4QD/hP/2y1fsIa9Z9RutYgh3N34FZ8Ktl4puAXaIGlct+gMCJ5BmwmA==", + "dev": true + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/which": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-5.0.0.tgz", + "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", + "dev": true, + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^18.17.0 || >=20.5.0" + } + }, + "node_modules/ws": { + "version": "8.18.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz", + "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/pmme-ui/package.json b/pmme-ui/package.json new file mode 100644 index 0000000..a1d72ba --- /dev/null +++ b/pmme-ui/package.json @@ -0,0 +1,8 @@ +{ + "name": "pmme-ui", + "version": "0.0.1", + "private": true, + "devDependencies": { + "shadow-cljs": "3.1.5" + } +} diff --git a/pmme-ui/public/index.html b/pmme-ui/public/index.html new file mode 100644 index 0000000..46b852d --- /dev/null +++ b/pmme-ui/public/index.html @@ -0,0 +1,12 @@ + + + + + + PMME UI + + +
+ + + \ No newline at end of file diff --git a/pmme-ui/shadow-cljs.edn b/pmme-ui/shadow-cljs.edn new file mode 100644 index 0000000..f1a362d --- /dev/null +++ b/pmme-ui/shadow-cljs.edn @@ -0,0 +1,19 @@ +;; shadow-cljs configuration +{:source-paths + ["src/main" + "src/test"] + + :dependencies + [] + + :builds + {:app {:target :browser + :output-dir "public/js" + :asset-path "/js" + :modules {:main {:init-fn pmme-ui.core/init}}} + + :release {:target :browser + :output-dir "../pmme-mobile/src/js" + :asset-path "/js" + :modules {:main {:init-fn pmme-ui.core/init}} + :compiler-options {:optimizations :advanced}}}} diff --git a/pmme-ui/src/main/pmme_ui/core.cljs b/pmme-ui/src/main/pmme_ui/core.cljs new file mode 100644 index 0000000..e6eade7 --- /dev/null +++ b/pmme-ui/src/main/pmme_ui/core.cljs @@ -0,0 +1,32 @@ +(ns pmme-ui.core + (:require [clojure.string :as str])) + +(defn handle-greet [event] + (.preventDefault event) + (let [input (.getElementById js/document "greet-input") + msg-element (.getElementById js/document "greet-msg") + name (.-value input)] + (if (empty? (str/trim name)) + (set! (.-innerHTML msg-element) "Please enter a name!") + (do + ;; You could call a Tauri command here instead + (set! (.-innerHTML msg-element) + (str "Hello, " name "! 👋 (from ClojureScript)")) + (set! (.-value input) ""))))) + +(defn setup-greet-form [] + (when-let [form (.getElementById js/document "greet-form")] + (.addEventListener form "submit" handle-greet))) + +(defn add-dynamic-styling [] + (let [style (.createElement js/document "style")] + (set! (.-textContent style) + "#greet-msg { color: #646cff; font-weight: bold; margin-top: 1rem; }") + (.appendChild (.-head js/document) style))) + +(defn init [] + (js/console.log "PMME UI initialized!") + (setup-greet-form) + (add-dynamic-styling) + ;; Remove the app element modification since it doesn't exist in this HTML + (js/console.log "Greet form is now powered by ClojureScript!"))