From a0d9af1ae25f402263e25132c0fb85db55febda6 Mon Sep 17 00:00:00 2001 From: Tasos Katsoulas Date: Tue, 10 Dec 2024 17:00:04 +0200 Subject: [PATCH] Introduce AlpineJS and HTMX into the project --- kitsune/sumo/static/sumo/js/alpine.js | 5 +++++ kitsune/sumo/static/sumo/js/htmx.js | 1 + package-lock.json | 32 +++++++++++++++++++++++++++ package.json | 4 +++- webpack/entrypoints.js | 2 ++ 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 kitsune/sumo/static/sumo/js/alpine.js create mode 100644 kitsune/sumo/static/sumo/js/htmx.js diff --git a/kitsune/sumo/static/sumo/js/alpine.js b/kitsune/sumo/static/sumo/js/alpine.js new file mode 100644 index 00000000000..df80acc4e2b --- /dev/null +++ b/kitsune/sumo/static/sumo/js/alpine.js @@ -0,0 +1,5 @@ +import Alpine from 'alpinejs'; + +window.Alpine = Alpine; + +Alpine.start(); diff --git a/kitsune/sumo/static/sumo/js/htmx.js b/kitsune/sumo/static/sumo/js/htmx.js new file mode 100644 index 00000000000..f3ecdb7fa51 --- /dev/null +++ b/kitsune/sumo/static/sumo/js/htmx.js @@ -0,0 +1 @@ +window.htmx = require("htmx.org"); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 36f502faa13..2286bf2daea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,11 @@ "dependencies": { "@babel/runtime": "^7.20.13", "@urql/svelte": "^3.0.3", + "alpinejs": "^3.14.7", "codemirror": "^5.65.11", "d3": "^3.5.17", "graphql": "^16.8.1", + "htmx.org": "^2.0.3", "jquery": "^3.6.3", "jquery-ui": "1.13.2", "nunjucks": "^3.2.4", @@ -2215,6 +2217,21 @@ "svelte": "^3.0.0" } }, + "node_modules/@vue/reactivity": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.1.5.tgz", + "integrity": "sha512-1tdfLmNjWG6t/CsPldh+foumYFo3cpyCHgBYQ34ylaMsJ+SNHQ1kApMIa8jN+i593zQuaw3AdWH0nJTARzCFhg==", + "license": "MIT", + "dependencies": { + "@vue/shared": "3.1.5" + } + }, + "node_modules/@vue/shared": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.1.5.tgz", + "integrity": "sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA==", + "license": "MIT" + }, "node_modules/@webassemblyjs/ast": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.12.1.tgz", @@ -2566,6 +2583,15 @@ "ajv": "^6.9.1" } }, + "node_modules/alpinejs": { + "version": "3.14.7", + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.14.7.tgz", + "integrity": "sha512-ScnbydNBcWVnCiVupD3wWUvoMPm8244xkvDNMxVCspgmap9m4QuJ7pjc+77UtByU+1+Ejg0wzYkP4mQaOMcvng==", + "license": "MIT", + "dependencies": { + "@vue/reactivity": "~3.1.1" + } + }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -7309,6 +7335,12 @@ "entities": "^2.0.0" } }, + "node_modules/htmx.org": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/htmx.org/-/htmx.org-2.0.3.tgz", + "integrity": "sha512-AeoJUAjkCVVajbfKX+3sVQBTCt8Ct4lif1T+z/tptTXo8+8yyq3QIMQQe/IT+R8ssfrO1I0DeX4CAronzCL6oA==", + "license": "0BSD" + }, "node_modules/http-cache-semantics": { "version": "3.8.1", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", diff --git a/package.json b/package.json index d4ed2c986b2..37070af3030 100644 --- a/package.json +++ b/package.json @@ -36,9 +36,11 @@ "dependencies": { "@babel/runtime": "^7.20.13", "@urql/svelte": "^3.0.3", + "alpinejs": "^3.14.7", "codemirror": "^5.65.11", "d3": "^3.5.17", "graphql": "^16.8.1", + "htmx.org": "^2.0.3", "jquery": "^3.6.3", "jquery-ui": "1.13.2", "nunjucks": "^3.2.4", @@ -101,4 +103,4 @@ "webpack-cli": "^5.1.4", "webpack-merge": "^5.8.0" } -} \ No newline at end of file +} diff --git a/webpack/entrypoints.js b/webpack/entrypoints.js index 218acee87cd..18fe9fe4410 100644 --- a/webpack/entrypoints.js +++ b/webpack/entrypoints.js @@ -4,6 +4,8 @@ const entrypoints = { "sumo/js/i18n.js", "sumo/js/kbox.js", "sumo/js/main.js", + "sumo/js/htmx.js", + "sumo/js/alpine.js", "sumo/js/geoip-locale.js", "sumo/js/ui.js", "sumo/js/analytics.js",