@buoy-gg/react-query 1.7.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.
- package/README.md +389 -0
- package/lib/commonjs/index.js +107 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/preset.js +220 -0
- package/lib/commonjs/react-query/ReactQueryDevTools.js +335 -0
- package/lib/commonjs/react-query/components/DataEditorMode.js +316 -0
- package/lib/commonjs/react-query/components/FilterStatusBadge.js +51 -0
- package/lib/commonjs/react-query/components/MutationBrowserMode.js +51 -0
- package/lib/commonjs/react-query/components/MutationEditorMode.js +257 -0
- package/lib/commonjs/react-query/components/QueryBrowserMode.js +82 -0
- package/lib/commonjs/react-query/components/QueryDebugInfo.js +107 -0
- package/lib/commonjs/react-query/components/QueryFilterViewV3.js +221 -0
- package/lib/commonjs/react-query/components/QuerySelector.js +208 -0
- package/lib/commonjs/react-query/components/ReactQueryDevToolsModal.js +76 -0
- package/lib/commonjs/react-query/components/ReactQuerySection.js +47 -0
- package/lib/commonjs/react-query/components/WifiToggle.js +49 -0
- package/lib/commonjs/react-query/components/index.js +253 -0
- package/lib/commonjs/react-query/components/modals/DataEditorModal.js +70 -0
- package/lib/commonjs/react-query/components/modals/MutationBrowserFooter.js +69 -0
- package/lib/commonjs/react-query/components/modals/MutationBrowserModal.js +146 -0
- package/lib/commonjs/react-query/components/modals/MutationEditorModal.js +58 -0
- package/lib/commonjs/react-query/components/modals/QueryBrowserFooter.js +63 -0
- package/lib/commonjs/react-query/components/modals/QueryBrowserModal.js +237 -0
- package/lib/commonjs/react-query/components/modals/ReactQueryModal.js +83 -0
- package/lib/commonjs/react-query/components/modals/ReactQueryModalHeader.js +171 -0
- package/lib/commonjs/react-query/components/modals/SwipeIndicator.js +204 -0
- package/lib/commonjs/react-query/components/query-browser/ActionButton.js +127 -0
- package/lib/commonjs/react-query/components/query-browser/ClearCacheButton.js +53 -0
- package/lib/commonjs/react-query/components/query-browser/Explorer.js +985 -0
- package/lib/commonjs/react-query/components/query-browser/MutationButton.js +184 -0
- package/lib/commonjs/react-query/components/query-browser/MutationDetails.js +122 -0
- package/lib/commonjs/react-query/components/query-browser/MutationDetailsChips.js +66 -0
- package/lib/commonjs/react-query/components/query-browser/MutationInformation.js +117 -0
- package/lib/commonjs/react-query/components/query-browser/MutationStatusCount.js +111 -0
- package/lib/commonjs/react-query/components/query-browser/MutationsList.js +212 -0
- package/lib/commonjs/react-query/components/query-browser/NetworkToggleButton.js +54 -0
- package/lib/commonjs/react-query/components/query-browser/QueryActions.js +138 -0
- package/lib/commonjs/react-query/components/query-browser/QueryBrowser.js +146 -0
- package/lib/commonjs/react-query/components/query-browser/QueryDetails.js +137 -0
- package/lib/commonjs/react-query/components/query-browser/QueryDetailsChip.js +76 -0
- package/lib/commonjs/react-query/components/query-browser/QueryInformation.js +94 -0
- package/lib/commonjs/react-query/components/query-browser/QueryRow.js +93 -0
- package/lib/commonjs/react-query/components/query-browser/QueryStatus.js +125 -0
- package/lib/commonjs/react-query/components/query-browser/QueryStatusCount.js +130 -0
- package/lib/commonjs/react-query/components/query-browser/StorageStatusCount.js +106 -0
- package/lib/commonjs/react-query/components/query-browser/index.js +170 -0
- package/lib/commonjs/react-query/components/query-browser/svgs.js +74 -0
- package/lib/commonjs/react-query/hooks/index.js +96 -0
- package/lib/commonjs/react-query/hooks/useActionButtons.js +59 -0
- package/lib/commonjs/react-query/hooks/useAllMutations.js +35 -0
- package/lib/commonjs/react-query/hooks/useAllQueries.js +117 -0
- package/lib/commonjs/react-query/hooks/useModalManager.js +178 -0
- package/lib/commonjs/react-query/hooks/useModalPersistence.js +71 -0
- package/lib/commonjs/react-query/hooks/useMutationActionButtons.js +22 -0
- package/lib/commonjs/react-query/hooks/useQueryStatusCounts.js +110 -0
- package/lib/commonjs/react-query/hooks/useReactQueryState.js +24 -0
- package/lib/commonjs/react-query/hooks/useSelectedMutation.js +30 -0
- package/lib/commonjs/react-query/hooks/useSelectedQuery.js +96 -0
- package/lib/commonjs/react-query/hooks/useStorageQueryCounts.js +28 -0
- package/lib/commonjs/react-query/hooks/useWifiState.js +67 -0
- package/lib/commonjs/react-query/index.js +16 -0
- package/lib/commonjs/react-query/types/index.js +16 -0
- package/lib/commonjs/react-query/types/types.js +14 -0
- package/lib/commonjs/react-query/utils/actions/deleteItem.js +23 -0
- package/lib/commonjs/react-query/utils/actions/invalidate.js +13 -0
- package/lib/commonjs/react-query/utils/actions/refetch.js +15 -0
- package/lib/commonjs/react-query/utils/actions/remove.js +12 -0
- package/lib/commonjs/react-query/utils/actions/reset.js +15 -0
- package/lib/commonjs/react-query/utils/actions/triggerError.js +30 -0
- package/lib/commonjs/react-query/utils/actions/triggerLoading.js +51 -0
- package/lib/commonjs/react-query/utils/deleteNestedDataByPath.js +56 -0
- package/lib/commonjs/react-query/utils/formatRelativeTime.js +29 -0
- package/lib/commonjs/react-query/utils/getQueryStatusColor.js +16 -0
- package/lib/commonjs/react-query/utils/getQueryStatusLabel.js +17 -0
- package/lib/commonjs/react-query/utils/getStorageQueryCounts.js +35 -0
- package/lib/commonjs/react-query/utils/index.js +170 -0
- package/lib/commonjs/react-query/utils/modalStorageOperations.js +127 -0
- package/lib/commonjs/react-query/utils/storageQueryUtils.js +149 -0
- package/lib/commonjs/react-query/utils/updateNestedDataByPath.js +61 -0
- package/lib/module/index.js +19 -0
- package/lib/module/preset.js +216 -0
- package/lib/module/react-query/ReactQueryDevTools.js +68 -0
- package/lib/module/react-query/components/DataEditorMode.js +310 -0
- package/lib/module/react-query/components/FilterStatusBadge.js +47 -0
- package/lib/module/react-query/components/MutationBrowserMode.js +46 -0
- package/lib/module/react-query/components/MutationEditorMode.js +252 -0
- package/lib/module/react-query/components/QueryBrowserMode.js +77 -0
- package/lib/module/react-query/components/QueryDebugInfo.js +104 -0
- package/lib/module/react-query/components/QueryFilterViewV3.js +218 -0
- package/lib/module/react-query/components/QuerySelector.js +204 -0
- package/lib/module/react-query/components/ReactQueryDevToolsModal.js +72 -0
- package/lib/module/react-query/components/ReactQuerySection.js +43 -0
- package/lib/module/react-query/components/WifiToggle.js +46 -0
- package/lib/module/react-query/components/index.js +29 -0
- package/lib/module/react-query/components/modals/DataEditorModal.js +66 -0
- package/lib/module/react-query/components/modals/MutationBrowserFooter.js +64 -0
- package/lib/module/react-query/components/modals/MutationBrowserModal.js +143 -0
- package/lib/module/react-query/components/modals/MutationEditorModal.js +54 -0
- package/lib/module/react-query/components/modals/QueryBrowserFooter.js +58 -0
- package/lib/module/react-query/components/modals/QueryBrowserModal.js +233 -0
- package/lib/module/react-query/components/modals/ReactQueryModal.js +79 -0
- package/lib/module/react-query/components/modals/ReactQueryModalHeader.js +167 -0
- package/lib/module/react-query/components/modals/SwipeIndicator.js +200 -0
- package/lib/module/react-query/components/query-browser/ActionButton.js +124 -0
- package/lib/module/react-query/components/query-browser/ClearCacheButton.js +49 -0
- package/lib/module/react-query/components/query-browser/Explorer.js +983 -0
- package/lib/module/react-query/components/query-browser/MutationButton.js +180 -0
- package/lib/module/react-query/components/query-browser/MutationDetails.js +117 -0
- package/lib/module/react-query/components/query-browser/MutationDetailsChips.js +62 -0
- package/lib/module/react-query/components/query-browser/MutationInformation.js +112 -0
- package/lib/module/react-query/components/query-browser/MutationStatusCount.js +106 -0
- package/lib/module/react-query/components/query-browser/MutationsList.js +207 -0
- package/lib/module/react-query/components/query-browser/NetworkToggleButton.js +50 -0
- package/lib/module/react-query/components/query-browser/QueryActions.js +133 -0
- package/lib/module/react-query/components/query-browser/QueryBrowser.js +141 -0
- package/lib/module/react-query/components/query-browser/QueryDetails.js +132 -0
- package/lib/module/react-query/components/query-browser/QueryDetailsChip.js +72 -0
- package/lib/module/react-query/components/query-browser/QueryInformation.js +89 -0
- package/lib/module/react-query/components/query-browser/QueryRow.js +89 -0
- package/lib/module/react-query/components/query-browser/QueryStatus.js +121 -0
- package/lib/module/react-query/components/query-browser/QueryStatusCount.js +125 -0
- package/lib/module/react-query/components/query-browser/StorageStatusCount.js +101 -0
- package/lib/module/react-query/components/query-browser/index.js +22 -0
- package/lib/module/react-query/components/query-browser/svgs.js +66 -0
- package/lib/module/react-query/hooks/index.js +23 -0
- package/lib/module/react-query/hooks/useActionButtons.js +54 -0
- package/lib/module/react-query/hooks/useAllMutations.js +32 -0
- package/lib/module/react-query/hooks/useAllQueries.js +114 -0
- package/lib/module/react-query/hooks/useModalManager.js +175 -0
- package/lib/module/react-query/hooks/useModalPersistence.js +67 -0
- package/lib/module/react-query/hooks/useMutationActionButtons.js +18 -0
- package/lib/module/react-query/hooks/useQueryStatusCounts.js +108 -0
- package/lib/module/react-query/hooks/useReactQueryState.js +20 -0
- package/lib/module/react-query/hooks/useSelectedMutation.js +27 -0
- package/lib/module/react-query/hooks/useSelectedQuery.js +92 -0
- package/lib/module/react-query/hooks/useStorageQueryCounts.js +25 -0
- package/lib/module/react-query/hooks/useWifiState.js +64 -0
- package/lib/module/react-query/index.js +3 -0
- package/lib/module/react-query/types/index.js +3 -0
- package/lib/module/react-query/types/types.js +10 -0
- package/lib/module/react-query/utils/actions/deleteItem.js +19 -0
- package/lib/module/react-query/utils/actions/invalidate.js +9 -0
- package/lib/module/react-query/utils/actions/refetch.js +11 -0
- package/lib/module/react-query/utils/actions/remove.js +8 -0
- package/lib/module/react-query/utils/actions/reset.js +11 -0
- package/lib/module/react-query/utils/actions/triggerError.js +26 -0
- package/lib/module/react-query/utils/actions/triggerLoading.js +47 -0
- package/lib/module/react-query/utils/deleteNestedDataByPath.js +51 -0
- package/lib/module/react-query/utils/formatRelativeTime.js +25 -0
- package/lib/module/react-query/utils/getQueryStatusColor.js +12 -0
- package/lib/module/react-query/utils/getQueryStatusLabel.js +13 -0
- package/lib/module/react-query/utils/getStorageQueryCounts.js +31 -0
- package/lib/module/react-query/utils/index.js +27 -0
- package/lib/module/react-query/utils/modalStorageOperations.js +117 -0
- package/lib/module/react-query/utils/storageQueryUtils.js +140 -0
- package/lib/module/react-query/utils/updateNestedDataByPath.js +56 -0
- package/lib/typescript/index.d.ts +7 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts +160 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/react-query/ReactQueryDevTools.d.ts +45 -0
- package/lib/typescript/react-query/ReactQueryDevTools.d.ts.map +1 -0
- package/lib/typescript/react-query/components/DataEditorMode.d.ts +25 -0
- package/lib/typescript/react-query/components/DataEditorMode.d.ts.map +1 -0
- package/lib/typescript/react-query/components/FilterStatusBadge.d.ts +12 -0
- package/lib/typescript/react-query/components/FilterStatusBadge.d.ts.map +1 -0
- package/lib/typescript/react-query/components/MutationBrowserMode.d.ts +14 -0
- package/lib/typescript/react-query/components/MutationBrowserMode.d.ts.map +1 -0
- package/lib/typescript/react-query/components/MutationEditorMode.d.ts +12 -0
- package/lib/typescript/react-query/components/MutationEditorMode.d.ts.map +1 -0
- package/lib/typescript/react-query/components/QueryBrowserMode.d.ts +14 -0
- package/lib/typescript/react-query/components/QueryBrowserMode.d.ts.map +1 -0
- package/lib/typescript/react-query/components/QueryDebugInfo.d.ts +6 -0
- package/lib/typescript/react-query/components/QueryDebugInfo.d.ts.map +1 -0
- package/lib/typescript/react-query/components/QueryFilterViewV3.d.ts +17 -0
- package/lib/typescript/react-query/components/QueryFilterViewV3.d.ts.map +1 -0
- package/lib/typescript/react-query/components/QuerySelector.d.ts +15 -0
- package/lib/typescript/react-query/components/QuerySelector.d.ts.map +1 -0
- package/lib/typescript/react-query/components/ReactQueryDevToolsModal.d.ts +19 -0
- package/lib/typescript/react-query/components/ReactQueryDevToolsModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/ReactQuerySection.d.ts +11 -0
- package/lib/typescript/react-query/components/ReactQuerySection.d.ts.map +1 -0
- package/lib/typescript/react-query/components/WifiToggle.d.ts +8 -0
- package/lib/typescript/react-query/components/WifiToggle.d.ts.map +1 -0
- package/lib/typescript/react-query/components/index.d.ts +21 -0
- package/lib/typescript/react-query/components/index.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/DataEditorModal.d.ts +17 -0
- package/lib/typescript/react-query/components/modals/DataEditorModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/MutationBrowserFooter.d.ts +17 -0
- package/lib/typescript/react-query/components/modals/MutationBrowserFooter.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/MutationBrowserModal.d.ts +21 -0
- package/lib/typescript/react-query/components/modals/MutationBrowserModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/MutationEditorModal.d.ts +17 -0
- package/lib/typescript/react-query/components/modals/MutationEditorModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/QueryBrowserFooter.d.ts +16 -0
- package/lib/typescript/react-query/components/modals/QueryBrowserFooter.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/QueryBrowserModal.d.ts +21 -0
- package/lib/typescript/react-query/components/modals/QueryBrowserModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/ReactQueryModal.d.ts +29 -0
- package/lib/typescript/react-query/components/modals/ReactQueryModal.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/ReactQueryModalHeader.d.ts +19 -0
- package/lib/typescript/react-query/components/modals/ReactQueryModalHeader.d.ts.map +1 -0
- package/lib/typescript/react-query/components/modals/SwipeIndicator.d.ts +14 -0
- package/lib/typescript/react-query/components/modals/SwipeIndicator.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts +49 -0
- package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/ClearCacheButton.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/ClearCacheButton.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/Explorer.d.ts +19 -0
- package/lib/typescript/react-query/components/query-browser/Explorer.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationButton.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/MutationButton.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationDetails.d.ts +10 -0
- package/lib/typescript/react-query/components/query-browser/MutationDetails.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationDetailsChips.d.ts +10 -0
- package/lib/typescript/react-query/components/query-browser/MutationDetailsChips.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationInformation.d.ts +8 -0
- package/lib/typescript/react-query/components/query-browser/MutationInformation.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationStatusCount.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/MutationStatusCount.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/MutationsList.d.ts +17 -0
- package/lib/typescript/react-query/components/query-browser/MutationsList.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/NetworkToggleButton.d.ts +11 -0
- package/lib/typescript/react-query/components/query-browser/NetworkToggleButton.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryActions.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/QueryActions.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryBrowser.d.ts +19 -0
- package/lib/typescript/react-query/components/query-browser/QueryBrowser.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryDetails.d.ts +10 -0
- package/lib/typescript/react-query/components/query-browser/QueryDetails.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryDetailsChip.d.ts +10 -0
- package/lib/typescript/react-query/components/query-browser/QueryDetailsChip.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryInformation.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/QueryInformation.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryRow.d.ts +12 -0
- package/lib/typescript/react-query/components/query-browser/QueryRow.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryStatus.d.ts +17 -0
- package/lib/typescript/react-query/components/query-browser/QueryStatus.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/QueryStatusCount.d.ts +11 -0
- package/lib/typescript/react-query/components/query-browser/QueryStatusCount.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/StorageStatusCount.d.ts +18 -0
- package/lib/typescript/react-query/components/query-browser/StorageStatusCount.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/index.d.ts +21 -0
- package/lib/typescript/react-query/components/query-browser/index.d.ts.map +1 -0
- package/lib/typescript/react-query/components/query-browser/svgs.d.ts +17 -0
- package/lib/typescript/react-query/components/query-browser/svgs.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/index.d.ts +13 -0
- package/lib/typescript/react-query/hooks/index.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useActionButtons.d.ts +21 -0
- package/lib/typescript/react-query/hooks/useActionButtons.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useAllMutations.d.ts +10 -0
- package/lib/typescript/react-query/hooks/useAllMutations.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useAllQueries.d.ts +12 -0
- package/lib/typescript/react-query/hooks/useAllQueries.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useModalManager.d.ts +39 -0
- package/lib/typescript/react-query/hooks/useModalManager.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useModalPersistence.d.ts +29 -0
- package/lib/typescript/react-query/hooks/useModalPersistence.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts +15 -0
- package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useQueryStatusCounts.d.ts +25 -0
- package/lib/typescript/react-query/hooks/useQueryStatusCounts.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useReactQueryState.d.ts +9 -0
- package/lib/typescript/react-query/hooks/useReactQueryState.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useSelectedMutation.d.ts +7 -0
- package/lib/typescript/react-query/hooks/useSelectedMutation.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useSelectedQuery.d.ts +25 -0
- package/lib/typescript/react-query/hooks/useSelectedQuery.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useStorageQueryCounts.d.ts +10 -0
- package/lib/typescript/react-query/hooks/useStorageQueryCounts.d.ts.map +1 -0
- package/lib/typescript/react-query/hooks/useWifiState.d.ts +9 -0
- package/lib/typescript/react-query/hooks/useWifiState.d.ts.map +1 -0
- package/lib/typescript/react-query/index.d.ts +2 -0
- package/lib/typescript/react-query/index.d.ts.map +1 -0
- package/lib/typescript/react-query/types/index.d.ts +2 -0
- package/lib/typescript/react-query/types/index.d.ts.map +1 -0
- package/lib/typescript/react-query/types/types.d.ts +10 -0
- package/lib/typescript/react-query/types/types.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/deleteItem.d.ts +9 -0
- package/lib/typescript/react-query/utils/actions/deleteItem.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/invalidate.d.ts +8 -0
- package/lib/typescript/react-query/utils/actions/invalidate.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/refetch.d.ts +7 -0
- package/lib/typescript/react-query/utils/actions/refetch.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/remove.d.ts +8 -0
- package/lib/typescript/react-query/utils/actions/remove.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/reset.d.ts +8 -0
- package/lib/typescript/react-query/utils/actions/reset.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/triggerError.d.ts +8 -0
- package/lib/typescript/react-query/utils/actions/triggerError.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/actions/triggerLoading.d.ts +7 -0
- package/lib/typescript/react-query/utils/actions/triggerLoading.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/deleteNestedDataByPath.d.ts +9 -0
- package/lib/typescript/react-query/utils/deleteNestedDataByPath.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/formatRelativeTime.d.ts +7 -0
- package/lib/typescript/react-query/utils/formatRelativeTime.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/getQueryStatusColor.d.ts +10 -0
- package/lib/typescript/react-query/utils/getQueryStatusColor.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/getQueryStatusLabel.d.ts +9 -0
- package/lib/typescript/react-query/utils/getQueryStatusLabel.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/getStorageQueryCounts.d.ts +13 -0
- package/lib/typescript/react-query/utils/getStorageQueryCounts.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/index.d.ts +17 -0
- package/lib/typescript/react-query/utils/index.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/modalStorageOperations.d.ts +55 -0
- package/lib/typescript/react-query/utils/modalStorageOperations.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/storageQueryUtils.d.ts +69 -0
- package/lib/typescript/react-query/utils/storageQueryUtils.d.ts.map +1 -0
- package/lib/typescript/react-query/utils/updateNestedDataByPath.d.ts +10 -0
- package/lib/typescript/react-query/utils/updateNestedDataByPath.d.ts.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState, useRef } from "react";
|
|
4
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Custom hook to track a single query by its queryKey with live updates
|
|
8
|
+
* Optimized to only re-render when the specific query changes
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Returns a single query instance matching the provided key and resubscribes whenever the cache
|
|
13
|
+
* entry changes. Ideal for detail panes where live updates are required without scanning the
|
|
14
|
+
* entire query cache.
|
|
15
|
+
*/
|
|
16
|
+
export function useGetQueryByQueryKey(queryKey) {
|
|
17
|
+
const {
|
|
18
|
+
query
|
|
19
|
+
} = useGetQueryByQueryKeyWithVersion(queryKey);
|
|
20
|
+
return query;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns a single query instance with a version number that increments on each cache update.
|
|
25
|
+
* Use the version as a dependency or key to ensure child components re-render when query state changes.
|
|
26
|
+
*
|
|
27
|
+
* This is necessary because React Query mutates the Query object in place, so React's
|
|
28
|
+
* shallow comparison won't detect changes to nested properties like query.state.status.
|
|
29
|
+
*/
|
|
30
|
+
export function useGetQueryByQueryKeyWithVersion(queryKey) {
|
|
31
|
+
const queryClient = useQueryClient();
|
|
32
|
+
const [queryState, setQueryState] = useState({
|
|
33
|
+
query: undefined,
|
|
34
|
+
version: 0
|
|
35
|
+
});
|
|
36
|
+
const queryHashRef = useRef(undefined);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!queryKey) {
|
|
39
|
+
setQueryState({
|
|
40
|
+
query: undefined,
|
|
41
|
+
version: 0
|
|
42
|
+
});
|
|
43
|
+
queryHashRef.current = undefined;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Get initial query state
|
|
48
|
+
const query = queryClient.getQueryCache().find({
|
|
49
|
+
queryKey,
|
|
50
|
+
exact: true
|
|
51
|
+
});
|
|
52
|
+
setQueryState({
|
|
53
|
+
query,
|
|
54
|
+
version: 0
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Store the stringified queryKey for comparison
|
|
58
|
+
const queryKeyString = JSON.stringify(queryKey);
|
|
59
|
+
queryHashRef.current = queryKeyString;
|
|
60
|
+
|
|
61
|
+
// Subscribe to query cache changes but only update if our specific query changed
|
|
62
|
+
const unsubscribe = queryClient.getQueryCache().subscribe(event => {
|
|
63
|
+
// Only process events for our specific query
|
|
64
|
+
if (event.type === "updated" || event.type === "added" || event.type === "removed") {
|
|
65
|
+
if ("query" in event && event.query) {
|
|
66
|
+
// Check if the event is for our query by comparing the stringified keys
|
|
67
|
+
const eventQueryKeyString = JSON.stringify(event.query.queryKey);
|
|
68
|
+
const isOurQuery = eventQueryKeyString === queryHashRef.current;
|
|
69
|
+
if (isOurQuery) {
|
|
70
|
+
if (event.type === "removed") {
|
|
71
|
+
setQueryState({
|
|
72
|
+
query: undefined,
|
|
73
|
+
version: 0
|
|
74
|
+
});
|
|
75
|
+
} else {
|
|
76
|
+
// For 'updated' and 'added' events, use the query from the event
|
|
77
|
+
// Update both the query and increment version to force re-renders
|
|
78
|
+
setQueryState(prev => ({
|
|
79
|
+
query: event.query,
|
|
80
|
+
version: prev.version + 1
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Cleanup subscription when component unmounts
|
|
89
|
+
return () => unsubscribe();
|
|
90
|
+
}, [queryClient, queryKey]);
|
|
91
|
+
return queryState;
|
|
92
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
import { getStorageQueryCounts } from "../utils/getStorageQueryCounts";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Hook to get storage query counts with proper memoization
|
|
9
|
+
* Following rule3 - Component Composition principles:
|
|
10
|
+
* - Extract Reusable Logic: Dedicated hook for storage counting
|
|
11
|
+
* - Rigor and Justification: Proper memoization only where proven necessary
|
|
12
|
+
* - Stable references: useMemo with correct dependencies to prevent infinite loops
|
|
13
|
+
*/
|
|
14
|
+
export function useStorageQueryCounts() {
|
|
15
|
+
const queryClient = useQueryClient();
|
|
16
|
+
|
|
17
|
+
// Memoize counts based on query cache state changes
|
|
18
|
+
// This prevents infinite re-renders by stabilizing the counts object
|
|
19
|
+
const counts = useMemo(() => {
|
|
20
|
+
const allQueries = queryClient.getQueryCache().getAll();
|
|
21
|
+
return getStorageQueryCounts(allQueries);
|
|
22
|
+
}, [queryClient]); // Depend on queryClient, not the result of getAll()
|
|
23
|
+
|
|
24
|
+
return counts;
|
|
25
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState, useRef } from "react";
|
|
4
|
+
import { onlineManager } from "@tanstack/react-query";
|
|
5
|
+
import { devToolsStorageKeys, safeGetItem, safeSetItem } from "@buoy-gg/shared-ui";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Synchronizes a local Wi-Fi toggle with React Query’s `onlineManager`, persisting the selection
|
|
9
|
+
* so developers can simulate offline mode across reloads.
|
|
10
|
+
*/
|
|
11
|
+
export function useWifiState() {
|
|
12
|
+
const [isOnline, setIsOnline] = useState(() => onlineManager.isOnline());
|
|
13
|
+
const hasLoadedPersistedState = useRef(false);
|
|
14
|
+
|
|
15
|
+
// Load persisted WiFi state on mount
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (hasLoadedPersistedState.current) return;
|
|
18
|
+
const loadPersistedState = async () => {
|
|
19
|
+
try {
|
|
20
|
+
const savedState = await safeGetItem(devToolsStorageKeys.settings.wifiEnabled());
|
|
21
|
+
if (savedState !== null) {
|
|
22
|
+
const isEnabled = savedState === "true";
|
|
23
|
+
setIsOnline(isEnabled);
|
|
24
|
+
onlineManager.setOnline(isEnabled);
|
|
25
|
+
}
|
|
26
|
+
hasLoadedPersistedState.current = true;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
// Failed to load WiFi state
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
loadPersistedState();
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
// Save WiFi state when it changes
|
|
35
|
+
const saveWifiState = async enabled => {
|
|
36
|
+
try {
|
|
37
|
+
await safeSetItem(devToolsStorageKeys.settings.wifiEnabled(), enabled.toString());
|
|
38
|
+
} catch (error) {
|
|
39
|
+
// Failed to save WiFi state
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const handleWifiToggle = () => {
|
|
43
|
+
const newOnlineState = !isOnline;
|
|
44
|
+
setIsOnline(newOnlineState);
|
|
45
|
+
onlineManager.setOnline(newOnlineState);
|
|
46
|
+
saveWifiState(newOnlineState);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Listen to online manager changes to keep state in sync
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const unsubscribe = onlineManager.subscribe(online => {
|
|
52
|
+
setIsOnline(online);
|
|
53
|
+
// Only save if we've already loaded the persisted state to avoid overwriting on mount
|
|
54
|
+
if (hasLoadedPersistedState.current) {
|
|
55
|
+
saveWifiState(online);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return unsubscribe;
|
|
59
|
+
}, []);
|
|
60
|
+
return {
|
|
61
|
+
isOnline,
|
|
62
|
+
handleWifiToggle
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Shared type definitions for the dev tools
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Type guard that narrows a value to a plain object (excluding arrays, Dates, Maps, etc.).
|
|
7
|
+
*/
|
|
8
|
+
export function isPlainObject(value) {
|
|
9
|
+
return value !== null && value !== undefined && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof Error) && !(value instanceof Map) && !(value instanceof Set) && !(value instanceof RegExp) && typeof value !== "function";
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { deleteNestedDataByPath } from "../deleteNestedDataByPath";
|
|
4
|
+
export default function deleteItem({
|
|
5
|
+
activeQuery,
|
|
6
|
+
dataPath,
|
|
7
|
+
queryClient
|
|
8
|
+
}) {
|
|
9
|
+
if (!dataPath) {
|
|
10
|
+
// Early return if path is missing
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const oldData = activeQuery.state.data;
|
|
14
|
+
const newData = deleteNestedDataByPath(oldData, dataPath);
|
|
15
|
+
|
|
16
|
+
// Force a new object reference to ensure React detects the change
|
|
17
|
+
const forceNewReference = JSON.parse(JSON.stringify(newData));
|
|
18
|
+
queryClient.setQueryData(activeQuery.queryKey, forceNewReference);
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export default function triggerError({
|
|
4
|
+
query,
|
|
5
|
+
queryClient
|
|
6
|
+
}) {
|
|
7
|
+
if (query.state.status !== "error") {
|
|
8
|
+
// --ACTION-TRIGGER-ERROR logic--
|
|
9
|
+
// This matches the ACTION-TRIGGER-ERROR case from the external sync system
|
|
10
|
+
const error = new Error("Unknown error from devtools");
|
|
11
|
+
const __previousQueryOptions = query.options;
|
|
12
|
+
query.setState({
|
|
13
|
+
status: "error",
|
|
14
|
+
error,
|
|
15
|
+
fetchMeta: {
|
|
16
|
+
...query.state.fetchMeta,
|
|
17
|
+
// @ts-expect-error This does exist
|
|
18
|
+
__previousQueryOptions
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
// --ACTION-RESTORE-ERROR logic--
|
|
23
|
+
// This matches the ACTION-RESTORE-ERROR case from the external sync system
|
|
24
|
+
queryClient.resetQueries(query);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export default function triggerLoading({
|
|
4
|
+
query
|
|
5
|
+
}) {
|
|
6
|
+
if (query.state.data === undefined) {
|
|
7
|
+
// --ACTION-RESTORE-LOADING logic--
|
|
8
|
+
// This matches the ACTION-RESTORE-LOADING case from the external sync system
|
|
9
|
+
const previousState = query.state;
|
|
10
|
+
const previousOptions = query.state.fetchMeta ? query.state.fetchMeta.__previousQueryOptions : null;
|
|
11
|
+
query.cancel({
|
|
12
|
+
silent: true
|
|
13
|
+
});
|
|
14
|
+
query.setState({
|
|
15
|
+
...previousState,
|
|
16
|
+
fetchStatus: "idle",
|
|
17
|
+
fetchMeta: null
|
|
18
|
+
});
|
|
19
|
+
if (previousOptions) {
|
|
20
|
+
query.fetch(previousOptions);
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
// --ACTION-TRIGGER-LOADING logic--
|
|
24
|
+
// This matches the ACTION-TRIGGER-LOADING case from the external sync system
|
|
25
|
+
const __previousQueryOptions = query.options;
|
|
26
|
+
|
|
27
|
+
// Trigger a fetch in order to trigger suspense as well.
|
|
28
|
+
query.fetch({
|
|
29
|
+
...__previousQueryOptions,
|
|
30
|
+
queryFn: () => {
|
|
31
|
+
return new Promise(() => {
|
|
32
|
+
// Never resolve - simulates perpetual loading
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
gcTime: -1
|
|
36
|
+
});
|
|
37
|
+
query.setState({
|
|
38
|
+
data: undefined,
|
|
39
|
+
status: "pending",
|
|
40
|
+
fetchMeta: {
|
|
41
|
+
...query.state.fetchMeta,
|
|
42
|
+
// @ts-expect-error This does exist
|
|
43
|
+
__previousQueryOptions
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Deletes nested data by path
|
|
5
|
+
*
|
|
6
|
+
* @param {unknown} oldData Data to be updated
|
|
7
|
+
* @param {Array<string>} deletePath Path to the data to be deleted
|
|
8
|
+
* @returns newData without the deleted items by path
|
|
9
|
+
*/
|
|
10
|
+
export const deleteNestedDataByPath = (oldData, deletePath) => {
|
|
11
|
+
if (oldData instanceof Map) {
|
|
12
|
+
const newData = new Map(oldData);
|
|
13
|
+
if (deletePath.length === 1) {
|
|
14
|
+
newData.delete(deletePath[0]);
|
|
15
|
+
return newData;
|
|
16
|
+
}
|
|
17
|
+
const [head, ...tail] = deletePath;
|
|
18
|
+
newData.set(head, deleteNestedDataByPath(newData.get(head), tail));
|
|
19
|
+
return newData;
|
|
20
|
+
}
|
|
21
|
+
if (oldData instanceof Set) {
|
|
22
|
+
const setAsArray = deleteNestedDataByPath(Array.from(oldData), deletePath);
|
|
23
|
+
return new Set(setAsArray);
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(oldData)) {
|
|
26
|
+
const newData = [...oldData];
|
|
27
|
+
if (deletePath.length === 1) {
|
|
28
|
+
return newData.filter((_, idx) => idx.toString() !== deletePath[0]);
|
|
29
|
+
}
|
|
30
|
+
const [head, ...tail] = deletePath;
|
|
31
|
+
|
|
32
|
+
// @ts-expect-error NAS
|
|
33
|
+
newData[head] = deleteNestedDataByPath(newData[head], tail);
|
|
34
|
+
return newData;
|
|
35
|
+
}
|
|
36
|
+
if (oldData instanceof Object) {
|
|
37
|
+
const newData = {
|
|
38
|
+
...oldData
|
|
39
|
+
};
|
|
40
|
+
if (deletePath.length === 1) {
|
|
41
|
+
// @ts-expect-error NAS
|
|
42
|
+
delete newData[deletePath[0]];
|
|
43
|
+
return newData;
|
|
44
|
+
}
|
|
45
|
+
const [head, ...tail] = deletePath;
|
|
46
|
+
// @ts-expect-error NAS
|
|
47
|
+
newData[head] = deleteNestedDataByPath(newData[head], tail);
|
|
48
|
+
return newData;
|
|
49
|
+
}
|
|
50
|
+
return oldData;
|
|
51
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Formats a timestamp as a relative time string (e.g., "10s ago", "5m ago", "2h ago")
|
|
5
|
+
* @param timestamp - Unix timestamp in milliseconds
|
|
6
|
+
* @returns Formatted relative time string
|
|
7
|
+
*/
|
|
8
|
+
export function formatRelativeTime(timestamp) {
|
|
9
|
+
const now = Date.now();
|
|
10
|
+
const diff = now - timestamp;
|
|
11
|
+
const seconds = Math.floor(diff / 1000);
|
|
12
|
+
if (seconds < 60) {
|
|
13
|
+
return `${seconds}s ago`;
|
|
14
|
+
}
|
|
15
|
+
const minutes = Math.floor(seconds / 60);
|
|
16
|
+
if (minutes < 60) {
|
|
17
|
+
return `${minutes}m ago`;
|
|
18
|
+
}
|
|
19
|
+
const hours = Math.floor(minutes / 60);
|
|
20
|
+
if (hours < 24) {
|
|
21
|
+
return `${hours}h ago`;
|
|
22
|
+
}
|
|
23
|
+
const days = Math.floor(hours / 24);
|
|
24
|
+
return `${days}d ago`;
|
|
25
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Maps a query’s runtime state to one of the predefined status color tokens used in the UI.
|
|
5
|
+
*/
|
|
6
|
+
export function getQueryStatusColor({
|
|
7
|
+
queryState,
|
|
8
|
+
observerCount,
|
|
9
|
+
isStale
|
|
10
|
+
}) {
|
|
11
|
+
return queryState.fetchStatus === "fetching" ? "blue" : !observerCount ? "gray" : queryState.fetchStatus === "paused" ? "purple" : isStale ? "yellow" : "green";
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Converts a query object into a human-friendly status string for badge rendering.
|
|
5
|
+
* Priority order: disabled > fetching > inactive > paused > stale > fresh
|
|
6
|
+
*/
|
|
7
|
+
export function getQueryStatusLabel(query) {
|
|
8
|
+
// Check disabled first - disabled queries won't automatically fetch
|
|
9
|
+
if (query.isDisabled()) {
|
|
10
|
+
return "disabled";
|
|
11
|
+
}
|
|
12
|
+
return query.state.fetchStatus === "fetching" ? "fetching" : !query.getObserversCount() ? "inactive" : query.state.fetchStatus === "paused" ? "paused" : query.isStale() ? "stale" : "fresh";
|
|
13
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { isStorageQuery, getStorageType, getCleanStorageKey } from "./storageQueryUtils";
|
|
4
|
+
import { isDevToolsStorageKey } from "@buoy-gg/shared-ui";
|
|
5
|
+
/**
|
|
6
|
+
* Calculate counts for each storage type from storage queries
|
|
7
|
+
* Following performance principles: no unnecessary memoization [[memory:4875074]]
|
|
8
|
+
*/
|
|
9
|
+
export function getStorageQueryCounts(queries) {
|
|
10
|
+
const counts = {
|
|
11
|
+
mmkv: 0,
|
|
12
|
+
async: 0,
|
|
13
|
+
secure: 0,
|
|
14
|
+
total: 0
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Filter to storage queries only, then count by type
|
|
18
|
+
const storageQueries = queries.filter(query => isStorageQuery(query.queryKey));
|
|
19
|
+
storageQueries.forEach(query => {
|
|
20
|
+
const storageType = getStorageType(query.queryKey);
|
|
21
|
+
if (storageType) {
|
|
22
|
+
// Filter out dev tool keys from the counts
|
|
23
|
+
const cleanKey = getCleanStorageKey(query.queryKey);
|
|
24
|
+
if (!isDevToolsStorageKey(cleanKey)) {
|
|
25
|
+
counts[storageType]++;
|
|
26
|
+
counts.total++;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return counts;
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Action utilities (map default exports to named for consistency)
|
|
4
|
+
export { default as invalidate } from "./actions/invalidate";
|
|
5
|
+
export { default as refetch } from "./actions/refetch";
|
|
6
|
+
export { default as reset } from "./actions/reset";
|
|
7
|
+
export { default as remove } from "./actions/remove";
|
|
8
|
+
export { default as deleteItem } from "./actions/deleteItem";
|
|
9
|
+
export { default as triggerError } from "./actions/triggerError";
|
|
10
|
+
export { default as triggerLoading } from "./actions/triggerLoading";
|
|
11
|
+
|
|
12
|
+
// Query status utilities
|
|
13
|
+
export * from "./getQueryStatusLabel";
|
|
14
|
+
export * from "./getQueryStatusColor";
|
|
15
|
+
|
|
16
|
+
// Storage utilities
|
|
17
|
+
export * from "./getStorageQueryCounts";
|
|
18
|
+
export * from "./storageQueryUtils";
|
|
19
|
+
export * from "./modalStorageOperations";
|
|
20
|
+
|
|
21
|
+
// Data manipulation utilities
|
|
22
|
+
export * from "./updateNestedDataByPath";
|
|
23
|
+
export * from "./deleteNestedDataByPath";
|
|
24
|
+
export { safeStringify } from "@buoy-gg/shared-ui";
|
|
25
|
+
|
|
26
|
+
// Display utilities
|
|
27
|
+
export { displayValue, parseDisplayValue } from "@buoy-gg/shared-ui";
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { safeSetItem, safeGetItem } from "@buoy-gg/shared-ui";
|
|
4
|
+
|
|
5
|
+
// Helper functions for persisting panel state using shared storage wrapper
|
|
6
|
+
const setItem = async (key, value) => {
|
|
7
|
+
await safeSetItem(key, value);
|
|
8
|
+
};
|
|
9
|
+
const getItem = async key => {
|
|
10
|
+
return safeGetItem(key);
|
|
11
|
+
};
|
|
12
|
+
// Storage operations
|
|
13
|
+
/**
|
|
14
|
+
* Persist the draggable panel dimensions so future sessions can restore the last window size.
|
|
15
|
+
*/
|
|
16
|
+
export const savePanelDimensions = async (storagePrefix, dimensions) => {
|
|
17
|
+
try {
|
|
18
|
+
await setItem(`${storagePrefix}_panel_dimensions`, JSON.stringify(dimensions));
|
|
19
|
+
} catch {
|
|
20
|
+
// Silently fail - persistence is optional
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** Remember the last snap height of the panel for bottom-sheet style layouts. */
|
|
25
|
+
export const savePanelHeight = async (storagePrefix, height) => {
|
|
26
|
+
try {
|
|
27
|
+
await setItem(`${storagePrefix}_panel_height`, height.toString());
|
|
28
|
+
} catch {
|
|
29
|
+
// Silently fail - persistence is optional
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Persist whether the panel was in floating mode so we can reopen at the same presentation style.
|
|
35
|
+
*/
|
|
36
|
+
export const saveFloatingMode = async (storagePrefix, isFloating) => {
|
|
37
|
+
try {
|
|
38
|
+
await setItem(`${storagePrefix}_is_floating_mode`, isFloating.toString());
|
|
39
|
+
} catch {
|
|
40
|
+
// Silently fail - persistence is optional
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Retrieve persisted panel geometry and presentation mode. Returns null values when nothing was
|
|
46
|
+
* previously stored so callers can fall back to defaults.
|
|
47
|
+
*/
|
|
48
|
+
export const loadPanelState = async storagePrefix => {
|
|
49
|
+
try {
|
|
50
|
+
const [dimensionsStr, heightStr, floatingModeStr] = await Promise.all([getItem(`${storagePrefix}_panel_dimensions`), getItem(`${storagePrefix}_panel_height`), getItem(`${storagePrefix}_is_floating_mode`)]);
|
|
51
|
+
const dimensions = dimensionsStr ? JSON.parse(dimensionsStr) : null;
|
|
52
|
+
const height = heightStr ? parseInt(heightStr, 10) : null;
|
|
53
|
+
const isFloating = floatingModeStr ? floatingModeStr === "true" : null;
|
|
54
|
+
return {
|
|
55
|
+
dimensions,
|
|
56
|
+
height,
|
|
57
|
+
isFloating
|
|
58
|
+
};
|
|
59
|
+
} catch {
|
|
60
|
+
// Return defaults on error
|
|
61
|
+
return {
|
|
62
|
+
dimensions: null,
|
|
63
|
+
height: null,
|
|
64
|
+
isFloating: null
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// Modal visibility state operations
|
|
70
|
+
/**
|
|
71
|
+
* Persist the comprehensive modal visibility state (open flags, selected query, etc.). Stored as a
|
|
72
|
+
* single JSON blob keyed by the provided prefix.
|
|
73
|
+
*/
|
|
74
|
+
export const saveModalVisibilityState = async (storagePrefix, state) => {
|
|
75
|
+
try {
|
|
76
|
+
const stateJson = JSON.stringify(state);
|
|
77
|
+
// storagePrefix already contains the full key, don't append _modal_state
|
|
78
|
+
const key = storagePrefix;
|
|
79
|
+
await setItem(key, stateJson);
|
|
80
|
+
} catch {
|
|
81
|
+
// Silently fail - persistence is a nice-to-have feature
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Read previously persisted modal visibility state. Returns null when no entry is stored or the
|
|
87
|
+
* payload cannot be parsed.
|
|
88
|
+
*/
|
|
89
|
+
export const loadModalVisibilityState = async storagePrefix => {
|
|
90
|
+
try {
|
|
91
|
+
// storagePrefix already contains the full key, don't append _modal_state
|
|
92
|
+
const key = storagePrefix;
|
|
93
|
+
const stateStr = await getItem(key);
|
|
94
|
+
if (stateStr && stateStr !== "") {
|
|
95
|
+
const parsed = JSON.parse(stateStr);
|
|
96
|
+
return parsed;
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
} catch {
|
|
100
|
+
// Silently fail - persistence is a nice-to-have feature
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Clear the cached modal visibility state. Useful when all modals close so we avoid reopening
|
|
107
|
+
* unintentionally on the next session.
|
|
108
|
+
*/
|
|
109
|
+
export const clearModalVisibilityState = async storagePrefix => {
|
|
110
|
+
try {
|
|
111
|
+
// storagePrefix already contains the full key, don't append _modal_state
|
|
112
|
+
const key = storagePrefix;
|
|
113
|
+
await setItem(key, "");
|
|
114
|
+
} catch {
|
|
115
|
+
// Silently fail - persistence is a nice-to-have feature
|
|
116
|
+
}
|
|
117
|
+
};
|