@buoy-gg/zustand 3.0.0 → 3.0.2

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.
@@ -112,6 +112,21 @@ function StoreExpandedContent({
112
112
  })]
113
113
  });
114
114
  }
115
+ function LoadingBrowserState() {
116
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
117
+ style: styles.emptyState,
118
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
119
+ size: "small",
120
+ color: _sharedUi.macOSColors.text.muted
121
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
122
+ style: styles.emptyTitle,
123
+ children: "Loading stores\u2026"
124
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
125
+ style: styles.emptyText,
126
+ children: "Waiting for the device to send its registered stores."
127
+ })]
128
+ });
129
+ }
115
130
  function EmptyBrowserState() {
116
131
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
117
132
  style: styles.emptyState,
@@ -130,7 +145,8 @@ function EmptyBrowserState() {
130
145
  function ZustandStoreBrowser({
131
146
  stores,
132
147
  searchQuery,
133
- onViewHistory
148
+ onViewHistory,
149
+ isLoading = false
134
150
  }) {
135
151
  const [expandedStore, setExpandedStore] = (0, _react.useState)(null);
136
152
 
@@ -144,7 +160,7 @@ function ZustandStoreBrowser({
144
160
  setExpandedStore(prev => prev === store.name ? null : store.name);
145
161
  }, []);
146
162
  if (filteredStores.length === 0 && !searchQuery) {
147
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyBrowserState, {});
163
+ return isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(LoadingBrowserState, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyBrowserState, {});
148
164
  }
149
165
  if (filteredStores.length === 0 && searchQuery) {
150
166
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import { useState, useMemo, useCallback } from "react";
14
- import { View, Text, StyleSheet, ScrollView, TouchableOpacity } from "react-native";
14
+ import { View, Text, StyleSheet, ScrollView, TouchableOpacity, ActivityIndicator } from "react-native";
15
15
  import { CompactRow, macOSColors, buoyColors, Database, parseValue, Box, ExpandedInfoRow, PillBadge } from "@buoy-gg/shared-ui";
16
16
  import { DataViewer } from "@buoy-gg/shared-ui/dataViewer";
17
17
  import { zustandStateStore } from "../utils/zustandStateStore";
@@ -108,6 +108,21 @@ function StoreExpandedContent({
108
108
  })]
109
109
  });
110
110
  }
111
+ function LoadingBrowserState() {
112
+ return /*#__PURE__*/_jsxs(View, {
113
+ style: styles.emptyState,
114
+ children: [/*#__PURE__*/_jsx(ActivityIndicator, {
115
+ size: "small",
116
+ color: macOSColors.text.muted
117
+ }), /*#__PURE__*/_jsx(Text, {
118
+ style: styles.emptyTitle,
119
+ children: "Loading stores\u2026"
120
+ }), /*#__PURE__*/_jsx(Text, {
121
+ style: styles.emptyText,
122
+ children: "Waiting for the device to send its registered stores."
123
+ })]
124
+ });
125
+ }
111
126
  function EmptyBrowserState() {
112
127
  return /*#__PURE__*/_jsxs(View, {
113
128
  style: styles.emptyState,
@@ -126,7 +141,8 @@ function EmptyBrowserState() {
126
141
  export function ZustandStoreBrowser({
127
142
  stores,
128
143
  searchQuery,
129
- onViewHistory
144
+ onViewHistory,
145
+ isLoading = false
130
146
  }) {
131
147
  const [expandedStore, setExpandedStore] = useState(null);
132
148
 
@@ -140,7 +156,7 @@ export function ZustandStoreBrowser({
140
156
  setExpandedStore(prev => prev === store.name ? null : store.name);
141
157
  }, []);
142
158
  if (filteredStores.length === 0 && !searchQuery) {
143
- return /*#__PURE__*/_jsx(EmptyBrowserState, {});
159
+ return isLoading ? /*#__PURE__*/_jsx(LoadingBrowserState, {}) : /*#__PURE__*/_jsx(EmptyBrowserState, {});
144
160
  }
145
161
  if (filteredStores.length === 0 && searchQuery) {
146
162
  return /*#__PURE__*/_jsxs(View, {
@@ -12,7 +12,14 @@ interface ZustandStoreBrowserProps {
12
12
  stores: ZustandStoreInfo[];
13
13
  searchQuery: string;
14
14
  onViewHistory: (storeName: string) => void;
15
+ /**
16
+ * True while we're still waiting for the device's first stores snapshot.
17
+ * Lets the browser show a loading state instead of the "no stores"
18
+ * empty state on first load (stores arrive a few seconds after the
19
+ * watch handshake).
20
+ */
21
+ isLoading?: boolean;
15
22
  }
16
- export declare function ZustandStoreBrowser({ stores, searchQuery, onViewHistory, }: ZustandStoreBrowserProps): import("react").JSX.Element;
23
+ export declare function ZustandStoreBrowser({ stores, searchQuery, onViewHistory, isLoading, }: ZustandStoreBrowserProps): import("react").JSX.Element;
17
24
  export {};
18
25
  //# sourceMappingURL=ZustandStoreBrowser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ZustandStoreBrowser.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandStoreBrowser.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAeH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,UAAU,wBAAwB;IAChC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAsGD,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,WAAW,EACX,aAAa,GACd,EAAE,wBAAwB,+BA4F1B"}
1
+ {"version":3,"file":"ZustandStoreBrowser.d.ts","sourceRoot":"","sources":["../../../../src/zustand/components/ZustandStoreBrowser.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAsBH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,UAAU,wBAAwB;IAChC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAkHD,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,WAAW,EACX,aAAa,EACb,SAAiB,GAClB,EAAE,wBAAwB,+BA4F1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/zustand",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Zustand store DevTools for React Native",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -26,8 +26,8 @@
26
26
  ],
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@buoy-gg/shared-ui": "3.0.0",
30
- "@buoy-gg/license": "3.0.0"
29
+ "@buoy-gg/license": "3.0.2",
30
+ "@buoy-gg/shared-ui": "3.0.2"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "*",