@buoy-gg/shared-ui 7.0.16 → 7.0.17
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/hooks/index.js +7 -0
- package/lib/commonjs/hooks/safe-area-impl.js +1 -1
- package/lib/commonjs/hooks/usePersistedState.js +71 -0
- package/lib/commonjs/icons/index.js +14 -0
- package/lib/commonjs/index.js +42 -0
- package/lib/commonjs/storage/devToolsStorageKeys.js +22 -0
- package/lib/commonjs/ui/components/ModalHeader.js +69 -0
- package/lib/commonjs/ui/components/ToolButton.js +90 -0
- package/lib/commonjs/ui/components/index.js +7 -0
- package/lib/commonjs/ui/index.js +8 -0
- package/lib/commonjs/ui/toolTheme.js +96 -0
- package/lib/commonjs/utils/index.js +38 -0
- package/lib/commonjs/utils/stateSnapshotRegistry.js +62 -0
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/safe-area-impl.js +1 -1
- package/lib/module/hooks/usePersistedState.js +68 -0
- package/lib/module/icons/index.js +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/storage/devToolsStorageKeys.js +22 -0
- package/lib/module/ui/components/ModalHeader.js +70 -2
- package/lib/module/ui/components/ToolButton.js +86 -0
- package/lib/module/ui/components/index.js +1 -0
- package/lib/module/ui/index.js +3 -0
- package/lib/module/ui/toolTheme.js +93 -0
- package/lib/module/utils/index.js +2 -0
- package/lib/module/utils/stateSnapshotRegistry.js +55 -0
- package/lib/typescript/commonjs/hooks/index.d.ts +1 -0
- package/lib/typescript/commonjs/hooks/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/hooks/usePersistedState.d.ts +16 -0
- package/lib/typescript/commonjs/hooks/usePersistedState.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/index.d.ts +1 -0
- package/lib/typescript/commonjs/icons/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts +19 -0
- package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts +13 -1
- package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ToolButton.d.ts +24 -0
- package/lib/typescript/commonjs/ui/components/ToolButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/index.d.ts +4 -0
- package/lib/typescript/commonjs/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +1 -0
- package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/toolTheme.d.ts +68 -0
- package/lib/typescript/commonjs/ui/toolTheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/index.d.ts +2 -0
- package/lib/typescript/commonjs/utils/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/stateSnapshotRegistry.d.ts +67 -0
- package/lib/typescript/commonjs/utils/stateSnapshotRegistry.d.ts.map +1 -0
- package/lib/typescript/module/hooks/index.d.ts +1 -0
- package/lib/typescript/module/hooks/index.d.ts.map +1 -1
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/hooks/usePersistedState.d.ts +16 -0
- package/lib/typescript/module/hooks/usePersistedState.d.ts.map +1 -0
- package/lib/typescript/module/icons/index.d.ts +1 -0
- package/lib/typescript/module/icons/index.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/storage/devToolsStorageKeys.d.ts +19 -0
- package/lib/typescript/module/storage/devToolsStorageKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ModalHeader.d.ts +13 -1
- package/lib/typescript/module/ui/components/ModalHeader.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ToolButton.d.ts +24 -0
- package/lib/typescript/module/ui/components/ToolButton.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/index.d.ts +4 -0
- package/lib/typescript/module/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/index.d.ts +1 -0
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/toolTheme.d.ts +68 -0
- package/lib/typescript/module/ui/toolTheme.d.ts.map +1 -0
- package/lib/typescript/module/utils/index.d.ts +2 -0
- package/lib/typescript/module/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/utils/stateSnapshotRegistry.d.ts +67 -0
- package/lib/typescript/module/utils/stateSnapshotRegistry.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "useFilterManager", {
|
|
|
33
33
|
return _useFilterManager.useFilterManager;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "usePersistedState", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _usePersistedState.usePersistedState;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, "useSafeAreaInsets", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function () {
|
|
@@ -40,5 +46,6 @@ Object.defineProperty(exports, "useSafeAreaInsets", {
|
|
|
40
46
|
}
|
|
41
47
|
});
|
|
42
48
|
var _useFilterManager = require("./useFilterManager.js");
|
|
49
|
+
var _usePersistedState = require("./usePersistedState.js");
|
|
43
50
|
var _useSafeAreaInsets = require("./useSafeAreaInsets.js");
|
|
44
51
|
var _useDeviceInfo = require("./useDeviceInfo.js");
|
|
@@ -7,7 +7,7 @@ exports.useNativeSafeAreaInsets = exports.safeAreaType = exports.hasSafeAreaPack
|
|
|
7
7
|
/**
|
|
8
8
|
* Auto-generated safe area implementation
|
|
9
9
|
* Detected: none
|
|
10
|
-
* Generated at: 2026-08-
|
|
10
|
+
* Generated at: 2026-08-07T14:32:36.664Z
|
|
11
11
|
*
|
|
12
12
|
* DO NOT EDIT - This file is generated by scripts/detect-safe-area.js
|
|
13
13
|
*
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePersistedState = usePersistedState;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _persistentStorage = require("../utils/persistentStorage.js");
|
|
9
|
+
/**
|
|
10
|
+
* Per-key cache so remounts (and multiple consumers of the same key) render
|
|
11
|
+
* the last-known value immediately instead of flashing the default while the
|
|
12
|
+
* async backend loads again.
|
|
13
|
+
*/
|
|
14
|
+
const hydratedCache = new Map();
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* `useState` persisted through `persistentStorage` (FileSystem → AsyncStorage
|
|
18
|
+
* → memory). Replaces the load-then-`hasLoaded`-guard `useEffect` pattern
|
|
19
|
+
* every tool used to hand-roll.
|
|
20
|
+
*
|
|
21
|
+
* Values are JSON-serialized; the default is returned until hydration
|
|
22
|
+
* completes (subsequent mounts of the same key hydrate synchronously from an
|
|
23
|
+
* in-memory cache). The third tuple element reports hydration so callers can
|
|
24
|
+
* defer writes that must not clobber a not-yet-loaded value.
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const [tab, setTab, tabHydrated] = usePersistedState("@react_buoy_custom_flags_tab", "flags");
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
function usePersistedState(key, defaultValue) {
|
|
31
|
+
const [value, setValue] = (0, _react.useState)(() => hydratedCache.has(key) ? hydratedCache.get(key) : defaultValue);
|
|
32
|
+
const [hydrated, setHydrated] = (0, _react.useState)(() => hydratedCache.has(key));
|
|
33
|
+
const keyRef = (0, _react.useRef)(key);
|
|
34
|
+
keyRef.current = key;
|
|
35
|
+
(0, _react.useEffect)(() => {
|
|
36
|
+
if (hydratedCache.has(key)) {
|
|
37
|
+
setValue(hydratedCache.get(key));
|
|
38
|
+
setHydrated(true);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
let cancelled = false;
|
|
42
|
+
_persistentStorage.persistentStorage.getItem(key).then(raw => {
|
|
43
|
+
if (cancelled) return;
|
|
44
|
+
if (raw != null) {
|
|
45
|
+
try {
|
|
46
|
+
const parsed = JSON.parse(raw);
|
|
47
|
+
hydratedCache.set(key, parsed);
|
|
48
|
+
setValue(parsed);
|
|
49
|
+
} catch {
|
|
50
|
+
// Corrupt payload — fall back to the default and let the next
|
|
51
|
+
// write repair it.
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
setHydrated(true);
|
|
55
|
+
}).catch(() => {
|
|
56
|
+
if (!cancelled) setHydrated(true);
|
|
57
|
+
});
|
|
58
|
+
return () => {
|
|
59
|
+
cancelled = true;
|
|
60
|
+
};
|
|
61
|
+
}, [key]);
|
|
62
|
+
const set = (0, _react.useCallback)(next => {
|
|
63
|
+
setValue(prev => {
|
|
64
|
+
const resolved = typeof next === "function" ? next(prev) : next;
|
|
65
|
+
hydratedCache.set(keyRef.current, resolved);
|
|
66
|
+
_persistentStorage.persistentStorage.setItem(keyRef.current, JSON.stringify(resolved)).catch(() => {});
|
|
67
|
+
return resolved;
|
|
68
|
+
});
|
|
69
|
+
}, []);
|
|
70
|
+
return [value, set, hydrated];
|
|
71
|
+
}
|
|
@@ -10,6 +10,8 @@ var _exportNames = {
|
|
|
10
10
|
ENV_ICON_COLOR: true,
|
|
11
11
|
ConsoleIcon: true,
|
|
12
12
|
CONSOLE_ICON_COLOR: true,
|
|
13
|
+
TimeMachineIcon: true,
|
|
14
|
+
TIME_MACHINE_ICON_COLOR: true,
|
|
13
15
|
ImagesIcon: true,
|
|
14
16
|
IMAGES_ICON_COLOR: true,
|
|
15
17
|
AssetsIcon: true,
|
|
@@ -218,6 +220,18 @@ Object.defineProperty(exports, "StorageStackIcon", {
|
|
|
218
220
|
return _StorageStackIcon.StorageStackIcon;
|
|
219
221
|
}
|
|
220
222
|
});
|
|
223
|
+
Object.defineProperty(exports, "TIME_MACHINE_ICON_COLOR", {
|
|
224
|
+
enumerable: true,
|
|
225
|
+
get: function () {
|
|
226
|
+
return _floatingToolsCore.TIME_MACHINE_ICON_COLOR;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
Object.defineProperty(exports, "TimeMachineIcon", {
|
|
230
|
+
enumerable: true,
|
|
231
|
+
get: function () {
|
|
232
|
+
return _floatingToolsCore.TimeMachineIcon;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
221
235
|
Object.defineProperty(exports, "WifiCircuitIcon", {
|
|
222
236
|
enumerable: true,
|
|
223
237
|
get: function () {
|
package/lib/commonjs/index.js
CHANGED
|
@@ -29,6 +29,12 @@ var _exportNames = {
|
|
|
29
29
|
getCachedOptionalModule: true,
|
|
30
30
|
setRenderCaptureProvider: true,
|
|
31
31
|
getRenderCaptureProvider: true,
|
|
32
|
+
registerStateSnapshotProvider: true,
|
|
33
|
+
getStateSnapshotProviders: true,
|
|
34
|
+
getStateSnapshotProvider: true,
|
|
35
|
+
subscribeToStateSnapshotProviders: true,
|
|
36
|
+
superJsonSerialize: true,
|
|
37
|
+
superJsonDeserialize: true,
|
|
32
38
|
reloadApp: true,
|
|
33
39
|
scheduleReloadApp: true,
|
|
34
40
|
resolveReloadStrategy: true,
|
|
@@ -248,6 +254,18 @@ Object.defineProperty(exports, "getSafeRouter", {
|
|
|
248
254
|
return _index3.getSafeRouter;
|
|
249
255
|
}
|
|
250
256
|
});
|
|
257
|
+
Object.defineProperty(exports, "getStateSnapshotProvider", {
|
|
258
|
+
enumerable: true,
|
|
259
|
+
get: function () {
|
|
260
|
+
return _index3.getStateSnapshotProvider;
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
Object.defineProperty(exports, "getStateSnapshotProviders", {
|
|
264
|
+
enumerable: true,
|
|
265
|
+
get: function () {
|
|
266
|
+
return _index3.getStateSnapshotProviders;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
251
269
|
Object.defineProperty(exports, "getStorageBackendType", {
|
|
252
270
|
enumerable: true,
|
|
253
271
|
get: function () {
|
|
@@ -380,6 +398,12 @@ Object.defineProperty(exports, "refreshGameUIColors", {
|
|
|
380
398
|
return _gameUIColors.refreshGameUIColors;
|
|
381
399
|
}
|
|
382
400
|
});
|
|
401
|
+
Object.defineProperty(exports, "registerStateSnapshotProvider", {
|
|
402
|
+
enumerable: true,
|
|
403
|
+
get: function () {
|
|
404
|
+
return _index3.registerStateSnapshotProvider;
|
|
405
|
+
}
|
|
406
|
+
});
|
|
383
407
|
Object.defineProperty(exports, "reloadApp", {
|
|
384
408
|
enumerable: true,
|
|
385
409
|
get: function () {
|
|
@@ -410,6 +434,12 @@ Object.defineProperty(exports, "setRenderCaptureProvider", {
|
|
|
410
434
|
return _index3.setRenderCaptureProvider;
|
|
411
435
|
}
|
|
412
436
|
});
|
|
437
|
+
Object.defineProperty(exports, "subscribeToStateSnapshotProviders", {
|
|
438
|
+
enumerable: true,
|
|
439
|
+
get: function () {
|
|
440
|
+
return _index3.subscribeToStateSnapshotProviders;
|
|
441
|
+
}
|
|
442
|
+
});
|
|
413
443
|
Object.defineProperty(exports, "subscribeToSubscriberCountChanges", {
|
|
414
444
|
enumerable: true,
|
|
415
445
|
get: function () {
|
|
@@ -422,6 +452,18 @@ Object.defineProperty(exports, "subscriberCountNotifier", {
|
|
|
422
452
|
return _index3.subscriberCountNotifier;
|
|
423
453
|
}
|
|
424
454
|
});
|
|
455
|
+
Object.defineProperty(exports, "superJsonDeserialize", {
|
|
456
|
+
enumerable: true,
|
|
457
|
+
get: function () {
|
|
458
|
+
return _index3.superJsonDeserialize;
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
Object.defineProperty(exports, "superJsonSerialize", {
|
|
462
|
+
enumerable: true,
|
|
463
|
+
get: function () {
|
|
464
|
+
return _index3.superJsonSerialize;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
425
467
|
Object.defineProperty(exports, "truncateText", {
|
|
426
468
|
enumerable: true,
|
|
427
469
|
get: function () {
|
|
@@ -38,6 +38,28 @@ const devToolsStorageKeys = exports.devToolsStorageKeys = {
|
|
|
38
38
|
dimensions: () => `${devToolsStorageKeys.modal.root()}_dimensions`,
|
|
39
39
|
hintAcknowledged: () => `${devToolsStorageKeys.modal.root()}_hint_acknowledged`
|
|
40
40
|
},
|
|
41
|
+
/**
|
|
42
|
+
* Namespace factory for third-party custom tools. Keys share the
|
|
43
|
+
* `@react_buoy` prefix, so `isDevToolsStorageKey` filtering (and the Storage
|
|
44
|
+
* tool's internal-key handling) covers custom-tool persistence for free.
|
|
45
|
+
*
|
|
46
|
+
* ```ts
|
|
47
|
+
* const keys = devToolsStorageKeys.custom("feature-flags");
|
|
48
|
+
* keys.modal(); // "@react_buoy_custom_feature-flags_modal"
|
|
49
|
+
* keys.key("overrides"); // "@react_buoy_custom_feature-flags_overrides"
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
custom: toolId => {
|
|
53
|
+
const root = `${devToolsStorageKeys.base}_custom_${toolId}`;
|
|
54
|
+
return {
|
|
55
|
+
root: () => root,
|
|
56
|
+
/** JsModal `persistenceKey` for this tool's window dimensions. */
|
|
57
|
+
modal: () => `${root}_modal`,
|
|
58
|
+
settings: () => `${root}_settings`,
|
|
59
|
+
/** Arbitrary tool-scoped key. */
|
|
60
|
+
key: suffix => `${root}_${suffix}`
|
|
61
|
+
};
|
|
62
|
+
},
|
|
41
63
|
/**
|
|
42
64
|
* Settings-related storage keys
|
|
43
65
|
*/
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Actions = Actions;
|
|
7
7
|
exports.Content = Content;
|
|
8
|
+
exports.HeaderSearch = HeaderSearch;
|
|
8
9
|
exports.ModalHeader = ModalHeader;
|
|
9
10
|
exports.Navigation = Navigation;
|
|
10
11
|
var _reactNative = require("react-native");
|
|
12
|
+
var _react = require("react");
|
|
11
13
|
var _index = require("../../icons/index.js");
|
|
12
14
|
var _gameUIColors = require("../gameUI/constants/gameUIColors.js");
|
|
13
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -118,10 +120,51 @@ function Actions({
|
|
|
118
120
|
}
|
|
119
121
|
Actions.displayName = "ModalHeaderActions";
|
|
120
122
|
|
|
123
|
+
// Expanding search input for the header. Render this IN PLACE OF
|
|
124
|
+
// `ModalHeader.Content` while search is active — it fills the same flex slot.
|
|
125
|
+
// Extracts the idiom env/network/storage each hand-rolled (~50 lines apiece).
|
|
126
|
+
|
|
127
|
+
function HeaderSearch({
|
|
128
|
+
value,
|
|
129
|
+
onChangeText,
|
|
130
|
+
onCancel,
|
|
131
|
+
placeholder = "Search...",
|
|
132
|
+
autoFocus = true
|
|
133
|
+
}) {
|
|
134
|
+
const inputRef = (0, _react.useRef)(null);
|
|
135
|
+
(0, _react.useEffect)(() => {
|
|
136
|
+
if (autoFocus) inputRef.current?.focus();
|
|
137
|
+
}, [autoFocus]);
|
|
138
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
139
|
+
style: styles.searchContainer,
|
|
140
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Search, {
|
|
141
|
+
size: 12,
|
|
142
|
+
color: _gameUIColors.buoyColors.textSecondary
|
|
143
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
144
|
+
ref: inputRef,
|
|
145
|
+
style: styles.searchInput,
|
|
146
|
+
placeholder: placeholder,
|
|
147
|
+
placeholderTextColor: _gameUIColors.buoyColors.textMuted,
|
|
148
|
+
value: value,
|
|
149
|
+
onChangeText: onChangeText,
|
|
150
|
+
autoCorrect: false,
|
|
151
|
+
autoCapitalize: "none"
|
|
152
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
153
|
+
onPress: onCancel,
|
|
154
|
+
style: styles.searchCancelButton,
|
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.X, {
|
|
156
|
+
size: 12,
|
|
157
|
+
color: _gameUIColors.buoyColors.textSecondary
|
|
158
|
+
})
|
|
159
|
+
})]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
121
163
|
// Attach sub-components to the main component
|
|
122
164
|
ModalHeader.Navigation = Navigation;
|
|
123
165
|
ModalHeader.Content = Content;
|
|
124
166
|
ModalHeader.Actions = Actions;
|
|
167
|
+
ModalHeader.Search = HeaderSearch;
|
|
125
168
|
const styles = _reactNative.StyleSheet.create({
|
|
126
169
|
headerContainer: {
|
|
127
170
|
flexDirection: "row",
|
|
@@ -169,5 +212,31 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
169
212
|
},
|
|
170
213
|
headerContentNoMargin: {
|
|
171
214
|
marginHorizontal: 0
|
|
215
|
+
},
|
|
216
|
+
searchContainer: {
|
|
217
|
+
flexDirection: "row",
|
|
218
|
+
alignItems: "center",
|
|
219
|
+
flex: 1,
|
|
220
|
+
backgroundColor: _gameUIColors.buoyColors.input,
|
|
221
|
+
borderRadius: 6,
|
|
222
|
+
paddingHorizontal: 10,
|
|
223
|
+
paddingVertical: 4,
|
|
224
|
+
marginHorizontal: 12,
|
|
225
|
+
marginVertical: 4,
|
|
226
|
+
height: 32,
|
|
227
|
+
borderWidth: 1,
|
|
228
|
+
borderColor: _gameUIColors.buoyColors.border
|
|
229
|
+
},
|
|
230
|
+
searchInput: {
|
|
231
|
+
flex: 1,
|
|
232
|
+
marginLeft: 8,
|
|
233
|
+
fontSize: 13,
|
|
234
|
+
color: _gameUIColors.buoyColors.text,
|
|
235
|
+
padding: 0,
|
|
236
|
+
height: "100%"
|
|
237
|
+
},
|
|
238
|
+
searchCancelButton: {
|
|
239
|
+
padding: 4,
|
|
240
|
+
marginLeft: 4
|
|
172
241
|
}
|
|
173
242
|
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ToolButton = ToolButton;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _gameUIColors = require("../gameUI/constants/gameUIColors.js");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* The shared action button for dev-tool surfaces. Fills the gap where every
|
|
12
|
+
* tool hand-styled its own TouchableOpacity for "Clear", "Apply", "Reset".
|
|
13
|
+
*/
|
|
14
|
+
function ToolButton({
|
|
15
|
+
label,
|
|
16
|
+
onPress,
|
|
17
|
+
variant = "primary",
|
|
18
|
+
size = "medium",
|
|
19
|
+
disabled = false,
|
|
20
|
+
icon,
|
|
21
|
+
style
|
|
22
|
+
}) {
|
|
23
|
+
const palette = VARIANTS[variant];
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
25
|
+
accessibilityRole: "button",
|
|
26
|
+
accessibilityLabel: label,
|
|
27
|
+
onPress: onPress,
|
|
28
|
+
disabled: disabled,
|
|
29
|
+
style: [styles.base, size === "small" ? styles.small : styles.medium, {
|
|
30
|
+
backgroundColor: palette.background,
|
|
31
|
+
borderColor: palette.border,
|
|
32
|
+
borderWidth: variant === "ghost" ? 0 : 1
|
|
33
|
+
}, disabled && styles.disabled, style],
|
|
34
|
+
children: [icon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
35
|
+
style: [styles.label, size === "small" && styles.labelSmall, {
|
|
36
|
+
color: palette.text
|
|
37
|
+
}],
|
|
38
|
+
children: label
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const VARIANTS = {
|
|
43
|
+
primary: {
|
|
44
|
+
background: _gameUIColors.buoyColors.primary + "22",
|
|
45
|
+
border: _gameUIColors.buoyColors.primary + "66",
|
|
46
|
+
text: _gameUIColors.buoyColors.primary
|
|
47
|
+
},
|
|
48
|
+
danger: {
|
|
49
|
+
background: _gameUIColors.gameUIColors.error + "15",
|
|
50
|
+
border: _gameUIColors.gameUIColors.error + "60",
|
|
51
|
+
text: _gameUIColors.gameUIColors.error
|
|
52
|
+
},
|
|
53
|
+
warning: {
|
|
54
|
+
background: _gameUIColors.gameUIColors.warning + "15",
|
|
55
|
+
border: _gameUIColors.gameUIColors.warning + "60",
|
|
56
|
+
text: _gameUIColors.gameUIColors.warning
|
|
57
|
+
},
|
|
58
|
+
ghost: {
|
|
59
|
+
background: "transparent",
|
|
60
|
+
border: "transparent",
|
|
61
|
+
text: _gameUIColors.buoyColors.textSecondary
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const styles = _reactNative.StyleSheet.create({
|
|
65
|
+
base: {
|
|
66
|
+
flexDirection: "row",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
justifyContent: "center",
|
|
69
|
+
gap: 6,
|
|
70
|
+
borderRadius: 8
|
|
71
|
+
},
|
|
72
|
+
medium: {
|
|
73
|
+
paddingVertical: 8,
|
|
74
|
+
paddingHorizontal: 14
|
|
75
|
+
},
|
|
76
|
+
small: {
|
|
77
|
+
paddingVertical: 5,
|
|
78
|
+
paddingHorizontal: 10
|
|
79
|
+
},
|
|
80
|
+
disabled: {
|
|
81
|
+
opacity: 0.4
|
|
82
|
+
},
|
|
83
|
+
label: {
|
|
84
|
+
fontSize: 12,
|
|
85
|
+
fontWeight: "600"
|
|
86
|
+
},
|
|
87
|
+
labelSmall: {
|
|
88
|
+
fontSize: 11
|
|
89
|
+
}
|
|
90
|
+
});
|
|
@@ -297,6 +297,12 @@ Object.defineProperty(exports, "TimeDisplay", {
|
|
|
297
297
|
return _TimeDisplay.TimeDisplay;
|
|
298
298
|
}
|
|
299
299
|
});
|
|
300
|
+
Object.defineProperty(exports, "ToolButton", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () {
|
|
303
|
+
return _ToolButton.ToolButton;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
300
306
|
Object.defineProperty(exports, "ToolbarClearButton", {
|
|
301
307
|
enumerable: true,
|
|
302
308
|
get: function () {
|
|
@@ -352,6 +358,7 @@ var _FilterComponents = require("./FilterComponents.js");
|
|
|
352
358
|
var _CompactFilterChips = require("./CompactFilterChips.js");
|
|
353
359
|
var _Badge = require("./Badge.js");
|
|
354
360
|
var _TabSelector = require("./TabSelector.js");
|
|
361
|
+
var _ToolButton = require("./ToolButton.js");
|
|
355
362
|
var _EventListItem = require("./EventListItem.js");
|
|
356
363
|
var _StatsCard = require("./StatsCard.js");
|
|
357
364
|
var _CompactRow = require("./CompactRow.js");
|
package/lib/commonjs/ui/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
+
toolTheme: true,
|
|
7
8
|
CyberpunkSectionButton: true
|
|
8
9
|
};
|
|
9
10
|
Object.defineProperty(exports, "CyberpunkSectionButton", {
|
|
@@ -12,6 +13,12 @@ Object.defineProperty(exports, "CyberpunkSectionButton", {
|
|
|
12
13
|
return _CyberpunkSectionButton.CyberpunkSectionButton;
|
|
13
14
|
}
|
|
14
15
|
});
|
|
16
|
+
Object.defineProperty(exports, "toolTheme", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _toolTheme.toolTheme;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
15
22
|
var _index = require("./components/index.js");
|
|
16
23
|
Object.keys(_index).forEach(function (key) {
|
|
17
24
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -24,6 +31,7 @@ Object.keys(_index).forEach(function (key) {
|
|
|
24
31
|
}
|
|
25
32
|
});
|
|
26
33
|
});
|
|
34
|
+
var _toolTheme = require("./toolTheme.js");
|
|
27
35
|
var _CyberpunkSectionButton = require("./console/CyberpunkSectionButton.js");
|
|
28
36
|
var _index2 = require("./gameUI/index.js");
|
|
29
37
|
Object.keys(_index2).forEach(function (key) {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toolTheme = void 0;
|
|
7
|
+
var _gameUIColors = require("./gameUI/constants/gameUIColors.js");
|
|
8
|
+
/**
|
|
9
|
+
* Semantic design tokens for dev-tool surfaces — the single documented entry
|
|
10
|
+
* point for custom-tool authors (and, over time, internal tools).
|
|
11
|
+
*
|
|
12
|
+
* Buoy historically grew three color systems (`buoyColors`, `gameUIColors`,
|
|
13
|
+
* `macOSColors`) with tribal knowledge about which to use where. `toolTheme`
|
|
14
|
+
* encodes that knowledge: surfaces/text come from the brand palette, semantic
|
|
15
|
+
* status colors from the gameUI palette. Consumers should not need to know
|
|
16
|
+
* that split exists.
|
|
17
|
+
*/
|
|
18
|
+
const toolTheme = exports.toolTheme = {
|
|
19
|
+
colors: {
|
|
20
|
+
/** Modal/page background. */
|
|
21
|
+
surface: _gameUIColors.buoyColors.base,
|
|
22
|
+
/** Card / row background, one step above surface. */
|
|
23
|
+
card: _gameUIColors.buoyColors.card,
|
|
24
|
+
/** Pressed/hover background. */
|
|
25
|
+
hover: _gameUIColors.buoyColors.hover,
|
|
26
|
+
/** Text-input background. */
|
|
27
|
+
input: _gameUIColors.buoyColors.input,
|
|
28
|
+
border: _gameUIColors.buoyColors.border,
|
|
29
|
+
borderStrong: _gameUIColors.buoyColors.borderStrong,
|
|
30
|
+
text: _gameUIColors.buoyColors.text,
|
|
31
|
+
textSecondary: _gameUIColors.buoyColors.textSecondary,
|
|
32
|
+
textMuted: _gameUIColors.buoyColors.textMuted,
|
|
33
|
+
/** Buoy teal — primary accent. */
|
|
34
|
+
accent: _gameUIColors.buoyColors.primary,
|
|
35
|
+
success: _gameUIColors.gameUIColors.success,
|
|
36
|
+
warning: _gameUIColors.gameUIColors.warning,
|
|
37
|
+
error: _gameUIColors.gameUIColors.error,
|
|
38
|
+
info: _gameUIColors.gameUIColors.info
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Text presets matching the styles internal tools re-declare per file.
|
|
42
|
+
* Spread into a style: `style={[toolTheme.text.label, { color: ... }]}`.
|
|
43
|
+
*/
|
|
44
|
+
text: {
|
|
45
|
+
/** Modal/section titles. */
|
|
46
|
+
title: {
|
|
47
|
+
fontSize: 14,
|
|
48
|
+
fontWeight: "600",
|
|
49
|
+
color: _gameUIColors.buoyColors.text
|
|
50
|
+
},
|
|
51
|
+
/** Default body copy. */
|
|
52
|
+
body: {
|
|
53
|
+
fontSize: 13,
|
|
54
|
+
color: _gameUIColors.buoyColors.text
|
|
55
|
+
},
|
|
56
|
+
/** Secondary copy under a primary line. */
|
|
57
|
+
subtitle: {
|
|
58
|
+
fontSize: 12,
|
|
59
|
+
color: _gameUIColors.buoyColors.textSecondary
|
|
60
|
+
},
|
|
61
|
+
/** ALL-CAPS section labels ("LOCAL OVERRIDES"). */
|
|
62
|
+
label: {
|
|
63
|
+
fontSize: 10,
|
|
64
|
+
fontWeight: "700",
|
|
65
|
+
color: _gameUIColors.buoyColors.textMuted,
|
|
66
|
+
letterSpacing: 1.2,
|
|
67
|
+
fontFamily: "monospace"
|
|
68
|
+
},
|
|
69
|
+
/** Monospace values (keys, ids, payload snippets). */
|
|
70
|
+
mono: {
|
|
71
|
+
fontSize: 11,
|
|
72
|
+
color: _gameUIColors.buoyColors.textSecondary,
|
|
73
|
+
fontFamily: "monospace"
|
|
74
|
+
},
|
|
75
|
+
/** Timestamps and fine print. */
|
|
76
|
+
small: {
|
|
77
|
+
fontSize: 9,
|
|
78
|
+
color: _gameUIColors.buoyColors.textMuted,
|
|
79
|
+
fontFamily: "monospace"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
/** 4-based spacing scale used across tool surfaces. */
|
|
83
|
+
spacing: {
|
|
84
|
+
xs: 4,
|
|
85
|
+
sm: 8,
|
|
86
|
+
md: 12,
|
|
87
|
+
lg: 16,
|
|
88
|
+
xl: 24
|
|
89
|
+
},
|
|
90
|
+
radius: {
|
|
91
|
+
sm: 6,
|
|
92
|
+
md: 8,
|
|
93
|
+
lg: 12,
|
|
94
|
+
pill: 9999
|
|
95
|
+
}
|
|
96
|
+
};
|
|
@@ -81,6 +81,18 @@ Object.defineProperty(exports, "getSafeRouter", {
|
|
|
81
81
|
return _safeExpoRouter.getSafeRouter;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
+
Object.defineProperty(exports, "getStateSnapshotProvider", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _stateSnapshotRegistry.getStateSnapshotProvider;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "getStateSnapshotProviders", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _stateSnapshotRegistry.getStateSnapshotProviders;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
84
96
|
Object.defineProperty(exports, "getStorageBackendType", {
|
|
85
97
|
enumerable: true,
|
|
86
98
|
get: function () {
|
|
@@ -171,6 +183,12 @@ Object.defineProperty(exports, "persistentStorage", {
|
|
|
171
183
|
return _persistentStorage.persistentStorage;
|
|
172
184
|
}
|
|
173
185
|
});
|
|
186
|
+
Object.defineProperty(exports, "registerStateSnapshotProvider", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () {
|
|
189
|
+
return _stateSnapshotRegistry.registerStateSnapshotProvider;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
174
192
|
Object.defineProperty(exports, "reloadApp", {
|
|
175
193
|
enumerable: true,
|
|
176
194
|
get: function () {
|
|
@@ -201,6 +219,12 @@ Object.defineProperty(exports, "setRenderCaptureProvider", {
|
|
|
201
219
|
return _renderCaptureRegistry.setRenderCaptureProvider;
|
|
202
220
|
}
|
|
203
221
|
});
|
|
222
|
+
Object.defineProperty(exports, "subscribeToStateSnapshotProviders", {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
get: function () {
|
|
225
|
+
return _stateSnapshotRegistry.subscribeToStateSnapshotProviders;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
204
228
|
Object.defineProperty(exports, "subscribeToSubscriberCountChanges", {
|
|
205
229
|
enumerable: true,
|
|
206
230
|
get: function () {
|
|
@@ -213,6 +237,18 @@ Object.defineProperty(exports, "subscriberCountNotifier", {
|
|
|
213
237
|
return _subscriberCountNotifier.subscriberCountNotifier;
|
|
214
238
|
}
|
|
215
239
|
});
|
|
240
|
+
Object.defineProperty(exports, "superJsonDeserialize", {
|
|
241
|
+
enumerable: true,
|
|
242
|
+
get: function () {
|
|
243
|
+
return _minimalSuperJSON.deserialize;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
Object.defineProperty(exports, "superJsonSerialize", {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
get: function () {
|
|
249
|
+
return _minimalSuperJSON.serialize;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
216
252
|
Object.defineProperty(exports, "truncateText", {
|
|
217
253
|
enumerable: true,
|
|
218
254
|
get: function () {
|
|
@@ -252,6 +288,8 @@ var _typeHelpers = require("./typeHelpers.js");
|
|
|
252
288
|
var _valueFormatting = require("./valueFormatting.js");
|
|
253
289
|
var _loadOptionalModule = require("./loadOptionalModule.js");
|
|
254
290
|
var _renderCaptureRegistry = require("./renderCaptureRegistry.js");
|
|
291
|
+
var _stateSnapshotRegistry = require("./stateSnapshotRegistry.js");
|
|
292
|
+
var _minimalSuperJSON = require("./minimalSuperJSON.js");
|
|
255
293
|
var _reloadApp = require("./reloadApp.js");
|
|
256
294
|
var _subscribable = require("./subscribable.js");
|
|
257
295
|
var _subscriberCountNotifier = require("./subscriberCountNotifier.js");
|