@oneclick.dev/cms-core-modules 0.0.110 → 0.0.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Acquisition-Dt2rREU8.js → Acquisition-DgzDQH51.js} +1 -1
- package/dist/{Acquisition-DNCy8nQz.mjs → Acquisition-FV3QpaUX.mjs} +2 -2
- package/dist/{Audience-Bs7b0TNm.js → Audience-BSgNvcVb.js} +1 -1
- package/dist/{Audience-CUeMVYRy.mjs → Audience-ka0b7YPE.mjs} +2 -2
- package/dist/{Components-DXbx0RLV.js → Components-6gTTI_u-.js} +1 -1
- package/dist/{Components-C83O-xlF.mjs → Components-iU3ZaJm5.mjs} +32 -32
- package/dist/{ContentEditor-D9-1SJ5F.mjs → ContentEditor-C5yNNLeV.mjs} +8446 -7893
- package/dist/{ContentEditor-BprPiHMJ.js → ContentEditor-MctMvN7D.js} +53 -53
- package/dist/{Create-89z41K73.js → Create--MOBOTA-.js} +1 -1
- package/dist/{Create-BCklc_T1.mjs → Create-BXNLRQag.mjs} +1 -1
- package/dist/DateFormatter-CSAbE3BC.js +1 -0
- package/dist/{DateFormatter-DUxlo8X8.mjs → DateFormatter-qbhRYxI_.mjs} +226 -222
- package/dist/{Detail-CNlljBfH.mjs → Detail-ChD5XurA.mjs} +1 -1
- package/dist/{Detail-C857g62L.js → Detail-RISEJJab.js} +1 -1
- package/dist/{Find-DIISO5GO.mjs → Find-zN_dKz4p.mjs} +1 -1
- package/dist/{GlobalStyling-C9VthHWK.mjs → GlobalStyling-Bp2PiOWt.mjs} +648 -502
- package/dist/GlobalStyling-fRjfDDeO.js +25 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Baqy-rTT.js +1 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Dx4Bpa2m.mjs +1263 -0
- package/dist/{Overview-Di84CsR5.mjs → Overview-98nkJUWN.mjs} +162 -157
- package/dist/{Overview-C-Jb_BxY.mjs → Overview-BR_y8x3W.mjs} +1 -1
- package/dist/{Overview-DC9io1bk.js → Overview-CX-n6W7d.js} +1 -1
- package/dist/Overview-Dl8cMlsr.js +1 -0
- package/dist/{Overview-BKAti8nc.mjs → Overview-MpgkLB6m.mjs} +36 -36
- package/dist/{SeoHealth-az1YuNF2.js → SeoHealth-C5npw7mE.js} +1 -1
- package/dist/{SeoHealth-MC3lSCOY.mjs → SeoHealth-bVQj_Xgm.mjs} +29 -29
- package/dist/{TableView-DXHhJ-jm.mjs → TableView-Bf1fdJrD.mjs} +1838 -1822
- package/dist/TableView-DNcXyIMu.js +4 -0
- package/dist/{agenda-IOqtALWf.js → agenda-BaJu3-1c.js} +1 -1
- package/dist/{agenda-DcatSSYQ.mjs → agenda-BwVY_8oM.mjs} +3 -3
- package/dist/cms-core-modules.css +1 -1
- package/dist/{exceptions-CI0B4xVj.js → exceptions-B6P9UiCj.js} +1 -1
- package/dist/{exceptions-YCQkHa6a.mjs → exceptions-De9-FvdP.mjs} +67 -67
- package/dist/{index-CpzDEMeC.mjs → index-B8GvmAwh.mjs} +438 -478
- package/dist/{index-wjkEPsNx.mjs → index-BIF2RB7k.mjs} +1212 -1316
- package/dist/index-ByRsp77L.js +70 -0
- package/dist/{index-BhWvXMOp.mjs → index-CFzn2Lus.mjs} +5 -9
- package/dist/{index-BFLV54kw.mjs → index-CkVwMqpn.mjs} +1114 -1100
- package/dist/index-DL6orwdK.js +35 -0
- package/dist/index-DUlYrnXH.js +58 -0
- package/dist/index-DZV720u-.mjs +439 -0
- package/dist/index-D_nfGegA.js +184 -0
- package/dist/index-DtSvAFLL.js +54 -0
- package/dist/{index-D30apIn-.mjs → index-L54VBzwJ.mjs} +2 -3
- package/dist/{index-BzWmWCo5.mjs → index-hH3e-IYz.mjs} +267 -267
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +17 -17
- package/dist/math-BJ-oX_IM.mjs +80 -0
- package/dist/math-emotyaF6.js +1 -0
- package/dist/{resources-CYOb5Bl6.mjs → resources-DwYxn2Vi.mjs} +1 -1
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/Icon.d.ts +15 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/Icon.vue.d.ts +92 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/ScopedSelectAll.d.ts +1 -2
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/iconOptions.d.ts +22 -0
- package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/useFocus.d.ts +1 -0
- package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/IconMenu.vue.d.ts +16 -0
- package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/index.d.ts +17 -0
- package/package.json +2 -2
- package/dist/DateFormatter-CYAD4GBN.js +0 -1
- package/dist/GlobalStyling-CnSlXkZc.js +0 -25
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Ceoje52V.js +0 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Dh9jzvE0.mjs +0 -1255
- package/dist/Overview-UoZHUMUz.js +0 -1
- package/dist/TableView-DQW0A1oG.js +0 -4
- package/dist/array-CbATeQbk.js +0 -1
- package/dist/array-DT5pE8Gm.mjs +0 -108
- package/dist/index-A2kp8Isi.js +0 -75
- package/dist/index-B5aBwdxY.js +0 -54
- package/dist/index-BiT55eU0.js +0 -58
- package/dist/index-G7cIlnGN.js +0 -158
- package/dist/index-V78huaSJ.mjs +0 -442
- package/dist/index-vHmvbEwa.js +0 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),C=require("@oneclick.dev/cms-kit");require("./index-B5aBwdxY.js");const d=require("lucide-vue-next"),B=require("./index-BiT55eU0.js"),q={class:"@container/charts flex flex-col gap-6 w-full max-w-7xl mx-auto py-8"},L={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},U={key:0,class:"flex items-center gap-2"},F={class:"flex items-center border rounded-lg overflow-hidden"},A=["onClick"],G={class:"text-sm text-destructive font-medium"},T={key:2,class:"flex items-center justify-center py-20"},j={class:"flex flex-col @4xl/charts:grid @4xl/charts:grid-cols-3 gap-6"},O={class:"relative"},P={class:"absolute inset-0 flex items-center justify-center pointer-events-none"},H={class:"text-center"},I={class:"text-2xl font-bold tabular-nums"},K={class:"mt-4 grid grid-cols-2 gap-x-4 gap-y-1.5 w-full"},W={class:"text-xs truncate"},J={class:"text-xs text-muted-foreground ml-auto tabular-nums"},Q={class:"overflow-x-auto"},X={class:"w-full text-sm"},Y={class:"divide-y"},Z={class:"px-6 py-3"},ee={class:"flex items-center gap-2"},te={class:"font-medium"},oe={class:"px-4 py-3 text-right tabular-nums"},se={class:"px-4 py-3 text-right tabular-nums"},ne={class:"px-4 py-3 text-right tabular-nums"},ae={class:"px-4 py-3 text-right tabular-nums"},le={class:"px-4 py-3 text-right tabular-nums"},re={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},ce={class:"flex items-center gap-4"},ie=["onClick"],de={key:0,class:"divide-y"},ue={class:"overflow-x-auto"},me={class:"w-full text-sm"},pe={class:"divide-y"},xe={class:"px-6 py-3 text-muted-foreground"},fe={class:"px-4 py-3 font-mono text-xs"},ge={class:"px-4 py-3 text-right tabular-nums"},he={class:"px-4 py-3 text-right tabular-nums"},_e={class:"px-4 py-3 text-right tabular-nums"},ye={class:"px-4 py-3 text-right tabular-nums"},ve={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},Ne={key:1,class:"divide-y"},Ve={class:"flex items-center gap-3 min-w-0"},ke={class:"text-muted-foreground w-5 text-right shrink-0"},Ee={class:"truncate font-medium"},Ce={class:"flex items-center gap-6 shrink-0 tabular-nums text-xs text-muted-foreground"},be={class:"w-20 text-right"},Be={class:"w-16 text-right"},we={class:"w-16 text-right"},De={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},Se={key:2,class:"divide-y"},Me={class:"flex items-center gap-3 min-w-0"},$e={class:"text-muted-foreground w-5 text-right shrink-0"},Re={class:"truncate font-medium"},ze={class:"flex items-center gap-6 shrink-0 tabular-nums text-xs text-muted-foreground"},qe={class:"w-20 text-right"},Le={class:"w-16 text-right"},Ue={class:"w-16 text-right"},Fe={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},Ae=e.defineComponent({__name:"Acquisition",setup(Ge){const{config:b}=C.useModule(),{moduleId:w}=C.useModuleRoute();C.useModuleBreadcrumbs(()=>[{label:"Acquisition"}]);const u=e.ref(!0),p=e.ref(null),x=e.ref("30"),m=e.ref("sources"),i=e.ref([]),v=e.ref([]),N=e.ref([]),V=e.ref([]),f=e.computed(()=>!!(b.serviceAccount&&b.propertyId));function g(s){return`/api/v1/modules/${w}${s}`}const D=[{label:"7d",value:"7"},{label:"14d",value:"14"},{label:"30d",value:"30"},{label:"90d",value:"90"}],c=["#3b82f6","#8b5cf6","#10b981","#f59e0b","#ef4444","#06b6d4","#ec4899","#84cc16","#f97316","#6366f1","#14b8a6","#e11d48","#a855f7","#22c55e","#eab308"],S=e.computed(()=>{const s={};return i.value.forEach((o,l)=>{const r=(o.sessionDefaultChannelGroup||"other").toLowerCase().replace(/[^a-z0-9]/g,"_");s[r]={label:o.sessionDefaultChannelGroup||"Other",color:c[l%c.length]}}),s}),M=e.computed(()=>i.value.map((s,o)=>({key:(s.sessionDefaultChannelGroup||"other").toLowerCase().replace(/[^a-z0-9]/g,"_"),label:s.sessionDefaultChannelGroup||"Other",sessions:s.sessions||0,fill:c[o%c.length]}))),$=e.computed(()=>i.value.reduce((s,o)=>s+(o.sessions||0),0));function n(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:Math.round(s).toString()}function h(s){return`${(s*100).toFixed(1)}%`}function R(s){const o=Math.floor(s/60),l=Math.round(s%60);return o>0?`${o}m ${l}s`:`${l}s`}async function _(){if(!f.value)return;u.value=!0,p.value=null;const s=`${x.value}daysAgo`;try{const[o,l,r,y]=await Promise.all([$fetch(g(`/acquisition/channels?startDate=${s}&endDate=today`)),$fetch(g(`/acquisition/source-medium?startDate=${s}&endDate=today`)),$fetch(g(`/acquisition/referrals?startDate=${s}&endDate=today`)).catch(()=>({rows:[]})),$fetch(g(`/acquisition/campaigns?startDate=${s}&endDate=today`)).catch(()=>({rows:[]}))]);i.value=o.rows||[],v.value=l.rows||[],N.value=r.rows||[],V.value=y.rows||[]}catch(o){p.value=o?.data?.statusMessage||o?.message||"Failed to load acquisition data"}finally{u.value=!1}}return e.watch(x,()=>_()),e.onMounted(()=>{f.value?_():u.value=!1}),(s,o)=>{const l=e.resolveComponent("Button"),r=e.resolveComponent("Card"),y=e.resolveComponent("CardTitle"),k=e.resolveComponent("CardHeader"),z=e.resolveComponent("ChartContainer"),E=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",L,[o[0]||(o[0]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Acquisition"),e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"},"Where your traffic comes from")],-1)),f.value?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("div",F,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(D,t=>e.createElementVNode("button",{key:t.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",x.value===t.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:a=>x.value=t.value},e.toDisplayString(t.label),11,A)),64))]),e.createVNode(l,{variant:"outline",size:"icon",onClick:_,disabled:u.value},{default:e.withCtx(()=>[e.createVNode(e.unref(d.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":u.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),f.value?p.value?(e.openBlock(),e.createBlock(r,{key:1,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",G,e.toDisplayString(p.value),1),e.createVNode(l,{variant:"outline",size:"sm",class:"mt-3",onClick:_},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):u.value?(e.openBlock(),e.createElementBlock("div",T,[e.createVNode(e.unref(d.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createElementVNode("div",j,[e.createVNode(r,{class:"@4xl/charts:col-span-1"},{default:e.withCtx(()=>[e.createVNode(k,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(y,{class:"text-base"},{default:e.withCtx(()=>[...o[3]||(o[3]=[e.createTextVNode("Channel Mix",-1)])]),_:1})]),_:1}),e.createVNode(E,{class:"flex flex-col items-center"},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(z,{config:S.value,class:"mx-auto aspect-square max-h-[220px]"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.S),{data:M.value,margin:{top:20,bottom:20,left:20,right:20}},{default:e.withCtx(()=>[e.createVNode(e.unref(B.E),{value:t=>t.sessions,color:t=>t.fill,arcWidth:40,padAngle:.02,cornerRadius:4},null,8,["value","color"])]),_:1},8,["data"])]),_:1},8,["config"]),e.createElementVNode("div",P,[e.createElementVNode("div",H,[e.createElementVNode("p",I,e.toDisplayString(n($.value)),1),o[4]||(o[4]=e.createElementVNode("p",{class:"text-xs text-muted-foreground"},"sessions",-1))])])]),e.createElementVNode("div",K,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value.slice(0,8),(t,a)=>(e.openBlock(),e.createElementBlock("div",{key:t.sessionDefaultChannelGroup,class:"flex items-center gap-2"},[e.createElementVNode("div",{class:"size-2.5 rounded-full shrink-0",style:e.normalizeStyle({backgroundColor:c[a%c.length]})},null,4),e.createElementVNode("span",W,e.toDisplayString(t.sessionDefaultChannelGroup),1),e.createElementVNode("span",J,e.toDisplayString(n(t.sessions)),1)]))),128))])]),_:1})]),_:1}),e.createVNode(r,{class:"@4xl/charts:col-span-2"},{default:e.withCtx(()=>[e.createVNode(k,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(y,{class:"text-base"},{default:e.withCtx(()=>[...o[5]||(o[5]=[e.createTextVNode("Channels Performance",-1)])]),_:1})]),_:1}),e.createVNode(E,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",Q,[e.createElementVNode("table",X,[o[6]||(o[6]=e.createElementVNode("thead",null,[e.createElementVNode("tr",{class:"border-b text-left"},[e.createElementVNode("th",{class:"px-6 py-3 font-medium text-muted-foreground"},"Channel"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Sessions"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Users"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"New Users"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Engage Rate"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Avg Duration")])],-1)),e.createElementVNode("tbody",Y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(t,a)=>(e.openBlock(),e.createElementBlock("tr",{key:t.sessionDefaultChannelGroup,class:"hover:bg-muted/50"},[e.createElementVNode("td",Z,[e.createElementVNode("div",ee,[e.createElementVNode("div",{class:"size-2.5 rounded-full shrink-0",style:e.normalizeStyle({backgroundColor:c[a%c.length]})},null,4),e.createElementVNode("span",te,e.toDisplayString(t.sessionDefaultChannelGroup),1)])]),e.createElementVNode("td",oe,e.toDisplayString(n(t.sessions)),1),e.createElementVNode("td",se,e.toDisplayString(n(t.totalUsers)),1),e.createElementVNode("td",ne,e.toDisplayString(n(t.newUsers)),1),e.createElementVNode("td",ae,e.toDisplayString(h(t.engagementRate||0)),1),e.createElementVNode("td",le,e.toDisplayString(R(t.averageSessionDuration||0)),1)]))),128))])])]),i.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",re,"No channel data available"))]),_:1})]),_:1})]),e.createVNode(r,null,{default:e.withCtx(()=>[e.createVNode(k,{class:"pb-0"},{default:e.withCtx(()=>[e.createElementVNode("div",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList([{key:"sources",label:"Source / Medium",icon:e.unref(d.Share2)},{key:"referrals",label:"Referrals",icon:e.unref(d.ExternalLink)},{key:"campaigns",label:"Campaigns",icon:e.unref(d.Megaphone)}],t=>(e.openBlock(),e.createElementBlock("button",{key:t.key,class:e.normalizeClass(["flex items-center gap-1.5 px-3 py-2 text-sm font-medium rounded-md transition-colors",m.value===t.key?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"]),onClick:a=>m.value=t.key},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon),{class:"size-3.5"})),e.createTextVNode(" "+e.toDisplayString(t.label),1)],10,ie))),128))])]),_:1}),e.createVNode(E,{class:"p-0 mt-4"},{default:e.withCtx(()=>[m.value==="sources"?(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("div",ue,[e.createElementVNode("table",me,[o[7]||(o[7]=e.createElementVNode("thead",null,[e.createElementVNode("tr",{class:"border-b text-left"},[e.createElementVNode("th",{class:"px-6 py-3 font-medium text-muted-foreground"},"#"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground"},"Source / Medium"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Sessions"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Users"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"New Users"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Bounce Rate")])],-1)),e.createElementVNode("tbody",pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(t,a)=>(e.openBlock(),e.createElementBlock("tr",{key:t.sessionSourceMedium,class:"hover:bg-muted/50"},[e.createElementVNode("td",xe,e.toDisplayString(a+1),1),e.createElementVNode("td",fe,e.toDisplayString(t.sessionSourceMedium),1),e.createElementVNode("td",ge,e.toDisplayString(n(t.sessions)),1),e.createElementVNode("td",he,e.toDisplayString(n(t.totalUsers)),1),e.createElementVNode("td",_e,e.toDisplayString(n(t.newUsers)),1),e.createElementVNode("td",ye,e.toDisplayString(h(t.bounceRate||0)),1)]))),128))])])]),v.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ve,"No data available"))])):e.createCommentVNode("",!0),m.value==="referrals"?(e.openBlock(),e.createElementBlock("div",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,(t,a)=>(e.openBlock(),e.createElementBlock("div",{key:t.sessionSource,class:"flex items-center justify-between px-6 py-3 text-sm hover:bg-muted/50"},[e.createElementVNode("div",Ve,[e.createElementVNode("span",ke,e.toDisplayString(a+1),1),e.createVNode(e.unref(d.ExternalLink),{class:"size-3.5 text-muted-foreground shrink-0"}),e.createElementVNode("span",Ee,e.toDisplayString(t.sessionSource),1)]),e.createElementVNode("div",Ce,[e.createElementVNode("span",be,e.toDisplayString(n(t.sessions))+" sessions",1),e.createElementVNode("span",Be,e.toDisplayString(n(t.totalUsers))+" users",1),e.createElementVNode("span",we,e.toDisplayString(h(t.engagementRate||0))+" eng.",1)])]))),128)),N.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",De,"No referral data available"))])):e.createCommentVNode("",!0),m.value==="campaigns"?(e.openBlock(),e.createElementBlock("div",Se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,(t,a)=>(e.openBlock(),e.createElementBlock("div",{key:t.sessionCampaignName,class:"flex items-center justify-between px-6 py-3 text-sm hover:bg-muted/50"},[e.createElementVNode("div",Me,[e.createElementVNode("span",$e,e.toDisplayString(a+1),1),e.createVNode(e.unref(d.Megaphone),{class:"size-3.5 text-muted-foreground shrink-0"}),e.createElementVNode("span",Re,e.toDisplayString(t.sessionCampaignName),1)]),e.createElementVNode("div",ze,[e.createElementVNode("span",qe,e.toDisplayString(n(t.sessions))+" sessions",1),e.createElementVNode("span",Le,e.toDisplayString(n(t.totalUsers))+" users",1),e.createElementVNode("span",Ue,e.toDisplayString(h(t.engagementRate||0))+" eng.",1)])]))),128)),V.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Fe,"No campaign data. Use UTM parameters in your URLs to track campaigns."))])):e.createCommentVNode("",!0)]),_:1})]),_:1})],64)):(e.openBlock(),e.createBlock(r,{key:0,class:"p-8 text-center"},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required",-1),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-2"},"Configure your GA4 property in module settings.",-1)])]),_:1}))])}}});exports.default=Ae;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),C=require("@oneclick.dev/cms-kit");require("./index-DtSvAFLL.js");const d=require("lucide-vue-next"),B=require("./index-DUlYrnXH.js"),q={class:"@container/charts flex flex-col gap-6 w-full max-w-7xl mx-auto py-8"},L={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},U={key:0,class:"flex items-center gap-2"},F={class:"flex items-center border rounded-lg overflow-hidden"},A=["onClick"],G={class:"text-sm text-destructive font-medium"},T={key:2,class:"flex items-center justify-center py-20"},j={class:"flex flex-col @4xl/charts:grid @4xl/charts:grid-cols-3 gap-6"},O={class:"relative"},P={class:"absolute inset-0 flex items-center justify-center pointer-events-none"},H={class:"text-center"},I={class:"text-2xl font-bold tabular-nums"},K={class:"mt-4 grid grid-cols-2 gap-x-4 gap-y-1.5 w-full"},W={class:"text-xs truncate"},J={class:"text-xs text-muted-foreground ml-auto tabular-nums"},Q={class:"overflow-x-auto"},X={class:"w-full text-sm"},Y={class:"divide-y"},Z={class:"px-6 py-3"},ee={class:"flex items-center gap-2"},te={class:"font-medium"},oe={class:"px-4 py-3 text-right tabular-nums"},se={class:"px-4 py-3 text-right tabular-nums"},ne={class:"px-4 py-3 text-right tabular-nums"},ae={class:"px-4 py-3 text-right tabular-nums"},le={class:"px-4 py-3 text-right tabular-nums"},re={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},ce={class:"flex items-center gap-4"},ie=["onClick"],de={key:0,class:"divide-y"},ue={class:"overflow-x-auto"},me={class:"w-full text-sm"},pe={class:"divide-y"},xe={class:"px-6 py-3 text-muted-foreground"},fe={class:"px-4 py-3 font-mono text-xs"},ge={class:"px-4 py-3 text-right tabular-nums"},he={class:"px-4 py-3 text-right tabular-nums"},_e={class:"px-4 py-3 text-right tabular-nums"},ye={class:"px-4 py-3 text-right tabular-nums"},ve={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},Ne={key:1,class:"divide-y"},Ve={class:"flex items-center gap-3 min-w-0"},ke={class:"text-muted-foreground w-5 text-right shrink-0"},Ee={class:"truncate font-medium"},Ce={class:"flex items-center gap-6 shrink-0 tabular-nums text-xs text-muted-foreground"},be={class:"w-20 text-right"},Be={class:"w-16 text-right"},we={class:"w-16 text-right"},De={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},Se={key:2,class:"divide-y"},Me={class:"flex items-center gap-3 min-w-0"},$e={class:"text-muted-foreground w-5 text-right shrink-0"},Re={class:"truncate font-medium"},ze={class:"flex items-center gap-6 shrink-0 tabular-nums text-xs text-muted-foreground"},qe={class:"w-20 text-right"},Le={class:"w-16 text-right"},Ue={class:"w-16 text-right"},Fe={key:0,class:"px-6 py-8 text-center text-muted-foreground text-sm"},Ae=e.defineComponent({__name:"Acquisition",setup(Ge){const{config:b}=C.useModule(),{moduleId:w}=C.useModuleRoute();C.useModuleBreadcrumbs(()=>[{label:"Acquisition"}]);const u=e.ref(!0),p=e.ref(null),x=e.ref("30"),m=e.ref("sources"),i=e.ref([]),v=e.ref([]),N=e.ref([]),V=e.ref([]),f=e.computed(()=>!!(b.serviceAccount&&b.propertyId));function g(s){return`/api/v1/modules/${w}${s}`}const D=[{label:"7d",value:"7"},{label:"14d",value:"14"},{label:"30d",value:"30"},{label:"90d",value:"90"}],c=["#3b82f6","#8b5cf6","#10b981","#f59e0b","#ef4444","#06b6d4","#ec4899","#84cc16","#f97316","#6366f1","#14b8a6","#e11d48","#a855f7","#22c55e","#eab308"],S=e.computed(()=>{const s={};return i.value.forEach((o,l)=>{const r=(o.sessionDefaultChannelGroup||"other").toLowerCase().replace(/[^a-z0-9]/g,"_");s[r]={label:o.sessionDefaultChannelGroup||"Other",color:c[l%c.length]}}),s}),M=e.computed(()=>i.value.map((s,o)=>({key:(s.sessionDefaultChannelGroup||"other").toLowerCase().replace(/[^a-z0-9]/g,"_"),label:s.sessionDefaultChannelGroup||"Other",sessions:s.sessions||0,fill:c[o%c.length]}))),$=e.computed(()=>i.value.reduce((s,o)=>s+(o.sessions||0),0));function n(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:Math.round(s).toString()}function h(s){return`${(s*100).toFixed(1)}%`}function R(s){const o=Math.floor(s/60),l=Math.round(s%60);return o>0?`${o}m ${l}s`:`${l}s`}async function _(){if(!f.value)return;u.value=!0,p.value=null;const s=`${x.value}daysAgo`;try{const[o,l,r,y]=await Promise.all([$fetch(g(`/acquisition/channels?startDate=${s}&endDate=today`)),$fetch(g(`/acquisition/source-medium?startDate=${s}&endDate=today`)),$fetch(g(`/acquisition/referrals?startDate=${s}&endDate=today`)).catch(()=>({rows:[]})),$fetch(g(`/acquisition/campaigns?startDate=${s}&endDate=today`)).catch(()=>({rows:[]}))]);i.value=o.rows||[],v.value=l.rows||[],N.value=r.rows||[],V.value=y.rows||[]}catch(o){p.value=o?.data?.statusMessage||o?.message||"Failed to load acquisition data"}finally{u.value=!1}}return e.watch(x,()=>_()),e.onMounted(()=>{f.value?_():u.value=!1}),(s,o)=>{const l=e.resolveComponent("Button"),r=e.resolveComponent("Card"),y=e.resolveComponent("CardTitle"),k=e.resolveComponent("CardHeader"),z=e.resolveComponent("ChartContainer"),E=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",L,[o[0]||(o[0]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Acquisition"),e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"},"Where your traffic comes from")],-1)),f.value?(e.openBlock(),e.createElementBlock("div",U,[e.createElementVNode("div",F,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(D,t=>e.createElementVNode("button",{key:t.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",x.value===t.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:a=>x.value=t.value},e.toDisplayString(t.label),11,A)),64))]),e.createVNode(l,{variant:"outline",size:"icon",onClick:_,disabled:u.value},{default:e.withCtx(()=>[e.createVNode(e.unref(d.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":u.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),f.value?p.value?(e.openBlock(),e.createBlock(r,{key:1,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",G,e.toDisplayString(p.value),1),e.createVNode(l,{variant:"outline",size:"sm",class:"mt-3",onClick:_},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):u.value?(e.openBlock(),e.createElementBlock("div",T,[e.createVNode(e.unref(d.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createElementVNode("div",j,[e.createVNode(r,{class:"@4xl/charts:col-span-1"},{default:e.withCtx(()=>[e.createVNode(k,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(y,{class:"text-base"},{default:e.withCtx(()=>[...o[3]||(o[3]=[e.createTextVNode("Channel Mix",-1)])]),_:1})]),_:1}),e.createVNode(E,{class:"flex flex-col items-center"},{default:e.withCtx(()=>[e.createElementVNode("div",O,[e.createVNode(z,{config:S.value,class:"mx-auto aspect-square max-h-[220px]"},{default:e.withCtx(()=>[e.createVNode(e.unref(B.b),{data:M.value,margin:{top:20,bottom:20,left:20,right:20}},{default:e.withCtx(()=>[e.createVNode(e.unref(B.E),{value:t=>t.sessions,color:t=>t.fill,arcWidth:40,padAngle:.02,cornerRadius:4},null,8,["value","color"])]),_:1},8,["data"])]),_:1},8,["config"]),e.createElementVNode("div",P,[e.createElementVNode("div",H,[e.createElementVNode("p",I,e.toDisplayString(n($.value)),1),o[4]||(o[4]=e.createElementVNode("p",{class:"text-xs text-muted-foreground"},"sessions",-1))])])]),e.createElementVNode("div",K,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value.slice(0,8),(t,a)=>(e.openBlock(),e.createElementBlock("div",{key:t.sessionDefaultChannelGroup,class:"flex items-center gap-2"},[e.createElementVNode("div",{class:"size-2.5 rounded-full shrink-0",style:e.normalizeStyle({backgroundColor:c[a%c.length]})},null,4),e.createElementVNode("span",W,e.toDisplayString(t.sessionDefaultChannelGroup),1),e.createElementVNode("span",J,e.toDisplayString(n(t.sessions)),1)]))),128))])]),_:1})]),_:1}),e.createVNode(r,{class:"@4xl/charts:col-span-2"},{default:e.withCtx(()=>[e.createVNode(k,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(y,{class:"text-base"},{default:e.withCtx(()=>[...o[5]||(o[5]=[e.createTextVNode("Channels Performance",-1)])]),_:1})]),_:1}),e.createVNode(E,{class:"p-0"},{default:e.withCtx(()=>[e.createElementVNode("div",Q,[e.createElementVNode("table",X,[o[6]||(o[6]=e.createElementVNode("thead",null,[e.createElementVNode("tr",{class:"border-b text-left"},[e.createElementVNode("th",{class:"px-6 py-3 font-medium text-muted-foreground"},"Channel"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Sessions"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Users"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"New Users"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Engage Rate"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Avg Duration")])],-1)),e.createElementVNode("tbody",Y,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(t,a)=>(e.openBlock(),e.createElementBlock("tr",{key:t.sessionDefaultChannelGroup,class:"hover:bg-muted/50"},[e.createElementVNode("td",Z,[e.createElementVNode("div",ee,[e.createElementVNode("div",{class:"size-2.5 rounded-full shrink-0",style:e.normalizeStyle({backgroundColor:c[a%c.length]})},null,4),e.createElementVNode("span",te,e.toDisplayString(t.sessionDefaultChannelGroup),1)])]),e.createElementVNode("td",oe,e.toDisplayString(n(t.sessions)),1),e.createElementVNode("td",se,e.toDisplayString(n(t.totalUsers)),1),e.createElementVNode("td",ne,e.toDisplayString(n(t.newUsers)),1),e.createElementVNode("td",ae,e.toDisplayString(h(t.engagementRate||0)),1),e.createElementVNode("td",le,e.toDisplayString(R(t.averageSessionDuration||0)),1)]))),128))])])]),i.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",re,"No channel data available"))]),_:1})]),_:1})]),e.createVNode(r,null,{default:e.withCtx(()=>[e.createVNode(k,{class:"pb-0"},{default:e.withCtx(()=>[e.createElementVNode("div",ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList([{key:"sources",label:"Source / Medium",icon:e.unref(d.Share2)},{key:"referrals",label:"Referrals",icon:e.unref(d.ExternalLink)},{key:"campaigns",label:"Campaigns",icon:e.unref(d.Megaphone)}],t=>(e.openBlock(),e.createElementBlock("button",{key:t.key,class:e.normalizeClass(["flex items-center gap-1.5 px-3 py-2 text-sm font-medium rounded-md transition-colors",m.value===t.key?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"]),onClick:a=>m.value=t.key},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon),{class:"size-3.5"})),e.createTextVNode(" "+e.toDisplayString(t.label),1)],10,ie))),128))])]),_:1}),e.createVNode(E,{class:"p-0 mt-4"},{default:e.withCtx(()=>[m.value==="sources"?(e.openBlock(),e.createElementBlock("div",de,[e.createElementVNode("div",ue,[e.createElementVNode("table",me,[o[7]||(o[7]=e.createElementVNode("thead",null,[e.createElementVNode("tr",{class:"border-b text-left"},[e.createElementVNode("th",{class:"px-6 py-3 font-medium text-muted-foreground"},"#"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground"},"Source / Medium"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Sessions"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Users"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"New Users"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Bounce Rate")])],-1)),e.createElementVNode("tbody",pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,(t,a)=>(e.openBlock(),e.createElementBlock("tr",{key:t.sessionSourceMedium,class:"hover:bg-muted/50"},[e.createElementVNode("td",xe,e.toDisplayString(a+1),1),e.createElementVNode("td",fe,e.toDisplayString(t.sessionSourceMedium),1),e.createElementVNode("td",ge,e.toDisplayString(n(t.sessions)),1),e.createElementVNode("td",he,e.toDisplayString(n(t.totalUsers)),1),e.createElementVNode("td",_e,e.toDisplayString(n(t.newUsers)),1),e.createElementVNode("td",ye,e.toDisplayString(h(t.bounceRate||0)),1)]))),128))])])]),v.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ve,"No data available"))])):e.createCommentVNode("",!0),m.value==="referrals"?(e.openBlock(),e.createElementBlock("div",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,(t,a)=>(e.openBlock(),e.createElementBlock("div",{key:t.sessionSource,class:"flex items-center justify-between px-6 py-3 text-sm hover:bg-muted/50"},[e.createElementVNode("div",Ve,[e.createElementVNode("span",ke,e.toDisplayString(a+1),1),e.createVNode(e.unref(d.ExternalLink),{class:"size-3.5 text-muted-foreground shrink-0"}),e.createElementVNode("span",Ee,e.toDisplayString(t.sessionSource),1)]),e.createElementVNode("div",Ce,[e.createElementVNode("span",be,e.toDisplayString(n(t.sessions))+" sessions",1),e.createElementVNode("span",Be,e.toDisplayString(n(t.totalUsers))+" users",1),e.createElementVNode("span",we,e.toDisplayString(h(t.engagementRate||0))+" eng.",1)])]))),128)),N.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",De,"No referral data available"))])):e.createCommentVNode("",!0),m.value==="campaigns"?(e.openBlock(),e.createElementBlock("div",Se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,(t,a)=>(e.openBlock(),e.createElementBlock("div",{key:t.sessionCampaignName,class:"flex items-center justify-between px-6 py-3 text-sm hover:bg-muted/50"},[e.createElementVNode("div",Me,[e.createElementVNode("span",$e,e.toDisplayString(a+1),1),e.createVNode(e.unref(d.Megaphone),{class:"size-3.5 text-muted-foreground shrink-0"}),e.createElementVNode("span",Re,e.toDisplayString(t.sessionCampaignName),1)]),e.createElementVNode("div",ze,[e.createElementVNode("span",qe,e.toDisplayString(n(t.sessions))+" sessions",1),e.createElementVNode("span",Le,e.toDisplayString(n(t.totalUsers))+" users",1),e.createElementVNode("span",Ue,e.toDisplayString(h(t.engagementRate||0))+" eng.",1)])]))),128)),V.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Fe,"No campaign data. Use UTM parameters in your URLs to track campaigns."))])):e.createCommentVNode("",!0)]),_:1})]),_:1})],64)):(e.openBlock(),e.createBlock(r,{key:0,class:"p-8 text-center"},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required",-1),e.createElementVNode("p",{class:"text-sm text-muted-foreground mt-2"},"Configure your GA4 property in module settings.",-1)])]),_:1}))])}}});exports.default=Ae;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as Q, ref as p, computed as U, watch as X, onMounted as Y, resolveComponent as b, openBlock as a, createElementBlock as l, createElementVNode as e, Fragment as h, renderList as v, normalizeClass as L, toDisplayString as o, createVNode as r, withCtx as i, unref as x, createCommentVNode as g, createBlock as E, createTextVNode as z, normalizeStyle as F, resolveDynamicComponent as Z } from "vue";
|
|
2
2
|
import { useModule as ee, useModuleRoute as te, useModuleBreadcrumbs as se } from "@oneclick.dev/cms-kit";
|
|
3
|
-
import "./index-
|
|
3
|
+
import "./index-CkVwMqpn.mjs";
|
|
4
4
|
import { RefreshCw as oe, Loader2 as ne, Share2 as ae, ExternalLink as T, Megaphone as V } from "lucide-vue-next";
|
|
5
|
-
import {
|
|
5
|
+
import { b as le, E as re } from "./index-DZV720u-.mjs";
|
|
6
6
|
const ie = { class: "@container/charts flex flex-col gap-6 w-full max-w-7xl mx-auto py-8" }, ue = { class: "flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center" }, de = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "flex items-center gap-2"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),D=require("@oneclick.dev/cms-kit");require("./index-B5aBwdxY.js");const r=require("lucide-vue-next"),z=require("./index-BiT55eU0.js"),H=require("./_plugin-vue_export-helper-BHFhmbuH.js"),I={class:"flex flex-col gap-6 w-full max-w-7xl mx-auto py-8"},K={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},G={key:0,class:"flex items-center gap-2"},J={class:"flex items-center border rounded-lg overflow-hidden"},Q=["onClick"],X={class:"text-sm text-destructive font-medium"},Y={key:2,class:"flex items-center justify-center py-20"},Z={class:"flex flex-col @lg:grid @lg:grid-cols-3 gap-6"},ee={class:"relative"},te={class:"absolute inset-0 flex items-center justify-center pointer-events-none"},se={class:"text-center"},oe={class:"text-xl font-bold tabular-nums"},ne={class:"mt-4 flex items-center gap-6"},le={class:"flex items-center gap-2"},ae={class:"text-sm font-semibold tabular-nums"},re={key:0,class:"text-xs text-muted-foreground"},de={class:"flex items-center gap-2"},ce={class:"text-sm font-semibold tabular-nums"},ie={key:0,class:"text-xs text-muted-foreground"},ue={class:"overflow-x-auto"},me={class:"w-full text-sm"},xe={class:"divide-y"},fe={class:"px-4 py-3"},ge={class:"flex items-center gap-2"},pe={class:"font-medium capitalize"},ve={class:"px-4 py-3 text-right tabular-nums"},he={class:"px-4 py-3 text-right tabular-nums"},Ve={class:"px-4 py-3 text-right tabular-nums"},_e={class:"px-4 py-3 text-right tabular-nums"},Ne={class:"px-4 py-3 text-right tabular-nums"},ye={class:"overflow-x-auto"},be={class:"min-w-[600px]"},Ee={class:"flex items-center mb-1.5"},ke={class:"flex-1 grid grid-cols-24 gap-0.5"},Ce={class:"w-10 shrink-0 text-xs text-muted-foreground"},we={class:"flex-1 grid grid-cols-24 gap-0.5"},Be=["title"],De={class:"grid @lg:grid-cols-3 gap-6"},Se={class:"flex items-center justify-between"},$e={class:"flex items-center gap-1"},ze=["onClick","title"],Re={class:"space-y-3"},Ue={class:"text-sm flex-1 truncate"},Te={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Fe={class:"text-xs tabular-nums text-muted-foreground w-12 text-right"},Me={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Le={class:"space-y-3"},Ae={class:"text-sm flex-1 truncate"},qe={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Pe={class:"text-xs tabular-nums text-muted-foreground w-12 text-right"},Oe={key:0,class:"py-4 text-center text-muted-foreground text-sm"},je={class:"space-y-2.5"},We={class:"flex-1 min-w-0"},He={class:"text-sm truncate block"},Ie={class:"text-xs text-muted-foreground truncate block"},Ke={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Ge={class:"text-xs tabular-nums text-muted-foreground w-12 text-right"},Je={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Qe=e.defineComponent({__name:"Audience",setup(Ye){const{config:S}=D.useModule(),{moduleId:R}=D.useModuleRoute();D.useModuleBreadcrumbs(()=>[{label:"Audience"}]);const u=e.ref(!0),h=e.ref(null),g=e.ref("30"),i=e.ref("browser"),V=e.ref([]),p=e.ref([]),_=e.ref([]),$=e.ref([]),N=e.ref([]),y=e.computed(()=>!!(S.serviceAccount&&S.propertyId));function m(o){return`/api/v1/modules/${R}${o}`}const U=[{label:"7d",value:"7"},{label:"14d",value:"14"},{label:"30d",value:"30"},{label:"90d",value:"90"}];function d(o){return o>=1e6?`${(o/1e6).toFixed(1)}M`:o>=1e3?`${(o/1e3).toFixed(1)}K`:Math.round(o).toString()}function T(o){return`${(o*100).toFixed(1)}%`}function F(o){const t=Math.floor(o/60),n=Math.round(o%60);return t>0?`${t}m ${n}s`:`${n}s`}const x={new:"#3b82f6",returning:"#8b5cf6"},M={new:{label:"New Users",color:x.new},returning:{label:"Returning Users",color:x.returning}},b=e.computed(()=>V.value.find(t=>t.newVsReturning==="new")?.totalUsers||0),E=e.computed(()=>V.value.find(t=>t.newVsReturning==="returning")?.totalUsers||0),L=e.computed(()=>[{key:"new",label:"New",value:b.value,fill:x.new},{key:"returning",label:"Returning",value:E.value,fill:x.returning}]),v=e.computed(()=>b.value+E.value),A=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],q=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],B=e.computed(()=>{const o=Array.from({length:7},()=>Array(24).fill(0));let t=1;return $.value.forEach(n=>{const l=A.indexOf(n.dayOfWeekName),a=parseInt(n.hour,10);l>=0&&a>=0&&a<24&&(o[l][a]=n.sessions||0,n.sessions>t&&(t=n.sessions))}),{matrix:o,maxVal:t}});function P(o,t){if(o===0)return"bg-muted";const n=o/t;return n>.75?"bg-blue-600 dark:bg-blue-500":n>.5?"bg-blue-500 dark:bg-blue-400":n>.25?"bg-blue-400/70 dark:bg-blue-400/60":"bg-blue-300/50 dark:bg-blue-300/30"}const O=[{key:"browser",label:"Browser",icon:r.Chrome},{key:"operatingSystem",label:"OS",icon:r.Cpu},{key:"screenResolution",label:"Screen",icon:r.Monitor}];async function k(){if(!y.value)return;u.value=!0,h.value=null;const o=`${g.value}daysAgo`;try{const[t,n,l,a,c]=await Promise.all([$fetch(m(`/audience/overview?startDate=${o}&endDate=today`)),$fetch(m(`/audience/technology?startDate=${o}&endDate=today&dimension=${i.value}`)),$fetch(m(`/audience/languages?startDate=${o}&endDate=today`)),$fetch(m(`/audience/hours?startDate=${o}&endDate=today`)),$fetch(m(`/audience/cities?startDate=${o}&endDate=today`))]);V.value=t.rows||[],p.value=n.rows||[],_.value=l.rows||[],$.value=a.rows||[],N.value=c.rows||[]}catch(t){h.value=t?.data?.statusMessage||t?.message||"Failed to load audience data"}finally{u.value=!1}}async function j(){const o=`${g.value}daysAgo`;try{const t=await $fetch(m(`/audience/technology?startDate=${o}&endDate=today&dimension=${i.value}`));p.value=t.rows||[]}catch{}}return e.watch(g,()=>k()),e.watch(i,()=>j()),e.onMounted(()=>{y.value?k():u.value=!1}),(o,t)=>{const n=e.resolveComponent("Button"),l=e.resolveComponent("Card"),a=e.resolveComponent("CardTitle"),c=e.resolveComponent("CardHeader"),W=e.resolveComponent("ChartContainer"),f=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",I,[e.createElementVNode("div",K,[t[0]||(t[0]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Audience"),e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"},"Who visits your site")],-1)),y.value?(e.openBlock(),e.createElementBlock("div",G,[e.createElementVNode("div",J,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(U,s=>e.createElementVNode("button",{key:s.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",g.value===s.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:C=>g.value=s.value},e.toDisplayString(s.label),11,Q)),64))]),e.createVNode(n,{variant:"outline",size:"icon",onClick:k,disabled:u.value},{default:e.withCtx(()=>[e.createVNode(e.unref(r.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":u.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),y.value?h.value?(e.openBlock(),e.createBlock(l,{key:1,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",X,e.toDisplayString(h.value),1),e.createVNode(n,{variant:"outline",size:"sm",class:"mt-3",onClick:k},{default:e.withCtx(()=>[...t[2]||(t[2]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):u.value?(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(e.unref(r.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createElementVNode("div",Z,[e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(a,{class:"text-base"},{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("New vs Returning",-1)])]),_:1})]),_:1}),e.createVNode(f,{class:"flex flex-col items-center"},{default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(W,{config:M,class:"mx-auto aspect-square max-h-[200px]"},{default:e.withCtx(()=>[e.createVNode(e.unref(z.S),{data:L.value,margin:{top:16,bottom:16,left:16,right:16}},{default:e.withCtx(()=>[e.createVNode(e.unref(z.E),{value:s=>s.value,color:s=>s.fill,arcWidth:35,padAngle:.03,cornerRadius:4},null,8,["value","color"])]),_:1},8,["data"])]),_:1}),e.createElementVNode("div",te,[e.createElementVNode("div",se,[e.createElementVNode("p",oe,e.toDisplayString(d(v.value)),1),t[4]||(t[4]=e.createElementVNode("p",{class:"text-xs text-muted-foreground"},"total users",-1))])])]),e.createElementVNode("div",ne,[e.createElementVNode("div",le,[e.createElementVNode("div",{class:"size-2.5 rounded-full",style:e.normalizeStyle({backgroundColor:x.new})},null,4),t[5]||(t[5]=e.createElementVNode("span",{class:"text-sm"},"New",-1)),e.createElementVNode("span",ae,e.toDisplayString(d(b.value)),1),v.value?(e.openBlock(),e.createElementBlock("span",re,e.toDisplayString(Math.round(b.value/v.value*100))+"%",1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",de,[e.createElementVNode("div",{class:"size-2.5 rounded-full",style:e.normalizeStyle({backgroundColor:x.returning})},null,4),t[6]||(t[6]=e.createElementVNode("span",{class:"text-sm"},"Returning",-1)),e.createElementVNode("span",ce,e.toDisplayString(d(E.value)),1),v.value?(e.openBlock(),e.createElementBlock("span",ie,e.toDisplayString(Math.round(E.value/v.value*100))+"%",1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1}),e.createVNode(l,{class:"@lg:col-span-2"},{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(a,{class:"text-base"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Engagement by Visitor Type",-1)])]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("table",me,[t[8]||(t[8]=e.createElementVNode("thead",null,[e.createElementVNode("tr",{class:"border-b text-left"},[e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground"},"Type"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Users"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Sessions"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Engagement Rate"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Avg Duration"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Pages/Session")])],-1)),e.createElementVNode("tbody",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,s=>(e.openBlock(),e.createElementBlock("tr",{key:s.newVsReturning,class:"hover:bg-muted/50"},[e.createElementVNode("td",fe,[e.createElementVNode("div",ge,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.newVsReturning==="new"?e.unref(r.UserPlus):e.unref(r.UserCheck)),{class:"size-4 text-muted-foreground"})),e.createElementVNode("span",pe,e.toDisplayString(s.newVsReturning),1)])]),e.createElementVNode("td",ve,e.toDisplayString(d(s.totalUsers)),1),e.createElementVNode("td",he,e.toDisplayString(d(s.sessions)),1),e.createElementVNode("td",Ve,e.toDisplayString(T(s.engagementRate||0)),1),e.createElementVNode("td",_e,e.toDisplayString(F(s.averageSessionDuration||0)),1),e.createElementVNode("td",Ne,e.toDisplayString((s.screenPageViewsPerSession||0).toFixed(1)),1)]))),128))])])])]),_:1})]),_:1})]),e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(a,{class:"text-base flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.Clock),{class:"size-4"}),t[9]||(t[9]=e.createTextVNode(" Peak Hours ",-1))]),_:1}),t[10]||(t[10]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"},"When your visitors are most active (based on sessions)",-1))]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",ye,[e.createElementVNode("div",be,[e.createElementVNode("div",Ee,[t[11]||(t[11]=e.createElementVNode("div",{class:"w-10 shrink-0"},null,-1)),e.createElementVNode("div",ke,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(24,s=>e.createElementVNode("div",{key:s,class:"text-[10px] text-muted-foreground text-center"},e.toDisplayString(s-1),1)),64))])]),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(q,(s,C)=>e.createElementVNode("div",{key:s,class:"flex items-center mb-0.5"},[e.createElementVNode("div",Ce,e.toDisplayString(s),1),e.createElementVNode("div",we,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(24,w=>e.createElementVNode("div",{key:w,class:e.normalizeClass(["aspect-square rounded-sm transition-colors",P(B.value.matrix[C]?.[w-1]||0,B.value.maxVal)]),title:`${s} ${w-1}:00 — ${B.value.matrix[C]?.[w-1]||0} sessions`},null,10,Be)),64))])])),64)),t[12]||(t[12]=e.createElementVNode("div",{class:"flex items-center justify-end gap-1.5 mt-3"},[e.createElementVNode("span",{class:"text-[10px] text-muted-foreground"},"Less"),e.createElementVNode("div",{class:"size-3 rounded-sm bg-muted"}),e.createElementVNode("div",{class:"size-3 rounded-sm bg-blue-300/50 dark:bg-blue-300/30"}),e.createElementVNode("div",{class:"size-3 rounded-sm bg-blue-400/70 dark:bg-blue-400/60"}),e.createElementVNode("div",{class:"size-3 rounded-sm bg-blue-500 dark:bg-blue-400"}),e.createElementVNode("div",{class:"size-3 rounded-sm bg-blue-600 dark:bg-blue-500"}),e.createElementVNode("span",{class:"text-[10px] text-muted-foreground"},"More")],-1))])])]),_:1})]),_:1}),e.createElementVNode("div",De,[e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createElementVNode("div",Se,[e.createVNode(a,{class:"text-base"},{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode("Technology",-1)])]),_:1}),e.createElementVNode("div",$e,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(O,s=>e.createElementVNode("button",{key:s.key,class:e.normalizeClass(["p-1.5 rounded-md transition-colors",i.value===s.key?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"]),onClick:C=>i.value=s.key,title:s.label},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.icon),{class:"size-3.5"}))],10,ze)),64))])])]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,s=>(e.openBlock(),e.createElementBlock("div",{key:s[i.value],class:"flex items-center gap-3"},[e.createElementVNode("span",Ue,e.toDisplayString(s[i.value]||"(not set)"),1),e.createElementVNode("div",Te,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${s.totalUsers/(p.value[0]?.totalUsers||1)*100}%`})},null,4)]),e.createElementVNode("span",Fe,e.toDisplayString(d(s.totalUsers)),1)]))),128)),p.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Me,"No data"))])]),_:1})]),_:1}),e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(a,{class:"text-base flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.Languages),{class:"size-4"}),t[14]||(t[14]=e.createTextVNode(" Languages ",-1))]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",Le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,s=>(e.openBlock(),e.createElementBlock("div",{key:s.language,class:"flex items-center gap-3"},[e.createElementVNode("span",Ae,e.toDisplayString(s.language),1),e.createElementVNode("div",qe,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${s.totalUsers/(_.value[0]?.totalUsers||1)*100}%`})},null,4)]),e.createElementVNode("span",Pe,e.toDisplayString(d(s.totalUsers)),1)]))),128)),_.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Oe,"No data"))])]),_:1})]),_:1}),e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(a,{class:"text-base flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.MapPin),{class:"size-4"}),t[15]||(t[15]=e.createTextVNode(" Top Cities ",-1))]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,s=>(e.openBlock(),e.createElementBlock("div",{key:`${s.city}-${s.country}`,class:"flex items-center gap-3"},[e.createElementVNode("div",We,[e.createElementVNode("span",He,e.toDisplayString(s.city),1),e.createElementVNode("span",Ie,e.toDisplayString(s.country),1)]),e.createElementVNode("div",Ke,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${s.totalUsers/(N.value[0]?.totalUsers||1)*100}%`})},null,4)]),e.createElementVNode("span",Ge,e.toDisplayString(d(s.totalUsers)),1)]))),128)),N.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Je,"No data"))])]),_:1})]),_:1})])],64)):(e.openBlock(),e.createBlock(l,{key:0,class:"p-8 text-center"},{default:e.withCtx(()=>[...t[1]||(t[1]=[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required",-1)])]),_:1}))])}}}),Xe=H._export_sfc(Qe,[["__scopeId","data-v-4f3ae270"]]);exports.default=Xe;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),D=require("@oneclick.dev/cms-kit");require("./index-DtSvAFLL.js");const r=require("lucide-vue-next"),z=require("./index-DUlYrnXH.js"),H=require("./_plugin-vue_export-helper-BHFhmbuH.js"),I={class:"flex flex-col gap-6 w-full max-w-7xl mx-auto py-8"},K={class:"flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center"},G={key:0,class:"flex items-center gap-2"},J={class:"flex items-center border rounded-lg overflow-hidden"},Q=["onClick"],X={class:"text-sm text-destructive font-medium"},Y={key:2,class:"flex items-center justify-center py-20"},Z={class:"flex flex-col @lg:grid @lg:grid-cols-3 gap-6"},ee={class:"relative"},te={class:"absolute inset-0 flex items-center justify-center pointer-events-none"},se={class:"text-center"},oe={class:"text-xl font-bold tabular-nums"},ne={class:"mt-4 flex items-center gap-6"},le={class:"flex items-center gap-2"},ae={class:"text-sm font-semibold tabular-nums"},re={key:0,class:"text-xs text-muted-foreground"},de={class:"flex items-center gap-2"},ce={class:"text-sm font-semibold tabular-nums"},ie={key:0,class:"text-xs text-muted-foreground"},ue={class:"overflow-x-auto"},me={class:"w-full text-sm"},xe={class:"divide-y"},fe={class:"px-4 py-3"},ge={class:"flex items-center gap-2"},pe={class:"font-medium capitalize"},ve={class:"px-4 py-3 text-right tabular-nums"},he={class:"px-4 py-3 text-right tabular-nums"},Ve={class:"px-4 py-3 text-right tabular-nums"},_e={class:"px-4 py-3 text-right tabular-nums"},Ne={class:"px-4 py-3 text-right tabular-nums"},ye={class:"overflow-x-auto"},be={class:"min-w-[600px]"},Ee={class:"flex items-center mb-1.5"},ke={class:"flex-1 grid grid-cols-24 gap-0.5"},Ce={class:"w-10 shrink-0 text-xs text-muted-foreground"},we={class:"flex-1 grid grid-cols-24 gap-0.5"},Be=["title"],De={class:"grid @lg:grid-cols-3 gap-6"},Se={class:"flex items-center justify-between"},$e={class:"flex items-center gap-1"},ze=["onClick","title"],Re={class:"space-y-3"},Ue={class:"text-sm flex-1 truncate"},Te={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Fe={class:"text-xs tabular-nums text-muted-foreground w-12 text-right"},Me={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Le={class:"space-y-3"},Ae={class:"text-sm flex-1 truncate"},qe={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Pe={class:"text-xs tabular-nums text-muted-foreground w-12 text-right"},Oe={key:0,class:"py-4 text-center text-muted-foreground text-sm"},je={class:"space-y-2.5"},We={class:"flex-1 min-w-0"},He={class:"text-sm truncate block"},Ie={class:"text-xs text-muted-foreground truncate block"},Ke={class:"flex-1 h-2 bg-muted rounded-full overflow-hidden"},Ge={class:"text-xs tabular-nums text-muted-foreground w-12 text-right"},Je={key:0,class:"py-4 text-center text-muted-foreground text-sm"},Qe=e.defineComponent({__name:"Audience",setup(Ye){const{config:S}=D.useModule(),{moduleId:R}=D.useModuleRoute();D.useModuleBreadcrumbs(()=>[{label:"Audience"}]);const u=e.ref(!0),h=e.ref(null),g=e.ref("30"),i=e.ref("browser"),V=e.ref([]),p=e.ref([]),_=e.ref([]),$=e.ref([]),N=e.ref([]),y=e.computed(()=>!!(S.serviceAccount&&S.propertyId));function m(o){return`/api/v1/modules/${R}${o}`}const U=[{label:"7d",value:"7"},{label:"14d",value:"14"},{label:"30d",value:"30"},{label:"90d",value:"90"}];function d(o){return o>=1e6?`${(o/1e6).toFixed(1)}M`:o>=1e3?`${(o/1e3).toFixed(1)}K`:Math.round(o).toString()}function T(o){return`${(o*100).toFixed(1)}%`}function F(o){const t=Math.floor(o/60),n=Math.round(o%60);return t>0?`${t}m ${n}s`:`${n}s`}const x={new:"#3b82f6",returning:"#8b5cf6"},M={new:{label:"New Users",color:x.new},returning:{label:"Returning Users",color:x.returning}},b=e.computed(()=>V.value.find(t=>t.newVsReturning==="new")?.totalUsers||0),E=e.computed(()=>V.value.find(t=>t.newVsReturning==="returning")?.totalUsers||0),L=e.computed(()=>[{key:"new",label:"New",value:b.value,fill:x.new},{key:"returning",label:"Returning",value:E.value,fill:x.returning}]),v=e.computed(()=>b.value+E.value),A=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],q=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],B=e.computed(()=>{const o=Array.from({length:7},()=>Array(24).fill(0));let t=1;return $.value.forEach(n=>{const l=A.indexOf(n.dayOfWeekName),a=parseInt(n.hour,10);l>=0&&a>=0&&a<24&&(o[l][a]=n.sessions||0,n.sessions>t&&(t=n.sessions))}),{matrix:o,maxVal:t}});function P(o,t){if(o===0)return"bg-muted";const n=o/t;return n>.75?"bg-blue-600 dark:bg-blue-500":n>.5?"bg-blue-500 dark:bg-blue-400":n>.25?"bg-blue-400/70 dark:bg-blue-400/60":"bg-blue-300/50 dark:bg-blue-300/30"}const O=[{key:"browser",label:"Browser",icon:r.Chrome},{key:"operatingSystem",label:"OS",icon:r.Cpu},{key:"screenResolution",label:"Screen",icon:r.Monitor}];async function k(){if(!y.value)return;u.value=!0,h.value=null;const o=`${g.value}daysAgo`;try{const[t,n,l,a,c]=await Promise.all([$fetch(m(`/audience/overview?startDate=${o}&endDate=today`)),$fetch(m(`/audience/technology?startDate=${o}&endDate=today&dimension=${i.value}`)),$fetch(m(`/audience/languages?startDate=${o}&endDate=today`)),$fetch(m(`/audience/hours?startDate=${o}&endDate=today`)),$fetch(m(`/audience/cities?startDate=${o}&endDate=today`))]);V.value=t.rows||[],p.value=n.rows||[],_.value=l.rows||[],$.value=a.rows||[],N.value=c.rows||[]}catch(t){h.value=t?.data?.statusMessage||t?.message||"Failed to load audience data"}finally{u.value=!1}}async function j(){const o=`${g.value}daysAgo`;try{const t=await $fetch(m(`/audience/technology?startDate=${o}&endDate=today&dimension=${i.value}`));p.value=t.rows||[]}catch{}}return e.watch(g,()=>k()),e.watch(i,()=>j()),e.onMounted(()=>{y.value?k():u.value=!1}),(o,t)=>{const n=e.resolveComponent("Button"),l=e.resolveComponent("Card"),a=e.resolveComponent("CardTitle"),c=e.resolveComponent("CardHeader"),W=e.resolveComponent("ChartContainer"),f=e.resolveComponent("CardContent");return e.openBlock(),e.createElementBlock("div",I,[e.createElementVNode("div",K,[t[0]||(t[0]=e.createElementVNode("div",null,[e.createElementVNode("h1",{class:"text-2xl font-semibold"},"Audience"),e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"},"Who visits your site")],-1)),y.value?(e.openBlock(),e.createElementBlock("div",G,[e.createElementVNode("div",J,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(U,s=>e.createElementVNode("button",{key:s.value,class:e.normalizeClass(["px-3 py-1.5 text-xs font-medium transition-colors",g.value===s.value?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted"]),onClick:C=>g.value=s.value},e.toDisplayString(s.label),11,Q)),64))]),e.createVNode(n,{variant:"outline",size:"icon",onClick:k,disabled:u.value},{default:e.withCtx(()=>[e.createVNode(e.unref(r.RefreshCw),{class:e.normalizeClass(["size-4",{"animate-spin":u.value}])},null,8,["class"])]),_:1},8,["disabled"])])):e.createCommentVNode("",!0)]),y.value?h.value?(e.openBlock(),e.createBlock(l,{key:1,class:"p-6 border-destructive/50 bg-destructive/5"},{default:e.withCtx(()=>[e.createElementVNode("p",X,e.toDisplayString(h.value),1),e.createVNode(n,{variant:"outline",size:"sm",class:"mt-3",onClick:k},{default:e.withCtx(()=>[...t[2]||(t[2]=[e.createTextVNode("Retry",-1)])]),_:1})]),_:1})):u.value?(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(e.unref(r.Loader2),{class:"size-8 animate-spin text-muted-foreground"})])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createElementVNode("div",Z,[e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(a,{class:"text-base"},{default:e.withCtx(()=>[...t[3]||(t[3]=[e.createTextVNode("New vs Returning",-1)])]),_:1})]),_:1}),e.createVNode(f,{class:"flex flex-col items-center"},{default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(W,{config:M,class:"mx-auto aspect-square max-h-[200px]"},{default:e.withCtx(()=>[e.createVNode(e.unref(z.b),{data:L.value,margin:{top:16,bottom:16,left:16,right:16}},{default:e.withCtx(()=>[e.createVNode(e.unref(z.E),{value:s=>s.value,color:s=>s.fill,arcWidth:35,padAngle:.03,cornerRadius:4},null,8,["value","color"])]),_:1},8,["data"])]),_:1}),e.createElementVNode("div",te,[e.createElementVNode("div",se,[e.createElementVNode("p",oe,e.toDisplayString(d(v.value)),1),t[4]||(t[4]=e.createElementVNode("p",{class:"text-xs text-muted-foreground"},"total users",-1))])])]),e.createElementVNode("div",ne,[e.createElementVNode("div",le,[e.createElementVNode("div",{class:"size-2.5 rounded-full",style:e.normalizeStyle({backgroundColor:x.new})},null,4),t[5]||(t[5]=e.createElementVNode("span",{class:"text-sm"},"New",-1)),e.createElementVNode("span",ae,e.toDisplayString(d(b.value)),1),v.value?(e.openBlock(),e.createElementBlock("span",re,e.toDisplayString(Math.round(b.value/v.value*100))+"%",1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",de,[e.createElementVNode("div",{class:"size-2.5 rounded-full",style:e.normalizeStyle({backgroundColor:x.returning})},null,4),t[6]||(t[6]=e.createElementVNode("span",{class:"text-sm"},"Returning",-1)),e.createElementVNode("span",ce,e.toDisplayString(d(E.value)),1),v.value?(e.openBlock(),e.createElementBlock("span",ie,e.toDisplayString(Math.round(E.value/v.value*100))+"%",1)):e.createCommentVNode("",!0)])])]),_:1})]),_:1}),e.createVNode(l,{class:"@lg:col-span-2"},{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(a,{class:"text-base"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Engagement by Visitor Type",-1)])]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",ue,[e.createElementVNode("table",me,[t[8]||(t[8]=e.createElementVNode("thead",null,[e.createElementVNode("tr",{class:"border-b text-left"},[e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground"},"Type"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Users"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Sessions"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Engagement Rate"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Avg Duration"),e.createElementVNode("th",{class:"px-4 py-3 font-medium text-muted-foreground text-right"},"Pages/Session")])],-1)),e.createElementVNode("tbody",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,s=>(e.openBlock(),e.createElementBlock("tr",{key:s.newVsReturning,class:"hover:bg-muted/50"},[e.createElementVNode("td",fe,[e.createElementVNode("div",ge,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.newVsReturning==="new"?e.unref(r.UserPlus):e.unref(r.UserCheck)),{class:"size-4 text-muted-foreground"})),e.createElementVNode("span",pe,e.toDisplayString(s.newVsReturning),1)])]),e.createElementVNode("td",ve,e.toDisplayString(d(s.totalUsers)),1),e.createElementVNode("td",he,e.toDisplayString(d(s.sessions)),1),e.createElementVNode("td",Ve,e.toDisplayString(T(s.engagementRate||0)),1),e.createElementVNode("td",_e,e.toDisplayString(F(s.averageSessionDuration||0)),1),e.createElementVNode("td",Ne,e.toDisplayString((s.screenPageViewsPerSession||0).toFixed(1)),1)]))),128))])])])]),_:1})]),_:1})]),e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(a,{class:"text-base flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.Clock),{class:"size-4"}),t[9]||(t[9]=e.createTextVNode(" Peak Hours ",-1))]),_:1}),t[10]||(t[10]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-1"},"When your visitors are most active (based on sessions)",-1))]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",ye,[e.createElementVNode("div",be,[e.createElementVNode("div",Ee,[t[11]||(t[11]=e.createElementVNode("div",{class:"w-10 shrink-0"},null,-1)),e.createElementVNode("div",ke,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(24,s=>e.createElementVNode("div",{key:s,class:"text-[10px] text-muted-foreground text-center"},e.toDisplayString(s-1),1)),64))])]),(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(q,(s,C)=>e.createElementVNode("div",{key:s,class:"flex items-center mb-0.5"},[e.createElementVNode("div",Ce,e.toDisplayString(s),1),e.createElementVNode("div",we,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(24,w=>e.createElementVNode("div",{key:w,class:e.normalizeClass(["aspect-square rounded-sm transition-colors",P(B.value.matrix[C]?.[w-1]||0,B.value.maxVal)]),title:`${s} ${w-1}:00 — ${B.value.matrix[C]?.[w-1]||0} sessions`},null,10,Be)),64))])])),64)),t[12]||(t[12]=e.createElementVNode("div",{class:"flex items-center justify-end gap-1.5 mt-3"},[e.createElementVNode("span",{class:"text-[10px] text-muted-foreground"},"Less"),e.createElementVNode("div",{class:"size-3 rounded-sm bg-muted"}),e.createElementVNode("div",{class:"size-3 rounded-sm bg-blue-300/50 dark:bg-blue-300/30"}),e.createElementVNode("div",{class:"size-3 rounded-sm bg-blue-400/70 dark:bg-blue-400/60"}),e.createElementVNode("div",{class:"size-3 rounded-sm bg-blue-500 dark:bg-blue-400"}),e.createElementVNode("div",{class:"size-3 rounded-sm bg-blue-600 dark:bg-blue-500"}),e.createElementVNode("span",{class:"text-[10px] text-muted-foreground"},"More")],-1))])])]),_:1})]),_:1}),e.createElementVNode("div",De,[e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createElementVNode("div",Se,[e.createVNode(a,{class:"text-base"},{default:e.withCtx(()=>[...t[13]||(t[13]=[e.createTextVNode("Technology",-1)])]),_:1}),e.createElementVNode("div",$e,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(O,s=>e.createElementVNode("button",{key:s.key,class:e.normalizeClass(["p-1.5 rounded-md transition-colors",i.value===s.key?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"]),onClick:C=>i.value=s.key,title:s.label},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.icon),{class:"size-3.5"}))],10,ze)),64))])])]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,s=>(e.openBlock(),e.createElementBlock("div",{key:s[i.value],class:"flex items-center gap-3"},[e.createElementVNode("span",Ue,e.toDisplayString(s[i.value]||"(not set)"),1),e.createElementVNode("div",Te,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${s.totalUsers/(p.value[0]?.totalUsers||1)*100}%`})},null,4)]),e.createElementVNode("span",Fe,e.toDisplayString(d(s.totalUsers)),1)]))),128)),p.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Me,"No data"))])]),_:1})]),_:1}),e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(a,{class:"text-base flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.Languages),{class:"size-4"}),t[14]||(t[14]=e.createTextVNode(" Languages ",-1))]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",Le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,s=>(e.openBlock(),e.createElementBlock("div",{key:s.language,class:"flex items-center gap-3"},[e.createElementVNode("span",Ae,e.toDisplayString(s.language),1),e.createElementVNode("div",qe,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${s.totalUsers/(_.value[0]?.totalUsers||1)*100}%`})},null,4)]),e.createElementVNode("span",Pe,e.toDisplayString(d(s.totalUsers)),1)]))),128)),_.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Oe,"No data"))])]),_:1})]),_:1}),e.createVNode(l,null,{default:e.withCtx(()=>[e.createVNode(c,{class:"pb-2"},{default:e.withCtx(()=>[e.createVNode(a,{class:"text-base flex items-center gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(r.MapPin),{class:"size-4"}),t[15]||(t[15]=e.createTextVNode(" Top Cities ",-1))]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,s=>(e.openBlock(),e.createElementBlock("div",{key:`${s.city}-${s.country}`,class:"flex items-center gap-3"},[e.createElementVNode("div",We,[e.createElementVNode("span",He,e.toDisplayString(s.city),1),e.createElementVNode("span",Ie,e.toDisplayString(s.country),1)]),e.createElementVNode("div",Ke,[e.createElementVNode("div",{class:"h-full bg-primary rounded-full transition-all",style:e.normalizeStyle({width:`${s.totalUsers/(N.value[0]?.totalUsers||1)*100}%`})},null,4)]),e.createElementVNode("span",Ge,e.toDisplayString(d(s.totalUsers)),1)]))),128)),N.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Je,"No data"))])]),_:1})]),_:1})])],64)):(e.openBlock(),e.createBlock(l,{key:0,class:"p-8 text-center"},{default:e.withCtx(()=>[...t[1]||(t[1]=[e.createElementVNode("p",{class:"text-lg font-medium"},"Setup required",-1)])]),_:1}))])}}}),Xe=H._export_sfc(Qe,[["__scopeId","data-v-4f3ae270"]]);exports.default=Xe;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as oe, ref as m, computed as C, watch as q, onMounted as re, resolveComponent as $, openBlock as o, createElementBlock as r, createElementVNode as e, Fragment as f, renderList as g, normalizeClass as E, toDisplayString as u, createVNode as l, withCtx as n, unref as x, createCommentVNode as R, createBlock as W, createTextVNode as b, normalizeStyle as M, resolveDynamicComponent as K } from "vue";
|
|
2
2
|
import { useModule as ue, useModuleRoute as de, useModuleBreadcrumbs as ie } from "@oneclick.dev/cms-kit";
|
|
3
|
-
import "./index-
|
|
3
|
+
import "./index-CkVwMqpn.mjs";
|
|
4
4
|
import { RefreshCw as ce, Loader2 as fe, UserPlus as me, UserCheck as ge, Clock as xe, Chrome as ve, Cpu as _e, Monitor as pe, Languages as be, MapPin as he } from "lucide-vue-next";
|
|
5
|
-
import {
|
|
5
|
+
import { b as ye, E as ke } from "./index-DZV720u-.mjs";
|
|
6
6
|
import { _ as we } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
7
7
|
const Ce = { class: "flex flex-col gap-6 w-full max-w-7xl mx-auto py-8" }, $e = { class: "flex justify-between gap-4 flex-col @lg:flex-row @lg:items-center" }, Re = {
|
|
8
8
|
key: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),m=require("lucide-vue-next"),k=require("@oneclick.dev/cms-kit"),S={class:"grid py-4"},Z={class:"flex gap-6 mb-6"},F={class:"w-1/2"},I={class:"w-1/2"},U={class:"flex gap-6 mb-6"},q={class:"w-1/2"},A={class:"w-1/2"},O={class:"grid grid-cols-3 bg-input/30 rounded border divide-x divide-input/30 mb-6"},P=e.defineComponent({__name:"ComponentDialog",emits:["add","edit","delete"],setup(s,{expose:V,emit:v}){const{confirm:C}=k.useConfirmation(),i=v,r=e.ref(!1),l=e.ref("create"),a=e.ref(""),d=e.ref(""),p=e.ref(""),f=e.ref(""),n=e.ref(""),o=e.ref("layout"),u=e.ref([]),y=x=>{x?(l.value="edit",a.value=x.id,d.value=x.displayName||"",p.value=x.name||"",f.value=x.tint||"",n.value=x.icon||"",o.value=x.componentType||"layout",u.value=x.formLayout||[]):(l.value="create",a.value="",d.value="",p.value="",f.value="",n.value="",o.value="layout",u.value=[]),r.value=!0},N=()=>{i("add",{id:crypto.randomUUID(),displayName:d.value,name:p.value,tint:f.value,icon:n.value,componentType:o.value,formLayout:u.value}),r.value=!1},b=()=>{i("edit",{id:a.value,displayName:d.value,name:p.value,tint:f.value,icon:n.value,componentType:o.value,formLayout:u.value}),r.value=!1},w=async()=>{await C("Are you sure you want to delete this component? This action cannot be undone.","Delete Component","Delete")&&(i("delete",a.value),r.value=!1)};return V({openDialog:y}),(x,t)=>{const g=e.resolveComponent("DialogTitle"),_=e.resolveComponent("DialogDescription"),D=e.resolveComponent("DialogHeader"),h=e.resolveComponent("Input"),L=e.resolveComponent("TailwindColorPicker"),T=e.resolveComponent("LucideIconPicker"),$=e.resolveComponent("FormBuilderSelect"),E=e.resolveComponent("Button"),H=e.resolveComponent("DialogFooter"),M=e.resolveComponent("DialogScrollContent"),z=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(z,{open:r.value,"onUpdate:open":t[8]||(t[8]=c=>r.value=c)},{default:e.withCtx(()=>[e.createVNode(M,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(D,null,{default:e.withCtx(()=>[e.createVNode(g,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value==="create"?"Add New Component":"Update Component"),1)]),_:1}),e.createVNode(_,null,{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode(" Connect the components from your front-end to build pages with them. ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",S,[e.createElementVNode("div",Z,[e.createElementVNode("div",F,[t[10]||(t[10]=e.createElementVNode("label",{for:"component-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Display Name",-1)),e.createVNode(h,{modelValue:d.value,"onUpdate:modelValue":t[0]||(t[0]=c=>d.value=c),placeholder:"Display Name",id:"component-dialog-display-name"},null,8,["modelValue"]),t[11]||(t[11]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-2"}," This is the name that the user will see in the component list. ",-1))]),e.createElementVNode("div",I,[t[12]||(t[12]=e.createElementVNode("label",{for:"component-dialog-component-name",class:"text-sm mb-1 block font-medium"},"Component Name",-1)),e.createVNode(h,{modelValue:p.value,"onUpdate:modelValue":t[1]||(t[1]=c=>p.value=c),placeholder:"Component Name",id:"component-dialog-component-name"},null,8,["modelValue"]),t[13]||(t[13]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-2"}," How is the component called in your front-end? ",-1))])]),e.createElementVNode("div",U,[e.createElementVNode("div",q,[t[14]||(t[14]=e.createElementVNode("label",{for:"component-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Tint",-1)),e.createVNode(L,{modelValue:f.value,"onUpdate:modelValue":t[2]||(t[2]=c=>f.value=c),"default-value":"white"},null,8,["modelValue"])]),e.createElementVNode("div",A,[t[15]||(t[15]=e.createElementVNode("label",{for:"component-dialog-component-name",class:"text-sm mb-1 block font-medium"},"Icon",-1)),e.createVNode(T,{modelValue:n.value,"onUpdate:modelValue":t[3]||(t[3]=c=>n.value=c)},null,8,["modelValue"])])]),t[22]||(t[22]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Component Type ",-1)),e.createElementVNode("div",O,[e.createElementVNode("button",{class:e.normalizeClass(["flex flex-col p-6 hover:bg-input/30 transition-all duration-300",{"bg-input/50 hover:bg-input/50":o.value=="layout"}]),onClick:t[4]||(t[4]=c=>o.value="layout")},[t[16]||(t[16]=e.createElementVNode("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"dark:invert dark:opacity-30 mx-auto mb-4"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10 6C7.79086 6 6 7.79086 6 10V15H0V10C0 4.47715 4.47715 0 10 0H15V6H10ZM35 6H25V0H35V6ZM50 6H45V0H50C55.5229 0 60 4.47715 60 10V15H54V10C54 7.79086 52.2091 6 50 6ZM6 25V35H0V25H6ZM54 35V25H60V35H54ZM6 45V50C6 52.2091 7.79086 54 10 54H15V60H10C4.47715 60 0 55.5228 0 50V45H6ZM54 50V45H60V50C60 55.5229 55.5228 60 50 60H45V54H50C52.2091 54 54 52.2091 54 50ZM25 54H35V60H25V54Z",fill:"black"})],-1)),t[17]||(t[17]=e.createElementVNode("div",{class:"mb-auto"},[e.createElementVNode("strong",{class:"text-sm mb-1"},"Layout Component"),e.createElementVNode("p",{class:"text-xs text-muted-foreground"}," Helps setting up the overall structure or layout of the page. (Examples: Section, 2 Column Grid, ...) ")],-1)),o.value!="layout"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 mx-auto mt-4"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheck),{key:1,class:"size-4 mx-auto mt-4"}))],2),e.createElementVNode("button",{class:e.normalizeClass(["flex flex-col p-6 hover:bg-input/30 transition-all duration-300",{"bg-input/50 hover:bg-input/50":o.value=="content"}]),onClick:t[5]||(t[5]=c=>o.value="content")},[t[18]||(t[18]=e.createElementVNode("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"dark:invert dark:opacity-30 mx-auto mb-4"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 10C0 4.47715 4.47715 0 10 0H50C55.5229 0 60 4.47715 60 10V50C60 55.5229 55.5228 60 50 60H10C4.47715 60 0 55.5228 0 50V10ZM10 6C7.79086 6 6 7.79086 6 10V50C6 52.2091 7.79086 54 10 54H50C52.2091 54 54 52.2091 54 50V10C54 7.79086 52.2091 6 50 6H10Z",fill:"black"})],-1)),t[19]||(t[19]=e.createElementVNode("div",{class:"mb-auto"},[e.createElementVNode("strong",{class:"text-sm mb-1"},"Content Component"),e.createElementVNode("p",{class:"text-xs text-muted-foreground"}," Aimed at hosting and displaying unique content. (Examples: Text, Link, Image, ...) ")],-1)),o.value!="content"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 mx-auto mt-4"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheck),{key:1,class:"size-4 mx-auto mt-4"}))],2),e.createElementVNode("button",{class:e.normalizeClass(["flex flex-col p-6 hover:bg-input/30 transition-all duration-300",{"bg-input/50 hover:bg-input/50":o.value=="hybrid"}]),onClick:t[6]||(t[6]=c=>o.value="hybrid")},[t[20]||(t[20]=e.createElementVNode("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"dark:invert dark:opacity-30 mx-auto mb-4"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M54 10C54 7.79086 52.2091 6 50 6L45 6L45 -6.55671e-07L50 -4.37114e-07C55.5228 -1.95703e-07 60 4.47715 60 10L60 15L54 15L54 10ZM54 50L54 15L60 15L60 50C60 55.5229 55.5228 60 50 60L15 60L15 54L50 54C52.2091 54 54 52.2091 54 50ZM35 6L25 6L25 -1.5299e-06L35 -1.09278e-06L35 6ZM15 6L10 6C7.79086 6 6 7.79086 6 10L6 15L-6.55671e-07 15L-4.37114e-07 10C-1.95703e-07 4.47715 4.47715 -2.42698e-06 10 -2.18557e-06L15 -1.96701e-06L15 6ZM10 54L15 54L15 60L10 60C4.47715 60 -2.42698e-06 55.5228 -2.18557e-06 50L-1.96701e-06 45L6 45L6 50C6 52.2091 7.79086 54 10 54ZM6 25L6 35L-1.5299e-06 35L-1.09278e-06 25L6 25Z",fill:"black"})],-1)),t[21]||(t[21]=e.createElementVNode("div",{class:"mb-auto"},[e.createElementVNode("strong",{class:"text-sm mb-1"},"Hybrid Component"),e.createElementVNode("p",{class:"text-xs text-muted-foreground"}," These serve as both layout and content components, unlocking complex layouts. ")],-1)),o.value!="hybrid"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 mx-auto mt-4"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheck),{key:1,class:"size-4 mx-auto mt-4"}))],2)]),t[23]||(t[23]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Form Layout ",-1)),t[24]||(t[24]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mb-2"}," This will be the form that the client can fill in to populate this component. ",-1)),e.createElementVNode("div",null,[e.createVNode($,{modelValue:u.value,"onUpdate:modelValue":t[7]||(t[7]=c=>u.value=c),buildText:"Edit Form Layout",editText:"Edit Form Layout"},null,8,["modelValue"])])]),e.createVNode(H,null,{default:e.withCtx(()=>[l.value==="edit"?(e.openBlock(),e.createBlock(E,{key:0,variant:"destructive",class:"mr-auto",onClick:w},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Delete Component ",-1)])]),_:1})):e.createCommentVNode("",!0),l.value==="create"?(e.openBlock(),e.createBlock(E,{key:1,type:"submit",onClick:N},{default:e.withCtx(()=>[...t[26]||(t[26]=[e.createTextVNode(" Add Component ",-1)])]),_:1})):(e.openBlock(),e.createBlock(E,{key:2,type:"submit",onClick:b},{default:e.withCtx(()=>[...t[27]||(t[27]=[e.createTextVNode(" Edit Component ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),j={class:"w-full truncate text-sm font-medium"},G={class:"w-full truncate text-xs text-muted-foreground"},B=e.defineComponent({__name:"ComponentGridItem",props:{component:{type:Object,required:!0}},emits:["edit"],setup(s,{emit:V}){const v=V;return(C,i)=>{const r=e.resolveComponent("Skeleton"),l=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("button",{onClick:i[0]||(i[0]=a=>v("edit")),class:"basis-[100px] max-w-[200px] @7xl:max-w-xs"},[e.createVNode(l,{class:"flex flex-col items-center px-4 py-4 gap-0 hover:bg-input/30"},{default:e.withCtx(()=>[s.component.icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(`${s.component.tint?"bg-"+s.component.tint:"bg-input/50"} rounded-lg p-4 mb-2`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(m.icons)[s.component.icon]),{class:"size-16 @5xl:size-22 @7xl:size-28"}))],2)):(e.openBlock(),e.createBlock(r,{key:1,class:"size-24 @5xl:size-30 @7xl:size-36 mb-2"})),e.createElementVNode("p",j,e.toDisplayString(s.component.displayName),1),e.createElementVNode("p",G,e.toDisplayString(s.component.name),1)]),_:1})])}}}),R={class:"flex flex-col gap-2 mb-12"},K={class:"flex items-start gap-4 overflow-hidden"},Y={class:"flex flex-col text-left"},J={class:"text-sm font-semibold"},Q={key:0,class:"text-xs text-muted-foreground/70 dark:text-muted-foreground/50 line-clamp-2 whitespace-normal mt-2"},W=e.defineComponent({__name:"VerticalToggle",props:{modelValue:{type:Array,required:!0},options:{type:Array,required:!0}},emits:["update:modelValue"],setup(s,{emit:V}){const v=s,C=V,i=e.computed({get(){return v.modelValue},set(a){C("update:modelValue",a)}}),r=e.ref("full"),l=a=>{i.value.includes(a)?i.value=i.value.filter(d=>d!==a):i.value.push(a)};return(a,d)=>{const p=e.resolveComponent("SegmentedControlButton"),f=e.resolveComponent("SegmentedControl"),n=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(f,{modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=o=>r.value=o),class:"grid grid-cols-2 mb-4 w-28 scale-75 origin-left opacity-50 transition-all duration-300 hover:opacity-100"},{default:e.withCtx(()=>[e.createVNode(p,{value:"minimal"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.Baseline),{class:"size-5 mx-auto"})]),_:1}),e.createVNode(p,{value:"full"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.LetterText),{class:"size-5 mx-auto"})]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",R,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.options,o=>(e.openBlock(),e.createBlock(n,{variant:"ghost",key:o.value,class:e.normalizeClass(["flex-1 transition-all duration-300 active:scale-95 rounded-md justify-start w-full h-auto cursor-pointer border",s.modelValue.includes(o.value)?"bg-white hover:bg-white dark:bg-input/30 dark:hover:bg-input/30 shadow-xs":"hover:bg-transparent"]),onClick:u=>l(o.value)},{default:e.withCtx(()=>[e.createElementVNode("div",K,[e.createVNode(e.unref(m.Check),{class:e.normalizeClass(["size-5 text-muted-foreground transition-opacity duration-300",s.modelValue.includes(o.value)?"opacity-100":"opacity-0"])},null,8,["class"]),e.createElementVNode("div",Y,[e.createElementVNode("span",J,e.toDisplayString(o.text),1),r.value==="full"&&o.description?(e.openBlock(),e.createElementBlock("p",Q,e.toDisplayString(o.description),1)):e.createCommentVNode("",!0)])])]),_:2},1032,["class","onClick"]))),128))])])}}}),X={key:0,class:"truncate"},ee={key:1},te={class:"p-6 overflow-y-auto"},oe={class:"flex flex-col gap-3"},le={class:"flex items-start gap-4 overflow-hidden"},ne={class:"flex flex-col text-left"},ae={class:"text-sm font-semibold mb-2"},se={class:"text-xs text-muted-foreground line-clamp-2 whitespace-normal"},re=e.defineComponent({__name:"DrawerToggle",props:{modelValue:{type:Array,required:!0},options:{type:Array,required:!0}},emits:["update:modelValue"],setup(s,{emit:V}){const v=s,C=V,i=e.computed({get(){return v.modelValue},set(l){C("update:modelValue",l)}}),r=l=>{i.value.includes(l)?i.value=i.value.filter(a=>a!==l):i.value.push(l)};return(l,a)=>{const d=e.resolveComponent("Button"),p=e.resolveComponent("DrawerTrigger"),f=e.resolveComponent("DrawerContent"),n=e.resolveComponent("Drawer");return e.openBlock(),e.createBlock(n,null,{default:e.withCtx(()=>[e.createVNode(p,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline",class:"mb-2"},{default:e.withCtx(()=>[s.modelValue.length<4?(e.openBlock(),e.createElementBlock("p",X,e.toDisplayString(s.modelValue.join(", ")),1)):(e.openBlock(),e.createElementBlock("p",ee,e.toDisplayString(s.modelValue.slice(0,3).join(", "))+" + "+e.toDisplayString(s.modelValue.length-3)+" more ",1)),e.createVNode(e.unref(m.ChevronDown),{class:"size-4 text-muted-foreground translate-y-0.25 ml-4"})]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",te,[e.createElementVNode("div",oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.options,o=>(e.openBlock(),e.createBlock(d,{key:o.value,class:e.normalizeClass(["justify-start w-full h-auto cursor-pointer flex-1 transition-all duration-300 active:scale-95 rounded-md border border-transparent",s.modelValue.includes(o.value)?"bg-input/30 border-border":""]),variant:"ghost",onClick:u=>r(o.value)},{default:e.withCtx(()=>[e.createElementVNode("div",le,[e.createVNode(e.unref(m.Check),{class:e.normalizeClass(["size-5 text-muted-foreground transition-opacity duration-300",s.modelValue.includes(o.value)?"opacity-100":"opacity-0"])},null,8,["class"]),e.createElementVNode("div",ne,[e.createElementVNode("span",ae,e.toDisplayString(o.text),1),e.createElementVNode("p",se,e.toDisplayString(o.description),1)])])]),_:2},1032,["class","onClick"]))),128))])])]),_:1})]),_:1})}}}),ie={class:"w-full"},de={class:"flex items-center justify-between gap-4 w-full my-4"},ue={class:"flex flex-col space-y-8 @5xl:flex-row @5xl:space-x-12 @5xl:space-y-0"},ce={class:"hidden @5xl:block @5xl:w-1/4 @7xl:w-1/5"},me={class:"flex-1"},pe={class:"@5xl:hidden"},ve={class:"flex items-center justify-between w-full"},fe={class:"flex items-start gap-8"},xe={key:0,class:"mb-8"},Ve={class:"flex flex-wrap gap-4"},Ce={key:1,class:"mb-8"},ge={class:"flex flex-wrap gap-4"},ke={key:2,class:"mb-8"},ye={class:"flex flex-wrap gap-4"},Ne=e.defineComponent({__name:"Components",setup(s){const V=[{value:"hybrid",text:"Hybrid Components",icon:"",description:"These serve as both layout and content components, unlocking complex layouts."},{value:"layout",text:"Layout Component",icon:"",description:"Helps setting up the overall structure or layout of the page. (Examples: Section, 2 Column Grid, ...)"},{value:"content",text:"Content Component",icon:"",description:"Aimed at hosting and displaying unique content. (Examples: Text, Link, Image, ...)"}],{getModuleData:v,setModuleData:C}=k.useModuleStorage(),{navigateTo:i}=k.useModuleRoute();k.useModuleBreadcrumbs(()=>[{text:"Components"}]);const r=e.useTemplateRef("componentDialog"),l=e.ref([]),a=e.ref(["hybrid","layout","content"]),d=async n=>{l.value.push(n),l.value=await v("components")||[],l.value.push(n),C("components",l.value)},p=async n=>{let o=l.value.findIndex(u=>u.id===n.id);o!==-1&&(l.value[o]=n),l.value=await v("components")||[],o=l.value.findIndex(u=>u.id===n.id),o!==-1&&(l.value[o]=n,C("components",l.value))},f=async n=>{l.value=l.value.filter(o=>o.id!==n),l.value=await v("components")||[],l.value=l.value.filter(o=>o.id!==n),C("components",l.value)};return e.onMounted(()=>{v("components").then(n=>{l.value=n})}),(n,o)=>{const u=e.resolveComponent("Button"),y=e.resolveComponent("CardTitle"),N=e.resolveComponent("CardDescription"),b=e.resolveComponent("CardHeader"),w=e.resolveComponent("CardContent"),x=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",ie,[e.createElementVNode("div",de,[e.createVNode(u,{onClick:o[0]||(o[0]=t=>e.unref(i)("/")),variant:"link",class:"!pl-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ChevronLeft),{class:"size-4"}),o[4]||(o[4]=e.createTextVNode(" Collections ",-1))]),_:1})]),e.createElementVNode("div",ue,[e.createElementVNode("div",ce,[e.createVNode(W,{options:V,modelValue:a.value,"onUpdate:modelValue":o[1]||(o[1]=t=>a.value=t)},null,8,["modelValue"])]),e.createElementVNode("div",me,[e.createElementVNode("div",pe,[e.createVNode(re,{options:V,modelValue:a.value,"onUpdate:modelValue":o[2]||(o[2]=t=>a.value=t)},null,8,["modelValue"])]),e.createVNode(x,null,{default:e.withCtx(()=>[e.createVNode(b,null,{default:e.withCtx(()=>[e.createElementVNode("div",ve,[e.createElementVNode("div",null,[e.createVNode(y,null,{default:e.withCtx(()=>[...o[5]||(o[5]=[e.createTextVNode("Components",-1)])]),_:1}),e.createVNode(N,null,{default:e.withCtx(()=>[...o[6]||(o[6]=[e.createTextVNode("Manage your components here.",-1)])]),_:1})]),e.createVNode(u,{onClick:o[3]||(o[3]=t=>r.value.openDialog())},{default:e.withCtx(()=>[e.createVNode(e.unref(m.Plus),{class:"size-4"}),o[7]||(o[7]=e.createTextVNode(" New Component ",-1))]),_:1})])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createElementVNode("div",fe,[e.createElementVNode("div",null,[a.value.includes("hybrid")?(e.openBlock(),e.createElementBlock("div",xe,[o[8]||(o[8]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Hybrid Components",-1)),e.createElementVNode("div",Ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,t=>(e.openBlock(),e.createBlock(B,{key:t.name,onEdit:g=>r.value.openDialog(t),component:t},null,8,["onEdit","component"]))),128))])])):e.createCommentVNode("",!0),a.value.includes("layout")?(e.openBlock(),e.createElementBlock("div",Ce,[o[9]||(o[9]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Layout Components",-1)),e.createElementVNode("div",ge,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,t=>(e.openBlock(),e.createBlock(B,{key:t.name,onEdit:g=>r.value.openDialog(t),component:t},null,8,["onEdit","component"]))),128))])])):e.createCommentVNode("",!0),a.value.includes("content")?(e.openBlock(),e.createElementBlock("div",ke,[o[10]||(o[10]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Content Components",-1)),e.createElementVNode("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,t=>(e.openBlock(),e.createBlock(B,{key:t.name,onEdit:g=>r.value.openDialog(t),component:t},null,8,["onEdit","component"]))),128))])])):e.createCommentVNode("",!0)])])]),_:1})]),_:1})])])]),e.createVNode(P,{ref_key:"componentDialog",ref:r,onAdd:d,onEdit:p,onDelete:f},null,512)],64)}}});exports.default=Ne;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),m=require("lucide-vue-next"),k=require("@oneclick.dev/cms-kit"),S={class:"grid py-4"},Z={class:"flex gap-6 mb-6"},F={class:"w-1/2"},A={class:"w-1/2"},I={class:"flex gap-6 mb-6"},U={class:"w-1/2"},q={class:"w-1/2"},O={class:"grid grid-cols-3 bg-input/30 rounded border divide-x divide-input/30 mb-6"},P=e.defineComponent({__name:"ComponentDialog",emits:["add","edit","delete"],setup(s,{expose:V,emit:v}){const{confirm:C}=k.useConfirmation(),i=v,r=e.ref(!1),l=e.ref("create"),a=e.ref(""),d=e.ref(""),p=e.ref(""),f=e.ref(""),n=e.ref(""),o=e.ref("layout"),u=e.ref([]),y=x=>{x?(l.value="edit",a.value=x.id,d.value=x.displayName||"",p.value=x.name||"",f.value=x.tint||"",n.value=x.icon||"",o.value=x.componentType||"layout",u.value=x.formLayout||[]):(l.value="create",a.value="",d.value="",p.value="",f.value="",n.value="",o.value="layout",u.value=[]),r.value=!0},N=()=>{i("add",{id:crypto.randomUUID(),displayName:d.value,name:p.value,tint:f.value,icon:n.value,componentType:o.value,formLayout:u.value}),r.value=!1},b=()=>{i("edit",{id:a.value,displayName:d.value,name:p.value,tint:f.value,icon:n.value,componentType:o.value,formLayout:u.value}),r.value=!1},w=async()=>{await C("Are you sure you want to delete this component? This action cannot be undone.","Delete Component","Delete")&&(i("delete",a.value),r.value=!1)};return V({openDialog:y}),(x,t)=>{const g=e.resolveComponent("DialogTitle"),_=e.resolveComponent("DialogDescription"),D=e.resolveComponent("DialogHeader"),h=e.resolveComponent("Input"),L=e.resolveComponent("TailwindColorPicker"),T=e.resolveComponent("LucideIconPicker"),$=e.resolveComponent("FormBuilderSelect"),E=e.resolveComponent("Button"),H=e.resolveComponent("DialogFooter"),M=e.resolveComponent("DialogScrollContent"),z=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(z,{open:r.value,"onUpdate:open":t[8]||(t[8]=c=>r.value=c)},{default:e.withCtx(()=>[e.createVNode(M,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(D,null,{default:e.withCtx(()=>[e.createVNode(g,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value==="create"?"Add New Component":"Update Component"),1)]),_:1}),e.createVNode(_,null,{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode(" Connect the components from your front-end to build pages with them. ",-1)])]),_:1})]),_:1}),e.createElementVNode("div",S,[e.createElementVNode("div",Z,[e.createElementVNode("div",F,[t[10]||(t[10]=e.createElementVNode("label",{for:"component-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Display Name",-1)),e.createVNode(h,{modelValue:d.value,"onUpdate:modelValue":t[0]||(t[0]=c=>d.value=c),placeholder:"Display Name",id:"component-dialog-display-name"},null,8,["modelValue"]),t[11]||(t[11]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-2"}," This is the name that the user will see in the component list. ",-1))]),e.createElementVNode("div",A,[t[12]||(t[12]=e.createElementVNode("label",{for:"component-dialog-component-name",class:"text-sm mb-1 block font-medium"},"Component Name",-1)),e.createVNode(h,{modelValue:p.value,"onUpdate:modelValue":t[1]||(t[1]=c=>p.value=c),placeholder:"Component Name",id:"component-dialog-component-name"},null,8,["modelValue"]),t[13]||(t[13]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mt-2"}," How is the component called in your front-end? ",-1))])]),e.createElementVNode("div",I,[e.createElementVNode("div",U,[t[14]||(t[14]=e.createElementVNode("label",{for:"component-dialog-display-name",class:"text-sm mb-1 block font-medium"},"Tint",-1)),e.createVNode(L,{modelValue:f.value,"onUpdate:modelValue":t[2]||(t[2]=c=>f.value=c),"default-value":"white"},null,8,["modelValue"])]),e.createElementVNode("div",q,[t[15]||(t[15]=e.createElementVNode("label",{for:"component-dialog-component-name",class:"text-sm mb-1 block font-medium"},"Icon",-1)),e.createVNode(T,{modelValue:n.value,"onUpdate:modelValue":t[3]||(t[3]=c=>n.value=c)},null,8,["modelValue"])])]),t[22]||(t[22]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Component Type ",-1)),e.createElementVNode("div",O,[e.createElementVNode("button",{class:e.normalizeClass(["flex flex-col p-6 hover:bg-input/30 transition-all duration-300",{"bg-input/50 hover:bg-input/50":o.value=="layout"}]),onClick:t[4]||(t[4]=c=>o.value="layout")},[t[16]||(t[16]=e.createElementVNode("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"dark:invert dark:opacity-30 mx-auto mb-4"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M10 6C7.79086 6 6 7.79086 6 10V15H0V10C0 4.47715 4.47715 0 10 0H15V6H10ZM35 6H25V0H35V6ZM50 6H45V0H50C55.5229 0 60 4.47715 60 10V15H54V10C54 7.79086 52.2091 6 50 6ZM6 25V35H0V25H6ZM54 35V25H60V35H54ZM6 45V50C6 52.2091 7.79086 54 10 54H15V60H10C4.47715 60 0 55.5228 0 50V45H6ZM54 50V45H60V50C60 55.5229 55.5228 60 50 60H45V54H50C52.2091 54 54 52.2091 54 50ZM25 54H35V60H25V54Z",fill:"black"})],-1)),t[17]||(t[17]=e.createElementVNode("div",{class:"mb-auto"},[e.createElementVNode("strong",{class:"text-sm mb-1"},"Layout Component"),e.createElementVNode("p",{class:"text-xs text-muted-foreground"}," Helps setting up the overall structure or layout of the page. (Examples: Section, 2 Column Grid, ...) ")],-1)),o.value!="layout"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 mx-auto mt-4"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheck),{key:1,class:"size-4 mx-auto mt-4"}))],2),e.createElementVNode("button",{class:e.normalizeClass(["flex flex-col p-6 hover:bg-input/30 transition-all duration-300",{"bg-input/50 hover:bg-input/50":o.value=="content"}]),onClick:t[5]||(t[5]=c=>o.value="content")},[t[18]||(t[18]=e.createElementVNode("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"dark:invert dark:opacity-30 mx-auto mb-4"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0 10C0 4.47715 4.47715 0 10 0H50C55.5229 0 60 4.47715 60 10V50C60 55.5229 55.5228 60 50 60H10C4.47715 60 0 55.5228 0 50V10ZM10 6C7.79086 6 6 7.79086 6 10V50C6 52.2091 7.79086 54 10 54H50C52.2091 54 54 52.2091 54 50V10C54 7.79086 52.2091 6 50 6H10Z",fill:"black"})],-1)),t[19]||(t[19]=e.createElementVNode("div",{class:"mb-auto"},[e.createElementVNode("strong",{class:"text-sm mb-1"},"Content Component"),e.createElementVNode("p",{class:"text-xs text-muted-foreground"}," Aimed at hosting and displaying unique content. (Examples: Text, Link, Image, ...) ")],-1)),o.value!="content"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 mx-auto mt-4"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheck),{key:1,class:"size-4 mx-auto mt-4"}))],2),e.createElementVNode("button",{class:e.normalizeClass(["flex flex-col p-6 hover:bg-input/30 transition-all duration-300",{"bg-input/50 hover:bg-input/50":o.value=="hybrid"}]),onClick:t[6]||(t[6]=c=>o.value="hybrid")},[t[20]||(t[20]=e.createElementVNode("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"dark:invert dark:opacity-30 mx-auto mb-4"},[e.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M54 10C54 7.79086 52.2091 6 50 6L45 6L45 -6.55671e-07L50 -4.37114e-07C55.5228 -1.95703e-07 60 4.47715 60 10L60 15L54 15L54 10ZM54 50L54 15L60 15L60 50C60 55.5229 55.5228 60 50 60L15 60L15 54L50 54C52.2091 54 54 52.2091 54 50ZM35 6L25 6L25 -1.5299e-06L35 -1.09278e-06L35 6ZM15 6L10 6C7.79086 6 6 7.79086 6 10L6 15L-6.55671e-07 15L-4.37114e-07 10C-1.95703e-07 4.47715 4.47715 -2.42698e-06 10 -2.18557e-06L15 -1.96701e-06L15 6ZM10 54L15 54L15 60L10 60C4.47715 60 -2.42698e-06 55.5228 -2.18557e-06 50L-1.96701e-06 45L6 45L6 50C6 52.2091 7.79086 54 10 54ZM6 25L6 35L-1.5299e-06 35L-1.09278e-06 25L6 25Z",fill:"black"})],-1)),t[21]||(t[21]=e.createElementVNode("div",{class:"mb-auto"},[e.createElementVNode("strong",{class:"text-sm mb-1"},"Hybrid Component"),e.createElementVNode("p",{class:"text-xs text-muted-foreground"}," These serve as both layout and content components, unlocking complex layouts. ")],-1)),o.value!="hybrid"?(e.openBlock(),e.createBlock(e.unref(m.Circle),{key:0,class:"size-4 mx-auto mt-4"})):(e.openBlock(),e.createBlock(e.unref(m.CircleCheck),{key:1,class:"size-4 mx-auto mt-4"}))],2)]),t[23]||(t[23]=e.createElementVNode("p",{class:"text-sm mb-1 block font-medium"}," Form Layout ",-1)),t[24]||(t[24]=e.createElementVNode("p",{class:"text-xs text-muted-foreground mb-2"}," This will be the form that the client can fill in to populate this component. ",-1)),e.createElementVNode("div",null,[e.createVNode($,{modelValue:u.value,"onUpdate:modelValue":t[7]||(t[7]=c=>u.value=c),buildText:"Edit Form Layout",editText:"Edit Form Layout"},null,8,["modelValue"])])]),e.createVNode(H,null,{default:e.withCtx(()=>[l.value==="edit"?(e.openBlock(),e.createBlock(E,{key:0,variant:"destructive",class:"mr-auto",onClick:w},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Delete Component ",-1)])]),_:1})):e.createCommentVNode("",!0),l.value==="create"?(e.openBlock(),e.createBlock(E,{key:1,type:"submit",onClick:N},{default:e.withCtx(()=>[...t[26]||(t[26]=[e.createTextVNode(" Add Component ",-1)])]),_:1})):(e.openBlock(),e.createBlock(E,{key:2,type:"submit",onClick:b},{default:e.withCtx(()=>[...t[27]||(t[27]=[e.createTextVNode(" Edit Component ",-1)])]),_:1}))]),_:1})]),_:1})]),_:1},8,["open"])}}}),j={class:"w-full truncate text-sm font-medium"},G={class:"w-full truncate text-xs text-muted-foreground"},B=e.defineComponent({__name:"ComponentGridItem",props:{component:{type:Object,required:!0}},emits:["edit"],setup(s,{emit:V}){const v=V;return(C,i)=>{const r=e.resolveComponent("Skeleton"),l=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("button",{onClick:i[0]||(i[0]=a=>v("edit")),class:"basis-[100px] max-w-[200px] @7xl:max-w-xs"},[e.createVNode(l,{class:"flex flex-col items-center px-4 py-4 gap-0 hover:bg-input/30"},{default:e.withCtx(()=>[s.component.icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(`${s.component.tint?"bg-"+s.component.tint:"bg-input/50"} rounded-lg p-4 mb-2`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(m.icons)[s.component.icon]),{class:"size-16 @5xl:size-22 @7xl:size-28"}))],2)):(e.openBlock(),e.createBlock(r,{key:1,class:"size-24 @5xl:size-30 @7xl:size-36 mb-2"})),e.createElementVNode("p",j,e.toDisplayString(s.component.displayName),1),e.createElementVNode("p",G,e.toDisplayString(s.component.name),1)]),_:1})])}}}),R={class:"flex flex-col gap-2 mb-12"},K={class:"flex items-start gap-4 overflow-hidden"},Y={class:"flex flex-col text-left"},J={class:"text-sm font-semibold"},Q={key:0,class:"text-xs text-muted-foreground/70 dark:text-muted-foreground/50 line-clamp-2 whitespace-normal mt-2"},W=e.defineComponent({__name:"VerticalToggle",props:{modelValue:{type:Array,required:!0},options:{type:Array,required:!0}},emits:["update:modelValue"],setup(s,{emit:V}){const v=s,C=V,i=e.computed({get(){return v.modelValue},set(a){C("update:modelValue",a)}}),r=e.ref("full"),l=a=>{i.value.includes(a)?i.value=i.value.filter(d=>d!==a):i.value.push(a)};return(a,d)=>{const p=e.resolveComponent("SegmentedControlButton"),f=e.resolveComponent("SegmentedControl"),n=e.resolveComponent("Button");return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(f,{modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=o=>r.value=o),class:"grid grid-cols-2 mb-4 w-28 scale-75 origin-left opacity-50 transition-all duration-300 hover:opacity-100"},{default:e.withCtx(()=>[e.createVNode(p,{value:"minimal"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.Baseline),{class:"size-5 mx-auto"})]),_:1}),e.createVNode(p,{value:"full"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.LetterText),{class:"size-5 mx-auto"})]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",R,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.options,o=>(e.openBlock(),e.createBlock(n,{variant:"ghost",key:o.value,class:e.normalizeClass(["flex-1 transition-all duration-300 active:scale-95 rounded-md justify-start w-full h-auto cursor-pointer border",s.modelValue.includes(o.value)?"bg-white hover:bg-white dark:bg-input/30 dark:hover:bg-input/30 shadow-xs":"hover:bg-transparent"]),onClick:u=>l(o.value)},{default:e.withCtx(()=>[e.createElementVNode("div",K,[e.createVNode(e.unref(m.Check),{class:e.normalizeClass(["size-5 text-muted-foreground transition-opacity duration-300",s.modelValue.includes(o.value)?"opacity-100":"opacity-0"])},null,8,["class"]),e.createElementVNode("div",Y,[e.createElementVNode("span",J,e.toDisplayString(o.text),1),r.value==="full"&&o.description?(e.openBlock(),e.createElementBlock("p",Q,e.toDisplayString(o.description),1)):e.createCommentVNode("",!0)])])]),_:2},1032,["class","onClick"]))),128))])])}}}),X={key:0,class:"truncate"},ee={key:1},te={class:"p-6 overflow-y-auto"},oe={class:"flex flex-col gap-3"},le={class:"flex items-start gap-4 overflow-hidden"},ne={class:"flex flex-col text-left"},ae={class:"text-sm font-semibold mb-2"},se={class:"text-xs text-muted-foreground line-clamp-2 whitespace-normal"},re=e.defineComponent({__name:"DrawerToggle",props:{modelValue:{type:Array,required:!0},options:{type:Array,required:!0}},emits:["update:modelValue"],setup(s,{emit:V}){const v=s,C=V,i=e.computed({get(){return v.modelValue},set(l){C("update:modelValue",l)}}),r=l=>{i.value.includes(l)?i.value=i.value.filter(a=>a!==l):i.value.push(l)};return(l,a)=>{const d=e.resolveComponent("Button"),p=e.resolveComponent("DrawerTrigger"),f=e.resolveComponent("DrawerContent"),n=e.resolveComponent("Drawer");return e.openBlock(),e.createBlock(n,null,{default:e.withCtx(()=>[e.createVNode(p,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(d,{variant:"outline",class:"mb-2"},{default:e.withCtx(()=>[s.modelValue.length<4?(e.openBlock(),e.createElementBlock("p",X,e.toDisplayString(s.modelValue.join(", ")),1)):(e.openBlock(),e.createElementBlock("p",ee,e.toDisplayString(s.modelValue.slice(0,3).join(", "))+" + "+e.toDisplayString(s.modelValue.length-3)+" more ",1)),e.createVNode(e.unref(m.ChevronDown),{class:"size-4 text-muted-foreground translate-y-0.25 ml-4"})]),_:1})]),_:1}),e.createVNode(f,null,{default:e.withCtx(()=>[e.createElementVNode("div",te,[e.createElementVNode("div",oe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.options,o=>(e.openBlock(),e.createBlock(d,{key:o.value,class:e.normalizeClass(["justify-start w-full h-auto cursor-pointer flex-1 transition-all duration-300 active:scale-95 rounded-md border border-transparent",s.modelValue.includes(o.value)?"bg-input/30 border-border":""]),variant:"ghost",onClick:u=>r(o.value)},{default:e.withCtx(()=>[e.createElementVNode("div",le,[e.createVNode(e.unref(m.Check),{class:e.normalizeClass(["size-5 text-muted-foreground transition-opacity duration-300",s.modelValue.includes(o.value)?"opacity-100":"opacity-0"])},null,8,["class"]),e.createElementVNode("div",ne,[e.createElementVNode("span",ae,e.toDisplayString(o.text),1),e.createElementVNode("p",se,e.toDisplayString(o.description),1)])])]),_:2},1032,["class","onClick"]))),128))])])]),_:1})]),_:1})}}}),ie={class:"w-full"},de={class:"flex items-center justify-between gap-4 w-full my-4"},ue={class:"flex flex-col space-y-8 @5xl:flex-row @5xl:space-x-12 @5xl:space-y-0"},ce={class:"hidden @5xl:block @5xl:w-1/4 @7xl:w-1/5"},me={class:"flex-1"},pe={class:"@5xl:hidden"},ve={class:"flex items-center justify-between w-full"},fe={class:"flex items-start gap-8"},xe={key:0,class:"mb-8"},Ve={class:"flex flex-wrap gap-4"},Ce={key:1,class:"mb-8"},ge={class:"flex flex-wrap gap-4"},ke={key:2,class:"mb-8"},ye={class:"flex flex-wrap gap-4"},Ne=e.defineComponent({__name:"Components",setup(s){const V=[{value:"hybrid",text:"Hybrid Components",icon:"",description:"These serve as both layout and content components, unlocking complex layouts."},{value:"layout",text:"Layout Component",icon:"",description:"Helps setting up the overall structure or layout of the page. (Examples: Section, 2 Column Grid, ...)"},{value:"content",text:"Content Component",icon:"",description:"Aimed at hosting and displaying unique content. (Examples: Text, Link, Image, ...)"}],{getModuleData:v,setModuleData:C}=k.useModuleStorage(),{navigateTo:i}=k.useModuleRoute();k.useModuleBreadcrumbs(()=>[{text:"Components"}]);const r=e.useTemplateRef("componentDialog"),l=e.ref([]),a=e.ref(["hybrid","layout","content"]),d=async n=>{Array.isArray(l.value)||(l.value=[]),l.value.push(n),l.value=await v("components")||[],l.value.push(n),C("components",l.value)},p=async n=>{let o=l.value.findIndex(u=>u.id===n.id);o!==-1&&(l.value[o]=n),l.value=await v("components")||[],o=l.value.findIndex(u=>u.id===n.id),o!==-1&&(l.value[o]=n,C("components",l.value))},f=async n=>{l.value=l.value.filter(o=>o.id!==n),l.value=await v("components")||[],l.value=l.value.filter(o=>o.id!==n),C("components",l.value)};return e.onMounted(()=>{v("components").then(n=>{console.log("Loaded components:",n),l.value=n||[]})}),(n,o)=>{const u=e.resolveComponent("Button"),y=e.resolveComponent("CardTitle"),N=e.resolveComponent("CardDescription"),b=e.resolveComponent("CardHeader"),w=e.resolveComponent("CardContent"),x=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",ie,[e.createElementVNode("div",de,[e.createVNode(u,{onClick:o[0]||(o[0]=t=>e.unref(i)("/")),variant:"link",class:"!pl-0"},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ChevronLeft),{class:"size-4"}),o[4]||(o[4]=e.createTextVNode(" Collections ",-1))]),_:1})]),e.createElementVNode("div",ue,[e.createElementVNode("div",ce,[e.createVNode(W,{options:V,modelValue:a.value,"onUpdate:modelValue":o[1]||(o[1]=t=>a.value=t)},null,8,["modelValue"])]),e.createElementVNode("div",me,[e.createElementVNode("div",pe,[e.createVNode(re,{options:V,modelValue:a.value,"onUpdate:modelValue":o[2]||(o[2]=t=>a.value=t)},null,8,["modelValue"])]),e.createVNode(x,null,{default:e.withCtx(()=>[e.createVNode(b,null,{default:e.withCtx(()=>[e.createElementVNode("div",ve,[e.createElementVNode("div",null,[e.createVNode(y,null,{default:e.withCtx(()=>[...o[5]||(o[5]=[e.createTextVNode("Components",-1)])]),_:1}),e.createVNode(N,null,{default:e.withCtx(()=>[...o[6]||(o[6]=[e.createTextVNode("Manage your components here.",-1)])]),_:1})]),e.createVNode(u,{onClick:o[3]||(o[3]=t=>r.value.openDialog())},{default:e.withCtx(()=>[e.createVNode(e.unref(m.Plus),{class:"size-4"}),o[7]||(o[7]=e.createTextVNode(" New Component ",-1))]),_:1})])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createElementVNode("div",fe,[e.createElementVNode("div",null,[a.value.includes("hybrid")?(e.openBlock(),e.createElementBlock("div",xe,[o[8]||(o[8]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Hybrid Components",-1)),e.createElementVNode("div",Ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value?.filter(t=>t.componentType==="hybrid"),t=>(e.openBlock(),e.createBlock(B,{key:t.name,onEdit:g=>r.value.openDialog(t),component:t},null,8,["onEdit","component"]))),128))])])):e.createCommentVNode("",!0),a.value.includes("layout")?(e.openBlock(),e.createElementBlock("div",Ce,[o[9]||(o[9]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Layout Components",-1)),e.createElementVNode("div",ge,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value?.filter(t=>t.componentType==="layout"),t=>(e.openBlock(),e.createBlock(B,{key:t.name,onEdit:g=>r.value.openDialog(t),component:t},null,8,["onEdit","component"]))),128))])])):e.createCommentVNode("",!0),a.value.includes("content")?(e.openBlock(),e.createElementBlock("div",ke,[o[10]||(o[10]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Content Components",-1)),e.createElementVNode("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value?.filter(t=>t.componentType==="content"),t=>(e.openBlock(),e.createBlock(B,{key:t.name,onEdit:g=>r.value.openDialog(t),component:t},null,8,["onEdit","component"]))),128))])])):e.createCommentVNode("",!0)])])]),_:1})]),_:1})])])]),e.createVNode(P,{ref_key:"componentDialog",ref:r,onAdd:d,onEdit:p,onDelete:f},null,512)],64)}}});exports.default=Ne;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as z, ref as w, resolveComponent as a, openBlock as s, createBlock as p, withCtx as i, createVNode as n, createTextVNode as D, toDisplayString as L, createElementVNode as t, normalizeClass as $, unref as g, createCommentVNode as
|
|
2
|
-
import { Circle as
|
|
1
|
+
import { defineComponent as z, ref as w, resolveComponent as a, openBlock as s, createBlock as p, withCtx as i, createVNode as n, createTextVNode as D, toDisplayString as L, createElementVNode as t, normalizeClass as $, unref as g, createCommentVNode as H, createElementBlock as x, resolveDynamicComponent as X, computed as P, Fragment as T, renderList as M, useTemplateRef as ee, onMounted as te } from "vue";
|
|
2
|
+
import { Circle as I, CircleCheck as U, icons as oe, Baseline as le, LetterText as ne, Check as j, ChevronDown as se, ChevronLeft as ae, Plus as ie } from "lucide-vue-next";
|
|
3
3
|
import { useConfirmation as ue, useModuleStorage as de, useModuleRoute as re, useModuleBreadcrumbs as me } from "@oneclick.dev/cms-kit";
|
|
4
4
|
const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { class: "w-1/2" }, fe = { class: "w-1/2" }, xe = { class: "flex gap-6 mb-6" }, ge = { class: "w-1/2" }, ye = { class: "w-1/2" }, Ce = { class: "grid grid-cols-3 bg-input/30 rounded border divide-x divide-input/30 mb-6" }, be = /* @__PURE__ */ z({
|
|
5
5
|
__name: "ComponentDialog",
|
|
@@ -33,7 +33,7 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
33
33
|
return V({
|
|
34
34
|
openDialog: E
|
|
35
35
|
}), (k, e) => {
|
|
36
|
-
const B = a("DialogTitle"), q = a("DialogDescription"), G = a("DialogHeader"), O = a("Input"), R = a("TailwindColorPicker"), Y = a("LucideIconPicker"), J = a("FormBuilderSelect"),
|
|
36
|
+
const B = a("DialogTitle"), q = a("DialogDescription"), G = a("DialogHeader"), O = a("Input"), R = a("TailwindColorPicker"), Y = a("LucideIconPicker"), J = a("FormBuilderSelect"), A = a("Button"), K = a("DialogFooter"), Q = a("DialogScrollContent"), W = a("Dialog");
|
|
37
37
|
return s(), p(W, {
|
|
38
38
|
open: m.value,
|
|
39
39
|
"onUpdate:open": e[8] || (e[8] = (y) => m.value = y)
|
|
@@ -135,10 +135,10 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
135
135
|
t("strong", { class: "text-sm mb-1" }, "Layout Component"),
|
|
136
136
|
t("p", { class: "text-xs text-muted-foreground" }, " Helps setting up the overall structure or layout of the page. (Examples: Section, 2 Column Grid, ...) ")
|
|
137
137
|
], -1)),
|
|
138
|
-
o.value != "layout" ? (s(), p(g(
|
|
138
|
+
o.value != "layout" ? (s(), p(g(I), {
|
|
139
139
|
key: 0,
|
|
140
140
|
class: "size-4 mx-auto mt-4"
|
|
141
|
-
})) : (s(), p(g(
|
|
141
|
+
})) : (s(), p(g(U), {
|
|
142
142
|
key: 1,
|
|
143
143
|
class: "size-4 mx-auto mt-4"
|
|
144
144
|
}))
|
|
@@ -166,10 +166,10 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
166
166
|
t("strong", { class: "text-sm mb-1" }, "Content Component"),
|
|
167
167
|
t("p", { class: "text-xs text-muted-foreground" }, " Aimed at hosting and displaying unique content. (Examples: Text, Link, Image, ...) ")
|
|
168
168
|
], -1)),
|
|
169
|
-
o.value != "content" ? (s(), p(g(
|
|
169
|
+
o.value != "content" ? (s(), p(g(I), {
|
|
170
170
|
key: 0,
|
|
171
171
|
class: "size-4 mx-auto mt-4"
|
|
172
|
-
})) : (s(), p(g(
|
|
172
|
+
})) : (s(), p(g(U), {
|
|
173
173
|
key: 1,
|
|
174
174
|
class: "size-4 mx-auto mt-4"
|
|
175
175
|
}))
|
|
@@ -197,10 +197,10 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
197
197
|
t("strong", { class: "text-sm mb-1" }, "Hybrid Component"),
|
|
198
198
|
t("p", { class: "text-xs text-muted-foreground" }, " These serve as both layout and content components, unlocking complex layouts. ")
|
|
199
199
|
], -1)),
|
|
200
|
-
o.value != "hybrid" ? (s(), p(g(
|
|
200
|
+
o.value != "hybrid" ? (s(), p(g(I), {
|
|
201
201
|
key: 0,
|
|
202
202
|
class: "size-4 mx-auto mt-4"
|
|
203
|
-
})) : (s(), p(g(
|
|
203
|
+
})) : (s(), p(g(U), {
|
|
204
204
|
key: 1,
|
|
205
205
|
class: "size-4 mx-auto mt-4"
|
|
206
206
|
}))
|
|
@@ -219,7 +219,7 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
219
219
|
]),
|
|
220
220
|
n(K, null, {
|
|
221
221
|
default: i(() => [
|
|
222
|
-
l.value === "edit" ? (s(), p(
|
|
222
|
+
l.value === "edit" ? (s(), p(A, {
|
|
223
223
|
key: 0,
|
|
224
224
|
variant: "destructive",
|
|
225
225
|
class: "mr-auto",
|
|
@@ -229,8 +229,8 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
229
229
|
D(" Delete Component ", -1)
|
|
230
230
|
])]),
|
|
231
231
|
_: 1
|
|
232
|
-
})) :
|
|
233
|
-
l.value === "create" ? (s(), p(
|
|
232
|
+
})) : H("", !0),
|
|
233
|
+
l.value === "create" ? (s(), p(A, {
|
|
234
234
|
key: 1,
|
|
235
235
|
type: "submit",
|
|
236
236
|
onClick: N
|
|
@@ -239,7 +239,7 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
239
239
|
D(" Add Component ", -1)
|
|
240
240
|
])]),
|
|
241
241
|
_: 1
|
|
242
|
-
})) : (s(), p(
|
|
242
|
+
})) : (s(), p(A, {
|
|
243
243
|
key: 2,
|
|
244
244
|
type: "submit",
|
|
245
245
|
onClick: Z
|
|
@@ -348,7 +348,7 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
348
348
|
_: 1
|
|
349
349
|
}, 8, ["modelValue"]),
|
|
350
350
|
t("div", we, [
|
|
351
|
-
(s(!0), x(
|
|
351
|
+
(s(!0), x(T, null, M(r.options, (o) => (s(), p(u, {
|
|
352
352
|
variant: "ghost",
|
|
353
353
|
key: o.value,
|
|
354
354
|
class: $(["flex-1 transition-all duration-300 active:scale-95 rounded-md justify-start w-full h-auto cursor-pointer border", r.modelValue.includes(o.value) ? "bg-white hover:bg-white dark:bg-input/30 dark:hover:bg-input/30 shadow-xs" : "hover:bg-transparent"]),
|
|
@@ -361,7 +361,7 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
361
361
|
}, null, 8, ["class"]),
|
|
362
362
|
t("div", he, [
|
|
363
363
|
t("span", Le, L(o.text), 1),
|
|
364
|
-
m.value === "full" && o.description ? (s(), x("p", De, L(o.description), 1)) :
|
|
364
|
+
m.value === "full" && o.description ? (s(), x("p", De, L(o.description), 1)) : H("", !0)
|
|
365
365
|
])
|
|
366
366
|
])
|
|
367
367
|
]),
|
|
@@ -371,10 +371,10 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
371
371
|
]);
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
|
-
}),
|
|
374
|
+
}), Te = {
|
|
375
375
|
key: 0,
|
|
376
376
|
class: "truncate"
|
|
377
|
-
},
|
|
377
|
+
}, He = { key: 1 }, Me = { class: "p-6 overflow-y-auto" }, ze = { class: "flex flex-col gap-3" }, Be = { class: "flex items-start gap-4 overflow-hidden" }, Ee = { class: "flex flex-col text-left" }, Ne = { class: "text-sm font-semibold mb-2" }, Ze = { class: "text-xs text-muted-foreground line-clamp-2 whitespace-normal" }, Se = /* @__PURE__ */ z({
|
|
378
378
|
__name: "DrawerToggle",
|
|
379
379
|
props: {
|
|
380
380
|
modelValue: {
|
|
@@ -409,7 +409,7 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
409
409
|
class: "mb-2"
|
|
410
410
|
}, {
|
|
411
411
|
default: i(() => [
|
|
412
|
-
r.modelValue.length < 4 ? (s(), x("p",
|
|
412
|
+
r.modelValue.length < 4 ? (s(), x("p", Te, L(r.modelValue.join(", ")), 1)) : (s(), x("p", He, L(r.modelValue.slice(0, 3).join(", ")) + " + " + L(r.modelValue.length - 3) + " more ", 1)),
|
|
413
413
|
n(g(se), { class: "size-4 text-muted-foreground translate-y-0.25 ml-4" })
|
|
414
414
|
]),
|
|
415
415
|
_: 1
|
|
@@ -421,7 +421,7 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
421
421
|
default: i(() => [
|
|
422
422
|
t("div", Me, [
|
|
423
423
|
t("div", ze, [
|
|
424
|
-
(s(!0), x(
|
|
424
|
+
(s(!0), x(T, null, M(r.options, (o) => (s(), p(v, {
|
|
425
425
|
key: o.value,
|
|
426
426
|
class: $(["justify-start w-full h-auto cursor-pointer flex-1 transition-all duration-300 active:scale-95 rounded-md border border-transparent", r.modelValue.includes(o.value) ? "bg-input/30 border-border" : ""]),
|
|
427
427
|
variant: "ghost",
|
|
@@ -450,7 +450,7 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
450
450
|
});
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
|
-
}),
|
|
453
|
+
}), Ae = { class: "w-full" }, Ie = { class: "flex items-center justify-between gap-4 w-full my-4" }, Ue = { class: "flex flex-col space-y-8 @5xl:flex-row @5xl:space-x-12 @5xl:space-y-0" }, Fe = { class: "hidden @5xl:block @5xl:w-1/4 @7xl:w-1/5" }, Oe = { class: "flex-1" }, Pe = { class: "@5xl:hidden" }, je = { class: "flex items-center justify-between w-full" }, qe = { class: "flex items-start gap-8" }, Ge = {
|
|
454
454
|
key: 0,
|
|
455
455
|
class: "mb-8"
|
|
456
456
|
}, Re = { class: "flex flex-wrap gap-4" }, Ye = {
|
|
@@ -486,7 +486,7 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
486
486
|
{ text: "Components" }
|
|
487
487
|
]);
|
|
488
488
|
const m = ee("componentDialog"), l = w([]), d = w(["hybrid", "layout", "content"]), v = async (u) => {
|
|
489
|
-
l.value.push(u), l.value = await b("components") || [], l.value.push(u), h("components", l.value);
|
|
489
|
+
Array.isArray(l.value) || (l.value = []), l.value.push(u), l.value = await b("components") || [], l.value.push(u), h("components", l.value);
|
|
490
490
|
}, C = async (u) => {
|
|
491
491
|
let o = l.value.findIndex((f) => f.id === u.id);
|
|
492
492
|
o !== -1 && (l.value[o] = u), l.value = await b("components") || [], o = l.value.findIndex((f) => f.id === u.id), o !== -1 && (l.value[o] = u, h("components", l.value));
|
|
@@ -495,13 +495,13 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
495
495
|
};
|
|
496
496
|
return te(() => {
|
|
497
497
|
b("components").then((u) => {
|
|
498
|
-
l.value = u;
|
|
498
|
+
console.log("Loaded components:", u), l.value = u || [];
|
|
499
499
|
});
|
|
500
500
|
}), (u, o) => {
|
|
501
501
|
const f = a("Button"), E = a("CardTitle"), N = a("CardDescription"), Z = a("CardHeader"), S = a("CardContent"), k = a("Card");
|
|
502
|
-
return s(), x(
|
|
503
|
-
t("div",
|
|
504
|
-
t("div",
|
|
502
|
+
return s(), x(T, null, [
|
|
503
|
+
t("div", Ae, [
|
|
504
|
+
t("div", Ie, [
|
|
505
505
|
n(f, {
|
|
506
506
|
onClick: o[0] || (o[0] = (e) => g(c)("/")),
|
|
507
507
|
variant: "link",
|
|
@@ -514,7 +514,7 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
514
514
|
_: 1
|
|
515
515
|
})
|
|
516
516
|
]),
|
|
517
|
-
t("div",
|
|
517
|
+
t("div", Ue, [
|
|
518
518
|
t("div", Fe, [
|
|
519
519
|
n($e, {
|
|
520
520
|
options: V,
|
|
@@ -569,33 +569,33 @@ const ce = { class: "grid py-4" }, pe = { class: "flex gap-6 mb-6" }, ve = { cla
|
|
|
569
569
|
d.value.includes("hybrid") ? (s(), x("div", Ge, [
|
|
570
570
|
o[8] || (o[8] = t("h3", { class: "font-medium mb-2" }, "Hybrid Components", -1)),
|
|
571
571
|
t("div", Re, [
|
|
572
|
-
(s(!0), x(
|
|
572
|
+
(s(!0), x(T, null, M(l.value?.filter((e) => e.componentType === "hybrid"), (e) => (s(), p(F, {
|
|
573
573
|
key: e.name,
|
|
574
574
|
onEdit: (B) => m.value.openDialog(e),
|
|
575
575
|
component: e
|
|
576
576
|
}, null, 8, ["onEdit", "component"]))), 128))
|
|
577
577
|
])
|
|
578
|
-
])) :
|
|
578
|
+
])) : H("", !0),
|
|
579
579
|
d.value.includes("layout") ? (s(), x("div", Ye, [
|
|
580
580
|
o[9] || (o[9] = t("h3", { class: "font-medium mb-2" }, "Layout Components", -1)),
|
|
581
581
|
t("div", Je, [
|
|
582
|
-
(s(!0), x(
|
|
582
|
+
(s(!0), x(T, null, M(l.value?.filter((e) => e.componentType === "layout"), (e) => (s(), p(F, {
|
|
583
583
|
key: e.name,
|
|
584
584
|
onEdit: (B) => m.value.openDialog(e),
|
|
585
585
|
component: e
|
|
586
586
|
}, null, 8, ["onEdit", "component"]))), 128))
|
|
587
587
|
])
|
|
588
|
-
])) :
|
|
588
|
+
])) : H("", !0),
|
|
589
589
|
d.value.includes("content") ? (s(), x("div", Ke, [
|
|
590
590
|
o[10] || (o[10] = t("h3", { class: "font-medium mb-2" }, "Content Components", -1)),
|
|
591
591
|
t("div", Qe, [
|
|
592
|
-
(s(!0), x(
|
|
592
|
+
(s(!0), x(T, null, M(l.value?.filter((e) => e.componentType === "content"), (e) => (s(), p(F, {
|
|
593
593
|
key: e.name,
|
|
594
594
|
onEdit: (B) => m.value.openDialog(e),
|
|
595
595
|
component: e
|
|
596
596
|
}, null, 8, ["onEdit", "component"]))), 128))
|
|
597
597
|
])
|
|
598
|
-
])) :
|
|
598
|
+
])) : H("", !0)
|
|
599
599
|
])
|
|
600
600
|
])
|
|
601
601
|
]),
|