@buoy-gg/shared-ui 7.0.30 → 7.0.32
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/JsModal.js +18 -2
- package/lib/commonjs/JsModal.web.js +7 -4
- package/lib/commonjs/dataViewer/DataTreeActionDock.js +4 -2
- package/lib/commonjs/dataViewer/LiveExplorer.js +930 -0
- package/lib/commonjs/dataViewer/ValueEditModal.js +385 -0
- package/lib/commonjs/dataViewer/index.js +47 -0
- package/lib/commonjs/dataViewer/nestedPath.js +115 -0
- package/lib/commonjs/dataViewer/treeActions.js +3 -2
- package/lib/commonjs/dataViewer/useTreeDraft.js +125 -0
- package/lib/commonjs/dataViewer/useTreeEditor.js +105 -0
- package/lib/commonjs/env/EnvironmentIndicator.js +7 -1
- package/lib/commonjs/hooks/safe-area-impl.js +1 -1
- package/lib/commonjs/index.js +24 -0
- package/lib/commonjs/license/tierLimits.js +14 -0
- package/lib/commonjs/storage/devToolsStorageKeys.js +36 -0
- package/lib/commonjs/sync/toolActionRegistry.js +166 -0
- package/lib/commonjs/sync/toolUiBridge.js +74 -0
- package/lib/commonjs/ui/components/CompactRow.js +4 -0
- package/lib/commonjs/ui/components/EventHistoryViewer/DiffModeTabs.js +9 -1
- package/lib/commonjs/ui/components/ExpandedInfoRow.js +3 -1
- package/lib/commonjs/ui/components/ModalHeader.js +12 -4
- package/lib/commonjs/ui/components/SearchBar.js +5 -109
- package/lib/commonjs/ui/components/ToolButton.js +5 -2
- package/lib/commonjs/ui/components/index.js +13 -0
- package/lib/commonjs/ui/components/windowDrag.js +45 -0
- package/lib/module/JsModal.js +18 -2
- package/lib/module/JsModal.web.js +7 -4
- package/lib/module/dataViewer/DataTreeActionDock.js +4 -2
- package/lib/module/dataViewer/LiveExplorer.js +925 -0
- package/lib/module/dataViewer/ValueEditModal.js +381 -0
- package/lib/module/dataViewer/index.js +10 -1
- package/lib/module/dataViewer/nestedPath.js +109 -0
- package/lib/module/dataViewer/treeActions.js +3 -2
- package/lib/module/dataViewer/useTreeDraft.js +121 -0
- package/lib/module/dataViewer/useTreeEditor.js +101 -0
- package/lib/module/env/EnvironmentIndicator.js +7 -1
- package/lib/module/hooks/safe-area-impl.js +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/license/tierLimits.js +14 -0
- package/lib/module/storage/devToolsStorageKeys.js +36 -0
- package/lib/module/sync/toolActionRegistry.js +154 -0
- package/lib/module/sync/toolUiBridge.js +68 -0
- package/lib/module/ui/components/CompactRow.js +4 -0
- package/lib/module/ui/components/EventHistoryViewer/DiffModeTabs.js +9 -1
- package/lib/module/ui/components/ExpandedInfoRow.js +3 -1
- package/lib/module/ui/components/ModalHeader.js +12 -4
- package/lib/module/ui/components/SearchBar.js +8 -112
- package/lib/module/ui/components/ToolButton.js +5 -2
- package/lib/module/ui/components/index.js +1 -0
- package/lib/module/ui/components/windowDrag.js +41 -0
- package/lib/typescript/commonjs/JsModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/JsModal.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/DataTreeActionDock.d.ts +6 -1
- package/lib/typescript/commonjs/dataViewer/DataTreeActionDock.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/LiveExplorer.d.ts +73 -0
- package/lib/typescript/commonjs/dataViewer/LiveExplorer.d.ts.map +1 -0
- package/lib/typescript/commonjs/dataViewer/ValueEditModal.d.ts +40 -0
- package/lib/typescript/commonjs/dataViewer/ValueEditModal.d.ts.map +1 -0
- package/lib/typescript/commonjs/dataViewer/index.d.ts +5 -0
- package/lib/typescript/commonjs/dataViewer/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/nestedPath.d.ts +20 -0
- package/lib/typescript/commonjs/dataViewer/nestedPath.d.ts.map +1 -0
- package/lib/typescript/commonjs/dataViewer/treeActions.d.ts +10 -0
- package/lib/typescript/commonjs/dataViewer/treeActions.d.ts.map +1 -1
- package/lib/typescript/commonjs/dataViewer/useTreeDraft.d.ts +81 -0
- package/lib/typescript/commonjs/dataViewer/useTreeDraft.d.ts.map +1 -0
- package/lib/typescript/commonjs/dataViewer/useTreeEditor.d.ts +52 -0
- package/lib/typescript/commonjs/dataViewer/useTreeEditor.d.ts.map +1 -0
- package/lib/typescript/commonjs/env/EnvironmentIndicator.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/license/tierLimits.d.ts +10 -0
- package/lib/typescript/commonjs/license/tierLimits.d.ts.map +1 -1
- package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts +36 -0
- package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/sync/toolActionRegistry.d.ts +85 -0
- package/lib/typescript/commonjs/sync/toolActionRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/sync/toolUiBridge.d.ts +39 -0
- package/lib/typescript/commonjs/sync/toolUiBridge.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/CompactRow.d.ts +5 -1
- package/lib/typescript/commonjs/ui/components/CompactRow.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/EventHistoryViewer/DiffModeTabs.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/EventHistoryViewer/types.d.ts +6 -0
- package/lib/typescript/commonjs/ui/components/EventHistoryViewer/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ExpandedInfoRow.d.ts +7 -1
- package/lib/typescript/commonjs/ui/components/ExpandedInfoRow.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/SearchBar.d.ts +1 -3
- package/lib/typescript/commonjs/ui/components/SearchBar.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ToolButton.d.ts +5 -1
- package/lib/typescript/commonjs/ui/components/ToolButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/index.d.ts +1 -0
- package/lib/typescript/commonjs/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/windowDrag.d.ts +39 -0
- package/lib/typescript/commonjs/ui/components/windowDrag.d.ts.map +1 -0
- package/lib/typescript/module/JsModal.d.ts.map +1 -1
- package/lib/typescript/module/JsModal.web.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/DataTreeActionDock.d.ts +6 -1
- package/lib/typescript/module/dataViewer/DataTreeActionDock.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/LiveExplorer.d.ts +73 -0
- package/lib/typescript/module/dataViewer/LiveExplorer.d.ts.map +1 -0
- package/lib/typescript/module/dataViewer/ValueEditModal.d.ts +40 -0
- package/lib/typescript/module/dataViewer/ValueEditModal.d.ts.map +1 -0
- package/lib/typescript/module/dataViewer/index.d.ts +5 -0
- package/lib/typescript/module/dataViewer/index.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/nestedPath.d.ts +20 -0
- package/lib/typescript/module/dataViewer/nestedPath.d.ts.map +1 -0
- package/lib/typescript/module/dataViewer/treeActions.d.ts +10 -0
- package/lib/typescript/module/dataViewer/treeActions.d.ts.map +1 -1
- package/lib/typescript/module/dataViewer/useTreeDraft.d.ts +81 -0
- package/lib/typescript/module/dataViewer/useTreeDraft.d.ts.map +1 -0
- package/lib/typescript/module/dataViewer/useTreeEditor.d.ts +52 -0
- package/lib/typescript/module/dataViewer/useTreeEditor.d.ts.map +1 -0
- package/lib/typescript/module/env/EnvironmentIndicator.d.ts.map +1 -1
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/index.d.ts +2 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/license/tierLimits.d.ts +10 -0
- package/lib/typescript/module/license/tierLimits.d.ts.map +1 -1
- package/lib/typescript/module/storage/devToolsStorageKeys.d.ts +36 -0
- package/lib/typescript/module/storage/devToolsStorageKeys.d.ts.map +1 -1
- package/lib/typescript/module/sync/toolActionRegistry.d.ts +85 -0
- package/lib/typescript/module/sync/toolActionRegistry.d.ts.map +1 -0
- package/lib/typescript/module/sync/toolUiBridge.d.ts +39 -0
- package/lib/typescript/module/sync/toolUiBridge.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/CompactRow.d.ts +5 -1
- package/lib/typescript/module/ui/components/CompactRow.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/EventHistoryViewer/DiffModeTabs.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/EventHistoryViewer/types.d.ts +6 -0
- package/lib/typescript/module/ui/components/EventHistoryViewer/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ExpandedInfoRow.d.ts +7 -1
- package/lib/typescript/module/ui/components/ExpandedInfoRow.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ModalHeader.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/SearchBar.d.ts +1 -3
- package/lib/typescript/module/ui/components/SearchBar.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ToolButton.d.ts +5 -1
- package/lib/typescript/module/ui/components/ToolButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/index.d.ts +1 -0
- package/lib/typescript/module/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/windowDrag.d.ts +39 -0
- package/lib/typescript/module/ui/components/windowDrag.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { useState
|
|
3
|
+
import { useState } from "react";
|
|
4
4
|
import { View, TextInput, TouchableOpacity, Text, StyleSheet } from "react-native";
|
|
5
|
-
import { Search, X, Filter
|
|
5
|
+
import { Search, X, Filter } from "../../icons/index.js";
|
|
6
6
|
import { gameUIColors } from "../gameUI/index.js";
|
|
7
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
export function SearchBar({
|
|
9
9
|
value,
|
|
10
10
|
onChange,
|
|
11
11
|
onClear,
|
|
12
12
|
placeholder = "Search...",
|
|
13
|
-
suggestions = [],
|
|
14
|
-
recentSearches = [],
|
|
15
13
|
showFilters = false,
|
|
16
14
|
onFilterPress,
|
|
17
15
|
style,
|
|
@@ -22,30 +20,13 @@ export function SearchBar({
|
|
|
22
20
|
returnKeyType
|
|
23
21
|
}) {
|
|
24
22
|
const [isFocused, setIsFocused] = useState(false);
|
|
25
|
-
const [showSuggestions, setShowSuggestions] = useState(false);
|
|
26
|
-
const blurTimeoutRef = useRef(null);
|
|
27
|
-
|
|
28
|
-
// Cleanup timeout on unmount
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
return () => {
|
|
31
|
-
if (blurTimeoutRef.current) {
|
|
32
|
-
clearTimeout(blurTimeoutRef.current);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}, []);
|
|
36
23
|
const handleClear = () => {
|
|
37
24
|
onChange("");
|
|
38
25
|
onClear?.();
|
|
39
26
|
};
|
|
40
|
-
|
|
41
|
-
onChange(suggestion);
|
|
42
|
-
setShowSuggestions(false);
|
|
43
|
-
};
|
|
44
|
-
const filteredSuggestions = suggestions.filter(s => s.toLowerCase().includes(value.toLowerCase()));
|
|
45
|
-
const shouldShowSuggestions = isFocused && (filteredSuggestions.length > 0 || value === "" && recentSearches.length > 0);
|
|
46
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
27
|
+
return /*#__PURE__*/_jsx(View, {
|
|
47
28
|
style: [styles.container, containerStyle],
|
|
48
|
-
children:
|
|
29
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
49
30
|
style: [styles.searchBar, isFocused && styles.searchBarFocused],
|
|
50
31
|
children: [/*#__PURE__*/_jsx(Search, {
|
|
51
32
|
size: 16,
|
|
@@ -56,22 +37,8 @@ export function SearchBar({
|
|
|
56
37
|
placeholderTextColor: gameUIColors.tertiary,
|
|
57
38
|
value: value,
|
|
58
39
|
onChangeText: onChange,
|
|
59
|
-
onFocus: () =>
|
|
60
|
-
|
|
61
|
-
setShowSuggestions(true);
|
|
62
|
-
},
|
|
63
|
-
onBlur: () => {
|
|
64
|
-
setIsFocused(false);
|
|
65
|
-
// Clear any existing timeout
|
|
66
|
-
if (blurTimeoutRef.current) {
|
|
67
|
-
clearTimeout(blurTimeoutRef.current);
|
|
68
|
-
}
|
|
69
|
-
// Set new timeout with proper cleanup
|
|
70
|
-
blurTimeoutRef.current = setTimeout(() => {
|
|
71
|
-
setShowSuggestions(false);
|
|
72
|
-
blurTimeoutRef.current = null;
|
|
73
|
-
}, 200);
|
|
74
|
-
},
|
|
40
|
+
onFocus: () => setIsFocused(true),
|
|
41
|
+
onBlur: () => setIsFocused(false),
|
|
75
42
|
autoFocus: autoFocus,
|
|
76
43
|
autoCapitalize: "none",
|
|
77
44
|
autoCorrect: false,
|
|
@@ -96,40 +63,7 @@ export function SearchBar({
|
|
|
96
63
|
color: gameUIColors.primary
|
|
97
64
|
})
|
|
98
65
|
})]
|
|
99
|
-
})
|
|
100
|
-
style: styles.suggestionsContainer,
|
|
101
|
-
children: [value === "" && recentSearches.length > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
102
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
103
|
-
style: styles.suggestionsTitle,
|
|
104
|
-
children: "Recent"
|
|
105
|
-
}), recentSearches.slice(0, 5).map((search, index) => /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
106
|
-
style: styles.suggestionItem,
|
|
107
|
-
onPress: () => handleSuggestionPress(search),
|
|
108
|
-
children: [/*#__PURE__*/_jsx(Clock, {
|
|
109
|
-
size: 12,
|
|
110
|
-
color: gameUIColors.tertiary
|
|
111
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
112
|
-
style: styles.suggestionText,
|
|
113
|
-
children: search
|
|
114
|
-
})]
|
|
115
|
-
}, index))]
|
|
116
|
-
}), filteredSuggestions.length > 0 && /*#__PURE__*/_jsxs(_Fragment, {
|
|
117
|
-
children: [value !== "" && /*#__PURE__*/_jsx(Text, {
|
|
118
|
-
style: styles.suggestionsTitle,
|
|
119
|
-
children: "Suggestions"
|
|
120
|
-
}), filteredSuggestions.slice(0, 5).map((suggestion, index) => /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
121
|
-
style: styles.suggestionItem,
|
|
122
|
-
onPress: () => handleSuggestionPress(suggestion),
|
|
123
|
-
children: [/*#__PURE__*/_jsx(Search, {
|
|
124
|
-
size: 12,
|
|
125
|
-
color: gameUIColors.tertiary
|
|
126
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
127
|
-
style: styles.suggestionText,
|
|
128
|
-
children: suggestion
|
|
129
|
-
})]
|
|
130
|
-
}, index))]
|
|
131
|
-
})]
|
|
132
|
-
})]
|
|
66
|
+
})
|
|
133
67
|
});
|
|
134
68
|
}
|
|
135
69
|
SearchBar.Quick = function QuickSearch({
|
|
@@ -204,44 +138,6 @@ const styles = StyleSheet.create({
|
|
|
204
138
|
borderRadius: 4,
|
|
205
139
|
backgroundColor: gameUIColors.primary + "20"
|
|
206
140
|
},
|
|
207
|
-
suggestionsContainer: {
|
|
208
|
-
position: "absolute",
|
|
209
|
-
top: "100%",
|
|
210
|
-
left: 0,
|
|
211
|
-
right: 0,
|
|
212
|
-
backgroundColor: gameUIColors.panel,
|
|
213
|
-
borderRadius: 8,
|
|
214
|
-
marginTop: 4,
|
|
215
|
-
paddingVertical: 4,
|
|
216
|
-
maxHeight: 200,
|
|
217
|
-
shadowColor: "#000",
|
|
218
|
-
shadowOffset: {
|
|
219
|
-
width: 0,
|
|
220
|
-
height: 2
|
|
221
|
-
},
|
|
222
|
-
shadowOpacity: 0.1,
|
|
223
|
-
shadowRadius: 4,
|
|
224
|
-
elevation: 3
|
|
225
|
-
},
|
|
226
|
-
suggestionsTitle: {
|
|
227
|
-
fontSize: 10,
|
|
228
|
-
fontWeight: "600",
|
|
229
|
-
color: gameUIColors.secondary,
|
|
230
|
-
textTransform: "uppercase",
|
|
231
|
-
paddingHorizontal: 12,
|
|
232
|
-
paddingVertical: 4
|
|
233
|
-
},
|
|
234
|
-
suggestionItem: {
|
|
235
|
-
flexDirection: "row",
|
|
236
|
-
alignItems: "center",
|
|
237
|
-
paddingHorizontal: 12,
|
|
238
|
-
paddingVertical: 8,
|
|
239
|
-
gap: 8
|
|
240
|
-
},
|
|
241
|
-
suggestionText: {
|
|
242
|
-
fontSize: 13,
|
|
243
|
-
color: gameUIColors.text
|
|
244
|
-
},
|
|
245
141
|
withFiltersContainer: {
|
|
246
142
|
position: "relative"
|
|
247
143
|
},
|
|
@@ -14,12 +14,15 @@ export function ToolButton({
|
|
|
14
14
|
size = "medium",
|
|
15
15
|
disabled = false,
|
|
16
16
|
icon,
|
|
17
|
-
style
|
|
17
|
+
style,
|
|
18
|
+
testID,
|
|
19
|
+
accessibilityLabel
|
|
18
20
|
}) {
|
|
19
21
|
const palette = VARIANTS[variant];
|
|
20
22
|
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
21
23
|
accessibilityRole: "button",
|
|
22
|
-
accessibilityLabel: label,
|
|
24
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
25
|
+
testID: testID,
|
|
23
26
|
onPress: onPress,
|
|
24
27
|
disabled: disabled,
|
|
25
28
|
style: [styles.base, size === "small" ? styles.small : styles.medium, {
|
|
@@ -5,6 +5,7 @@ export { ValueTypeBadge } from "./ValueTypeBadge.js";
|
|
|
5
5
|
export { StorageTypeBadge } from "./StorageTypeBadge.js";
|
|
6
6
|
export { CopyButton, InlineCopyButton, ToolbarCopyButton, ActionCopyButton, ToolbarClearButton } from "./CopyButton.js";
|
|
7
7
|
export { ModalHeader } from "./ModalHeader.js";
|
|
8
|
+
export { windowDragProps, noWindowDragProps } from "./windowDrag.js";
|
|
8
9
|
export { ModalHintBanner } from "./ModalHintBanner.js";
|
|
9
10
|
export { ClipboardHintBanner } from "./ClipboardHintBanner.js";
|
|
10
11
|
export { SectionHeader } from "./SectionHeader.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Desktop window-drag tagging for tool headers.
|
|
5
|
+
*
|
|
6
|
+
* Buoy Desktop runs a FRAMELESS Electron window: nothing but a
|
|
7
|
+
* `-webkit-app-region: drag` region moves it. The sidebar's own header carries
|
|
8
|
+
* that duty, but with the sidebar open the content column has no strip of its
|
|
9
|
+
* own — the TOOL's header is the top edge of the window there, so grabbing it
|
|
10
|
+
* looked like it should move the app and didn't.
|
|
11
|
+
*
|
|
12
|
+
* These spread onto a `View` and mark the region for the desktop stylesheet
|
|
13
|
+
* (`apps/desktop/src/index.css`, `[data-buoy-window-drag]`). react-native-web
|
|
14
|
+
* turns `dataSet` into `data-*` attributes; React Native drops the prop on
|
|
15
|
+
* device, so this is INERT on mobile — the styling that gives it meaning only
|
|
16
|
+
* exists in the desktop app.
|
|
17
|
+
*
|
|
18
|
+
* `dataSet` is a react-native-web extension that RN's own prop types don't
|
|
19
|
+
* declare; spreading it (rather than passing it inline) is what keeps
|
|
20
|
+
* TypeScript quiet, and puts the explanation here once instead of a
|
|
21
|
+
* `@ts-ignore` at every header.
|
|
22
|
+
*
|
|
23
|
+
* A drag region SWALLOWS mouse events, so every control inside one has to opt
|
|
24
|
+
* back out or it stops being clickable. The desktop app does that for itself:
|
|
25
|
+
* react-native-web renders touchables as featureless `<div>`s, so it finds
|
|
26
|
+
* them at runtime by their `cursor: pointer` rather than by any selector —
|
|
27
|
+
* see apps/desktop/src/windowDragRegions.ts. `noWindowDragProps` is here for
|
|
28
|
+
* a region that must opt out regardless of how it looks.
|
|
29
|
+
*/
|
|
30
|
+
export const windowDragProps = {
|
|
31
|
+
dataSet: {
|
|
32
|
+
buoyWindowDrag: "1"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/** Opt a subtree back out of an enclosing {@link windowDragProps} region. */
|
|
37
|
+
export const noWindowDragProps = {
|
|
38
|
+
dataSet: {
|
|
39
|
+
buoyNoDrag: "1"
|
|
40
|
+
}
|
|
41
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsModal.d.ts","sourceRoot":"","sources":["../../../src/JsModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAUL,SAAS,EAEV,MAAM,OAAO,CAAC;AACf,OAAO,EAML,QAAQ,EAGR,SAAS,EAEV,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"JsModal.d.ts","sourceRoot":"","sources":["../../../src/JsModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAUL,SAAS,EAEV,MAAM,OAAO,CAAC;AACf,OAAO,EAML,QAAQ,EAGR,SAAS,EAEV,MAAM,cAAc,CAAC;AAyHtB,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;AAE/C,UAAU,YAAY;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MA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AAE,SAAS,GAAG,OAAO,CAAC;CAC/B;AAwgDD,eAAO,MAAM,OAAO,oDAAyB,CAAC"}
|
|
@@ -28,6 +28,11 @@ export interface DataTreeActionDockProps {
|
|
|
28
28
|
* mode). The phone's does.
|
|
29
29
|
*/
|
|
30
30
|
containersEditable?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Top-level entries can be edited but not removed — for merge-write
|
|
33
|
+
* documents (see `TreeActionOptions.rootEntriesLocked`).
|
|
34
|
+
*/
|
|
35
|
+
rootEntriesLocked?: boolean;
|
|
31
36
|
}
|
|
32
|
-
export declare function DataTreeActionDock({ root, selection, onEdit, onSelectPath, onEditValue, containersEditable, }: DataTreeActionDockProps): import("react").JSX.Element;
|
|
37
|
+
export declare function DataTreeActionDock({ root, selection, onEdit, onSelectPath, onEditValue, containersEditable, rootEntriesLocked, }: DataTreeActionDockProps): import("react").JSX.Element;
|
|
33
38
|
//# sourceMappingURL=DataTreeActionDock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTreeActionDock.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/DataTreeActionDock.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAIL,KAAK,iBAAiB,EAGvB,MAAM,eAAe,CAAC;AAqCvB,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,IAAI,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,iCAAiC;IACjC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,sEAAsE;IACtE,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACvC,8DAA8D;IAC9D,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTreeActionDock.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/DataTreeActionDock.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAIL,KAAK,iBAAiB,EAGvB,MAAM,eAAe,CAAC;AAqCvB,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,IAAI,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,iCAAiC;IACjC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,sEAAsE;IACtE,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACvC,8DAA8D;IAC9D,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAqCD,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,SAAS,EACT,MAAM,EACN,YAAY,EACZ,WAAW,EACX,kBAAyB,EACzB,iBAAyB,GAC1B,EAAE,uBAAuB,+BA2CzB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The LIVE data editor — a recursive JSON tree whose leaves are inputs.
|
|
3
|
+
*
|
|
4
|
+
* Hoisted from @buoy-gg/react-query's `query-browser/Explorer.tsx` (the Data
|
|
5
|
+
* Editor that tool has always shipped) so every tool edits data through ONE
|
|
6
|
+
* implementation: react-query wraps it with a setQueryData writer, zustand
|
|
7
|
+
* with a merge-only setState writer, storage with a whole-key writer. There
|
|
8
|
+
* is no draft and no Save: each change writes through immediately (or on a
|
|
9
|
+
* short debounce — see below) and the app reacts while you type.
|
|
10
|
+
*
|
|
11
|
+
* What a leaf renders as is the ORIGINAL value's type, which is also what
|
|
12
|
+
* keeps edits type-safe without asking anything: strings and numbers get an
|
|
13
|
+
* inline input (numbers with +/- steppers and a numeric keyboard), booleans a
|
|
14
|
+
* one-tap TRUE/FALSE toggle, container members a delete ✕, arrays a clear-[]
|
|
15
|
+
* button. Structural edits this tree can't express (add key, rename) belong
|
|
16
|
+
* to the host's Raw escape hatch, not here.
|
|
17
|
+
*
|
|
18
|
+
* The one knob the RQ original doesn't use: `debounceMs`. A cache write is
|
|
19
|
+
* free and unlogged, so RQ writes per keystroke (`debounceMs: 0`). Zustand
|
|
20
|
+
* and storage writes are RECORDED — events timeline, per-store change counts,
|
|
21
|
+
* the free tier's change cap — and storage's hit disk, so those hosts pass
|
|
22
|
+
* ~300ms: the input echoes instantly, the write lands one beat after you stop
|
|
23
|
+
* typing (flushed on blur/unmount), and "granola" is one recorded change
|
|
24
|
+
* instead of seven. Discrete gestures — toggle, stepper, delete, clear —
|
|
25
|
+
* always write immediately.
|
|
26
|
+
*/
|
|
27
|
+
import type { JsonValue } from "../types/types";
|
|
28
|
+
/**
|
|
29
|
+
* How the explorer writes into whatever owns the data. The tree never mutates
|
|
30
|
+
* anything itself — every edit is handed to the host through this.
|
|
31
|
+
*/
|
|
32
|
+
export interface LiveEditWriter {
|
|
33
|
+
/** Replace the node at `path` with `value`. Fired per committed change. */
|
|
34
|
+
update(path: string[], value: unknown): void;
|
|
35
|
+
/** Remove the node at `path`. Omit entirely → no delete affordances. */
|
|
36
|
+
remove?(path: string[]): void;
|
|
37
|
+
/**
|
|
38
|
+
* Per-node removal veto. Zustand vetoes depth-1 paths — its merge write can
|
|
39
|
+
* rewrite a top-level key but never delete one. Default: allowed.
|
|
40
|
+
*/
|
|
41
|
+
canRemove?(path: string[]): boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface LiveExplorerProps {
|
|
44
|
+
editable?: boolean;
|
|
45
|
+
label: string;
|
|
46
|
+
value: JsonValue;
|
|
47
|
+
defaultExpanded?: string[];
|
|
48
|
+
/** Absent writer = read-only tree, exactly like `editable: false`. */
|
|
49
|
+
writer?: LiveEditWriter;
|
|
50
|
+
dataPath?: string[];
|
|
51
|
+
itemsDeletable?: boolean;
|
|
52
|
+
/** Bump when the subject changes externally to re-sync focused inputs. */
|
|
53
|
+
dataVersion?: number;
|
|
54
|
+
/** Handle scheme for rows/controls; hosts keep their own namespaces. */
|
|
55
|
+
testIDForPath?: (dataPath: string[]) => string;
|
|
56
|
+
/**
|
|
57
|
+
* Trailing debounce for TYPED commits (text/number input). 0 = write per
|
|
58
|
+
* keystroke (react-query). Discrete gestures always write immediately.
|
|
59
|
+
*/
|
|
60
|
+
debounceMs?: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Recursive live data explorer — see the module docstring. Used for both
|
|
64
|
+
* editable and read-only JSON trees.
|
|
65
|
+
*/
|
|
66
|
+
export declare function LiveExplorer({ editable, label, value, defaultExpanded, writer, dataPath, itemsDeletable, dataVersion, testIDForPath, debounceMs, }: LiveExplorerProps): import("react").JSX.Element;
|
|
67
|
+
/** A writer for plain local data — host supplies get/set of the whole root. */
|
|
68
|
+
export declare function makeRootWriter(options: {
|
|
69
|
+
getRoot: () => JsonValue;
|
|
70
|
+
setRoot: (next: JsonValue) => void;
|
|
71
|
+
canRemove?: (path: string[]) => boolean;
|
|
72
|
+
}): LiveEditWriter;
|
|
73
|
+
//# sourceMappingURL=LiveExplorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveExplorer.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/LiveExplorer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQhD;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,MAAM,CAAC,IAAI,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with Cancel and Save.
|
|
3
|
+
*
|
|
4
|
+
* This started as a pushed full screen and that was more ceremony than the task
|
|
5
|
+
* deserves — changing one string is the most ordinary thing in these tools, and
|
|
6
|
+
* it shouldn't cost a navigation. A modal is what people expect, and the reason
|
|
7
|
+
* it's pinned to the TOP rather than centred is the keyboard: a centred panel
|
|
8
|
+
* gets shoved up or covered the moment the field focuses, and a bottom sheet is
|
|
9
|
+
* simply underneath it. At the top it stays put and stays readable.
|
|
10
|
+
*
|
|
11
|
+
* The field is multiline for anything textual. Stored values are routinely
|
|
12
|
+
* tokens, URLs and serialized blobs, and a single line shows you roughly forty
|
|
13
|
+
* characters of them, scrolling sideways — which is how you edit the wrong part
|
|
14
|
+
* of a string without noticing.
|
|
15
|
+
*
|
|
16
|
+
* Type is preserved by construction: the ORIGINAL value's type picks the editor
|
|
17
|
+
* AND decides how the draft is read back, so editing a number can only produce
|
|
18
|
+
* a number. Raw JSON — the escape hatch for containers — re-checks the parsed
|
|
19
|
+
* result and refuses a different shape.
|
|
20
|
+
*
|
|
21
|
+
* Nothing here writes. `onSave` hands the value to whoever owns it.
|
|
22
|
+
*
|
|
23
|
+
* Hoisted from the Storage tool (which keeps its testIDs via `testIDPrefix`)
|
|
24
|
+
* so the Zustand store editor types values through the same rules.
|
|
25
|
+
*/
|
|
26
|
+
export interface ValueEditModalProps {
|
|
27
|
+
/** Path into the value being edited — labels the panel, never used to write. */
|
|
28
|
+
path: string[];
|
|
29
|
+
value: unknown;
|
|
30
|
+
onSave: (next: unknown) => void;
|
|
31
|
+
onCancel: () => void;
|
|
32
|
+
/** "Save" when this writes, "Apply" when it only updates a draft. */
|
|
33
|
+
saveLabel?: string;
|
|
34
|
+
/** Disables the controls while a write is in flight. */
|
|
35
|
+
busy?: boolean;
|
|
36
|
+
/** Handle root for the panel's controls (`<prefix>-input`, `-save`, …). */
|
|
37
|
+
testIDPrefix?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function ValueEditModal({ path, value, onSave, onCancel, saveLabel, busy, testIDPrefix, }: ValueEditModalProps): import("react").JSX.Element;
|
|
40
|
+
//# sourceMappingURL=ValueEditModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValueEditModal.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/ValueEditModal.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAgBH,MAAM,WAAW,mBAAmB;IAClC,gFAAgF;IAChF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAChC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAkCD,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAkB,EAClB,IAAY,EACZ,YAAgC,GACjC,EAAE,mBAAmB,+BA+HrB"}
|
|
@@ -29,4 +29,9 @@ export { computeLineDiff, DiffType, ABSENT_VALUE, isAbsent, type LineDiffInfo, t
|
|
|
29
29
|
export { diffThemes, gitClassicTheme, devToolsDefaultTheme, type DiffTheme, type DiffThemeKey, } from "./diffThemes";
|
|
30
30
|
export { objectDiff, boundedDeepEqual, toDiffable, jsonLikelyLargerThan, type ObjectDiffOptions, type ObjectDiffResult, } from "./objectDiff";
|
|
31
31
|
export { ThemedSplitView, type DiffOptions, type DiffCompareMethod, } from "./ThemedSplitView";
|
|
32
|
+
export { useTreeDraft, type TreeDraft } from "./useTreeDraft";
|
|
33
|
+
export { useTreeEditor, type TreeEditor, type TreeEditorOptions, } from "./useTreeEditor";
|
|
34
|
+
export { ValueEditModal, type ValueEditModalProps } from "./ValueEditModal";
|
|
35
|
+
export { LiveExplorer, makeRootWriter, type LiveEditWriter, type LiveExplorerProps, } from "./LiveExplorer";
|
|
36
|
+
export { updateNestedDataByPath, deleteNestedDataByPath } from "./nestedPath";
|
|
32
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C;;;;GAIG;AACH,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIlE,OAAO,EACL,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,MAAM,GACZ,MAAM,WAAW,CAAC;AAInB,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,SAAS,EACT,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC;AAIvB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,KAAK,sBAAsB,GAC5B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,KAAK,SAAS,EACd,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C;;;;GAIG;AACH,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,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,CAAC;AACzB,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,KAAK,SAAS,EACd,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EACL,aAAa,EACb,KAAK,UAAU,EACf,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5E,OAAO,EACL,YAAY,EACZ,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Immutable path writes over arbitrary JSON-ish data — the write kernel the
|
|
3
|
+
* live explorer edits through.
|
|
4
|
+
*
|
|
5
|
+
* Hoisted verbatim from @buoy-gg/react-query (utils/updateNestedDataByPath +
|
|
6
|
+
* utils/deleteNestedDataByPath), where the RQ Data Editor has run on them in
|
|
7
|
+
* production; react-query re-exports from here. Handles objects, arrays, and
|
|
8
|
+
* Map/Set (a Set edit round-trips through an array).
|
|
9
|
+
*/
|
|
10
|
+
import type { JsonValue } from "../types/types";
|
|
11
|
+
/**
|
|
12
|
+
* Returns a copy of `oldData` with the node at `updatePath` replaced by
|
|
13
|
+
* `value`. An empty path replaces the whole document.
|
|
14
|
+
*/
|
|
15
|
+
export declare const updateNestedDataByPath: (oldData: JsonValue, updatePath: string[], value: JsonValue) => JsonValue;
|
|
16
|
+
/**
|
|
17
|
+
* Returns a copy of `oldData` without the node at `deletePath`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const deleteNestedDataByPath: (oldData: unknown, deletePath: string[]) => unknown;
|
|
20
|
+
//# sourceMappingURL=nestedPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nestedPath.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/nestedPath.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,SAAS,EAClB,YAAY,MAAM,EAAE,EACpB,OAAO,SAAS,KACf,SAiEF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,OAAO,EAChB,YAAY,MAAM,EAAE,KACnB,OAmDF,CAAC"}
|
|
@@ -55,6 +55,16 @@ export interface TreeActionOptions {
|
|
|
55
55
|
* physically cannot show it.
|
|
56
56
|
*/
|
|
57
57
|
containersEditable?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Depth-1 entries can be changed but never removed.
|
|
60
|
+
*
|
|
61
|
+
* For documents whose write path is a top-level shallow MERGE (a zustand
|
|
62
|
+
* store's `setState(partial, false)`): a merge can rewrite a top-level key
|
|
63
|
+
* but has no way to delete one, so offering Remove there would produce an
|
|
64
|
+
* edit the save cannot express. Everything nested is unaffected — removing
|
|
65
|
+
* `lines[0]` just rewrites `lines`.
|
|
66
|
+
*/
|
|
67
|
+
rootEntriesLocked?: boolean;
|
|
58
68
|
}
|
|
59
69
|
/** The node's type, as a badge shows it. */
|
|
60
70
|
export declare function typeLabel(value: unknown): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeActions.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/treeActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAKL,KAAK,MAAM,EACZ,MAAM,WAAW,CAAC;AAEnB,uDAAuD;AACvD,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,KAAK,GACL,WAAW,GACX,QAAQ,GACR,UAAU,GACV,QAAQ,CAAC;AAEb,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,YAAY,CAAC;IACjB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,sDAAsD;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;OAOG;IACH,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"treeActions.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/treeActions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAKL,KAAK,MAAM,EACZ,MAAM,WAAW,CAAC;AAEnB,uDAAuD;AACvD,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,KAAK,GACL,WAAW,GACX,QAAQ,GACR,UAAU,GACV,QAAQ,CAAC;AAEb,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,YAAY,CAAC;IACjB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,sDAAsD;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;;;OAOG;IACH,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,4CAA4C;AAC5C,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKhD;AAED,+EAA+E;AAC/E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,CAEjD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,EAAE,GACpB,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAIlC;AAUD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,SAAS,EAAE,iBAAiB,GAAG,IAAI,EACnC,OAAO,GAAE,iBAAsB,GAC9B,UAAU,EAAE,CAiGd"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A local draft of a tree value, edited in place and written ONCE.
|
|
3
|
+
*
|
|
4
|
+
* Applying each tree op straight to the owning document was the obvious first
|
|
5
|
+
* cut and it behaves badly for two compounding reasons:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Every op is a round trip.** The write lands, the owner emits an event,
|
|
8
|
+
* a snapshot comes back, and the browser re-reads everything — so a six-tap
|
|
9
|
+
* reorder is six writes and six full refreshes. The tree rebuilds under the
|
|
10
|
+
* user mid-gesture.
|
|
11
|
+
* 2. **The highlight and the value fall out of step.** Selection is local and
|
|
12
|
+
* moves instantly; the value it points at only catches up when the round
|
|
13
|
+
* trip completes, so for a beat the highlight sits on the old contents.
|
|
14
|
+
*
|
|
15
|
+
* Optimistic updates — the React Query pattern of rendering the expected result
|
|
16
|
+
* and reconciling later — fix (2) but not (1): they still write per change.
|
|
17
|
+
* Buffering fixes both, and it's what every editor that owns a document does
|
|
18
|
+
* (a form's dirty state, an IDE's unsaved buffer, JSON Editor's in-memory doc
|
|
19
|
+
* with an explicit save).
|
|
20
|
+
*
|
|
21
|
+
* The trade is that the buffer can go stale if the owner writes the same
|
|
22
|
+
* document while you're editing. That's the same last-write-wins a text editor
|
|
23
|
+
* has, and `isDirty` at least makes it visible that you're holding unsaved
|
|
24
|
+
* changes.
|
|
25
|
+
*
|
|
26
|
+
* Grew up as the Storage tool's key editor; hoisted here so the Zustand store
|
|
27
|
+
* editor is the same editor rather than a drifting copy. The save contract
|
|
28
|
+
* takes the VALUE — a storage host stringifies it, a zustand host diffs it
|
|
29
|
+
* into a merge partial.
|
|
30
|
+
*/
|
|
31
|
+
import { type JsonOp } from "./jsonOps";
|
|
32
|
+
export interface TreeDraft {
|
|
33
|
+
/** True while the tree is in edit mode. */
|
|
34
|
+
isEditing: boolean;
|
|
35
|
+
/** What the tree should render — the draft while editing, else the live value. */
|
|
36
|
+
value: unknown;
|
|
37
|
+
/** True when the draft differs from what's stored. */
|
|
38
|
+
isDirty: boolean;
|
|
39
|
+
/** True while the single write is in flight. */
|
|
40
|
+
isSaving: boolean;
|
|
41
|
+
/** Error from the last save attempt, or null. */
|
|
42
|
+
error: string | null;
|
|
43
|
+
/** Where the tree should move its highlight after the last op. */
|
|
44
|
+
selectPath: string[] | null | undefined;
|
|
45
|
+
begin: () => void;
|
|
46
|
+
/** Apply one op to the DRAFT. Nothing is written. */
|
|
47
|
+
apply: (op: JsonOp) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Move the highlight explicitly, for the ops that CREATE a node.
|
|
50
|
+
* `selectionPathAfterOp` handles the ones that move or delete a node, but it
|
|
51
|
+
* can't handle these — it doesn't see the container, so it can't know an
|
|
52
|
+
* append landed at index 3.
|
|
53
|
+
*/
|
|
54
|
+
selectAt: (path: string[]) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Write the draft to its owner and leave edit mode. No-op write when clean.
|
|
57
|
+
*
|
|
58
|
+
* Resolves `true` when the value is safely written and `false` when the write
|
|
59
|
+
* was refused — it never rejects, because a failed save is a state this hook
|
|
60
|
+
* handles (it keeps edit mode open and sets `error`). Callers that navigate
|
|
61
|
+
* away on save MUST check the result, or they'll close over a draft that was
|
|
62
|
+
* never written and show the user nothing.
|
|
63
|
+
*/
|
|
64
|
+
commit: () => Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Throw the draft away — back to the value as stored, still editing.
|
|
67
|
+
*
|
|
68
|
+
* Deliberately NOT "leave edit mode": Discard sits next to Save in the
|
|
69
|
+
* commit row and leaves you on the editor. Dropping out of edit mode there
|
|
70
|
+
* left a screen that looked fine and silently swallowed every subsequent
|
|
71
|
+
* edit — `value` fell back to the live value, `isDirty` was pinned false,
|
|
72
|
+
* and Save never came back, because nothing re-enters edit mode after mount.
|
|
73
|
+
*/
|
|
74
|
+
discard: () => void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @param liveValue the value as its owner currently holds it (already parsed)
|
|
78
|
+
* @param save persists the draft VALUE; rejecting keeps edit mode open
|
|
79
|
+
*/
|
|
80
|
+
export declare function useTreeDraft(liveValue: unknown, save?: (value: unknown) => Promise<void>): TreeDraft;
|
|
81
|
+
//# sourceMappingURL=useTreeDraft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTreeDraft.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/useTreeDraft.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAqC,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAE3E,MAAM,WAAW,SAAS;IACxB,2CAA2C;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,kFAAkF;IAClF,KAAK,EAAE,OAAO,CAAC;IACf,sDAAsD;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,kEAAkE;IAClE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;IAExC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,qDAAqD;IACrD,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACnC;;;;;;;;OAQG;IACH,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B;;;;;;;;OAQG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,OAAO,EAClB,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GACvC,SAAS,CAuFX"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everything editing a tree document involves, minus how it looks.
|
|
3
|
+
*
|
|
4
|
+
* The phone and the dashboard run the same editor: one buffered draft, one
|
|
5
|
+
* write on save, a selection the structural actions operate on, a modal for
|
|
6
|
+
* typing a value, and a guard so closing can't silently drop unsaved work.
|
|
7
|
+
* What differs is presentation — thumb-sized tiles under a full screen versus
|
|
8
|
+
* chips docked in a panel — which is a rendering concern and nothing more.
|
|
9
|
+
*
|
|
10
|
+
* Keeping the rules here means the surfaces (and the tools — storage keys and
|
|
11
|
+
* zustand stores run this same hook) can't drift on the things that would
|
|
12
|
+
* actually hurt: whether a boolean opens an editor, whether a failed write
|
|
13
|
+
* closes the editor anyway, what "dirty" means.
|
|
14
|
+
*/
|
|
15
|
+
import type { DataTreeSelection } from "./treeActions";
|
|
16
|
+
import { type TreeDraft } from "./useTreeDraft";
|
|
17
|
+
export interface TreeEditor {
|
|
18
|
+
draft: TreeDraft;
|
|
19
|
+
/** The tree row the structural actions apply to. */
|
|
20
|
+
selection: DataTreeSelection | null;
|
|
21
|
+
setSelection: (selection: DataTreeSelection | null) => void;
|
|
22
|
+
/** Which node the value modal is open on. Null means it's closed. */
|
|
23
|
+
valuePath: string[] | null;
|
|
24
|
+
/** Open the value modal — or, for a boolean, just flip it. */
|
|
25
|
+
openValueEditor: (path: string[]) => void;
|
|
26
|
+
closeValueEditor: () => void;
|
|
27
|
+
/** Take the modal's result into the draft. */
|
|
28
|
+
applyValue: (next: unknown) => void;
|
|
29
|
+
/** Open the modal on the whole value — the manual/raw JSON escape hatch. */
|
|
30
|
+
openRawEditor: () => void;
|
|
31
|
+
/** Leave, resolving unsaved work first. */
|
|
32
|
+
requestClose: () => void;
|
|
33
|
+
/** Write, and leave only if the write landed. */
|
|
34
|
+
saveAndClose: () => void;
|
|
35
|
+
}
|
|
36
|
+
export interface TreeEditorOptions {
|
|
37
|
+
/** The value as its owner holds it, already un-stringified. */
|
|
38
|
+
value: unknown;
|
|
39
|
+
/** Performs the single write. Rejecting keeps the work on screen. */
|
|
40
|
+
save: (value: unknown) => Promise<void>;
|
|
41
|
+
onClose: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Asks the user what to do about unsaved work. Called only when dirty; the
|
|
44
|
+
* host owns this because a phone wants a native alert and a panel may not.
|
|
45
|
+
*/
|
|
46
|
+
confirmDiscard: (choices: {
|
|
47
|
+
save: () => void;
|
|
48
|
+
discard: () => void;
|
|
49
|
+
}) => void;
|
|
50
|
+
}
|
|
51
|
+
export declare function useTreeEditor({ value, save, onClose, confirmDiscard, }: TreeEditorOptions): TreeEditor;
|
|
52
|
+
//# sourceMappingURL=useTreeEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTreeEditor.d.ts","sourceRoot":"","sources":["../../../../src/dataViewer/useTreeEditor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,oDAAoD;IACpD,SAAS,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpC,YAAY,EAAE,CAAC,SAAS,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;IAC5D,qEAAqE;IACrE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC3B,8DAA8D;IAC9D,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,8CAA8C;IAC9C,UAAU,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,4EAA4E;IAC5E,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,2CAA2C;IAC3C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,iDAAiD;IACjD,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,KAAK,EAAE,OAAO,CAAC;IACf,qEAAqE;IACrE,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,CAAC,OAAO,EAAE;QACxB,IAAI,EAAE,MAAM,IAAI,CAAC;QACjB,OAAO,EAAE,MAAM,IAAI,CAAC;KACrB,KAAK,IAAI,CAAC;CACZ;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,IAAI,EACJ,OAAO,EACP,cAAc,GACf,EAAE,iBAAiB,GAAG,UAAU,CA2EhC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentIndicator.d.ts","sourceRoot":"","sources":["../../../../src/env/EnvironmentIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,cAAc,CAAC;AAWxE,OAAO,EAAE,KAAK,WAAW,EAAwB,MAAM,gBAAgB,CAAC;AAExE,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,4EAA4E;IAC5E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAyDD,wBAAgB,oBAAoB,CAAC,EACnC,WAAW,EACX,QAAQ,EACR,WAAmB,EACnB,OAAO,GACR,EAAE,yBAAyB,+
|
|
1
|
+
{"version":3,"file":"EnvironmentIndicator.d.ts","sourceRoot":"","sources":["../../../../src/env/EnvironmentIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAyB,MAAM,cAAc,CAAC;AAWxE,OAAO,EAAE,KAAK,WAAW,EAAwB,MAAM,gBAAgB,CAAC;AAExE,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,WAAW,GAAG,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC9C,4EAA4E;IAC5E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAyDD,wBAAgB,oBAAoB,CAAC,EACnC,WAAW,EACX,QAAQ,EACR,WAAmB,EACnB,OAAO,GACR,EAAE,yBAAyB,+BAwE3B"}
|