@upstash/react-redis-browser 0.2.11 → 0.2.12
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.js +59 -33
- package/dist/index.mjs +32 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -263,15 +263,16 @@ var DatabrowserProvider = ({
|
|
|
263
263
|
removeItem: () => {
|
|
264
264
|
}
|
|
265
265
|
},
|
|
266
|
-
version:
|
|
266
|
+
version: 5,
|
|
267
267
|
migrate: (originalState, version) => {
|
|
268
268
|
const state = originalState;
|
|
269
269
|
if (version <= 1) {
|
|
270
270
|
state.tabs = state.tabs.map(([id, data]) => [id, { ...data, id }]);
|
|
271
271
|
}
|
|
272
|
-
if (version <=
|
|
272
|
+
if (version <= 4) {
|
|
273
273
|
state.tabs = state.tabs.map(([id, data]) => {
|
|
274
274
|
const oldData = data;
|
|
275
|
+
if (oldData.selectedKeys && Array.isArray(oldData.selectedKeys)) return [id, data];
|
|
275
276
|
return [
|
|
276
277
|
id,
|
|
277
278
|
{ ...data, selectedKeys: oldData.selectedKey ? [oldData.selectedKey] : [] }
|
|
@@ -506,9 +507,9 @@ var useTab = () => {
|
|
|
506
507
|
return _react.useMemo.call(void 0,
|
|
507
508
|
() => ({
|
|
508
509
|
active: selectedTab === tabId,
|
|
509
|
-
selectedKey: tabData.selectedKeys[0],
|
|
510
|
+
selectedKey: _optionalChain([tabData, 'access', _13 => _13.selectedKeys, 'optionalAccess', _14 => _14[0]]),
|
|
510
511
|
// Backwards compatibility - first selected key
|
|
511
|
-
selectedKeys: tabData.selectedKeys,
|
|
512
|
+
selectedKeys: _nullishCoalesce(tabData.selectedKeys, () => ( [])),
|
|
512
513
|
selectedListItem: tabData.selectedListItem,
|
|
513
514
|
search: tabData.search,
|
|
514
515
|
pinned: tabData.pinned,
|
|
@@ -602,15 +603,15 @@ var getGroupRecursive = (classParts, classPartObject) => {
|
|
|
602
603
|
return void 0;
|
|
603
604
|
}
|
|
604
605
|
const classRest = classParts.join(CLASS_PART_SEPARATOR);
|
|
605
|
-
return _optionalChain([classPartObject, 'access',
|
|
606
|
+
return _optionalChain([classPartObject, 'access', _15 => _15.validators, 'access', _16 => _16.find, 'call', _17 => _17(({
|
|
606
607
|
validator
|
|
607
|
-
}) => validator(classRest)), 'optionalAccess',
|
|
608
|
+
}) => validator(classRest)), 'optionalAccess', _18 => _18.classGroupId]);
|
|
608
609
|
};
|
|
609
610
|
var arbitraryPropertyRegex = /^\[(.+)\]$/;
|
|
610
611
|
var getGroupIdForArbitraryProperty = (className) => {
|
|
611
612
|
if (arbitraryPropertyRegex.test(className)) {
|
|
612
613
|
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
|
|
613
|
-
const property = _optionalChain([arbitraryPropertyClassName, 'optionalAccess',
|
|
614
|
+
const property = _optionalChain([arbitraryPropertyClassName, 'optionalAccess', _19 => _19.substring, 'call', _20 => _20(0, arbitraryPropertyClassName.indexOf(":"))]);
|
|
614
615
|
if (property) {
|
|
615
616
|
return "arbitrary.." + property;
|
|
616
617
|
}
|
|
@@ -3306,7 +3307,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3306
3307
|
refetchOnMount: false
|
|
3307
3308
|
});
|
|
3308
3309
|
const keys = _react.useMemo.call(void 0, () => {
|
|
3309
|
-
const keys2 = _nullishCoalesce(_optionalChain([query, 'access',
|
|
3310
|
+
const keys2 = _nullishCoalesce(_optionalChain([query, 'access', _21 => _21.data, 'optionalAccess', _22 => _22.pages, 'access', _23 => _23.flatMap, 'call', _24 => _24((page) => page.keys)]), () => ( []));
|
|
3310
3311
|
const keysSet = /* @__PURE__ */ new Set();
|
|
3311
3312
|
const dedupedKeys = [];
|
|
3312
3313
|
for (const key of keys2) {
|
|
@@ -3337,7 +3338,7 @@ var useKeys = () => {
|
|
|
3337
3338
|
var useKeyType = (key) => {
|
|
3338
3339
|
const { keys } = useKeys();
|
|
3339
3340
|
const keyTuple = _react.useMemo.call(void 0, () => keys.find(([k, _]) => k === key), [keys, key]);
|
|
3340
|
-
return _optionalChain([keyTuple, 'optionalAccess',
|
|
3341
|
+
return _optionalChain([keyTuple, 'optionalAccess', _25 => _25[1]]);
|
|
3341
3342
|
};
|
|
3342
3343
|
|
|
3343
3344
|
// src/components/databrowser/components/display/display-list.tsx
|
|
@@ -3581,7 +3582,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
3581
3582
|
// +1 since first message is the last one
|
|
3582
3583
|
LIST_DISPLAY_PAGE_SIZE + 1
|
|
3583
3584
|
);
|
|
3584
|
-
const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access',
|
|
3585
|
+
const lastMessageId = messages.length > 0 ? _optionalChain([messages, 'access', _26 => _26.at, 'call', _27 => _27(-1), 'optionalAccess', _28 => _28[0]]) : void 0;
|
|
3585
3586
|
return {
|
|
3586
3587
|
cursor: messages.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastMessageId,
|
|
3587
3588
|
keys: messages.map(([id, fields]) => ({
|
|
@@ -3745,7 +3746,7 @@ var useEditListItem = () => {
|
|
|
3745
3746
|
}
|
|
3746
3747
|
case "stream": {
|
|
3747
3748
|
if (!isNew || !newKey) throw new Error("Stream data type is not mutable");
|
|
3748
|
-
const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess',
|
|
3749
|
+
const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess', _29 => _29.split, 'call', _30 => _30("\n")]), () => ( []))).map(
|
|
3749
3750
|
({ key, value }) => [key, value]
|
|
3750
3751
|
);
|
|
3751
3752
|
pipe.xadd(dataKey, newKey, Object.fromEntries(opts));
|
|
@@ -3827,7 +3828,7 @@ var LengthBadge = ({
|
|
|
3827
3828
|
content
|
|
3828
3829
|
}) => {
|
|
3829
3830
|
const { data, isLoading } = useFetchKeyLength({ dataKey, type });
|
|
3830
|
-
const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess',
|
|
3831
|
+
const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess', _31 => _31.length]), () => ( data));
|
|
3831
3832
|
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 });
|
|
3832
3833
|
};
|
|
3833
3834
|
var SizeBadge = ({ dataKey }) => {
|
|
@@ -4511,7 +4512,7 @@ var ItemContextMenu = ({
|
|
|
4511
4512
|
editItem({
|
|
4512
4513
|
type,
|
|
4513
4514
|
dataKey,
|
|
4514
|
-
itemKey: _optionalChain([data, 'optionalAccess',
|
|
4515
|
+
itemKey: _optionalChain([data, 'optionalAccess', _32 => _32.key]),
|
|
4515
4516
|
// For deletion
|
|
4516
4517
|
newKey: void 0
|
|
4517
4518
|
});
|
|
@@ -4546,7 +4547,7 @@ var ItemContextMenu = ({
|
|
|
4546
4547
|
{
|
|
4547
4548
|
onClick: () => {
|
|
4548
4549
|
if (!data) return;
|
|
4549
|
-
navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess',
|
|
4550
|
+
navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess', _33 => _33.key]));
|
|
4550
4551
|
toast({
|
|
4551
4552
|
description: "Key copied to clipboard"
|
|
4552
4553
|
});
|
|
@@ -4558,11 +4559,11 @@ var ItemContextMenu = ({
|
|
|
4558
4559
|
]
|
|
4559
4560
|
}
|
|
4560
4561
|
),
|
|
4561
|
-
_optionalChain([data, 'optionalAccess',
|
|
4562
|
+
_optionalChain([data, 'optionalAccess', _34 => _34.value]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4562
4563
|
ContextMenuItem,
|
|
4563
4564
|
{
|
|
4564
4565
|
onClick: () => {
|
|
4565
|
-
navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
4566
|
+
navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _35 => _35.value]), () => ( "")));
|
|
4566
4567
|
toast({
|
|
4567
4568
|
description: "Value copied to clipboard"
|
|
4568
4569
|
});
|
|
@@ -5058,7 +5059,7 @@ var useSetHashTTL = () => {
|
|
|
5058
5059
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
5059
5060
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
5060
5061
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
5061
|
-
const expireAt = _optionalChain([data, 'optionalAccess',
|
|
5062
|
+
const expireAt = _optionalChain([data, 'optionalAccess', _36 => _36[field]]);
|
|
5062
5063
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5063
5064
|
TTLBadge,
|
|
5064
5065
|
{
|
|
@@ -5133,7 +5134,13 @@ var handleCopyClick = async (textToCopy) => {
|
|
|
5133
5134
|
|
|
5134
5135
|
// src/components/databrowser/components/display/input/custom-editor.tsx
|
|
5135
5136
|
|
|
5136
|
-
var CustomEditor = ({
|
|
5137
|
+
var CustomEditor = (props) => {
|
|
5138
|
+
if (isTest) {
|
|
5139
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TestEditor, { ...props });
|
|
5140
|
+
}
|
|
5141
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MonacoEditor, { ...props });
|
|
5142
|
+
};
|
|
5143
|
+
var MonacoEditor = ({
|
|
5137
5144
|
language,
|
|
5138
5145
|
value,
|
|
5139
5146
|
onChange,
|
|
@@ -5149,7 +5156,7 @@ var CustomEditor = ({
|
|
|
5149
5156
|
if (!active || !monaco || !editorRef.current) {
|
|
5150
5157
|
return;
|
|
5151
5158
|
}
|
|
5152
|
-
_optionalChain([monaco, 'optionalAccess',
|
|
5159
|
+
_optionalChain([monaco, 'optionalAccess', _37 => _37.editor, 'access', _38 => _38.setModelLanguage, 'call', _39 => _39(editorRef.current.getModel(), language)]);
|
|
5153
5160
|
}, [monaco, language, active]);
|
|
5154
5161
|
const editor = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5155
5162
|
_react2.Editor,
|
|
@@ -5198,7 +5205,26 @@ var CustomEditor = ({
|
|
|
5198
5205
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5199
5206
|
style: { height },
|
|
5200
5207
|
children: [
|
|
5201
|
-
|
|
5208
|
+
editor,
|
|
5209
|
+
showCopyButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5210
|
+
CopyButton,
|
|
5211
|
+
{
|
|
5212
|
+
value,
|
|
5213
|
+
className: "absolute right-0 top-0 hidden group-hover/editor:flex"
|
|
5214
|
+
}
|
|
5215
|
+
)
|
|
5216
|
+
]
|
|
5217
|
+
}
|
|
5218
|
+
);
|
|
5219
|
+
};
|
|
5220
|
+
var TestEditor = ({ value, onChange, height, showCopyButton }) => {
|
|
5221
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
5222
|
+
"div",
|
|
5223
|
+
{
|
|
5224
|
+
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5225
|
+
style: { height },
|
|
5226
|
+
children: [
|
|
5227
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", { "aria-label": "editor", value, onChange: (e) => onChange(e.target.value) }),
|
|
5202
5228
|
showCopyButton && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5203
5229
|
CopyButton,
|
|
5204
5230
|
{
|
|
@@ -5295,7 +5321,7 @@ var ListEditForm = ({
|
|
|
5295
5321
|
dataKey
|
|
5296
5322
|
});
|
|
5297
5323
|
const findValue = () => {
|
|
5298
|
-
for (const page of _nullishCoalesce(_optionalChain([query, 'access',
|
|
5324
|
+
for (const page of _nullishCoalesce(_optionalChain([query, 'access', _40 => _40.data, 'optionalAccess', _41 => _41.pages]), () => ( []))) {
|
|
5299
5325
|
const item = page.keys.find((item2) => item2.key === itemKey);
|
|
5300
5326
|
if (item && "value" in item) return item.value;
|
|
5301
5327
|
}
|
|
@@ -5441,7 +5467,7 @@ var HashFieldTTLInfo = ({
|
|
|
5441
5467
|
fields
|
|
5442
5468
|
}) => {
|
|
5443
5469
|
const { data } = useFetchHashFieldExpires({ dataKey, fields });
|
|
5444
|
-
const expireAt = _optionalChain([data, 'optionalAccess',
|
|
5470
|
+
const expireAt = _optionalChain([data, 'optionalAccess', _42 => _42[field]]);
|
|
5445
5471
|
const [ttl, setTTL] = _react.useState.call(void 0, () => calculateTTL(expireAt));
|
|
5446
5472
|
_react.useEffect.call(void 0, () => {
|
|
5447
5473
|
setTTL(calculateTTL(expireAt));
|
|
@@ -5478,7 +5504,7 @@ var ListItems = ({
|
|
|
5478
5504
|
dataKey
|
|
5479
5505
|
}) => {
|
|
5480
5506
|
const { setSelectedListItem } = useTab();
|
|
5481
|
-
const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access',
|
|
5507
|
+
const keys = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([query, 'access', _43 => _43.data, 'optionalAccess', _44 => _44.pages, 'access', _45 => _45.flatMap, 'call', _46 => _46((page) => page.keys)]), () => ( [])), [query.data]);
|
|
5482
5508
|
const fields = _react.useMemo.call(void 0, () => keys.map((key) => key.key), [keys]);
|
|
5483
5509
|
const { mutate: editItem } = useEditListItem();
|
|
5484
5510
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -5736,7 +5762,7 @@ function AddKeyModal() {
|
|
|
5736
5762
|
setSelectedKey(key);
|
|
5737
5763
|
setOpen(false);
|
|
5738
5764
|
setTimeout(() => {
|
|
5739
|
-
_optionalChain([window, 'access',
|
|
5765
|
+
_optionalChain([window, 'access', _47 => _47.document, 'access', _48 => _48.querySelector, 'call', _49 => _49(`[data-key="${key}"]`), 'optionalAccess', _50 => _50.scrollIntoView, 'call', _51 => _51({
|
|
5740
5766
|
behavior: "smooth",
|
|
5741
5767
|
block: "start",
|
|
5742
5768
|
inline: "nearest"
|
|
@@ -5781,7 +5807,7 @@ function AddKeyModal() {
|
|
|
5781
5807
|
}
|
|
5782
5808
|
)
|
|
5783
5809
|
] }),
|
|
5784
|
-
formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access',
|
|
5810
|
+
formState.errors.key && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "mb-3 mt-2 text-xs text-red-500", children: _optionalChain([formState, 'access', _52 => _52.errors, 'access', _53 => _53.key, 'optionalAccess', _54 => _54.message]) }),
|
|
5785
5811
|
/* @__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" }),
|
|
5786
5812
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
5787
5813
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6055,7 +6081,7 @@ var SearchInput = () => {
|
|
|
6055
6081
|
} else if (e.key === "Escape") {
|
|
6056
6082
|
setState("");
|
|
6057
6083
|
setFocusedIndex(-1);
|
|
6058
|
-
_optionalChain([inputRef, 'access',
|
|
6084
|
+
_optionalChain([inputRef, 'access', _55 => _55.current, 'optionalAccess', _56 => _56.blur, 'call', _57 => _57()]);
|
|
6059
6085
|
} else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
|
|
6060
6086
|
e.preventDefault();
|
|
6061
6087
|
if (focusedIndex < filteredHistory.length - 1) {
|
|
@@ -6069,7 +6095,7 @@ var SearchInput = () => {
|
|
|
6069
6095
|
setFocusedIndex(focusedIndex - 1);
|
|
6070
6096
|
} else if (filteredHistory.length > 0 && focusedIndex === 0) {
|
|
6071
6097
|
setFocusedIndex(-1);
|
|
6072
|
-
_optionalChain([inputRef, 'access',
|
|
6098
|
+
_optionalChain([inputRef, 'access', _58 => _58.current, 'optionalAccess', _59 => _59.focus, 'call', _60 => _60()]);
|
|
6073
6099
|
} else if (filteredHistory.length > 0) {
|
|
6074
6100
|
setFocusedIndex(filteredHistory.length - 1);
|
|
6075
6101
|
}
|
|
@@ -6370,7 +6396,7 @@ var useOverflow = () => {
|
|
|
6370
6396
|
}
|
|
6371
6397
|
if (!node) return;
|
|
6372
6398
|
observerRef.current = new ResizeObserver((entries) => {
|
|
6373
|
-
const el = _optionalChain([entries, 'access',
|
|
6399
|
+
const el = _optionalChain([entries, 'access', _61 => _61.at, 'call', _62 => _62(0), 'optionalAccess', _63 => _63.target]);
|
|
6374
6400
|
if (!el) return;
|
|
6375
6401
|
setIsOverflow(el.scrollWidth > el.clientWidth);
|
|
6376
6402
|
});
|
|
@@ -6378,7 +6404,7 @@ var useOverflow = () => {
|
|
|
6378
6404
|
}, []);
|
|
6379
6405
|
_react.useEffect.call(void 0, () => {
|
|
6380
6406
|
return () => {
|
|
6381
|
-
_optionalChain([observerRef, 'access',
|
|
6407
|
+
_optionalChain([observerRef, 'access', _64 => _64.current, 'optionalAccess', _65 => _65.disconnect, 'call', _66 => _66()]);
|
|
6382
6408
|
};
|
|
6383
6409
|
}, []);
|
|
6384
6410
|
return { ref, isOverflow };
|
|
@@ -6488,8 +6514,8 @@ var SortableTab = ({ id }) => {
|
|
|
6488
6514
|
const [originalWidth, setOriginalWidth] = _react.useState.call(void 0, null);
|
|
6489
6515
|
const textRef = _react.useRef.call(void 0, null);
|
|
6490
6516
|
const { tabs } = useDatabrowserStore();
|
|
6491
|
-
const tabData = _optionalChain([tabs, 'access',
|
|
6492
|
-
const isPinned = _optionalChain([tabData, 'optionalAccess',
|
|
6517
|
+
const tabData = _optionalChain([tabs, 'access', _67 => _67.find, 'call', _68 => _68(([tabId]) => tabId === id), 'optionalAccess', _69 => _69[1]]);
|
|
6518
|
+
const isPinned = _optionalChain([tabData, 'optionalAccess', _70 => _70.pinned]);
|
|
6493
6519
|
const { attributes, listeners: listeners2, setNodeRef, transform, transition, isDragging } = _sortable.useSortable.call(void 0, {
|
|
6494
6520
|
id,
|
|
6495
6521
|
disabled: isPinned,
|
|
@@ -6709,7 +6735,7 @@ function AddTabButton() {
|
|
|
6709
6735
|
const tabsId = addTab();
|
|
6710
6736
|
selectTab(tabsId);
|
|
6711
6737
|
setTimeout(() => {
|
|
6712
|
-
const tab = _optionalChain([rootRef, 'optionalAccess',
|
|
6738
|
+
const tab = _optionalChain([rootRef, 'optionalAccess', _71 => _71.current, 'optionalAccess', _72 => _72.querySelector, 'call', _73 => _73(`#tab-${tabsId}`)]);
|
|
6713
6739
|
if (!tab) return;
|
|
6714
6740
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
6715
6741
|
}, 20);
|
|
@@ -6743,7 +6769,7 @@ function TabsListButton({
|
|
|
6743
6769
|
onSelectTab(id);
|
|
6744
6770
|
setOpen(false);
|
|
6745
6771
|
setTimeout(() => {
|
|
6746
|
-
const tab = _optionalChain([rootRef, 'optionalAccess',
|
|
6772
|
+
const tab = _optionalChain([rootRef, 'optionalAccess', _74 => _74.current, 'optionalAccess', _75 => _75.querySelector, 'call', _76 => _76(`#tab-${id}`)]);
|
|
6747
6773
|
if (!tab) return;
|
|
6748
6774
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
6749
6775
|
}, 20);
|
package/dist/index.mjs
CHANGED
|
@@ -263,15 +263,16 @@ var DatabrowserProvider = ({
|
|
|
263
263
|
removeItem: () => {
|
|
264
264
|
}
|
|
265
265
|
},
|
|
266
|
-
version:
|
|
266
|
+
version: 5,
|
|
267
267
|
migrate: (originalState, version) => {
|
|
268
268
|
const state = originalState;
|
|
269
269
|
if (version <= 1) {
|
|
270
270
|
state.tabs = state.tabs.map(([id, data]) => [id, { ...data, id }]);
|
|
271
271
|
}
|
|
272
|
-
if (version <=
|
|
272
|
+
if (version <= 4) {
|
|
273
273
|
state.tabs = state.tabs.map(([id, data]) => {
|
|
274
274
|
const oldData = data;
|
|
275
|
+
if (oldData.selectedKeys && Array.isArray(oldData.selectedKeys)) return [id, data];
|
|
275
276
|
return [
|
|
276
277
|
id,
|
|
277
278
|
{ ...data, selectedKeys: oldData.selectedKey ? [oldData.selectedKey] : [] }
|
|
@@ -506,9 +507,9 @@ var useTab = () => {
|
|
|
506
507
|
return useMemo3(
|
|
507
508
|
() => ({
|
|
508
509
|
active: selectedTab === tabId,
|
|
509
|
-
selectedKey: tabData.selectedKeys[0],
|
|
510
|
+
selectedKey: tabData.selectedKeys?.[0],
|
|
510
511
|
// Backwards compatibility - first selected key
|
|
511
|
-
selectedKeys: tabData.selectedKeys,
|
|
512
|
+
selectedKeys: tabData.selectedKeys ?? [],
|
|
512
513
|
selectedListItem: tabData.selectedListItem,
|
|
513
514
|
search: tabData.search,
|
|
514
515
|
pinned: tabData.pinned,
|
|
@@ -5133,7 +5134,13 @@ var handleCopyClick = async (textToCopy) => {
|
|
|
5133
5134
|
|
|
5134
5135
|
// src/components/databrowser/components/display/input/custom-editor.tsx
|
|
5135
5136
|
import { jsx as jsx32, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5136
|
-
var CustomEditor = ({
|
|
5137
|
+
var CustomEditor = (props) => {
|
|
5138
|
+
if (isTest) {
|
|
5139
|
+
return /* @__PURE__ */ jsx32(TestEditor, { ...props });
|
|
5140
|
+
}
|
|
5141
|
+
return /* @__PURE__ */ jsx32(MonacoEditor, { ...props });
|
|
5142
|
+
};
|
|
5143
|
+
var MonacoEditor = ({
|
|
5137
5144
|
language,
|
|
5138
5145
|
value,
|
|
5139
5146
|
onChange,
|
|
@@ -5198,7 +5205,26 @@ var CustomEditor = ({
|
|
|
5198
5205
|
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5199
5206
|
style: { height },
|
|
5200
5207
|
children: [
|
|
5201
|
-
|
|
5208
|
+
editor,
|
|
5209
|
+
showCopyButton && /* @__PURE__ */ jsx32(
|
|
5210
|
+
CopyButton,
|
|
5211
|
+
{
|
|
5212
|
+
value,
|
|
5213
|
+
className: "absolute right-0 top-0 hidden group-hover/editor:flex"
|
|
5214
|
+
}
|
|
5215
|
+
)
|
|
5216
|
+
]
|
|
5217
|
+
}
|
|
5218
|
+
);
|
|
5219
|
+
};
|
|
5220
|
+
var TestEditor = ({ value, onChange, height, showCopyButton }) => {
|
|
5221
|
+
return /* @__PURE__ */ jsxs19(
|
|
5222
|
+
"div",
|
|
5223
|
+
{
|
|
5224
|
+
className: cn("group/editor relative", height === void 0 && "h-full"),
|
|
5225
|
+
style: { height },
|
|
5226
|
+
children: [
|
|
5227
|
+
/* @__PURE__ */ jsx32("input", { "aria-label": "editor", value, onChange: (e) => onChange(e.target.value) }),
|
|
5202
5228
|
showCopyButton && /* @__PURE__ */ jsx32(
|
|
5203
5229
|
CopyButton,
|
|
5204
5230
|
{
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "@upstash/react-redis-browser", "version": "v0.2.
|
|
1
|
+
{ "name": "@upstash/react-redis-browser", "version": "v0.2.12", "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 ./src" }, "lint-staged": { "**/*.{js,ts,tsx}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/modifiers": "^9.0.0", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", "@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.1.14", "@radix-ui/react-dropdown-menu": "^2.1.15", "@radix-ui/react-label": "^2.1.7", "@radix-ui/react-popover": "^1.0.7", "@radix-ui/react-portal": "^1.1.2", "@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.35.8", "bytes": "^3.1.2", "cmdk": "^1.1.1", "react-hook-form": "^7.53.0", "react-resizable-panels": "^2.1.4", "zustand": "5.0.0" }, "devDependencies": { "@playwright/test": "^1.56.1", "@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", "dotenv": "^16.5.0", "eslint": "9.10.0", "eslint-plugin-unicorn": "55.0.0", "postcss": "^8.4.31", "postcss-prefix-selector": "^2.1.0", "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" } }
|