@upstash/react-redis-browser 0.1.2-canary → 0.1.2-canary-3

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/README.md CHANGED
@@ -1,74 +1,37 @@
1
1
  # RedisBrowser for Upstash Redis
2
+ `@upstash/react-redis-browser` is a React component that provides a UI for browsing and editing data in your Upstash Redis instances.
2
3
 
3
- `@upstash/react-redis-browser` is a React component that provides a UI for browsing and editing data in your Upstash Redis instances. It’s easy to set up and integrate into your React applications. This guide will help you get started with the installation and basic usage.
4
+ <img src="public%2Fredis-browser.png" width="640px" />
4
5
 
5
- ## Table of Contents
6
-
7
- - [Install](#1-install)
8
- - [Configuration](#2-configuration)
9
- - [Usage](#3-usage)
10
-
11
- ## 1. Install
6
+ ### Install
12
7
 
13
8
  Install the databrowser component via npm:
14
9
 
15
- ```sh-session
10
+ ```bash
16
11
  $ npm install @upstash/react-redis-browser
17
12
  ```
18
13
 
19
- ## 2. Configuration
20
-
21
- ### Environment Variables
22
-
23
- Configure your Upstash Redis REST URL and token as environment variables:
24
-
25
- ```sh-session
26
- NEXT_PUBLIC_UPSTASH_REDIS_REST_URL=YOUR_REDIS_REST_URL
27
- NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN=YOUR_REDIS_REST_TOKEN
28
- ```
29
-
30
- ## 3. Usage
31
-
32
- ### Creating the Data Browser Component
33
-
34
- In your React application, create a new component that will utilize @upstash/react-redis-browser.
14
+ ### Usage
35
15
 
36
16
  Here's a basic example of how to use the component:
37
17
 
38
18
  ```tsx
39
19
  import { RedisBrowser } from "@upstash/react-redis-browser"
40
-
41
20
  import "@upstash/react-redis-browser/dist/index.css"
42
21
 
43
22
  export default function RedisBrowserDemo() {
44
- const redisUrl = process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL
45
- const redisToken = process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN
46
-
47
23
  return (
48
24
  <main style={mainStyle}>
49
- <div style={divStyle}>
50
- <RedisBrowser token={redisToken} url={redisUrl} />
51
- </div>
25
+ <RedisBrowser
26
+ url={UPSTASH_REDIS_REST_URL}
27
+ token={UPSTASH_REDIS_REST_TOKEN} />
52
28
  </main>
53
29
  )
54
30
  }
55
31
 
56
32
  const mainStyle = {
57
- height: "100vh",
58
33
  width: "100vw",
59
- display: "flex",
60
- alignItems: "center",
61
- justifyContent: "center",
62
- flexDirection: "column",
63
- background: "rgb(250,250,250)",
34
+ maxWidth: "900px",
35
+ height: "500px",
36
+ margin: "0 auto",
64
37
  }
65
-
66
- const divStyle = {
67
- height: "100%",
68
- width: "100%",
69
- maxHeight: "45rem",
70
- maxWidth: "64rem",
71
- borderRadius: "0.5rem",
72
- overflow: "hidden",
73
- }
74
- ```
package/dist/index.css CHANGED
@@ -360,11 +360,6 @@
360
360
  max-width: 1536px;
361
361
  }
362
362
  }
363
- .ups-db input[type=number].plain-input::-webkit-inner-spin-button,
364
- .ups-db input[type=number].plain-input::-webkit-outer-spin-button {
365
- -webkit-appearance: none;
366
- margin: 0;
367
- }
368
363
  .ups-db .sr-only {
369
364
  position: absolute;
370
365
  width: 1px;
@@ -449,10 +444,6 @@
449
444
  margin-left: -0.25rem;
450
445
  margin-right: -0.25rem;
451
446
  }
452
- .ups-db .mx-auto {
453
- margin-left: auto;
454
- margin-right: auto;
455
- }
456
447
  .ups-db .my-1 {
457
448
  margin-top: 0.25rem;
458
449
  margin-bottom: 0.25rem;
@@ -543,9 +534,6 @@
543
534
  .ups-db .h-\[100px\] {
544
535
  height: 100px;
545
536
  }
546
- .ups-db .h-\[600px\] {
547
- height: 600px;
548
- }
549
537
  .ups-db .h-\[var\(--radix-select-trigger-height\)\] {
550
538
  height: var(--radix-select-trigger-height);
551
539
  }
@@ -555,9 +543,6 @@
555
543
  .ups-db .h-px {
556
544
  height: 1px;
557
545
  }
558
- .ups-db .max-h-full {
559
- max-height: 100%;
560
- }
561
546
  .ups-db .max-h-screen {
562
547
  max-height: 100vh;
563
548
  }
@@ -633,9 +618,6 @@
633
618
  .ups-db .max-w-lg {
634
619
  max-width: 32rem;
635
620
  }
636
- .ups-db .max-w-screen-lg {
637
- max-width: 1024px;
638
- }
639
621
  .ups-db .flex-1 {
640
622
  flex: 1 1 0%;
641
623
  }
@@ -977,9 +959,6 @@
977
959
  .ups-db .p-1 {
978
960
  padding: 0.25rem;
979
961
  }
980
- .ups-db .p-10 {
981
- padding: 2.5rem;
982
- }
983
962
  .ups-db .p-2 {
984
963
  padding: 0.5rem;
985
964
  }
package/dist/index.js CHANGED
@@ -5058,7 +5058,7 @@ var EditorDisplayForm = ({
5058
5058
  var DataDisplay = () => {
5059
5059
  const { selectedKey } = useDatabrowserStore();
5060
5060
  const type = useKeyType(selectedKey);
5061
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full rounded-xl border p-1", children: !selectedKey ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}) : !type ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: type === "string" || type === "json" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListDisplay, { dataKey: selectedKey, type }) }) });
5061
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full rounded-xl border p-1 bg-white", children: !selectedKey ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}) : !type ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: type === "string" || type === "json" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListDisplay, { dataKey: selectedKey, type }) }) });
5062
5062
  };
5063
5063
 
5064
5064
  // src/components/databrowser/components/add-key-modal.tsx
@@ -5425,7 +5425,7 @@ function DataTypeSelector() {
5425
5425
 
5426
5426
  function Sidebar() {
5427
5427
  const { keys, query } = useKeys();
5428
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2 rounded-xl border p-1", children: [
5428
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2 rounded-xl border p-1 bg-white", children: [
5429
5429
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg bg-zinc-100 px-3 py-2", children: [
5430
5430
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center justify-between pl-1", children: [
5431
5431
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayDbSize, {}),
@@ -5445,7 +5445,7 @@ function Sidebar() {
5445
5445
  var RedisBrowser = ({ token, url }) => {
5446
5446
  const credentials = _react.useMemo.call(void 0, () => ({ token, url }), [token, url]);
5447
5447
  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: [
5448
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "ups-db h-full", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5448
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "ups-db", style: { height: "100%" }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
5449
5449
  _reactresizablepanels.PanelGroup,
5450
5450
  {
5451
5451
  autoSaveId: "persistence",
@@ -5453,7 +5453,7 @@ var RedisBrowser = ({ token, url }) => {
5453
5453
  className: "h-full w-full gap-0.5 text-sm antialiased",
5454
5454
  children: [
5455
5455
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Sidebar, {}) }),
5456
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.PanelResizeHandle, { className: "h-full flex w-1.5 items-center justify-center rounded-full hover:bg-zinc-300/20", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5456
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.PanelResizeHandle, { className: "h-fullm flex w-1.5 items-center justify-center rounded-full hover:bg-zinc-300/20", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
5457
5457
  _iconsreact.IconDotsVertical,
5458
5458
  {
5459
5459
  size: 16,
package/dist/index.mjs CHANGED
@@ -5058,7 +5058,7 @@ import { Fragment as Fragment7, jsx as jsx32 } from "react/jsx-runtime";
5058
5058
  var DataDisplay = () => {
5059
5059
  const { selectedKey } = useDatabrowserStore();
5060
5060
  const type = useKeyType(selectedKey);
5061
- return /* @__PURE__ */ jsx32("div", { className: "h-full rounded-xl border p-1", children: !selectedKey ? /* @__PURE__ */ jsx32("div", {}) : !type ? /* @__PURE__ */ jsx32("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx32("span", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ jsx32(Fragment7, { children: type === "string" || type === "json" ? /* @__PURE__ */ jsx32(EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ jsx32(ListDisplay, { dataKey: selectedKey, type }) }) });
5061
+ return /* @__PURE__ */ jsx32("div", { className: "h-full rounded-xl border p-1 bg-white", children: !selectedKey ? /* @__PURE__ */ jsx32("div", {}) : !type ? /* @__PURE__ */ jsx32("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ jsx32("span", { className: "text-gray-500", children: "Loading..." }) }) : /* @__PURE__ */ jsx32(Fragment7, { children: type === "string" || type === "json" ? /* @__PURE__ */ jsx32(EditorDisplay, { dataKey: selectedKey, type }) : /* @__PURE__ */ jsx32(ListDisplay, { dataKey: selectedKey, type }) }) });
5062
5062
  };
5063
5063
 
5064
5064
  // src/components/databrowser/components/add-key-modal.tsx
@@ -5425,7 +5425,7 @@ function DataTypeSelector() {
5425
5425
  import { jsx as jsx41, jsxs as jsxs30 } from "react/jsx-runtime";
5426
5426
  function Sidebar() {
5427
5427
  const { keys, query } = useKeys();
5428
- return /* @__PURE__ */ jsxs30("div", { className: "flex h-full flex-col gap-2 rounded-xl border p-1", children: [
5428
+ return /* @__PURE__ */ jsxs30("div", { className: "flex h-full flex-col gap-2 rounded-xl border p-1 bg-white", children: [
5429
5429
  /* @__PURE__ */ jsxs30("div", { className: "rounded-lg bg-zinc-100 px-3 py-2", children: [
5430
5430
  /* @__PURE__ */ jsxs30("div", { className: "flex h-10 items-center justify-between pl-1", children: [
5431
5431
  /* @__PURE__ */ jsx41(DisplayDbSize, {}),
@@ -5445,7 +5445,7 @@ import { jsx as jsx42, jsxs as jsxs31 } from "react/jsx-runtime";
5445
5445
  var RedisBrowser = ({ token, url }) => {
5446
5446
  const credentials = useMemo6(() => ({ token, url }), [token, url]);
5447
5447
  return /* @__PURE__ */ jsx42(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx42(TooltipProvider, { children: /* @__PURE__ */ jsx42(DatabrowserProvider, { redisCredentials: credentials, children: /* @__PURE__ */ jsxs31(KeysProvider, { children: [
5448
- /* @__PURE__ */ jsx42("div", { className: "ups-db h-full", children: /* @__PURE__ */ jsxs31(
5448
+ /* @__PURE__ */ jsx42("div", { className: "ups-db", style: { height: "100%" }, children: /* @__PURE__ */ jsxs31(
5449
5449
  PanelGroup,
5450
5450
  {
5451
5451
  autoSaveId: "persistence",
@@ -5453,7 +5453,7 @@ var RedisBrowser = ({ token, url }) => {
5453
5453
  className: "h-full w-full gap-0.5 text-sm antialiased",
5454
5454
  children: [
5455
5455
  /* @__PURE__ */ jsx42(Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ jsx42(Sidebar, {}) }),
5456
- /* @__PURE__ */ jsx42(PanelResizeHandle, { className: "h-full flex w-1.5 items-center justify-center rounded-full hover:bg-zinc-300/20", children: /* @__PURE__ */ jsx42(
5456
+ /* @__PURE__ */ jsx42(PanelResizeHandle, { className: "h-fullm flex w-1.5 items-center justify-center rounded-full hover:bg-zinc-300/20", children: /* @__PURE__ */ jsx42(
5457
5457
  IconDotsVertical2,
5458
5458
  {
5459
5459
  size: 16,
package/package.json CHANGED
@@ -1 +1 @@
1
- { "name": "@upstash/react-redis-browser", "version": "v0.1.2-canary", "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-3", "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" } }