diff --git a/package.json b/package.json new file mode 100644 index 0000000..4e4e83b --- /dev/null +++ b/package.json @@ -0,0 +1,11 @@ +{ + "name": "@e-ops-pf/starter-kit", + "version": "1.0.0", + "private": true, + "scripts": { + "build": "vite build" + }, + "devDependencies": { + "vite": "^5.0.0" + } + } diff --git a/public/js/e-ops-pf/starter-kit/app.js b/public/js/e-ops-pf/starter-kit/app.js new file mode 100644 index 0000000..553a672 --- /dev/null +++ b/public/js/e-ops-pf/starter-kit/app.js @@ -0,0 +1 @@ +document.addEventListener("alpine:init",()=>{Alpine.directive("confirm-modal",(c,a,{evaluate:l})=>{c.addEventListener("click",m=>{m.preventDefault();const o=document.getElementById("global-confirm-modal"),e=c.dataset;console.log("Dataset:",e),document.getElementById("confirm-title").innerHTML=e.title||"Confirm Action",document.getElementById("confirm-message").innerHTML=e.message||"Are you sure you want to proceed?",document.getElementById("confirm-cancel").innerHTML=e.cancelLabel||"Cancel",document.getElementById("confirm-confirm").innerHTML=e.confirmLabel||"Confirm",document.getElementById("confirm-confirm").addEventListener("click",()=>{var d;if(e.url)window.location.href=e.url;else if(e.action){const t=document.createElement("form");t.method="POST",t.action=e.action;const i=(d=document.querySelector('meta[name="csrf-token"]'))==null?void 0:d.content;if(i){const n=document.createElement("input");n.type="hidden",n.name="_token",n.value=i,t.appendChild(n)}if(e.method&&e.method.toUpperCase()!=="POST"){const n=document.createElement("input");n.type="hidden",n.name="_method",n.value=e.method,t.appendChild(n)}document.body.appendChild(t),t.submit()}else console.error("No URL or action specified for confirmation."),o.close()}),document.getElementById("confirm-cancel").addEventListener("click",()=>{o.close()}),o.showModal()})})}); diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..7c9db83 --- /dev/null +++ b/vite.config.js @@ -0,0 +1,20 @@ +import { defineConfig } from 'vite' +import path from 'path' + +export default defineConfig({ + build: { + outDir: 'public/js/e-ops-pf/starter-kit', + emptyOutDir: true, + rollupOptions: { + input: 'resources/js/app.js', + output: { + entryFileNames: 'app.js', + }, + }, + }, + resolve: { + alias: { + '@': path.resolve(__dirname, 'resources/js'), + }, + }, +}) \ No newline at end of file