@upstash/react-redis-browser 0.2.12-canary → 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 +29 -29
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -507,9 +507,9 @@ var useTab = () => {
|
|
|
507
507
|
return _react.useMemo.call(void 0,
|
|
508
508
|
() => ({
|
|
509
509
|
active: selectedTab === tabId,
|
|
510
|
-
selectedKey: tabData.selectedKeys[0],
|
|
510
|
+
selectedKey: _optionalChain([tabData, 'access', _13 => _13.selectedKeys, 'optionalAccess', _14 => _14[0]]),
|
|
511
511
|
// Backwards compatibility - first selected key
|
|
512
|
-
selectedKeys: tabData.selectedKeys,
|
|
512
|
+
selectedKeys: _nullishCoalesce(tabData.selectedKeys, () => ( [])),
|
|
513
513
|
selectedListItem: tabData.selectedListItem,
|
|
514
514
|
search: tabData.search,
|
|
515
515
|
pinned: tabData.pinned,
|
|
@@ -603,15 +603,15 @@ var getGroupRecursive = (classParts, classPartObject) => {
|
|
|
603
603
|
return void 0;
|
|
604
604
|
}
|
|
605
605
|
const classRest = classParts.join(CLASS_PART_SEPARATOR);
|
|
606
|
-
return _optionalChain([classPartObject, 'access',
|
|
606
|
+
return _optionalChain([classPartObject, 'access', _15 => _15.validators, 'access', _16 => _16.find, 'call', _17 => _17(({
|
|
607
607
|
validator
|
|
608
|
-
}) => validator(classRest)), 'optionalAccess',
|
|
608
|
+
}) => validator(classRest)), 'optionalAccess', _18 => _18.classGroupId]);
|
|
609
609
|
};
|
|
610
610
|
var arbitraryPropertyRegex = /^\[(.+)\]$/;
|
|
611
611
|
var getGroupIdForArbitraryProperty = (className) => {
|
|
612
612
|
if (arbitraryPropertyRegex.test(className)) {
|
|
613
613
|
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
|
|
614
|
-
const property = _optionalChain([arbitraryPropertyClassName, 'optionalAccess',
|
|
614
|
+
const property = _optionalChain([arbitraryPropertyClassName, 'optionalAccess', _19 => _19.substring, 'call', _20 => _20(0, arbitraryPropertyClassName.indexOf(":"))]);
|
|
615
615
|
if (property) {
|
|
616
616
|
return "arbitrary.." + property;
|
|
617
617
|
}
|
|
@@ -3307,7 +3307,7 @@ var KeysProvider = ({ children }) => {
|
|
|
3307
3307
|
refetchOnMount: false
|
|
3308
3308
|
});
|
|
3309
3309
|
const keys = _react.useMemo.call(void 0, () => {
|
|
3310
|
-
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)]), () => ( []));
|
|
3311
3311
|
const keysSet = /* @__PURE__ */ new Set();
|
|
3312
3312
|
const dedupedKeys = [];
|
|
3313
3313
|
for (const key of keys2) {
|
|
@@ -3338,7 +3338,7 @@ var useKeys = () => {
|
|
|
3338
3338
|
var useKeyType = (key) => {
|
|
3339
3339
|
const { keys } = useKeys();
|
|
3340
3340
|
const keyTuple = _react.useMemo.call(void 0, () => keys.find(([k, _]) => k === key), [keys, key]);
|
|
3341
|
-
return _optionalChain([keyTuple, 'optionalAccess',
|
|
3341
|
+
return _optionalChain([keyTuple, 'optionalAccess', _25 => _25[1]]);
|
|
3342
3342
|
};
|
|
3343
3343
|
|
|
3344
3344
|
// src/components/databrowser/components/display/display-list.tsx
|
|
@@ -3582,7 +3582,7 @@ var useFetchListItems = ({ dataKey, type }) => {
|
|
|
3582
3582
|
// +1 since first message is the last one
|
|
3583
3583
|
LIST_DISPLAY_PAGE_SIZE + 1
|
|
3584
3584
|
);
|
|
3585
|
-
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;
|
|
3586
3586
|
return {
|
|
3587
3587
|
cursor: messages.length < LIST_DISPLAY_PAGE_SIZE ? void 0 : lastMessageId,
|
|
3588
3588
|
keys: messages.map(([id, fields]) => ({
|
|
@@ -3746,7 +3746,7 @@ var useEditListItem = () => {
|
|
|
3746
3746
|
}
|
|
3747
3747
|
case "stream": {
|
|
3748
3748
|
if (!isNew || !newKey) throw new Error("Stream data type is not mutable");
|
|
3749
|
-
const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess',
|
|
3749
|
+
const opts = transformArray(_nullishCoalesce(_optionalChain([newValue, 'optionalAccess', _29 => _29.split, 'call', _30 => _30("\n")]), () => ( []))).map(
|
|
3750
3750
|
({ key, value }) => [key, value]
|
|
3751
3751
|
);
|
|
3752
3752
|
pipe.xadd(dataKey, newKey, Object.fromEntries(opts));
|
|
@@ -3828,7 +3828,7 @@ var LengthBadge = ({
|
|
|
3828
3828
|
content
|
|
3829
3829
|
}) => {
|
|
3830
3830
|
const { data, isLoading } = useFetchKeyLength({ dataKey, type });
|
|
3831
|
-
const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess',
|
|
3831
|
+
const length = _nullishCoalesce(_optionalChain([content, 'optionalAccess', _31 => _31.length]), () => ( data));
|
|
3832
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 });
|
|
3833
3833
|
};
|
|
3834
3834
|
var SizeBadge = ({ dataKey }) => {
|
|
@@ -4512,7 +4512,7 @@ var ItemContextMenu = ({
|
|
|
4512
4512
|
editItem({
|
|
4513
4513
|
type,
|
|
4514
4514
|
dataKey,
|
|
4515
|
-
itemKey: _optionalChain([data, 'optionalAccess',
|
|
4515
|
+
itemKey: _optionalChain([data, 'optionalAccess', _32 => _32.key]),
|
|
4516
4516
|
// For deletion
|
|
4517
4517
|
newKey: void 0
|
|
4518
4518
|
});
|
|
@@ -4547,7 +4547,7 @@ var ItemContextMenu = ({
|
|
|
4547
4547
|
{
|
|
4548
4548
|
onClick: () => {
|
|
4549
4549
|
if (!data) return;
|
|
4550
|
-
navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess',
|
|
4550
|
+
navigator.clipboard.writeText(_optionalChain([data, 'optionalAccess', _33 => _33.key]));
|
|
4551
4551
|
toast({
|
|
4552
4552
|
description: "Key copied to clipboard"
|
|
4553
4553
|
});
|
|
@@ -4559,11 +4559,11 @@ var ItemContextMenu = ({
|
|
|
4559
4559
|
]
|
|
4560
4560
|
}
|
|
4561
4561
|
),
|
|
4562
|
-
_optionalChain([data, 'optionalAccess',
|
|
4562
|
+
_optionalChain([data, 'optionalAccess', _34 => _34.value]) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
4563
4563
|
ContextMenuItem,
|
|
4564
4564
|
{
|
|
4565
4565
|
onClick: () => {
|
|
4566
|
-
navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
4566
|
+
navigator.clipboard.writeText(_nullishCoalesce(_optionalChain([data, 'optionalAccess', _35 => _35.value]), () => ( "")));
|
|
4567
4567
|
toast({
|
|
4568
4568
|
description: "Value copied to clipboard"
|
|
4569
4569
|
});
|
|
@@ -5059,7 +5059,7 @@ var useSetHashTTL = () => {
|
|
|
5059
5059
|
var HashFieldTTLBadge = ({ dataKey, field }) => {
|
|
5060
5060
|
const { data } = useFetchHashFieldExpires({ dataKey, fields: [field] });
|
|
5061
5061
|
const { mutate: setTTL, isPending } = useSetHashTTL();
|
|
5062
|
-
const expireAt = _optionalChain([data, 'optionalAccess',
|
|
5062
|
+
const expireAt = _optionalChain([data, 'optionalAccess', _36 => _36[field]]);
|
|
5063
5063
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5064
5064
|
TTLBadge,
|
|
5065
5065
|
{
|
|
@@ -5156,7 +5156,7 @@ var MonacoEditor = ({
|
|
|
5156
5156
|
if (!active || !monaco || !editorRef.current) {
|
|
5157
5157
|
return;
|
|
5158
5158
|
}
|
|
5159
|
-
_optionalChain([monaco, 'optionalAccess',
|
|
5159
|
+
_optionalChain([monaco, 'optionalAccess', _37 => _37.editor, 'access', _38 => _38.setModelLanguage, 'call', _39 => _39(editorRef.current.getModel(), language)]);
|
|
5160
5160
|
}, [monaco, language, active]);
|
|
5161
5161
|
const editor = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
5162
5162
|
_react2.Editor,
|
|
@@ -5321,7 +5321,7 @@ var ListEditForm = ({
|
|
|
5321
5321
|
dataKey
|
|
5322
5322
|
});
|
|
5323
5323
|
const findValue = () => {
|
|
5324
|
-
for (const page of _nullishCoalesce(_optionalChain([query, 'access',
|
|
5324
|
+
for (const page of _nullishCoalesce(_optionalChain([query, 'access', _40 => _40.data, 'optionalAccess', _41 => _41.pages]), () => ( []))) {
|
|
5325
5325
|
const item = page.keys.find((item2) => item2.key === itemKey);
|
|
5326
5326
|
if (item && "value" in item) return item.value;
|
|
5327
5327
|
}
|
|
@@ -5467,7 +5467,7 @@ var HashFieldTTLInfo = ({
|
|
|
5467
5467
|
fields
|
|
5468
5468
|
}) => {
|
|
5469
5469
|
const { data } = useFetchHashFieldExpires({ dataKey, fields });
|
|
5470
|
-
const expireAt = _optionalChain([data, 'optionalAccess',
|
|
5470
|
+
const expireAt = _optionalChain([data, 'optionalAccess', _42 => _42[field]]);
|
|
5471
5471
|
const [ttl, setTTL] = _react.useState.call(void 0, () => calculateTTL(expireAt));
|
|
5472
5472
|
_react.useEffect.call(void 0, () => {
|
|
5473
5473
|
setTTL(calculateTTL(expireAt));
|
|
@@ -5504,7 +5504,7 @@ var ListItems = ({
|
|
|
5504
5504
|
dataKey
|
|
5505
5505
|
}) => {
|
|
5506
5506
|
const { setSelectedListItem } = useTab();
|
|
5507
|
-
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]);
|
|
5508
5508
|
const fields = _react.useMemo.call(void 0, () => keys.map((key) => key.key), [keys]);
|
|
5509
5509
|
const { mutate: editItem } = useEditListItem();
|
|
5510
5510
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: keys.map(({ key, value }, i) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -5762,7 +5762,7 @@ function AddKeyModal() {
|
|
|
5762
5762
|
setSelectedKey(key);
|
|
5763
5763
|
setOpen(false);
|
|
5764
5764
|
setTimeout(() => {
|
|
5765
|
-
_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({
|
|
5766
5766
|
behavior: "smooth",
|
|
5767
5767
|
block: "start",
|
|
5768
5768
|
inline: "nearest"
|
|
@@ -5807,7 +5807,7 @@ function AddKeyModal() {
|
|
|
5807
5807
|
}
|
|
5808
5808
|
)
|
|
5809
5809
|
] }),
|
|
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',
|
|
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]) }),
|
|
5811
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" }),
|
|
5812
5812
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mt-6 flex justify-end gap-2", children: [
|
|
5813
5813
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -6081,7 +6081,7 @@ var SearchInput = () => {
|
|
|
6081
6081
|
} else if (e.key === "Escape") {
|
|
6082
6082
|
setState("");
|
|
6083
6083
|
setFocusedIndex(-1);
|
|
6084
|
-
_optionalChain([inputRef, 'access',
|
|
6084
|
+
_optionalChain([inputRef, 'access', _55 => _55.current, 'optionalAccess', _56 => _56.blur, 'call', _57 => _57()]);
|
|
6085
6085
|
} else if (e.key === "ArrowDown" || e.key === "Tab" && !e.shiftKey) {
|
|
6086
6086
|
e.preventDefault();
|
|
6087
6087
|
if (focusedIndex < filteredHistory.length - 1) {
|
|
@@ -6095,7 +6095,7 @@ var SearchInput = () => {
|
|
|
6095
6095
|
setFocusedIndex(focusedIndex - 1);
|
|
6096
6096
|
} else if (filteredHistory.length > 0 && focusedIndex === 0) {
|
|
6097
6097
|
setFocusedIndex(-1);
|
|
6098
|
-
_optionalChain([inputRef, 'access',
|
|
6098
|
+
_optionalChain([inputRef, 'access', _58 => _58.current, 'optionalAccess', _59 => _59.focus, 'call', _60 => _60()]);
|
|
6099
6099
|
} else if (filteredHistory.length > 0) {
|
|
6100
6100
|
setFocusedIndex(filteredHistory.length - 1);
|
|
6101
6101
|
}
|
|
@@ -6396,7 +6396,7 @@ var useOverflow = () => {
|
|
|
6396
6396
|
}
|
|
6397
6397
|
if (!node) return;
|
|
6398
6398
|
observerRef.current = new ResizeObserver((entries) => {
|
|
6399
|
-
const el = _optionalChain([entries, 'access',
|
|
6399
|
+
const el = _optionalChain([entries, 'access', _61 => _61.at, 'call', _62 => _62(0), 'optionalAccess', _63 => _63.target]);
|
|
6400
6400
|
if (!el) return;
|
|
6401
6401
|
setIsOverflow(el.scrollWidth > el.clientWidth);
|
|
6402
6402
|
});
|
|
@@ -6404,7 +6404,7 @@ var useOverflow = () => {
|
|
|
6404
6404
|
}, []);
|
|
6405
6405
|
_react.useEffect.call(void 0, () => {
|
|
6406
6406
|
return () => {
|
|
6407
|
-
_optionalChain([observerRef, 'access',
|
|
6407
|
+
_optionalChain([observerRef, 'access', _64 => _64.current, 'optionalAccess', _65 => _65.disconnect, 'call', _66 => _66()]);
|
|
6408
6408
|
};
|
|
6409
6409
|
}, []);
|
|
6410
6410
|
return { ref, isOverflow };
|
|
@@ -6514,8 +6514,8 @@ var SortableTab = ({ id }) => {
|
|
|
6514
6514
|
const [originalWidth, setOriginalWidth] = _react.useState.call(void 0, null);
|
|
6515
6515
|
const textRef = _react.useRef.call(void 0, null);
|
|
6516
6516
|
const { tabs } = useDatabrowserStore();
|
|
6517
|
-
const tabData = _optionalChain([tabs, 'access',
|
|
6518
|
-
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]);
|
|
6519
6519
|
const { attributes, listeners: listeners2, setNodeRef, transform, transition, isDragging } = _sortable.useSortable.call(void 0, {
|
|
6520
6520
|
id,
|
|
6521
6521
|
disabled: isPinned,
|
|
@@ -6735,7 +6735,7 @@ function AddTabButton() {
|
|
|
6735
6735
|
const tabsId = addTab();
|
|
6736
6736
|
selectTab(tabsId);
|
|
6737
6737
|
setTimeout(() => {
|
|
6738
|
-
const tab = _optionalChain([rootRef, 'optionalAccess',
|
|
6738
|
+
const tab = _optionalChain([rootRef, 'optionalAccess', _71 => _71.current, 'optionalAccess', _72 => _72.querySelector, 'call', _73 => _73(`#tab-${tabsId}`)]);
|
|
6739
6739
|
if (!tab) return;
|
|
6740
6740
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
6741
6741
|
}, 20);
|
|
@@ -6769,7 +6769,7 @@ function TabsListButton({
|
|
|
6769
6769
|
onSelectTab(id);
|
|
6770
6770
|
setOpen(false);
|
|
6771
6771
|
setTimeout(() => {
|
|
6772
|
-
const tab = _optionalChain([rootRef, 'optionalAccess',
|
|
6772
|
+
const tab = _optionalChain([rootRef, 'optionalAccess', _74 => _74.current, 'optionalAccess', _75 => _75.querySelector, 'call', _76 => _76(`#tab-${id}`)]);
|
|
6773
6773
|
if (!tab) return;
|
|
6774
6774
|
tab.scrollIntoView({ behavior: "smooth" });
|
|
6775
6775
|
}, 20);
|
package/dist/index.mjs
CHANGED
|
@@ -507,9 +507,9 @@ var useTab = () => {
|
|
|
507
507
|
return useMemo3(
|
|
508
508
|
() => ({
|
|
509
509
|
active: selectedTab === tabId,
|
|
510
|
-
selectedKey: tabData.selectedKeys[0],
|
|
510
|
+
selectedKey: tabData.selectedKeys?.[0],
|
|
511
511
|
// Backwards compatibility - first selected key
|
|
512
|
-
selectedKeys: tabData.selectedKeys,
|
|
512
|
+
selectedKeys: tabData.selectedKeys ?? [],
|
|
513
513
|
selectedListItem: tabData.selectedListItem,
|
|
514
514
|
search: tabData.search,
|
|
515
515
|
pinned: tabData.pinned,
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "@upstash/react-redis-browser", "version": "v0.2.12
|
|
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" } }
|