@buoy-gg/time-machine 7.0.29 → 7.0.30
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/package.json +10 -11
- package/src/components/HeaderReloadButton.tsx +0 -45
- package/src/components/TimeMachineBody.tsx +0 -246
- package/src/components/TimeMachineModal.tsx +0 -75
- package/src/components/confirm.ts +0 -35
- package/src/components/format.ts +0 -17
- package/src/components/list/CaptureBar.tsx +0 -100
- package/src/components/list/RestoreOutcomeCard.tsx +0 -181
- package/src/components/list/SnapshotRow.tsx +0 -164
- package/src/components/list/SourcesStrip.tsx +0 -127
- package/src/components/list/UndoDeleteBar.tsx +0 -76
- package/src/components/list/WipeAllRow.tsx +0 -42
- package/src/components/preview/ItemDiffPanel.tsx +0 -83
- package/src/components/preview/PreviewFlow.tsx +0 -70
- package/src/components/preview/RestorePointNameRow.tsx +0 -80
- package/src/components/preview/RestorePreviewScreen.tsx +0 -1149
- package/src/components/preview/verdictMeta.ts +0 -40
- package/src/components/sources.ts +0 -92
- package/src/hooks/useTimeMachine.ts +0 -26
- package/src/index.tsx +0 -68
- package/src/preset.tsx +0 -47
- package/src/store/routeRestore.ts +0 -194
- package/src/store/snapshotVault.ts +0 -274
- package/src/store/timeMachineStore.ts +0 -881
- package/src/sync/timeMachineSyncAdapter.ts +0 -241
- package/src/ui/SwipeActionsRow.tsx +0 -199
- package/src/ui/primitives.tsx +0 -174
- package/src/ui/tmTheme.ts +0 -109
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The preview screen, wired to the store — the restore leg (baseline
|
|
3
|
-
* confirmation, the route prompt, landing back on the list) lives here so
|
|
4
|
-
* RestorePreviewScreen stays presentation.
|
|
5
|
-
*
|
|
6
|
-
* Kept apart from the restore-point list so each screen mounts and unmounts
|
|
7
|
-
* as a whole tree — the router in ../TimeMachineBody picks one, never swaps
|
|
8
|
-
* branches inside a live tree. (Item diffs are NOT a screen: they expand
|
|
9
|
-
* inline inside the preview's list.)
|
|
10
|
-
*/
|
|
11
|
-
import { timeMachineStore } from "../../store/timeMachineStore";
|
|
12
|
-
import type {
|
|
13
|
-
PreviewSideRef,
|
|
14
|
-
PreviewState,
|
|
15
|
-
} from "../../store/timeMachineStore";
|
|
16
|
-
import type { SnapshotMeta } from "../../store/snapshotVault";
|
|
17
|
-
import { confirmDestructive } from "../confirm";
|
|
18
|
-
import { RestorePreviewScreen } from "./RestorePreviewScreen";
|
|
19
|
-
|
|
20
|
-
function snapshotFor(
|
|
21
|
-
ref: PreviewSideRef,
|
|
22
|
-
snapshots: SnapshotMeta[]
|
|
23
|
-
): SnapshotMeta | undefined {
|
|
24
|
-
return ref === "current"
|
|
25
|
-
? undefined
|
|
26
|
-
: snapshots.find((s) => s.id === ref.snapshotId);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function PreviewScreen({
|
|
30
|
-
preview,
|
|
31
|
-
snapshots,
|
|
32
|
-
busy,
|
|
33
|
-
onClose,
|
|
34
|
-
}: {
|
|
35
|
-
preview: PreviewState;
|
|
36
|
-
snapshots: SnapshotMeta[];
|
|
37
|
-
busy: boolean;
|
|
38
|
-
onClose: () => void;
|
|
39
|
-
}) {
|
|
40
|
-
const rightMeta = snapshotFor(preview.right, snapshots);
|
|
41
|
-
|
|
42
|
-
const restore = (mode: "live" | "reload", excludeKeys?: string[]) => {
|
|
43
|
-
if (!rightMeta || busy) return;
|
|
44
|
-
if (rightMeta.baseline) {
|
|
45
|
-
confirmDestructive(
|
|
46
|
-
"Restore fresh install?",
|
|
47
|
-
"This wipes all app storage and reloads the app.",
|
|
48
|
-
"Wipe & reload",
|
|
49
|
-
() => void timeMachineStore.restore(rightMeta.id, "reload")
|
|
50
|
-
);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
// Land back on the list, where the outcome card reports the results —
|
|
54
|
-
// the preview's diff is stale the moment restore runs. Whether the route
|
|
55
|
-
// comes back is the restore point's own setting, toggled on its row.
|
|
56
|
-
void timeMachineStore
|
|
57
|
-
.restore(rightMeta.id, mode, excludeKeys)
|
|
58
|
-
.then(onClose);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<RestorePreviewScreen
|
|
63
|
-
preview={preview}
|
|
64
|
-
snapshots={snapshots}
|
|
65
|
-
busy={busy}
|
|
66
|
-
onBack={onClose}
|
|
67
|
-
onRestore={restore}
|
|
68
|
-
/>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The restore point's name, editable in place.
|
|
3
|
-
*
|
|
4
|
-
* Renaming lives on the preview rather than behind a swipe on the list: the
|
|
5
|
-
* list is for picking one, and you rarely know a name is wrong until you're
|
|
6
|
-
* looking at what the point actually contains.
|
|
7
|
-
*
|
|
8
|
-
* Commits on blur as well as on return — tapping away from a field you have
|
|
9
|
-
* just typed into should keep the typing. Finder and iOS both treat leaving
|
|
10
|
-
* as accepting, and silently discarding an edit is the one outcome nobody
|
|
11
|
-
* wants.
|
|
12
|
-
*/
|
|
13
|
-
import { useEffect, useState } from "react";
|
|
14
|
-
import { StyleSheet, Text, TextInput, View } from "react-native";
|
|
15
|
-
import { tm } from "../../ui/tmTheme";
|
|
16
|
-
|
|
17
|
-
export function RestorePointNameRow({
|
|
18
|
-
name,
|
|
19
|
-
onRename,
|
|
20
|
-
}: {
|
|
21
|
-
name: string;
|
|
22
|
-
onRename: (name: string) => void;
|
|
23
|
-
}) {
|
|
24
|
-
const [draft, setDraft] = useState(name);
|
|
25
|
-
|
|
26
|
-
// A rename from anywhere else (MCP, the desktop) should show up here.
|
|
27
|
-
useEffect(() => setDraft(name), [name]);
|
|
28
|
-
|
|
29
|
-
const commit = () => {
|
|
30
|
-
const trimmed = draft.trim();
|
|
31
|
-
if (!trimmed) {
|
|
32
|
-
setDraft(name); // an empty name would make the row unidentifiable
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
if (trimmed !== name) onRename(trimmed);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<View style={styles.row}>
|
|
40
|
-
<Text style={styles.label}>Name</Text>
|
|
41
|
-
<TextInput
|
|
42
|
-
style={styles.input}
|
|
43
|
-
value={draft}
|
|
44
|
-
onChangeText={setDraft}
|
|
45
|
-
onSubmitEditing={commit}
|
|
46
|
-
onBlur={commit}
|
|
47
|
-
returnKeyType="done"
|
|
48
|
-
selectTextOnFocus
|
|
49
|
-
accessibilityLabel="Restore point name"
|
|
50
|
-
testID="tm-preview-name"
|
|
51
|
-
/>
|
|
52
|
-
</View>
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const styles = StyleSheet.create({
|
|
57
|
-
row: {
|
|
58
|
-
flexDirection: "row",
|
|
59
|
-
alignItems: "center",
|
|
60
|
-
gap: 14,
|
|
61
|
-
minHeight: tm.rowMinHeight,
|
|
62
|
-
paddingHorizontal: tm.textInset,
|
|
63
|
-
},
|
|
64
|
-
label: {
|
|
65
|
-
color: tm.color.labelSecondary,
|
|
66
|
-
fontSize: tm.font.row,
|
|
67
|
-
letterSpacing: tm.tracking.row,
|
|
68
|
-
},
|
|
69
|
-
input: {
|
|
70
|
-
flex: 1,
|
|
71
|
-
minWidth: 0,
|
|
72
|
-
color: tm.color.label,
|
|
73
|
-
fontSize: tm.font.row,
|
|
74
|
-
fontWeight: "600",
|
|
75
|
-
letterSpacing: tm.tracking.row,
|
|
76
|
-
textAlign: "right",
|
|
77
|
-
padding: 0,
|
|
78
|
-
backgroundColor: "transparent",
|
|
79
|
-
},
|
|
80
|
-
});
|