@buoy-gg/time-machine 7.0.22 → 7.0.24
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/components/TimeMachineBody.js +147 -677
- package/lib/commonjs/components/TimeMachineBody.js.map +1 -1
- package/lib/commonjs/components/TimeMachineModal.js +10 -11
- package/lib/commonjs/components/TimeMachineModal.js.map +1 -1
- package/lib/commonjs/components/confirm.js +39 -0
- package/lib/commonjs/components/confirm.js.map +1 -0
- package/lib/commonjs/components/format.js +24 -0
- package/lib/commonjs/components/format.js.map +1 -0
- package/lib/commonjs/components/list/CaptureBar.js +95 -0
- package/lib/commonjs/components/list/CaptureBar.js.map +1 -0
- package/lib/commonjs/components/list/RestoreOutcomeCard.js +162 -0
- package/lib/commonjs/components/list/RestoreOutcomeCard.js.map +1 -0
- package/lib/commonjs/components/list/SnapshotRow.js +141 -0
- package/lib/commonjs/components/list/SnapshotRow.js.map +1 -0
- package/lib/commonjs/components/list/SourcesStrip.js +126 -0
- package/lib/commonjs/components/list/SourcesStrip.js.map +1 -0
- package/lib/commonjs/components/list/UndoDeleteBar.js +81 -0
- package/lib/commonjs/components/list/UndoDeleteBar.js.map +1 -0
- package/lib/commonjs/components/list/WipeAllRow.js +46 -0
- package/lib/commonjs/components/list/WipeAllRow.js.map +1 -0
- package/lib/commonjs/components/preview/ItemDiffPanel.js +77 -0
- package/lib/commonjs/components/preview/ItemDiffPanel.js.map +1 -0
- package/lib/commonjs/components/preview/PreviewFlow.js +51 -0
- package/lib/commonjs/components/preview/PreviewFlow.js.map +1 -0
- package/lib/commonjs/components/preview/RestorePointNameRow.js +83 -0
- package/lib/commonjs/components/preview/RestorePointNameRow.js.map +1 -0
- package/lib/commonjs/components/preview/RestorePreviewScreen.js +549 -635
- package/lib/commonjs/components/preview/RestorePreviewScreen.js.map +1 -1
- package/lib/commonjs/components/preview/verdictMeta.js +8 -8
- package/lib/commonjs/components/preview/verdictMeta.js.map +1 -1
- package/lib/commonjs/components/sources.js +72 -0
- package/lib/commonjs/components/sources.js.map +1 -0
- package/lib/commonjs/store/snapshotVault.js +93 -9
- package/lib/commonjs/store/snapshotVault.js.map +1 -1
- package/lib/commonjs/store/timeMachineStore.js +125 -6
- package/lib/commonjs/store/timeMachineStore.js.map +1 -1
- package/lib/commonjs/sync/timeMachineSyncAdapter.js +41 -0
- package/lib/commonjs/sync/timeMachineSyncAdapter.js.map +1 -1
- package/lib/commonjs/ui/SwipeActionsRow.js +167 -0
- package/lib/commonjs/ui/SwipeActionsRow.js.map +1 -0
- package/lib/commonjs/ui/primitives.js +164 -0
- package/lib/commonjs/ui/primitives.js.map +1 -0
- package/lib/commonjs/ui/tmTheme.js +103 -0
- package/lib/commonjs/ui/tmTheme.js.map +1 -0
- package/lib/module/components/TimeMachineBody.js +150 -680
- package/lib/module/components/TimeMachineBody.js.map +1 -1
- package/lib/module/components/TimeMachineModal.js +11 -12
- package/lib/module/components/TimeMachineModal.js.map +1 -1
- package/lib/module/components/confirm.js +34 -0
- package/lib/module/components/confirm.js.map +1 -0
- package/lib/module/components/format.js +19 -0
- package/lib/module/components/format.js.map +1 -0
- package/lib/module/components/list/CaptureBar.js +90 -0
- package/lib/module/components/list/CaptureBar.js.map +1 -0
- package/lib/module/components/list/RestoreOutcomeCard.js +156 -0
- package/lib/module/components/list/RestoreOutcomeCard.js.map +1 -0
- package/lib/module/components/list/SnapshotRow.js +138 -0
- package/lib/module/components/list/SnapshotRow.js.map +1 -0
- package/lib/module/components/list/SourcesStrip.js +121 -0
- package/lib/module/components/list/SourcesStrip.js.map +1 -0
- package/lib/module/components/list/UndoDeleteBar.js +78 -0
- package/lib/module/components/list/UndoDeleteBar.js.map +1 -0
- package/lib/module/components/list/WipeAllRow.js +41 -0
- package/lib/module/components/list/WipeAllRow.js.map +1 -0
- package/lib/module/components/preview/ItemDiffPanel.js +72 -0
- package/lib/module/components/preview/ItemDiffPanel.js.map +1 -0
- package/lib/module/components/preview/PreviewFlow.js +46 -0
- package/lib/module/components/preview/PreviewFlow.js.map +1 -0
- package/lib/module/components/preview/RestorePointNameRow.js +78 -0
- package/lib/module/components/preview/RestorePointNameRow.js.map +1 -0
- package/lib/module/components/preview/RestorePreviewScreen.js +552 -638
- package/lib/module/components/preview/RestorePreviewScreen.js.map +1 -1
- package/lib/module/components/preview/verdictMeta.js +9 -8
- package/lib/module/components/preview/verdictMeta.js.map +1 -1
- package/lib/module/components/sources.js +66 -0
- package/lib/module/components/sources.js.map +1 -0
- package/lib/module/store/snapshotVault.js +87 -9
- package/lib/module/store/snapshotVault.js.map +1 -1
- package/lib/module/store/timeMachineStore.js +125 -7
- package/lib/module/store/timeMachineStore.js.map +1 -1
- package/lib/module/sync/timeMachineSyncAdapter.js +41 -0
- package/lib/module/sync/timeMachineSyncAdapter.js.map +1 -1
- package/lib/module/ui/SwipeActionsRow.js +162 -0
- package/lib/module/ui/SwipeActionsRow.js.map +1 -0
- package/lib/module/ui/primitives.js +156 -0
- package/lib/module/ui/primitives.js.map +1 -0
- package/lib/module/ui/tmTheme.js +99 -0
- package/lib/module/ui/tmTheme.js.map +1 -0
- package/lib/typescript/components/TimeMachineBody.d.ts.map +1 -1
- package/lib/typescript/components/TimeMachineModal.d.ts.map +1 -1
- package/lib/typescript/components/confirm.d.ts +2 -0
- package/lib/typescript/components/confirm.d.ts.map +1 -0
- package/lib/typescript/components/format.d.ts +4 -0
- package/lib/typescript/components/format.d.ts.map +1 -0
- package/lib/typescript/components/list/CaptureBar.d.ts +6 -0
- package/lib/typescript/components/list/CaptureBar.d.ts.map +1 -0
- package/lib/typescript/components/list/RestoreOutcomeCard.d.ts +11 -0
- package/lib/typescript/components/list/RestoreOutcomeCard.d.ts.map +1 -0
- package/lib/typescript/components/list/SnapshotRow.d.ts +12 -0
- package/lib/typescript/components/list/SnapshotRow.d.ts.map +1 -0
- package/lib/typescript/components/list/SourcesStrip.d.ts +5 -0
- package/lib/typescript/components/list/SourcesStrip.d.ts.map +1 -0
- package/lib/typescript/components/list/UndoDeleteBar.d.ts +8 -0
- package/lib/typescript/components/list/UndoDeleteBar.d.ts.map +1 -0
- package/lib/typescript/components/list/WipeAllRow.d.ts +5 -0
- package/lib/typescript/components/list/WipeAllRow.d.ts.map +1 -0
- package/lib/typescript/components/preview/ItemDiffPanel.d.ts +5 -0
- package/lib/typescript/components/preview/ItemDiffPanel.d.ts.map +1 -0
- package/lib/typescript/components/preview/PreviewFlow.d.ts +9 -0
- package/lib/typescript/components/preview/PreviewFlow.d.ts.map +1 -0
- package/lib/typescript/components/preview/RestorePointNameRow.d.ts +5 -0
- package/lib/typescript/components/preview/RestorePointNameRow.d.ts.map +1 -0
- package/lib/typescript/components/preview/RestorePreviewScreen.d.ts +1 -5
- package/lib/typescript/components/preview/RestorePreviewScreen.d.ts.map +1 -1
- package/lib/typescript/components/preview/verdictMeta.d.ts +5 -0
- package/lib/typescript/components/preview/verdictMeta.d.ts.map +1 -1
- package/lib/typescript/components/sources.d.ts +36 -0
- package/lib/typescript/components/sources.d.ts.map +1 -0
- package/lib/typescript/store/snapshotVault.d.ts +48 -0
- package/lib/typescript/store/snapshotVault.d.ts.map +1 -1
- package/lib/typescript/store/timeMachineStore.d.ts +35 -1
- package/lib/typescript/store/timeMachineStore.d.ts.map +1 -1
- package/lib/typescript/sync/timeMachineSyncAdapter.d.ts +17 -0
- package/lib/typescript/sync/timeMachineSyncAdapter.d.ts.map +1 -1
- package/lib/typescript/ui/SwipeActionsRow.d.ts +32 -0
- package/lib/typescript/ui/SwipeActionsRow.d.ts.map +1 -0
- package/lib/typescript/ui/primitives.d.ts +57 -0
- package/lib/typescript/ui/primitives.d.ts.map +1 -0
- package/lib/typescript/ui/tmTheme.d.ts +67 -0
- package/lib/typescript/ui/tmTheme.d.ts.map +1 -0
- package/package.json +7 -7
- package/src/components/TimeMachineBody.tsx +183 -817
- package/src/components/TimeMachineModal.tsx +10 -11
- package/src/components/confirm.ts +35 -0
- package/src/components/format.ts +17 -0
- package/src/components/list/CaptureBar.tsx +100 -0
- package/src/components/list/RestoreOutcomeCard.tsx +159 -0
- package/src/components/list/SnapshotRow.tsx +155 -0
- package/src/components/list/SourcesStrip.tsx +124 -0
- package/src/components/list/UndoDeleteBar.tsx +76 -0
- package/src/components/list/WipeAllRow.tsx +42 -0
- package/src/components/preview/ItemDiffPanel.tsx +77 -0
- package/src/components/preview/PreviewFlow.tsx +70 -0
- package/src/components/preview/RestorePointNameRow.tsx +80 -0
- package/src/components/preview/RestorePreviewScreen.tsx +535 -535
- package/src/components/preview/verdictMeta.ts +8 -8
- package/src/components/sources.ts +92 -0
- package/src/store/snapshotVault.ts +131 -9
- package/src/store/timeMachineStore.ts +136 -5
- package/src/sync/timeMachineSyncAdapter.ts +30 -0
- package/src/ui/SwipeActionsRow.tsx +199 -0
- package/src/ui/primitives.tsx +157 -0
- package/src/ui/tmTheme.ts +107 -0
- package/lib/commonjs/components/preview/ItemDetailScreen.js +0 -189
- package/lib/commonjs/components/preview/ItemDetailScreen.js.map +0 -1
- package/lib/module/components/preview/ItemDetailScreen.js +0 -184
- package/lib/module/components/preview/ItemDetailScreen.js.map +0 -1
- package/lib/typescript/components/preview/ItemDetailScreen.d.ts +0 -11
- package/lib/typescript/components/preview/ItemDetailScreen.d.ts.map +0 -1
- package/src/components/preview/ItemDetailScreen.tsx +0 -172
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Item detail — one preview item's before/after, rendered with the two
|
|
5
|
-
* familiar views (TREE / SPLIT, same as storage events).
|
|
6
|
-
*
|
|
7
|
-
* The render-layer viewers only handle plain JSON faithfully, so both sides
|
|
8
|
-
* pass through toDiffable (Dates→ISO, Maps→objects, BigInt→"1n", cycles→
|
|
9
|
-
* "[Circular]") and the pair is memoized ONCE per item — the storage tool's
|
|
10
|
-
* fix for the fresh-identity-every-render trap that redux/zustand still have.
|
|
11
|
-
*/
|
|
12
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
13
|
-
import { ScrollView, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
14
|
-
import { DiffModeTabs, buoyColors, devToolsStorageKeys, persistentStorage } from "@buoy-gg/shared-ui";
|
|
15
|
-
import { useToolHeader, useToolHost } from "@buoy-gg/core";
|
|
16
|
-
import { ABSENT_VALUE, ThemedSplitView, TreeDiffViewer, devToolsDefaultTheme, toDiffable } from "@buoy-gg/shared-ui/dataViewer";
|
|
17
|
-
import { VERDICT_META } from "./verdictMeta";
|
|
18
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
-
const DIFF_MODE_KEY = devToolsStorageKeys.timeMachine.diffViewerMode();
|
|
20
|
-
const TABS = [{
|
|
21
|
-
key: "tree",
|
|
22
|
-
label: "TREE VIEW"
|
|
23
|
-
}, {
|
|
24
|
-
key: "split",
|
|
25
|
-
label: "SPLIT VIEW"
|
|
26
|
-
}];
|
|
27
|
-
export function ItemDetailScreen({
|
|
28
|
-
sourceLabel,
|
|
29
|
-
item,
|
|
30
|
-
leftLabel,
|
|
31
|
-
rightLabel,
|
|
32
|
-
onBack
|
|
33
|
-
}) {
|
|
34
|
-
// Persisted view preference — storage's load-guard/validate/optimistic
|
|
35
|
-
// pattern, default TREE (structured state reads better as a tree).
|
|
36
|
-
const [diffMode, setDiffMode] = useState("tree");
|
|
37
|
-
const hasLoadedMode = useRef(false);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (hasLoadedMode.current) return;
|
|
40
|
-
hasLoadedMode.current = true;
|
|
41
|
-
void persistentStorage.getItem(DIFF_MODE_KEY).then(saved => {
|
|
42
|
-
if (saved === "tree" || saved === "split") setDiffMode(saved);
|
|
43
|
-
});
|
|
44
|
-
}, []);
|
|
45
|
-
const changeMode = mode => {
|
|
46
|
-
setDiffMode(mode);
|
|
47
|
-
void persistentStorage.setItem(DIFF_MODE_KEY, mode).catch(() => {});
|
|
48
|
-
};
|
|
49
|
-
const meta = VERDICT_META[item.verdict];
|
|
50
|
-
const host = useToolHost();
|
|
51
|
-
const hosted = host.instanceId !== undefined;
|
|
52
|
-
|
|
53
|
-
// Hosted: the shared modal header shows this item's identity + back.
|
|
54
|
-
useToolHeader(hosted ? {
|
|
55
|
-
title: item.label,
|
|
56
|
-
subtitle: `${sourceLabel} · ${meta.label} · ${leftLabel} → ${rightLabel}`,
|
|
57
|
-
onBack,
|
|
58
|
-
searchable: false // nothing searchable on a single item's diff
|
|
59
|
-
} : null,
|
|
60
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
-
[hosted, item.key, sourceLabel, leftLabel, rightLabel]);
|
|
62
|
-
|
|
63
|
-
// Normalize ONCE per item; ABSENT_VALUE keeps added/removed reading as
|
|
64
|
-
// pure additions/removals instead of diffs against the literal "null".
|
|
65
|
-
const {
|
|
66
|
-
oldValue,
|
|
67
|
-
newValue
|
|
68
|
-
} = useMemo(() => ({
|
|
69
|
-
oldValue: item.verdict === "added" ? ABSENT_VALUE : toDiffable(item.oldValue),
|
|
70
|
-
newValue: item.verdict === "removed" ? ABSENT_VALUE : toDiffable(item.newValue)
|
|
71
|
-
}), [item]);
|
|
72
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
73
|
-
style: styles.container,
|
|
74
|
-
children: [!hosted && /*#__PURE__*/_jsxs(View, {
|
|
75
|
-
style: styles.screenHeader,
|
|
76
|
-
children: [/*#__PURE__*/_jsx(TouchableOpacity, {
|
|
77
|
-
onPress: onBack,
|
|
78
|
-
hitSlop: HIT,
|
|
79
|
-
testID: "tm-item-back",
|
|
80
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
81
|
-
style: styles.backText,
|
|
82
|
-
children: "\u2039 Preview"
|
|
83
|
-
})
|
|
84
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
85
|
-
style: styles.titleBlock,
|
|
86
|
-
children: [/*#__PURE__*/_jsxs(Text, {
|
|
87
|
-
style: styles.title,
|
|
88
|
-
numberOfLines: 1,
|
|
89
|
-
children: [/*#__PURE__*/_jsxs(Text, {
|
|
90
|
-
style: {
|
|
91
|
-
color: meta.color
|
|
92
|
-
},
|
|
93
|
-
children: [meta.glyph, " "]
|
|
94
|
-
}), item.label]
|
|
95
|
-
}), /*#__PURE__*/_jsxs(Text, {
|
|
96
|
-
style: styles.subtitle,
|
|
97
|
-
numberOfLines: 1,
|
|
98
|
-
children: [sourceLabel, " \xB7 ", meta.label, " \xB7 ", leftLabel, " \u2192 ", rightLabel]
|
|
99
|
-
})]
|
|
100
|
-
})]
|
|
101
|
-
}), item.reason && /*#__PURE__*/_jsxs(Text, {
|
|
102
|
-
style: styles.reason,
|
|
103
|
-
children: ["\u26A0 ", item.reason]
|
|
104
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
105
|
-
style: styles.tabs,
|
|
106
|
-
children: /*#__PURE__*/_jsx(DiffModeTabs, {
|
|
107
|
-
tabs: TABS,
|
|
108
|
-
activeTab: diffMode,
|
|
109
|
-
onTabChange: changeMode
|
|
110
|
-
})
|
|
111
|
-
}), /*#__PURE__*/_jsx(ScrollView, {
|
|
112
|
-
style: styles.scroll,
|
|
113
|
-
contentContainerStyle: styles.scrollContent,
|
|
114
|
-
children: diffMode === "tree" ? /*#__PURE__*/_jsx(TreeDiffViewer, {
|
|
115
|
-
oldValue: oldValue,
|
|
116
|
-
newValue: newValue,
|
|
117
|
-
theme: "dark",
|
|
118
|
-
showUnchanged: false,
|
|
119
|
-
scrollEnabled: false
|
|
120
|
-
}) : /*#__PURE__*/_jsx(ThemedSplitView, {
|
|
121
|
-
oldValue: oldValue,
|
|
122
|
-
newValue: newValue,
|
|
123
|
-
differences: EMPTY,
|
|
124
|
-
theme: devToolsDefaultTheme,
|
|
125
|
-
scrollEnabled: false
|
|
126
|
-
})
|
|
127
|
-
})]
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
const EMPTY = [];
|
|
131
|
-
const HIT = {
|
|
132
|
-
top: 10,
|
|
133
|
-
bottom: 10,
|
|
134
|
-
left: 10,
|
|
135
|
-
right: 10
|
|
136
|
-
};
|
|
137
|
-
const styles = StyleSheet.create({
|
|
138
|
-
container: {
|
|
139
|
-
flex: 1
|
|
140
|
-
},
|
|
141
|
-
screenHeader: {
|
|
142
|
-
flexDirection: "row",
|
|
143
|
-
alignItems: "center",
|
|
144
|
-
paddingHorizontal: 12,
|
|
145
|
-
paddingVertical: 8,
|
|
146
|
-
gap: 10
|
|
147
|
-
},
|
|
148
|
-
backText: {
|
|
149
|
-
color: buoyColors.primary,
|
|
150
|
-
fontSize: 14
|
|
151
|
-
},
|
|
152
|
-
titleBlock: {
|
|
153
|
-
flex: 1,
|
|
154
|
-
minWidth: 0
|
|
155
|
-
},
|
|
156
|
-
title: {
|
|
157
|
-
color: buoyColors.text,
|
|
158
|
-
fontSize: 13,
|
|
159
|
-
fontWeight: "700"
|
|
160
|
-
},
|
|
161
|
-
subtitle: {
|
|
162
|
-
color: buoyColors.textMuted,
|
|
163
|
-
fontSize: 10,
|
|
164
|
-
marginTop: 2
|
|
165
|
-
},
|
|
166
|
-
reason: {
|
|
167
|
-
color: buoyColors.warning,
|
|
168
|
-
fontSize: 11,
|
|
169
|
-
paddingHorizontal: 12,
|
|
170
|
-
paddingBottom: 6
|
|
171
|
-
},
|
|
172
|
-
tabs: {
|
|
173
|
-
paddingHorizontal: 12,
|
|
174
|
-
paddingBottom: 8
|
|
175
|
-
},
|
|
176
|
-
scroll: {
|
|
177
|
-
flex: 1
|
|
178
|
-
},
|
|
179
|
-
scrollContent: {
|
|
180
|
-
paddingHorizontal: 12,
|
|
181
|
-
paddingBottom: 24
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
//# sourceMappingURL=ItemDetailScreen.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useMemo","useRef","useState","ScrollView","StyleSheet","Text","TouchableOpacity","View","DiffModeTabs","buoyColors","devToolsStorageKeys","persistentStorage","useToolHeader","useToolHost","ABSENT_VALUE","ThemedSplitView","TreeDiffViewer","devToolsDefaultTheme","toDiffable","VERDICT_META","jsx","_jsx","jsxs","_jsxs","DIFF_MODE_KEY","timeMachine","diffViewerMode","TABS","key","label","ItemDetailScreen","sourceLabel","item","leftLabel","rightLabel","onBack","diffMode","setDiffMode","hasLoadedMode","current","getItem","then","saved","changeMode","mode","setItem","catch","meta","verdict","host","hosted","instanceId","undefined","title","subtitle","searchable","oldValue","newValue","style","styles","container","children","screenHeader","onPress","hitSlop","HIT","testID","backText","titleBlock","numberOfLines","color","glyph","reason","tabs","activeTab","onTabChange","scroll","contentContainerStyle","scrollContent","theme","showUnchanged","scrollEnabled","differences","EMPTY","top","bottom","left","right","create","flex","flexDirection","alignItems","paddingHorizontal","paddingVertical","gap","primary","fontSize","minWidth","text","fontWeight","textMuted","marginTop","warning","paddingBottom"],"sourceRoot":"../../../../src","sources":["components/preview/ItemDetailScreen.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC5D,SAASC,UAAU,EAAEC,UAAU,EAAEC,IAAI,EAAEC,gBAAgB,EAAEC,IAAI,QAAQ,cAAc;AACnF,SACEC,YAAY,EACZC,UAAU,EACVC,mBAAmB,EACnBC,iBAAiB,QACZ,oBAAoB;AAC3B,SAASC,aAAa,EAAEC,WAAW,QAAQ,eAAe;AAE1D,SACEC,YAAY,EACZC,eAAe,EACfC,cAAc,EACdC,oBAAoB,EACpBC,UAAU,QACL,+BAA+B;AACtC,SAASC,YAAY,QAAQ,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7C,MAAMC,aAAa,GAAGd,mBAAmB,CAACe,WAAW,CAACC,cAAc,CAAC,CAAC;AACtE,MAAMC,IAAI,GAAG,CACX;EAAEC,GAAG,EAAE,MAAM;EAAEC,KAAK,EAAE;AAA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@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { StateSnapshotPreviewItem } from "@buoy-gg/shared-ui";
|
|
2
|
-
export interface ItemDetailScreenProps {
|
|
3
|
-
sourceLabel: string;
|
|
4
|
-
item: StateSnapshotPreviewItem;
|
|
5
|
-
/** "old → new" side labels, e.g. "CURRENT STATE" / snapshot name. */
|
|
6
|
-
leftLabel: string;
|
|
7
|
-
rightLabel: string;
|
|
8
|
-
onBack: () => void;
|
|
9
|
-
}
|
|
10
|
-
export declare function ItemDetailScreen({ sourceLabel, item, leftLabel, rightLabel, onBack, }: ItemDetailScreenProps): import("react").JSX.Element;
|
|
11
|
-
//# sourceMappingURL=ItemDetailScreen.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ItemDetailScreen.d.ts","sourceRoot":"","sources":["../../../../src/components/preview/ItemDetailScreen.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAgBnE,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,wBAAwB,CAAC;IAC/B,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,WAAW,EACX,IAAI,EACJ,SAAS,EACT,UAAU,EACV,MAAM,GACP,EAAE,qBAAqB,+BA+FvB"}
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Item detail — one preview item's before/after, rendered with the two
|
|
3
|
-
* familiar views (TREE / SPLIT, same as storage events).
|
|
4
|
-
*
|
|
5
|
-
* The render-layer viewers only handle plain JSON faithfully, so both sides
|
|
6
|
-
* pass through toDiffable (Dates→ISO, Maps→objects, BigInt→"1n", cycles→
|
|
7
|
-
* "[Circular]") and the pair is memoized ONCE per item — the storage tool's
|
|
8
|
-
* fix for the fresh-identity-every-render trap that redux/zustand still have.
|
|
9
|
-
*/
|
|
10
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
11
|
-
import { ScrollView, StyleSheet, Text, TouchableOpacity, View } from "react-native";
|
|
12
|
-
import {
|
|
13
|
-
DiffModeTabs,
|
|
14
|
-
buoyColors,
|
|
15
|
-
devToolsStorageKeys,
|
|
16
|
-
persistentStorage,
|
|
17
|
-
} from "@buoy-gg/shared-ui";
|
|
18
|
-
import { useToolHeader, useToolHost } from "@buoy-gg/core";
|
|
19
|
-
import type { StateSnapshotPreviewItem } from "@buoy-gg/shared-ui";
|
|
20
|
-
import {
|
|
21
|
-
ABSENT_VALUE,
|
|
22
|
-
ThemedSplitView,
|
|
23
|
-
TreeDiffViewer,
|
|
24
|
-
devToolsDefaultTheme,
|
|
25
|
-
toDiffable,
|
|
26
|
-
} from "@buoy-gg/shared-ui/dataViewer";
|
|
27
|
-
import { VERDICT_META } from "./verdictMeta";
|
|
28
|
-
|
|
29
|
-
const DIFF_MODE_KEY = devToolsStorageKeys.timeMachine.diffViewerMode();
|
|
30
|
-
const TABS = [
|
|
31
|
-
{ key: "tree", label: "TREE VIEW" },
|
|
32
|
-
{ key: "split", label: "SPLIT VIEW" },
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
export interface ItemDetailScreenProps {
|
|
36
|
-
sourceLabel: string;
|
|
37
|
-
item: StateSnapshotPreviewItem;
|
|
38
|
-
/** "old → new" side labels, e.g. "CURRENT STATE" / snapshot name. */
|
|
39
|
-
leftLabel: string;
|
|
40
|
-
rightLabel: string;
|
|
41
|
-
onBack: () => void;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function ItemDetailScreen({
|
|
45
|
-
sourceLabel,
|
|
46
|
-
item,
|
|
47
|
-
leftLabel,
|
|
48
|
-
rightLabel,
|
|
49
|
-
onBack,
|
|
50
|
-
}: ItemDetailScreenProps) {
|
|
51
|
-
// Persisted view preference — storage's load-guard/validate/optimistic
|
|
52
|
-
// pattern, default TREE (structured state reads better as a tree).
|
|
53
|
-
const [diffMode, setDiffMode] = useState<string>("tree");
|
|
54
|
-
const hasLoadedMode = useRef(false);
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (hasLoadedMode.current) return;
|
|
57
|
-
hasLoadedMode.current = true;
|
|
58
|
-
void persistentStorage.getItem(DIFF_MODE_KEY).then((saved) => {
|
|
59
|
-
if (saved === "tree" || saved === "split") setDiffMode(saved);
|
|
60
|
-
});
|
|
61
|
-
}, []);
|
|
62
|
-
const changeMode = (mode: string) => {
|
|
63
|
-
setDiffMode(mode);
|
|
64
|
-
void persistentStorage.setItem(DIFF_MODE_KEY, mode).catch(() => {});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const meta = VERDICT_META[item.verdict];
|
|
68
|
-
const host = useToolHost();
|
|
69
|
-
const hosted = host.instanceId !== undefined;
|
|
70
|
-
|
|
71
|
-
// Hosted: the shared modal header shows this item's identity + back.
|
|
72
|
-
useToolHeader(
|
|
73
|
-
hosted
|
|
74
|
-
? {
|
|
75
|
-
title: item.label,
|
|
76
|
-
subtitle: `${sourceLabel} · ${meta.label} · ${leftLabel} → ${rightLabel}`,
|
|
77
|
-
onBack,
|
|
78
|
-
searchable: false, // nothing searchable on a single item's diff
|
|
79
|
-
}
|
|
80
|
-
: null,
|
|
81
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
82
|
-
[hosted, item.key, sourceLabel, leftLabel, rightLabel]
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
// Normalize ONCE per item; ABSENT_VALUE keeps added/removed reading as
|
|
86
|
-
// pure additions/removals instead of diffs against the literal "null".
|
|
87
|
-
const { oldValue, newValue } = useMemo(
|
|
88
|
-
() => ({
|
|
89
|
-
oldValue:
|
|
90
|
-
item.verdict === "added" ? ABSENT_VALUE : toDiffable(item.oldValue),
|
|
91
|
-
newValue:
|
|
92
|
-
item.verdict === "removed" ? ABSENT_VALUE : toDiffable(item.newValue),
|
|
93
|
-
}),
|
|
94
|
-
[item]
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<View style={styles.container}>
|
|
99
|
-
{!hosted && (
|
|
100
|
-
<View style={styles.screenHeader}>
|
|
101
|
-
<TouchableOpacity onPress={onBack} hitSlop={HIT} testID="tm-item-back">
|
|
102
|
-
<Text style={styles.backText}>‹ Preview</Text>
|
|
103
|
-
</TouchableOpacity>
|
|
104
|
-
<View style={styles.titleBlock}>
|
|
105
|
-
<Text style={styles.title} numberOfLines={1}>
|
|
106
|
-
<Text style={{ color: meta.color }}>{meta.glyph} </Text>
|
|
107
|
-
{item.label}
|
|
108
|
-
</Text>
|
|
109
|
-
<Text style={styles.subtitle} numberOfLines={1}>
|
|
110
|
-
{sourceLabel} · {meta.label} · {leftLabel} → {rightLabel}
|
|
111
|
-
</Text>
|
|
112
|
-
</View>
|
|
113
|
-
</View>
|
|
114
|
-
)}
|
|
115
|
-
|
|
116
|
-
{item.reason && <Text style={styles.reason}>⚠ {item.reason}</Text>}
|
|
117
|
-
|
|
118
|
-
<View style={styles.tabs}>
|
|
119
|
-
<DiffModeTabs tabs={TABS} activeTab={diffMode} onTabChange={changeMode} />
|
|
120
|
-
</View>
|
|
121
|
-
|
|
122
|
-
{/* One page-level scroller; both viewers render inline at natural
|
|
123
|
-
height (scrollEnabled=false) — the storage matched-pair contract. */}
|
|
124
|
-
<ScrollView style={styles.scroll} contentContainerStyle={styles.scrollContent}>
|
|
125
|
-
{diffMode === "tree" ? (
|
|
126
|
-
<TreeDiffViewer
|
|
127
|
-
oldValue={oldValue}
|
|
128
|
-
newValue={newValue}
|
|
129
|
-
theme="dark"
|
|
130
|
-
showUnchanged={false}
|
|
131
|
-
scrollEnabled={false}
|
|
132
|
-
/>
|
|
133
|
-
) : (
|
|
134
|
-
<ThemedSplitView
|
|
135
|
-
oldValue={oldValue}
|
|
136
|
-
newValue={newValue}
|
|
137
|
-
differences={EMPTY}
|
|
138
|
-
theme={devToolsDefaultTheme}
|
|
139
|
-
scrollEnabled={false}
|
|
140
|
-
/>
|
|
141
|
-
)}
|
|
142
|
-
</ScrollView>
|
|
143
|
-
</View>
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const EMPTY: unknown[] = [];
|
|
148
|
-
const HIT = { top: 10, bottom: 10, left: 10, right: 10 };
|
|
149
|
-
|
|
150
|
-
const styles = StyleSheet.create({
|
|
151
|
-
container: { flex: 1 },
|
|
152
|
-
screenHeader: {
|
|
153
|
-
flexDirection: "row",
|
|
154
|
-
alignItems: "center",
|
|
155
|
-
paddingHorizontal: 12,
|
|
156
|
-
paddingVertical: 8,
|
|
157
|
-
gap: 10,
|
|
158
|
-
},
|
|
159
|
-
backText: { color: buoyColors.primary, fontSize: 14 },
|
|
160
|
-
titleBlock: { flex: 1, minWidth: 0 },
|
|
161
|
-
title: { color: buoyColors.text, fontSize: 13, fontWeight: "700" },
|
|
162
|
-
subtitle: { color: buoyColors.textMuted, fontSize: 10, marginTop: 2 },
|
|
163
|
-
reason: {
|
|
164
|
-
color: buoyColors.warning,
|
|
165
|
-
fontSize: 11,
|
|
166
|
-
paddingHorizontal: 12,
|
|
167
|
-
paddingBottom: 6,
|
|
168
|
-
},
|
|
169
|
-
tabs: { paddingHorizontal: 12, paddingBottom: 8 },
|
|
170
|
-
scroll: { flex: 1 },
|
|
171
|
-
scrollContent: { paddingHorizontal: 12, paddingBottom: 24 },
|
|
172
|
-
});
|