@buoy-gg/shared-ui 7.0.4 → 7.0.5
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/lib/commonjs/colors/index.js +49 -0
- package/lib/commonjs/dataViewer/DataTreeActionBar.js +389 -0
- package/lib/commonjs/dataViewer/DataTreeActionDock.js +222 -0
- package/lib/commonjs/dataViewer/DataViewer.js +18 -3
- package/lib/commonjs/dataViewer/VirtualizedDataExplorer.js +227 -28
- package/lib/commonjs/dataViewer/index.js +88 -0
- package/lib/commonjs/dataViewer/jsonOps.js +320 -0
- package/lib/commonjs/dataViewer/lineDiff.js +285 -83
- package/lib/commonjs/dataViewer/tree/TreeDiffViewer.js +20 -5
- package/lib/commonjs/dataViewer/treeActions.js +167 -0
- package/lib/commonjs/env/EnvironmentSelector.js +2 -2
- package/lib/commonjs/env/EnvironmentSelectorInline.js +2 -2
- package/lib/commonjs/hooks/safe-area-impl.js +1 -1
- package/lib/commonjs/icons/index.js +79 -3
- package/lib/commonjs/icons/lucide-icons-original-full.js +5 -1
- package/lib/commonjs/icons/lucide-icons.js +59 -2
- package/lib/commonjs/index.js +35 -0
- package/lib/commonjs/settings/components/BubbleSettingsSection.js +21 -19
- package/lib/commonjs/storage/devToolsStorageKeys.js +6 -3
- package/lib/commonjs/ui/components/Badge.js +2 -0
- package/lib/commonjs/ui/components/CompactRow.js +7 -0
- package/lib/commonjs/ui/components/CopyButton.js +27 -4
- package/lib/commonjs/ui/components/DevToolsCard.js +11 -0
- package/lib/commonjs/ui/components/DynamicFilterView.js +8 -1
- package/lib/commonjs/ui/components/EmptyState.js +12 -5
- package/lib/commonjs/ui/components/ErrorBoundary.js +3 -2
- package/lib/commonjs/ui/components/EventHistoryViewer/EventHistoryViewer.js +63 -11
- package/lib/commonjs/ui/components/ExpandableSection.js +4 -3
- package/lib/commonjs/ui/components/ExpandableSectionHeader.js +2 -1
- package/lib/commonjs/ui/components/FilterViewPattern.js +8 -7
- package/lib/commonjs/ui/components/ListItem.js +7 -5
- package/lib/commonjs/ui/components/PowerToggleButton.js +4 -1
- package/lib/commonjs/ui/components/TabSelector.js +3 -0
- package/lib/commonjs/ui/console/CyberpunkConsoleSection.js +1 -1
- package/lib/commonjs/ui/console/GalaxyButton.js +1 -1
- package/lib/commonjs/ui/gameUI/components/GameUICompactStats.js +2 -2
- package/lib/commonjs/ui/gameUI/constants/gameUIColors.js +28 -6
- package/lib/commonjs/ui/gameUI/constants/macOSDesignSystemColors.js +22 -4
- package/lib/commonjs/utils/index.js +25 -0
- package/lib/commonjs/utils/reloadApp.js +144 -0
- package/lib/module/colors/index.js +21 -0
- package/lib/module/dataViewer/DataTreeActionBar.js +384 -0
- package/lib/module/dataViewer/DataTreeActionDock.js +218 -0
- package/lib/module/dataViewer/DataViewer.js +18 -3
- package/lib/module/dataViewer/VirtualizedDataExplorer.js +228 -30
- package/lib/module/dataViewer/index.js +16 -1
- package/lib/module/dataViewer/jsonOps.js +311 -0
- package/lib/module/dataViewer/lineDiff.js +284 -82
- package/lib/module/dataViewer/tree/TreeDiffViewer.js +20 -5
- package/lib/module/dataViewer/treeActions.js +161 -0
- package/lib/module/env/EnvironmentSelector.js +2 -2
- package/lib/module/env/EnvironmentSelectorInline.js +2 -2
- package/lib/module/hooks/safe-area-impl.js +1 -1
- package/lib/module/icons/index.js +10 -1
- package/lib/module/icons/lucide-icons-original-full.js +5 -1
- package/lib/module/icons/lucide-icons.js +56 -0
- package/lib/module/index.js +4 -0
- package/lib/module/settings/components/BubbleSettingsSection.js +21 -19
- package/lib/module/storage/devToolsStorageKeys.js +6 -3
- package/lib/module/ui/components/Badge.js +2 -0
- package/lib/module/ui/components/CompactRow.js +7 -0
- package/lib/module/ui/components/CopyButton.js +29 -6
- package/lib/module/ui/components/DevToolsCard.js +11 -0
- package/lib/module/ui/components/DynamicFilterView.js +8 -1
- package/lib/module/ui/components/EmptyState.js +12 -5
- package/lib/module/ui/components/ErrorBoundary.js +3 -2
- package/lib/module/ui/components/EventHistoryViewer/EventHistoryViewer.js +63 -11
- package/lib/module/ui/components/ExpandableSection.js +4 -3
- package/lib/module/ui/components/ExpandableSectionHeader.js +2 -1
- package/lib/module/ui/components/FilterViewPattern.js +9 -7
- package/lib/module/ui/components/ListItem.js +7 -5
- package/lib/module/ui/components/PowerToggleButton.js +4 -1
- package/lib/module/ui/components/TabSelector.js +3 -0
- package/lib/module/ui/console/CyberpunkConsoleSection.js +1 -1
- package/lib/module/ui/console/GalaxyButton.js +1 -1
- package/lib/module/ui/gameUI/components/GameUICompactStats.js +2 -2
- package/lib/module/ui/gameUI/constants/gameUIColors.js +27 -6
- package/lib/module/ui/gameUI/constants/macOSDesignSystemColors.js +19 -2
- package/lib/module/utils/index.js +1 -0
- package/lib/module/utils/reloadApp.js +137 -0
- package/lib/typescript/commonjs/colors/index.d.ts +22 -0
- package/lib/typescript/commonjs/colors/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/dataViewer/DataTreeActionBar.d.ts +53 -0
- package/lib/typescript/commonjs/dataViewer/DataTreeActionBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/dataViewer/DataTreeActionDock.d.ts +33 -0
- package/lib/typescript/commonjs/dataViewer/DataTreeActionDock.d.ts.map +1 -0
- package/lib/typescript/commonjs/dataViewer/DataViewer.d.ts +14 -1
- package/lib/typescript/commonjs/dataViewer/DataViewer.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/VirtualizedDataExplorer.d.ts +30 -1
- package/lib/typescript/commonjs/dataViewer/VirtualizedDataExplorer.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/__tests__/jsonOps.test.d.ts +19 -0
- package/lib/typescript/commonjs/dataViewer/__tests__/jsonOps.test.d.ts.map +1 -0
- package/lib/typescript/commonjs/dataViewer/index.d.ts +5 -1
- package/lib/typescript/commonjs/dataViewer/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/jsonOps.d.ts +124 -0
- package/lib/typescript/commonjs/dataViewer/jsonOps.d.ts.map +1 -0
- package/lib/typescript/commonjs/dataViewer/lineDiff.d.ts +27 -0
- package/lib/typescript/commonjs/dataViewer/lineDiff.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/tree/TreeDiffViewer.d.ts +8 -1
- package/lib/typescript/commonjs/dataViewer/tree/TreeDiffViewer.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/treeActions.d.ts +83 -0
- package/lib/typescript/commonjs/dataViewer/treeActions.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/icons/index.d.ts +6 -1
- package/lib/typescript/commonjs/icons/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/lucide-icons-original-full.d.ts.map +1 -1
- package/lib/typescript/commonjs/icons/lucide-icons.d.ts +9 -0
- package/lib/typescript/commonjs/icons/lucide-icons.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/settings/components/BubbleSettingsSection.d.ts.map +1 -1
- package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts +5 -1
- package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/CopyButton.d.ts +7 -1
- package/lib/typescript/commonjs/ui/components/CopyButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/EmptyState.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ErrorBoundary.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/EventHistoryViewer/EventHistoryViewer.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/EventHistoryViewer/types.d.ts +23 -7
- package/lib/typescript/commonjs/ui/components/EventHistoryViewer/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ExpandableSection.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ExpandableSectionHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FilterViewPattern.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ListItem.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts +36 -30
- package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/gameUI/constants/macOSDesignSystemColors.d.ts +5 -0
- package/lib/typescript/commonjs/ui/gameUI/constants/macOSDesignSystemColors.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/index.d.ts +1 -0
- package/lib/typescript/commonjs/utils/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/reloadApp.d.ts +68 -0
- package/lib/typescript/commonjs/utils/reloadApp.d.ts.map +1 -0
- package/lib/typescript/module/colors/index.d.ts +22 -0
- package/lib/typescript/module/colors/index.d.ts.map +1 -0
- package/lib/typescript/module/dataViewer/DataTreeActionBar.d.ts +53 -0
- package/lib/typescript/module/dataViewer/DataTreeActionBar.d.ts.map +1 -0
- package/lib/typescript/module/dataViewer/DataTreeActionDock.d.ts +33 -0
- package/lib/typescript/module/dataViewer/DataTreeActionDock.d.ts.map +1 -0
- package/lib/typescript/module/dataViewer/DataViewer.d.ts +14 -1
- package/lib/typescript/module/dataViewer/DataViewer.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/VirtualizedDataExplorer.d.ts +30 -1
- package/lib/typescript/module/dataViewer/VirtualizedDataExplorer.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/__tests__/jsonOps.test.d.ts +19 -0
- package/lib/typescript/module/dataViewer/__tests__/jsonOps.test.d.ts.map +1 -0
- package/lib/typescript/module/dataViewer/index.d.ts +5 -1
- package/lib/typescript/module/dataViewer/index.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/jsonOps.d.ts +124 -0
- package/lib/typescript/module/dataViewer/jsonOps.d.ts.map +1 -0
- package/lib/typescript/module/dataViewer/lineDiff.d.ts +27 -0
- package/lib/typescript/module/dataViewer/lineDiff.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/tree/TreeDiffViewer.d.ts +8 -1
- package/lib/typescript/module/dataViewer/tree/TreeDiffViewer.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/treeActions.d.ts +83 -0
- package/lib/typescript/module/dataViewer/treeActions.d.ts.map +1 -0
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/icons/index.d.ts +6 -1
- package/lib/typescript/module/icons/index.d.ts.map +1 -1
- package/lib/typescript/module/icons/lucide-icons-original-full.d.ts.map +1 -1
- package/lib/typescript/module/icons/lucide-icons.d.ts +9 -0
- package/lib/typescript/module/icons/lucide-icons.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/settings/components/BubbleSettingsSection.d.ts.map +1 -1
- package/lib/typescript/module/storage/devToolsStorageKeys.d.ts +5 -1
- package/lib/typescript/module/storage/devToolsStorageKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/CopyButton.d.ts +7 -1
- package/lib/typescript/module/ui/components/CopyButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/EmptyState.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ErrorBoundary.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/EventHistoryViewer/EventHistoryViewer.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/EventHistoryViewer/types.d.ts +23 -7
- package/lib/typescript/module/ui/components/EventHistoryViewer/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ExpandableSection.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ExpandableSectionHeader.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FilterViewPattern.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ListItem.d.ts.map +1 -1
- package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts +36 -30
- package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
- package/lib/typescript/module/ui/gameUI/constants/macOSDesignSystemColors.d.ts +5 -0
- package/lib/typescript/module/ui/gameUI/constants/macOSDesignSystemColors.d.ts.map +1 -1
- package/lib/typescript/module/utils/index.d.ts +1 -0
- package/lib/typescript/module/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/utils/reloadApp.d.ts +68 -0
- package/lib/typescript/module/utils/reloadApp.d.ts.map +1 -0
- package/package.json +15 -4
- package/lib/commonjs/icons/ImageOverlayIcon.js +0 -142
- package/lib/module/icons/ImageOverlayIcon.js +0 -137
- package/lib/typescript/commonjs/icons/ImageOverlayIcon.d.ts +0 -14
- package/lib/typescript/commonjs/icons/ImageOverlayIcon.d.ts.map +0 -1
- package/lib/typescript/module/icons/ImageOverlayIcon.d.ts +0 -14
- package/lib/typescript/module/icons/ImageOverlayIcon.d.ts.map +0 -1
|
@@ -7,6 +7,7 @@ exports.ErrorBoundary = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _index = require("../../icons/index.js");
|
|
10
|
+
var _gameUIColors = require("../gameUI/constants/gameUIColors.js");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
class ErrorBoundary extends _react.Component {
|
|
12
13
|
constructor(props) {
|
|
@@ -69,7 +70,7 @@ class ErrorBoundary extends _react.Component {
|
|
|
69
70
|
exports.ErrorBoundary = ErrorBoundary;
|
|
70
71
|
const styles = _reactNative.StyleSheet.create({
|
|
71
72
|
errorContainer: {
|
|
72
|
-
backgroundColor:
|
|
73
|
+
backgroundColor: _gameUIColors.buoyColors.card,
|
|
73
74
|
borderRadius: 6,
|
|
74
75
|
borderWidth: 1,
|
|
75
76
|
borderColor: "#EF4444",
|
|
@@ -87,7 +88,7 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
87
88
|
fontWeight: "600"
|
|
88
89
|
},
|
|
89
90
|
errorMessage: {
|
|
90
|
-
color:
|
|
91
|
+
color: _gameUIColors.buoyColors.textSecondary,
|
|
91
92
|
fontSize: 12,
|
|
92
93
|
textAlign: "center",
|
|
93
94
|
lineHeight: 16
|
|
@@ -21,6 +21,30 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
21
21
|
* This is a dumb component - all state is controlled externally.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Section wrapper for the diff view: a plain flex box normally, or a ScrollView
|
|
26
|
+
* when the whole section should scroll as one page. Split out so the children
|
|
27
|
+
* are written once instead of duplicated across both branches.
|
|
28
|
+
*/
|
|
29
|
+
function DiffSectionContainer({
|
|
30
|
+
scrolls,
|
|
31
|
+
style,
|
|
32
|
+
children
|
|
33
|
+
}) {
|
|
34
|
+
if (!scrolls) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
35
|
+
style: style,
|
|
36
|
+
children: children
|
|
37
|
+
});
|
|
38
|
+
// `contentSection` carries `flex: 1`, which is meaningless (and harmful) on a
|
|
39
|
+
// content container — the scrolling variant uses flexGrow padding instead.
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
41
|
+
style: styles.contentScroll,
|
|
42
|
+
contentContainerStyle: styles.contentScrollInner,
|
|
43
|
+
showsVerticalScrollIndicator: true,
|
|
44
|
+
children: children
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
24
48
|
/**
|
|
25
49
|
* EventHistoryViewer is the main container for viewing event history.
|
|
26
50
|
* It composes sub-components to display current value or diff views.
|
|
@@ -56,6 +80,7 @@ const EventHistoryViewer = exports.EventHistoryViewer = /*#__PURE__*/(0, _react.
|
|
|
56
80
|
canRightNext,
|
|
57
81
|
onLeftPickerOpen,
|
|
58
82
|
onRightPickerOpen,
|
|
83
|
+
scrollDiffSection,
|
|
59
84
|
// Footer
|
|
60
85
|
disableInternalFooter,
|
|
61
86
|
footerCurrentIndex,
|
|
@@ -65,28 +90,36 @@ const EventHistoryViewer = exports.EventHistoryViewer = /*#__PURE__*/(0, _react.
|
|
|
65
90
|
onFooterPrevious,
|
|
66
91
|
onFooterNext
|
|
67
92
|
}) {
|
|
93
|
+
const hasCurrentView = renderCurrentView != null;
|
|
68
94
|
const diffDisabled = footerTotalItems <= 1;
|
|
69
95
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
70
96
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
71
97
|
style: [styles.container, {
|
|
72
|
-
//
|
|
73
|
-
|
|
98
|
+
// Reserve space ONLY for the internal footer, which is absolutely
|
|
99
|
+
// positioned and would otherwise cover the content. An external
|
|
100
|
+
// footer is laid out by the host modal, which already pads the
|
|
101
|
+
// content area by its own footerHeight — adding this on top of that
|
|
102
|
+
// left a dead band above the footer (96px of padding for a footer
|
|
103
|
+
// that isn't in this subtree).
|
|
104
|
+
paddingBottom: !disableInternalFooter && footerTotalItems > 1 ? 96 : 0
|
|
74
105
|
}],
|
|
75
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ViewToggleCards.ViewToggleCards, {
|
|
106
|
+
children: [hasCurrentView && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ViewToggleCards.ViewToggleCards, {
|
|
76
107
|
activeView: activeView,
|
|
77
|
-
onViewChange: onViewChange,
|
|
78
|
-
currentLabel: currentViewLabel,
|
|
79
|
-
currentDescription: currentViewDescription,
|
|
108
|
+
onViewChange: onViewChange ?? (() => {}),
|
|
109
|
+
currentLabel: currentViewLabel ?? "",
|
|
110
|
+
currentDescription: currentViewDescription ?? "",
|
|
80
111
|
currentIcon: currentViewIcon,
|
|
81
112
|
diffLabel: diffViewLabel,
|
|
82
113
|
diffDescription: diffViewDescription,
|
|
83
114
|
diffIcon: diffViewIcon,
|
|
84
115
|
diffDisabled: diffDisabled
|
|
85
|
-
}), activeView === "current" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
86
|
-
style: styles.
|
|
116
|
+
}), hasCurrentView && activeView === "current" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
117
|
+
style: styles.contentScroll,
|
|
118
|
+
contentContainerStyle: styles.contentScrollInner,
|
|
87
119
|
showsVerticalScrollIndicator: true,
|
|
88
|
-
children: renderCurrentView()
|
|
89
|
-
}), activeView === "diff" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
120
|
+
children: renderCurrentView?.()
|
|
121
|
+
}), (!hasCurrentView || activeView === "diff") && /*#__PURE__*/(0, _jsxRuntime.jsxs)(DiffSectionContainer, {
|
|
122
|
+
scrolls: scrollDiffSection,
|
|
90
123
|
style: styles.contentSection,
|
|
91
124
|
children: [diffModeTabs && diffModeTabs.length > 0 && onDiffModeChange && /*#__PURE__*/(0, _jsxRuntime.jsx)(_DiffModeTabs.DiffModeTabs, {
|
|
92
125
|
tabs: diffModeTabs,
|
|
@@ -106,7 +139,10 @@ const EventHistoryViewer = exports.EventHistoryViewer = /*#__PURE__*/(0, _react.
|
|
|
106
139
|
canRightNext: canRightNext,
|
|
107
140
|
onLeftPress: onLeftPickerOpen,
|
|
108
141
|
onRightPress: onRightPickerOpen
|
|
109
|
-
}), renderDiffContent()
|
|
142
|
+
}), scrollDiffSection ? renderDiffContent() : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
143
|
+
style: styles.diffContent,
|
|
144
|
+
children: renderDiffContent()
|
|
145
|
+
})]
|
|
110
146
|
})]
|
|
111
147
|
}), !disableInternalFooter && /*#__PURE__*/(0, _jsxRuntime.jsx)(_EventStepperFooter.EventStepperFooter, {
|
|
112
148
|
currentIndex: footerCurrentIndex,
|
|
@@ -126,7 +162,23 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
126
162
|
},
|
|
127
163
|
contentSection: {
|
|
128
164
|
flex: 1,
|
|
165
|
+
minHeight: 0,
|
|
129
166
|
paddingHorizontal: 14,
|
|
130
167
|
paddingVertical: 10
|
|
168
|
+
},
|
|
169
|
+
contentScroll: {
|
|
170
|
+
// No `minHeight: 0` here. On the scroll frame it stops the ScrollView from
|
|
171
|
+
// constraining itself, so a tall value lays out at full content height and
|
|
172
|
+
// spills past the panel and the footer instead of scrolling inside it.
|
|
173
|
+
flex: 1
|
|
174
|
+
},
|
|
175
|
+
contentScrollInner: {
|
|
176
|
+
flexGrow: 1,
|
|
177
|
+
paddingHorizontal: 14,
|
|
178
|
+
paddingVertical: 10
|
|
179
|
+
},
|
|
180
|
+
diffContent: {
|
|
181
|
+
flex: 1,
|
|
182
|
+
minHeight: 0
|
|
131
183
|
}
|
|
132
184
|
});
|
|
@@ -7,6 +7,7 @@ exports.ExpandableSection = ExpandableSection;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _ExpandableSectionHeader = require("./ExpandableSectionHeader.js");
|
|
10
|
+
var _macOSDesignSystemColors = require("../gameUI/constants/macOSDesignSystemColors.js");
|
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
12
|
function ExpandableSection({
|
|
12
13
|
icon,
|
|
@@ -51,10 +52,10 @@ function ExpandableSection({
|
|
|
51
52
|
}
|
|
52
53
|
const styles = _reactNative.StyleSheet.create({
|
|
53
54
|
container: {
|
|
54
|
-
backgroundColor:
|
|
55
|
+
backgroundColor: _macOSDesignSystemColors.macOSColors.background.card,
|
|
55
56
|
borderRadius: 12,
|
|
56
57
|
borderWidth: 1,
|
|
57
|
-
borderColor: "rgba(
|
|
58
|
+
borderColor: "rgba(128, 128, 128, 0.16)",
|
|
58
59
|
overflow: "hidden",
|
|
59
60
|
marginHorizontal: 8,
|
|
60
61
|
marginBottom: 16
|
|
@@ -65,7 +66,7 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
65
66
|
divider: {
|
|
66
67
|
height: 1,
|
|
67
68
|
width: "100%",
|
|
68
|
-
backgroundColor: "rgba(
|
|
69
|
+
backgroundColor: "rgba(128, 128, 128, 0.12)",
|
|
69
70
|
marginBottom: 24
|
|
70
71
|
}
|
|
71
72
|
});
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ExpandableSectionHeader = ExpandableSectionHeader;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _index = require("../../icons/index.js");
|
|
9
|
+
var _gameUIColors = require("../gameUI/constants/gameUIColors.js");
|
|
9
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function ExpandableSectionHeader({
|
|
11
12
|
icon: Icon,
|
|
@@ -78,7 +79,7 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
78
79
|
},
|
|
79
80
|
subtitle: {
|
|
80
81
|
fontSize: 16,
|
|
81
|
-
color:
|
|
82
|
+
color: _gameUIColors.buoyColors.textSecondary
|
|
82
83
|
},
|
|
83
84
|
chevronContainer: {
|
|
84
85
|
paddingTop: 6
|
|
@@ -7,6 +7,7 @@ exports.FilterViewPattern = FilterViewPattern;
|
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _index = require("../../icons/index.js");
|
|
9
9
|
var _gameUIColors = require("../gameUI/constants/gameUIColors.js");
|
|
10
|
+
var _macOSDesignSystemColors = require("../gameUI/constants/macOSDesignSystemColors.js");
|
|
10
11
|
var _useFilterManager = require("../../hooks/useFilterManager.js");
|
|
11
12
|
var _FilterComponents = require("./FilterComponents.js");
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -122,17 +123,17 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
122
123
|
backgroundColor: "transparent"
|
|
123
124
|
},
|
|
124
125
|
suggestedContainer: {
|
|
125
|
-
backgroundColor: "rgba(
|
|
126
|
+
backgroundColor: "rgba(128, 128, 128, 0.06)",
|
|
126
127
|
borderRadius: 8,
|
|
127
128
|
padding: 12,
|
|
128
129
|
marginBottom: 16,
|
|
129
130
|
maxHeight: 300,
|
|
130
131
|
borderWidth: 1,
|
|
131
|
-
borderColor: "rgba(
|
|
132
|
+
borderColor: "rgba(128, 128, 128, 0.16)"
|
|
132
133
|
},
|
|
133
134
|
suggestedTitle: {
|
|
134
135
|
fontSize: 10,
|
|
135
|
-
color:
|
|
136
|
+
color: _macOSDesignSystemColors.macOSColors.text.icon,
|
|
136
137
|
fontWeight: "600",
|
|
137
138
|
letterSpacing: 0.5,
|
|
138
139
|
marginBottom: 12,
|
|
@@ -144,24 +145,24 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
144
145
|
suggestedItem: {
|
|
145
146
|
flexDirection: "row",
|
|
146
147
|
alignItems: "center",
|
|
147
|
-
backgroundColor: "rgba(
|
|
148
|
+
backgroundColor: "rgba(128, 128, 128, 0.04)",
|
|
148
149
|
borderRadius: 6,
|
|
149
150
|
paddingHorizontal: 10,
|
|
150
151
|
paddingVertical: 10,
|
|
151
152
|
marginBottom: 6,
|
|
152
153
|
borderWidth: 1,
|
|
153
|
-
borderColor: "rgba(
|
|
154
|
+
borderColor: "rgba(128, 128, 128, 0.1)"
|
|
154
155
|
},
|
|
155
156
|
suggestedText: {
|
|
156
157
|
flex: 1,
|
|
157
158
|
fontSize: 12,
|
|
158
|
-
color:
|
|
159
|
+
color: _gameUIColors.buoyColors.text,
|
|
159
160
|
fontFamily: "monospace",
|
|
160
161
|
marginLeft: 4
|
|
161
162
|
},
|
|
162
163
|
emptyText: {
|
|
163
164
|
fontSize: 11,
|
|
164
|
-
color:
|
|
165
|
+
color: _macOSDesignSystemColors.macOSColors.text.icon,
|
|
165
166
|
fontStyle: "italic",
|
|
166
167
|
padding: 12,
|
|
167
168
|
textAlign: "center"
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ListItem = ListItem;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
|
+
var _macOSDesignSystemColors = require("../gameUI/constants/macOSDesignSystemColors.js");
|
|
9
|
+
var _gameUIColors = require("../gameUI/constants/gameUIColors.js");
|
|
8
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
11
|
// Base ListItem container component
|
|
10
12
|
|
|
@@ -124,13 +126,13 @@ ListItem.Metadata = Metadata;
|
|
|
124
126
|
ListItem.Actions = Actions;
|
|
125
127
|
const styles = _reactNative.StyleSheet.create({
|
|
126
128
|
container: {
|
|
127
|
-
backgroundColor:
|
|
129
|
+
backgroundColor: _gameUIColors.buoyColors.card,
|
|
128
130
|
borderRadius: 8,
|
|
129
131
|
padding: 12,
|
|
130
132
|
marginHorizontal: 16,
|
|
131
133
|
marginVertical: 4,
|
|
132
134
|
borderWidth: 1,
|
|
133
|
-
borderColor: "rgba(
|
|
135
|
+
borderColor: "rgba(128, 128, 128, 0.1)"
|
|
134
136
|
},
|
|
135
137
|
header: {
|
|
136
138
|
flexDirection: "row",
|
|
@@ -150,17 +152,17 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
150
152
|
title: {
|
|
151
153
|
fontSize: 16,
|
|
152
154
|
fontWeight: "600",
|
|
153
|
-
color:
|
|
155
|
+
color: _gameUIColors.buoyColors.text,
|
|
154
156
|
marginBottom: 4
|
|
155
157
|
},
|
|
156
158
|
subtitle: {
|
|
157
159
|
fontSize: 14,
|
|
158
|
-
color:
|
|
160
|
+
color: _gameUIColors.buoyColors.textSecondary,
|
|
159
161
|
lineHeight: 20
|
|
160
162
|
},
|
|
161
163
|
metadata: {
|
|
162
164
|
fontSize: 12,
|
|
163
|
-
color:
|
|
165
|
+
color: _macOSDesignSystemColors.macOSColors.text.icon
|
|
164
166
|
},
|
|
165
167
|
actions: {
|
|
166
168
|
flexDirection: "row",
|
|
@@ -63,9 +63,12 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
63
63
|
backgroundColor: _macOSDesignSystemColors.macOSColors.semantic.successBackground,
|
|
64
64
|
borderColor: _macOSDesignSystemColors.macOSColors.semantic.success + "40"
|
|
65
65
|
},
|
|
66
|
+
// OFF stays red on both chromes: capture being disabled is exactly the kind
|
|
67
|
+
// of state the user needs to notice, so it keeps its colour.
|
|
66
68
|
disabledButton: {
|
|
67
69
|
backgroundColor: _macOSDesignSystemColors.macOSColors.semantic.errorBackground,
|
|
68
|
-
borderColor: _macOSDesignSystemColors.macOSColors.semantic.error + "40"
|
|
70
|
+
borderColor: _macOSDesignSystemColors.macOSColors.semantic.error + "40",
|
|
71
|
+
borderWidth: 1
|
|
69
72
|
},
|
|
70
73
|
buttonDisabled: {
|
|
71
74
|
opacity: 0.55
|
|
@@ -505,7 +505,7 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
505
505
|
},
|
|
506
506
|
glassShimmer: {
|
|
507
507
|
..._absoluteFill.absoluteFill,
|
|
508
|
-
backgroundColor: "rgba(
|
|
508
|
+
backgroundColor: "rgba(128, 128, 128, 0.06)",
|
|
509
509
|
opacity: 0.6
|
|
510
510
|
},
|
|
511
511
|
glitchOverlayLayer: {
|
|
@@ -73,7 +73,7 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
73
73
|
backgroundColor: "rgba(31, 31, 31, 0.85)",
|
|
74
74
|
borderRadius: 12,
|
|
75
75
|
borderWidth: 1,
|
|
76
|
-
borderColor: "rgba(
|
|
76
|
+
borderColor: "rgba(128, 128, 128, 0.24)",
|
|
77
77
|
overflow: "hidden"
|
|
78
78
|
},
|
|
79
79
|
starsContainer: {
|
|
@@ -168,7 +168,7 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
168
168
|
marginBottom: 8,
|
|
169
169
|
paddingBottom: 8,
|
|
170
170
|
borderBottomWidth: 1,
|
|
171
|
-
borderBottomColor: "rgba(
|
|
171
|
+
borderBottomColor: "rgba(128, 128, 128, 0.1)"
|
|
172
172
|
},
|
|
173
173
|
headerLeft: {
|
|
174
174
|
gap: 1
|
|
@@ -223,7 +223,7 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
223
223
|
},
|
|
224
224
|
healthBarBg: {
|
|
225
225
|
height: 4,
|
|
226
|
-
backgroundColor: "rgba(
|
|
226
|
+
backgroundColor: "rgba(128, 128, 128, 0.1)",
|
|
227
227
|
borderRadius: 2,
|
|
228
228
|
overflow: "hidden"
|
|
229
229
|
},
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.gameUIColors = exports.dialColors = exports.buoyColors = void 0;
|
|
6
|
+
exports.refreshGameUIColors = exports.gameUIColors = exports.dialColors = exports.buoyColors = void 0;
|
|
7
7
|
var _macOSDesignSystemColors = require("./macOSDesignSystemColors.js");
|
|
8
8
|
/**
|
|
9
9
|
* Game UI Color Palette - Simple Theme Swapping
|
|
@@ -129,9 +129,18 @@ const activeTheme = macOSTheme; // macOS - Apple HIG design system
|
|
|
129
129
|
// GAME UI COLORS (uses selected theme)
|
|
130
130
|
// ============================================
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
/* NOTE ON KEY ORDER — the spread comes LAST on purpose.
|
|
133
|
+
*
|
|
134
|
+
* These seven keys are fallbacks for `defaultTheme`, which doesn't define them.
|
|
135
|
+
* They used to sit AFTER the spread, which meant they silently overrode the
|
|
136
|
+
* active theme: `background`/`panel`/`buttonBackground` stayed hardcoded dark
|
|
137
|
+
* and `primary`/`primaryLight` stayed hardcoded white, no matter what palette
|
|
138
|
+
* was selected, so a theme could not override them at all. With the spread
|
|
139
|
+
* last, an active theme that defines them wins and only `defaultTheme` falls
|
|
140
|
+
* back. */
|
|
141
|
+
/** Fallbacks (dark-ish) for themes that don't define these keys — only
|
|
142
|
+
* `defaultTheme` needs them; `macOSTheme` supplies all seven. */
|
|
143
|
+
const fallbacks = {
|
|
135
144
|
background: "rgba(8, 12, 21, 0.98)",
|
|
136
145
|
panel: "rgba(16, 22, 35, 0.98)",
|
|
137
146
|
backdrop: "rgba(0, 0, 0, 0.85)",
|
|
@@ -140,9 +149,21 @@ const gameUIColors = exports.gameUIColors = {
|
|
|
140
149
|
// Default text colors for dark background
|
|
141
150
|
primary: "#FFFFFF",
|
|
142
151
|
primaryLight: "#F1F5F9"
|
|
143
|
-
|
|
144
|
-
// Theme-specific colors (later spread overrides defaults when present)
|
|
145
152
|
};
|
|
153
|
+
const gameUIColors = exports.gameUIColors = {
|
|
154
|
+
...fallbacks,
|
|
155
|
+
...activeTheme
|
|
156
|
+
};
|
|
157
|
+
/** Re-derive the theme-driven values in place after `macOSColors` has been
|
|
158
|
+
* re-tinted at runtime (desktop dashboard theme switch only — see
|
|
159
|
+
* in place). Keeps object identity so every
|
|
160
|
+
* `gameUIColors.x` read at render time picks the new value up. Module-level
|
|
161
|
+
* captures (`const BG = gameUIColors.panel`) still need a reload. */
|
|
162
|
+
const refreshGameUIColors = () => {
|
|
163
|
+
(0, _macOSDesignSystemColors.refreshMacOSGameUIColors)();
|
|
164
|
+
Object.assign(gameUIColors, activeTheme);
|
|
165
|
+
};
|
|
166
|
+
|
|
146
167
|
// ============================================
|
|
147
168
|
// BUOY BRAND COLORS
|
|
148
169
|
// ============================================
|
|
@@ -150,6 +171,7 @@ const gameUIColors = exports.gameUIColors = {
|
|
|
150
171
|
* Buoy brand colors - EXACT values from web docs site dark theme.
|
|
151
172
|
* Use these for consistent branding across all Buoy dev tools.
|
|
152
173
|
*/
|
|
174
|
+
exports.refreshGameUIColors = refreshGameUIColors;
|
|
153
175
|
const buoyColors = exports.buoyColors = {
|
|
154
176
|
// Backgrounds (dark to light)
|
|
155
177
|
base: "#121212",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.macOSGameUIColors = exports.macOSColors = void 0;
|
|
6
|
+
exports.refreshMacOSGameUIColors = exports.macOSGameUIColors = exports.macOSColors = void 0;
|
|
7
7
|
/**
|
|
8
8
|
* macOS Desktop App Design System Colors
|
|
9
9
|
* Based on Apple's Human Interface Guidelines with a dark-mode-first approach
|
|
@@ -160,8 +160,14 @@ const macOSColors = exports.macOSColors = {
|
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
/* `macOSGameUIColors` is a DERIVED SNAPSHOT: every field below copies a string
|
|
164
|
+
* value out of `macOSColors` at module-evaluation time, so later edits to
|
|
165
|
+
* `macOSColors` do not reach it. The desktop dashboard re-tints the palette by
|
|
166
|
+
* mutating `macOSColors` in place,
|
|
167
|
+
* which is why the snapshot is built by a factory and can be refreshed with
|
|
168
|
+
* `refreshMacOSGameUIColors()`. Nested objects (`dataTypes`, `diff`) are shared
|
|
169
|
+
* REFERENCES, not copies, so those already follow a re-tint on their own. */
|
|
170
|
+
const buildMacOSGameUIColors = () => ({
|
|
165
171
|
// Base backgrounds
|
|
166
172
|
background: macOSColors.background.base,
|
|
167
173
|
panel: macOSColors.background.card,
|
|
@@ -203,4 +209,16 @@ const macOSGameUIColors = exports.macOSGameUIColors = {
|
|
|
203
209
|
secondary: macOSColors.semantic.debug,
|
|
204
210
|
tertiary: macOSColors.semantic.success
|
|
205
211
|
}
|
|
206
|
-
};
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// Create a compatible gameUIColors object for gradual migration
|
|
215
|
+
const macOSGameUIColors = exports.macOSGameUIColors = buildMacOSGameUIColors();
|
|
216
|
+
|
|
217
|
+
/** Re-derive the snapshot above from the current `macOSColors` values, keeping
|
|
218
|
+
* the object identity so existing importers see the new colors. Only the
|
|
219
|
+
* desktop dashboard's theme switcher calls this; on device the palette never
|
|
220
|
+
* changes, so this is a no-op that is never invoked. */
|
|
221
|
+
const refreshMacOSGameUIColors = () => {
|
|
222
|
+
Object.assign(macOSGameUIColors, buildMacOSGameUIColors());
|
|
223
|
+
};
|
|
224
|
+
exports.refreshMacOSGameUIColors = refreshMacOSGameUIColors;
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "REMOTE_RELOAD_DELAY_MS", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _reloadApp.REMOTE_RELOAD_DELAY_MS;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "Subscribable", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
|
@@ -165,12 +171,30 @@ Object.defineProperty(exports, "persistentStorage", {
|
|
|
165
171
|
return _persistentStorage.persistentStorage;
|
|
166
172
|
}
|
|
167
173
|
});
|
|
174
|
+
Object.defineProperty(exports, "reloadApp", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () {
|
|
177
|
+
return _reloadApp.reloadApp;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "resolveReloadStrategy", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function () {
|
|
183
|
+
return _reloadApp.resolveReloadStrategy;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
168
186
|
Object.defineProperty(exports, "safeStringify", {
|
|
169
187
|
enumerable: true,
|
|
170
188
|
get: function () {
|
|
171
189
|
return _safeStringify.safeStringify;
|
|
172
190
|
}
|
|
173
191
|
});
|
|
192
|
+
Object.defineProperty(exports, "scheduleReloadApp", {
|
|
193
|
+
enumerable: true,
|
|
194
|
+
get: function () {
|
|
195
|
+
return _reloadApp.scheduleReloadApp;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
174
198
|
Object.defineProperty(exports, "setRenderCaptureProvider", {
|
|
175
199
|
enumerable: true,
|
|
176
200
|
get: function () {
|
|
@@ -228,6 +252,7 @@ var _typeHelpers = require("./typeHelpers.js");
|
|
|
228
252
|
var _valueFormatting = require("./valueFormatting.js");
|
|
229
253
|
var _loadOptionalModule = require("./loadOptionalModule.js");
|
|
230
254
|
var _renderCaptureRegistry = require("./renderCaptureRegistry.js");
|
|
255
|
+
var _reloadApp = require("./reloadApp.js");
|
|
231
256
|
var _subscribable = require("./subscribable.js");
|
|
232
257
|
var _subscriberCountNotifier = require("./subscriberCountNotifier.js");
|
|
233
258
|
var _safeExpoRouter = require("./safeExpoRouter.js");
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.REMOTE_RELOAD_DELAY_MS = void 0;
|
|
7
|
+
exports.reloadApp = reloadApp;
|
|
8
|
+
exports.resolveReloadStrategy = resolveReloadStrategy;
|
|
9
|
+
exports.scheduleReloadApp = scheduleReloadApp;
|
|
10
|
+
/**
|
|
11
|
+
* reloadApp
|
|
12
|
+
*
|
|
13
|
+
* Programmatic JS-bundle reload primitive. Two strategies, picked at runtime:
|
|
14
|
+
*
|
|
15
|
+
* - `dev-settings`: React Native core's `DevSettings.reload()`. Works in
|
|
16
|
+
* __DEV__ builds (including Expo Go) with zero deps, but throws in
|
|
17
|
+
* release.
|
|
18
|
+
* - `expo-updates`: `Updates.reloadAsync()` from the `expo-updates`
|
|
19
|
+
* package. Works in dev clients and production, but fails in Expo Go
|
|
20
|
+
* and is not bundled with any Buoy package — host apps opt in by
|
|
21
|
+
* installing `expo-updates` separately.
|
|
22
|
+
*
|
|
23
|
+
* "auto" prefers `dev-settings` in __DEV__ and falls back to
|
|
24
|
+
* `expo-updates` otherwise. The dynamic `require` keeps `expo-updates` an
|
|
25
|
+
* optional peer — Expo Go users never load it.
|
|
26
|
+
*
|
|
27
|
+
* Lives in shared (not in a tool package) because BOTH the always-installed
|
|
28
|
+
* core — whose `app` sync adapter exposes reload to remote drivers like the
|
|
29
|
+
* MCP server — and perf-monitor's batch runner (reload between cases) need it,
|
|
30
|
+
* and reloading must not require a tool with native peer deps.
|
|
31
|
+
*
|
|
32
|
+
* IMPORTANT: callers must persist any state they need to survive BEFORE
|
|
33
|
+
* invoking this. Once the reload fires, the JS realm is gone — there is
|
|
34
|
+
* no "after" code path.
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/** The concrete mechanism a `ReloadStrategy` resolves to at runtime. */
|
|
38
|
+
|
|
39
|
+
function loadDevSettings() {
|
|
40
|
+
try {
|
|
41
|
+
// Prefer the core RN module; cast to unknown first so TS doesn't try
|
|
42
|
+
// to follow into RN's typings (the package may not be in the type
|
|
43
|
+
// graph in some build setups).
|
|
44
|
+
const rn = require("react-native");
|
|
45
|
+
const ds = rn?.DevSettings;
|
|
46
|
+
if (ds && typeof ds.reload === "function") {
|
|
47
|
+
return ds;
|
|
48
|
+
}
|
|
49
|
+
} catch {
|
|
50
|
+
// fall through
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
function loadExpoUpdates() {
|
|
55
|
+
try {
|
|
56
|
+
const mod = require("expo-updates");
|
|
57
|
+
if (mod && typeof mod.reloadAsync === "function") {
|
|
58
|
+
return mod;
|
|
59
|
+
}
|
|
60
|
+
} catch {
|
|
61
|
+
// expo-updates not installed
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Which mechanism `strategy` would actually use right now, or null when none
|
|
68
|
+
* is available. Lets a caller check reloadability BEFORE committing (e.g. a
|
|
69
|
+
* remote driver that must answer "will this work?" over the wire, since after
|
|
70
|
+
* the reload fires there is no code path left to answer from).
|
|
71
|
+
*/
|
|
72
|
+
function resolveReloadStrategy(strategy = "auto") {
|
|
73
|
+
if (strategy === "dev-settings") {
|
|
74
|
+
return loadDevSettings() ? "dev-settings" : null;
|
|
75
|
+
}
|
|
76
|
+
if (strategy === "expo-updates") {
|
|
77
|
+
return loadExpoUpdates() ? "expo-updates" : null;
|
|
78
|
+
}
|
|
79
|
+
if (__DEV__ && loadDevSettings()) return "dev-settings";
|
|
80
|
+
return loadExpoUpdates() ? "expo-updates" : null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Why `strategy` can't run, phrased for the person who has to fix it. */
|
|
84
|
+
function unavailableMessage(strategy) {
|
|
85
|
+
if (strategy === "dev-settings") {
|
|
86
|
+
return "[buoy] DevSettings.reload() unavailable — strategy 'dev-settings' requires React Native dev mode.";
|
|
87
|
+
}
|
|
88
|
+
if (strategy === "expo-updates") {
|
|
89
|
+
return "[buoy] expo-updates not installed — strategy 'expo-updates' requires the host app to add the dependency.";
|
|
90
|
+
}
|
|
91
|
+
return "[buoy] No reload mechanism available. Run in __DEV__ or install expo-updates.";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Trigger a full JS bundle reload. Resolves to a never-resolving promise
|
|
96
|
+
* because the realm is being torn down — code after the call should not
|
|
97
|
+
* execute. Throws synchronously if no strategy is available.
|
|
98
|
+
*/
|
|
99
|
+
async function reloadApp(strategy = "auto", reason = "buoy reload") {
|
|
100
|
+
const resolved = resolveReloadStrategy(strategy);
|
|
101
|
+
if (!resolved) throw new Error(unavailableMessage(strategy));
|
|
102
|
+
if (resolved === "dev-settings") {
|
|
103
|
+
loadDevSettings().reload(reason);
|
|
104
|
+
} else {
|
|
105
|
+
await loadExpoUpdates().reloadAsync();
|
|
106
|
+
}
|
|
107
|
+
return await new Promise(() => {});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Delay before a remotely-requested reload actually fires. The realm dies the
|
|
112
|
+
* instant it does, so a remote caller's acknowledgement (an action result on
|
|
113
|
+
* the sync socket) must be flushed to the broker first — this is the window
|
|
114
|
+
* that lets it get out.
|
|
115
|
+
*/
|
|
116
|
+
const REMOTE_RELOAD_DELAY_MS = exports.REMOTE_RELOAD_DELAY_MS = 250;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Arm a reload to fire shortly, and report which mechanism will do it.
|
|
120
|
+
*
|
|
121
|
+
* Unlike {@link reloadApp}, this returns — synchronously and BEFORE the realm
|
|
122
|
+
* is torn down — so a remote driver (Buoy Desktop, the MCP server) can answer
|
|
123
|
+
* "reload accepted, via dev-settings" over the socket. Throws (without
|
|
124
|
+
* scheduling anything) when no mechanism is available, so an impossible reload
|
|
125
|
+
* fails loudly instead of looking accepted and silently doing nothing.
|
|
126
|
+
*/
|
|
127
|
+
function scheduleReloadApp(options) {
|
|
128
|
+
const strategy = options?.strategy ?? "auto";
|
|
129
|
+
const resolved = resolveReloadStrategy(strategy);
|
|
130
|
+
if (!resolved) throw new Error(unavailableMessage(strategy));
|
|
131
|
+
const delayMs = Math.max(0, options?.delayMs ?? REMOTE_RELOAD_DELAY_MS);
|
|
132
|
+
const reason = options?.reason ?? "buoy remote reload";
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
void reloadApp(resolved, reason).catch(() => {
|
|
135
|
+
// Nothing left to report to — the caller already got its ack, and the
|
|
136
|
+
// pre-flight resolve above means this only trips on a mechanism that
|
|
137
|
+
// broke between scheduling and firing.
|
|
138
|
+
});
|
|
139
|
+
}, delayMs);
|
|
140
|
+
return {
|
|
141
|
+
strategy: resolved,
|
|
142
|
+
delayMs
|
|
143
|
+
};
|
|
144
|
+
}
|