@upstash/react-redis-browser 0.2.8 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +28 -13
- package/dist/index.js +190 -101
- package/dist/index.mjs +316 -227
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/databrowser/index.tsx
|
|
2
|
-
import { useEffect as useEffect14, useMemo as useMemo9, useRef as
|
|
2
|
+
import { useEffect as useEffect14, useMemo as useMemo9, useRef as useRef7 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/dark-mode-context.tsx
|
|
5
5
|
import { createContext, useContext } from "react";
|
|
@@ -260,18 +260,20 @@ var DatabrowserProvider = ({
|
|
|
260
260
|
removeItem: () => {
|
|
261
261
|
}
|
|
262
262
|
},
|
|
263
|
-
version:
|
|
264
|
-
// @ts-expect-error Reset the store for < v1
|
|
263
|
+
version: 4,
|
|
265
264
|
migrate: (originalState, version) => {
|
|
266
265
|
const state = originalState;
|
|
267
|
-
if (version
|
|
268
|
-
|
|
266
|
+
if (version <= 1) {
|
|
267
|
+
state.tabs = state.tabs.map(([id, data]) => [id, { ...data, id }]);
|
|
269
268
|
}
|
|
270
|
-
if (version
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
269
|
+
if (version <= 2) {
|
|
270
|
+
state.tabs = state.tabs.map(([id, data]) => {
|
|
271
|
+
const oldData = data;
|
|
272
|
+
return [
|
|
273
|
+
id,
|
|
274
|
+
{ ...data, selectedKeys: oldData.selectedKey ? [oldData.selectedKey] : [] }
|
|
275
|
+
];
|
|
276
|
+
});
|
|
275
277
|
}
|
|
276
278
|
return state;
|
|
277
279
|
}
|
|
@@ -302,7 +304,7 @@ var storeCreator = (set, get) => ({
|
|
|
302
304
|
const id = crypto.randomUUID();
|
|
303
305
|
const newTabData = {
|
|
304
306
|
id,
|
|
305
|
-
|
|
307
|
+
selectedKeys: [],
|
|
306
308
|
search: { key: "", type: void 0 },
|
|
307
309
|
pinned: false
|
|
308
310
|
};
|
|
@@ -395,16 +397,19 @@ var storeCreator = (set, get) => ({
|
|
|
395
397
|
selectTab: (id) => {
|
|
396
398
|
set({ selectedTab: id });
|
|
397
399
|
},
|
|
398
|
-
|
|
399
|
-
return get().tabs.find(([id]) => id === tabId)?.[1]?.
|
|
400
|
+
getSelectedKeys: (tabId) => {
|
|
401
|
+
return get().tabs.find(([id]) => id === tabId)?.[1]?.selectedKeys ?? [];
|
|
400
402
|
},
|
|
401
403
|
setSelectedKey: (tabId, key) => {
|
|
404
|
+
get().setSelectedKeys(tabId, key ? [key] : []);
|
|
405
|
+
},
|
|
406
|
+
setSelectedKeys: (tabId, keys) => {
|
|
402
407
|
set((old) => {
|
|
403
408
|
const tabIndex = old.tabs.findIndex(([id]) => id === tabId);
|
|
404
409
|
if (tabIndex === -1) return old;
|
|
405
410
|
const newTabs = [...old.tabs];
|
|
406
411
|
const [, tabData] = newTabs[tabIndex];
|
|
407
|
-
newTabs[tabIndex] = [tabId, { ...tabData,
|
|
412
|
+
newTabs[tabIndex] = [tabId, { ...tabData, selectedKeys: keys, selectedListItem: void 0 }];
|
|
408
413
|
return { ...old, tabs: newTabs };
|
|
409
414
|
});
|
|
410
415
|
},
|
|
@@ -485,6 +490,7 @@ var useTab = () => {
|
|
|
485
490
|
selectedTab,
|
|
486
491
|
tabs,
|
|
487
492
|
setSelectedKey,
|
|
493
|
+
setSelectedKeys,
|
|
488
494
|
setSelectedListItem,
|
|
489
495
|
setSearch,
|
|
490
496
|
setSearchKey,
|
|
@@ -497,11 +503,14 @@ var useTab = () => {
|
|
|
497
503
|
return useMemo3(
|
|
498
504
|
() => ({
|
|
499
505
|
active: selectedTab === tabId,
|
|
500
|
-
selectedKey: tabData.
|
|
506
|
+
selectedKey: tabData.selectedKeys[0],
|
|
507
|
+
// Backwards compatibility - first selected key
|
|
508
|
+
selectedKeys: tabData.selectedKeys,
|
|
501
509
|
selectedListItem: tabData.selectedListItem,
|
|
502
510
|
search: tabData.search,
|
|
503
511
|
pinned: tabData.pinned,
|
|
504
512
|
setSelectedKey: (key) => setSelectedKey(tabId, key),
|
|
513
|
+
setSelectedKeys: (keys) => setSelectedKeys(tabId, keys),
|
|
505
514
|
setSelectedListItem: (item) => setSelectedListItem(tabId, item),
|
|
506
515
|
setSearch: (search) => setSearch(tabId, search),
|
|
507
516
|
setSearchKey: (key) => setSearchKey(tabId, key),
|
|
@@ -3836,8 +3845,8 @@ var HeaderTTLBadge = ({ dataKey }) => {
|
|
|
3836
3845
|
}
|
|
3837
3846
|
);
|
|
3838
3847
|
};
|
|
3839
|
-
var Badge = ({ children, label }) => /* @__PURE__ */ jsxs3("div", { className: "flex h-6 items-center gap-0.5 rounded-md bg-white px-2 text-xs text-zinc-700", children: [
|
|
3840
|
-
/* @__PURE__ */ jsx11("span", { className: "text-zinc-500", children: label }),
|
|
3848
|
+
var Badge = ({ children, label }) => /* @__PURE__ */ jsxs3("div", { className: "flex h-6 items-center gap-0.5 rounded-md bg-white px-2 text-xs text-zinc-700 dark:bg-zinc-200", children: [
|
|
3849
|
+
/* @__PURE__ */ jsx11("span", { className: "text-zinc-500 dark:text-zinc-600", children: label }),
|
|
3841
3850
|
/* @__PURE__ */ jsx11("span", { className: "font-medium", children })
|
|
3842
3851
|
] });
|
|
3843
3852
|
|
|
@@ -4441,16 +4450,20 @@ function DeleteAlertDialog({
|
|
|
4441
4450
|
onDeleteConfirm,
|
|
4442
4451
|
open,
|
|
4443
4452
|
onOpenChange,
|
|
4444
|
-
deletionType
|
|
4453
|
+
deletionType,
|
|
4454
|
+
count: count2 = 1
|
|
4445
4455
|
}) {
|
|
4456
|
+
const isPlural = count2 > 1;
|
|
4457
|
+
const itemLabel = deletionType === "item" ? "Item" : "Key";
|
|
4458
|
+
const itemsLabel = deletionType === "item" ? "Items" : "Keys";
|
|
4446
4459
|
return /* @__PURE__ */ jsxs10(AlertDialog, { open, onOpenChange, children: [
|
|
4447
4460
|
children && /* @__PURE__ */ jsx20(AlertDialogTrigger, { asChild: true, children }),
|
|
4448
4461
|
/* @__PURE__ */ jsxs10(AlertDialogContent, { children: [
|
|
4449
4462
|
/* @__PURE__ */ jsxs10(AlertDialogHeader, { children: [
|
|
4450
|
-
/* @__PURE__ */ jsx20(AlertDialogTitle, { children:
|
|
4463
|
+
/* @__PURE__ */ jsx20(AlertDialogTitle, { children: isPlural ? `Delete ${count2} ${itemsLabel}` : `Delete ${itemLabel}` }),
|
|
4451
4464
|
/* @__PURE__ */ jsxs10(AlertDialogDescription, { className: "mt-5", children: [
|
|
4452
|
-
"Are you sure you want to delete
|
|
4453
|
-
deletionType
|
|
4465
|
+
"Are you sure you want to delete ",
|
|
4466
|
+
isPlural ? `these ${count2} ${deletionType}s` : `this ${deletionType}`,
|
|
4454
4467
|
"?",
|
|
4455
4468
|
/* @__PURE__ */ jsx20("br", {}),
|
|
4456
4469
|
"This action cannot be undone."
|
|
@@ -4696,6 +4709,36 @@ var InfiniteScroll = ({
|
|
|
4696
4709
|
// src/components/databrowser/components/display/display-header.tsx
|
|
4697
4710
|
import { IconPlus } from "@tabler/icons-react";
|
|
4698
4711
|
|
|
4712
|
+
// src/components/ui/tooltip.tsx
|
|
4713
|
+
import * as React10 from "react";
|
|
4714
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4715
|
+
import { Fragment as Fragment3, jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4716
|
+
var Tooltip = TooltipPrimitive.Root;
|
|
4717
|
+
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
4718
|
+
var TooltipContent = React10.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx24(TooltipPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx24(
|
|
4719
|
+
TooltipPrimitive.Content,
|
|
4720
|
+
{
|
|
4721
|
+
ref,
|
|
4722
|
+
sideOffset,
|
|
4723
|
+
className: cn(
|
|
4724
|
+
"z-50 overflow-hidden rounded-md bg-zinc-900 px-3 py-1.5 text-xs text-zinc-50 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",
|
|
4725
|
+
className
|
|
4726
|
+
),
|
|
4727
|
+
...props
|
|
4728
|
+
}
|
|
4729
|
+
) }));
|
|
4730
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
4731
|
+
var SimpleTooltip = ({
|
|
4732
|
+
content,
|
|
4733
|
+
children
|
|
4734
|
+
}) => {
|
|
4735
|
+
if (!content) return /* @__PURE__ */ jsx24(Fragment3, { children });
|
|
4736
|
+
return /* @__PURE__ */ jsxs14(Tooltip, { delayDuration: 400, children: [
|
|
4737
|
+
/* @__PURE__ */ jsx24(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx24("div", { children }) }),
|
|
4738
|
+
/* @__PURE__ */ jsx24(TooltipContent, { side: "top", children: content })
|
|
4739
|
+
] });
|
|
4740
|
+
};
|
|
4741
|
+
|
|
4699
4742
|
// src/types/index.ts
|
|
4700
4743
|
var DATA_TYPES = ["string", "list", "hash", "set", "zset", "json", "stream"];
|
|
4701
4744
|
var DATA_TYPE_NAMES = {
|
|
@@ -4717,15 +4760,15 @@ import {
|
|
|
4717
4760
|
IconList,
|
|
4718
4761
|
IconQuote
|
|
4719
4762
|
} from "@tabler/icons-react";
|
|
4720
|
-
import { jsx as
|
|
4763
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4721
4764
|
var iconsMap = {
|
|
4722
|
-
string: /* @__PURE__ */
|
|
4723
|
-
set: /* @__PURE__ */
|
|
4724
|
-
hash: /* @__PURE__ */
|
|
4725
|
-
json: /* @__PURE__ */
|
|
4726
|
-
zset: /* @__PURE__ */
|
|
4727
|
-
list: /* @__PURE__ */
|
|
4728
|
-
stream: /* @__PURE__ */
|
|
4765
|
+
string: /* @__PURE__ */ jsx25(IconQuote, { size: 15, stroke: 1.2 }),
|
|
4766
|
+
set: /* @__PURE__ */ jsx25(IconLayersIntersect, { size: 15, stroke: 1.2 }),
|
|
4767
|
+
hash: /* @__PURE__ */ jsx25(IconHash, { size: 15, stroke: 1.2 }),
|
|
4768
|
+
json: /* @__PURE__ */ jsx25(IconCodeDots, { size: 15, stroke: 1.2 }),
|
|
4769
|
+
zset: /* @__PURE__ */ jsx25(IconArrowsSort, { size: 15, stroke: 1.2 }),
|
|
4770
|
+
list: /* @__PURE__ */ jsx25(IconList, { size: 15, stroke: 1.2 }),
|
|
4771
|
+
stream: /* @__PURE__ */ jsx25(IconList, { size: 15, stroke: 1.2 })
|
|
4729
4772
|
};
|
|
4730
4773
|
var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-center", {
|
|
4731
4774
|
variants: {
|
|
@@ -4749,20 +4792,20 @@ var tagVariants = cva("inline-flex shrink-0 items-center rounded-md justify-cent
|
|
|
4749
4792
|
}
|
|
4750
4793
|
});
|
|
4751
4794
|
function TypeTag({ className, variant, type }) {
|
|
4752
|
-
return /* @__PURE__ */
|
|
4795
|
+
return /* @__PURE__ */ jsx25("span", { className: cn(tagVariants({ variant, type, className })), children: type === "icon" ? iconsMap[variant] : DATA_TYPE_NAMES[variant] });
|
|
4753
4796
|
}
|
|
4754
4797
|
|
|
4755
4798
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
4756
4799
|
import { IconDotsVertical } from "@tabler/icons-react";
|
|
4757
4800
|
|
|
4758
4801
|
// src/components/ui/dropdown-menu.tsx
|
|
4759
|
-
import * as
|
|
4802
|
+
import * as React11 from "react";
|
|
4760
4803
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4761
4804
|
import { CheckIcon as CheckIcon2, ChevronRightIcon as ChevronRightIcon2, DotFilledIcon as DotFilledIcon2 } from "@radix-ui/react-icons";
|
|
4762
|
-
import { jsx as
|
|
4805
|
+
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4763
4806
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
4764
4807
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
4765
|
-
var DropdownMenuSubTrigger =
|
|
4808
|
+
var DropdownMenuSubTrigger = React11.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs15(
|
|
4766
4809
|
DropdownMenuPrimitive.SubTrigger,
|
|
4767
4810
|
{
|
|
4768
4811
|
ref,
|
|
@@ -4774,12 +4817,12 @@ var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, .
|
|
|
4774
4817
|
...props,
|
|
4775
4818
|
children: [
|
|
4776
4819
|
children,
|
|
4777
|
-
/* @__PURE__ */
|
|
4820
|
+
/* @__PURE__ */ jsx26(ChevronRightIcon2, { className: "ml-auto" })
|
|
4778
4821
|
]
|
|
4779
4822
|
}
|
|
4780
4823
|
));
|
|
4781
4824
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
4782
|
-
var DropdownMenuSubContent =
|
|
4825
|
+
var DropdownMenuSubContent = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4783
4826
|
DropdownMenuPrimitive.SubContent,
|
|
4784
4827
|
{
|
|
4785
4828
|
ref,
|
|
@@ -4791,7 +4834,7 @@ var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) =
|
|
|
4791
4834
|
}
|
|
4792
4835
|
));
|
|
4793
4836
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
4794
|
-
var DropdownMenuContent =
|
|
4837
|
+
var DropdownMenuContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx26(DropdownMenuPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx26(
|
|
4795
4838
|
DropdownMenuPrimitive.Content,
|
|
4796
4839
|
{
|
|
4797
4840
|
ref,
|
|
@@ -4805,12 +4848,12 @@ var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...pr
|
|
|
4805
4848
|
}
|
|
4806
4849
|
) }));
|
|
4807
4850
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
4808
|
-
var DropdownMenuItem =
|
|
4851
|
+
var DropdownMenuItem = React11.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4809
4852
|
DropdownMenuPrimitive.Item,
|
|
4810
4853
|
{
|
|
4811
4854
|
ref,
|
|
4812
4855
|
className: cn(
|
|
4813
|
-
"data-[disabled]:opacity-50[&>svg]:size-4 relative flex cursor-
|
|
4856
|
+
"data-[disabled]:opacity-50[&>svg]:size-4 relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-zinc-100 focus:text-zinc-900 data-[disabled]:pointer-events-none [&>svg]:shrink-0",
|
|
4814
4857
|
inset && "pl-8",
|
|
4815
4858
|
className
|
|
4816
4859
|
),
|
|
@@ -4818,7 +4861,7 @@ var DropdownMenuItem = React10.forwardRef(({ className, inset, ...props }, ref)
|
|
|
4818
4861
|
}
|
|
4819
4862
|
));
|
|
4820
4863
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
4821
|
-
var DropdownMenuCheckboxItem =
|
|
4864
|
+
var DropdownMenuCheckboxItem = React11.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs15(
|
|
4822
4865
|
DropdownMenuPrimitive.CheckboxItem,
|
|
4823
4866
|
{
|
|
4824
4867
|
ref,
|
|
@@ -4829,13 +4872,13 @@ var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checke
|
|
|
4829
4872
|
checked,
|
|
4830
4873
|
...props,
|
|
4831
4874
|
children: [
|
|
4832
|
-
/* @__PURE__ */
|
|
4875
|
+
/* @__PURE__ */ jsx26("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx26(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx26(CheckIcon2, { className: "h-4 w-4" }) }) }),
|
|
4833
4876
|
children
|
|
4834
4877
|
]
|
|
4835
4878
|
}
|
|
4836
4879
|
));
|
|
4837
4880
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
4838
|
-
var DropdownMenuRadioItem =
|
|
4881
|
+
var DropdownMenuRadioItem = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs15(
|
|
4839
4882
|
DropdownMenuPrimitive.RadioItem,
|
|
4840
4883
|
{
|
|
4841
4884
|
ref,
|
|
@@ -4845,13 +4888,13 @@ var DropdownMenuRadioItem = React10.forwardRef(({ className, children, ...props
|
|
|
4845
4888
|
),
|
|
4846
4889
|
...props,
|
|
4847
4890
|
children: [
|
|
4848
|
-
/* @__PURE__ */
|
|
4891
|
+
/* @__PURE__ */ jsx26("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx26(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx26(DotFilledIcon2, { className: "h-2 w-2 fill-current" }) }) }),
|
|
4849
4892
|
children
|
|
4850
4893
|
]
|
|
4851
4894
|
}
|
|
4852
4895
|
));
|
|
4853
4896
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
4854
|
-
var DropdownMenuLabel =
|
|
4897
|
+
var DropdownMenuLabel = React11.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4855
4898
|
DropdownMenuPrimitive.Label,
|
|
4856
4899
|
{
|
|
4857
4900
|
ref,
|
|
@@ -4860,7 +4903,7 @@ var DropdownMenuLabel = React10.forwardRef(({ className, inset, ...props }, ref)
|
|
|
4860
4903
|
}
|
|
4861
4904
|
));
|
|
4862
4905
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
4863
|
-
var DropdownMenuSeparator =
|
|
4906
|
+
var DropdownMenuSeparator = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx26(
|
|
4864
4907
|
DropdownMenuPrimitive.Separator,
|
|
4865
4908
|
{
|
|
4866
4909
|
ref,
|
|
@@ -4870,18 +4913,18 @@ var DropdownMenuSeparator = React10.forwardRef(({ className, ...props }, ref) =>
|
|
|
4870
4913
|
));
|
|
4871
4914
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
4872
4915
|
var DropdownMenuShortcut = ({ className, ...props }) => {
|
|
4873
|
-
return /* @__PURE__ */
|
|
4916
|
+
return /* @__PURE__ */ jsx26("span", { className: cn("ml-auto text-xs tracking-widest opacity-60", className), ...props });
|
|
4874
4917
|
};
|
|
4875
4918
|
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
4876
4919
|
|
|
4877
4920
|
// src/components/databrowser/components/display/key-actions.tsx
|
|
4878
|
-
import { jsx as
|
|
4921
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4879
4922
|
function KeyActions({ dataKey, content }) {
|
|
4880
4923
|
const { mutateAsync: deleteKey } = useDeleteKey();
|
|
4881
|
-
return /* @__PURE__ */
|
|
4882
|
-
/* @__PURE__ */
|
|
4883
|
-
/* @__PURE__ */
|
|
4884
|
-
content && /* @__PURE__ */
|
|
4924
|
+
return /* @__PURE__ */ jsxs16(DropdownMenu, { modal: false, children: [
|
|
4925
|
+
/* @__PURE__ */ jsx27(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(Button, { size: "icon-sm", "aria-label": "Key actions", children: /* @__PURE__ */ jsx27(IconDotsVertical, { className: "size-4 text-zinc-500 dark:text-zinc-600" }) }) }),
|
|
4926
|
+
/* @__PURE__ */ jsxs16(DropdownMenuContent, { className: "", align: "end", children: [
|
|
4927
|
+
content && /* @__PURE__ */ jsx27(
|
|
4885
4928
|
DropdownMenuItem,
|
|
4886
4929
|
{
|
|
4887
4930
|
onClick: () => {
|
|
@@ -4893,7 +4936,7 @@ function KeyActions({ dataKey, content }) {
|
|
|
4893
4936
|
children: "Copy content"
|
|
4894
4937
|
}
|
|
4895
4938
|
),
|
|
4896
|
-
/* @__PURE__ */
|
|
4939
|
+
/* @__PURE__ */ jsx27(
|
|
4897
4940
|
DropdownMenuItem,
|
|
4898
4941
|
{
|
|
4899
4942
|
onClick: () => {
|
|
@@ -4902,12 +4945,12 @@ function KeyActions({ dataKey, content }) {
|
|
|
4902
4945
|
children: "Copy key"
|
|
4903
4946
|
}
|
|
4904
4947
|
),
|
|
4905
|
-
/* @__PURE__ */
|
|
4948
|
+
/* @__PURE__ */ jsx27(
|
|
4906
4949
|
DeleteAlertDialog,
|
|
4907
4950
|
{
|
|
4908
4951
|
deletionType: "key",
|
|
4909
4952
|
onDeleteConfirm: async () => await deleteKey(dataKey),
|
|
4910
|
-
children: /* @__PURE__ */
|
|
4953
|
+
children: /* @__PURE__ */ jsx27(
|
|
4911
4954
|
DropdownMenuItem,
|
|
4912
4955
|
{
|
|
4913
4956
|
className: "text-red-500 focus:bg-red-500 focus:text-white",
|
|
@@ -4922,7 +4965,7 @@ function KeyActions({ dataKey, content }) {
|
|
|
4922
4965
|
}
|
|
4923
4966
|
|
|
4924
4967
|
// src/components/databrowser/components/display/display-header.tsx
|
|
4925
|
-
import { jsx as
|
|
4968
|
+
import { jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4926
4969
|
var DisplayHeader = ({
|
|
4927
4970
|
dataKey,
|
|
4928
4971
|
type,
|
|
@@ -4932,19 +4975,19 @@ var DisplayHeader = ({
|
|
|
4932
4975
|
const handleAddItem = () => {
|
|
4933
4976
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
4934
4977
|
};
|
|
4935
|
-
return /* @__PURE__ */
|
|
4936
|
-
/* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
4938
|
-
/* @__PURE__ */
|
|
4939
|
-
type !== "string" && type !== "json" && /* @__PURE__ */
|
|
4940
|
-
/* @__PURE__ */
|
|
4978
|
+
return /* @__PURE__ */ jsxs17("div", { className: "rounded-lg bg-zinc-100", children: [
|
|
4979
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex min-h-10 items-center justify-between gap-4", children: [
|
|
4980
|
+
/* @__PURE__ */ jsx28("h2", { className: "grow truncate text-base", children: dataKey.trim() === "" ? /* @__PURE__ */ jsx28("span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ jsx28("span", { className: "font-semibold", children: dataKey }) }),
|
|
4981
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
|
|
4982
|
+
type !== "string" && type !== "json" && /* @__PURE__ */ jsx28(SimpleTooltip, { content: "Add item", children: /* @__PURE__ */ jsx28(Button, { onClick: handleAddItem, size: "icon-sm", "aria-label": "Add item", children: /* @__PURE__ */ jsx28(IconPlus, { className: "size-4 text-zinc-500 dark:text-zinc-600" }) }) }),
|
|
4983
|
+
/* @__PURE__ */ jsx28(KeyActions, { dataKey, content })
|
|
4941
4984
|
] })
|
|
4942
4985
|
] }),
|
|
4943
|
-
/* @__PURE__ */
|
|
4944
|
-
/* @__PURE__ */
|
|
4945
|
-
/* @__PURE__ */
|
|
4946
|
-
/* @__PURE__ */
|
|
4947
|
-
/* @__PURE__ */
|
|
4986
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex h-10 flex-wrap items-center gap-1.5", children: [
|
|
4987
|
+
/* @__PURE__ */ jsx28(TypeTag, { variant: type, type: "badge" }),
|
|
4988
|
+
/* @__PURE__ */ jsx28(SizeBadge, { dataKey }),
|
|
4989
|
+
/* @__PURE__ */ jsx28(LengthBadge, { dataKey, type, content }),
|
|
4990
|
+
/* @__PURE__ */ jsx28(HeaderTTLBadge, { dataKey })
|
|
4948
4991
|
] })
|
|
4949
4992
|
] });
|
|
4950
4993
|
};
|
|
@@ -4952,36 +4995,6 @@ var DisplayHeader = ({
|
|
|
4952
4995
|
// src/components/databrowser/components/display/display-list-edit.tsx
|
|
4953
4996
|
import { Controller as Controller2, FormProvider, useForm as useForm2, useFormContext } from "react-hook-form";
|
|
4954
4997
|
|
|
4955
|
-
// src/components/ui/tooltip.tsx
|
|
4956
|
-
import * as React11 from "react";
|
|
4957
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4958
|
-
import { Fragment as Fragment3, jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4959
|
-
var Tooltip = TooltipPrimitive.Root;
|
|
4960
|
-
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
4961
|
-
var TooltipContent = React11.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx28(TooltipPrimitive.Portal, { container: portalRoot, children: /* @__PURE__ */ jsx28(
|
|
4962
|
-
TooltipPrimitive.Content,
|
|
4963
|
-
{
|
|
4964
|
-
ref,
|
|
4965
|
-
sideOffset,
|
|
4966
|
-
className: cn(
|
|
4967
|
-
"z-50 overflow-hidden rounded-md bg-zinc-900 px-3 py-1.5 text-xs text-zinc-50 animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",
|
|
4968
|
-
className
|
|
4969
|
-
),
|
|
4970
|
-
...props
|
|
4971
|
-
}
|
|
4972
|
-
) }));
|
|
4973
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
4974
|
-
var SimpleTooltip = ({
|
|
4975
|
-
content,
|
|
4976
|
-
children
|
|
4977
|
-
}) => {
|
|
4978
|
-
if (!content) return /* @__PURE__ */ jsx28(Fragment3, { children });
|
|
4979
|
-
return /* @__PURE__ */ jsxs17(Tooltip, { delayDuration: 400, children: [
|
|
4980
|
-
/* @__PURE__ */ jsx28(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx28("div", { children }) }),
|
|
4981
|
-
/* @__PURE__ */ jsx28(TooltipContent, { side: "top", children: content })
|
|
4982
|
-
] });
|
|
4983
|
-
};
|
|
4984
|
-
|
|
4985
4998
|
// src/components/databrowser/hooks/use-fetch-hash-ttl.ts
|
|
4986
4999
|
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
4987
5000
|
var FETCH_HASH_FIELD_TTLS_QUERY_KEY = "fetch-hash-field-ttls";
|
|
@@ -5473,7 +5486,9 @@ var ListItems = ({
|
|
|
5473
5486
|
onClick: () => {
|
|
5474
5487
|
setSelectedListItem({ key });
|
|
5475
5488
|
},
|
|
5476
|
-
className: cn(
|
|
5489
|
+
className: cn(
|
|
5490
|
+
"h-10 border-b border-b-zinc-100 transition-colors hover:bg-zinc-100 dark:border-b-zinc-200 dark:hover:bg-zinc-200"
|
|
5491
|
+
),
|
|
5477
5492
|
children: [
|
|
5478
5493
|
/* @__PURE__ */ jsx36(
|
|
5479
5494
|
"td",
|
|
@@ -5495,7 +5510,7 @@ var ListItems = ({
|
|
|
5495
5510
|
type !== "stream" && /* @__PURE__ */ jsx36(
|
|
5496
5511
|
"td",
|
|
5497
5512
|
{
|
|
5498
|
-
className: "w-0 min-w-0 p-0",
|
|
5513
|
+
className: "w-0 min-w-0 p-0 pr-2",
|
|
5499
5514
|
onClick: (e) => {
|
|
5500
5515
|
e.stopPropagation();
|
|
5501
5516
|
},
|
|
@@ -5594,9 +5609,6 @@ var DataDisplay = () => {
|
|
|
5594
5609
|
return /* @__PURE__ */ jsx38("div", { className: "h-full p-4", children: !selectedKey ? /* @__PURE__ */ jsx38("div", {}) : !type ? query.isLoading ? /* @__PURE__ */ jsx38("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx38("span", { className: "text-zinc-500", children: "Loading..." }) }) : /* @__PURE__ */ jsx38("div", {}) : /* @__PURE__ */ jsx38(Fragment7, { children: type === "string" || type === "json" ? /* @__PURE__ */ jsx38(EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ jsx38(ListDisplay, { dataKey: selectedKey, type }) }) });
|
|
5595
5610
|
};
|
|
5596
5611
|
|
|
5597
|
-
// src/components/databrowser/components/sidebar/index.tsx
|
|
5598
|
-
import { IconRefresh } from "@tabler/icons-react";
|
|
5599
|
-
|
|
5600
5612
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5601
5613
|
import { useState as useState9 } from "react";
|
|
5602
5614
|
import { DialogDescription as DialogDescription2 } from "@radix-ui/react-dialog";
|
|
@@ -5737,7 +5749,7 @@ function AddKeyModal() {
|
|
|
5737
5749
|
setOpen(open2);
|
|
5738
5750
|
},
|
|
5739
5751
|
children: [
|
|
5740
|
-
/* @__PURE__ */ jsx40(DialogTrigger, {
|
|
5752
|
+
/* @__PURE__ */ jsx40(DialogTrigger, { children: /* @__PURE__ */ jsx40(SimpleTooltip, { content: "Add key", children: /* @__PURE__ */ jsx40(Button, { variant: "primary", size: "icon-sm", "data-testid": "add-key-button", children: /* @__PURE__ */ jsx40(PlusIcon, { className: "size-4" }) }) }) }),
|
|
5741
5753
|
/* @__PURE__ */ jsxs24(DialogContent, { className: "max-w-[400px]", children: [
|
|
5742
5754
|
/* @__PURE__ */ jsx40(DialogHeader, { children: /* @__PURE__ */ jsx40(DialogTitle, { children: "Create new key" }) }),
|
|
5743
5755
|
/* @__PURE__ */ jsx40("div", { className: "sr-only", children: /* @__PURE__ */ jsx40(DialogDescription2, { children: "Create new key" }) }),
|
|
@@ -5798,6 +5810,9 @@ var Empty = () => {
|
|
|
5798
5810
|
] }) });
|
|
5799
5811
|
};
|
|
5800
5812
|
|
|
5813
|
+
// src/components/databrowser/components/sidebar/keys-list.tsx
|
|
5814
|
+
import { useRef as useRef3 } from "react";
|
|
5815
|
+
|
|
5801
5816
|
// src/components/databrowser/components/sidebar-context-menu.tsx
|
|
5802
5817
|
import { useState as useState10 } from "react";
|
|
5803
5818
|
import { IconCopy as IconCopy3, IconExternalLink as IconExternalLink2, IconTrash as IconTrash3 } from "@tabler/icons-react";
|
|
@@ -5806,19 +5821,22 @@ import { Fragment as Fragment8, jsx as jsx42, jsxs as jsxs26 } from "react/jsx-r
|
|
|
5806
5821
|
var SidebarContextMenu = ({ children }) => {
|
|
5807
5822
|
const { mutate: deleteKey } = useDeleteKey();
|
|
5808
5823
|
const [isAlertOpen, setAlertOpen] = useState10(false);
|
|
5809
|
-
const [
|
|
5810
|
-
const { addTab, setSelectedKey, selectTab, setSearch } = useDatabrowserStore();
|
|
5811
|
-
const { search: currentSearch } = useTab();
|
|
5824
|
+
const [contextKeys, setContextKeys] = useState10([]);
|
|
5825
|
+
const { addTab, setSelectedKey: setSelectedKeyGlobal, selectTab, setSearch } = useDatabrowserStore();
|
|
5826
|
+
const { search: currentSearch, selectedKeys, setSelectedKey } = useTab();
|
|
5812
5827
|
return /* @__PURE__ */ jsxs26(Fragment8, { children: [
|
|
5813
5828
|
/* @__PURE__ */ jsx42(
|
|
5814
5829
|
DeleteAlertDialog,
|
|
5815
5830
|
{
|
|
5816
5831
|
deletionType: "key",
|
|
5832
|
+
count: contextKeys.length,
|
|
5817
5833
|
open: isAlertOpen,
|
|
5818
5834
|
onOpenChange: setAlertOpen,
|
|
5819
5835
|
onDeleteConfirm: (e) => {
|
|
5820
5836
|
e.stopPropagation();
|
|
5821
|
-
|
|
5837
|
+
for (const key of contextKeys) {
|
|
5838
|
+
deleteKey(key);
|
|
5839
|
+
}
|
|
5822
5840
|
setAlertOpen(false);
|
|
5823
5841
|
}
|
|
5824
5842
|
}
|
|
@@ -5831,7 +5849,13 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5831
5849
|
const el = e.target;
|
|
5832
5850
|
const key = el.closest("[data-key]");
|
|
5833
5851
|
if (key && key instanceof HTMLElement && key.dataset.key !== void 0) {
|
|
5834
|
-
|
|
5852
|
+
const clickedKey = key.dataset.key;
|
|
5853
|
+
if (selectedKeys.includes(clickedKey)) {
|
|
5854
|
+
setContextKeys(selectedKeys);
|
|
5855
|
+
} else {
|
|
5856
|
+
setSelectedKey(clickedKey);
|
|
5857
|
+
setContextKeys([clickedKey]);
|
|
5858
|
+
}
|
|
5835
5859
|
} else {
|
|
5836
5860
|
throw new Error("Key not found");
|
|
5837
5861
|
}
|
|
@@ -5844,12 +5868,13 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5844
5868
|
ContextMenuItem,
|
|
5845
5869
|
{
|
|
5846
5870
|
onClick: () => {
|
|
5847
|
-
navigator.clipboard.writeText(
|
|
5871
|
+
navigator.clipboard.writeText(contextKeys[0]);
|
|
5848
5872
|
toast({
|
|
5849
5873
|
description: "Key copied to clipboard"
|
|
5850
5874
|
});
|
|
5851
5875
|
},
|
|
5852
5876
|
className: "gap-2",
|
|
5877
|
+
disabled: contextKeys.length !== 1,
|
|
5853
5878
|
children: [
|
|
5854
5879
|
/* @__PURE__ */ jsx42(IconCopy3, { size: 16 }),
|
|
5855
5880
|
"Copy key"
|
|
@@ -5861,11 +5886,12 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5861
5886
|
{
|
|
5862
5887
|
onClick: () => {
|
|
5863
5888
|
const newTabId = addTab();
|
|
5864
|
-
|
|
5889
|
+
setSelectedKeyGlobal(newTabId, contextKeys[0]);
|
|
5865
5890
|
setSearch(newTabId, currentSearch);
|
|
5866
5891
|
selectTab(newTabId);
|
|
5867
5892
|
},
|
|
5868
5893
|
className: "gap-2",
|
|
5894
|
+
disabled: contextKeys.length !== 1,
|
|
5869
5895
|
children: [
|
|
5870
5896
|
/* @__PURE__ */ jsx42(IconExternalLink2, { size: 16 }),
|
|
5871
5897
|
"Open in new tab"
|
|
@@ -5875,7 +5901,7 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5875
5901
|
/* @__PURE__ */ jsx42(ContextMenuSeparator3, {}),
|
|
5876
5902
|
/* @__PURE__ */ jsxs26(ContextMenuItem, { onClick: () => setAlertOpen(true), className: "gap-2", children: [
|
|
5877
5903
|
/* @__PURE__ */ jsx42(IconTrash3, { size: 16 }),
|
|
5878
|
-
"Delete key"
|
|
5904
|
+
contextKeys.length > 1 ? `Delete ${contextKeys.length} keys` : "Delete key"
|
|
5879
5905
|
] })
|
|
5880
5906
|
] })
|
|
5881
5907
|
] })
|
|
@@ -5886,7 +5912,23 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5886
5912
|
import { Fragment as Fragment9, jsx as jsx43, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5887
5913
|
var KeysList = () => {
|
|
5888
5914
|
const { keys } = useKeys();
|
|
5889
|
-
|
|
5915
|
+
const lastClickedIndexRef = useRef3(null);
|
|
5916
|
+
return /* @__PURE__ */ jsx43(SidebarContextMenu, { children: /* @__PURE__ */ jsxs27(Fragment9, { children: [
|
|
5917
|
+
/* @__PURE__ */ jsx43("div", { className: "h-px" }),
|
|
5918
|
+
keys.map((data, i) => /* @__PURE__ */ jsxs27(Fragment9, { children: [
|
|
5919
|
+
/* @__PURE__ */ jsx43(
|
|
5920
|
+
KeyItem,
|
|
5921
|
+
{
|
|
5922
|
+
index: i,
|
|
5923
|
+
data,
|
|
5924
|
+
allKeys: keys,
|
|
5925
|
+
lastClickedIndexRef
|
|
5926
|
+
},
|
|
5927
|
+
data[0]
|
|
5928
|
+
),
|
|
5929
|
+
i !== keys.length - 1 && /* @__PURE__ */ jsx43("div", { className: "-z-10 mx-2 h-px bg-zinc-100 dark:bg-zinc-200" })
|
|
5930
|
+
] }))
|
|
5931
|
+
] }) });
|
|
5890
5932
|
};
|
|
5891
5933
|
var keyStyles = {
|
|
5892
5934
|
string: "border-sky-400 !bg-sky-50 text-sky-900",
|
|
@@ -5897,11 +5939,33 @@ var keyStyles = {
|
|
|
5897
5939
|
list: "border-orange-400 !bg-orange-50 text-orange-900",
|
|
5898
5940
|
stream: "border-green-400 !bg-green-50 text-green-900"
|
|
5899
5941
|
};
|
|
5900
|
-
var KeyItem = ({
|
|
5901
|
-
|
|
5942
|
+
var KeyItem = ({
|
|
5943
|
+
data,
|
|
5944
|
+
index,
|
|
5945
|
+
allKeys,
|
|
5946
|
+
lastClickedIndexRef
|
|
5947
|
+
}) => {
|
|
5948
|
+
const { selectedKeys, setSelectedKeys, setSelectedKey } = useTab();
|
|
5902
5949
|
const [dataKey, dataType] = data;
|
|
5903
|
-
const isKeySelected =
|
|
5904
|
-
const
|
|
5950
|
+
const isKeySelected = selectedKeys.includes(dataKey);
|
|
5951
|
+
const handleClick = (e) => {
|
|
5952
|
+
if (e.shiftKey && lastClickedIndexRef.current !== null) {
|
|
5953
|
+
const start = Math.min(lastClickedIndexRef.current, index);
|
|
5954
|
+
const end = Math.max(lastClickedIndexRef.current, index);
|
|
5955
|
+
const rangeKeys = allKeys.slice(start, end + 1).map(([key]) => key);
|
|
5956
|
+
setSelectedKeys(rangeKeys);
|
|
5957
|
+
} else if (e.metaKey || e.ctrlKey) {
|
|
5958
|
+
if (isKeySelected) {
|
|
5959
|
+
setSelectedKeys(selectedKeys.filter((k) => k !== dataKey));
|
|
5960
|
+
} else {
|
|
5961
|
+
setSelectedKeys([...selectedKeys, dataKey]);
|
|
5962
|
+
}
|
|
5963
|
+
lastClickedIndexRef.current = index;
|
|
5964
|
+
} else {
|
|
5965
|
+
setSelectedKey(dataKey);
|
|
5966
|
+
lastClickedIndexRef.current = index;
|
|
5967
|
+
}
|
|
5968
|
+
};
|
|
5905
5969
|
return /* @__PURE__ */ jsxs27(
|
|
5906
5970
|
Button,
|
|
5907
5971
|
{
|
|
@@ -5909,24 +5973,51 @@ var KeyItem = ({ data, nextKey }) => {
|
|
|
5909
5973
|
variant: isKeySelected ? "default" : "ghost",
|
|
5910
5974
|
className: cn(
|
|
5911
5975
|
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0 !ring-0 focus-visible:bg-zinc-50",
|
|
5912
|
-
"select-none border border-transparent text-left",
|
|
5976
|
+
"-my-px select-none border border-transparent text-left",
|
|
5913
5977
|
isKeySelected && "shadow-sm",
|
|
5914
5978
|
isKeySelected && keyStyles[dataType]
|
|
5915
5979
|
),
|
|
5916
|
-
onClick:
|
|
5980
|
+
onClick: handleClick,
|
|
5917
5981
|
children: [
|
|
5918
5982
|
/* @__PURE__ */ jsx43(TypeTag, { variant: dataType, type: "icon" }),
|
|
5919
|
-
/* @__PURE__ */ jsx43("p", { className: "truncate whitespace-nowrap", children: dataKey })
|
|
5920
|
-
!isKeySelected && !isNextKeySelected && /* @__PURE__ */ jsx43("span", { className: "absolute -bottom-px left-3 right-3 h-px bg-zinc-100" })
|
|
5983
|
+
/* @__PURE__ */ jsx43("p", { className: "truncate whitespace-nowrap", children: dataKey })
|
|
5921
5984
|
]
|
|
5922
5985
|
}
|
|
5923
5986
|
);
|
|
5924
5987
|
};
|
|
5925
5988
|
|
|
5989
|
+
// src/components/databrowser/components/sidebar/reload-button.tsx
|
|
5990
|
+
import { useState as useState11 } from "react";
|
|
5991
|
+
import { IconLoader2 as IconLoader22, IconRefresh } from "@tabler/icons-react";
|
|
5992
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
5993
|
+
var ReloadButton = ({
|
|
5994
|
+
onClick,
|
|
5995
|
+
isLoading: isLoadingProp
|
|
5996
|
+
}) => {
|
|
5997
|
+
const [isLoading, setIsLoading] = useState11(false);
|
|
5998
|
+
const handleClick = () => {
|
|
5999
|
+
setIsLoading(true);
|
|
6000
|
+
onClick();
|
|
6001
|
+
setTimeout(() => {
|
|
6002
|
+
setIsLoading(false);
|
|
6003
|
+
}, 350);
|
|
6004
|
+
};
|
|
6005
|
+
return /* @__PURE__ */ jsx44("div", { children: /* @__PURE__ */ jsx44(SimpleTooltip, { content: "Refresh", children: /* @__PURE__ */ jsx44(
|
|
6006
|
+
Button,
|
|
6007
|
+
{
|
|
6008
|
+
variant: "outline",
|
|
6009
|
+
size: "icon-sm",
|
|
6010
|
+
onClick: handleClick,
|
|
6011
|
+
disabled: isLoading || isLoadingProp,
|
|
6012
|
+
children: isLoading ? /* @__PURE__ */ jsx44(IconLoader22, { className: "animate-spin text-zinc-500", size: 16 }) : /* @__PURE__ */ jsx44(IconRefresh, { className: "text-zinc-500 dark:text-zinc-600", size: 16 })
|
|
6013
|
+
}
|
|
6014
|
+
) }) });
|
|
6015
|
+
};
|
|
6016
|
+
|
|
5926
6017
|
// src/components/databrowser/components/sidebar/search-input.tsx
|
|
5927
|
-
import { useEffect as useEffect11, useRef as
|
|
6018
|
+
import { useEffect as useEffect11, useRef as useRef4, useState as useState12 } from "react";
|
|
5928
6019
|
import { IconX } from "@tabler/icons-react";
|
|
5929
|
-
import { jsx as
|
|
6020
|
+
import { jsx as jsx45, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5930
6021
|
var dedupeSearchHistory = (history) => {
|
|
5931
6022
|
const seen = /* @__PURE__ */ new Set();
|
|
5932
6023
|
return history.filter((item) => {
|
|
@@ -5938,11 +6029,11 @@ var dedupeSearchHistory = (history) => {
|
|
|
5938
6029
|
var SearchInput = () => {
|
|
5939
6030
|
const { setSearchKey, search } = useTab();
|
|
5940
6031
|
const { searchHistory, addSearchHistory } = useDatabrowserStore();
|
|
5941
|
-
const [state, setState] =
|
|
5942
|
-
const [isFocus, setIsFocus] =
|
|
5943
|
-
const [focusedIndex, setFocusedIndex] =
|
|
5944
|
-
const inputRef =
|
|
5945
|
-
const historyItemRefs =
|
|
6032
|
+
const [state, setState] = useState12(search.key);
|
|
6033
|
+
const [isFocus, setIsFocus] = useState12(false);
|
|
6034
|
+
const [focusedIndex, setFocusedIndex] = useState12(-1);
|
|
6035
|
+
const inputRef = useRef4(null);
|
|
6036
|
+
const historyItemRefs = useRef4([]);
|
|
5946
6037
|
const handleSubmit = (value) => {
|
|
5947
6038
|
if (value.trim() !== "" && !value.includes("*")) value = `${value}*`;
|
|
5948
6039
|
addSearchHistory(value);
|
|
@@ -5984,12 +6075,12 @@ var SearchInput = () => {
|
|
|
5984
6075
|
};
|
|
5985
6076
|
return /* @__PURE__ */ jsxs28("div", { className: "relative grow", children: [
|
|
5986
6077
|
/* @__PURE__ */ jsxs28(Popover, { open: isFocus && filteredHistory.length > 0, children: [
|
|
5987
|
-
/* @__PURE__ */
|
|
6078
|
+
/* @__PURE__ */ jsx45(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx45("div", { className: "h-8 rounded-md rounded-l-none border border-zinc-300 font-normal", children: /* @__PURE__ */ jsx45(
|
|
5988
6079
|
Input,
|
|
5989
6080
|
{
|
|
5990
6081
|
ref: inputRef,
|
|
5991
6082
|
placeholder: "Search",
|
|
5992
|
-
className: "rounded-l-none border-
|
|
6083
|
+
className: "h-full rounded-l-none border-none pr-6",
|
|
5993
6084
|
onKeyDown: handleKeyDown,
|
|
5994
6085
|
onChange: (e) => {
|
|
5995
6086
|
setState(e.currentTarget.value);
|
|
@@ -6003,7 +6094,7 @@ var SearchInput = () => {
|
|
|
6003
6094
|
onBlur: () => setIsFocus(false)
|
|
6004
6095
|
}
|
|
6005
6096
|
) }) }),
|
|
6006
|
-
/* @__PURE__ */
|
|
6097
|
+
/* @__PURE__ */ jsx45(
|
|
6007
6098
|
PopoverContent,
|
|
6008
6099
|
{
|
|
6009
6100
|
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
@@ -6012,7 +6103,7 @@ var SearchInput = () => {
|
|
|
6012
6103
|
e.preventDefault();
|
|
6013
6104
|
e.stopPropagation();
|
|
6014
6105
|
},
|
|
6015
|
-
children: filteredHistory.map((item, index) => /* @__PURE__ */
|
|
6106
|
+
children: filteredHistory.map((item, index) => /* @__PURE__ */ jsx45("div", { className: "w-full py-[3px]", children: /* @__PURE__ */ jsx45(
|
|
6016
6107
|
"button",
|
|
6017
6108
|
{
|
|
6018
6109
|
ref: (el) => {
|
|
@@ -6039,8 +6130,8 @@ var SearchInput = () => {
|
|
|
6039
6130
|
setState("");
|
|
6040
6131
|
},
|
|
6041
6132
|
children: [
|
|
6042
|
-
/* @__PURE__ */
|
|
6043
|
-
/* @__PURE__ */
|
|
6133
|
+
/* @__PURE__ */ jsx45(IconX, { size: 16 }),
|
|
6134
|
+
/* @__PURE__ */ jsx45("span", { className: "sr-only", children: "Clear" })
|
|
6044
6135
|
]
|
|
6045
6136
|
}
|
|
6046
6137
|
),
|
|
@@ -6049,15 +6140,15 @@ var SearchInput = () => {
|
|
|
6049
6140
|
};
|
|
6050
6141
|
|
|
6051
6142
|
// src/components/databrowser/components/sidebar/skeleton-buttons.tsx
|
|
6052
|
-
import { jsx as
|
|
6143
|
+
import { jsx as jsx46, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6053
6144
|
var DEFAULT_SKELETON_COUNT = 6;
|
|
6054
|
-
var LoadingSkeleton = () => /* @__PURE__ */
|
|
6055
|
-
/* @__PURE__ */
|
|
6056
|
-
/* @__PURE__ */
|
|
6145
|
+
var LoadingSkeleton = () => /* @__PURE__ */ jsx46("div", { className: "block h-full w-full rounded-lg border border-zinc-200 bg-white p-1 pr-3 transition-all", children: Array.from({ length: DEFAULT_SKELETON_COUNT }).fill(0).map((_, idx) => /* @__PURE__ */ jsxs29("div", { className: "flex h-10 items-center gap-2 px-3", children: [
|
|
6146
|
+
/* @__PURE__ */ jsx46(Skeleton, { className: "size-5 shrink-0 rounded" }),
|
|
6147
|
+
/* @__PURE__ */ jsx46(Skeleton, { className: "h-4 grow rounded" })
|
|
6057
6148
|
] }, idx)) });
|
|
6058
6149
|
|
|
6059
6150
|
// src/components/databrowser/components/sidebar/type-selector.tsx
|
|
6060
|
-
import { jsx as
|
|
6151
|
+
import { jsx as jsx47, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6061
6152
|
var ALL_TYPES_KEY = "all";
|
|
6062
6153
|
function DataTypeSelector() {
|
|
6063
6154
|
const { search, setSearchType } = useTab();
|
|
@@ -6073,9 +6164,9 @@ function DataTypeSelector() {
|
|
|
6073
6164
|
},
|
|
6074
6165
|
value: search.type === void 0 ? ALL_TYPES_KEY : search.type,
|
|
6075
6166
|
children: [
|
|
6076
|
-
/* @__PURE__ */
|
|
6077
|
-
/* @__PURE__ */
|
|
6078
|
-
([key, value]) => /* @__PURE__ */
|
|
6167
|
+
/* @__PURE__ */ jsx47(SelectTrigger, { className: "!w-auto select-none whitespace-nowrap rounded-r-none border-r-0 border-zinc-300 pr-8", children: /* @__PURE__ */ jsx47(SelectValue, {}) }),
|
|
6168
|
+
/* @__PURE__ */ jsx47(SelectContent, { children: /* @__PURE__ */ jsx47(SelectGroup, { children: [[ALL_TYPES_KEY, "All Types"], ...Object.entries(DATA_TYPE_NAMES)].map(
|
|
6169
|
+
([key, value]) => /* @__PURE__ */ jsx47(SelectItem, { value: key, children: value }, key)
|
|
6079
6170
|
) }) })
|
|
6080
6171
|
]
|
|
6081
6172
|
}
|
|
@@ -6083,19 +6174,17 @@ function DataTypeSelector() {
|
|
|
6083
6174
|
}
|
|
6084
6175
|
|
|
6085
6176
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
6086
|
-
import { jsx as
|
|
6177
|
+
import { jsx as jsx48, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6087
6178
|
function Sidebar() {
|
|
6088
6179
|
const { keys, query } = useKeys();
|
|
6089
6180
|
return /* @__PURE__ */ jsxs31("div", { className: "flex h-full flex-col gap-2 p-4", children: [
|
|
6090
6181
|
/* @__PURE__ */ jsxs31("div", { className: "rounded-lg bg-zinc-100", children: [
|
|
6091
6182
|
/* @__PURE__ */ jsxs31("div", { className: "flex h-10 items-center justify-between pl-1", children: [
|
|
6092
|
-
/* @__PURE__ */
|
|
6183
|
+
/* @__PURE__ */ jsx48(DisplayDbSize, {}),
|
|
6093
6184
|
/* @__PURE__ */ jsxs31("div", { className: "flex gap-1", children: [
|
|
6094
|
-
/* @__PURE__ */
|
|
6095
|
-
|
|
6185
|
+
/* @__PURE__ */ jsx48(
|
|
6186
|
+
ReloadButton,
|
|
6096
6187
|
{
|
|
6097
|
-
"aria-label": "Refresh",
|
|
6098
|
-
className: "h-7 w-7 px-0 text-zinc-500",
|
|
6099
6188
|
onClick: () => {
|
|
6100
6189
|
queryClient.invalidateQueries({
|
|
6101
6190
|
queryKey: [FETCH_KEYS_QUERY_KEY]
|
|
@@ -6113,28 +6202,28 @@ function Sidebar() {
|
|
|
6113
6202
|
queryKey: [FETCH_KEY_TYPE_QUERY_KEY]
|
|
6114
6203
|
});
|
|
6115
6204
|
},
|
|
6116
|
-
|
|
6205
|
+
isLoading: query.isFetching
|
|
6117
6206
|
}
|
|
6118
6207
|
),
|
|
6119
|
-
/* @__PURE__ */
|
|
6208
|
+
/* @__PURE__ */ jsx48(AddKeyModal, {})
|
|
6120
6209
|
] })
|
|
6121
6210
|
] }),
|
|
6122
6211
|
/* @__PURE__ */ jsxs31("div", { className: "flex h-10 items-center", children: [
|
|
6123
|
-
/* @__PURE__ */
|
|
6124
|
-
/* @__PURE__ */
|
|
6212
|
+
/* @__PURE__ */ jsx48(DataTypeSelector, {}),
|
|
6213
|
+
/* @__PURE__ */ jsx48(SearchInput, {})
|
|
6125
6214
|
] })
|
|
6126
6215
|
] }),
|
|
6127
|
-
query.isLoading && keys.length === 0 ? /* @__PURE__ */
|
|
6216
|
+
query.isLoading && keys.length === 0 ? /* @__PURE__ */ jsx48(LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
6128
6217
|
// Infinite scroll already has a loader at the bottom
|
|
6129
|
-
/* @__PURE__ */
|
|
6130
|
-
) : /* @__PURE__ */
|
|
6218
|
+
/* @__PURE__ */ jsx48(InfiniteScroll, { query, disableRoundedInherit: true, className: "min-h-0", children: /* @__PURE__ */ jsx48(KeysList, {}) })
|
|
6219
|
+
) : /* @__PURE__ */ jsx48(Empty, {})
|
|
6131
6220
|
] });
|
|
6132
6221
|
}
|
|
6133
6222
|
|
|
6134
6223
|
// src/components/databrowser/components/databrowser-instance.tsx
|
|
6135
|
-
import { jsx as
|
|
6224
|
+
import { jsx as jsx49, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
6136
6225
|
var DatabrowserInstance = ({ hidden }) => {
|
|
6137
|
-
return /* @__PURE__ */
|
|
6226
|
+
return /* @__PURE__ */ jsx49(KeysProvider, { children: /* @__PURE__ */ jsxs32("div", { className: cn("min-h-0 grow rounded-md bg-zinc-100", hidden && "hidden"), children: [
|
|
6138
6227
|
/* @__PURE__ */ jsxs32(
|
|
6139
6228
|
PanelGroup,
|
|
6140
6229
|
{
|
|
@@ -6142,18 +6231,18 @@ var DatabrowserInstance = ({ hidden }) => {
|
|
|
6142
6231
|
direction: "horizontal",
|
|
6143
6232
|
className: "h-full w-full gap-0.5 text-sm antialiased",
|
|
6144
6233
|
children: [
|
|
6145
|
-
/* @__PURE__ */
|
|
6146
|
-
/* @__PURE__ */
|
|
6147
|
-
/* @__PURE__ */
|
|
6234
|
+
/* @__PURE__ */ jsx49(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx49(Sidebar, {}) }),
|
|
6235
|
+
/* @__PURE__ */ jsx49(PanelResizeHandle, { className: "group flex h-full w-3 justify-center", children: /* @__PURE__ */ jsx49("div", { className: "h-full border-r border-dashed border-zinc-200 transition-colors group-hover:border-zinc-500" }) }),
|
|
6236
|
+
/* @__PURE__ */ jsx49(Panel, { minSize: 40, children: /* @__PURE__ */ jsx49(DataDisplay, {}) })
|
|
6148
6237
|
]
|
|
6149
6238
|
}
|
|
6150
6239
|
),
|
|
6151
|
-
/* @__PURE__ */
|
|
6240
|
+
/* @__PURE__ */ jsx49(Toaster, {})
|
|
6152
6241
|
] }) });
|
|
6153
6242
|
};
|
|
6154
6243
|
|
|
6155
6244
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
6156
|
-
import { useCallback as useCallback3, useEffect as useEffect13, useMemo as useMemo8, useRef as
|
|
6245
|
+
import { useCallback as useCallback3, useEffect as useEffect13, useMemo as useMemo8, useRef as useRef6, useState as useState14 } from "react";
|
|
6157
6246
|
import {
|
|
6158
6247
|
closestCenter,
|
|
6159
6248
|
DndContext,
|
|
@@ -6171,8 +6260,8 @@ import { IconChevronDown as IconChevronDown2, IconMaximize, IconPlus as IconPlus
|
|
|
6171
6260
|
import * as React13 from "react";
|
|
6172
6261
|
import { Command as CommandPrimitive } from "cmdk";
|
|
6173
6262
|
import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
|
|
6174
|
-
import { jsx as
|
|
6175
|
-
var Command = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6263
|
+
import { jsx as jsx50, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
6264
|
+
var Command = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx50(
|
|
6176
6265
|
CommandPrimitive,
|
|
6177
6266
|
{
|
|
6178
6267
|
ref,
|
|
@@ -6185,8 +6274,8 @@ var Command = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
6185
6274
|
));
|
|
6186
6275
|
Command.displayName = CommandPrimitive.displayName;
|
|
6187
6276
|
var CommandInput = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs33("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
|
|
6188
|
-
/* @__PURE__ */
|
|
6189
|
-
/* @__PURE__ */
|
|
6277
|
+
/* @__PURE__ */ jsx50(MagnifyingGlassIcon, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
6278
|
+
/* @__PURE__ */ jsx50(
|
|
6190
6279
|
CommandPrimitive.Input,
|
|
6191
6280
|
{
|
|
6192
6281
|
ref,
|
|
@@ -6199,7 +6288,7 @@ var CommandInput = React13.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
6199
6288
|
)
|
|
6200
6289
|
] }));
|
|
6201
6290
|
CommandInput.displayName = CommandPrimitive.Input.displayName;
|
|
6202
|
-
var CommandList = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6291
|
+
var CommandList = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx50(
|
|
6203
6292
|
CommandPrimitive.List,
|
|
6204
6293
|
{
|
|
6205
6294
|
ref,
|
|
@@ -6208,9 +6297,9 @@ var CommandList = React13.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
6208
6297
|
}
|
|
6209
6298
|
));
|
|
6210
6299
|
CommandList.displayName = CommandPrimitive.List.displayName;
|
|
6211
|
-
var CommandEmpty = React13.forwardRef((props, ref) => /* @__PURE__ */
|
|
6300
|
+
var CommandEmpty = React13.forwardRef((props, ref) => /* @__PURE__ */ jsx50(CommandPrimitive.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
6212
6301
|
CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
|
|
6213
|
-
var CommandGroup = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6302
|
+
var CommandGroup = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx50(
|
|
6214
6303
|
CommandPrimitive.Group,
|
|
6215
6304
|
{
|
|
6216
6305
|
ref,
|
|
@@ -6222,7 +6311,7 @@ var CommandGroup = React13.forwardRef(({ className, ...props }, ref) => /* @__PU
|
|
|
6222
6311
|
}
|
|
6223
6312
|
));
|
|
6224
6313
|
CommandGroup.displayName = CommandPrimitive.Group.displayName;
|
|
6225
|
-
var CommandSeparator = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6314
|
+
var CommandSeparator = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx50(
|
|
6226
6315
|
CommandPrimitive.Separator,
|
|
6227
6316
|
{
|
|
6228
6317
|
ref,
|
|
@@ -6231,7 +6320,7 @@ var CommandSeparator = React13.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
6231
6320
|
}
|
|
6232
6321
|
));
|
|
6233
6322
|
CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
|
|
6234
|
-
var CommandItem = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
6323
|
+
var CommandItem = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx50(
|
|
6235
6324
|
CommandPrimitive.Item,
|
|
6236
6325
|
{
|
|
6237
6326
|
ref,
|
|
@@ -6244,7 +6333,7 @@ var CommandItem = React13.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
6244
6333
|
));
|
|
6245
6334
|
CommandItem.displayName = CommandPrimitive.Item.displayName;
|
|
6246
6335
|
var CommandShortcut = ({ className, ...props }) => {
|
|
6247
|
-
return /* @__PURE__ */
|
|
6336
|
+
return /* @__PURE__ */ jsx50("span", { className: cn("ml-auto text-xs tracking-widest text-zinc-500", className), ...props });
|
|
6248
6337
|
};
|
|
6249
6338
|
CommandShortcut.displayName = "CommandShortcut";
|
|
6250
6339
|
|
|
@@ -6259,19 +6348,19 @@ import {
|
|
|
6259
6348
|
} from "@tabler/icons-react";
|
|
6260
6349
|
|
|
6261
6350
|
// src/components/databrowser/components/tab-type-icon.tsx
|
|
6262
|
-
import { jsx as
|
|
6351
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
6263
6352
|
function TabTypeIcon({ selectedKey }) {
|
|
6264
6353
|
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
6265
|
-
if (isLoading) return /* @__PURE__ */
|
|
6354
|
+
if (isLoading) return /* @__PURE__ */ jsx51(Skeleton, { className: "h-5 w-5 rounded" });
|
|
6266
6355
|
if (!keyType || keyType === "none") return;
|
|
6267
|
-
return /* @__PURE__ */
|
|
6356
|
+
return /* @__PURE__ */ jsx51(TypeTag, { variant: keyType, type: "icon" });
|
|
6268
6357
|
}
|
|
6269
6358
|
|
|
6270
6359
|
// src/hooks/use-overflow.ts
|
|
6271
|
-
import { useCallback as useCallback2, useEffect as useEffect12, useRef as
|
|
6360
|
+
import { useCallback as useCallback2, useEffect as useEffect12, useRef as useRef5, useState as useState13 } from "react";
|
|
6272
6361
|
var useOverflow = () => {
|
|
6273
|
-
const [isOverflow, setIsOverflow] =
|
|
6274
|
-
const observerRef =
|
|
6362
|
+
const [isOverflow, setIsOverflow] = useState13(false);
|
|
6363
|
+
const observerRef = useRef5(null);
|
|
6275
6364
|
const ref = useCallback2((node) => {
|
|
6276
6365
|
if (observerRef.current) {
|
|
6277
6366
|
observerRef.current.disconnect();
|
|
@@ -6294,7 +6383,7 @@ var useOverflow = () => {
|
|
|
6294
6383
|
};
|
|
6295
6384
|
|
|
6296
6385
|
// src/components/databrowser/components/tab.tsx
|
|
6297
|
-
import { jsx as
|
|
6386
|
+
import { jsx as jsx52, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6298
6387
|
var Tab = ({ id, isList }) => {
|
|
6299
6388
|
const { active, search, selectedKey, pinned } = useTab();
|
|
6300
6389
|
const {
|
|
@@ -6310,7 +6399,7 @@ var Tab = ({ id, isList }) => {
|
|
|
6310
6399
|
const hasPinnedTabs = tabs.some(([, data]) => data.pinned);
|
|
6311
6400
|
const { ref, isOverflow } = useOverflow();
|
|
6312
6401
|
const label = search.key || selectedKey;
|
|
6313
|
-
const iconNode = search.key ? /* @__PURE__ */
|
|
6402
|
+
const iconNode = search.key ? /* @__PURE__ */ jsx52(IconSearch, { size: 15 }) : selectedKey ? /* @__PURE__ */ jsx52(TabTypeIcon, { selectedKey }) : void 0;
|
|
6314
6403
|
const tabNode = /* @__PURE__ */ jsxs34(
|
|
6315
6404
|
"div",
|
|
6316
6405
|
{
|
|
@@ -6324,7 +6413,7 @@ var Tab = ({ id, isList }) => {
|
|
|
6324
6413
|
),
|
|
6325
6414
|
children: [
|
|
6326
6415
|
iconNode,
|
|
6327
|
-
/* @__PURE__ */
|
|
6416
|
+
/* @__PURE__ */ jsx52(
|
|
6328
6417
|
"span",
|
|
6329
6418
|
{
|
|
6330
6419
|
ref,
|
|
@@ -6332,23 +6421,23 @@ var Tab = ({ id, isList }) => {
|
|
|
6332
6421
|
children: label || "New Tab"
|
|
6333
6422
|
}
|
|
6334
6423
|
),
|
|
6335
|
-
pinned && /* @__PURE__ */
|
|
6336
|
-
tabs.length > 1 && !pinned && /* @__PURE__ */
|
|
6424
|
+
pinned && /* @__PURE__ */ jsx52(IconPin, { size: 14, className: "text-zinc-500" }),
|
|
6425
|
+
tabs.length > 1 && !pinned && /* @__PURE__ */ jsx52(
|
|
6337
6426
|
"button",
|
|
6338
6427
|
{
|
|
6339
6428
|
onClick: (e) => {
|
|
6340
6429
|
e.stopPropagation();
|
|
6341
6430
|
removeTab(id);
|
|
6342
6431
|
},
|
|
6343
|
-
className: "p-1 text-zinc-300 transition-colors hover:text-zinc-500",
|
|
6344
|
-
children: /* @__PURE__ */
|
|
6432
|
+
className: "p-1 text-zinc-300 transition-colors hover:text-zinc-500 dark:text-zinc-400",
|
|
6433
|
+
children: /* @__PURE__ */ jsx52(IconX2, { size: 16 })
|
|
6345
6434
|
}
|
|
6346
6435
|
)
|
|
6347
6436
|
]
|
|
6348
6437
|
}
|
|
6349
6438
|
);
|
|
6350
6439
|
return /* @__PURE__ */ jsxs34(ContextMenu, { children: [
|
|
6351
|
-
/* @__PURE__ */
|
|
6440
|
+
/* @__PURE__ */ jsx52(SimpleTooltip, { content: isOverflow ? label : void 0, children: /* @__PURE__ */ jsx52(ContextMenuTrigger, { asChild: true, children: tabNode }) }),
|
|
6352
6441
|
/* @__PURE__ */ jsxs34(
|
|
6353
6442
|
ContextMenuContent,
|
|
6354
6443
|
{
|
|
@@ -6357,20 +6446,20 @@ var Tab = ({ id, isList }) => {
|
|
|
6357
6446
|
},
|
|
6358
6447
|
children: [
|
|
6359
6448
|
/* @__PURE__ */ jsxs34(ContextMenuItem, { onSelect: () => togglePinTab(id), className: "gap-2", children: [
|
|
6360
|
-
/* @__PURE__ */
|
|
6449
|
+
/* @__PURE__ */ jsx52(IconPin, { size: 16 }),
|
|
6361
6450
|
pinned ? "Unpin Tab" : "Pin Tab"
|
|
6362
6451
|
] }),
|
|
6363
6452
|
/* @__PURE__ */ jsxs34(ContextMenuItem, { onSelect: () => duplicateTab(id), className: "gap-2", children: [
|
|
6364
|
-
/* @__PURE__ */
|
|
6453
|
+
/* @__PURE__ */ jsx52(IconCopyPlus, { size: 16 }),
|
|
6365
6454
|
"Duplicate Tab"
|
|
6366
6455
|
] }),
|
|
6367
|
-
/* @__PURE__ */
|
|
6456
|
+
/* @__PURE__ */ jsx52(ContextMenuSeparator, {}),
|
|
6368
6457
|
/* @__PURE__ */ jsxs34(ContextMenuItem, { onSelect: () => forceRemoveTab(id), className: "gap-2", children: [
|
|
6369
|
-
/* @__PURE__ */
|
|
6458
|
+
/* @__PURE__ */ jsx52(IconX2, { size: 16 }),
|
|
6370
6459
|
"Close Tab"
|
|
6371
6460
|
] }),
|
|
6372
6461
|
/* @__PURE__ */ jsxs34(ContextMenuItem, { onSelect: () => closeOtherTabs(id), className: "gap-2", children: [
|
|
6373
|
-
/* @__PURE__ */
|
|
6462
|
+
/* @__PURE__ */ jsx52(IconSquareX, { size: 16 }),
|
|
6374
6463
|
"Close Other Tabs"
|
|
6375
6464
|
] }),
|
|
6376
6465
|
/* @__PURE__ */ jsxs34(
|
|
@@ -6380,7 +6469,7 @@ var Tab = ({ id, isList }) => {
|
|
|
6380
6469
|
className: "gap-2",
|
|
6381
6470
|
disabled: !hasPinnedTabs,
|
|
6382
6471
|
children: [
|
|
6383
|
-
/* @__PURE__ */
|
|
6472
|
+
/* @__PURE__ */ jsx52(IconArrowsMinimize, { size: 16 }),
|
|
6384
6473
|
"Close All But Pinned"
|
|
6385
6474
|
]
|
|
6386
6475
|
}
|
|
@@ -6392,10 +6481,10 @@ var Tab = ({ id, isList }) => {
|
|
|
6392
6481
|
};
|
|
6393
6482
|
|
|
6394
6483
|
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
6395
|
-
import { jsx as
|
|
6484
|
+
import { jsx as jsx53, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
6396
6485
|
var SortableTab = ({ id }) => {
|
|
6397
|
-
const [originalWidth, setOriginalWidth] =
|
|
6398
|
-
const textRef =
|
|
6486
|
+
const [originalWidth, setOriginalWidth] = useState14(null);
|
|
6487
|
+
const textRef = useRef6(null);
|
|
6399
6488
|
const { tabs } = useDatabrowserStore();
|
|
6400
6489
|
const tabData = tabs.find(([tabId]) => tabId === id)?.[1];
|
|
6401
6490
|
const isPinned = tabData?.pinned;
|
|
@@ -6460,7 +6549,7 @@ var SortableTab = ({ id }) => {
|
|
|
6460
6549
|
minWidth: originalWidth ? `${originalWidth}px` : void 0
|
|
6461
6550
|
} : {}
|
|
6462
6551
|
};
|
|
6463
|
-
return /* @__PURE__ */
|
|
6552
|
+
return /* @__PURE__ */ jsx53(
|
|
6464
6553
|
"div",
|
|
6465
6554
|
{
|
|
6466
6555
|
ref: measureRef,
|
|
@@ -6468,7 +6557,7 @@ var SortableTab = ({ id }) => {
|
|
|
6468
6557
|
className: isDragging ? "cursor-grabbing" : isPinned ? "cursor-default" : "cursor-grab",
|
|
6469
6558
|
...attributes,
|
|
6470
6559
|
...isPinned ? {} : listeners2,
|
|
6471
|
-
children: /* @__PURE__ */
|
|
6560
|
+
children: /* @__PURE__ */ jsx53(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx53(Tab, { id }) })
|
|
6472
6561
|
}
|
|
6473
6562
|
);
|
|
6474
6563
|
};
|
|
@@ -6481,10 +6570,10 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
6481
6570
|
return 0;
|
|
6482
6571
|
});
|
|
6483
6572
|
}, [tabs]);
|
|
6484
|
-
const scrollRef =
|
|
6485
|
-
const [hasLeftShadow, setHasLeftShadow] =
|
|
6486
|
-
const [hasRightShadow, setHasRightShadow] =
|
|
6487
|
-
const [isOverflow, setIsOverflow] =
|
|
6573
|
+
const scrollRef = useRef6(null);
|
|
6574
|
+
const [hasLeftShadow, setHasLeftShadow] = useState14(false);
|
|
6575
|
+
const [hasRightShadow, setHasRightShadow] = useState14(false);
|
|
6576
|
+
const [isOverflow, setIsOverflow] = useState14(false);
|
|
6488
6577
|
useEffect13(() => {
|
|
6489
6578
|
const el = scrollRef.current;
|
|
6490
6579
|
if (!el) return;
|
|
@@ -6544,16 +6633,16 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
6544
6633
|
}
|
|
6545
6634
|
};
|
|
6546
6635
|
return /* @__PURE__ */ jsxs35("div", { className: "relative mb-2 shrink-0", children: [
|
|
6547
|
-
/* @__PURE__ */
|
|
6636
|
+
/* @__PURE__ */ jsx53("div", { className: "absolute bottom-0 left-0 right-0 -z-10 h-[1px] w-full bg-zinc-200" }),
|
|
6548
6637
|
/* @__PURE__ */ jsxs35("div", { className: "flex translate-y-[1px] items-center gap-1", children: [
|
|
6549
6638
|
/* @__PURE__ */ jsxs35("div", { className: "relative min-w-0 flex-1", children: [
|
|
6550
|
-
/* @__PURE__ */
|
|
6639
|
+
/* @__PURE__ */ jsx53(
|
|
6551
6640
|
"div",
|
|
6552
6641
|
{
|
|
6553
6642
|
className: `tabs-shadow-left pointer-events-none absolute left-0 top-0 z-10 h-full w-6 transition-opacity duration-200 ${hasLeftShadow ? "opacity-100" : "opacity-0"}`
|
|
6554
6643
|
}
|
|
6555
6644
|
),
|
|
6556
|
-
/* @__PURE__ */
|
|
6645
|
+
/* @__PURE__ */ jsx53(
|
|
6557
6646
|
"div",
|
|
6558
6647
|
{
|
|
6559
6648
|
className: `tabs-shadow-right pointer-events-none absolute right-0 top-0 z-10 h-full w-6 transition-opacity duration-200 ${hasRightShadow ? "opacity-100" : "opacity-0"}`
|
|
@@ -6566,7 +6655,7 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
6566
6655
|
onScroll: recomputeShadows,
|
|
6567
6656
|
className: "scrollbar-hide flex min-w-0 flex-1 items-center gap-1 overflow-x-auto pb-[1px] [&::-webkit-scrollbar]:hidden",
|
|
6568
6657
|
children: [
|
|
6569
|
-
/* @__PURE__ */
|
|
6658
|
+
/* @__PURE__ */ jsx53(
|
|
6570
6659
|
DndContext,
|
|
6571
6660
|
{
|
|
6572
6661
|
sensors,
|
|
@@ -6578,25 +6667,25 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
6578
6667
|
strategy: MeasuringStrategy.Always
|
|
6579
6668
|
}
|
|
6580
6669
|
},
|
|
6581
|
-
children: /* @__PURE__ */
|
|
6670
|
+
children: /* @__PURE__ */ jsx53(
|
|
6582
6671
|
SortableContext,
|
|
6583
6672
|
{
|
|
6584
6673
|
items: sortedTabs.map(([id]) => id),
|
|
6585
6674
|
strategy: horizontalListSortingStrategy,
|
|
6586
|
-
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */
|
|
6675
|
+
children: selectedTab && sortedTabs.map(([id]) => /* @__PURE__ */ jsx53(SortableTab, { id }, id))
|
|
6587
6676
|
}
|
|
6588
6677
|
)
|
|
6589
6678
|
}
|
|
6590
6679
|
),
|
|
6591
|
-
!isOverflow && /* @__PURE__ */
|
|
6680
|
+
!isOverflow && /* @__PURE__ */ jsx53("div", { className: "flex items-center gap-1 pl-1 pr-1", children: /* @__PURE__ */ jsx53(AddTabButton, {}) })
|
|
6592
6681
|
]
|
|
6593
6682
|
}
|
|
6594
6683
|
)
|
|
6595
6684
|
] }),
|
|
6596
6685
|
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-1 pl-1", children: [
|
|
6597
|
-
isOverflow && /* @__PURE__ */
|
|
6598
|
-
tabs.length > 1 && /* @__PURE__ */
|
|
6599
|
-
onFullScreenClick && /* @__PURE__ */
|
|
6686
|
+
isOverflow && /* @__PURE__ */ jsx53(AddTabButton, {}),
|
|
6687
|
+
tabs.length > 1 && /* @__PURE__ */ jsx53(TabsListButton, { tabs, onSelectTab: selectTab }),
|
|
6688
|
+
onFullScreenClick && /* @__PURE__ */ jsx53(
|
|
6600
6689
|
Button,
|
|
6601
6690
|
{
|
|
6602
6691
|
"aria-label": "Toggle fullscreen",
|
|
@@ -6604,7 +6693,7 @@ var DatabrowserTabs = ({ onFullScreenClick }) => {
|
|
|
6604
6693
|
size: "icon-sm",
|
|
6605
6694
|
onClick: onFullScreenClick,
|
|
6606
6695
|
className: "flex-shrink-0 bg-blue-100 hover:bg-blue-600 hover:text-white",
|
|
6607
|
-
children: /* @__PURE__ */
|
|
6696
|
+
children: /* @__PURE__ */ jsx53(IconMaximize, { size: 16 })
|
|
6608
6697
|
}
|
|
6609
6698
|
)
|
|
6610
6699
|
] })
|
|
@@ -6623,15 +6712,15 @@ function AddTabButton() {
|
|
|
6623
6712
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
6624
6713
|
}, 20);
|
|
6625
6714
|
};
|
|
6626
|
-
return /* @__PURE__ */
|
|
6715
|
+
return /* @__PURE__ */ jsx53(
|
|
6627
6716
|
Button,
|
|
6628
6717
|
{
|
|
6629
6718
|
"aria-label": "Add new tab",
|
|
6630
6719
|
variant: "secondary",
|
|
6631
6720
|
size: "icon-sm",
|
|
6632
6721
|
onClick: handleAddTab,
|
|
6633
|
-
className: "flex-shrink-0",
|
|
6634
|
-
children: /* @__PURE__ */
|
|
6722
|
+
className: "flex-shrink-0 dark:bg-zinc-200",
|
|
6723
|
+
children: /* @__PURE__ */ jsx53(IconPlus2, { className: "text-zinc-500 dark:text-zinc-600", size: 16 })
|
|
6635
6724
|
}
|
|
6636
6725
|
);
|
|
6637
6726
|
}
|
|
@@ -6639,7 +6728,7 @@ function TabsListButton({
|
|
|
6639
6728
|
tabs,
|
|
6640
6729
|
onSelectTab
|
|
6641
6730
|
}) {
|
|
6642
|
-
const [open, setOpen] =
|
|
6731
|
+
const [open, setOpen] = useState14(false);
|
|
6643
6732
|
const sorted = useMemo8(() => {
|
|
6644
6733
|
return [...tabs].sort(([, a], [, b]) => {
|
|
6645
6734
|
if (a.pinned && !b.pinned) return -1;
|
|
@@ -6658,7 +6747,7 @@ function TabsListButton({
|
|
|
6658
6747
|
}, 20);
|
|
6659
6748
|
};
|
|
6660
6749
|
return /* @__PURE__ */ jsxs35(Popover, { open, onOpenChange: setOpen, children: [
|
|
6661
|
-
/* @__PURE__ */
|
|
6750
|
+
/* @__PURE__ */ jsx53(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs35(
|
|
6662
6751
|
Button,
|
|
6663
6752
|
{
|
|
6664
6753
|
variant: "secondary",
|
|
@@ -6666,14 +6755,14 @@ function TabsListButton({
|
|
|
6666
6755
|
className: "h-7 gap-1 px-2",
|
|
6667
6756
|
"aria-label": "Search in tabs",
|
|
6668
6757
|
children: [
|
|
6669
|
-
/* @__PURE__ */
|
|
6670
|
-
/* @__PURE__ */
|
|
6758
|
+
/* @__PURE__ */ jsx53("span", { className: "text-xs text-zinc-600", children: tabs.length }),
|
|
6759
|
+
/* @__PURE__ */ jsx53(IconChevronDown2, { className: "text-zinc-500", size: 16 })
|
|
6671
6760
|
]
|
|
6672
6761
|
}
|
|
6673
6762
|
) }),
|
|
6674
|
-
/* @__PURE__ */
|
|
6675
|
-
/* @__PURE__ */
|
|
6676
|
-
/* @__PURE__ */
|
|
6763
|
+
/* @__PURE__ */ jsx53(PopoverContent, { className: "w-96 p-0", align: "end", children: /* @__PURE__ */ jsx53(Command, { children: /* @__PURE__ */ jsxs35(CommandList, { children: [
|
|
6764
|
+
/* @__PURE__ */ jsx53(CommandEmpty, { children: "No tabs" }),
|
|
6765
|
+
/* @__PURE__ */ jsx53(CommandGroup, { children: sorted.map(([_id, item]) => /* @__PURE__ */ jsx53(
|
|
6677
6766
|
CommandItem,
|
|
6678
6767
|
{
|
|
6679
6768
|
style: {
|
|
@@ -6683,7 +6772,7 @@ function TabsListButton({
|
|
|
6683
6772
|
onSelect: () => {
|
|
6684
6773
|
handleSelectTab(item.id);
|
|
6685
6774
|
},
|
|
6686
|
-
children: /* @__PURE__ */
|
|
6775
|
+
children: /* @__PURE__ */ jsx53(TabIdProvider, { value: _id, children: /* @__PURE__ */ jsx53(Tab, { id: _id, isList: true }) })
|
|
6687
6776
|
},
|
|
6688
6777
|
item.id
|
|
6689
6778
|
)) })
|
|
@@ -6692,7 +6781,7 @@ function TabsListButton({
|
|
|
6692
6781
|
}
|
|
6693
6782
|
|
|
6694
6783
|
// src/components/databrowser/index.tsx
|
|
6695
|
-
import { jsx as
|
|
6784
|
+
import { jsx as jsx54, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
6696
6785
|
var RedisBrowser = ({
|
|
6697
6786
|
token,
|
|
6698
6787
|
url,
|
|
@@ -6702,11 +6791,11 @@ var RedisBrowser = ({
|
|
|
6702
6791
|
theme = "light"
|
|
6703
6792
|
}) => {
|
|
6704
6793
|
const credentials = useMemo9(() => ({ token, url }), [token, url]);
|
|
6705
|
-
const rootRef =
|
|
6794
|
+
const rootRef = useRef7(null);
|
|
6706
6795
|
useEffect14(() => {
|
|
6707
6796
|
queryClient.resetQueries();
|
|
6708
6797
|
}, [credentials.url]);
|
|
6709
|
-
return /* @__PURE__ */
|
|
6798
|
+
return /* @__PURE__ */ jsx54(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx54(RedisProvider, { redisCredentials: credentials, children: /* @__PURE__ */ jsx54(DarkModeProvider, { theme, children: /* @__PURE__ */ jsx54(DatabrowserProvider, { storage, rootRef, children: /* @__PURE__ */ jsx54(TooltipProvider, { children: /* @__PURE__ */ jsx54(
|
|
6710
6799
|
RedisBrowserRoot,
|
|
6711
6800
|
{
|
|
6712
6801
|
hideTabs,
|
|
@@ -6727,15 +6816,15 @@ var RedisBrowserRoot = ({
|
|
|
6727
6816
|
}, [theme]);
|
|
6728
6817
|
return (
|
|
6729
6818
|
/* ups-db is the custom class used to prefix every style in the css bundle */
|
|
6730
|
-
/* @__PURE__ */
|
|
6819
|
+
/* @__PURE__ */ jsx54(
|
|
6731
6820
|
"div",
|
|
6732
6821
|
{
|
|
6733
6822
|
className: `ups-db ${theme === "dark" ? "dark" : ""}`,
|
|
6734
6823
|
style: { height: "100%" },
|
|
6735
6824
|
ref: rootRef,
|
|
6736
6825
|
children: /* @__PURE__ */ jsxs36("div", { className: "flex h-full flex-col text-zinc-700", children: [
|
|
6737
|
-
!hideTabs && /* @__PURE__ */
|
|
6738
|
-
/* @__PURE__ */
|
|
6826
|
+
!hideTabs && /* @__PURE__ */ jsx54(DatabrowserTabs, { onFullScreenClick }),
|
|
6827
|
+
/* @__PURE__ */ jsx54(DatabrowserInstances, {})
|
|
6739
6828
|
] })
|
|
6740
6829
|
}
|
|
6741
6830
|
)
|
|
@@ -6748,7 +6837,7 @@ var DatabrowserInstances = () => {
|
|
|
6748
6837
|
else if (!selectedTab) selectTab(tabs[0][0]);
|
|
6749
6838
|
}, [tabs, selectedTab, addTab, selectTab]);
|
|
6750
6839
|
if (!selectedTab) return;
|
|
6751
|
-
return tabs.map(([id]) => /* @__PURE__ */
|
|
6840
|
+
return tabs.map(([id]) => /* @__PURE__ */ jsx54(TabIdProvider, { value: id, children: /* @__PURE__ */ jsx54(DatabrowserInstance, { hidden: id !== selectedTab }) }, id));
|
|
6752
6841
|
};
|
|
6753
6842
|
export {
|
|
6754
6843
|
RedisBrowser
|