@sunpix/claude-code-web
Version:
A web-based interface for interacting with Claude Code CLI
2 lines (1 loc) • 5.75 kB
JavaScript
import{R as e,z as t,h as r,f as a,b as n,e as o,P as s,c as i,a as u}from"./BonREZMq.js";import{e as l,I as d,r as c,y as v,o as p,w as f,b as g,f as b,D as h,n as m,i as y}from"./sqhd64MX.js";const w=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,x=e,S=(e,t)=>r=>{var a;if(null==(null==t?void 0:t.variants))return x(e,null==r?void 0:r.class,null==r?void 0:r.className);const{variants:n,defaultVariants:o}=t,s=Object.keys(n).map(e=>{const t=null==r?void 0:r[e],a=null==o?void 0:o[e];if(null===t)return null;const s=w(t)||w(a);return n[e][s]}),i=r&&Object.entries(r).reduce((e,t)=>{let[r,a]=t;return void 0===a||(e[r]=a),e},{}),u=null==t||null===(a=t.compoundVariants)||void 0===a?void 0:a.reduce((e,t)=>{let{class:r,className:a,...n}=t;return Object.entries(n).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...o,...i}[t]):{...o,...i}[t]===r})?[...e,r,a]:e},[]);return x(e,s,u,null==r?void 0:r.class,null==r?void 0:r.className)},A={bubbles:!1,cancelable:!0},I={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function k(e,t,r){const a=function(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(a)||"horizontal"===t&&["ArrowUp","ArrowDown"].includes(a)))return I[a]}function F(e,r=!1){const a=t();for(const n of e){if(n===a)return;if(n.focus({preventScroll:r}),t()!==a)return}}function T(e,t){return e.map((r,a)=>e[(t+a)%e.length])}const[z,_]=o("RovingFocusGroup");var R=l({__name:"RovingFocusGroup",props:{orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!1},currentTabStopId:{type:[String,null],required:!1},defaultCurrentTabStopId:{type:String,required:!1},preventScrollOnEntryFocus:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["entryFocus","update:currentTabStopId"],setup(e,{expose:t,emit:o}){const i=e,u=o,{loop:l,orientation:m,dir:y}=d(i),w=r(y),x=a(i,"currentTabStopId",u,{defaultValue:i.defaultCurrentTabStopId,passive:void 0===i.currentTabStopId}),S=c(!1),I=c(!1),k=c(0),{getItems:T,CollectionSlot:z}=n({isProvider:!0});function R(e){const t=!I.value;if(e.currentTarget&&e.target===e.currentTarget&&t&&!S.value){const t=new CustomEvent("rovingFocusGroup.onEntryFocus",A);if(e.currentTarget.dispatchEvent(t),u("entryFocus",t),!t.defaultPrevented){const e=T().map(e=>e.ref).filter(e=>""!==e.dataset.disabled);F([e.find(e=>""===e.getAttribute("data-active")),e.find(e=>e.id===x.value),...e].filter(Boolean),i.preventScrollOnEntryFocus)}}I.value=!1}function q(){setTimeout(()=>{I.value=!1},1)}return t({getItems:T}),_({loop:l,dir:w,orientation:m,currentTabStopId:x,onItemFocus:e=>{x.value=e},onItemShiftTab:()=>{S.value=!0},onFocusableItemAdd:()=>{k.value++},onFocusableItemRemove:()=>{k.value--}}),(e,t)=>(p(),v(b(z),null,{default:f(()=>[g(b(s),{tabindex:S.value||0===k.value?-1:0,"data-orientation":b(m),as:e.as,"as-child":e.asChild,dir:b(w),style:{outline:"none"},onMousedown:t[0]||(t[0]=e=>I.value=!0),onMouseup:q,onFocus:R,onBlur:t[1]||(t[1]=e=>S.value=!1)},{default:f(()=>[h(e.$slots,"default")]),_:3},8,["tabindex","data-orientation","as","as-child","dir"])]),_:3}))}});const q=l({__name:"Button",props:{variant:{},size:{},class:{},asChild:{type:Boolean},as:{default:"button"}},setup(e){const t=e;return(e,r)=>(p(),v(b(s),{"data-slot":"button",as:e.as,"as-child":e.asChild,class:m(b(i)(b(C)({variant:e.variant,size:e.size}),t.class))},{default:f(()=>[h(e.$slots,"default")]),_:3},8,["as","as-child","class"]))}}),C=S("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}}),B=u("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]),E=c(!1),j=c((()=>{{if(window.innerWidth<=768)return!1;const e=localStorage.getItem("sidebar:open");return null===e||"true"===e}})());function M(){const e=()=>{const e=E.value;E.value=window.innerWidth<=768,!e&&E.value&&(j.value=!1)};e(),window.addEventListener("resize",e);const t=y(()=>E.value?"var(--sidebar-width-mobile)":j.value?"var(--sidebar-width)":"var(--sidebar-width-collapsed)"),r=y(()=>E.value?"0":j.value?"16rem":"3rem");return{isOpen:y(()=>j.value),isMobile:y(()=>E.value),sidebarWidth:t,contentMargin:r,toggle:()=>{j.value=!j.value,E.value||localStorage.setItem("sidebar:open",String(j.value))},close:()=>{j.value=!1},open:()=>{j.value=!0}}}export{B as P,R,q as _,S as c,F as f,k as g,z as i,M as u,T as w};