@prisma/studio-core 0.0.0-dev.202504120019 → 0.0.0-dev.202504121011

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.
@@ -844,11 +844,6 @@ video {
844
844
  -moz-user-select: none;
845
845
  user-select: none;
846
846
  }
847
- .ps-appearance-none {
848
- -webkit-appearance: none;
849
- -moz-appearance: none;
850
- appearance: none;
851
- }
852
847
  .ps-flex-row {
853
848
  flex-direction: row;
854
849
  }
@@ -1007,9 +1002,6 @@ video {
1007
1002
  .ps-fill-current {
1008
1003
  fill: currentColor;
1009
1004
  }
1010
- .ps-fill-yellow-500 {
1011
- fill: #eab308;
1012
- }
1013
1005
  .ps-p-0 {
1014
1006
  padding: 0px;
1015
1007
  }
@@ -1193,10 +1185,6 @@ video {
1193
1185
  --tw-text-opacity: 1;
1194
1186
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
1195
1187
  }
1196
- .ps-text-yellow-500 {
1197
- --tw-text-opacity: 1;
1198
- color: rgb(234 179 8 / var(--tw-text-opacity, 1));
1199
- }
1200
1188
  .ps-underline-offset-4 {
1201
1189
  text-underline-offset: 4px;
1202
1190
  }
package/dist/ui/index.cjs CHANGED
@@ -1,163 +1 @@
1
- "use strict";var Ha=Object.create;var we=Object.defineProperty;var Oa=Object.getOwnPropertyDescriptor;var Na=Object.getOwnPropertyNames;var Ea=Object.getPrototypeOf,Ga=Object.prototype.hasOwnProperty;var za=(e,a)=>{for(var t in a)we(e,t,{get:a[t],enumerable:!0})},Qe=(e,a,t,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of Na(a))!Ga.call(e,l)&&l!==t&&we(e,l,{get:()=>a[l],enumerable:!(o=Oa(a,l))||o.enumerable});return e};var A=(e,a,t)=>(t=e!=null?Ha(Ea(e)):{},Qe(a||!e||!e.__esModule?we(t,"default",{value:e,enumerable:!0}):t,e)),Va=e=>Qe(we({},"__esModule",{value:!0}),e);var Ct={};za(Ct,{Studio:()=>Ke});module.exports=Va(Ct);var gu=require("../index-KSZNOSSS.css");var Fa=require("nuqs/adapters/react"),v=A(require("react"),1);var $e=require("@radix-ui/react-slot"),Ye=require("nuqs");var _e=require("clsx"),je=require("tailwind-merge");function u(...e){return(0,je.twMerge)((0,_e.clsx)(e))}var U=require("react/jsx-runtime"),ae=()=>{let{setCurrentTable:e,currentTable:a,favoriteTableIds:t,tables:o}=ke(),[l,m]=(0,Ye.useQueryState)("tableId"),r=async f=>{await m(f);let C=o.find(S=>S.id===f);C&&e(C)};return(0,U.jsxs)("div",{className:"ps-flex ps-flex-col ps-w-64 ps-gap-4 ps-shrink-0",children:[(0,U.jsx)(ae.Block,{label:"Tables",children:o.map(f=>(0,U.jsx)(ae.Item,{isActive:a?.id===f.id,onClick:C=>{C.preventDefault(),r(f.id)},className:`ps-px-2 ps-py-1 ps-cursor-pointer ps-rounded ${a?.id===f.id?"ps-bg-primary ps-text-white":"ps-hover:ps-bg-gray-100"}`,children:f.name},f.id))}),t.size>0&&(0,U.jsx)(ae.Block,{label:"Favourites",children:o.filter(f=>t.has(f.id)).map(f=>(0,U.jsx)(ae.Item,{isActive:a?.id===f.id,onClick:C=>{C.preventDefault(),r(f.id)},children:f.name},f.id))})]})},Wa=({className:e,label:a,children:t,...o})=>(0,U.jsxs)("div",{className:u("ps-rounded-lg ps-border ps-bg-card ps-text-card-foreground ps-shadow-xs",e),...o,children:[(0,U.jsx)("div",{className:"ps-pt-4 ps-pb-2 ps-px-4",children:(0,U.jsx)("h2",{className:"ps-text-sm ps-font-medium",children:a})}),(0,U.jsx)("nav",{"aria-label":a,className:"ps-flex ps-flex-col ps-gap-px ps-pb-3",children:t})]}),Xa=({className:e,asChild:a=!1,isActive:t,size:o,...l})=>(0,U.jsx)(a?$e.Slot:"button",{"data-sidebar":"menu-button","data-size":o,"data-active":t,className:u("ps-py-1.5 ps-px-4 ps-text-sm ps-font-medium ps-flex ps-gap-2 ps-items-center ps-border ps-border-transparent ps-bg-transparent ps-hover:bg-muted/50",e),...l});ae.Block=Wa;ae.Item=Xa;var ea=ae;var ee=require("@dnd-kit/core"),re=require("@dnd-kit/sortable"),Da=require("@dnd-kit/utilities"),V=require("@tanstack/react-table"),N=require("react");var W=A(require("react"),1);var G=require("react/jsx-runtime"),De=W.forwardRef(({className:e,...a},t)=>(0,G.jsx)("div",{className:"ps-relative ps-w-full ps-overflow-auto ps-flex ps-items-start ps-h-full",children:(0,G.jsx)("table",{ref:t,className:u("ps-w-full ps-caption-bottom ps-text-sm table-fixed",e),...a})}));De.displayName="Table";var Te=W.forwardRef(({className:e,...a},t)=>(0,G.jsx)("thead",{ref:t,className:u("[&_tr]:ps-border-b",e),...a}));Te.displayName="TableHeader";var Ae=W.forwardRef(({className:e,...a},t)=>(0,G.jsx)("tbody",{ref:t,className:u("[&_tr:last-child]:ps-border-0",e),...a}));Ae.displayName="TableBody";var Ka=W.forwardRef(({className:e,...a},t)=>(0,G.jsx)("tfoot",{ref:t,className:u("ps-border-t ps-bg-muted/50 ps-font-medium [&>tr]:last:ps-border-b-0",e),...a}));Ka.displayName="TableFooter";var ie=W.forwardRef(({className:e,...a},t)=>(0,G.jsx)("tr",{ref:t,className:u("ps-border-b ps-transition-colors hover:ps-bg-muted/50 data-[state=selected]:ps-bg-muted",e),...a}));ie.displayName="TableRow";var be=W.forwardRef(({className:e,...a},t)=>(0,G.jsx)("th",{ref:t,className:u("ps-h-10 ps-px-2 ps-text-left ps-align-middle ps-font-medium ps-text-muted-foreground [&:has([role=checkbox])]:ps-pr-0 [&>[role=checkbox]]:ps-translate-y-[2px]",e),...a}));be.displayName="TableHead";var ne=W.forwardRef(({className:e,...a},t)=>(0,G.jsx)("td",{ref:t,className:u("ps-p-2 ps-align-middle [&:has([role=checkbox])]:ps-pr-0 [&>[role=checkbox]]:ps-translate-y-[2px]",e),...a}));ne.displayName="TableCell";var Za=W.forwardRef(({className:e,...a},t)=>(0,G.jsx)("caption",{ref:t,className:u("ps-mt-4 ps-text-sm ps-text-muted-foreground",e),...a}));Za.displayName="TableCaption";var na=require("@uiw/codemirror-theme-tokyo-night"),ca=A(require("@uiw/react-codemirror"),1);var X=A(require("@radix-ui/react-popover"),1),y=A(require("react"),1);var de=require("react/jsx-runtime"),aa=y.createContext(null),Be=({children:e,...a})=>{let[t,o]=y.useState(!1);return(0,de.jsx)(aa.Provider,{value:{open:t,setOpen:o},children:(0,de.jsx)(X.Root,{open:t,onOpenChange:o,...a,children:e})})};Be.displayName="PopoverCell";var Fe=y.forwardRef(({children:e,onDoubleClick:a,className:t,...o},l)=>{let m=y.useContext(aa),[r,f]=y.useState(!1),C=y.useRef(null);return y.useEffect(()=>{let R=fe=>{let O=fe.target;C.current&&!C.current.contains(O)&&(console.log("Outside click - removing focus"),f(!1))};return document.addEventListener("click",R),()=>document.removeEventListener("click",R)},[]),(0,de.jsx)(X.Trigger,{ref:R=>{typeof l=="function"?l(R):l&&(l.current=R),C.current=R},onClick:R=>{R.preventDefault(),console.log("Click handler - setting focus to true"),f(!0)},onDoubleClick:R=>{R.preventDefault(),m?.setOpen(!0),a?.()},"data-focus":r.toString(),className:u("w-full h-full cursor-pointer",t),...o,children:e})});Fe.displayName="PopoverCellTrigger";var qe=y.forwardRef(({className:e,align:a="center",sideOffset:t=4,...o},l)=>(0,de.jsx)(X.Portal,{children:(0,de.jsx)(X.Content,{ref:l,align:a,sideOffset:t,className:u("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));qe.displayName=X.Content.displayName;var Me=require("react");var ta=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Re=(...e)=>e.filter((a,t,o)=>!!a&&o.indexOf(a)===t).join(" ");var ce=require("react");var oa={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var la=(0,ce.forwardRef)(({color:e="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:l="",children:m,iconNode:r,...f},C)=>(0,ce.createElement)("svg",{ref:C,...oa,width:a,height:a,stroke:e,strokeWidth:o?Number(t)*24/Number(a):t,className:Re("lucide",l),...f},[...r.map(([S,b])=>(0,ce.createElement)(S,b)),...Array.isArray(m)?m:[m]]));var L=(e,a)=>{let t=(0,Me.forwardRef)(({className:o,...l},m)=>(0,Me.createElement)(la,{ref:m,iconNode:a,className:Re(`lucide-${ta(e)}`,o),...l}));return t.displayName=`${e}`,t};var j=L("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);var pe=L("ArrowUpWideNarrow",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]]);var K=L("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var se=L("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var me=L("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var Z=L("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var Le=L("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var xe=L("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);var Ie=L("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);var te=L("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var Ce=L("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var $=L("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);var ge=L("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);var he=L("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);var Se=L("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);var sa=require("react");var i=A(require("@radix-ui/react-context-menu"),1);var J=A(require("react"),1);var w=require("react/jsx-runtime"),ua=i.Root,da=i.Trigger;var Ja=J.forwardRef(({className:e,inset:a,children:t,...o},l)=>(0,w.jsxs)(i.SubTrigger,{ref:l,className:u("ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[state=open]:ps-bg-accent data-[state=open]:ps-text-accent-foreground",a&&"ps-pl-8",e),...o,children:[t,(0,w.jsx)(Z,{className:"ps-ml-auto ps-h-4 ps-w-4"})]}));Ja.displayName=i.SubTrigger.displayName;var Qa=J.forwardRef(({className:e,...a},t)=>(0,w.jsx)(i.SubContent,{ref:t,className:u("ps-z-50 ps-min-w-[8rem] ps-overflow-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-lg data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-context-menu-content-transform-origin]",e),...a}));Qa.displayName=i.SubContent.displayName;var Ue=J.forwardRef(({className:e,...a},t)=>(0,w.jsx)(i.Portal,{children:(0,w.jsx)(i.Content,{ref:t,className:u("ps-z-50 ps-max-h-[--radix-context-menu-content-available-height] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-md data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-context-menu-content-transform-origin]",e),...a})}));Ue.displayName=i.Content.displayName;var He=J.forwardRef(({className:e,inset:a,...t},o)=>(0,w.jsx)(i.Item,{ref:o,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",a&&"ps-pl-8",e),...t}));He.displayName=i.Item.displayName;var _a=J.forwardRef(({className:e,children:a,checked:t,...o},l)=>(0,w.jsxs)(i.CheckboxItem,{ref:l,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),checked:t,...o,children:[(0,w.jsx)("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:(0,w.jsx)(i.ItemIndicator,{children:(0,w.jsx)(K,{className:"ps-h-4 ps-w-4"})})}),a]}));_a.displayName=i.CheckboxItem.displayName;var ja=J.forwardRef(({className:e,children:a,...t},o)=>(0,w.jsxs)(i.RadioItem,{ref:o,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[(0,w.jsx)("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:(0,w.jsx)(i.ItemIndicator,{children:(0,w.jsx)(te,{className:"ps-h-4 ps-w-4 ps-fill-current"})})}),a]}));ja.displayName=i.RadioItem.displayName;var $a=J.forwardRef(({className:e,inset:a,...t},o)=>(0,w.jsx)(i.Label,{ref:o,className:u("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold ps-text-foreground",a&&"ps-pl-8",e),...t}));$a.displayName=i.Label.displayName;var Ya=J.forwardRef(({className:e,...a},t)=>(0,w.jsx)(i.Separator,{ref:t,className:u("ps--mx-1 ps-my-1 ps-h-px ps-bg-border",e),...a}));Ya.displayName=i.Separator.displayName;var et=({className:e,...a})=>(0,w.jsx)("span",{className:u("ps-ml-auto ps-text-xs ps-tracking-widest ps-text-muted-foreground",e),...a});et.displayName="ContextMenuShortcut";var oe=require("react/jsx-runtime"),Oe=e=>{if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(e==null)return"";if((0,sa.isValidElement)(e)){let a=e.props;return e.type&&typeof e.type=="function"&&e.type.name==="RevealText"?a.text||"":e.type&&typeof e.type=="function"&&e.type.name==="NullValue"?"NULL":a.children?Oe(a.children):""}return Array.isArray(e)?e.map(Oe).join(""):""},ra=({children:e})=>(0,oe.jsxs)(ua,{children:[(0,oe.jsx)(da,{className:"ps-block ps-w-full ps-p-[var(--studio-cell-spacing)]",children:e}),(0,oe.jsx)(Ue,{children:(0,oe.jsxs)(He,{onClick:()=>{let a=Oe(e);navigator.clipboard.writeText(a).catch(t=>{console.error("Failed to copy to clipboard:",t)})},className:"ps-flex ps-items-center ps-gap-2",children:[(0,oe.jsx)(Ce,{size:12}),"Copy"]})})]});var ia=require("react/jsx-runtime");function fa(){return(0,ia.jsx)("code",{className:"ps-text-gray-500",children:"NULL"})}var Q=require("react/jsx-runtime");function pa({cell:e,getPinningStyles:a,dataType:t,isRelational:o,relatesTo:l,relationField:m}){let r=e.getValue(),f=r==null,C=S=>{if(S==null)return"NULL";if(typeof S=="object")try{return JSON.stringify(S,null,2)}catch(b){return console.error("Error stringifying value:",b),String(S)}return String(S)};return(0,Q.jsxs)(Be,{children:[(0,Q.jsx)(Fe,{asChild:!0,children:(0,Q.jsx)(ne,{...a(e.column),"data-cell-type":"data","data-type":t.toLowerCase(),"data-relational":o?"true":void 0,"data-relates-to":l,"data-relation-field":m,className:u(a(e.column).className,"ps-p-0",e.column.getIsPinned()&&"ps-sticky"),children:(0,Q.jsx)(ra,{children:f?(0,Q.jsx)(fa,{}):C(r)})})}),(0,Q.jsx)(qe,{align:"start",alignOffset:0,sideOffset:0,className:"ps-min-w-(--radix-popover-trigger-width) ps-rounded-none ps-bg-muted ps-p-0",children:(0,Q.jsx)(ca.default,{value:C(r),theme:na.tokyoNight,height:"100px",basicSetup:{lineNumbers:!0,foldGutter:!1,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!1},onChange:S=>{console.log("New value:",S)}})})]},e.id)}var La=require("react/jsx-runtime");function ma({cell:e,getPinningStyles:a,dataType:t}){let o={cell:e,getPinningStyles:a},l=e.column.columnDef.meta,m={...o,isRelational:l?.isRelational,relatesTo:l?.relatesTo,relationField:l?.relationField};return(0,La.jsx)(pa,{...m,dataType:t||"STRING"})}var Pa=require("@tanstack/react-table");var xa=require("@radix-ui/react-slot"),Ia=require("class-variance-authority"),Ca=A(require("react"),1);var ga=require("react/jsx-runtime"),at=(0,Ia.cva)("ps-inline-flex ps-items-center ps-justify-center ps-gap-2 ps-whitespace-nowrap ps-rounded-md ps-text-sm ps-font-medium ps-transition-colors focus-visible:ps-outline-none focus-visible:ps-ring-1 focus-visible:ps-ring-ring disabled:ps-pointer-events-none disabled:ps-opacity-50 [&_svg]:ps-pointer-events-none [&_svg]:ps-size-4 [&_svg]:ps-shrink-0",{variants:{variant:{default:"ps-bg-primary ps-text-primary-foreground ps-shadow hover:ps-bg-primary/90",destructive:"ps-bg-destructive ps-text-destructive-foreground ps-shadow-sm hover:ps-bg-destructive/90",outline:"ps-border ps-border-input ps-bg-background ps-shadow-sm hover:ps-bg-accent hover:ps-text-accent-foreground",secondary:"ps-bg-secondary ps-text-secondary-foreground ps-shadow-sm hover:ps-bg-secondary/80",ghost:"hover:ps-bg-accent hover:ps-text-accent-foreground",link:"ps-text-primary ps-underline-offset-4 hover:ps-underline"},size:{default:"ps-h-9 ps-px-4 ps-py-2",sm:"ps-h-8 ps-rounded-md ps-px-3 ps-text-xs",lg:"ps-h-10 ps-rounded-md ps-px-8",icon:"ps-h-9 ps-w-9"}},defaultVariants:{variant:"default",size:"default"}}),z=Ca.forwardRef(({className:e,variant:a,size:t,asChild:o=!1,...l},m)=>(0,ga.jsx)(o?xa.Slot:"button",{className:u(at({variant:a,size:t,className:e})),ref:m,...l}));z.displayName="Button";var n=A(require("@radix-ui/react-dropdown-menu"),1);var _=A(require("react"),1);var k=require("react/jsx-runtime"),ha=n.Root,Sa=n.Trigger;var tt=_.forwardRef(({className:e,inset:a,children:t,...o},l)=>(0,k.jsxs)(n.SubTrigger,{ref:l,className:u("ps-flex ps-cursor-default ps-select-none ps-items-center ps-gap-2 ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent data-[state=open]:ps-bg-accent [&_svg]:ps-pointer-events-none [&_svg]:ps-size-4 [&_svg]:ps-shrink-0",a&&"ps-pl-8",e),...o,children:[t,(0,k.jsx)(Z,{className:"ps-ml-auto"})]}));tt.displayName=n.SubTrigger.displayName;var ot=_.forwardRef(({className:e,...a},t)=>(0,k.jsx)(n.SubContent,{ref:t,className:u("ps-z-50 ps-min-w-[8rem] ps-overflow-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-lg data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-dropdown-menu-content-transform-origin]",e),...a}));ot.displayName=n.SubContent.displayName;var Ne=_.forwardRef(({className:e,sideOffset:a=4,...t},o)=>(0,k.jsx)(n.Portal,{children:(0,k.jsx)(n.Content,{ref:o,sideOffset:a,className:u("ps-z-50 ps-max-h-[var(--radix-dropdown-menu-content-available-height)] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-md","data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-dropdown-menu-content-transform-origin]",e),...t})}));Ne.displayName=n.Content.displayName;var ve=_.forwardRef(({className:e,inset:a,...t},o)=>(0,k.jsx)(n.Item,{ref:o,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-gap-2 ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50 [&>svg]:ps-size-4 [&>svg]:ps-shrink-0",a&&"ps-pl-8",e),...t}));ve.displayName=n.Item.displayName;var lt=_.forwardRef(({className:e,children:a,checked:t,...o},l)=>(0,k.jsxs)(n.CheckboxItem,{ref:l,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),checked:t,...o,children:[(0,k.jsx)("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:(0,k.jsx)(n.ItemIndicator,{children:(0,k.jsx)(K,{className:"ps-h-4 ps-w-4"})})}),a]}));lt.displayName=n.CheckboxItem.displayName;var ut=_.forwardRef(({className:e,children:a,...t},o)=>(0,k.jsxs)(n.RadioItem,{ref:o,className:u("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[(0,k.jsx)("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:(0,k.jsx)(n.ItemIndicator,{children:(0,k.jsx)(te,{className:"ps-h-2 ps-w-2 ps-fill-current"})})}),a]}));ut.displayName=n.RadioItem.displayName;var dt=_.forwardRef(({className:e,inset:a,...t},o)=>(0,k.jsx)(n.Label,{ref:o,className:u("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold",a&&"ps-pl-8",e),...t}));dt.displayName=n.Label.displayName;var st=_.forwardRef(({className:e,...a},t)=>(0,k.jsx)(n.Separator,{ref:t,className:u("ps--mx-1 ps-my-1 ps-h-px ps-bg-muted",e),...a}));st.displayName=n.Separator.displayName;var rt=({className:e,...a})=>(0,k.jsx)("span",{className:u("ps-ml-auto ps-text-xs ps-tracking-widest ps-opacity-60",e),...a});rt.displayName="DropdownMenuShortcut";var x=require("react/jsx-runtime");function Ee({header:e}){let a=e.column.columnDef.meta,t=a?.dataType,o=a?.isRelational;return(0,x.jsxs)("div",{className:"ps-flex ps-items-center ps-justify-between ps-w-full ps-h-full",children:[(0,x.jsxs)("div",{className:"ps-flex-1 ps-flex ps-items-center ps-justify-between",children:[o&&(0,x.jsx)(ge,{size:14,className:"text-blue-700"}),(0,x.jsxs)("div",{className:"ps-align-text-bottom ps-leading-none ps-h-[20px]",children:[(0,x.jsx)("span",{className:"ps-inline-block ps-text-foreground ps-font-bold ps-text-sm",children:e.isPlaceholder?null:(0,Pa.flexRender)(e.column.columnDef.header,e.getContext())}),t&&t!=="NONE"&&(0,x.jsx)("span",{className:"ps-inline-block ps-ml-2 ps-text-xs ps-font-mono ps-text-muted-foreground/70 ps-lowercase",children:t})]}),(0,x.jsx)("span",{className:"ps-flex ps-items-center ps-gap-1",children:e.column.getCanPin()&&e.column.id!=="select"&&(0,x.jsxs)(ha,{children:[(0,x.jsx)(Sa,{asChild:!0,children:(0,x.jsx)(z,{variant:"ghost",size:"icon",children:(0,x.jsx)($,{size:16})})}),(0,x.jsxs)(Ne,{children:[e.column.getCanSort()&&(0,x.jsx)(ve,{onClick:()=>e.column.toggleSorting(e.column.getIsSorted()==="asc"),children:(0,x.jsxs)("span",{className:"ps-flex ps-items-center ps-gap-2",children:[e.column.getIsSorted()==="asc"?(0,x.jsx)(j,{size:16}):(0,x.jsx)(pe,{size:16}),e.column.getIsSorted()==="asc"?"Sort descending":"Sort ascending"]})}),(0,x.jsx)(ve,{onClick:()=>e.column.pin(e.column.getIsPinned()?!1:"left"),children:e.column.getIsPinned()?(0,x.jsxs)("span",{className:"ps-flex ps-items-center ps-gap-2",children:[(0,x.jsx)(he,{size:16}),"Unpin column"]}):(0,x.jsxs)("span",{className:"ps-flex ps-items-center ps-gap-2",children:[(0,x.jsx)(Se,{size:16}),"Pin column"]})})]})]})})]}),e.column.getCanResize()&&(0,x.jsx)("button",{type:"button",tabIndex:0,onMouseDown:l=>{l.stopPropagation(),e.getResizeHandler()(l)},onTouchStart:l=>{l.stopPropagation(),e.getResizeHandler()(l)},onClick:l=>l.stopPropagation(),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),l.stopPropagation(),e.getResizeHandler()(l))},className:u("ps-absolute ps-right-0 ps-top-0 ps-h-full ps-w-3 ps-cursor-col-resize","ps-select-none ps-touch-none ps-transition-colors ps-group","ps-border-0 ps-bg-transparent",e.column.getIsResizing()&&"ps-bg-gray-300","before:ps-absolute before:ps-right-[3px] before:ps-top-1/2 before:ps--translate-y-1/2","after:ps-absolute after:ps-right-[7px] after:ps-top-1/2 after:ps--translate-y-1/2","before:ps-w-[2px] before:ps-h-0 before:ps-bg-gray-400 before:ps-rounded-full before:ps-opacity-0","after:ps-w-[2px] after:ps-h-0 after:ps-bg-gray-400 after:ps-rounded-full after:ps-opacity-0","before:ps-transition-all before:ps-duration-200","after:ps-transition-all after:ps-duration-200","group-hover:before:ps-opacity-100","group-hover:after:ps-opacity-100","group-hover:before:ps-h-4","group-hover:after:ps-h-4","group-active:ps-bg-transparent group-active:before:ps-bg-white group-active:after:ps-bg-white",e.column.getIsResizing()&&"before:ps-opacity-100"),"aria-label":"Resize column"})]})}var wa=A(require("react"),1);var ka=require("react/jsx-runtime"),Ge=wa.forwardRef(({className:e,type:a,...t},o)=>(0,ka.jsx)("input",{type:a,className:u("ps-flex ps-h-9 ps-w-full ps-rounded-md ps-border ps-border-input ps-bg-transparent ps-px-3 ps-py-1 ps-text-base ps-shadow-sm ps-transition-colors file:ps-border-0 file:ps-bg-transparent file:ps-text-sm file:ps-font-medium file:ps-text-foreground placeholder:ps-text-muted-foreground focus-visible:ps-outline-none focus-visible:ps-ring-1 focus-visible:ps-ring-ring disabled:ps-cursor-not-allowed disabled:ps-opacity-50 md:ps-text-sm",e),ref:o,...t}));Ge.displayName="Input";var c=A(require("@radix-ui/react-select"),1);var Y=A(require("react"),1);var h=require("react/jsx-runtime"),ba=c.Root;var Ra=c.Value,ze=Y.forwardRef(({className:e,children:a,...t},o)=>(0,h.jsxs)(c.Trigger,{ref:o,className:u("ps-flex ps-h-9 ps-w-full ps-items-center ps-justify-between ps-whitespace-nowrap ps-rounded-md ps-border ps-border-input ps-bg-transparent ps-px-3 ps-py-2 ps-text-sm ps-shadow-sm ps-ring-offset-background data-[placeholder]:ps-text-muted-foreground focus:ps-outline-none focus:ps-ring-1 focus:ps-ring-ring disabled:ps-cursor-not-allowed disabled:ps-opacity-50 [&>span]:ps-line-clamp-1",e),...t,children:[a,(0,h.jsx)(c.Icon,{asChild:!0,children:(0,h.jsx)(se,{className:"ps-h-4 ps-w-4 ps-opacity-50"})})]}));ze.displayName=c.Trigger.displayName;var Ma=Y.forwardRef(({className:e,...a},t)=>(0,h.jsx)(c.ScrollUpButton,{ref:t,className:u("ps-flex ps-cursor-default ps-items-center ps-justify-center ps-py-1",e),...a,children:(0,h.jsx)(Le,{className:"ps-h-4 ps-w-4"})}));Ma.displayName=c.ScrollUpButton.displayName;var va=Y.forwardRef(({className:e,...a},t)=>(0,h.jsx)(c.ScrollDownButton,{ref:t,className:u("ps-flex ps-cursor-default ps-items-center ps-justify-center ps-py-1",e),...a,children:(0,h.jsx)(se,{className:"ps-h-4 ps-w-4"})}));va.displayName=c.ScrollDownButton.displayName;var Ve=Y.forwardRef(({className:e,children:a,position:t="popper",...o},l)=>(0,h.jsx)(c.Portal,{children:(0,h.jsxs)(c.Content,{ref:l,className:u("ps-relative ps-z-50 ps-max-h-[--radix-select-content-available-height] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-text-popover-foreground ps-shadow-md data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-select-content-transform-origin]",t==="popper"&&"data-[side=bottom]:ps-translate-y-1 data-[side=left]:ps--translate-x-1 data-[side=right]:ps-translate-x-1 data-[side=top]:ps--translate-y-1",e),position:t,...o,children:[(0,h.jsx)(Ma,{}),(0,h.jsx)(c.Viewport,{className:u("ps-p-1",t==="popper"&&"ps-h-[var(--radix-select-trigger-height)] ps-w-full ps-min-w-[var(--radix-select-trigger-width)]"),children:a}),(0,h.jsx)(va,{})]})}));Ve.displayName=c.Content.displayName;var ft=Y.forwardRef(({className:e,...a},t)=>(0,h.jsx)(c.Label,{ref:t,className:u("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold",e),...a}));ft.displayName=c.Label.displayName;var We=Y.forwardRef(({className:e,children:a,...t},o)=>(0,h.jsxs)(c.Item,{ref:o,className:u("ps-relative ps-flex ps-w-full ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-2 ps-pr-8 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[(0,h.jsx)("span",{className:"ps-absolute ps-right-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:(0,h.jsx)(c.ItemIndicator,{children:(0,h.jsx)(K,{className:"ps-h-4 ps-w-4"})})}),(0,h.jsx)(c.ItemText,{children:a})]}));We.displayName=c.Item.displayName;var it=Y.forwardRef(({className:e,...a},t)=>(0,h.jsx)(c.Separator,{ref:t,className:u("ps--mx-1 ps-my-1 ps-h-px ps-bg-muted",e),...a}));it.displayName=c.Separator.displayName;var I=require("react/jsx-runtime"),nt=[10,20,50,100];function ya({table:e,variant:a="basic",className:t}){let{pageSize:o,pageIndex:l}=e.getState().pagination,m=e.getPageCount();return(0,I.jsx)("div",{className:u("ps-flex ps-items-center ps-justify-between ps-space-x-2 ps-py-4 ps-px-4",t),children:a==="basic"?(0,I.jsxs)("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[(0,I.jsx)(z,{variant:"outline",size:"sm",className:"ps-h-9",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:"Previous"}),(0,I.jsx)(z,{variant:"outline",size:"sm",className:"ps-h-9",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:"Next"})]}):(0,I.jsxs)("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[(0,I.jsxs)("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[(0,I.jsx)(z,{variant:"outline",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:(0,I.jsx)(xe,{className:"ps-w-4 ps-h-4"})}),(0,I.jsx)(z,{variant:"outline",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:(0,I.jsx)(me,{className:"ps-w-4 ps-h-4"})}),(0,I.jsxs)("div",{className:"ps-flex ps-items-center ps-gap-1 ps-text-xs ps-font-medium",children:["Page",(0,I.jsx)(Ge,{type:"number",min:1,max:m,value:l+1,className:"ps-w-12",onChange:r=>{let f=r.target.value?Number(r.target.value)-1:0;e.setPageIndex(f)}}),(0,I.jsxs)("span",{className:"ps-shrink-0 ps-w-max",children:["of ",m]})]}),(0,I.jsx)(z,{variant:"outline",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:(0,I.jsx)(Z,{className:"ps-w-4 ps-h-4"})}),(0,I.jsx)(z,{variant:"outline",onClick:()=>e.setPageIndex(m-1),disabled:!e.getCanNextPage(),children:(0,I.jsx)(Ie,{className:"ps-w-4 ps-h-4"})})]}),(0,I.jsxs)(ba,{value:o.toString(),onValueChange:r=>e.setPageSize(Number(r)),children:[(0,I.jsx)(ze,{children:(0,I.jsx)(Ra,{})}),(0,I.jsx)(Ve,{children:nt.map(r=>(0,I.jsxs)(We,{value:r.toString(),children:[r," per page"]},r))})]})]})})}var Pe=e=>{let a=e.getIsPinned(),t=a==="left"&&e.getIsLastColumn("left"),o=a==="right"&&e.getIsFirstColumn("right");return{className:u("ps-overflow-hidden ps-whitespace-nowrap ps-text-ellipsis",a&&["ps-sticky ps-bg-background ps-shadow-[1px_0_0_0_hsl(var(--border))]",a==="left"?"ps-left-0":"ps-right-0","ps-z-20"],!a&&"ps-relative ps-z-10",t&&"ps-shadow-[1px_0_0_0_hsl(var(--border))]",o&&"ps-shadow-[-1px_0_0_0_hsl(var(--border))]"),style:{width:e.getSize(),left:a==="left"?`${e.getStart("left")}px`:void 0,right:a==="right"?`${e.getAfter("right")}px`:void 0}}};var p=require("react/jsx-runtime"),ct=({_table:e})=>{let{currentTable:a,isLoaded:t}=ke();return t?(0,p.jsx)("div",{className:"ps-flex ps-items-center ps-justify-between ps-w-full ps-gap-2",children:(0,p.jsx)("div",{className:"ps-flex ps-items-center ps-gap-2",children:(0,p.jsx)("span",{className:"ps-flex ps-items-center ps-gap-2",children:(0,p.jsx)("h1",{className:"ps-text-sm ps-font-medium",children:a?.name})})})}):null},pt=({header:e,children:a,getPinningStyles:t})=>{let{attributes:o,listeners:l,transform:m,transition:r,setNodeRef:f,isDragging:C,isOver:S}=(0,re.useSortable)({id:e.id}),b=e.column.columnDef.meta,R={transform:Da.CSS.Transform.toString(m),transition:r,...t(e.column).style,cursor:"grab",touchAction:"none"};return(0,p.jsxs)(be,{ref:f,...o,...l,style:R,"data-relational":b?.isRelational?"true":void 0,"data-relates-to":b?.relatesTo,"data-relation-field":b?.relationField,className:u("ps-group",t(e.column).className,C&&"ps-opacity-50",S&&"ps-bg-gray-100","ps-select-none ps-touch-none ps-relative",e.column.getIsPinned()&&"ps-sticky"),children:[a,S&&(0,p.jsx)("div",{className:"ps-absolute ps-inset-0 ps-border-2 ps-border-primary ps-rounded-sm ps-pointer-events-none"})]})};function Ta({data:e=[],columns:a}){console.log("Data received in StudioGrid:",e);let[t,o]=(0,N.useState)([]),[l,m]=(0,N.useState)([]),[r,f]=(0,N.useState)({}),[C,S]=(0,N.useState)({left:[],right:[]}),[b,R]=(0,N.useState)([]),[fe,O]=(0,N.useState)("");(0,N.useEffect)(()=>{if(a&&a.length>0){let g=a.map(q=>q.id);if(b.length===0){R(g);return}let d=[...b],P=d.filter(q=>!a.some(ue=>ue.id===q));P.forEach(q=>{let ue=d.indexOf(q);ue!==-1&&d.splice(ue,1)});let T=g.filter(q=>!d.includes(q));T.length>0&&d.push(...T),(P.length>0||T.length>0)&&R(d)}},[a,b]);let D=(0,ee.useSensor)(ee.MouseSensor,{activationConstraint:{distance:10}}),B=(0,ee.useSensors)(D),F=g=>{let{active:d,over:P}=g;if(P&&d.id!==P.id){let T=M.getColumn(d.id),q=M.getColumn(P.id);if(!T||!q)return;let ue=T.getIsPinned(),Ua=q.getIsPinned();if(ue!==Ua)return;let Ze=b.indexOf(d.id),Je=b.indexOf(P.id);if(Ze===-1||Je===-1)return;let ye=[...b];ye.splice(Ze,1),ye.splice(Je,0,d.id),R(ye)}},E=(0,N.useMemo)(()=>{if(!a||a.length===0)return console.log("No columns configuration available"),[];let g=(d,P)=>{if(d==null)return"";switch(P){case"TIMESTAMP":return d?new Date(d).toLocaleString():"";case"UUID":case"STRING":return String(d);default:return String(d)}};return a.map(d=>({accessorKey:d.id,header:()=>(0,p.jsx)("div",{className:"ps-font-medium",children:d.id}),cell:({getValue:P})=>g(P(),d.type),meta:{dataType:d.type,isRelational:d.isRelational,relatesTo:d.relatesTo,relationField:d.relationField}}))},[a]),M=(0,V.useReactTable)({data:e||[],defaultColumn:{size:200,minSize:50,maxSize:500},columns:E,getCoreRowModel:(0,V.getCoreRowModel)(),onSortingChange:o,getSortedRowModel:(0,V.getSortedRowModel)(),getPaginationRowModel:(0,V.getPaginationRowModel)(),getFilteredRowModel:(0,V.getFilteredRowModel)(),onColumnFiltersChange:m,enableColumnResizing:!0,columnResizeMode:"onChange",onColumnSizingChange:f,enableColumnPinning:!0,onColumnPinningChange:S,onGlobalFilterChange:O,globalFilterFn:(g,d,P)=>{let T=g.getValue(d);return T==null?!1:String(T).toLowerCase().includes(String(P).toLowerCase())},state:{sorting:t,columnFilters:l,columnSizing:r,columnPinning:C,columnOrder:b,globalFilter:fe}});return!e||e.length===0?(0,p.jsxs)("div",{className:"ps-p-4 ps-border ps-rounded-md ps-w-full",children:[(0,p.jsx)("p",{className:"ps-text-lg ps-font-semibold",children:"No data available."}),(0,p.jsx)("p",{className:"ps-text-sm ps-text-gray-500",children:e?"Data array is empty.":"Data is undefined."})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"ps-bg-studio-header-background ps-flex ps-w-full ps-p-2 ps-py-3 ps-border-b",children:(0,p.jsx)(ct,{_table:M})}),(0,p.jsx)("div",{"data-studio":"content",className:"ps-flex-1 ps-w-0 ps-h-0 ps-min-w-full",children:(0,p.jsxs)("div",{className:"ps-flex ps-flex-col ps-w-full ps-h-full ps-overflow-scroll",children:[(0,p.jsx)(ee.DndContext,{sensors:B,onDragEnd:F,children:(0,p.jsxs)(De,{children:[(0,p.jsx)(Te,{children:M.getHeaderGroups().map(g=>(0,p.jsx)(ie,{className:u("ps-relative",M.getLeftLeafHeaders().some(d=>d.column.getIsPinned()==="left")&&`ps-pl-[${M.getLeftLeafHeaders().filter(d=>d.column.getIsPinned()==="left").reduce((d,P)=>d+P.getSize(),0)}px]`),children:(0,p.jsx)(re.SortableContext,{items:g.headers.map(d=>d.id),strategy:re.horizontalListSortingStrategy,children:g.headers.map(d=>d.column.id==="select"?(0,p.jsx)(be,{className:u("ps-px-[var(--studio-cell-spacing)]",Pe(d.column).className,d.column.getIsPinned()&&"ps-sticky"),style:Pe(d.column).style,"data-cell-type":"select",children:(0,p.jsx)(Ee,{header:d})},d.id):(0,p.jsx)(pt,{header:d,table:M,getPinningStyles:Pe,children:(0,p.jsx)(Ee,{header:d})},d.id))})},g.id))}),(0,p.jsx)(Ae,{children:M.getRowModel().rows?.length?M.getRowModel().rows.map(g=>(0,p.jsx)(ie,{className:u("ps-bg-table-row ps-odd:bg-table-row-odd ps-group"),children:g.getVisibleCells().map(d=>(0,p.jsx)(ma,{cell:d,getPinningStyles:Pe,dataType:a.find(P=>P.id===d.column.id)?.type},d.id))},g.id)):(0,p.jsx)(ie,{children:(0,p.jsx)(ne,{colSpan:a.length,className:"ps-h-24 ps-text-center",children:"No results."})})})]})}),(0,p.jsx)(ya,{table:M,variant:"numeric"})]})})]})}var le=require("react"),Ba=require("react/jsx-runtime"),mt={theme:"system",setTheme:()=>null},Lt=(0,le.createContext)(mt);function Aa({children:e,defaultTheme:a="system",storageKey:t="vite-ui-theme",...o}){let[l,m]=(0,le.useState)(()=>localStorage.getItem(t)||a);(0,le.useEffect)(()=>{let f=window.document.documentElement;if(f.classList.remove("light","dark"),l==="system"){let C=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(C);return}f.classList.add(l)},[l]);let r={theme:l,setTheme:f=>{localStorage.setItem(t,f),m(f)}};return(0,Ba.jsx)(Lt.Provider,{...o,value:r,children:e})}var H=require("react/jsx-runtime"),qa=(0,v.createContext)(void 0),ke=()=>{let e=(0,v.useContext)(qa);if(!e)throw new Error("useStudio must be used within a Studio.Provider");return e};function xt(e){return{id:e,accessorKey:e,header:e.charAt(0).toUpperCase()+e.slice(1),type:"STRING",nullable:!0,isKey:!1}}var Xe=new AbortController().signal,It=({adapter:e})=>{let[a,t]=(0,v.useState)([]),[o,l]=(0,v.useState)(null),[m,r]=(0,v.useState)(!1),[f,C]=(0,v.useState)([]),[S,b]=(0,v.useState)([]),R=v.default.useMemo(()=>new Set(a.filter(O=>O.isFavorite).map(O=>O.id)),[a]),fe=O=>{t(D=>D.map(B=>B.id===O?{...B,isFavorite:!B.isFavorite}:B))};return(0,v.useEffect)(()=>{(async()=>{try{let[D,B]=await e.introspect({abortSignal:Xe});if(D||!B?.schemas){console.error("Error fetching schema:",D);return}let F=Object.entries(B.schemas).flatMap(([E,M])=>Object.entries(M.tables).map(([g])=>({id:`${E}.${g}`,name:g.charAt(0).toUpperCase()+g.slice(1),schema:E,isFavorite:!1})));t(F),!o&&F.length>0&&F[0]&&l(F[0])}catch(D){console.error("Error fetching tables:",D)}})()},[e,o]),(0,v.useEffect)(()=>{(async()=>{if(!o?.id){r(!0);return}try{r(!1);let[D,B]=await e.introspect({abortSignal:Xe});if(D||!B?.schemas){console.error("Error fetching schema:",D),r(!0);return}let[F,E]=o.id.split(".");if(!F||!E){console.error("Invalid table ID format:",o.id),r(!0);return}let M=B.schemas[F];if(!M){console.error(`Schema ${F} not found`),r(!0);return}let g=M.tables[E];if(!g){console.error(`Table ${E} not found in schema ${F}`),r(!0);return}let d=Object.entries(g.columns).map(([q])=>xt(q));b(d);let[P,T]=await e.query({schema:F,table:E},{abortSignal:Xe});if(P||!T){console.error(`Failed to fetch data for table ${E}:`,P),r(!0);return}C(T.rows),r(!0)}catch(D){console.error("Error fetching table data:",D),r(!0)}})()},[e,o]),e?!m&&a.length===0?(0,H.jsx)("div",{children:"Loading available tables..."}):m&&a.length===0?(0,H.jsx)("div",{children:"No tables found in the database."}):(0,H.jsx)(Aa,{children:(0,H.jsx)(Fa.NuqsAdapter,{children:(0,H.jsx)(qa.Provider,{value:{adapter:e,currentTable:o,isLoaded:m,tables:a,favoriteTableIds:R,setCurrentTable:l,toggleFavorite:fe},children:(0,H.jsxs)("div",{className:"ps-flex ps-gap-4 ps-w-full ps-rounded-sm ps-bg-background ps-p-4 ps-relative",children:[(0,H.jsx)(ea,{}),(0,H.jsx)("div",{className:"ps-flex ps-w-full ps-flex-col ps-border ps-rounded-lg",children:(0,H.jsx)(Ta,{columns:S,data:f})})]})})})}):(console.error("No adapter provided to Studio component"),(0,H.jsx)("div",{children:"Error: No adapter provided"}))},Ke=It;0&&(module.exports={Studio});
2
- /*! Bundled license information:
3
-
4
- lucide-react/dist/esm/shared/src/utils.js:
5
- (**
6
- * @license lucide-react v0.427.0 - ISC
7
- *
8
- * This source code is licensed under the ISC license.
9
- * See the LICENSE file in the root directory of this source tree.
10
- *)
11
-
12
- lucide-react/dist/esm/defaultAttributes.js:
13
- (**
14
- * @license lucide-react v0.427.0 - ISC
15
- *
16
- * This source code is licensed under the ISC license.
17
- * See the LICENSE file in the root directory of this source tree.
18
- *)
19
-
20
- lucide-react/dist/esm/Icon.js:
21
- (**
22
- * @license lucide-react v0.427.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- *)
27
-
28
- lucide-react/dist/esm/createLucideIcon.js:
29
- (**
30
- * @license lucide-react v0.427.0 - ISC
31
- *
32
- * This source code is licensed under the ISC license.
33
- * See the LICENSE file in the root directory of this source tree.
34
- *)
35
-
36
- lucide-react/dist/esm/icons/arrow-down-wide-narrow.js:
37
- (**
38
- * @license lucide-react v0.427.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- *)
43
-
44
- lucide-react/dist/esm/icons/arrow-up-wide-narrow.js:
45
- (**
46
- * @license lucide-react v0.427.0 - ISC
47
- *
48
- * This source code is licensed under the ISC license.
49
- * See the LICENSE file in the root directory of this source tree.
50
- *)
51
-
52
- lucide-react/dist/esm/icons/check.js:
53
- (**
54
- * @license lucide-react v0.427.0 - ISC
55
- *
56
- * This source code is licensed under the ISC license.
57
- * See the LICENSE file in the root directory of this source tree.
58
- *)
59
-
60
- lucide-react/dist/esm/icons/chevron-down.js:
61
- (**
62
- * @license lucide-react v0.427.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- *)
67
-
68
- lucide-react/dist/esm/icons/chevron-left.js:
69
- (**
70
- * @license lucide-react v0.427.0 - ISC
71
- *
72
- * This source code is licensed under the ISC license.
73
- * See the LICENSE file in the root directory of this source tree.
74
- *)
75
-
76
- lucide-react/dist/esm/icons/chevron-right.js:
77
- (**
78
- * @license lucide-react v0.427.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- *)
83
-
84
- lucide-react/dist/esm/icons/chevron-up.js:
85
- (**
86
- * @license lucide-react v0.427.0 - ISC
87
- *
88
- * This source code is licensed under the ISC license.
89
- * See the LICENSE file in the root directory of this source tree.
90
- *)
91
-
92
- lucide-react/dist/esm/icons/chevrons-left.js:
93
- (**
94
- * @license lucide-react v0.427.0 - ISC
95
- *
96
- * This source code is licensed under the ISC license.
97
- * See the LICENSE file in the root directory of this source tree.
98
- *)
99
-
100
- lucide-react/dist/esm/icons/chevrons-right.js:
101
- (**
102
- * @license lucide-react v0.427.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- *)
107
-
108
- lucide-react/dist/esm/icons/circle.js:
109
- (**
110
- * @license lucide-react v0.427.0 - ISC
111
- *
112
- * This source code is licensed under the ISC license.
113
- * See the LICENSE file in the root directory of this source tree.
114
- *)
115
-
116
- lucide-react/dist/esm/icons/copy.js:
117
- (**
118
- * @license lucide-react v0.427.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- *)
123
-
124
- lucide-react/dist/esm/icons/ellipsis.js:
125
- (**
126
- * @license lucide-react v0.427.0 - ISC
127
- *
128
- * This source code is licensed under the ISC license.
129
- * See the LICENSE file in the root directory of this source tree.
130
- *)
131
-
132
- lucide-react/dist/esm/icons/link.js:
133
- (**
134
- * @license lucide-react v0.427.0 - ISC
135
- *
136
- * This source code is licensed under the ISC license.
137
- * See the LICENSE file in the root directory of this source tree.
138
- *)
139
-
140
- lucide-react/dist/esm/icons/pin-off.js:
141
- (**
142
- * @license lucide-react v0.427.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- *)
147
-
148
- lucide-react/dist/esm/icons/pin.js:
149
- (**
150
- * @license lucide-react v0.427.0 - ISC
151
- *
152
- * This source code is licensed under the ISC license.
153
- * See the LICENSE file in the root directory of this source tree.
154
- *)
155
-
156
- lucide-react/dist/esm/lucide-react.js:
157
- (**
158
- * @license lucide-react v0.427.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- *)
163
- */
1
+ "use strict";var f=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var V=Object.prototype.hasOwnProperty;var B=(e,t)=>{for(var r in t)f(e,r,{get:t[r],enumerable:!0})},M=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of L(t))!V.call(e,o)&&o!==r&&f(e,o,{get:()=>t[o],enumerable:!(s=q(t,o))||s.enumerable});return e};var Q=e=>M(f({},"__esModule",{value:!0}),e);var F={};B(F,{Studio:()=>W});module.exports=Q(F);var me=require("../index-ESMXH6DI.css");var w=require("@radix-ui/react-slot");var S=require("@tanstack/react-query");var v=require("@tanstack/react-query"),T=require("nuqs/adapters/react"),m=require("react"),c=require("react/jsx-runtime"),R=new v.QueryClient,b=(0,m.createContext)(void 0);function P(e){let{children:t,...r}=e,[s,o]=(0,m.useState)(null);return(0,c.jsx)(v.QueryClientProvider,{client:R,children:(0,c.jsx)(T.NuqsAdapter,{children:(0,c.jsx)(b.Provider,{value:{...r,activeTable:s,setActiveTable:o},children:t})})})}function h(){let e=(0,m.useContext)(b);if(!e)throw new Error("`useStudio` must be used within a `StudioContext.Provider`");return e}function C(){let{adapter:e}=h();return(0,S.useQuery)({initialData:{schemas:{[e.defaultSchema||"db"]:{tables:{}}}},queryFn:async({signal:t})=>{let[r,s]=await e.introspect({abortSignal:t});if(r)throw r;return s},queryKey:["introspection"],staleTime:1/0})}var g=require("clsx"),y=require("tailwind-merge");function x(...e){return(0,y.twMerge)((0,g.clsx)(e))}var i=require("react/jsx-runtime"),l=()=>{let{data:e}=C(),{activeTable:t,adapter:r,setActiveTable:s}=h();return(0,i.jsx)("div",{className:"ps-flex ps-flex-col ps-w-64 ps-gap-4 ps-shrink-0",children:(0,i.jsx)(l.Block,{label:"Tables",children:Object.values(e.schemas[r.defaultSchema||"db"].tables).map(o=>(0,i.jsx)(l.Item,{isActive:t===o,onClick:u=>{u.preventDefault(),t!==o&&s(o)},className:`ps-px-2 ps-py-1 ps-cursor-pointer ps-rounded ${t===o?"ps-bg-primary ps-text-white":"ps-hover:ps-bg-gray-100"}`,children:o.name},`${o.schema}-${o.name}`))})})},D=({className:e,label:t,children:r,...s})=>(0,i.jsxs)("div",{className:x("ps-rounded-lg ps-border ps-bg-card ps-text-card-foreground ps-shadow-xs",e),...s,children:[(0,i.jsx)("div",{className:"ps-pt-4 ps-pb-2 ps-px-4",children:(0,i.jsx)("h2",{className:"ps-text-sm ps-font-medium",children:t})}),(0,i.jsx)("nav",{"aria-label":t,className:"ps-flex ps-flex-col ps-gap-px ps-pb-3",children:r})]}),$=({className:e,asChild:t=!1,isActive:r,size:s,...o})=>(0,i.jsx)(t?w.Slot:"button",{"data-sidebar":"menu-button","data-size":s,"data-active":r,className:x("ps-py-1.5 ps-px-4 ps-text-sm ps-font-medium ps-flex ps-gap-2 ps-items-center ps-border ps-border-transparent ps-bg-transparent ps-hover:bg-muted/50",e),...o});l.Block=D;l.Item=$;var N=l;var n=require("react"),k=require("react/jsx-runtime"),z={theme:"system",setTheme:()=>null},H=(0,n.createContext)(z);function A({children:e,defaultTheme:t="system",storageKey:r="vite-ui-theme",...s}){let[o,u]=(0,n.useState)(()=>localStorage.getItem(r)||t);(0,n.useEffect)(()=>{let p=window.document.documentElement;if(p.classList.remove("light","dark"),o==="system"){let E=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";p.classList.add(E);return}p.classList.add(o)},[o]);let I={theme:o,setTheme:p=>{localStorage.setItem(r,p),u(p)}};return(0,k.jsx)(H.Provider,{...s,value:I,children:e})}var a=require("react/jsx-runtime");function W(e){let{adapter:t}=e;return t?(0,a.jsx)(A,{children:(0,a.jsx)(P,{adapter:t,children:(0,a.jsxs)("div",{className:"ps-flex ps-gap-4 ps-w-full ps-rounded-sm ps-bg-background ps-p-4 ps-relative",children:[(0,a.jsx)(N,{}),(0,a.jsx)("div",{className:"ps-flex ps-w-full ps-flex-col ps-border ps-rounded-lg"})]})})}):(console.error("No adapter provided to Studio component"),(0,a.jsx)("div",{children:"Error: No adapter provided"}))}0&&(module.exports={Studio});
@@ -1,23 +1,13 @@
1
- import { ReactNode } from 'react';
2
- import { A as Adapter } from '../adapter-D0mwGLmg.cjs';
3
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { A as Adapter } from '../adapter-D0mwGLmg.cjs';
4
3
  import '../type-utils-rTHUvEmt.cjs';
5
4
 
6
- interface StudioProps$1 {
7
- adapter: Adapter;
8
- children?: ReactNode;
9
- }
10
-
11
- /**
12
- * Studio component props
13
- */
14
5
  interface StudioProps {
15
6
  adapter: Adapter;
16
7
  }
17
8
  /**
18
9
  * Main Studio component that provides database visualization and management
19
- * @param adapter - Implementation of the Adapter interface for database operations
20
10
  */
21
- declare const Studio: ({ adapter }: StudioProps) => react_jsx_runtime.JSX.Element;
11
+ declare function Studio(props: StudioProps): react_jsx_runtime.JSX.Element;
22
12
 
23
- export { Studio, type StudioProps$1 as StudioProps };
13
+ export { Studio, type StudioProps };
@@ -1,23 +1,13 @@
1
- import { ReactNode } from 'react';
2
- import { A as Adapter } from '../adapter-CqrlY1Ga.js';
3
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { A as Adapter } from '../adapter-CqrlY1Ga.js';
4
3
  import '../type-utils-rTHUvEmt.js';
5
4
 
6
- interface StudioProps$1 {
7
- adapter: Adapter;
8
- children?: ReactNode;
9
- }
10
-
11
- /**
12
- * Studio component props
13
- */
14
5
  interface StudioProps {
15
6
  adapter: Adapter;
16
7
  }
17
8
  /**
18
9
  * Main Studio component that provides database visualization and management
19
- * @param adapter - Implementation of the Adapter interface for database operations
20
10
  */
21
- declare const Studio: ({ adapter }: StudioProps) => react_jsx_runtime.JSX.Element;
11
+ declare function Studio(props: StudioProps): react_jsx_runtime.JSX.Element;
22
12
 
23
- export { Studio, type StudioProps$1 as StudioProps };
13
+ export { Studio, type StudioProps };
package/dist/ui/index.js CHANGED
@@ -1,163 +1 @@
1
- import"../chunk-2FW6TKD6.js";import"../index-KSZNOSSS.css";import{NuqsAdapter as Tt}from"nuqs/adapters/react";import At,{createContext as Bt,useContext as Ft,useEffect as Ia,useState as Ce}from"react";import{Slot as wa}from"@radix-ui/react-slot";import{useQueryState as ka}from"nuqs";import{clsx as Sa}from"clsx";import{twMerge as Pa}from"tailwind-merge";function l(...e){return Pa(Sa(e))}import{jsx as X,jsxs as Ze}from"react/jsx-runtime";var _=()=>{let{setCurrentTable:e,currentTable:a,favoriteTableIds:t,tables:o}=ge(),[u,p]=ka("tableId"),r=async f=>{await p(f);let x=o.find(C=>C.id===f);x&&e(x)};return Ze("div",{className:"ps-flex ps-flex-col ps-w-64 ps-gap-4 ps-shrink-0",children:[X(_.Block,{label:"Tables",children:o.map(f=>X(_.Item,{isActive:a?.id===f.id,onClick:x=>{x.preventDefault(),r(f.id)},className:`ps-px-2 ps-py-1 ps-cursor-pointer ps-rounded ${a?.id===f.id?"ps-bg-primary ps-text-white":"ps-hover:ps-bg-gray-100"}`,children:f.name},f.id))}),t.size>0&&X(_.Block,{label:"Favourites",children:o.filter(f=>t.has(f.id)).map(f=>X(_.Item,{isActive:a?.id===f.id,onClick:x=>{x.preventDefault(),r(f.id)},children:f.name},f.id))})]})},ba=({className:e,label:a,children:t,...o})=>Ze("div",{className:l("ps-rounded-lg ps-border ps-bg-card ps-text-card-foreground ps-shadow-xs",e),...o,children:[X("div",{className:"ps-pt-4 ps-pb-2 ps-px-4",children:X("h2",{className:"ps-text-sm ps-font-medium",children:a})}),X("nav",{"aria-label":a,className:"ps-flex ps-flex-col ps-gap-px ps-pb-3",children:t})]}),Ra=({className:e,asChild:a=!1,isActive:t,size:o,...u})=>X(a?wa:"button",{"data-sidebar":"menu-button","data-size":o,"data-active":t,className:l("ps-py-1.5 ps-px-4 ps-text-sm ps-font-medium ps-flex ps-gap-2 ps-items-center ps-border ps-border-transparent ps-bg-transparent ps-hover:bg-muted/50",e),...u});_.Block=ba;_.Item=Ra;var Ke=_;import{DndContext as st,MouseSensor as rt,useSensor as ft,useSensors as it}from"@dnd-kit/core";import{horizontalListSortingStrategy as nt,SortableContext as ct,useSortable as pt}from"@dnd-kit/sortable";import{CSS as mt}from"@dnd-kit/utilities";import{getCoreRowModel as Lt,getFilteredRowModel as xt,getPaginationRowModel as It,getSortedRowModel as Ct,useReactTable as gt}from"@tanstack/react-table";import{useEffect as ht,useMemo as St,useState as te}from"react";import*as O from"react";import{jsx as H}from"react/jsx-runtime";var ke=O.forwardRef(({className:e,...a},t)=>H("div",{className:"ps-relative ps-w-full ps-overflow-auto ps-flex ps-items-start ps-h-full",children:H("table",{ref:t,className:l("ps-w-full ps-caption-bottom ps-text-sm table-fixed",e),...a})}));ke.displayName="Table";var be=O.forwardRef(({className:e,...a},t)=>H("thead",{ref:t,className:l("[&_tr]:ps-border-b",e),...a}));be.displayName="TableHeader";var Re=O.forwardRef(({className:e,...a},t)=>H("tbody",{ref:t,className:l("[&_tr:last-child]:ps-border-0",e),...a}));Re.displayName="TableBody";var Ma=O.forwardRef(({className:e,...a},t)=>H("tfoot",{ref:t,className:l("ps-border-t ps-bg-muted/50 ps-font-medium [&>tr]:last:ps-border-b-0",e),...a}));Ma.displayName="TableFooter";var le=O.forwardRef(({className:e,...a},t)=>H("tr",{ref:t,className:l("ps-border-b ps-transition-colors hover:ps-bg-muted/50 data-[state=selected]:ps-bg-muted",e),...a}));le.displayName="TableRow";var he=O.forwardRef(({className:e,...a},t)=>H("th",{ref:t,className:l("ps-h-10 ps-px-2 ps-text-left ps-align-middle ps-font-medium ps-text-muted-foreground [&:has([role=checkbox])]:ps-pr-0 [&>[role=checkbox]]:ps-translate-y-[2px]",e),...a}));he.displayName="TableHead";var ue=O.forwardRef(({className:e,...a},t)=>H("td",{ref:t,className:l("ps-p-2 ps-align-middle [&:has([role=checkbox])]:ps-pr-0 [&>[role=checkbox]]:ps-translate-y-[2px]",e),...a}));ue.displayName="TableCell";var va=O.forwardRef(({className:e,...a},t)=>H("caption",{ref:t,className:l("ps-mt-4 ps-text-sm ps-text-muted-foreground",e),...a}));va.displayName="TableCaption";import{tokyoNight as Ga}from"@uiw/codemirror-theme-tokyo-night";import za from"@uiw/react-codemirror";import*as N from"@radix-ui/react-popover";import*as b from"react";import{jsx as de}from"react/jsx-runtime";var Je=b.createContext(null),Me=({children:e,...a})=>{let[t,o]=b.useState(!1);return de(Je.Provider,{value:{open:t,setOpen:o},children:de(N.Root,{open:t,onOpenChange:o,...a,children:e})})};Me.displayName="PopoverCell";var ve=b.forwardRef(({children:e,onDoubleClick:a,className:t,...o},u)=>{let p=b.useContext(Je),[r,f]=b.useState(!1),x=b.useRef(null);return b.useEffect(()=>{let S=oe=>{let F=oe.target;x.current&&!x.current.contains(F)&&(console.log("Outside click - removing focus"),f(!1))};return document.addEventListener("click",S),()=>document.removeEventListener("click",S)},[]),de(N.Trigger,{ref:S=>{typeof u=="function"?u(S):u&&(u.current=S),x.current=S},onClick:S=>{S.preventDefault(),console.log("Click handler - setting focus to true"),f(!0)},onDoubleClick:S=>{S.preventDefault(),p?.setOpen(!0),a?.()},"data-focus":r.toString(),className:l("w-full h-full cursor-pointer",t),...o,children:e})});ve.displayName="PopoverCellTrigger";var ye=b.forwardRef(({className:e,align:a="center",sideOffset:t=4,...o},u)=>de(N.Portal,{children:de(N.Content,{ref:u,align:a,sideOffset:t,className:l("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));ye.displayName=N.Content.displayName;import{forwardRef as Da,createElement as Ta}from"react";var Qe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Se=(...e)=>e.filter((a,t,o)=>!!a&&o.indexOf(a)===t).join(" ");import{forwardRef as ya,createElement as je}from"react";var _e={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var $e=ya(({color:e="currentColor",size:a=24,strokeWidth:t=2,absoluteStrokeWidth:o,className:u="",children:p,iconNode:r,...f},x)=>je("svg",{ref:x,..._e,width:a,height:a,stroke:e,strokeWidth:o?Number(t)*24/Number(a):t,className:Se("lucide",u),...f},[...r.map(([C,h])=>je(C,h)),...Array.isArray(p)?p:[p]]));var m=(e,a)=>{let t=Da(({className:o,...u},p)=>Ta($e,{ref:p,iconNode:a,className:Se(`lucide-${Qe(e)}`,o),...u}));return t.displayName=`${e}`,t};var K=m("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);var se=m("ArrowUpWideNarrow",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]]);var E=m("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);var ee=m("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);var re=m("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);var G=m("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);var fe=m("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);var ie=m("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);var ne=m("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);var j=m("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var ce=m("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var Z=m("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);var pe=m("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);var me=m("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);var Le=m("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);import{isValidElement as Na}from"react";import*as i from"@radix-ui/react-context-menu";import*as z from"react";import{jsx as R,jsxs as Ae}from"react/jsx-runtime";var Ye=i.Root,ea=i.Trigger;var Aa=z.forwardRef(({className:e,inset:a,children:t,...o},u)=>Ae(i.SubTrigger,{ref:u,className:l("ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[state=open]:ps-bg-accent data-[state=open]:ps-text-accent-foreground",a&&"ps-pl-8",e),...o,children:[t,R(G,{className:"ps-ml-auto ps-h-4 ps-w-4"})]}));Aa.displayName=i.SubTrigger.displayName;var Ba=z.forwardRef(({className:e,...a},t)=>R(i.SubContent,{ref:t,className:l("ps-z-50 ps-min-w-[8rem] ps-overflow-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-lg data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-context-menu-content-transform-origin]",e),...a}));Ba.displayName=i.SubContent.displayName;var De=z.forwardRef(({className:e,...a},t)=>R(i.Portal,{children:R(i.Content,{ref:t,className:l("ps-z-50 ps-max-h-[--radix-context-menu-content-available-height] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-md data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-context-menu-content-transform-origin]",e),...a})}));De.displayName=i.Content.displayName;var Te=z.forwardRef(({className:e,inset:a,...t},o)=>R(i.Item,{ref:o,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",a&&"ps-pl-8",e),...t}));Te.displayName=i.Item.displayName;var Fa=z.forwardRef(({className:e,children:a,checked:t,...o},u)=>Ae(i.CheckboxItem,{ref:u,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),checked:t,...o,children:[R("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:R(i.ItemIndicator,{children:R(E,{className:"ps-h-4 ps-w-4"})})}),a]}));Fa.displayName=i.CheckboxItem.displayName;var qa=z.forwardRef(({className:e,children:a,...t},o)=>Ae(i.RadioItem,{ref:o,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[R("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:R(i.ItemIndicator,{children:R(j,{className:"ps-h-4 ps-w-4 ps-fill-current"})})}),a]}));qa.displayName=i.RadioItem.displayName;var Ua=z.forwardRef(({className:e,inset:a,...t},o)=>R(i.Label,{ref:o,className:l("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold ps-text-foreground",a&&"ps-pl-8",e),...t}));Ua.displayName=i.Label.displayName;var Ha=z.forwardRef(({className:e,...a},t)=>R(i.Separator,{ref:t,className:l("ps--mx-1 ps-my-1 ps-h-px ps-bg-border",e),...a}));Ha.displayName=i.Separator.displayName;var Oa=({className:e,...a})=>R("span",{className:l("ps-ml-auto ps-text-xs ps-tracking-widest ps-text-muted-foreground",e),...a});Oa.displayName="ContextMenuShortcut";import{jsx as Be,jsxs as aa}from"react/jsx-runtime";var Fe=e=>{if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);if(e==null)return"";if(Na(e)){let a=e.props;return e.type&&typeof e.type=="function"&&e.type.name==="RevealText"?a.text||"":e.type&&typeof e.type=="function"&&e.type.name==="NullValue"?"NULL":a.children?Fe(a.children):""}return Array.isArray(e)?e.map(Fe).join(""):""},ta=({children:e})=>aa(Ye,{children:[Be(ea,{className:"ps-block ps-w-full ps-p-[var(--studio-cell-spacing)]",children:e}),Be(De,{children:aa(Te,{onClick:()=>{let a=Fe(e);navigator.clipboard.writeText(a).catch(t=>{console.error("Failed to copy to clipboard:",t)})},className:"ps-flex ps-items-center ps-gap-2",children:[Be(ce,{size:12}),"Copy"]})})]});import{jsx as Ea}from"react/jsx-runtime";function oa(){return Ea("code",{className:"ps-text-gray-500",children:"NULL"})}import{jsx as ae,jsxs as Va}from"react/jsx-runtime";function la({cell:e,getPinningStyles:a,dataType:t,isRelational:o,relatesTo:u,relationField:p}){let r=e.getValue(),f=r==null,x=C=>{if(C==null)return"NULL";if(typeof C=="object")try{return JSON.stringify(C,null,2)}catch(h){return console.error("Error stringifying value:",h),String(C)}return String(C)};return Va(Me,{children:[ae(ve,{asChild:!0,children:ae(ue,{...a(e.column),"data-cell-type":"data","data-type":t.toLowerCase(),"data-relational":o?"true":void 0,"data-relates-to":u,"data-relation-field":p,className:l(a(e.column).className,"ps-p-0",e.column.getIsPinned()&&"ps-sticky"),children:ae(ta,{children:f?ae(oa,{}):x(r)})})}),ae(ye,{align:"start",alignOffset:0,sideOffset:0,className:"ps-min-w-(--radix-popover-trigger-width) ps-rounded-none ps-bg-muted ps-p-0",children:ae(za,{value:x(r),theme:Ga,height:"100px",basicSetup:{lineNumbers:!0,foldGutter:!1,dropCursor:!1,allowMultipleSelections:!1,indentOnInput:!1},onChange:C=>{console.log("New value:",C)}})})]},e.id)}import{jsx as Wa}from"react/jsx-runtime";function ua({cell:e,getPinningStyles:a,dataType:t}){let o={cell:e,getPinningStyles:a},u=e.column.columnDef.meta,p={...o,isRelational:u?.isRelational,relatesTo:u?.relatesTo,relationField:u?.relationField};return Wa(la,{...p,dataType:t||"STRING"})}import{flexRender as tt}from"@tanstack/react-table";import{Slot as Xa}from"@radix-ui/react-slot";import{cva as Ka}from"class-variance-authority";import*as da from"react";import{jsx as Ja}from"react/jsx-runtime";var Za=Ka("ps-inline-flex ps-items-center ps-justify-center ps-gap-2 ps-whitespace-nowrap ps-rounded-md ps-text-sm ps-font-medium ps-transition-colors focus-visible:ps-outline-none focus-visible:ps-ring-1 focus-visible:ps-ring-ring disabled:ps-pointer-events-none disabled:ps-opacity-50 [&_svg]:ps-pointer-events-none [&_svg]:ps-size-4 [&_svg]:ps-shrink-0",{variants:{variant:{default:"ps-bg-primary ps-text-primary-foreground ps-shadow hover:ps-bg-primary/90",destructive:"ps-bg-destructive ps-text-destructive-foreground ps-shadow-sm hover:ps-bg-destructive/90",outline:"ps-border ps-border-input ps-bg-background ps-shadow-sm hover:ps-bg-accent hover:ps-text-accent-foreground",secondary:"ps-bg-secondary ps-text-secondary-foreground ps-shadow-sm hover:ps-bg-secondary/80",ghost:"hover:ps-bg-accent hover:ps-text-accent-foreground",link:"ps-text-primary ps-underline-offset-4 hover:ps-underline"},size:{default:"ps-h-9 ps-px-4 ps-py-2",sm:"ps-h-8 ps-rounded-md ps-px-3 ps-text-xs",lg:"ps-h-10 ps-rounded-md ps-px-8",icon:"ps-h-9 ps-w-9"}},defaultVariants:{variant:"default",size:"default"}}),U=da.forwardRef(({className:e,variant:a,size:t,asChild:o=!1,...u},p)=>Ja(o?Xa:"button",{className:l(Za({variant:a,size:t,className:e})),ref:p,...u}));U.displayName="Button";import*as n from"@radix-ui/react-dropdown-menu";import*as V from"react";import{jsx as M,jsxs as Ue}from"react/jsx-runtime";var sa=n.Root,ra=n.Trigger;var Qa=V.forwardRef(({className:e,inset:a,children:t,...o},u)=>Ue(n.SubTrigger,{ref:u,className:l("ps-flex ps-cursor-default ps-select-none ps-items-center ps-gap-2 ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none focus:ps-bg-accent data-[state=open]:ps-bg-accent [&_svg]:ps-pointer-events-none [&_svg]:ps-size-4 [&_svg]:ps-shrink-0",a&&"ps-pl-8",e),...o,children:[t,M(G,{className:"ps-ml-auto"})]}));Qa.displayName=n.SubTrigger.displayName;var _a=V.forwardRef(({className:e,...a},t)=>M(n.SubContent,{ref:t,className:l("ps-z-50 ps-min-w-[8rem] ps-overflow-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-lg data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-dropdown-menu-content-transform-origin]",e),...a}));_a.displayName=n.SubContent.displayName;var qe=V.forwardRef(({className:e,sideOffset:a=4,...t},o)=>M(n.Portal,{children:M(n.Content,{ref:o,sideOffset:a,className:l("ps-z-50 ps-max-h-[var(--radix-dropdown-menu-content-available-height)] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-p-1 ps-text-popover-foreground ps-shadow-md","data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-dropdown-menu-content-transform-origin]",e),...t})}));qe.displayName=n.Content.displayName;var Pe=V.forwardRef(({className:e,inset:a,...t},o)=>M(n.Item,{ref:o,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-gap-2 ps-rounded-sm ps-px-2 ps-py-1.5 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50 [&>svg]:ps-size-4 [&>svg]:ps-shrink-0",a&&"ps-pl-8",e),...t}));Pe.displayName=n.Item.displayName;var ja=V.forwardRef(({className:e,children:a,checked:t,...o},u)=>Ue(n.CheckboxItem,{ref:u,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),checked:t,...o,children:[M("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:M(n.ItemIndicator,{children:M(E,{className:"ps-h-4 ps-w-4"})})}),a]}));ja.displayName=n.CheckboxItem.displayName;var $a=V.forwardRef(({className:e,children:a,...t},o)=>Ue(n.RadioItem,{ref:o,className:l("ps-relative ps-flex ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-8 ps-pr-2 ps-text-sm ps-outline-none ps-transition-colors focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[M("span",{className:"ps-absolute ps-left-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:M(n.ItemIndicator,{children:M(j,{className:"ps-h-2 ps-w-2 ps-fill-current"})})}),a]}));$a.displayName=n.RadioItem.displayName;var Ya=V.forwardRef(({className:e,inset:a,...t},o)=>M(n.Label,{ref:o,className:l("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold",a&&"ps-pl-8",e),...t}));Ya.displayName=n.Label.displayName;var et=V.forwardRef(({className:e,...a},t)=>M(n.Separator,{ref:t,className:l("ps--mx-1 ps-my-1 ps-h-px ps-bg-muted",e),...a}));et.displayName=n.Separator.displayName;var at=({className:e,...a})=>M("span",{className:l("ps-ml-auto ps-text-xs ps-tracking-widest ps-opacity-60",e),...a});at.displayName="DropdownMenuShortcut";import{jsx as v,jsxs as J}from"react/jsx-runtime";function He({header:e}){let a=e.column.columnDef.meta,t=a?.dataType,o=a?.isRelational;return J("div",{className:"ps-flex ps-items-center ps-justify-between ps-w-full ps-h-full",children:[J("div",{className:"ps-flex-1 ps-flex ps-items-center ps-justify-between",children:[o&&v(pe,{size:14,className:"text-blue-700"}),J("div",{className:"ps-align-text-bottom ps-leading-none ps-h-[20px]",children:[v("span",{className:"ps-inline-block ps-text-foreground ps-font-bold ps-text-sm",children:e.isPlaceholder?null:tt(e.column.columnDef.header,e.getContext())}),t&&t!=="NONE"&&v("span",{className:"ps-inline-block ps-ml-2 ps-text-xs ps-font-mono ps-text-muted-foreground/70 ps-lowercase",children:t})]}),v("span",{className:"ps-flex ps-items-center ps-gap-1",children:e.column.getCanPin()&&e.column.id!=="select"&&J(sa,{children:[v(ra,{asChild:!0,children:v(U,{variant:"ghost",size:"icon",children:v(Z,{size:16})})}),J(qe,{children:[e.column.getCanSort()&&v(Pe,{onClick:()=>e.column.toggleSorting(e.column.getIsSorted()==="asc"),children:J("span",{className:"ps-flex ps-items-center ps-gap-2",children:[e.column.getIsSorted()==="asc"?v(K,{size:16}):v(se,{size:16}),e.column.getIsSorted()==="asc"?"Sort descending":"Sort ascending"]})}),v(Pe,{onClick:()=>e.column.pin(e.column.getIsPinned()?!1:"left"),children:e.column.getIsPinned()?J("span",{className:"ps-flex ps-items-center ps-gap-2",children:[v(me,{size:16}),"Unpin column"]}):J("span",{className:"ps-flex ps-items-center ps-gap-2",children:[v(Le,{size:16}),"Pin column"]})})]})]})})]}),e.column.getCanResize()&&v("button",{type:"button",tabIndex:0,onMouseDown:u=>{u.stopPropagation(),e.getResizeHandler()(u)},onTouchStart:u=>{u.stopPropagation(),e.getResizeHandler()(u)},onClick:u=>u.stopPropagation(),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),u.stopPropagation(),e.getResizeHandler()(u))},className:l("ps-absolute ps-right-0 ps-top-0 ps-h-full ps-w-3 ps-cursor-col-resize","ps-select-none ps-touch-none ps-transition-colors ps-group","ps-border-0 ps-bg-transparent",e.column.getIsResizing()&&"ps-bg-gray-300","before:ps-absolute before:ps-right-[3px] before:ps-top-1/2 before:ps--translate-y-1/2","after:ps-absolute after:ps-right-[7px] after:ps-top-1/2 after:ps--translate-y-1/2","before:ps-w-[2px] before:ps-h-0 before:ps-bg-gray-400 before:ps-rounded-full before:ps-opacity-0","after:ps-w-[2px] after:ps-h-0 after:ps-bg-gray-400 after:ps-rounded-full after:ps-opacity-0","before:ps-transition-all before:ps-duration-200","after:ps-transition-all after:ps-duration-200","group-hover:before:ps-opacity-100","group-hover:after:ps-opacity-100","group-hover:before:ps-h-4","group-hover:after:ps-h-4","group-active:ps-bg-transparent group-active:before:ps-bg-white group-active:after:ps-bg-white",e.column.getIsResizing()&&"before:ps-opacity-100"),"aria-label":"Resize column"})]})}import*as fa from"react";import{jsx as ot}from"react/jsx-runtime";var Oe=fa.forwardRef(({className:e,type:a,...t},o)=>ot("input",{type:a,className:l("ps-flex ps-h-9 ps-w-full ps-rounded-md ps-border ps-border-input ps-bg-transparent ps-px-3 ps-py-1 ps-text-base ps-shadow-sm ps-transition-colors file:ps-border-0 file:ps-bg-transparent file:ps-text-sm file:ps-font-medium file:ps-text-foreground placeholder:ps-text-muted-foreground focus-visible:ps-outline-none focus-visible:ps-ring-1 focus-visible:ps-ring-ring disabled:ps-cursor-not-allowed disabled:ps-opacity-50 md:ps-text-sm",e),ref:o,...t}));Oe.displayName="Input";import*as c from"@radix-ui/react-select";import*as Q from"react";import{jsx as P,jsxs as ze}from"react/jsx-runtime";var ia=c.Root;var na=c.Value,Ne=Q.forwardRef(({className:e,children:a,...t},o)=>ze(c.Trigger,{ref:o,className:l("ps-flex ps-h-9 ps-w-full ps-items-center ps-justify-between ps-whitespace-nowrap ps-rounded-md ps-border ps-border-input ps-bg-transparent ps-px-3 ps-py-2 ps-text-sm ps-shadow-sm ps-ring-offset-background data-[placeholder]:ps-text-muted-foreground focus:ps-outline-none focus:ps-ring-1 focus:ps-ring-ring disabled:ps-cursor-not-allowed disabled:ps-opacity-50 [&>span]:ps-line-clamp-1",e),...t,children:[a,P(c.Icon,{asChild:!0,children:P(ee,{className:"ps-h-4 ps-w-4 ps-opacity-50"})})]}));Ne.displayName=c.Trigger.displayName;var ca=Q.forwardRef(({className:e,...a},t)=>P(c.ScrollUpButton,{ref:t,className:l("ps-flex ps-cursor-default ps-items-center ps-justify-center ps-py-1",e),...a,children:P(fe,{className:"ps-h-4 ps-w-4"})}));ca.displayName=c.ScrollUpButton.displayName;var pa=Q.forwardRef(({className:e,...a},t)=>P(c.ScrollDownButton,{ref:t,className:l("ps-flex ps-cursor-default ps-items-center ps-justify-center ps-py-1",e),...a,children:P(ee,{className:"ps-h-4 ps-w-4"})}));pa.displayName=c.ScrollDownButton.displayName;var Ee=Q.forwardRef(({className:e,children:a,position:t="popper",...o},u)=>P(c.Portal,{children:ze(c.Content,{ref:u,className:l("ps-relative ps-z-50 ps-max-h-[--radix-select-content-available-height] ps-min-w-[8rem] ps-overflow-y-auto ps-overflow-x-hidden ps-rounded-md ps-border ps-bg-popover ps-text-popover-foreground ps-shadow-md data-[state=open]:ps-animate-in data-[state=closed]:ps-animate-out data-[state=closed]:ps-fade-out-0 data-[state=open]:ps-fade-in-0 data-[state=closed]:ps-zoom-out-95 data-[state=open]:ps-zoom-in-95 data-[side=bottom]:ps-slide-in-from-top-2 data-[side=left]:ps-slide-in-from-right-2 data-[side=right]:ps-slide-in-from-left-2 data-[side=top]:ps-slide-in-from-bottom-2 ps-origin-[--radix-select-content-transform-origin]",t==="popper"&&"data-[side=bottom]:ps-translate-y-1 data-[side=left]:ps--translate-x-1 data-[side=right]:ps-translate-x-1 data-[side=top]:ps--translate-y-1",e),position:t,...o,children:[P(ca,{}),P(c.Viewport,{className:l("ps-p-1",t==="popper"&&"ps-h-[var(--radix-select-trigger-height)] ps-w-full ps-min-w-[var(--radix-select-trigger-width)]"),children:a}),P(pa,{})]})}));Ee.displayName=c.Content.displayName;var lt=Q.forwardRef(({className:e,...a},t)=>P(c.Label,{ref:t,className:l("ps-px-2 ps-py-1.5 ps-text-sm ps-font-semibold",e),...a}));lt.displayName=c.Label.displayName;var Ge=Q.forwardRef(({className:e,children:a,...t},o)=>ze(c.Item,{ref:o,className:l("ps-relative ps-flex ps-w-full ps-cursor-default ps-select-none ps-items-center ps-rounded-sm ps-py-1.5 ps-pl-2 ps-pr-8 ps-text-sm ps-outline-none focus:ps-bg-accent focus:ps-text-accent-foreground data-[disabled]:ps-pointer-events-none data-[disabled]:ps-opacity-50",e),...t,children:[P("span",{className:"ps-absolute ps-right-2 ps-flex ps-h-3.5 ps-w-3.5 ps-items-center ps-justify-center",children:P(c.ItemIndicator,{children:P(E,{className:"ps-h-4 ps-w-4"})})}),P(c.ItemText,{children:a})]}));Ge.displayName=c.Item.displayName;var ut=Q.forwardRef(({className:e,...a},t)=>P(c.Separator,{ref:t,className:l("ps--mx-1 ps-my-1 ps-h-px ps-bg-muted",e),...a}));ut.displayName=c.Separator.displayName;import{jsx as k,jsxs as $}from"react/jsx-runtime";var dt=[10,20,50,100];function ma({table:e,variant:a="basic",className:t}){let{pageSize:o,pageIndex:u}=e.getState().pagination,p=e.getPageCount();return k("div",{className:l("ps-flex ps-items-center ps-justify-between ps-space-x-2 ps-py-4 ps-px-4",t),children:a==="basic"?$("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[k(U,{variant:"outline",size:"sm",className:"ps-h-9",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:"Previous"}),k(U,{variant:"outline",size:"sm",className:"ps-h-9",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:"Next"})]}):$("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[$("div",{className:"ps-flex ps-items-center ps-space-x-2",children:[k(U,{variant:"outline",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:k(ie,{className:"ps-w-4 ps-h-4"})}),k(U,{variant:"outline",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:k(re,{className:"ps-w-4 ps-h-4"})}),$("div",{className:"ps-flex ps-items-center ps-gap-1 ps-text-xs ps-font-medium",children:["Page",k(Oe,{type:"number",min:1,max:p,value:u+1,className:"ps-w-12",onChange:r=>{let f=r.target.value?Number(r.target.value)-1:0;e.setPageIndex(f)}}),$("span",{className:"ps-shrink-0 ps-w-max",children:["of ",p]})]}),k(U,{variant:"outline",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:k(G,{className:"ps-w-4 ps-h-4"})}),k(U,{variant:"outline",onClick:()=>e.setPageIndex(p-1),disabled:!e.getCanNextPage(),children:k(ne,{className:"ps-w-4 ps-h-4"})})]}),$(ia,{value:o.toString(),onValueChange:r=>e.setPageSize(Number(r)),children:[k(Ne,{children:k(na,{})}),k(Ee,{children:dt.map(r=>$(Ge,{value:r.toString(),children:[r," per page"]},r))})]})]})})}var xe=e=>{let a=e.getIsPinned(),t=a==="left"&&e.getIsLastColumn("left"),o=a==="right"&&e.getIsFirstColumn("right");return{className:l("ps-overflow-hidden ps-whitespace-nowrap ps-text-ellipsis",a&&["ps-sticky ps-bg-background ps-shadow-[1px_0_0_0_hsl(var(--border))]",a==="left"?"ps-left-0":"ps-right-0","ps-z-20"],!a&&"ps-relative ps-z-10",t&&"ps-shadow-[1px_0_0_0_hsl(var(--border))]",o&&"ps-shadow-[-1px_0_0_0_hsl(var(--border))]"),style:{width:e.getSize(),left:a==="left"?`${e.getStart("left")}px`:void 0,right:a==="right"?`${e.getAfter("right")}px`:void 0}}};import{Fragment as kt,jsx as L,jsxs as Ie}from"react/jsx-runtime";var Pt=({_table:e})=>{let{currentTable:a,isLoaded:t}=ge();return t?L("div",{className:"ps-flex ps-items-center ps-justify-between ps-w-full ps-gap-2",children:L("div",{className:"ps-flex ps-items-center ps-gap-2",children:L("span",{className:"ps-flex ps-items-center ps-gap-2",children:L("h1",{className:"ps-text-sm ps-font-medium",children:a?.name})})})}):null},wt=({header:e,children:a,getPinningStyles:t})=>{let{attributes:o,listeners:u,transform:p,transition:r,setNodeRef:f,isDragging:x,isOver:C}=pt({id:e.id}),h=e.column.columnDef.meta,S={transform:mt.Transform.toString(p),transition:r,...t(e.column).style,cursor:"grab",touchAction:"none"};return Ie(he,{ref:f,...o,...u,style:S,"data-relational":h?.isRelational?"true":void 0,"data-relates-to":h?.relatesTo,"data-relation-field":h?.relationField,className:l("ps-group",t(e.column).className,x&&"ps-opacity-50",C&&"ps-bg-gray-100","ps-select-none ps-touch-none ps-relative",e.column.getIsPinned()&&"ps-sticky"),children:[a,C&&L("div",{className:"ps-absolute ps-inset-0 ps-border-2 ps-border-primary ps-rounded-sm ps-pointer-events-none"})]})};function La({data:e=[],columns:a}){console.log("Data received in StudioGrid:",e);let[t,o]=te([]),[u,p]=te([]),[r,f]=te({}),[x,C]=te({left:[],right:[]}),[h,S]=te([]),[oe,F]=te("");ht(()=>{if(a&&a.length>0){let I=a.map(B=>B.id);if(h.length===0){S(I);return}let d=[...h],g=d.filter(B=>!a.some(Y=>Y.id===B));g.forEach(B=>{let Y=d.indexOf(B);Y!==-1&&d.splice(Y,1)});let D=I.filter(B=>!d.includes(B));D.length>0&&d.push(...D),(g.length>0||D.length>0)&&S(d)}},[a,h]);let y=ft(rt,{activationConstraint:{distance:10}}),T=it(y),A=I=>{let{active:d,over:g}=I;if(g&&d.id!==g.id){let D=w.getColumn(d.id),B=w.getColumn(g.id);if(!D||!B)return;let Y=D.getIsPinned(),ha=B.getIsPinned();if(Y!==ha)return;let We=h.indexOf(d.id),Xe=h.indexOf(g.id);if(We===-1||Xe===-1)return;let we=[...h];we.splice(We,1),we.splice(Xe,0,d.id),S(we)}},q=St(()=>{if(!a||a.length===0)return console.log("No columns configuration available"),[];let I=(d,g)=>{if(d==null)return"";switch(g){case"TIMESTAMP":return d?new Date(d).toLocaleString():"";case"UUID":case"STRING":return String(d);default:return String(d)}};return a.map(d=>({accessorKey:d.id,header:()=>L("div",{className:"ps-font-medium",children:d.id}),cell:({getValue:g})=>I(g(),d.type),meta:{dataType:d.type,isRelational:d.isRelational,relatesTo:d.relatesTo,relationField:d.relationField}}))},[a]),w=gt({data:e||[],defaultColumn:{size:200,minSize:50,maxSize:500},columns:q,getCoreRowModel:Lt(),onSortingChange:o,getSortedRowModel:Ct(),getPaginationRowModel:It(),getFilteredRowModel:xt(),onColumnFiltersChange:p,enableColumnResizing:!0,columnResizeMode:"onChange",onColumnSizingChange:f,enableColumnPinning:!0,onColumnPinningChange:C,onGlobalFilterChange:F,globalFilterFn:(I,d,g)=>{let D=I.getValue(d);return D==null?!1:String(D).toLowerCase().includes(String(g).toLowerCase())},state:{sorting:t,columnFilters:u,columnSizing:r,columnPinning:x,columnOrder:h,globalFilter:oe}});return!e||e.length===0?Ie("div",{className:"ps-p-4 ps-border ps-rounded-md ps-w-full",children:[L("p",{className:"ps-text-lg ps-font-semibold",children:"No data available."}),L("p",{className:"ps-text-sm ps-text-gray-500",children:e?"Data array is empty.":"Data is undefined."})]}):Ie(kt,{children:[L("div",{className:"ps-bg-studio-header-background ps-flex ps-w-full ps-p-2 ps-py-3 ps-border-b",children:L(Pt,{_table:w})}),L("div",{"data-studio":"content",className:"ps-flex-1 ps-w-0 ps-h-0 ps-min-w-full",children:Ie("div",{className:"ps-flex ps-flex-col ps-w-full ps-h-full ps-overflow-scroll",children:[L(st,{sensors:T,onDragEnd:A,children:Ie(ke,{children:[L(be,{children:w.getHeaderGroups().map(I=>L(le,{className:l("ps-relative",w.getLeftLeafHeaders().some(d=>d.column.getIsPinned()==="left")&&`ps-pl-[${w.getLeftLeafHeaders().filter(d=>d.column.getIsPinned()==="left").reduce((d,g)=>d+g.getSize(),0)}px]`),children:L(ct,{items:I.headers.map(d=>d.id),strategy:nt,children:I.headers.map(d=>d.column.id==="select"?L(he,{className:l("ps-px-[var(--studio-cell-spacing)]",xe(d.column).className,d.column.getIsPinned()&&"ps-sticky"),style:xe(d.column).style,"data-cell-type":"select",children:L(He,{header:d})},d.id):L(wt,{header:d,table:w,getPinningStyles:xe,children:L(He,{header:d})},d.id))})},I.id))}),L(Re,{children:w.getRowModel().rows?.length?w.getRowModel().rows.map(I=>L(le,{className:l("ps-bg-table-row ps-odd:bg-table-row-odd ps-group"),children:I.getVisibleCells().map(d=>L(ua,{cell:d,getPinningStyles:xe,dataType:a.find(g=>g.id===d.column.id)?.type},d.id))},I.id)):L(le,{children:L(ue,{colSpan:a.length,className:"ps-h-24 ps-text-center",children:"No results."})})})]})}),L(ma,{table:w,variant:"numeric"})]})})]})}import{createContext as bt,useContext as dd,useEffect as Rt,useState as Mt}from"react";import{jsx as Dt}from"react/jsx-runtime";var vt={theme:"system",setTheme:()=>null},yt=bt(vt);function xa({children:e,defaultTheme:a="system",storageKey:t="vite-ui-theme",...o}){let[u,p]=Mt(()=>localStorage.getItem(t)||a);Rt(()=>{let f=window.document.documentElement;if(f.classList.remove("light","dark"),u==="system"){let x=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";f.classList.add(x);return}f.classList.add(u)},[u]);let r={theme:u,setTheme:f=>{localStorage.setItem(t,f),p(f)}};return Dt(yt.Provider,{...o,value:r,children:e})}import{jsx as W,jsxs as Ht}from"react/jsx-runtime";var Ca=Bt(void 0),ge=()=>{let e=Ft(Ca);if(!e)throw new Error("useStudio must be used within a Studio.Provider");return e};function qt(e){return{id:e,accessorKey:e,header:e.charAt(0).toUpperCase()+e.slice(1),type:"STRING",nullable:!0,isKey:!1}}var Ve=new AbortController().signal,Ut=({adapter:e})=>{let[a,t]=Ce([]),[o,u]=Ce(null),[p,r]=Ce(!1),[f,x]=Ce([]),[C,h]=Ce([]),S=At.useMemo(()=>new Set(a.filter(F=>F.isFavorite).map(F=>F.id)),[a]),oe=F=>{t(y=>y.map(T=>T.id===F?{...T,isFavorite:!T.isFavorite}:T))};return Ia(()=>{(async()=>{try{let[y,T]=await e.introspect({abortSignal:Ve});if(y||!T?.schemas){console.error("Error fetching schema:",y);return}let A=Object.entries(T.schemas).flatMap(([q,w])=>Object.entries(w.tables).map(([I])=>({id:`${q}.${I}`,name:I.charAt(0).toUpperCase()+I.slice(1),schema:q,isFavorite:!1})));t(A),!o&&A.length>0&&A[0]&&u(A[0])}catch(y){console.error("Error fetching tables:",y)}})()},[e,o]),Ia(()=>{(async()=>{if(!o?.id){r(!0);return}try{r(!1);let[y,T]=await e.introspect({abortSignal:Ve});if(y||!T?.schemas){console.error("Error fetching schema:",y),r(!0);return}let[A,q]=o.id.split(".");if(!A||!q){console.error("Invalid table ID format:",o.id),r(!0);return}let w=T.schemas[A];if(!w){console.error(`Schema ${A} not found`),r(!0);return}let I=w.tables[q];if(!I){console.error(`Table ${q} not found in schema ${A}`),r(!0);return}let d=Object.entries(I.columns).map(([B])=>qt(B));h(d);let[g,D]=await e.query({schema:A,table:q},{abortSignal:Ve});if(g||!D){console.error(`Failed to fetch data for table ${q}:`,g),r(!0);return}x(D.rows),r(!0)}catch(y){console.error("Error fetching table data:",y),r(!0)}})()},[e,o]),e?!p&&a.length===0?W("div",{children:"Loading available tables..."}):p&&a.length===0?W("div",{children:"No tables found in the database."}):W(xa,{children:W(Tt,{children:W(Ca.Provider,{value:{adapter:e,currentTable:o,isLoaded:p,tables:a,favoriteTableIds:S,setCurrentTable:u,toggleFavorite:oe},children:Ht("div",{className:"ps-flex ps-gap-4 ps-w-full ps-rounded-sm ps-bg-background ps-p-4 ps-relative",children:[W(Ke,{}),W("div",{className:"ps-flex ps-w-full ps-flex-col ps-border ps-rounded-lg",children:W(La,{columns:C,data:f})})]})})})}):(console.error("No adapter provided to Studio component"),W("div",{children:"Error: No adapter provided"}))},ga=Ut;export{ga as Studio};
2
- /*! Bundled license information:
3
-
4
- lucide-react/dist/esm/shared/src/utils.js:
5
- (**
6
- * @license lucide-react v0.427.0 - ISC
7
- *
8
- * This source code is licensed under the ISC license.
9
- * See the LICENSE file in the root directory of this source tree.
10
- *)
11
-
12
- lucide-react/dist/esm/defaultAttributes.js:
13
- (**
14
- * @license lucide-react v0.427.0 - ISC
15
- *
16
- * This source code is licensed under the ISC license.
17
- * See the LICENSE file in the root directory of this source tree.
18
- *)
19
-
20
- lucide-react/dist/esm/Icon.js:
21
- (**
22
- * @license lucide-react v0.427.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- *)
27
-
28
- lucide-react/dist/esm/createLucideIcon.js:
29
- (**
30
- * @license lucide-react v0.427.0 - ISC
31
- *
32
- * This source code is licensed under the ISC license.
33
- * See the LICENSE file in the root directory of this source tree.
34
- *)
35
-
36
- lucide-react/dist/esm/icons/arrow-down-wide-narrow.js:
37
- (**
38
- * @license lucide-react v0.427.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- *)
43
-
44
- lucide-react/dist/esm/icons/arrow-up-wide-narrow.js:
45
- (**
46
- * @license lucide-react v0.427.0 - ISC
47
- *
48
- * This source code is licensed under the ISC license.
49
- * See the LICENSE file in the root directory of this source tree.
50
- *)
51
-
52
- lucide-react/dist/esm/icons/check.js:
53
- (**
54
- * @license lucide-react v0.427.0 - ISC
55
- *
56
- * This source code is licensed under the ISC license.
57
- * See the LICENSE file in the root directory of this source tree.
58
- *)
59
-
60
- lucide-react/dist/esm/icons/chevron-down.js:
61
- (**
62
- * @license lucide-react v0.427.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- *)
67
-
68
- lucide-react/dist/esm/icons/chevron-left.js:
69
- (**
70
- * @license lucide-react v0.427.0 - ISC
71
- *
72
- * This source code is licensed under the ISC license.
73
- * See the LICENSE file in the root directory of this source tree.
74
- *)
75
-
76
- lucide-react/dist/esm/icons/chevron-right.js:
77
- (**
78
- * @license lucide-react v0.427.0 - ISC
79
- *
80
- * This source code is licensed under the ISC license.
81
- * See the LICENSE file in the root directory of this source tree.
82
- *)
83
-
84
- lucide-react/dist/esm/icons/chevron-up.js:
85
- (**
86
- * @license lucide-react v0.427.0 - ISC
87
- *
88
- * This source code is licensed under the ISC license.
89
- * See the LICENSE file in the root directory of this source tree.
90
- *)
91
-
92
- lucide-react/dist/esm/icons/chevrons-left.js:
93
- (**
94
- * @license lucide-react v0.427.0 - ISC
95
- *
96
- * This source code is licensed under the ISC license.
97
- * See the LICENSE file in the root directory of this source tree.
98
- *)
99
-
100
- lucide-react/dist/esm/icons/chevrons-right.js:
101
- (**
102
- * @license lucide-react v0.427.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- *)
107
-
108
- lucide-react/dist/esm/icons/circle.js:
109
- (**
110
- * @license lucide-react v0.427.0 - ISC
111
- *
112
- * This source code is licensed under the ISC license.
113
- * See the LICENSE file in the root directory of this source tree.
114
- *)
115
-
116
- lucide-react/dist/esm/icons/copy.js:
117
- (**
118
- * @license lucide-react v0.427.0 - ISC
119
- *
120
- * This source code is licensed under the ISC license.
121
- * See the LICENSE file in the root directory of this source tree.
122
- *)
123
-
124
- lucide-react/dist/esm/icons/ellipsis.js:
125
- (**
126
- * @license lucide-react v0.427.0 - ISC
127
- *
128
- * This source code is licensed under the ISC license.
129
- * See the LICENSE file in the root directory of this source tree.
130
- *)
131
-
132
- lucide-react/dist/esm/icons/link.js:
133
- (**
134
- * @license lucide-react v0.427.0 - ISC
135
- *
136
- * This source code is licensed under the ISC license.
137
- * See the LICENSE file in the root directory of this source tree.
138
- *)
139
-
140
- lucide-react/dist/esm/icons/pin-off.js:
141
- (**
142
- * @license lucide-react v0.427.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- *)
147
-
148
- lucide-react/dist/esm/icons/pin.js:
149
- (**
150
- * @license lucide-react v0.427.0 - ISC
151
- *
152
- * This source code is licensed under the ISC license.
153
- * See the LICENSE file in the root directory of this source tree.
154
- *)
155
-
156
- lucide-react/dist/esm/lucide-react.js:
157
- (**
158
- * @license lucide-react v0.427.0 - ISC
159
- *
160
- * This source code is licensed under the ISC license.
161
- * See the LICENSE file in the root directory of this source tree.
162
- *)
163
- */
1
+ import"../chunk-2FW6TKD6.js";import"../index-ESMXH6DI.css";import{Slot as q}from"@radix-ui/react-slot";import{useQuery as k}from"@tanstack/react-query";import{QueryClient as S,QueryClientProvider as C}from"@tanstack/react-query";import{NuqsAdapter as g}from"nuqs/adapters/react";import{createContext as y,useContext as w,useState as N}from"react";import{jsx as u}from"react/jsx-runtime";var A=new S,v=y(void 0);function h(e){let{children:t,...r}=e,[s,o]=N(null);return u(C,{client:A,children:u(g,{children:u(v.Provider,{value:{...r,activeTable:s,setActiveTable:o},children:t})})})}function l(){let e=w(v);if(!e)throw new Error("`useStudio` must be used within a `StudioContext.Provider`");return e}function f(){let{adapter:e}=l();return k({initialData:{schemas:{[e.defaultSchema||"db"]:{tables:{}}}},queryFn:async({signal:t})=>{let[r,s]=await e.introspect({abortSignal:t});if(r)throw r;return s},queryKey:["introspection"],staleTime:1/0})}import{clsx as I}from"clsx";import{twMerge as E}from"tailwind-merge";function c(...e){return E(I(e))}import{jsx as i,jsxs as B}from"react/jsx-runtime";var p=()=>{let{data:e}=f(),{activeTable:t,adapter:r,setActiveTable:s}=l();return i("div",{className:"ps-flex ps-flex-col ps-w-64 ps-gap-4 ps-shrink-0",children:i(p.Block,{label:"Tables",children:Object.values(e.schemas[r.defaultSchema||"db"].tables).map(o=>i(p.Item,{isActive:t===o,onClick:m=>{m.preventDefault(),t!==o&&s(o)},className:`ps-px-2 ps-py-1 ps-cursor-pointer ps-rounded ${t===o?"ps-bg-primary ps-text-white":"ps-hover:ps-bg-gray-100"}`,children:o.name},`${o.schema}-${o.name}`))})})},L=({className:e,label:t,children:r,...s})=>B("div",{className:c("ps-rounded-lg ps-border ps-bg-card ps-text-card-foreground ps-shadow-xs",e),...s,children:[i("div",{className:"ps-pt-4 ps-pb-2 ps-px-4",children:i("h2",{className:"ps-text-sm ps-font-medium",children:t})}),i("nav",{"aria-label":t,className:"ps-flex ps-flex-col ps-gap-px ps-pb-3",children:r})]}),V=({className:e,asChild:t=!1,isActive:r,size:s,...o})=>i(t?q:"button",{"data-sidebar":"menu-button","data-size":s,"data-active":r,className:c("ps-py-1.5 ps-px-4 ps-text-sm ps-font-medium ps-flex ps-gap-2 ps-items-center ps-border ps-border-transparent ps-bg-transparent ps-hover:bg-muted/50",e),...o});p.Block=L;p.Item=V;var x=p;import{createContext as M,useContext as me,useEffect as Q,useState as R}from"react";import{jsx as z}from"react/jsx-runtime";var D={theme:"system",setTheme:()=>null},$=M(D);function T({children:e,defaultTheme:t="system",storageKey:r="vite-ui-theme",...s}){let[o,m]=R(()=>localStorage.getItem(r)||t);Q(()=>{let a=window.document.documentElement;if(a.classList.remove("light","dark"),o==="system"){let P=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";a.classList.add(P);return}a.classList.add(o)},[o]);let b={theme:o,setTheme:a=>{localStorage.setItem(r,a),m(a)}};return z($.Provider,{...s,value:b,children:e})}import{jsx as d,jsxs as H}from"react/jsx-runtime";function xe(e){let{adapter:t}=e;return t?d(T,{children:d(h,{adapter:t,children:H("div",{className:"ps-flex ps-gap-4 ps-w-full ps-rounded-sm ps-bg-background ps-p-4 ps-relative",children:[d(x,{}),d("div",{className:"ps-flex ps-w-full ps-flex-col ps-border ps-rounded-lg"})]})})}):(console.error("No adapter provided to Studio component"),d("div",{children:"Error: No adapter provided"}))}export{xe as Studio};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma/studio-core",
3
- "version": "0.0.0-dev.202504120019",
3
+ "version": "0.0.0-dev.202504121011",
4
4
  "description": "Modular Prisma Studio components",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -107,6 +107,7 @@
107
107
  "@radix-ui/react-popover": "1.1.6",
108
108
  "@radix-ui/react-select": "2.1.6",
109
109
  "@radix-ui/react-slot": "1.1.2",
110
+ "@tanstack/react-query": "5.72.2",
110
111
  "@tanstack/react-table": "8.20.1",
111
112
  "@uiw/codemirror-theme-tokyo-night": "4.23.10",
112
113
  "@uiw/react-codemirror": "4.23.10",