@upstash/react-redis-browser 0.1.2-canary-4 → 0.1.2-canary-5

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 CHANGED
@@ -1059,9 +1059,6 @@
1059
1059
  font-size: 0.75rem;
1060
1060
  line-height: 1rem;
1061
1061
  }
1062
- .ups-db .font-bold {
1063
- font-weight: 700;
1064
- }
1065
1062
  .ups-db .font-medium {
1066
1063
  font-weight: 500;
1067
1064
  }
package/dist/index.js CHANGED
@@ -3320,7 +3320,7 @@ var useFetchListItems = ({ dataKey, type }) => {
3320
3320
  count: LIST_DISPLAY_PAGE_SIZE
3321
3321
  });
3322
3322
  return {
3323
- cursor: nextCursor,
3323
+ cursor: nextCursor === "0" ? void 0 : nextCursor,
3324
3324
  keys: keys.map((key) => ({ key }))
3325
3325
  };
3326
3326
  },
@@ -3336,7 +3336,7 @@ var useFetchListItems = ({ dataKey, type }) => {
3336
3336
  rev: true
3337
3337
  });
3338
3338
  return {
3339
- cursor: lastIndex + LIST_DISPLAY_PAGE_SIZE,
3339
+ cursor: res.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastIndex + LIST_DISPLAY_PAGE_SIZE,
3340
3340
  keys: transformArray(res)
3341
3341
  };
3342
3342
  },
@@ -3351,7 +3351,7 @@ var useFetchListItems = ({ dataKey, type }) => {
3351
3351
  count: LIST_DISPLAY_PAGE_SIZE
3352
3352
  });
3353
3353
  return {
3354
- cursor: res[0],
3354
+ cursor: res[0] === "0" ? void 0 : res[0],
3355
3355
  keys: transformArray(res[1])
3356
3356
  };
3357
3357
  },
@@ -3365,7 +3365,7 @@ var useFetchListItems = ({ dataKey, type }) => {
3365
3365
  const lastIndex = Number(pageParam);
3366
3366
  const values = await redis.lrange(dataKey, lastIndex, lastIndex + LIST_DISPLAY_PAGE_SIZE);
3367
3367
  return {
3368
- cursor: lastIndex + LIST_DISPLAY_PAGE_SIZE,
3368
+ cursor: values.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastIndex + LIST_DISPLAY_PAGE_SIZE,
3369
3369
  keys: values.map((value, i) => ({
3370
3370
  key: (lastIndex + i).toString(),
3371
3371
  value
@@ -3377,17 +3377,18 @@ var useFetchListItems = ({ dataKey, type }) => {
3377
3377
  const streamQuery = _reactquery.useInfiniteQuery.call(void 0, {
3378
3378
  enabled: type === "stream",
3379
3379
  queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "stream"],
3380
- initialPageParam: "0",
3380
+ initialPageParam: "-",
3381
3381
  queryFn: async ({ pageParam: lastId }) => {
3382
3382
  const messages = await redis.xrange(
3383
3383
  dataKey,
3384
- lastId,
3384
+ lastId === "-" ? "-" : `(${lastId}`,
3385
3385
  "+",
3386
- LIST_DISPLAY_PAGE_SIZE
3386
+ // +1 since first message is the last one
3387
+ LIST_DISPLAY_PAGE_SIZE + 1
3387
3388
  );
3388
3389
  const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access', _15 => _15.at, 'call', _16 => _16(-1), 'optionalAccess', _17 => _17[0]]) : void 0;
3389
3390
  return {
3390
- cursor: lastMessageId,
3391
+ cursor: messages.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastMessageId,
3391
3392
  keys: messages.map(([id, fields]) => ({
3392
3393
  key: id,
3393
3394
  value: fields.join("\n")
@@ -3790,30 +3791,28 @@ function DeleteAlertDialog({
3790
3791
  children,
3791
3792
  onDeleteConfirm,
3792
3793
  open,
3793
- onOpenChange
3794
+ onOpenChange,
3795
+ deletionType
3794
3796
  }) {
3795
3797
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, AlertDialog, { open, onOpenChange, children: [
3796
3798
  children && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertDialogTrigger, { asChild: true, children }),
3797
3799
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, AlertDialogContent, { children: [
3798
3800
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, AlertDialogHeader, { children: [
3799
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertDialogTitle, { children: "Irreversible Action!" }),
3801
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertDialogTitle, { children: deletionType === "item" ? "Delete Item" : "Delete Key" }),
3800
3802
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, AlertDialogDescription, { className: "mt-5", children: [
3801
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-bold", children: "This action CANNOT BE UNDONE." }),
3802
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
3803
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
3804
- "By proceeding, you will ",
3805
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-bold", children: "PERMANENTLY REMOVE" }),
3806
- " your data from our servers, resulting in complete and irreversible loss of your information."
3803
+ "Are you sure you want to delete this ",
3804
+ deletionType,
3805
+ "? This action cannot be undone."
3807
3806
  ] })
3808
3807
  ] }),
3809
3808
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, AlertDialogFooter, { children: [
3810
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertDialogCancel, { children: "Cancel" }),
3809
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AlertDialogCancel, { type: "button", children: "Cancel" }),
3811
3810
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3812
3811
  AlertDialogAction,
3813
3812
  {
3814
3813
  className: "bg-red-500 text-gray-50 hover:bg-red-600",
3815
3814
  onClick: onDeleteConfirm,
3816
- children: "Delete"
3815
+ children: "Yes, Delete"
3817
3816
  }
3818
3817
  )
3819
3818
  ] })
@@ -3836,6 +3835,7 @@ var ItemContextMenu = ({
3836
3835
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3837
3836
  DeleteAlertDialog,
3838
3837
  {
3838
+ deletionType: "item",
3839
3839
  open: isAlertOpen,
3840
3840
  onOpenChange: setAlertOpen,
3841
3841
  onDeleteConfirm: (e) => {
@@ -4540,7 +4540,7 @@ function KeyActions({ dataKey, content }) {
4540
4540
  children: "Copy content"
4541
4541
  }
4542
4542
  ),
4543
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DeleteAlertDialog, { onDeleteConfirm: async () => await deleteKey(dataKey), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuItem, { onSelect: (e) => e.preventDefault(), children: "Delete key" }) })
4543
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DeleteAlertDialog, { deletionType: "key", onDeleteConfirm: async () => await deleteKey(dataKey), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuItem, { onSelect: (e) => e.preventDefault(), children: "Delete key" }) })
4544
4544
  ] })
4545
4545
  ] });
4546
4546
  }
@@ -4673,7 +4673,7 @@ var CustomEditor = ({
4673
4673
  language,
4674
4674
  value,
4675
4675
  onChange,
4676
- maxDynamicHeight,
4676
+ height,
4677
4677
  showCopyButton
4678
4678
  }) => {
4679
4679
  const monaco = _react2.useMonaco.call(void 0, );
@@ -4687,9 +4687,9 @@ var CustomEditor = ({
4687
4687
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
4688
4688
  "div",
4689
4689
  {
4690
- className: cn("group/editor relative", maxDynamicHeight === void 0 && "h-full p-2"),
4690
+ className: cn("group/editor relative", height === void 0 && "h-full p-2"),
4691
4691
  style: {
4692
- height: maxDynamicHeight
4692
+ height
4693
4693
  },
4694
4694
  children: [
4695
4695
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -4749,7 +4749,7 @@ var CustomEditor = ({
4749
4749
  var useField = ({
4750
4750
  name,
4751
4751
  form,
4752
- isEditorDynamic = false,
4752
+ height,
4753
4753
  showCopyButton
4754
4754
  }) => {
4755
4755
  const { field, fieldState } = _reacthookform.useController.call(void 0, {
@@ -4787,7 +4787,7 @@ var useField = ({
4787
4787
  language: contentType === "JSON" ? "json" : "plaintext",
4788
4788
  value: field.value,
4789
4789
  onChange: field.onChange,
4790
- maxDynamicHeight: isEditorDynamic ? 100 : void 0,
4790
+ height,
4791
4791
  showCopyButton
4792
4792
  }
4793
4793
  ) })
@@ -4839,13 +4839,14 @@ var ListEditForm = ({
4839
4839
  });
4840
4840
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacthookform.FormProvider, { ...form, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit, className: "flex flex-col gap-2", children: [
4841
4841
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex grow flex-col gap-2", children: [
4842
- type !== "list" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FormItem, { name: "key", label: keyLabel }),
4843
- type === "zset" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NumberFormItem, { name: "value", label: valueLabel }) : type !== "set" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FormItem, { name: "value", label: valueLabel })
4842
+ type !== "list" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FormItem, { name: "key", height: type === "set" ? 250 : 100, label: keyLabel }),
4843
+ type === "zset" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NumberFormItem, { name: "value", label: valueLabel }) : type !== "set" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, FormItem, { name: "value", height: type === "list" ? 250 : 100, label: valueLabel })
4844
4844
  ] }),
4845
4845
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex justify-end gap-2", children: [
4846
4846
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4847
4847
  Button,
4848
4848
  {
4849
+ type: "button",
4849
4850
  onClick: () => {
4850
4851
  setSelectedListItem(void 0);
4851
4852
  },
@@ -4889,12 +4890,16 @@ var NumberFormItem = ({ name, label }) => {
4889
4890
  )
4890
4891
  ] });
4891
4892
  };
4892
- var FormItem = ({ name, label }) => {
4893
+ var FormItem = ({
4894
+ name,
4895
+ label,
4896
+ height
4897
+ }) => {
4893
4898
  const form = _reacthookform.useFormContext.call(void 0, );
4894
4899
  const { editor, selector } = useField({
4895
4900
  name,
4896
4901
  form,
4897
- isEditorDynamic: true,
4902
+ height,
4898
4903
  showCopyButton: true
4899
4904
  });
4900
4905
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-1", children: [
@@ -4966,22 +4971,33 @@ var ListItems = ({
4966
4971
  children: value
4967
4972
  }
4968
4973
  ),
4969
- type !== "stream" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { width: 20, className: "px-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4970
- DeleteAlertDialog,
4974
+ type !== "stream" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4975
+ "td",
4971
4976
  {
4972
- onDeleteConfirm: (e) => {
4977
+ width: 20,
4978
+ className: "px-3",
4979
+ onClick: (e) => {
4973
4980
  e.stopPropagation();
4974
- editItem({
4975
- type,
4976
- dataKey,
4977
- itemKey: key,
4978
- // For deletion
4979
- newKey: void 0
4980
- });
4981
4981
  },
4982
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { size: "icon-sm", variant: "secondary", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconTrash, { className: "size-4 text-zinc-500" }) })
4982
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4983
+ DeleteAlertDialog,
4984
+ {
4985
+ deletionType: "item",
4986
+ onDeleteConfirm: (e) => {
4987
+ e.stopPropagation();
4988
+ editItem({
4989
+ type,
4990
+ dataKey,
4991
+ itemKey: key,
4992
+ // For deletion
4993
+ newKey: void 0
4994
+ });
4995
+ },
4996
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { size: "icon-sm", variant: "secondary", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconTrash, { className: "size-4 text-zinc-500" }) })
4997
+ }
4998
+ )
4983
4999
  }
4984
- ) })
5000
+ )
4985
5001
  ]
4986
5002
  }
4987
5003
  )
@@ -5060,12 +5076,13 @@ var DataDisplay = () => {
5060
5076
 
5061
5077
  // src/components/databrowser/components/add-key-modal.tsx
5062
5078
 
5079
+ var _reactdialog = require('@radix-ui/react-dialog'); var DialogPrimitive = _interopRequireWildcard(_reactdialog);
5063
5080
 
5064
5081
 
5065
5082
 
5066
5083
  // src/components/ui/dialog.tsx
5067
5084
 
5068
- var _reactdialog = require('@radix-ui/react-dialog'); var DialogPrimitive = _interopRequireWildcard(_reactdialog);
5085
+
5069
5086
 
5070
5087
  var Dialog = DialogPrimitive.Root;
5071
5088
  var DialogTrigger = DialogPrimitive.Trigger;
@@ -5207,6 +5224,7 @@ function AddKeyModal() {
5207
5224
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Button, { variant: "primary", size: "icon-sm", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.PlusIcon, { className: "size-4" }) }) }),
5208
5225
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, DialogContent, { className: "max-w-[400px]", children: [
5209
5226
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogHeader, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DialogTitle, { children: "Create new key" }) }),
5227
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "sr-only", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactdialog.DialogDescription, { children: "Create new key" }) }),
5210
5228
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { className: "mt-4", onSubmit, children: [
5211
5229
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
5212
5230
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -5278,6 +5296,7 @@ var SidebarContextMenu = ({
5278
5296
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5279
5297
  DeleteAlertDialog,
5280
5298
  {
5299
+ deletionType: "key",
5281
5300
  open: isAlertOpen,
5282
5301
  onOpenChange: setAlertOpen,
5283
5302
  onDeleteConfirm: (e) => {
@@ -5441,8 +5460,8 @@ function Sidebar() {
5441
5460
 
5442
5461
  var RedisBrowser = ({ token, url }) => {
5443
5462
  const credentials = _react.useMemo.call(void 0, () => ({ token, url }), [token, url]);
5444
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacttooltip.TooltipProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserProvider, { redisCredentials: credentials, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, KeysProvider, { children: [
5445
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "ups-db", style: { height: "100%" }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5463
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacttooltip.TooltipProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserProvider, { redisCredentials: credentials, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeysProvider, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "ups-db", style: { height: "100%" }, children: [
5464
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5446
5465
  _reactresizablepanels.PanelGroup,
5447
5466
  {
5448
5467
  autoSaveId: "persistence",
@@ -5461,9 +5480,9 @@ var RedisBrowser = ({ token, url }) => {
5461
5480
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { minSize: 40, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataDisplay, {}) })
5462
5481
  ]
5463
5482
  }
5464
- ) }),
5483
+ ),
5465
5484
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Toaster, {})
5466
- ] }) }) }) });
5485
+ ] }) }) }) }) });
5467
5486
  };
5468
5487
 
5469
5488
 
package/dist/index.mjs CHANGED
@@ -3320,7 +3320,7 @@ var useFetchListItems = ({ dataKey, type }) => {
3320
3320
  count: LIST_DISPLAY_PAGE_SIZE
3321
3321
  });
3322
3322
  return {
3323
- cursor: nextCursor,
3323
+ cursor: nextCursor === "0" ? void 0 : nextCursor,
3324
3324
  keys: keys.map((key) => ({ key }))
3325
3325
  };
3326
3326
  },
@@ -3336,7 +3336,7 @@ var useFetchListItems = ({ dataKey, type }) => {
3336
3336
  rev: true
3337
3337
  });
3338
3338
  return {
3339
- cursor: lastIndex + LIST_DISPLAY_PAGE_SIZE,
3339
+ cursor: res.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastIndex + LIST_DISPLAY_PAGE_SIZE,
3340
3340
  keys: transformArray(res)
3341
3341
  };
3342
3342
  },
@@ -3351,7 +3351,7 @@ var useFetchListItems = ({ dataKey, type }) => {
3351
3351
  count: LIST_DISPLAY_PAGE_SIZE
3352
3352
  });
3353
3353
  return {
3354
- cursor: res[0],
3354
+ cursor: res[0] === "0" ? void 0 : res[0],
3355
3355
  keys: transformArray(res[1])
3356
3356
  };
3357
3357
  },
@@ -3365,7 +3365,7 @@ var useFetchListItems = ({ dataKey, type }) => {
3365
3365
  const lastIndex = Number(pageParam);
3366
3366
  const values = await redis.lrange(dataKey, lastIndex, lastIndex + LIST_DISPLAY_PAGE_SIZE);
3367
3367
  return {
3368
- cursor: lastIndex + LIST_DISPLAY_PAGE_SIZE,
3368
+ cursor: values.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastIndex + LIST_DISPLAY_PAGE_SIZE,
3369
3369
  keys: values.map((value, i) => ({
3370
3370
  key: (lastIndex + i).toString(),
3371
3371
  value
@@ -3377,17 +3377,18 @@ var useFetchListItems = ({ dataKey, type }) => {
3377
3377
  const streamQuery = useInfiniteQuery2({
3378
3378
  enabled: type === "stream",
3379
3379
  queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "stream"],
3380
- initialPageParam: "0",
3380
+ initialPageParam: "-",
3381
3381
  queryFn: async ({ pageParam: lastId }) => {
3382
3382
  const messages = await redis.xrange(
3383
3383
  dataKey,
3384
- lastId,
3384
+ lastId === "-" ? "-" : `(${lastId}`,
3385
3385
  "+",
3386
- LIST_DISPLAY_PAGE_SIZE
3386
+ // +1 since first message is the last one
3387
+ LIST_DISPLAY_PAGE_SIZE + 1
3387
3388
  );
3388
3389
  const lastMessageId = messages.length > 0 ? messages.at(-1)?.[0] : void 0;
3389
3390
  return {
3390
- cursor: lastMessageId,
3391
+ cursor: messages.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastMessageId,
3391
3392
  keys: messages.map(([id, fields]) => ({
3392
3393
  key: id,
3393
3394
  value: fields.join("\n")
@@ -3790,30 +3791,28 @@ function DeleteAlertDialog({
3790
3791
  children,
3791
3792
  onDeleteConfirm,
3792
3793
  open,
3793
- onOpenChange
3794
+ onOpenChange,
3795
+ deletionType
3794
3796
  }) {
3795
3797
  return /* @__PURE__ */ jsxs5(AlertDialog, { open, onOpenChange, children: [
3796
3798
  children && /* @__PURE__ */ jsx10(AlertDialogTrigger, { asChild: true, children }),
3797
3799
  /* @__PURE__ */ jsxs5(AlertDialogContent, { children: [
3798
3800
  /* @__PURE__ */ jsxs5(AlertDialogHeader, { children: [
3799
- /* @__PURE__ */ jsx10(AlertDialogTitle, { children: "Irreversible Action!" }),
3801
+ /* @__PURE__ */ jsx10(AlertDialogTitle, { children: deletionType === "item" ? "Delete Item" : "Delete Key" }),
3800
3802
  /* @__PURE__ */ jsxs5(AlertDialogDescription, { className: "mt-5", children: [
3801
- /* @__PURE__ */ jsx10("span", { className: "font-bold", children: "This action CANNOT BE UNDONE." }),
3802
- /* @__PURE__ */ jsx10("br", {}),
3803
- /* @__PURE__ */ jsx10("br", {}),
3804
- "By proceeding, you will ",
3805
- /* @__PURE__ */ jsx10("span", { className: "font-bold", children: "PERMANENTLY REMOVE" }),
3806
- " your data from our servers, resulting in complete and irreversible loss of your information."
3803
+ "Are you sure you want to delete this ",
3804
+ deletionType,
3805
+ "? This action cannot be undone."
3807
3806
  ] })
3808
3807
  ] }),
3809
3808
  /* @__PURE__ */ jsxs5(AlertDialogFooter, { children: [
3810
- /* @__PURE__ */ jsx10(AlertDialogCancel, { children: "Cancel" }),
3809
+ /* @__PURE__ */ jsx10(AlertDialogCancel, { type: "button", children: "Cancel" }),
3811
3810
  /* @__PURE__ */ jsx10(
3812
3811
  AlertDialogAction,
3813
3812
  {
3814
3813
  className: "bg-red-500 text-gray-50 hover:bg-red-600",
3815
3814
  onClick: onDeleteConfirm,
3816
- children: "Delete"
3815
+ children: "Yes, Delete"
3817
3816
  }
3818
3817
  )
3819
3818
  ] })
@@ -3836,6 +3835,7 @@ var ItemContextMenu = ({
3836
3835
  /* @__PURE__ */ jsx11(
3837
3836
  DeleteAlertDialog,
3838
3837
  {
3838
+ deletionType: "item",
3839
3839
  open: isAlertOpen,
3840
3840
  onOpenChange: setAlertOpen,
3841
3841
  onDeleteConfirm: (e) => {
@@ -4540,7 +4540,7 @@ function KeyActions({ dataKey, content }) {
4540
4540
  children: "Copy content"
4541
4541
  }
4542
4542
  ),
4543
- /* @__PURE__ */ jsx22(DeleteAlertDialog, { onDeleteConfirm: async () => await deleteKey(dataKey), children: /* @__PURE__ */ jsx22(DropdownMenuItem, { onSelect: (e) => e.preventDefault(), children: "Delete key" }) })
4543
+ /* @__PURE__ */ jsx22(DeleteAlertDialog, { deletionType: "key", onDeleteConfirm: async () => await deleteKey(dataKey), children: /* @__PURE__ */ jsx22(DropdownMenuItem, { onSelect: (e) => e.preventDefault(), children: "Delete key" }) })
4544
4544
  ] })
4545
4545
  ] });
4546
4546
  }
@@ -4673,7 +4673,7 @@ var CustomEditor = ({
4673
4673
  language,
4674
4674
  value,
4675
4675
  onChange,
4676
- maxDynamicHeight,
4676
+ height,
4677
4677
  showCopyButton
4678
4678
  }) => {
4679
4679
  const monaco = useMonaco();
@@ -4687,9 +4687,9 @@ var CustomEditor = ({
4687
4687
  return /* @__PURE__ */ jsxs18(
4688
4688
  "div",
4689
4689
  {
4690
- className: cn("group/editor relative", maxDynamicHeight === void 0 && "h-full p-2"),
4690
+ className: cn("group/editor relative", height === void 0 && "h-full p-2"),
4691
4691
  style: {
4692
- height: maxDynamicHeight
4692
+ height
4693
4693
  },
4694
4694
  children: [
4695
4695
  /* @__PURE__ */ jsx27(
@@ -4749,7 +4749,7 @@ import { Fragment as Fragment4, jsx as jsx28 } from "react/jsx-runtime";
4749
4749
  var useField = ({
4750
4750
  name,
4751
4751
  form,
4752
- isEditorDynamic = false,
4752
+ height,
4753
4753
  showCopyButton
4754
4754
  }) => {
4755
4755
  const { field, fieldState } = useController({
@@ -4787,7 +4787,7 @@ var useField = ({
4787
4787
  language: contentType === "JSON" ? "json" : "plaintext",
4788
4788
  value: field.value,
4789
4789
  onChange: field.onChange,
4790
- maxDynamicHeight: isEditorDynamic ? 100 : void 0,
4790
+ height,
4791
4791
  showCopyButton
4792
4792
  }
4793
4793
  ) })
@@ -4839,13 +4839,14 @@ var ListEditForm = ({
4839
4839
  });
4840
4840
  return /* @__PURE__ */ jsx29(FormProvider, { ...form, children: /* @__PURE__ */ jsxs19("form", { onSubmit, className: "flex flex-col gap-2", children: [
4841
4841
  /* @__PURE__ */ jsxs19("div", { className: "flex grow flex-col gap-2", children: [
4842
- type !== "list" && /* @__PURE__ */ jsx29(FormItem, { name: "key", label: keyLabel }),
4843
- type === "zset" ? /* @__PURE__ */ jsx29(NumberFormItem, { name: "value", label: valueLabel }) : type !== "set" && /* @__PURE__ */ jsx29(FormItem, { name: "value", label: valueLabel })
4842
+ type !== "list" && /* @__PURE__ */ jsx29(FormItem, { name: "key", height: type === "set" ? 250 : 100, label: keyLabel }),
4843
+ type === "zset" ? /* @__PURE__ */ jsx29(NumberFormItem, { name: "value", label: valueLabel }) : type !== "set" && /* @__PURE__ */ jsx29(FormItem, { name: "value", height: type === "list" ? 250 : 100, label: valueLabel })
4844
4844
  ] }),
4845
4845
  /* @__PURE__ */ jsxs19("div", { className: "flex justify-end gap-2", children: [
4846
4846
  /* @__PURE__ */ jsx29(
4847
4847
  Button,
4848
4848
  {
4849
+ type: "button",
4849
4850
  onClick: () => {
4850
4851
  setSelectedListItem(void 0);
4851
4852
  },
@@ -4889,12 +4890,16 @@ var NumberFormItem = ({ name, label }) => {
4889
4890
  )
4890
4891
  ] });
4891
4892
  };
4892
- var FormItem = ({ name, label }) => {
4893
+ var FormItem = ({
4894
+ name,
4895
+ label,
4896
+ height
4897
+ }) => {
4893
4898
  const form = useFormContext();
4894
4899
  const { editor, selector } = useField({
4895
4900
  name,
4896
4901
  form,
4897
- isEditorDynamic: true,
4902
+ height,
4898
4903
  showCopyButton: true
4899
4904
  });
4900
4905
  return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-1", children: [
@@ -4966,22 +4971,33 @@ var ListItems = ({
4966
4971
  children: value
4967
4972
  }
4968
4973
  ),
4969
- type !== "stream" && /* @__PURE__ */ jsx30("td", { width: 20, className: "px-3", children: /* @__PURE__ */ jsx30(
4970
- DeleteAlertDialog,
4974
+ type !== "stream" && /* @__PURE__ */ jsx30(
4975
+ "td",
4971
4976
  {
4972
- onDeleteConfirm: (e) => {
4977
+ width: 20,
4978
+ className: "px-3",
4979
+ onClick: (e) => {
4973
4980
  e.stopPropagation();
4974
- editItem({
4975
- type,
4976
- dataKey,
4977
- itemKey: key,
4978
- // For deletion
4979
- newKey: void 0
4980
- });
4981
4981
  },
4982
- children: /* @__PURE__ */ jsx30(Button, { size: "icon-sm", variant: "secondary", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx30(IconTrash, { className: "size-4 text-zinc-500" }) })
4982
+ children: /* @__PURE__ */ jsx30(
4983
+ DeleteAlertDialog,
4984
+ {
4985
+ deletionType: "item",
4986
+ onDeleteConfirm: (e) => {
4987
+ e.stopPropagation();
4988
+ editItem({
4989
+ type,
4990
+ dataKey,
4991
+ itemKey: key,
4992
+ // For deletion
4993
+ newKey: void 0
4994
+ });
4995
+ },
4996
+ children: /* @__PURE__ */ jsx30(Button, { size: "icon-sm", variant: "secondary", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx30(IconTrash, { className: "size-4 text-zinc-500" }) })
4997
+ }
4998
+ )
4983
4999
  }
4984
- ) })
5000
+ )
4985
5001
  ]
4986
5002
  }
4987
5003
  )
@@ -5060,6 +5076,7 @@ var DataDisplay = () => {
5060
5076
 
5061
5077
  // src/components/databrowser/components/add-key-modal.tsx
5062
5078
  import { useState as useState8 } from "react";
5079
+ import { DialogDescription as DialogDescription2 } from "@radix-ui/react-dialog";
5063
5080
  import { PlusIcon } from "@radix-ui/react-icons";
5064
5081
  import { Controller as Controller3, useForm as useForm4 } from "react-hook-form";
5065
5082
 
@@ -5207,6 +5224,7 @@ function AddKeyModal() {
5207
5224
  /* @__PURE__ */ jsx34(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsx34(Button, { variant: "primary", size: "icon-sm", children: /* @__PURE__ */ jsx34(PlusIcon, { className: "size-4" }) }) }),
5208
5225
  /* @__PURE__ */ jsxs23(DialogContent, { className: "max-w-[400px]", children: [
5209
5226
  /* @__PURE__ */ jsx34(DialogHeader, { children: /* @__PURE__ */ jsx34(DialogTitle, { children: "Create new key" }) }),
5227
+ /* @__PURE__ */ jsx34("div", { className: "sr-only", children: /* @__PURE__ */ jsx34(DialogDescription2, { children: "Create new key" }) }),
5210
5228
  /* @__PURE__ */ jsxs23("form", { className: "mt-4", onSubmit, children: [
5211
5229
  /* @__PURE__ */ jsxs23("div", { className: "flex gap-1", children: [
5212
5230
  /* @__PURE__ */ jsx34(
@@ -5278,6 +5296,7 @@ var SidebarContextMenu = ({
5278
5296
  /* @__PURE__ */ jsx36(
5279
5297
  DeleteAlertDialog,
5280
5298
  {
5299
+ deletionType: "key",
5281
5300
  open: isAlertOpen,
5282
5301
  onOpenChange: setAlertOpen,
5283
5302
  onDeleteConfirm: (e) => {
@@ -5441,8 +5460,8 @@ function Sidebar() {
5441
5460
  import { jsx as jsx42, jsxs as jsxs31 } from "react/jsx-runtime";
5442
5461
  var RedisBrowser = ({ token, url }) => {
5443
5462
  const credentials = useMemo6(() => ({ token, url }), [token, url]);
5444
- return /* @__PURE__ */ jsx42(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx42(TooltipProvider, { children: /* @__PURE__ */ jsx42(DatabrowserProvider, { redisCredentials: credentials, children: /* @__PURE__ */ jsxs31(KeysProvider, { children: [
5445
- /* @__PURE__ */ jsx42("div", { className: "ups-db", style: { height: "100%" }, children: /* @__PURE__ */ jsxs31(
5463
+ return /* @__PURE__ */ jsx42(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx42(TooltipProvider, { children: /* @__PURE__ */ jsx42(DatabrowserProvider, { redisCredentials: credentials, children: /* @__PURE__ */ jsx42(KeysProvider, { children: /* @__PURE__ */ jsxs31("div", { className: "ups-db", style: { height: "100%" }, children: [
5464
+ /* @__PURE__ */ jsxs31(
5446
5465
  PanelGroup,
5447
5466
  {
5448
5467
  autoSaveId: "persistence",
@@ -5461,9 +5480,9 @@ var RedisBrowser = ({ token, url }) => {
5461
5480
  /* @__PURE__ */ jsx42(Panel, { minSize: 40, children: /* @__PURE__ */ jsx42(DataDisplay, {}) })
5462
5481
  ]
5463
5482
  }
5464
- ) }),
5483
+ ),
5465
5484
  /* @__PURE__ */ jsx42(Toaster, {})
5466
- ] }) }) }) });
5485
+ ] }) }) }) }) });
5467
5486
  };
5468
5487
  export {
5469
5488
  RedisBrowser
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@upstash/react-redis-browser", "version": "v0.1.2-canary-4", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "bugs": { "url": "https://github.com/upstash/react-redis-browser/issues" }, "homepage": "https://github.com/upstash/react-redis-browser", "files": [ "./dist/**" ], "scripts": { "build": "tsup", "dev": "vite", "lint": "tsc && eslint", "fmt": "prettier --write ." }, "lint-staged": { "**/*.{js,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.4.0", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-context-menu": "^2.2.2", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-icons": "1.3.0", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-scroll-area": "^1.0.3", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "^1.31.6", "bytes": "^3.1.2", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "postcss-prefix-selector": "^2.1.0", "@types/node": "^22.8.4", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "8.4.0", "@typescript-eslint/parser": "8.4.0", "@vitejs/plugin-react": "^4.1.0", "autoprefixer": "^10.4.14", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "postcss": "^8.4.31", "prettier": "^3.0.3", "prettier-plugin-tailwindcss": "^0.5.5", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwind-merge": "^2.5.4", "tailwindcss": "^3.4.14", "tailwindcss-animate": "^1.0.7", "tsup": "^8.3.5", "typescript": "^5.0.4", "vite": "^5.4.10", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { "react": "^18.2.0 || ^19", "react-dom": "^18.2.0 || ^19" } }
1
+ { "name": "@upstash/react-redis-browser", "version": "v0.1.2-canary-5", "main": "./dist/index.js", "types": "./dist/index.d.ts", "license": "MIT", "private": false, "publishConfig": { "access": "public" }, "bugs": { "url": "https://github.com/upstash/react-redis-browser/issues" }, "homepage": "https://github.com/upstash/react-redis-browser", "files": [ "./dist/**" ], "scripts": { "build": "tsup", "dev": "vite", "lint": "tsc && eslint", "fmt": "prettier --write ." }, "lint-staged": { "**/*.{js,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@ianvs/prettier-plugin-sort-imports": "^4.4.0", "@monaco-editor/react": "^4.6.0", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-context-menu": "^2.2.2", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-icons": "1.3.0", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-scroll-area": "^1.0.3", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", "@radix-ui/react-toast": "^1.1.5", "@radix-ui/react-tooltip": "^1.0.7", "@tabler/icons-react": "^3.19.0", "@tanstack/react-query": "^5.32.0", "@types/bytes": "^3.1.4", "@upstash/redis": "^1.31.6", "bytes": "^3.1.2", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "postcss-prefix-selector": "^2.1.0", "@types/node": "^22.8.4", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "8.4.0", "@typescript-eslint/parser": "8.4.0", "@vitejs/plugin-react": "^4.1.0", "autoprefixer": "^10.4.14", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "postcss": "^8.4.31", "prettier": "^3.0.3", "prettier-plugin-tailwindcss": "^0.5.5", "react": "^18.3.1", "react-dom": "^18.3.1", "tailwind-merge": "^2.5.4", "tailwindcss": "^3.4.14", "tailwindcss-animate": "^1.0.7", "tsup": "^8.3.5", "typescript": "^5.0.4", "vite": "^5.4.10", "vite-tsconfig-paths": "^5.0.1" }, "peerDependencies": { "react": "^18.2.0 || ^19", "react-dom": "^18.2.0 || ^19" } }