@upstash/react-redis-browser 0.1.11-canary-2 → 0.1.11
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 +26 -138
- package/dist/index.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +252 -521
- package/dist/index.mjs +526 -795
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,97 +4,9 @@ var _react = require('react'); var React = _interopRequireWildcard(_react); var
|
|
|
4
4
|
// src/store.tsx
|
|
5
5
|
|
|
6
6
|
var _zustand = require('zustand');
|
|
7
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
8
|
-
var DatabrowserContext = _react.createContext.call(void 0, void 0);
|
|
9
|
-
var DatabrowserProvider = ({ children }) => {
|
|
10
|
-
const store = _react.useMemo.call(void 0, () => createDatabrowserStore(), []);
|
|
11
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserContext.Provider, { value: { store }, children });
|
|
12
|
-
};
|
|
13
|
-
var useDatabrowser = () => {
|
|
14
|
-
const context = _react.useContext.call(void 0, DatabrowserContext);
|
|
15
|
-
if (!context) {
|
|
16
|
-
throw new Error("useDatabrowser must be used within a DatabrowserProvider");
|
|
17
|
-
}
|
|
18
|
-
return context;
|
|
19
|
-
};
|
|
20
|
-
var useDatabrowserStore = () => {
|
|
21
|
-
const { store } = useDatabrowser();
|
|
22
|
-
return _zustand.useStore.call(void 0, store);
|
|
23
|
-
};
|
|
24
|
-
var createDatabrowserStore = () => _zustand.create.call(void 0, (set, get) => ({
|
|
25
|
-
selectedTab: void 0,
|
|
26
|
-
tabs: {},
|
|
27
|
-
addTab: () => {
|
|
28
|
-
const id = crypto.randomUUID();
|
|
29
|
-
const newTabData = {
|
|
30
|
-
selectedKey: void 0,
|
|
31
|
-
search: { key: "", type: void 0 }
|
|
32
|
-
};
|
|
33
|
-
set((old) => ({
|
|
34
|
-
tabs: { ...old.tabs, [id]: newTabData },
|
|
35
|
-
selectedTab: old.selectedTab === void 0 ? id : old.selectedTab
|
|
36
|
-
}));
|
|
37
|
-
},
|
|
38
|
-
removeTab: (id) => {
|
|
39
|
-
set((old) => {
|
|
40
|
-
const newTabs = { ...old.tabs };
|
|
41
|
-
delete newTabs[id];
|
|
42
|
-
let selectedTab = old.selectedTab;
|
|
43
|
-
if (selectedTab === id) {
|
|
44
|
-
const tabIds = Object.keys(newTabs);
|
|
45
|
-
selectedTab = tabIds.length > 0 ? tabIds[0] : void 0;
|
|
46
|
-
}
|
|
47
|
-
return { tabs: newTabs, selectedTab };
|
|
48
|
-
});
|
|
49
|
-
},
|
|
50
|
-
selectTab: (id) => {
|
|
51
|
-
set({ selectedTab: id });
|
|
52
|
-
},
|
|
53
|
-
getSelectedKey: (tabId) => {
|
|
54
|
-
return _optionalChain([get, 'call', _2 => _2(), 'access', _3 => _3.tabs, 'access', _4 => _4[tabId], 'optionalAccess', _5 => _5.selectedKey]);
|
|
55
|
-
},
|
|
56
|
-
setSelectedKey: (tabId, key) => {
|
|
57
|
-
set((old) => ({
|
|
58
|
-
...old,
|
|
59
|
-
tabs: {
|
|
60
|
-
...old.tabs,
|
|
61
|
-
[tabId]: { ...old.tabs[tabId], selectedKey: key, selectedListItem: void 0 }
|
|
62
|
-
}
|
|
63
|
-
}));
|
|
64
|
-
},
|
|
65
|
-
setSelectedListItem: (tabId, item) => {
|
|
66
|
-
set((old) => ({
|
|
67
|
-
...old,
|
|
68
|
-
tabs: { ...old.tabs, [tabId]: { ...old.tabs[tabId], selectedListItem: item } }
|
|
69
|
-
}));
|
|
70
|
-
},
|
|
71
|
-
setSearch: (tabId, search) => set((old) => ({ ...old, tabs: { ...old.tabs, [tabId]: { ...old.tabs[tabId], search } } })),
|
|
72
|
-
setSearchKey: (tabId, key) => set((old) => ({
|
|
73
|
-
...old,
|
|
74
|
-
tabs: {
|
|
75
|
-
...old.tabs,
|
|
76
|
-
[tabId]: { ...old.tabs[tabId], search: { ...old.tabs[tabId].search, key } }
|
|
77
|
-
}
|
|
78
|
-
})),
|
|
79
|
-
setSearchType: (tabId, type) => set((old) => ({
|
|
80
|
-
...old,
|
|
81
|
-
tabs: {
|
|
82
|
-
...old.tabs,
|
|
83
|
-
[tabId]: { ...old.tabs[tabId], search: { ...old.tabs[tabId].search, type } }
|
|
84
|
-
}
|
|
85
|
-
})),
|
|
86
|
-
searchHistory: [],
|
|
87
|
-
addSearchHistory: (key) => {
|
|
88
|
-
set((old) => ({ ...old, searchHistory: [key, ...old.searchHistory] }));
|
|
89
|
-
}
|
|
90
|
-
}));
|
|
91
|
-
|
|
92
|
-
// src/components/databrowser/index.tsx
|
|
93
|
-
var _reacttooltip = require('@radix-ui/react-tooltip'); var TooltipPrimitive = _interopRequireWildcard(_reacttooltip);
|
|
94
|
-
var _reactquery = require('@tanstack/react-query');
|
|
95
7
|
|
|
96
8
|
// src/lib/clients.ts
|
|
97
|
-
|
|
9
|
+
var _reactquery = require('@tanstack/react-query');
|
|
98
10
|
var _redis = require('@upstash/redis');
|
|
99
11
|
|
|
100
12
|
// src/components/ui/use-toast.ts
|
|
@@ -224,8 +136,8 @@ var redisClient = ({
|
|
|
224
136
|
credentials,
|
|
225
137
|
pipelining
|
|
226
138
|
}) => {
|
|
227
|
-
const token = _optionalChain([credentials, 'optionalAccess',
|
|
228
|
-
const url = _optionalChain([credentials, 'optionalAccess',
|
|
139
|
+
const token = _optionalChain([credentials, 'optionalAccess', _2 => _2.token]) || process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_TOKEN;
|
|
140
|
+
const url = _optionalChain([credentials, 'optionalAccess', _3 => _3.url]) || process.env.NEXT_PUBLIC_UPSTASH_REDIS_REST_URL;
|
|
229
141
|
if (!url) {
|
|
230
142
|
throw new Error("Redis URL is missing!");
|
|
231
143
|
}
|
|
@@ -268,53 +180,140 @@ var queryClient = new (0, _reactquery.QueryClient)({
|
|
|
268
180
|
})
|
|
269
181
|
});
|
|
270
182
|
|
|
271
|
-
// src/
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
var
|
|
275
|
-
var RedisProvider = ({
|
|
183
|
+
// src/store.tsx
|
|
184
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
185
|
+
var DatabrowserContext = _react.createContext.call(void 0, void 0);
|
|
186
|
+
var DatabrowserProvider = ({
|
|
276
187
|
children,
|
|
277
188
|
redisCredentials
|
|
278
189
|
}) => {
|
|
279
|
-
const redisInstance = _react.useMemo.call(void 0,
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
[redisCredentials]
|
|
286
|
-
);
|
|
287
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
288
|
-
RedisContext.Provider,
|
|
289
|
-
{
|
|
290
|
-
value: { redis: redisInstance, redisNoPipeline: redisInstanceNoPipeline },
|
|
291
|
-
children
|
|
292
|
-
}
|
|
293
|
-
);
|
|
190
|
+
const redisInstance = _react.useMemo.call(void 0, () => redisClient({ credentials: redisCredentials, pipelining: true }), [redisCredentials]);
|
|
191
|
+
const redisInstanceNoPipeline = _react.useMemo.call(void 0, () => redisClient({ credentials: redisCredentials, pipelining: false }), [redisCredentials]);
|
|
192
|
+
const [store] = _react.useState.call(void 0, () => {
|
|
193
|
+
return createDatabrowserStore();
|
|
194
|
+
});
|
|
195
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserContext.Provider, { value: { redis: redisInstance, redisNoPipeline: redisInstanceNoPipeline, store }, children });
|
|
294
196
|
};
|
|
295
|
-
var
|
|
296
|
-
const context = _react.useContext.call(void 0,
|
|
197
|
+
var useDatabrowser = () => {
|
|
198
|
+
const context = _react.useContext.call(void 0, DatabrowserContext);
|
|
297
199
|
if (!context) {
|
|
298
|
-
throw new Error("
|
|
200
|
+
throw new Error("useDatabrowser must be used within a DatabrowserProvider");
|
|
299
201
|
}
|
|
300
202
|
return context;
|
|
301
203
|
};
|
|
204
|
+
var useDatabrowserStore = () => {
|
|
205
|
+
const { store } = useDatabrowser();
|
|
206
|
+
return _zustand.useStore.call(void 0, store);
|
|
207
|
+
};
|
|
208
|
+
var createDatabrowserStore = () => _zustand.create.call(void 0, (set) => ({
|
|
209
|
+
selectedKey: void 0,
|
|
210
|
+
setSelectedKey: (key) => {
|
|
211
|
+
set((old) => ({ ...old, selectedKey: key, selectedListItem: void 0 }));
|
|
212
|
+
},
|
|
213
|
+
selectedListItem: void 0,
|
|
214
|
+
setSelectedListItem: (item) => {
|
|
215
|
+
set((old) => ({ ...old, selectedListItem: item }));
|
|
216
|
+
},
|
|
217
|
+
search: { key: "", type: void 0 },
|
|
218
|
+
setSearch: (search) => set({ search }),
|
|
219
|
+
setSearchKey: (key) => set((state) => ({ search: { ...state.search, key } })),
|
|
220
|
+
setSearchType: (type) => set((state) => ({ search: { ...state.search, type } }))
|
|
221
|
+
}));
|
|
222
|
+
|
|
223
|
+
// src/components/databrowser/index.tsx
|
|
224
|
+
var _reacttooltip = require('@radix-ui/react-tooltip'); var TooltipPrimitive = _interopRequireWildcard(_reacttooltip);
|
|
225
|
+
var _iconsreact = require('@tabler/icons-react');
|
|
302
226
|
|
|
303
|
-
// src/components/databrowser/components/databrowser-instance.tsx
|
|
304
227
|
var _reactresizablepanels = require('react-resizable-panels');
|
|
305
228
|
|
|
306
|
-
//
|
|
229
|
+
// src/components/ui/toaster.tsx
|
|
230
|
+
var _reactportal = require('@radix-ui/react-portal');
|
|
231
|
+
|
|
232
|
+
// src/lib/portal-root.ts
|
|
233
|
+
var root;
|
|
234
|
+
if (typeof document !== "undefined") {
|
|
235
|
+
const id = "react-redis-browser-portal-root";
|
|
236
|
+
root = _nullishCoalesce(document.querySelector(`#${id}`), () => ( document.createElement("div")));
|
|
237
|
+
root.classList.add("ups-db");
|
|
238
|
+
root.id = "react-redis-browser-portal-root";
|
|
239
|
+
document.body.append(root);
|
|
240
|
+
}
|
|
241
|
+
var portalRoot = root;
|
|
242
|
+
|
|
243
|
+
// src/components/ui/toast.tsx
|
|
244
|
+
|
|
245
|
+
var _reacticons = require('@radix-ui/react-icons');
|
|
246
|
+
var _reacttoast = require('@radix-ui/react-toast'); var ToastPrimitives = _interopRequireWildcard(_reacttoast);
|
|
247
|
+
|
|
248
|
+
// node_modules/class-variance-authority/node_modules/clsx/dist/clsx.mjs
|
|
307
249
|
function r(e) {
|
|
250
|
+
var t, f, n = "";
|
|
251
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
252
|
+
else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
253
|
+
else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
254
|
+
return n;
|
|
255
|
+
}
|
|
256
|
+
function clsx() {
|
|
257
|
+
for (var e, t, f = 0, n = ""; f < arguments.length; ) (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
258
|
+
return n;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// node_modules/class-variance-authority/dist/index.mjs
|
|
262
|
+
var falsyToString = (value) => typeof value === "boolean" ? "".concat(value) : value === 0 ? "0" : value;
|
|
263
|
+
var cx = clsx;
|
|
264
|
+
var cva = (base, config) => {
|
|
265
|
+
return (props) => {
|
|
266
|
+
var ref;
|
|
267
|
+
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
268
|
+
const { variants, defaultVariants } = config;
|
|
269
|
+
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
270
|
+
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
271
|
+
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
272
|
+
if (variantProp === null) return null;
|
|
273
|
+
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
274
|
+
return variants[variant][variantKey];
|
|
275
|
+
});
|
|
276
|
+
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
277
|
+
let [key, value] = param;
|
|
278
|
+
if (value === void 0) {
|
|
279
|
+
return acc;
|
|
280
|
+
}
|
|
281
|
+
acc[key] = value;
|
|
282
|
+
return acc;
|
|
283
|
+
}, {});
|
|
284
|
+
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (ref = config.compoundVariants) === null || ref === void 0 ? void 0 : ref.reduce((acc, param1) => {
|
|
285
|
+
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param1;
|
|
286
|
+
return Object.entries(compoundVariantOptions).every((param) => {
|
|
287
|
+
let [key, value] = param;
|
|
288
|
+
return Array.isArray(value) ? value.includes({
|
|
289
|
+
...defaultVariants,
|
|
290
|
+
...propsWithoutUndefined
|
|
291
|
+
}[key]) : {
|
|
292
|
+
...defaultVariants,
|
|
293
|
+
...propsWithoutUndefined
|
|
294
|
+
}[key] === value;
|
|
295
|
+
}) ? [
|
|
296
|
+
...acc,
|
|
297
|
+
cvClass,
|
|
298
|
+
cvClassName
|
|
299
|
+
] : acc;
|
|
300
|
+
}, []);
|
|
301
|
+
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
// node_modules/clsx/dist/clsx.mjs
|
|
306
|
+
function r2(e) {
|
|
308
307
|
var t, f, n = "";
|
|
309
308
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
310
309
|
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
311
310
|
var o = e.length;
|
|
312
|
-
for (t = 0; t < o; t++) e[t] && (f =
|
|
311
|
+
for (t = 0; t < o; t++) e[t] && (f = r2(e[t])) && (n && (n += " "), n += f);
|
|
313
312
|
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
314
313
|
return n;
|
|
315
314
|
}
|
|
316
|
-
function
|
|
317
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t =
|
|
315
|
+
function clsx2() {
|
|
316
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r2(e)) && (n && (n += " "), n += t);
|
|
318
317
|
return n;
|
|
319
318
|
}
|
|
320
319
|
|
|
@@ -359,15 +358,15 @@ var getGroupRecursive = (classParts, classPartObject) => {
|
|
|
359
358
|
return void 0;
|
|
360
359
|
}
|
|
361
360
|
const classRest = classParts.join(CLASS_PART_SEPARATOR);
|
|
362
|
-
return _optionalChain([classPartObject, 'access',
|
|
361
|
+
return _optionalChain([classPartObject, 'access', _4 => _4.validators, 'access', _5 => _5.find, 'call', _6 => _6(({
|
|
363
362
|
validator
|
|
364
|
-
}) => validator(classRest)), 'optionalAccess',
|
|
363
|
+
}) => validator(classRest)), 'optionalAccess', _7 => _7.classGroupId]);
|
|
365
364
|
};
|
|
366
365
|
var arbitraryPropertyRegex = /^\[(.+)\]$/;
|
|
367
366
|
var getGroupIdForArbitraryProperty = (className) => {
|
|
368
367
|
if (arbitraryPropertyRegex.test(className)) {
|
|
369
368
|
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
|
|
370
|
-
const property = _optionalChain([arbitraryPropertyClassName, 'optionalAccess',
|
|
369
|
+
const property = _optionalChain([arbitraryPropertyClassName, 'optionalAccess', _8 => _8.substring, 'call', _9 => _9(0, arbitraryPropertyClassName.indexOf(":"))]);
|
|
371
370
|
if (property) {
|
|
372
371
|
return "arbitrary.." + property;
|
|
373
372
|
}
|
|
@@ -2780,7 +2779,7 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
|
2780
2779
|
|
|
2781
2780
|
// src/lib/utils.ts
|
|
2782
2781
|
function cn(...inputs) {
|
|
2783
|
-
return twMerge(
|
|
2782
|
+
return twMerge(clsx2(inputs));
|
|
2784
2783
|
}
|
|
2785
2784
|
function formatNumber(value) {
|
|
2786
2785
|
const intl = new Intl.NumberFormat("en-US");
|
|
@@ -2812,82 +2811,6 @@ function formatTime(seconds) {
|
|
|
2812
2811
|
return parts.slice(0, 1).join(" ");
|
|
2813
2812
|
}
|
|
2814
2813
|
|
|
2815
|
-
// src/components/ui/toaster.tsx
|
|
2816
|
-
var _reactportal = require('@radix-ui/react-portal');
|
|
2817
|
-
|
|
2818
|
-
// src/lib/portal-root.ts
|
|
2819
|
-
var root;
|
|
2820
|
-
if (typeof document !== "undefined") {
|
|
2821
|
-
const id = "react-redis-browser-portal-root";
|
|
2822
|
-
root = _nullishCoalesce(document.querySelector(`#${id}`), () => ( document.createElement("div")));
|
|
2823
|
-
root.classList.add("ups-db");
|
|
2824
|
-
root.id = "react-redis-browser-portal-root";
|
|
2825
|
-
document.body.append(root);
|
|
2826
|
-
}
|
|
2827
|
-
var portalRoot = root;
|
|
2828
|
-
|
|
2829
|
-
// src/components/ui/toast.tsx
|
|
2830
|
-
|
|
2831
|
-
var _reacticons = require('@radix-ui/react-icons');
|
|
2832
|
-
var _reacttoast = require('@radix-ui/react-toast'); var ToastPrimitives = _interopRequireWildcard(_reacttoast);
|
|
2833
|
-
|
|
2834
|
-
// node_modules/class-variance-authority/node_modules/clsx/dist/clsx.mjs
|
|
2835
|
-
function r2(e) {
|
|
2836
|
-
var t, f, n = "";
|
|
2837
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
2838
|
-
else if ("object" == typeof e) if (Array.isArray(e)) for (t = 0; t < e.length; t++) e[t] && (f = r2(e[t])) && (n && (n += " "), n += f);
|
|
2839
|
-
else for (t in e) e[t] && (n && (n += " "), n += t);
|
|
2840
|
-
return n;
|
|
2841
|
-
}
|
|
2842
|
-
function clsx2() {
|
|
2843
|
-
for (var e, t, f = 0, n = ""; f < arguments.length; ) (e = arguments[f++]) && (t = r2(e)) && (n && (n += " "), n += t);
|
|
2844
|
-
return n;
|
|
2845
|
-
}
|
|
2846
|
-
|
|
2847
|
-
// node_modules/class-variance-authority/dist/index.mjs
|
|
2848
|
-
var falsyToString = (value) => typeof value === "boolean" ? "".concat(value) : value === 0 ? "0" : value;
|
|
2849
|
-
var cx = clsx2;
|
|
2850
|
-
var cva = (base, config) => {
|
|
2851
|
-
return (props) => {
|
|
2852
|
-
var ref;
|
|
2853
|
-
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2854
|
-
const { variants, defaultVariants } = config;
|
|
2855
|
-
const getVariantClassNames = Object.keys(variants).map((variant) => {
|
|
2856
|
-
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
2857
|
-
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
2858
|
-
if (variantProp === null) return null;
|
|
2859
|
-
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
2860
|
-
return variants[variant][variantKey];
|
|
2861
|
-
});
|
|
2862
|
-
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param) => {
|
|
2863
|
-
let [key, value] = param;
|
|
2864
|
-
if (value === void 0) {
|
|
2865
|
-
return acc;
|
|
2866
|
-
}
|
|
2867
|
-
acc[key] = value;
|
|
2868
|
-
return acc;
|
|
2869
|
-
}, {});
|
|
2870
|
-
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (ref = config.compoundVariants) === null || ref === void 0 ? void 0 : ref.reduce((acc, param1) => {
|
|
2871
|
-
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param1;
|
|
2872
|
-
return Object.entries(compoundVariantOptions).every((param) => {
|
|
2873
|
-
let [key, value] = param;
|
|
2874
|
-
return Array.isArray(value) ? value.includes({
|
|
2875
|
-
...defaultVariants,
|
|
2876
|
-
...propsWithoutUndefined
|
|
2877
|
-
}[key]) : {
|
|
2878
|
-
...defaultVariants,
|
|
2879
|
-
...propsWithoutUndefined
|
|
2880
|
-
}[key] === value;
|
|
2881
|
-
}) ? [
|
|
2882
|
-
...acc,
|
|
2883
|
-
cvClass,
|
|
2884
|
-
cvClassName
|
|
2885
|
-
] : acc;
|
|
2886
|
-
}, []);
|
|
2887
|
-
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
2888
|
-
};
|
|
2889
|
-
};
|
|
2890
|
-
|
|
2891
2814
|
// src/components/ui/toast.tsx
|
|
2892
2815
|
|
|
2893
2816
|
var ToastProvider = ToastPrimitives.Provider;
|
|
@@ -2994,61 +2917,12 @@ function Toaster() {
|
|
|
2994
2917
|
|
|
2995
2918
|
|
|
2996
2919
|
|
|
2997
|
-
// src/tab-provider.tsx
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
var TabIdContext = _react.createContext.call(void 0, void 0);
|
|
3001
|
-
var TabIdProvider = ({ children, value }) => {
|
|
3002
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TabIdContext.Provider, { value, children });
|
|
3003
|
-
};
|
|
3004
|
-
var useTab = () => {
|
|
3005
|
-
const {
|
|
3006
|
-
selectedTab,
|
|
3007
|
-
tabs,
|
|
3008
|
-
setSelectedKey,
|
|
3009
|
-
setSelectedListItem,
|
|
3010
|
-
setSearch,
|
|
3011
|
-
setSearchKey,
|
|
3012
|
-
setSearchType
|
|
3013
|
-
} = useDatabrowserStore();
|
|
3014
|
-
if (!selectedTab) throw new Error("selectedTab is undefined when using useTab()");
|
|
3015
|
-
return _react.useMemo.call(void 0,
|
|
3016
|
-
() => ({
|
|
3017
|
-
selectedKey: _optionalChain([tabs, 'access', _14 => _14[selectedTab], 'optionalAccess', _15 => _15.selectedKey]),
|
|
3018
|
-
selectedListItem: _optionalChain([tabs, 'access', _16 => _16[selectedTab], 'optionalAccess', _17 => _17.selectedListItem]),
|
|
3019
|
-
search: _optionalChain([tabs, 'access', _18 => _18[selectedTab], 'optionalAccess', _19 => _19.search]),
|
|
3020
|
-
setSelectedKey: (key) => setSelectedKey(selectedTab, key),
|
|
3021
|
-
setSelectedListItem: (item) => setSelectedListItem(selectedTab, item),
|
|
3022
|
-
setSearch: (search) => setSearch(selectedTab, search),
|
|
3023
|
-
setSearchKey: (key) => setSearchKey(selectedTab, key),
|
|
3024
|
-
setSearchType: (type) => setSearchType(selectedTab, type)
|
|
3025
|
-
}),
|
|
3026
|
-
[selectedTab, tabs]
|
|
3027
|
-
);
|
|
3028
|
-
};
|
|
3029
|
-
|
|
3030
|
-
// src/components/databrowser/hooks/use-fetch-key-type.ts
|
|
3031
|
-
|
|
3032
|
-
var FETCH_KEY_TYPE_QUERY_KEY = "fetch-key-type";
|
|
3033
|
-
var useFetchKeyType = (key) => {
|
|
3034
|
-
const { redis } = useRedis();
|
|
3035
|
-
return _reactquery.useQuery.call(void 0, {
|
|
3036
|
-
queryKey: [FETCH_KEY_TYPE_QUERY_KEY, key],
|
|
3037
|
-
queryFn: async () => {
|
|
3038
|
-
if (!key) return "none";
|
|
3039
|
-
return await redis.type(key);
|
|
3040
|
-
}
|
|
3041
|
-
});
|
|
3042
|
-
};
|
|
3043
|
-
|
|
3044
|
-
// src/components/databrowser/hooks/use-keys.tsx
|
|
3045
|
-
|
|
3046
2920
|
var KeysContext = _react.createContext.call(void 0, void 0);
|
|
3047
2921
|
var FETCH_KEYS_QUERY_KEY = "use-fetch-keys";
|
|
3048
2922
|
var SCAN_COUNT = 100;
|
|
3049
2923
|
var KeysProvider = ({ children }) => {
|
|
3050
|
-
const { search } =
|
|
3051
|
-
const { redisNoPipeline: redis } =
|
|
2924
|
+
const { search } = useDatabrowserStore();
|
|
2925
|
+
const { redisNoPipeline: redis } = useDatabrowser();
|
|
3052
2926
|
const query = _reactquery.useInfiniteQuery.call(void 0, {
|
|
3053
2927
|
queryKey: [FETCH_KEYS_QUERY_KEY, search],
|
|
3054
2928
|
initialPageParam: "0",
|
|
@@ -3076,9 +2950,6 @@ var KeysProvider = ({ children }) => {
|
|
|
3076
2950
|
index += 2;
|
|
3077
2951
|
}
|
|
3078
2952
|
}
|
|
3079
|
-
for (const [key, type] of keys2) {
|
|
3080
|
-
queryClient.setQueryData([FETCH_KEY_TYPE_QUERY_KEY, key], type);
|
|
3081
|
-
}
|
|
3082
2953
|
return {
|
|
3083
2954
|
cursor: cursor === "0" ? void 0 : cursor,
|
|
3084
2955
|
keys: keys2,
|
|
@@ -3090,7 +2961,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3090
2961
|
refetchOnMount: false
|
|
3091
2962
|
});
|
|
3092
2963
|
const keys = _react.useMemo.call(void 0, () => {
|
|
3093
|
-
const keys2 = _nullishCoalesce(_optionalChain([query, 'access',
|
|
2964
|
+
const keys2 = _nullishCoalesce(_optionalChain([query, 'access', _10 => _10.data, 'optionalAccess', _11 => _11.pages, 'access', _12 => _12.flatMap, 'call', _13 => _13((page) => page.keys)]), () => ( []));
|
|
3094
2965
|
const keysSet = /* @__PURE__ */ new Set();
|
|
3095
2966
|
const dedupedKeys = [];
|
|
3096
2967
|
for (const key of keys2) {
|
|
@@ -3121,19 +2992,19 @@ var useKeys = () => {
|
|
|
3121
2992
|
var useKeyType = (key) => {
|
|
3122
2993
|
const { keys } = useKeys();
|
|
3123
2994
|
const keyTuple = _react.useMemo.call(void 0, () => keys.find(([k, _]) => k === key), [keys, key]);
|
|
3124
|
-
return _optionalChain([keyTuple, 'optionalAccess',
|
|
2995
|
+
return _optionalChain([keyTuple, 'optionalAccess', _14 => _14[1]]);
|
|
3125
2996
|
};
|
|
3126
2997
|
|
|
3127
2998
|
// src/components/databrowser/components/display/display-list.tsx
|
|
3128
2999
|
|
|
3129
|
-
|
|
3000
|
+
|
|
3130
3001
|
|
|
3131
3002
|
// src/components/ui/button.tsx
|
|
3132
3003
|
|
|
3133
3004
|
var _reactslot = require('@radix-ui/react-slot');
|
|
3134
3005
|
|
|
3135
3006
|
var buttonVariants = cva(
|
|
3136
|
-
"inline-flex items-center justify-center rounded-md text-sm ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-
|
|
3007
|
+
"inline-flex items-center justify-center rounded-md text-sm ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 dark:ring-offset-zinc-950 dark:focus-visible:ring-zinc-300",
|
|
3137
3008
|
{
|
|
3138
3009
|
variants: {
|
|
3139
3010
|
variant: {
|
|
@@ -3190,7 +3061,7 @@ function Skeleton({ className, ...props }) {
|
|
|
3190
3061
|
|
|
3191
3062
|
var FETCH_DB_SIZE_QUERY_KEY = "fetch-db-size";
|
|
3192
3063
|
var DisplayDbSize = () => {
|
|
3193
|
-
const { redis } =
|
|
3064
|
+
const { redis } = useDatabrowser();
|
|
3194
3065
|
const { data: keyCount } = _reactquery.useQuery.call(void 0, {
|
|
3195
3066
|
queryKey: [FETCH_DB_SIZE_QUERY_KEY],
|
|
3196
3067
|
queryFn: async () => {
|
|
@@ -3208,7 +3079,7 @@ var DisplayDbSize = () => {
|
|
|
3208
3079
|
|
|
3209
3080
|
// src/components/databrowser/hooks/use-add-key.ts
|
|
3210
3081
|
var useAddKey = () => {
|
|
3211
|
-
const { redis } =
|
|
3082
|
+
const { redis } = useDatabrowser();
|
|
3212
3083
|
const mutation = _reactquery.useMutation.call(void 0, {
|
|
3213
3084
|
mutationFn: async ({ key, type }) => {
|
|
3214
3085
|
if (await redis.exists(key)) throw new Error(`Key "${key}" already exists`);
|
|
@@ -3288,12 +3159,16 @@ var useAddKey = () => {
|
|
|
3288
3159
|
// src/components/databrowser/hooks/use-delete-key-cache.ts
|
|
3289
3160
|
|
|
3290
3161
|
|
|
3162
|
+
// src/components/databrowser/hooks/use-fetch-key-type.tsx
|
|
3163
|
+
|
|
3164
|
+
var FETCH_KEY_TYPE_QUERY_KEY = "fetch-key-type";
|
|
3165
|
+
|
|
3291
3166
|
// src/components/databrowser/hooks/use-fetch-list-items.tsx
|
|
3292
3167
|
|
|
3293
3168
|
var LIST_DISPLAY_PAGE_SIZE = 50;
|
|
3294
3169
|
var FETCH_LIST_ITEMS_QUERY_KEY = "use-fetch-list-items";
|
|
3295
3170
|
var useFetchListItems = ({ dataKey, type }) => {
|
|
3296
|
-
const { redisNoPipeline: redis } =
|
|
3171
|
+
const { redisNoPipeline: redis } = useDatabrowser();
|
|
3297
3172
|
const setQuery = _reactquery.useInfiniteQuery.call(void 0, {
|
|
3298
3173
|
enabled: type === "set",
|
|
3299
3174
|
queryKey: [FETCH_LIST_ITEMS_QUERY_KEY, dataKey, "set"],
|
|
@@ -3372,7 +3247,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
3372
3247
|
// +1 since first message is the last one
|
|
3373
3248
|
LIST_DISPLAY_PAGE_SIZE + 1
|
|
3374
3249
|
);
|
|
3375
|
-
const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access',
|
|
3250
|
+
const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access', _15 => _15.at, 'call', _16 => _16(-1), 'optionalAccess', _17 => _17[0]]) : void 0;
|
|
3376
3251
|
return {
|
|
3377
3252
|
cursor: messages.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastMessageId,
|
|
3378
3253
|
keys: messages.map(([id, fields]) => ({
|
|
@@ -3408,7 +3283,7 @@ function transformArray(inputArray) {
|
|
|
3408
3283
|
|
|
3409
3284
|
var FETCH_SIMPLE_KEY_QUERY_KEY = "fetch-simple-key";
|
|
3410
3285
|
var useFetchSimpleKey = (dataKey, type) => {
|
|
3411
|
-
const { redisNoPipeline: redis } =
|
|
3286
|
+
const { redisNoPipeline: redis } = useDatabrowser();
|
|
3412
3287
|
const { deleteKeyCache } = useDeleteKeyCache();
|
|
3413
3288
|
return _reactquery.useQuery.call(void 0, {
|
|
3414
3289
|
queryKey: [FETCH_SIMPLE_KEY_QUERY_KEY, dataKey],
|
|
@@ -3435,7 +3310,7 @@ var sortObject = (obj) => {
|
|
|
3435
3310
|
|
|
3436
3311
|
// src/components/databrowser/hooks/use-delete-key-cache.ts
|
|
3437
3312
|
var useDeleteKeyCache = () => {
|
|
3438
|
-
const { setSelectedKey } =
|
|
3313
|
+
const { setSelectedKey } = useDatabrowserStore();
|
|
3439
3314
|
const deleteKeyCache = _react.useCallback.call(void 0,
|
|
3440
3315
|
(key) => {
|
|
3441
3316
|
setSelectedKey(void 0);
|
|
@@ -3459,7 +3334,7 @@ var useDeleteKeyCache = () => {
|
|
|
3459
3334
|
|
|
3460
3335
|
// src/components/databrowser/hooks/use-delete-key.ts
|
|
3461
3336
|
var useDeleteKey = () => {
|
|
3462
|
-
const { redis } =
|
|
3337
|
+
const { redis } = useDatabrowser();
|
|
3463
3338
|
const { deleteKeyCache } = useDeleteKeyCache();
|
|
3464
3339
|
const deleteKey = _reactquery.useMutation.call(void 0, {
|
|
3465
3340
|
mutationFn: async (key) => {
|
|
@@ -3478,7 +3353,7 @@ var useDeleteKey = () => {
|
|
|
3478
3353
|
// src/components/databrowser/hooks/use-edit-list-item.tsx
|
|
3479
3354
|
|
|
3480
3355
|
var useEditListItem = () => {
|
|
3481
|
-
const { redis } =
|
|
3356
|
+
const { redis } = useDatabrowser();
|
|
3482
3357
|
return _reactquery.useMutation.call(void 0, {
|
|
3483
3358
|
mutationFn: async ({
|
|
3484
3359
|
type,
|
|
@@ -3536,7 +3411,7 @@ var useEditListItem = () => {
|
|
|
3536
3411
|
}
|
|
3537
3412
|
case "stream": {
|
|
3538
3413
|
if (!isNew || !newKey) throw new Error("Stream data type is not mutable");
|
|
3539
|
-
const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess',
|
|
3414
|
+
const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess', _18 => _18.split, 'call', _19 => _19("\n")]), () => ( []))).map(
|
|
3540
3415
|
({ key, value }) => [key, value]
|
|
3541
3416
|
);
|
|
3542
3417
|
pipe.xadd(dataKey, newKey, Object.fromEntries(opts));
|
|
@@ -3571,7 +3446,7 @@ var _bytes = require('bytes'); var _bytes2 = _interopRequireDefault(_bytes);
|
|
|
3571
3446
|
|
|
3572
3447
|
var FETCH_KEY_LENGTH_QUERY_KEY = "fetch-key-length";
|
|
3573
3448
|
var useFetchKeyLength = ({ dataKey, type }) => {
|
|
3574
|
-
const { redis } =
|
|
3449
|
+
const { redis } = useDatabrowser();
|
|
3575
3450
|
return _reactquery.useQuery.call(void 0, {
|
|
3576
3451
|
queryKey: [FETCH_KEY_LENGTH_QUERY_KEY, dataKey],
|
|
3577
3452
|
queryFn: async () => {
|
|
@@ -3601,7 +3476,7 @@ var useFetchKeyLength = ({ dataKey, type }) => {
|
|
|
3601
3476
|
|
|
3602
3477
|
var FETCH_KEY_SIZE_QUERY_KEY = "fetch-key-size";
|
|
3603
3478
|
var useFetchKeySize = (dataKey) => {
|
|
3604
|
-
const { redis } =
|
|
3479
|
+
const { redis } = useDatabrowser();
|
|
3605
3480
|
return _reactquery.useQuery.call(void 0, {
|
|
3606
3481
|
queryKey: [FETCH_KEY_SIZE_QUERY_KEY, dataKey],
|
|
3607
3482
|
queryFn: async () => {
|
|
@@ -3618,7 +3493,7 @@ var LengthBadge = ({
|
|
|
3618
3493
|
content
|
|
3619
3494
|
}) => {
|
|
3620
3495
|
const { data, isLoading } = useFetchKeyLength({ dataKey, type });
|
|
3621
|
-
const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess',
|
|
3496
|
+
const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess', _20 => _20.length]), () => ( data));
|
|
3622
3497
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Badge, { label: "Length:", children: isLoading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "ml-1 h-3 w-10 rounded-md opacity-50" }) : length });
|
|
3623
3498
|
};
|
|
3624
3499
|
var SizeBadge = ({ dataKey }) => {
|
|
@@ -3628,7 +3503,7 @@ var SizeBadge = ({ dataKey }) => {
|
|
|
3628
3503
|
}) });
|
|
3629
3504
|
};
|
|
3630
3505
|
var HeaderTTLBadge = ({ dataKey }) => {
|
|
3631
|
-
const { data: expireAt } =
|
|
3506
|
+
const { data: expireAt } = useFetchKeyExpire(dataKey);
|
|
3632
3507
|
const { mutate: setTTL, isPending } = useSetTTL();
|
|
3633
3508
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
3634
3509
|
TTLBadge,
|
|
@@ -3978,8 +3853,8 @@ var TTLBadge = ({
|
|
|
3978
3853
|
|
|
3979
3854
|
// src/components/databrowser/hooks/use-fetch-ttl.ts
|
|
3980
3855
|
var FETCH_TTL_QUERY_KEY = "fetch-ttl";
|
|
3981
|
-
var
|
|
3982
|
-
const { redis } =
|
|
3856
|
+
var useFetchKeyExpire = (dataKey) => {
|
|
3857
|
+
const { redis } = useDatabrowser();
|
|
3983
3858
|
const { isLoading, error, data } = _reactquery.useQuery.call(void 0, {
|
|
3984
3859
|
queryKey: [FETCH_TTL_QUERY_KEY, dataKey],
|
|
3985
3860
|
queryFn: async () => {
|
|
@@ -4000,7 +3875,7 @@ var useFetchTTL = (dataKey) => {
|
|
|
4000
3875
|
// src/components/databrowser/hooks/use-set-simple-key.tsx
|
|
4001
3876
|
|
|
4002
3877
|
var useSetSimpleKey = (dataKey, type) => {
|
|
4003
|
-
const { redis } =
|
|
3878
|
+
const { redis } = useDatabrowser();
|
|
4004
3879
|
return _reactquery.useMutation.call(void 0, {
|
|
4005
3880
|
mutationFn: async (value) => {
|
|
4006
3881
|
if (type === "string") {
|
|
@@ -4023,7 +3898,7 @@ var useSetSimpleKey = (dataKey, type) => {
|
|
|
4023
3898
|
// src/components/databrowser/hooks/use-set-ttl.ts
|
|
4024
3899
|
|
|
4025
3900
|
var useSetTTL = () => {
|
|
4026
|
-
const { redis } =
|
|
3901
|
+
const { redis } = useDatabrowser();
|
|
4027
3902
|
const updateTTL = _reactquery.useMutation.call(void 0, {
|
|
4028
3903
|
mutationFn: async ({ dataKey, ttl }) => {
|
|
4029
3904
|
await (ttl === void 0 || ttl === TTL_INFINITE ? redis.persist(dataKey) : redis.expire(dataKey, ttl));
|
|
@@ -4309,7 +4184,7 @@ var ItemContextMenu = ({
|
|
|
4309
4184
|
editItem({
|
|
4310
4185
|
type,
|
|
4311
4186
|
dataKey,
|
|
4312
|
-
itemKey: _optionalChain([data, 'optionalAccess',
|
|
4187
|
+
itemKey: _optionalChain([data, 'optionalAccess', _21 => _21.key]),
|
|
4313
4188
|
// For deletion
|
|
4314
4189
|
newKey: void 0
|
|
4315
4190
|
});
|
|
@@ -4344,7 +4219,7 @@ var ItemContextMenu = ({
|
|
|
4344
4219
|
{
|
|
4345
4220
|
onClick: () => {
|
|
4346
4221
|
if (!data) return;
|
|
4347
|
-
navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess',
|
|
4222
|
+
navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess', _22 => _22.key]));
|
|
4348
4223
|
toast({
|
|
4349
4224
|
description: "Key copied to clipboard"
|
|
4350
4225
|
});
|
|
@@ -4352,11 +4227,11 @@ var ItemContextMenu = ({
|
|
|
4352
4227
|
children: "Copy key"
|
|
4353
4228
|
}
|
|
4354
4229
|
),
|
|
4355
|
-
_optionalChain([data, 'optionalAccess',
|
|
4230
|
+
_optionalChain([data, 'optionalAccess', _23 => _23.value]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4356
4231
|
ContextMenuItem,
|
|
4357
4232
|
{
|
|
4358
4233
|
onClick: () => {
|
|
4359
|
-
navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
4234
|
+
navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _24 => _24.value]), () => ( "")));
|
|
4360
4235
|
toast({
|
|
4361
4236
|
description: "Value copied to clipboard"
|
|
4362
4237
|
});
|
|
@@ -4374,11 +4249,12 @@ var ItemContextMenu = ({
|
|
|
4374
4249
|
// src/components/databrowser/components/sidebar/infinite-scroll.tsx
|
|
4375
4250
|
|
|
4376
4251
|
|
|
4252
|
+
|
|
4377
4253
|
// src/components/ui/scroll-area.tsx
|
|
4378
4254
|
|
|
4379
4255
|
var _reactscrollarea = require('@radix-ui/react-scroll-area'); var ScrollAreaPrimitive = _interopRequireWildcard(_reactscrollarea);
|
|
4380
4256
|
|
|
4381
|
-
var ScrollArea = React9.forwardRef(({ className, children, onScroll,
|
|
4257
|
+
var ScrollArea = React9.forwardRef(({ className, children, onScroll, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4382
4258
|
ScrollAreaPrimitive.Root,
|
|
4383
4259
|
{
|
|
4384
4260
|
ref,
|
|
@@ -4389,7 +4265,7 @@ var ScrollArea = React9.forwardRef(({ className, children, onScroll, disableRoun
|
|
|
4389
4265
|
ScrollAreaPrimitive.Viewport,
|
|
4390
4266
|
{
|
|
4391
4267
|
onScroll,
|
|
4392
|
-
className:
|
|
4268
|
+
className: "h-full w-full rounded-[inherit] [&>div]:!block",
|
|
4393
4269
|
children
|
|
4394
4270
|
}
|
|
4395
4271
|
),
|
|
@@ -4420,9 +4296,10 @@ ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
|
4420
4296
|
|
|
4421
4297
|
var InfiniteScroll = ({
|
|
4422
4298
|
query,
|
|
4423
|
-
children
|
|
4424
|
-
...props
|
|
4299
|
+
children
|
|
4425
4300
|
}) => {
|
|
4301
|
+
const scrollRef = _react.useRef.call(void 0, null);
|
|
4302
|
+
const contentRef = _react.useRef.call(void 0, null);
|
|
4426
4303
|
const handleScroll = (e) => {
|
|
4427
4304
|
const { scrollTop, clientHeight, scrollHeight } = e.currentTarget;
|
|
4428
4305
|
if (scrollTop + clientHeight > scrollHeight - 100) {
|
|
@@ -4432,20 +4309,30 @@ var InfiniteScroll = ({
|
|
|
4432
4309
|
query.fetchNextPage();
|
|
4433
4310
|
}
|
|
4434
4311
|
};
|
|
4435
|
-
|
|
4312
|
+
const checkAndFetchMore = () => {
|
|
4313
|
+
if (!scrollRef.current || !contentRef.current) return;
|
|
4314
|
+
const viewportHeight = scrollRef.current.clientHeight;
|
|
4315
|
+
const contentHeight = contentRef.current.clientHeight;
|
|
4316
|
+
const overflowThreshold = viewportHeight + 100;
|
|
4317
|
+
if (contentHeight < overflowThreshold && query.hasNextPage && !query.isFetching) {
|
|
4318
|
+
query.fetchNextPage();
|
|
4319
|
+
}
|
|
4320
|
+
};
|
|
4321
|
+
_react.useEffect.call(void 0, () => {
|
|
4322
|
+
const timer = setTimeout(checkAndFetchMore, 100);
|
|
4323
|
+
return () => clearTimeout(timer);
|
|
4324
|
+
}, [query.data]);
|
|
4325
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4436
4326
|
ScrollArea,
|
|
4437
4327
|
{
|
|
4438
4328
|
type: "always",
|
|
4329
|
+
className: "block h-full w-full transition-all",
|
|
4439
4330
|
onScroll: handleScroll,
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
"block h-full w-full overflow-visible rounded-lg border border-zinc-200 bg-white p-1 pr-3 transition-all",
|
|
4443
|
-
props.className
|
|
4444
|
-
),
|
|
4445
|
-
children: [
|
|
4331
|
+
ref: scrollRef,
|
|
4332
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: contentRef, children: [
|
|
4446
4333
|
children,
|
|
4447
4334
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex h-[100px] justify-center py-2 text-zinc-300", children: query.isFetching && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconLoader2, { className: "animate-spin", size: 16 }) })
|
|
4448
|
-
]
|
|
4335
|
+
] })
|
|
4449
4336
|
}
|
|
4450
4337
|
);
|
|
4451
4338
|
};
|
|
@@ -4524,14 +4411,14 @@ var DropdownMenuSubTrigger = React10.forwardRef(({ className, inset, children, .
|
|
|
4524
4411
|
{
|
|
4525
4412
|
ref,
|
|
4526
4413
|
className: cn(
|
|
4527
|
-
"flex cursor-default select-none items-center
|
|
4414
|
+
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-zinc-100 data-[state=open]:bg-zinc-100 dark:focus:bg-zinc-800 dark:data-[state=open]:bg-zinc-800",
|
|
4528
4415
|
inset && "pl-8",
|
|
4529
4416
|
className
|
|
4530
4417
|
),
|
|
4531
4418
|
...props,
|
|
4532
4419
|
children: [
|
|
4533
4420
|
children,
|
|
4534
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.ChevronRightIcon, { className: "ml-auto" })
|
|
4421
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.ChevronRightIcon, { className: "ml-auto size-4" })
|
|
4535
4422
|
]
|
|
4536
4423
|
}
|
|
4537
4424
|
));
|
|
@@ -4541,7 +4428,7 @@ var DropdownMenuSubContent = React10.forwardRef(({ className, ...props }, ref) =
|
|
|
4541
4428
|
{
|
|
4542
4429
|
ref,
|
|
4543
4430
|
className: cn(
|
|
4544
|
-
"z-50 min-w-[8rem]
|
|
4431
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
|
|
4545
4432
|
className
|
|
4546
4433
|
),
|
|
4547
4434
|
...props
|
|
@@ -4554,8 +4441,8 @@ var DropdownMenuContent = React10.forwardRef(({ className, sideOffset = 4, ...pr
|
|
|
4554
4441
|
ref,
|
|
4555
4442
|
sideOffset,
|
|
4556
4443
|
className: cn(
|
|
4557
|
-
"z-50
|
|
4558
|
-
"
|
|
4444
|
+
"z-50 min-w-[8rem] overflow-hidden rounded-md border border-neutral-200 bg-white p-1 text-neutral-950 shadow-md dark:border-neutral-800 dark:bg-neutral-950 dark:text-neutral-50",
|
|
4445
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
4559
4446
|
className
|
|
4560
4447
|
),
|
|
4561
4448
|
...props
|
|
@@ -4586,7 +4473,7 @@ var DropdownMenuCheckboxItem = React10.forwardRef(({ className, children, checke
|
|
|
4586
4473
|
checked,
|
|
4587
4474
|
...props,
|
|
4588
4475
|
children: [
|
|
4589
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.CheckIcon, { className: "
|
|
4476
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.CheckIcon, { className: "size-4" }) }) }),
|
|
4590
4477
|
children
|
|
4591
4478
|
]
|
|
4592
4479
|
}
|
|
@@ -4602,7 +4489,7 @@ var DropdownMenuRadioItem = React10.forwardRef(({ className, children, ...props
|
|
|
4602
4489
|
),
|
|
4603
4490
|
...props,
|
|
4604
4491
|
children: [
|
|
4605
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.DotFilledIcon, { className: "
|
|
4492
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacticons.DotFilledIcon, { className: "size-4 fill-current" }) }) }),
|
|
4606
4493
|
children
|
|
4607
4494
|
]
|
|
4608
4495
|
}
|
|
@@ -4669,11 +4556,11 @@ var DisplayHeader = ({
|
|
|
4669
4556
|
type,
|
|
4670
4557
|
content
|
|
4671
4558
|
}) => {
|
|
4672
|
-
const { setSelectedListItem } =
|
|
4559
|
+
const { setSelectedListItem } = useDatabrowserStore();
|
|
4673
4560
|
const handleAddItem = () => {
|
|
4674
4561
|
setSelectedListItem({ key: type === "stream" ? "*" : "", isNew: true });
|
|
4675
4562
|
};
|
|
4676
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg bg-zinc-100", children: [
|
|
4563
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg bg-zinc-100 px-3 py-2", children: [
|
|
4677
4564
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex min-h-10 items-center justify-between gap-4", children: [
|
|
4678
4565
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "grow truncate text-base", children: dataKey.trim() === "" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ml-1 text-zinc-500", children: "(Empty Key)" }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "font-semibold", children: dataKey }) }),
|
|
4679
4566
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-1", children: [
|
|
@@ -4730,7 +4617,7 @@ var useFetchHashFieldExpires = ({
|
|
|
4730
4617
|
dataKey,
|
|
4731
4618
|
fields
|
|
4732
4619
|
}) => {
|
|
4733
|
-
const { redis } =
|
|
4620
|
+
const { redis } = useDatabrowser();
|
|
4734
4621
|
return _reactquery.useQuery.call(void 0, {
|
|
4735
4622
|
queryKey: [FETCH_HASH_FIELD_TTLS_QUERY_KEY, dataKey, fields],
|
|
4736
4623
|
queryFn: async () => {
|
|
@@ -4761,7 +4648,7 @@ var useFetchHashFieldExpires = ({
|
|
|
4761
4648
|
// src/components/databrowser/hooks/use-set-hash-ttl.ts
|
|
4762
4649
|
|
|
4763
4650
|
var useSetHashTTL = () => {
|
|
4764
|
-
const { redis } =
|
|
4651
|
+
const { redis } = useDatabrowser();
|
|
4765
4652
|
return _reactquery.useMutation.call(void 0, {
|
|
4766
4653
|
mutationFn: async ({
|
|
4767
4654
|
dataKey,
|
|
@@ -4783,7 +4670,7 @@ var useSetHashTTL = () => {
|
|
|
4783
4670
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
4784
4671
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
4785
4672
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
4786
|
-
const expireAt = _optionalChain([data, 'optionalAccess',
|
|
4673
|
+
const expireAt = _optionalChain([data, 'optionalAccess', _25 => _25[field]]);
|
|
4787
4674
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
4788
4675
|
TTLBadge,
|
|
4789
4676
|
{
|
|
@@ -4872,7 +4759,7 @@ var CustomEditor = ({
|
|
|
4872
4759
|
if (!monaco || !editorRef.current) {
|
|
4873
4760
|
return;
|
|
4874
4761
|
}
|
|
4875
|
-
_optionalChain([monaco, 'optionalAccess',
|
|
4762
|
+
_optionalChain([monaco, 'optionalAccess', _26 => _26.editor, 'access', _27 => _27.setModelLanguage, 'call', _28 => _28(editorRef.current.getModel(), language)]);
|
|
4876
4763
|
}, [monaco, language]);
|
|
4877
4764
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4878
4765
|
"div",
|
|
@@ -5007,7 +4894,7 @@ var ListEditDisplay = ({
|
|
|
5007
4894
|
type,
|
|
5008
4895
|
item
|
|
5009
4896
|
}) => {
|
|
5010
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grow rounded-md bg-zinc-100", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListEditForm, { item, type, dataKey }, item.key) });
|
|
4897
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "grow rounded-md bg-zinc-100 p-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListEditForm, { item, type, dataKey }, item.key) });
|
|
5011
4898
|
};
|
|
5012
4899
|
var ListEditForm = ({
|
|
5013
4900
|
type,
|
|
@@ -5019,7 +4906,7 @@ var ListEditForm = ({
|
|
|
5019
4906
|
dataKey
|
|
5020
4907
|
});
|
|
5021
4908
|
const findValue = () => {
|
|
5022
|
-
for (const page of _nullishCoalesce(_optionalChain([query, 'access',
|
|
4909
|
+
for (const page of _nullishCoalesce(_optionalChain([query, 'access', _29 => _29.data, 'optionalAccess', _30 => _30.pages]), () => ( []))) {
|
|
5023
4910
|
const item = page.keys.find((item2) => item2.key === itemKey);
|
|
5024
4911
|
if (item && "value" in item) return item.value;
|
|
5025
4912
|
}
|
|
@@ -5033,7 +4920,7 @@ var ListEditForm = ({
|
|
|
5033
4920
|
}
|
|
5034
4921
|
});
|
|
5035
4922
|
const { mutateAsync: editItem, isPending } = useEditListItem();
|
|
5036
|
-
const { setSelectedListItem } =
|
|
4923
|
+
const { setSelectedListItem } = useDatabrowserStore();
|
|
5037
4924
|
const [keyLabel, valueLabel] = headerLabels[type];
|
|
5038
4925
|
const onSubmit = form.handleSubmit(async ({ key, value }) => {
|
|
5039
4926
|
await editItem({
|
|
@@ -5165,7 +5052,7 @@ var HashFieldTTLInfo = ({
|
|
|
5165
5052
|
fields
|
|
5166
5053
|
}) => {
|
|
5167
5054
|
const { data } = useFetchHashFieldExpires({ dataKey, fields });
|
|
5168
|
-
const expireAt = _optionalChain([data, 'optionalAccess',
|
|
5055
|
+
const expireAt = _optionalChain([data, 'optionalAccess', _31 => _31[field]]);
|
|
5169
5056
|
const [ttl, setTTL] = _react.useState.call(void 0, () => calculateTTL(expireAt));
|
|
5170
5057
|
_react.useEffect.call(void 0, () => {
|
|
5171
5058
|
setTTL(calculateTTL(expireAt));
|
|
@@ -5188,12 +5075,12 @@ var headerLabels = {
|
|
|
5188
5075
|
set: ["Value", ""]
|
|
5189
5076
|
};
|
|
5190
5077
|
var ListDisplay = ({ dataKey, type }) => {
|
|
5191
|
-
const { selectedListItem } =
|
|
5078
|
+
const { selectedListItem } = useDatabrowserStore();
|
|
5192
5079
|
const query = useFetchListItems({ dataKey, type });
|
|
5193
5080
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2", children: [
|
|
5194
5081
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayHeader, { dataKey, type }),
|
|
5195
5082
|
selectedListItem && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListEditDisplay, { dataKey, type, item: selectedListItem }),
|
|
5196
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("min-h-0 grow", selectedListItem && "hidden"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfiniteScroll, { query, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "table", { className: "w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ItemContextMenu, { dataKey, type, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListItems, { dataKey, type, query }) }) }) }) }) })
|
|
5083
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("min-h-0 grow", selectedListItem && "hidden"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfiniteScroll, { query, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pr-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "table", { className: "w-full", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ItemContextMenu, { dataKey, type, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ListItems, { dataKey, type, query }) }) }) }) }) }) })
|
|
5197
5084
|
] });
|
|
5198
5085
|
};
|
|
5199
5086
|
var ListItems = ({
|
|
@@ -5201,8 +5088,8 @@ var ListItems = ({
|
|
|
5201
5088
|
type,
|
|
5202
5089
|
dataKey
|
|
5203
5090
|
}) => {
|
|
5204
|
-
const { setSelectedListItem } =
|
|
5205
|
-
const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access',
|
|
5091
|
+
const { setSelectedListItem } = useDatabrowserStore();
|
|
5092
|
+
const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access', _32 => _32.data, 'optionalAccess', _33 => _33.pages, 'access', _34 => _34.flatMap, 'call', _35 => _35((page) => page.keys)]), () => ( [])), [query.data]);
|
|
5206
5093
|
const fields = _react.useMemo.call(void 0, () => keys.map((key) => key.key), [keys]);
|
|
5207
5094
|
const { mutate: editItem } = useEditListItem();
|
|
5208
5095
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -5213,7 +5100,7 @@ var ListItems = ({
|
|
|
5213
5100
|
onClick: () => {
|
|
5214
5101
|
setSelectedListItem({ key });
|
|
5215
5102
|
},
|
|
5216
|
-
className: cn("h-10 border-b border-b-zinc-100
|
|
5103
|
+
className: cn("h-10 border-b border-b-zinc-100 hover:bg-zinc-100 "),
|
|
5217
5104
|
children: [
|
|
5218
5105
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5219
5106
|
"td",
|
|
@@ -5284,7 +5171,13 @@ var EditorDisplay = ({ dataKey, type }) => {
|
|
|
5284
5171
|
const { data } = useFetchSimpleKey(dataKey, type);
|
|
5285
5172
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full w-full flex-col gap-2", children: [
|
|
5286
5173
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayHeader, { dataKey, type, content: _nullishCoalesce(data, () => ( void 0)) }),
|
|
5287
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5174
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5175
|
+
"div",
|
|
5176
|
+
{
|
|
5177
|
+
className: "flex h-full grow flex-col gap-2\n rounded-md bg-zinc-100 p-3",
|
|
5178
|
+
children: data === void 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Spinner, { isLoadingText: "", isLoading: true }) : data === null ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EditorDisplayForm, { dataKey, type, data }, dataKey)
|
|
5179
|
+
}
|
|
5180
|
+
)
|
|
5288
5181
|
] });
|
|
5289
5182
|
};
|
|
5290
5183
|
var EditorDisplayForm = ({
|
|
@@ -5328,10 +5221,10 @@ var EditorDisplayForm = ({
|
|
|
5328
5221
|
// src/components/databrowser/components/display/index.tsx
|
|
5329
5222
|
|
|
5330
5223
|
var DataDisplay = () => {
|
|
5331
|
-
const { selectedKey } =
|
|
5224
|
+
const { selectedKey } = useDatabrowserStore();
|
|
5332
5225
|
const { query } = useKeys();
|
|
5333
5226
|
const type = useKeyType(selectedKey);
|
|
5334
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full p-
|
|
5227
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "h-full rounded-xl border bg-white p-1", children: !selectedKey ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}) : !type ? query.isLoading ? /* @__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, "div", {}) : /* @__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 }) }) });
|
|
5335
5228
|
};
|
|
5336
5229
|
|
|
5337
5230
|
// src/components/databrowser/components/sidebar/index.tsx
|
|
@@ -5447,7 +5340,7 @@ DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
|
5447
5340
|
// src/components/databrowser/components/add-key-modal.tsx
|
|
5448
5341
|
|
|
5449
5342
|
function AddKeyModal() {
|
|
5450
|
-
const { setSelectedKey } =
|
|
5343
|
+
const { setSelectedKey } = useDatabrowserStore();
|
|
5451
5344
|
const [open, setOpen] = _react.useState.call(void 0, false);
|
|
5452
5345
|
const { mutateAsync: addKey, isPending } = useAddKey();
|
|
5453
5346
|
const { control, handleSubmit, formState, reset } = _reacthookform.useForm.call(void 0, {
|
|
@@ -5461,7 +5354,7 @@ function AddKeyModal() {
|
|
|
5461
5354
|
setSelectedKey(key);
|
|
5462
5355
|
setOpen(false);
|
|
5463
5356
|
setTimeout(() => {
|
|
5464
|
-
_optionalChain([window, 'access',
|
|
5357
|
+
_optionalChain([window, 'access', _36 => _36.document, 'access', _37 => _37.querySelector, 'call', _38 => _38(`[data-key="${key}"]`), 'optionalAccess', _39 => _39.scrollIntoView, 'call', _40 => _40({
|
|
5465
5358
|
behavior: "smooth",
|
|
5466
5359
|
block: "start",
|
|
5467
5360
|
inline: "nearest"
|
|
@@ -5506,7 +5399,7 @@ function AddKeyModal() {
|
|
|
5506
5399
|
}
|
|
5507
5400
|
)
|
|
5508
5401
|
] }),
|
|
5509
|
-
formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access',
|
|
5402
|
+
formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access', _41 => _41.errors, 'access', _42 => _42.key, 'optionalAccess', _43 => _43.message]) }),
|
|
5510
5403
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mt-2 text-xs text-zinc-500", children: "After creating the key, you can edit the value" }),
|
|
5511
5404
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
5512
5405
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -5600,7 +5493,7 @@ var SidebarContextMenu = ({ children }) => {
|
|
|
5600
5493
|
|
|
5601
5494
|
var KeysList = () => {
|
|
5602
5495
|
const { keys } = useKeys();
|
|
5603
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SidebarContextMenu, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: keys.map((data, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyItem, { nextKey: _nullishCoalesce(_optionalChain([keys, 'access',
|
|
5496
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pr-3", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SidebarContextMenu, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: keys.map((data, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeyItem, { nextKey: _nullishCoalesce(_optionalChain([keys, 'access', _44 => _44.at, 'call', _45 => _45(i + 1), 'optionalAccess', _46 => _46[0]]), () => ( "")), data }, data[0])) }) }) });
|
|
5604
5497
|
};
|
|
5605
5498
|
var keyStyles = {
|
|
5606
5499
|
string: "border-sky-400 !bg-sky-50 text-sky-900",
|
|
@@ -5612,7 +5505,7 @@ var keyStyles = {
|
|
|
5612
5505
|
stream: "border-green-400 !bg-green-50 text-green-900"
|
|
5613
5506
|
};
|
|
5614
5507
|
var KeyItem = ({ data, nextKey }) => {
|
|
5615
|
-
const { selectedKey, setSelectedKey } =
|
|
5508
|
+
const { selectedKey, setSelectedKey } = useDatabrowserStore();
|
|
5616
5509
|
const [dataKey, dataType] = data;
|
|
5617
5510
|
const isKeySelected = selectedKey === dataKey;
|
|
5618
5511
|
const isNextKeySelected = selectedKey === nextKey;
|
|
@@ -5622,7 +5515,7 @@ var KeyItem = ({ data, nextKey }) => {
|
|
|
5622
5515
|
"data-key": dataKey,
|
|
5623
5516
|
variant: isKeySelected ? "default" : "ghost",
|
|
5624
5517
|
className: cn(
|
|
5625
|
-
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0
|
|
5518
|
+
"relative flex h-10 w-full items-center justify-start gap-2 px-3 py-0 ",
|
|
5626
5519
|
"select-none border border-transparent text-left",
|
|
5627
5520
|
isKeySelected && "shadow-sm",
|
|
5628
5521
|
isKeySelected && keyStyles[dataType]
|
|
@@ -5641,106 +5534,30 @@ var KeyItem = ({ data, nextKey }) => {
|
|
|
5641
5534
|
|
|
5642
5535
|
|
|
5643
5536
|
|
|
5644
|
-
var dedupeSearchHistory = (history) => {
|
|
5645
|
-
const seen = /* @__PURE__ */ new Set();
|
|
5646
|
-
return history.filter((item) => {
|
|
5647
|
-
if (!item || seen.has(item)) return false;
|
|
5648
|
-
seen.add(item);
|
|
5649
|
-
return true;
|
|
5650
|
-
});
|
|
5651
|
-
};
|
|
5652
5537
|
var SearchInput = () => {
|
|
5653
|
-
const { setSearchKey, search } =
|
|
5654
|
-
const { searchHistory, addSearchHistory } = useDatabrowserStore();
|
|
5538
|
+
const { setSearchKey, search } = useDatabrowserStore();
|
|
5655
5539
|
const [state, setState] = _react.useState.call(void 0, search.key);
|
|
5656
|
-
const
|
|
5657
|
-
const [focusedIndex, setFocusedIndex] = _react.useState.call(void 0, -1);
|
|
5658
|
-
const inputRef = _react.useRef.call(void 0, null);
|
|
5659
|
-
const historyItemRefs = _react.useRef.call(void 0, []);
|
|
5660
|
-
const handleSubmit = (value) => {
|
|
5540
|
+
const submit = (value) => {
|
|
5661
5541
|
if (value.trim() !== "" && !value.includes("*")) value = `${value}*`;
|
|
5662
|
-
addSearchHistory(value);
|
|
5663
5542
|
setSearchKey(value);
|
|
5664
5543
|
setState(value);
|
|
5665
5544
|
};
|
|
5666
|
-
const filteredHistory = dedupeSearchHistory(
|
|
5667
|
-
searchHistory.filter((item) => item.includes(state) && item !== state)
|
|
5668
|
-
).slice(0, 5).map((item) => item.endsWith("*") ? item.slice(0, -1) : item);
|
|
5669
|
-
_react.useEffect.call(void 0, () => {
|
|
5670
|
-
setFocusedIndex(-1);
|
|
5671
|
-
}, [filteredHistory.length]);
|
|
5672
|
-
const handleKeyDown = (e) => {
|
|
5673
|
-
if (e.key === "Enter") {
|
|
5674
|
-
const text = focusedIndex >= 0 && focusedIndex < filteredHistory.length ? filteredHistory[focusedIndex] : e.currentTarget.value;
|
|
5675
|
-
handleSubmit(text);
|
|
5676
|
-
} else if (e.key === "Escape") {
|
|
5677
|
-
setState("");
|
|
5678
|
-
setFocusedIndex(-1);
|
|
5679
|
-
_optionalChain([inputRef, 'access', _57 => _57.current, 'optionalAccess', _58 => _58.blur, 'call', _59 => _59()]);
|
|
5680
|
-
} else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
|
|
5681
|
-
e.preventDefault();
|
|
5682
|
-
if (focusedIndex < filteredHistory.length - 1) {
|
|
5683
|
-
setFocusedIndex(focusedIndex + 1);
|
|
5684
|
-
} else if (filteredHistory.length > 0) {
|
|
5685
|
-
setFocusedIndex(0);
|
|
5686
|
-
}
|
|
5687
|
-
} else if (e.key === "ArrowUp" || e.key === "Tab" && e.shiftKey) {
|
|
5688
|
-
e.preventDefault();
|
|
5689
|
-
if (focusedIndex > 0) {
|
|
5690
|
-
setFocusedIndex(focusedIndex - 1);
|
|
5691
|
-
} else if (filteredHistory.length > 0 && focusedIndex === 0) {
|
|
5692
|
-
setFocusedIndex(-1);
|
|
5693
|
-
_optionalChain([inputRef, 'access', _60 => _60.current, 'optionalAccess', _61 => _61.focus, 'call', _62 => _62()]);
|
|
5694
|
-
} else if (filteredHistory.length > 0) {
|
|
5695
|
-
setFocusedIndex(filteredHistory.length - 1);
|
|
5696
|
-
}
|
|
5697
|
-
}
|
|
5698
|
-
};
|
|
5699
5545
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative grow", children: [
|
|
5700
|
-
/* @__PURE__ */ _jsxruntime.
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
setFocusedIndex(-1);
|
|
5716
|
-
},
|
|
5717
|
-
onBlur: () => setIsFocus(false)
|
|
5718
|
-
}
|
|
5719
|
-
) }) }),
|
|
5720
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5721
|
-
PopoverContent,
|
|
5722
|
-
{
|
|
5723
|
-
className: "w-[--radix-popover-trigger-width] divide-y px-3 py-2 text-[13px] text-zinc-900",
|
|
5724
|
-
autoFocus: false,
|
|
5725
|
-
onOpenAutoFocus: (e) => {
|
|
5726
|
-
e.preventDefault();
|
|
5727
|
-
e.stopPropagation();
|
|
5728
|
-
},
|
|
5729
|
-
children: filteredHistory.map((item, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "w-full py-[3px]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5730
|
-
"button",
|
|
5731
|
-
{
|
|
5732
|
-
ref: (el) => {
|
|
5733
|
-
historyItemRefs.current[index] = el;
|
|
5734
|
-
},
|
|
5735
|
-
onClick: () => handleSubmit(item),
|
|
5736
|
-
onMouseEnter: () => setFocusedIndex(index),
|
|
5737
|
-
className: `block w-full rounded-sm p-1 text-left transition-colors ${focusedIndex === index ? "bg-zinc-100" : "hover:bg-zinc-100"}`,
|
|
5738
|
-
children: item
|
|
5739
|
-
}
|
|
5740
|
-
) }, item))
|
|
5741
|
-
}
|
|
5742
|
-
)
|
|
5743
|
-
] }),
|
|
5546
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5547
|
+
Input,
|
|
5548
|
+
{
|
|
5549
|
+
placeholder: "Search",
|
|
5550
|
+
className: "rounded-l-none border-zinc-300 font-normal",
|
|
5551
|
+
onKeyDown: (e) => {
|
|
5552
|
+
if (e.key === "Enter") submit(e.currentTarget.value);
|
|
5553
|
+
},
|
|
5554
|
+
onChange: (e) => {
|
|
5555
|
+
setState(e.currentTarget.value);
|
|
5556
|
+
if (e.currentTarget.value.trim() === "") submit("");
|
|
5557
|
+
},
|
|
5558
|
+
value: state
|
|
5559
|
+
}
|
|
5560
|
+
),
|
|
5744
5561
|
state && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5745
5562
|
Button,
|
|
5746
5563
|
{
|
|
@@ -5757,8 +5574,7 @@ var SearchInput = () => {
|
|
|
5757
5574
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children: "Clear" })
|
|
5758
5575
|
]
|
|
5759
5576
|
}
|
|
5760
|
-
)
|
|
5761
|
-
" "
|
|
5577
|
+
)
|
|
5762
5578
|
] });
|
|
5763
5579
|
};
|
|
5764
5580
|
|
|
@@ -5774,7 +5590,7 @@ var LoadingSkeleton = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div",
|
|
|
5774
5590
|
|
|
5775
5591
|
var ALL_TYPES_KEY = "all";
|
|
5776
5592
|
function DataTypeSelector() {
|
|
5777
|
-
const { search, setSearchType } =
|
|
5593
|
+
const { search, setSearchType } = useDatabrowserStore();
|
|
5778
5594
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5779
5595
|
Select,
|
|
5780
5596
|
{
|
|
@@ -5800,8 +5616,8 @@ function DataTypeSelector() {
|
|
|
5800
5616
|
|
|
5801
5617
|
function Sidebar() {
|
|
5802
5618
|
const { keys, query } = useKeys();
|
|
5803
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2 p-
|
|
5804
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg bg-zinc-100", children: [
|
|
5619
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-full flex-col gap-2 rounded-xl border bg-white p-1", children: [
|
|
5620
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "rounded-lg bg-zinc-100 px-3 py-2", children: [
|
|
5805
5621
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex h-10 items-center justify-between pl-1", children: [
|
|
5806
5622
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DisplayDbSize, {}),
|
|
5807
5623
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-1", children: [
|
|
@@ -5839,15 +5655,19 @@ function Sidebar() {
|
|
|
5839
5655
|
] }),
|
|
5840
5656
|
query.isLoading && keys.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoadingSkeleton, {}) : keys.length > 0 ? (
|
|
5841
5657
|
// Infinite scroll already has a loader at the bottom
|
|
5842
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfiniteScroll, { query,
|
|
5658
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, InfiniteScroll, { query, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, KeysList, {}) })
|
|
5843
5659
|
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Empty, {})
|
|
5844
5660
|
] });
|
|
5845
5661
|
}
|
|
5846
5662
|
|
|
5847
|
-
// src/components/databrowser/
|
|
5663
|
+
// src/components/databrowser/index.tsx
|
|
5848
5664
|
|
|
5849
|
-
var
|
|
5850
|
-
|
|
5665
|
+
var RedisBrowser = ({ token, url }) => {
|
|
5666
|
+
const credentials = _react.useMemo.call(void 0, () => ({ token, url }), [token, url]);
|
|
5667
|
+
_react.useEffect.call(void 0, () => {
|
|
5668
|
+
queryClient.resetQueries();
|
|
5669
|
+
}, [credentials.url]);
|
|
5670
|
+
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: [
|
|
5851
5671
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5852
5672
|
_reactresizablepanels.PanelGroup,
|
|
5853
5673
|
{
|
|
@@ -5856,109 +5676,20 @@ var DatabrowserInstance = ({ hidden }) => {
|
|
|
5856
5676
|
className: "h-full w-full gap-0.5 text-sm antialiased",
|
|
5857
5677
|
children: [
|
|
5858
5678
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { defaultSize: 30, minSize: 30, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Sidebar, {}) }),
|
|
5859
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.PanelResizeHandle, { className: "
|
|
5679
|
+
/* @__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,
|
|
5680
|
+
_iconsreact.IconDotsVertical,
|
|
5681
|
+
{
|
|
5682
|
+
size: 16,
|
|
5683
|
+
stroke: 1,
|
|
5684
|
+
className: "pointer-events-none shrink-0 opacity-20"
|
|
5685
|
+
}
|
|
5686
|
+
) }),
|
|
5860
5687
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactresizablepanels.Panel, { minSize: 40, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DataDisplay, {}) })
|
|
5861
5688
|
]
|
|
5862
5689
|
}
|
|
5863
5690
|
),
|
|
5864
5691
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Toaster, {})
|
|
5865
|
-
] }) });
|
|
5866
|
-
};
|
|
5867
|
-
|
|
5868
|
-
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
// src/components/databrowser/components/tab-type-icon.tsx
|
|
5872
|
-
|
|
5873
|
-
function TabTypeIcon({ selectedKey }) {
|
|
5874
|
-
const { data: keyType, isLoading } = useFetchKeyType(selectedKey);
|
|
5875
|
-
if (isLoading) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Skeleton, { className: "h-5 w-5 rounded" });
|
|
5876
|
-
if (!keyType || keyType === "none") return;
|
|
5877
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TypeTag, { variant: keyType, type: "icon" });
|
|
5878
|
-
}
|
|
5879
|
-
|
|
5880
|
-
// src/components/databrowser/components/databrowser-tabs.tsx
|
|
5881
|
-
|
|
5882
|
-
var Tab = ({ id }) => {
|
|
5883
|
-
const { selectTab, selectedTab, tabs, removeTab } = useDatabrowserStore();
|
|
5884
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5885
|
-
"div",
|
|
5886
|
-
{
|
|
5887
|
-
onClick: () => selectTab(id),
|
|
5888
|
-
className: cn(
|
|
5889
|
-
"flex h-9 cursor-pointer items-center gap-2 rounded-t-lg border border-zinc-200 px-3 text-[13px] transition-colors",
|
|
5890
|
-
id === selectedTab ? "border-b-white bg-white text-zinc-900" : "bg-zinc-100 hover:bg-zinc-50"
|
|
5891
|
-
),
|
|
5892
|
-
children: [
|
|
5893
|
-
tabs[id].selectedKey ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
5894
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, TabTypeIcon, { selectedKey: tabs[id].selectedKey }),
|
|
5895
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "max-w-32 truncate whitespace-nowrap", children: tabs[id].selectedKey })
|
|
5896
|
-
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "whitespace-nowrap", children: "New Tab" }),
|
|
5897
|
-
Object.keys(tabs).length > 1 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5898
|
-
"button",
|
|
5899
|
-
{
|
|
5900
|
-
onClick: (e) => {
|
|
5901
|
-
e.stopPropagation();
|
|
5902
|
-
removeTab(id);
|
|
5903
|
-
},
|
|
5904
|
-
className: "p-1 text-zinc-300 transition-colors hover:text-zinc-500",
|
|
5905
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconX, { size: 16 })
|
|
5906
|
-
}
|
|
5907
|
-
)
|
|
5908
|
-
]
|
|
5909
|
-
}
|
|
5910
|
-
);
|
|
5911
|
-
};
|
|
5912
|
-
var DatabrowserTabs = () => {
|
|
5913
|
-
const { tabs, addTab } = useDatabrowserStore();
|
|
5914
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative mb-2 shrink-0", children: [
|
|
5915
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "absolute bottom-0 left-0 right-0 -z-10 h-[1px] w-full bg-zinc-200" }),
|
|
5916
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "scrollbar-hide flex translate-y-[1px] items-center gap-1 overflow-x-scroll pb-[1px] [&::-webkit-scrollbar]:hidden", children: [
|
|
5917
|
-
Object.keys(tabs).map((id) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Tab, { id }, id)),
|
|
5918
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5919
|
-
Button,
|
|
5920
|
-
{
|
|
5921
|
-
variant: "secondary",
|
|
5922
|
-
size: "icon-sm",
|
|
5923
|
-
onClick: addTab,
|
|
5924
|
-
className: "mr-1 flex-shrink-0",
|
|
5925
|
-
title: "Add new tab",
|
|
5926
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsreact.IconPlus, { className: "text-zinc-500", size: 16 })
|
|
5927
|
-
}
|
|
5928
|
-
)
|
|
5929
|
-
] })
|
|
5930
|
-
] });
|
|
5931
|
-
};
|
|
5932
|
-
|
|
5933
|
-
// src/components/databrowser/index.tsx
|
|
5934
|
-
|
|
5935
|
-
var RedisBrowser = ({
|
|
5936
|
-
token,
|
|
5937
|
-
url,
|
|
5938
|
-
hideTabs
|
|
5939
|
-
}) => {
|
|
5940
|
-
const credentials = _react.useMemo.call(void 0, () => ({ token, url }), [token, url]);
|
|
5941
|
-
_react.useEffect.call(void 0, () => {
|
|
5942
|
-
queryClient.resetQueries();
|
|
5943
|
-
}, [credentials.url]);
|
|
5944
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactquery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RedisProvider, { redisCredentials: credentials, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserProvider, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reacttooltip.TooltipProvider, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5945
|
-
"div",
|
|
5946
|
-
{
|
|
5947
|
-
className: "ups-db",
|
|
5948
|
-
style: { height: "100%", display: "flex", flexDirection: "column" },
|
|
5949
|
-
children: [
|
|
5950
|
-
!hideTabs && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserTabs, {}),
|
|
5951
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserInstances, {})
|
|
5952
|
-
]
|
|
5953
|
-
}
|
|
5954
|
-
) }) }) }) });
|
|
5955
|
-
};
|
|
5956
|
-
var DatabrowserInstances = () => {
|
|
5957
|
-
const { tabs, selectedTab, addTab } = useDatabrowserStore();
|
|
5958
|
-
_react.useEffect.call(void 0, () => {
|
|
5959
|
-
if (Object.keys(tabs).length === 0) addTab();
|
|
5960
|
-
}, [tabs]);
|
|
5961
|
-
return Object.entries(tabs).map(([id]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TabIdProvider, { value: id, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DatabrowserInstance, { hidden: id !== selectedTab }) }, id));
|
|
5692
|
+
] }) }) }) }) });
|
|
5962
5693
|
};
|
|
5963
5694
|
|
|
5964
5695
|
|