vfs-kit 1.0.0 → 1.0.2
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/LICENSE +21 -21
- package/README.md +145 -2
- package/dist/VfsAdapter-BWjniD9Y.d.mts +57 -0
- package/dist/VfsAdapter-DOBt_TyL.d.ts +57 -0
- package/dist/VfsEngine-B6nhgyjQ.d.mts +152 -0
- package/dist/VfsEngine-DLx0iUpi.d.ts +152 -0
- package/dist/VfsNode-D10gxL5W.d.mts +48 -0
- package/dist/VfsNode-D10gxL5W.d.ts +48 -0
- package/dist/adapters/index.d.mts +201 -0
- package/dist/adapters/index.d.ts +201 -0
- package/dist/adapters/index.js +1159 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/index.mjs +1159 -0
- package/dist/adapters/index.mjs.map +1 -0
- package/dist/chunk-2FEJBM4N.js +60 -0
- package/dist/chunk-2FEJBM4N.js.map +1 -0
- package/dist/chunk-7OQI6PNM.mjs +60 -0
- package/dist/chunk-7OQI6PNM.mjs.map +1 -0
- package/dist/chunk-ALWOZGZI.mjs +23 -0
- package/dist/chunk-ALWOZGZI.mjs.map +1 -0
- package/dist/chunk-POSVS4C7.mjs +531 -0
- package/dist/chunk-POSVS4C7.mjs.map +1 -0
- package/dist/chunk-R3ROYAMW.js +23 -0
- package/dist/chunk-R3ROYAMW.js.map +1 -0
- package/dist/chunk-SWRBVSS6.mjs +16 -0
- package/dist/chunk-SWRBVSS6.mjs.map +1 -0
- package/dist/chunk-U2CKTXY7.js +16 -0
- package/dist/chunk-U2CKTXY7.js.map +1 -0
- package/dist/chunk-WZVVI3HX.js +531 -0
- package/dist/chunk-WZVVI3HX.js.map +1 -0
- package/dist/components/index.d.mts +193 -0
- package/dist/components/index.d.ts +193 -0
- package/dist/components/index.js +1197 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index.mjs +1197 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/hooks/index.d.mts +120 -0
- package/dist/hooks/index.d.ts +120 -0
- package/dist/hooks/index.js +51 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +51 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +42 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +530 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +530 -0
- package/dist/index.mjs.map +1 -0
- package/dist/useVfsTabs-ZHDaLrM1.d.mts +39 -0
- package/dist/useVfsTabs-ZHDaLrM1.d.ts +39 -0
- package/package.json +63 -30
- package/index.js +0 -7
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
VfsContext,
|
|
4
|
+
useVfsContext
|
|
5
|
+
} from "./chunk-SWRBVSS6.mjs";
|
|
6
|
+
import {
|
|
7
|
+
__async,
|
|
8
|
+
__spreadProps,
|
|
9
|
+
__spreadValues
|
|
10
|
+
} from "./chunk-7OQI6PNM.mjs";
|
|
11
|
+
|
|
12
|
+
// src/react/hooks/useVfsEngine.ts
|
|
13
|
+
import { useCallback, useContext, useSyncExternalStore } from "react";
|
|
14
|
+
function useVfsEngine(workspaceId) {
|
|
15
|
+
var _a;
|
|
16
|
+
const ctx = useContext(VfsContext);
|
|
17
|
+
const id = workspaceId != null ? workspaceId : ctx == null ? void 0 : ctx.activeWorkspaceId;
|
|
18
|
+
const engine = (_a = ctx == null ? void 0 : ctx.workspaces.get(id)) == null ? void 0 : _a.engine;
|
|
19
|
+
const subscribe = useCallback((cb) => engine.subscribe(cb), [engine]);
|
|
20
|
+
const getVersion = useCallback(() => engine.version, [engine]);
|
|
21
|
+
const getPending = useCallback(() => engine.pending, [engine]);
|
|
22
|
+
const getError = useCallback(() => engine.lastError, [engine]);
|
|
23
|
+
const version = useSyncExternalStore(subscribe, getVersion);
|
|
24
|
+
const pending = useSyncExternalStore(subscribe, getPending);
|
|
25
|
+
const error = useSyncExternalStore(subscribe, getError);
|
|
26
|
+
const fs = useCallback(() => {
|
|
27
|
+
const toArray = (ids) => Array.isArray(ids) ? ids : [ids];
|
|
28
|
+
return {
|
|
29
|
+
execute: (command) => engine.execute(command),
|
|
30
|
+
createFile: (parentId, name, opts) => engine.execute(__spreadValues({ op: "create", kind: "file", parentId, name }, opts)),
|
|
31
|
+
createFolder: (parentId, name, opts) => engine.execute(__spreadValues({ op: "create", kind: "folder", parentId, name }, opts)),
|
|
32
|
+
rename: (id2, newName) => engine.execute({ op: "rename", id: id2, newName }),
|
|
33
|
+
delete: (ids, permanent) => engine.execute({ op: "delete", ids: toArray(ids), permanent }),
|
|
34
|
+
restore: (ids) => engine.execute({ op: "restore", ids: toArray(ids) }),
|
|
35
|
+
purge: (ids) => engine.execute({ op: "purge", ids: toArray(ids) }),
|
|
36
|
+
move: (ids, newParentId) => engine.execute({ op: "move", ids: toArray(ids), newParentId }),
|
|
37
|
+
write: (id2, content) => engine.execute({ op: "write", id: id2, content }),
|
|
38
|
+
lock: (ids) => engine.execute({ op: "lock", ids: toArray(ids) }),
|
|
39
|
+
unlock: (ids) => engine.execute({ op: "unlock", ids: toArray(ids) }),
|
|
40
|
+
reorder: (parentId, orderedIds) => engine.execute({ op: "reorder", parentId, orderedIds }),
|
|
41
|
+
snapshot: (fileId, label) => engine.execute({ op: "snapshot", fileId, label })
|
|
42
|
+
};
|
|
43
|
+
}, [engine])();
|
|
44
|
+
const tree = useCallback(() => ({
|
|
45
|
+
getNode: (id2) => engine.getNode(id2),
|
|
46
|
+
getChildren: (parentId, opts) => engine.getChildren(parentId, opts),
|
|
47
|
+
getPath: (id2) => engine.getPath(id2),
|
|
48
|
+
readFile: (id2) => engine.readFile(id2),
|
|
49
|
+
readJSON: (id2) => __async(null, null, function* () {
|
|
50
|
+
const bytes = yield engine.readFile(id2);
|
|
51
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
52
|
+
}),
|
|
53
|
+
writeJSON: (id2, data) => __async(null, null, function* () {
|
|
54
|
+
const bytes = new TextEncoder().encode(JSON.stringify(data, null, 2));
|
|
55
|
+
yield engine.execute({ op: "write", id: id2, content: bytes });
|
|
56
|
+
}),
|
|
57
|
+
search: (query, opts) => engine.search(query, opts),
|
|
58
|
+
getTrashed: () => engine.getTrashed(),
|
|
59
|
+
getSnapshots: (fileId) => engine.getSnapshots(fileId)
|
|
60
|
+
}), [engine])();
|
|
61
|
+
return { fs, tree, status: { pending, error, version } };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/react/hooks/useVfsTabs.ts
|
|
65
|
+
import { useCallback as useCallback2, useEffect, useMemo, useReducer, useRef } from "react";
|
|
66
|
+
var defaultDirtyChecker = ({
|
|
67
|
+
savedContent,
|
|
68
|
+
currentContent
|
|
69
|
+
}) => {
|
|
70
|
+
if (!savedContent && !currentContent) return false;
|
|
71
|
+
if (!savedContent || !currentContent) return true;
|
|
72
|
+
if (savedContent.byteLength !== currentContent.byteLength) return true;
|
|
73
|
+
for (let i = 0; i < savedContent.byteLength; i++) {
|
|
74
|
+
if (savedContent[i] !== currentContent[i]) return true;
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
};
|
|
78
|
+
function tabReducer(state, action) {
|
|
79
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
80
|
+
switch (action.type) {
|
|
81
|
+
case "OPEN": {
|
|
82
|
+
const existing = state.tabs.find(
|
|
83
|
+
(t) => t.nodeId === action.tab.nodeId && t.workspaceId === action.tab.workspaceId
|
|
84
|
+
);
|
|
85
|
+
if (existing) return __spreadProps(__spreadValues({}, state), { activeTabId: existing.id });
|
|
86
|
+
return {
|
|
87
|
+
tabs: [...state.tabs, action.tab],
|
|
88
|
+
activeTabId: action.tab.id
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
case "CLOSE": {
|
|
92
|
+
const tab = state.tabs.find((t) => t.id === action.tabId);
|
|
93
|
+
if (tab == null ? void 0 : tab.isLocked) return state;
|
|
94
|
+
const filtered = state.tabs.filter((t) => t.id !== action.tabId);
|
|
95
|
+
const nextActive = state.activeTabId === action.tabId ? (_b = (_a = filtered[filtered.length - 1]) == null ? void 0 : _a.id) != null ? _b : null : state.activeTabId;
|
|
96
|
+
return { tabs: filtered, activeTabId: nextActive };
|
|
97
|
+
}
|
|
98
|
+
case "CLOSE_OTHERS": {
|
|
99
|
+
const keep = state.tabs.filter(
|
|
100
|
+
(t) => t.id === action.tabId || t.isLocked
|
|
101
|
+
);
|
|
102
|
+
return { tabs: keep, activeTabId: action.tabId };
|
|
103
|
+
}
|
|
104
|
+
case "CLOSE_ALL": {
|
|
105
|
+
const keep = state.tabs.filter(
|
|
106
|
+
(t) => t.isLocked || (action.workspaceId ? t.workspaceId !== action.workspaceId : false)
|
|
107
|
+
);
|
|
108
|
+
const activeStillExists = keep.find((t) => t.id === state.activeTabId);
|
|
109
|
+
return {
|
|
110
|
+
tabs: keep,
|
|
111
|
+
activeTabId: activeStillExists ? state.activeTabId : (_d = (_c = keep[keep.length - 1]) == null ? void 0 : _c.id) != null ? _d : null
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
case "SET_ACTIVE":
|
|
115
|
+
return __spreadProps(__spreadValues({}, state), { activeTabId: action.tabId });
|
|
116
|
+
case "REORDER": {
|
|
117
|
+
const from = state.tabs.findIndex((t) => t.id === action.activeId);
|
|
118
|
+
const to = state.tabs.findIndex((t) => t.id === action.overId);
|
|
119
|
+
if (from === -1 || to === -1) return state;
|
|
120
|
+
const reordered = [...state.tabs];
|
|
121
|
+
const [moved] = reordered.splice(from, 1);
|
|
122
|
+
reordered.splice(to, 0, moved);
|
|
123
|
+
return __spreadProps(__spreadValues({}, state), { tabs: reordered });
|
|
124
|
+
}
|
|
125
|
+
case "LOCK":
|
|
126
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
127
|
+
tabs: state.tabs.map(
|
|
128
|
+
(t) => t.id === action.tabId ? __spreadProps(__spreadValues({}, t), { isLocked: true }) : t
|
|
129
|
+
)
|
|
130
|
+
});
|
|
131
|
+
case "UNLOCK":
|
|
132
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
133
|
+
tabs: state.tabs.map(
|
|
134
|
+
(t) => t.id === action.tabId ? __spreadProps(__spreadValues({}, t), { isLocked: false }) : t
|
|
135
|
+
)
|
|
136
|
+
});
|
|
137
|
+
case "MARK_DIRTY":
|
|
138
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
139
|
+
tabs: state.tabs.map(
|
|
140
|
+
(t) => t.id === action.tabId ? __spreadProps(__spreadValues({}, t), { currentContent: action.currentContent, isDirty: true }) : t
|
|
141
|
+
)
|
|
142
|
+
});
|
|
143
|
+
case "MARK_SAVED":
|
|
144
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
145
|
+
tabs: state.tabs.map(
|
|
146
|
+
(t) => t.id === action.tabId ? __spreadProps(__spreadValues({}, t), {
|
|
147
|
+
isDirty: false,
|
|
148
|
+
savedContent: t.currentContent,
|
|
149
|
+
lastSavedAt: Date.now()
|
|
150
|
+
}) : t
|
|
151
|
+
)
|
|
152
|
+
});
|
|
153
|
+
case "RENAME":
|
|
154
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
155
|
+
tabs: state.tabs.map(
|
|
156
|
+
(t) => t.nodeId === action.nodeId ? __spreadProps(__spreadValues({}, t), { title: action.newTitle }) : t
|
|
157
|
+
)
|
|
158
|
+
});
|
|
159
|
+
case "REMOVE_NODE": {
|
|
160
|
+
const filtered = state.tabs.filter((t) => t.nodeId !== action.nodeId);
|
|
161
|
+
const nextActive = ((_e = state.tabs.find((t) => t.nodeId === action.nodeId)) == null ? void 0 : _e.id) === state.activeTabId ? (_g = (_f = filtered[filtered.length - 1]) == null ? void 0 : _f.id) != null ? _g : null : state.activeTabId;
|
|
162
|
+
return { tabs: filtered, activeTabId: nextActive };
|
|
163
|
+
}
|
|
164
|
+
case "HYDRATE":
|
|
165
|
+
return { tabs: action.tabs, activeTabId: action.activeTabId };
|
|
166
|
+
default:
|
|
167
|
+
return state;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
var SESSION_KEY = (workspaceId) => `vfs-tabs:${workspaceId}`;
|
|
171
|
+
function saveToSession(workspaceId, state) {
|
|
172
|
+
const payload = {
|
|
173
|
+
tabs: state.tabs.filter((t) => t.workspaceId === workspaceId).map(
|
|
174
|
+
({ id, nodeId, workspaceId: workspaceId2, title, isLocked }) => ({ id, nodeId, workspaceId: workspaceId2, title, isLocked })
|
|
175
|
+
),
|
|
176
|
+
activeTabId: state.activeTabId
|
|
177
|
+
};
|
|
178
|
+
try {
|
|
179
|
+
sessionStorage.setItem(SESSION_KEY(workspaceId), JSON.stringify(payload));
|
|
180
|
+
} catch (e) {
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
function loadFromSession(workspaceId) {
|
|
184
|
+
try {
|
|
185
|
+
const raw = sessionStorage.getItem(SESSION_KEY(workspaceId));
|
|
186
|
+
return raw ? JSON.parse(raw) : null;
|
|
187
|
+
} catch (e) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
function useVfsTabs(options = {}) {
|
|
192
|
+
var _a;
|
|
193
|
+
const ctx = useVfsContext();
|
|
194
|
+
const { dirtyChecker = defaultDirtyChecker, workspaceIds } = options;
|
|
195
|
+
const resolvedIds = useMemo(
|
|
196
|
+
() => workspaceIds != null ? workspaceIds : [ctx.activeWorkspaceId],
|
|
197
|
+
[workspaceIds == null ? void 0 : workspaceIds.join(","), ctx.activeWorkspaceId]
|
|
198
|
+
);
|
|
199
|
+
const [state, dispatch] = useReducer(tabReducer, {
|
|
200
|
+
tabs: [],
|
|
201
|
+
activeTabId: null
|
|
202
|
+
});
|
|
203
|
+
useEffect(() => {
|
|
204
|
+
if (ctx.tabPersistence.strategy === "none") return;
|
|
205
|
+
const allTabs = [];
|
|
206
|
+
let activeId = null;
|
|
207
|
+
for (const wsId of resolvedIds) {
|
|
208
|
+
const workspace = ctx.workspaces.get(wsId);
|
|
209
|
+
if (!workspace) continue;
|
|
210
|
+
const persisted = loadFromSession(wsId);
|
|
211
|
+
if (!persisted) continue;
|
|
212
|
+
for (const t of persisted.tabs) {
|
|
213
|
+
allTabs.push(__spreadProps(__spreadValues({}, t), {
|
|
214
|
+
isDirty: false,
|
|
215
|
+
savedContent: null,
|
|
216
|
+
currentContent: null,
|
|
217
|
+
lastSavedAt: null
|
|
218
|
+
}));
|
|
219
|
+
}
|
|
220
|
+
if (persisted.activeTabId) activeId = persisted.activeTabId;
|
|
221
|
+
}
|
|
222
|
+
if (allTabs.length > 0) {
|
|
223
|
+
dispatch({ type: "HYDRATE", tabs: allTabs, activeTabId: activeId });
|
|
224
|
+
}
|
|
225
|
+
}, []);
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
if (ctx.tabPersistence.strategy === "none") return;
|
|
228
|
+
for (const wsId of resolvedIds) {
|
|
229
|
+
saveToSession(wsId, state);
|
|
230
|
+
}
|
|
231
|
+
}, [state, ctx.tabPersistence.strategy, resolvedIds]);
|
|
232
|
+
const stateRef = useRef(state);
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
stateRef.current = state;
|
|
235
|
+
}, [state]);
|
|
236
|
+
useEffect(() => {
|
|
237
|
+
const unsubs = [];
|
|
238
|
+
for (const wsId of resolvedIds) {
|
|
239
|
+
const workspace = ctx.workspaces.get(wsId);
|
|
240
|
+
if (!workspace) continue;
|
|
241
|
+
const { engine } = workspace;
|
|
242
|
+
unsubs.push(engine.on("renamed", (node) => {
|
|
243
|
+
dispatch({ type: "RENAME", nodeId: node.id, newTitle: node.name });
|
|
244
|
+
}));
|
|
245
|
+
unsubs.push(engine.on("deleted", ({ ids }) => {
|
|
246
|
+
for (const id of ids) dispatch({ type: "REMOVE_NODE", nodeId: id });
|
|
247
|
+
}));
|
|
248
|
+
unsubs.push(engine.on("change", () => {
|
|
249
|
+
if (ctx.tabPersistence.strategy !== "none") {
|
|
250
|
+
saveToSession(wsId, stateRef.current);
|
|
251
|
+
}
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
return () => unsubs.forEach((u) => u());
|
|
255
|
+
}, [resolvedIds, ctx.workspaces, ctx.tabPersistence.strategy]);
|
|
256
|
+
const open = useCallback2((nodeId, workspaceId) => __async(null, null, function* () {
|
|
257
|
+
const workspace = ctx.workspaces.get(workspaceId);
|
|
258
|
+
if (!workspace) throw new Error(`Workspace "${workspaceId}" not found`);
|
|
259
|
+
const node = yield workspace.engine.getNode(nodeId);
|
|
260
|
+
if (!node) throw new Error(`Node "${nodeId}" not found`);
|
|
261
|
+
const content = node.kind === "file" ? yield workspace.engine.readFile(nodeId) : null;
|
|
262
|
+
const tab = {
|
|
263
|
+
id: crypto.randomUUID(),
|
|
264
|
+
nodeId,
|
|
265
|
+
workspaceId,
|
|
266
|
+
title: node.name,
|
|
267
|
+
isDirty: false,
|
|
268
|
+
isLocked: false,
|
|
269
|
+
savedContent: content,
|
|
270
|
+
currentContent: content,
|
|
271
|
+
lastSavedAt: null
|
|
272
|
+
};
|
|
273
|
+
dispatch({ type: "OPEN", tab });
|
|
274
|
+
}), [ctx.workspaces]);
|
|
275
|
+
const close = useCallback2((tabId) => {
|
|
276
|
+
const tab = state.tabs.find((t) => t.id === tabId);
|
|
277
|
+
if (tab == null ? void 0 : tab.isLocked) {
|
|
278
|
+
const workspace = ctx.workspaces.get(tab.workspaceId);
|
|
279
|
+
workspace == null ? void 0 : workspace.engine.emit("warning", {
|
|
280
|
+
code: "LOCKED_TAB_CLOSE",
|
|
281
|
+
tabId,
|
|
282
|
+
nodeId: tab.nodeId
|
|
283
|
+
});
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
dispatch({ type: "CLOSE", tabId });
|
|
287
|
+
}, [state.tabs, ctx.workspaces]);
|
|
288
|
+
const markDirty = useCallback2((tabId, currentContent) => {
|
|
289
|
+
const tab = state.tabs.find((t) => t.id === tabId);
|
|
290
|
+
if (!tab) return;
|
|
291
|
+
const isDirty = dirtyChecker({
|
|
292
|
+
nodeId: tab.nodeId,
|
|
293
|
+
savedContent: tab.savedContent,
|
|
294
|
+
currentContent,
|
|
295
|
+
lastSavedAt: tab.lastSavedAt
|
|
296
|
+
});
|
|
297
|
+
if (isDirty) dispatch({ type: "MARK_DIRTY", tabId, currentContent });
|
|
298
|
+
}, [state.tabs, dirtyChecker]);
|
|
299
|
+
const activeTab = (_a = state.tabs.find((t) => t.id === state.activeTabId)) != null ? _a : null;
|
|
300
|
+
return {
|
|
301
|
+
tabs: state.tabs,
|
|
302
|
+
activeTabId: state.activeTabId,
|
|
303
|
+
activeTab,
|
|
304
|
+
open,
|
|
305
|
+
close,
|
|
306
|
+
closeOthers: (tabId) => dispatch({ type: "CLOSE_OTHERS", tabId }),
|
|
307
|
+
closeAll: (workspaceId) => dispatch({ type: "CLOSE_ALL", workspaceId }),
|
|
308
|
+
setActive: (tabId) => dispatch({ type: "SET_ACTIVE", tabId }),
|
|
309
|
+
reorder: (a, o) => dispatch({ type: "REORDER", activeId: a, overId: o }),
|
|
310
|
+
lock: (tabId) => dispatch({ type: "LOCK", tabId }),
|
|
311
|
+
unlock: (tabId) => dispatch({ type: "UNLOCK", tabId }),
|
|
312
|
+
markDirty,
|
|
313
|
+
markSaved: (tabId) => dispatch({ type: "MARK_SAVED", tabId })
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// src/react/hooks/useVfsSelection.ts
|
|
318
|
+
import { useCallback as useCallback3, useReducer as useReducer2 } from "react";
|
|
319
|
+
function selectionReducer(state, action) {
|
|
320
|
+
var _a, _b;
|
|
321
|
+
switch (action.type) {
|
|
322
|
+
case "SELECT":
|
|
323
|
+
return {
|
|
324
|
+
selection: [action.id],
|
|
325
|
+
lastSelectedId: action.id
|
|
326
|
+
};
|
|
327
|
+
case "TOGGLE": {
|
|
328
|
+
const isSelected = state.selection.includes(action.id);
|
|
329
|
+
return {
|
|
330
|
+
selection: isSelected ? state.selection.filter((id) => id !== action.id) : [...state.selection, action.id],
|
|
331
|
+
lastSelectedId: action.id
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
case "SELECT_RANGE":
|
|
335
|
+
return {
|
|
336
|
+
selection: Array.from(/* @__PURE__ */ new Set([...state.selection, ...action.ids])),
|
|
337
|
+
lastSelectedId: (_a = action.ids[action.ids.length - 1]) != null ? _a : state.lastSelectedId
|
|
338
|
+
};
|
|
339
|
+
case "DESELECT":
|
|
340
|
+
return __spreadProps(__spreadValues({}, state), {
|
|
341
|
+
selection: state.selection.filter((id) => id !== action.id)
|
|
342
|
+
});
|
|
343
|
+
case "DESELECT_ALL":
|
|
344
|
+
return { selection: [], lastSelectedId: null };
|
|
345
|
+
case "SELECT_ALL":
|
|
346
|
+
return {
|
|
347
|
+
selection: action.ids,
|
|
348
|
+
lastSelectedId: (_b = action.ids[action.ids.length - 1]) != null ? _b : null
|
|
349
|
+
};
|
|
350
|
+
default:
|
|
351
|
+
return state;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
function resolveRange(orderedIds, anchorId, targetId) {
|
|
355
|
+
const anchorIdx = orderedIds.indexOf(anchorId);
|
|
356
|
+
const targetIdx = orderedIds.indexOf(targetId);
|
|
357
|
+
if (anchorIdx === -1 || targetIdx === -1) return [targetId];
|
|
358
|
+
const [from, to] = anchorIdx < targetIdx ? [anchorIdx, targetIdx] : [targetIdx, anchorIdx];
|
|
359
|
+
return orderedIds.slice(from, to + 1);
|
|
360
|
+
}
|
|
361
|
+
function useVfsSelection(options = {}) {
|
|
362
|
+
const {
|
|
363
|
+
multiSelect = true,
|
|
364
|
+
rangeSelect = true
|
|
365
|
+
} = options;
|
|
366
|
+
const [state, dispatch] = useReducer2(selectionReducer, {
|
|
367
|
+
selection: [],
|
|
368
|
+
lastSelectedId: null
|
|
369
|
+
});
|
|
370
|
+
const select = useCallback3((id) => {
|
|
371
|
+
dispatch({ type: "SELECT", id });
|
|
372
|
+
}, []);
|
|
373
|
+
const toggle = useCallback3((id) => {
|
|
374
|
+
if (!multiSelect) {
|
|
375
|
+
dispatch({ type: "SELECT", id });
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
dispatch({ type: "TOGGLE", id });
|
|
379
|
+
}, [multiSelect]);
|
|
380
|
+
const selectRange = useCallback3((orderedIds, anchorId, targetId) => {
|
|
381
|
+
if (!rangeSelect) {
|
|
382
|
+
dispatch({ type: "SELECT", id: targetId });
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
const range = resolveRange(orderedIds, anchorId, targetId);
|
|
386
|
+
dispatch({ type: "SELECT_RANGE", ids: range });
|
|
387
|
+
}, [rangeSelect]);
|
|
388
|
+
const deselect = useCallback3((id) => dispatch({ type: "DESELECT", id }), []);
|
|
389
|
+
const deselectAll = useCallback3(() => dispatch({ type: "DESELECT_ALL" }), []);
|
|
390
|
+
const selectAll = useCallback3((ids) => dispatch({ type: "SELECT_ALL", ids }), []);
|
|
391
|
+
const isSelected = useCallback3(
|
|
392
|
+
(id) => state.selection.includes(id),
|
|
393
|
+
[state.selection]
|
|
394
|
+
);
|
|
395
|
+
return {
|
|
396
|
+
selection: state.selection,
|
|
397
|
+
lastSelectedId: state.lastSelectedId,
|
|
398
|
+
isSelected,
|
|
399
|
+
select,
|
|
400
|
+
toggle,
|
|
401
|
+
selectRange,
|
|
402
|
+
deselect,
|
|
403
|
+
deselectAll,
|
|
404
|
+
selectAll
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// src/react/hooks/useVfsExpanded.ts
|
|
409
|
+
import { useCallback as useCallback4, useEffect as useEffect2, useMemo as useMemo2, useReducer as useReducer3 } from "react";
|
|
410
|
+
function expandedReducer(state, action) {
|
|
411
|
+
switch (action.type) {
|
|
412
|
+
case "EXPAND": {
|
|
413
|
+
if (state.has(action.id)) return state;
|
|
414
|
+
const next = new Set(state);
|
|
415
|
+
next.add(action.id);
|
|
416
|
+
return next;
|
|
417
|
+
}
|
|
418
|
+
case "COLLAPSE": {
|
|
419
|
+
if (!state.has(action.id)) return state;
|
|
420
|
+
const next = new Set(state);
|
|
421
|
+
next.delete(action.id);
|
|
422
|
+
return next;
|
|
423
|
+
}
|
|
424
|
+
case "TOGGLE": {
|
|
425
|
+
const next = new Set(state);
|
|
426
|
+
next.has(action.id) ? next.delete(action.id) : next.add(action.id);
|
|
427
|
+
return next;
|
|
428
|
+
}
|
|
429
|
+
case "EXPAND_ALL": {
|
|
430
|
+
const next = new Set(state);
|
|
431
|
+
for (const id of action.ids) next.add(id);
|
|
432
|
+
return next;
|
|
433
|
+
}
|
|
434
|
+
case "COLLAPSE_ALL":
|
|
435
|
+
return /* @__PURE__ */ new Set();
|
|
436
|
+
case "HYDRATE":
|
|
437
|
+
return new Set(action.ids);
|
|
438
|
+
default:
|
|
439
|
+
return state;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
var PERSIST_KEY = (key) => `vfs-expanded:${key}`;
|
|
443
|
+
function saveExpanded(key, ids) {
|
|
444
|
+
try {
|
|
445
|
+
sessionStorage.setItem(PERSIST_KEY(key), JSON.stringify([...ids]));
|
|
446
|
+
} catch (e) {
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
function loadExpanded(key) {
|
|
450
|
+
try {
|
|
451
|
+
const raw = sessionStorage.getItem(PERSIST_KEY(key));
|
|
452
|
+
return raw ? JSON.parse(raw) : null;
|
|
453
|
+
} catch (e) {
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
function useVfsExpanded(options = {}) {
|
|
458
|
+
const {
|
|
459
|
+
workspaceIds,
|
|
460
|
+
defaultExpanded = [],
|
|
461
|
+
persistKey
|
|
462
|
+
} = options;
|
|
463
|
+
const ctx = useVfsContext();
|
|
464
|
+
const resolvedIds = useMemo2(
|
|
465
|
+
() => workspaceIds != null ? workspaceIds : [ctx.activeWorkspaceId],
|
|
466
|
+
[workspaceIds == null ? void 0 : workspaceIds.join(","), ctx.activeWorkspaceId]
|
|
467
|
+
);
|
|
468
|
+
const [expandedIds, dispatch] = useReducer3(
|
|
469
|
+
expandedReducer,
|
|
470
|
+
void 0,
|
|
471
|
+
() => {
|
|
472
|
+
if (persistKey) {
|
|
473
|
+
const persisted = loadExpanded(persistKey);
|
|
474
|
+
if (persisted) return new Set(persisted);
|
|
475
|
+
}
|
|
476
|
+
return new Set(defaultExpanded);
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
useEffect2(() => {
|
|
480
|
+
if (!persistKey) return;
|
|
481
|
+
saveExpanded(persistKey, expandedIds);
|
|
482
|
+
}, [expandedIds, persistKey]);
|
|
483
|
+
useEffect2(() => {
|
|
484
|
+
const unsubs = [];
|
|
485
|
+
for (const wsId of resolvedIds) {
|
|
486
|
+
const workspace = ctx.workspaces.get(wsId);
|
|
487
|
+
if (!workspace) continue;
|
|
488
|
+
unsubs.push(workspace.engine.on("deleted", ({ ids }) => {
|
|
489
|
+
for (const id of ids) {
|
|
490
|
+
dispatch({ type: "COLLAPSE", id });
|
|
491
|
+
}
|
|
492
|
+
}));
|
|
493
|
+
}
|
|
494
|
+
return () => unsubs.forEach((u) => u());
|
|
495
|
+
}, [resolvedIds, ctx.workspaces]);
|
|
496
|
+
const expandToNode = useCallback4((nodeId, workspaceId) => __async(null, null, function* () {
|
|
497
|
+
const wsId = workspaceId != null ? workspaceId : ctx.activeWorkspaceId;
|
|
498
|
+
const workspace = ctx.workspaces.get(wsId);
|
|
499
|
+
if (!workspace) return;
|
|
500
|
+
const { engine } = workspace;
|
|
501
|
+
const ancestorIds = [];
|
|
502
|
+
let current = yield engine.getNode(nodeId);
|
|
503
|
+
while (current == null ? void 0 : current.parentId) {
|
|
504
|
+
ancestorIds.push(current.parentId);
|
|
505
|
+
current = yield engine.getNode(current.parentId);
|
|
506
|
+
}
|
|
507
|
+
dispatch({ type: "EXPAND_ALL", ids: ancestorIds });
|
|
508
|
+
}), [ctx.workspaces, ctx.activeWorkspaceId]);
|
|
509
|
+
const isExpanded = useCallback4(
|
|
510
|
+
(id) => expandedIds.has(id),
|
|
511
|
+
[expandedIds]
|
|
512
|
+
);
|
|
513
|
+
return {
|
|
514
|
+
expandedIds,
|
|
515
|
+
isExpanded,
|
|
516
|
+
expand: (id) => dispatch({ type: "EXPAND", id }),
|
|
517
|
+
collapse: (id) => dispatch({ type: "COLLAPSE", id }),
|
|
518
|
+
toggle: (id) => dispatch({ type: "TOGGLE", id }),
|
|
519
|
+
expandAll: (ids) => dispatch({ type: "EXPAND_ALL", ids }),
|
|
520
|
+
collapseAll: () => dispatch({ type: "COLLAPSE_ALL" }),
|
|
521
|
+
expandToNode
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
export {
|
|
526
|
+
useVfsEngine,
|
|
527
|
+
useVfsTabs,
|
|
528
|
+
useVfsSelection,
|
|
529
|
+
useVfsExpanded
|
|
530
|
+
};
|
|
531
|
+
//# sourceMappingURL=chunk-POSVS4C7.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/hooks/useVfsEngine.ts","../src/react/hooks/useVfsTabs.ts","../src/react/hooks/useVfsSelection.ts","../src/react/hooks/useVfsExpanded.ts"],"sourcesContent":["import { useCallback, useContext, useSyncExternalStore } from \"react\";\nimport { useVfsWorkspace, VfsContext } from \"../context/VfsContext\";\nimport { VfsCommand } from \"../../core/VfsEngine\";\nimport { VfsNode, VfsFileNode, VfsFolderNode, VfsFileSnapshot } from \"../../core/VfsNode\";\n\n// ── Return types ───────────────────────────────────────────────────────────\n\nexport interface VfsFsApi<TMeta = Record<string, unknown>> {\n execute: (command: VfsCommand) => Promise<void>;\n\n createFile: (parentId: string | null, name: string, opts?: { mimeType?: string; meta?: TMeta }) => Promise<void>;\n createFolder: (parentId: string | null, name: string, opts?: { meta?: TMeta }) => Promise<void>;\n rename: (id: string, newName: string) => Promise<void>;\n delete: (ids: string | string[], permanent?: boolean) => Promise<void>;\n restore: (ids: string | string[]) => Promise<void>;\n purge: (ids: string | string[]) => Promise<void>;\n move: (ids: string | string[], newParentId: string | null) => Promise<void>;\n write: (id: string, content: Uint8Array) => Promise<void>;\n lock: (ids: string | string[]) => Promise<void>;\n unlock: (ids: string | string[]) => Promise<void>;\n reorder: (parentId: string | null, orderedIds: string[]) => Promise<void>;\n snapshot: (fileId: string, label?: string) => Promise<void>;\n}\n\nexport interface VfsTreeApi<TMeta = Record<string, unknown>> {\n getNode: (id: string) => Promise<VfsNode<TMeta> | null>;\n getChildren: (parentId: string | null, opts?: { includeTrashed?: boolean }) => Promise<VfsNode<TMeta>[]>;\n getPath: (id: string) => Promise<string>;\n readFile: (id: string) => Promise<Uint8Array>;\n readJSON: <T>(id: string) => Promise<T>;\n writeJSON: <T>(id: string, data: T) => Promise<void>;\n search: (query: string, opts?: { scope?: string | null; kind?: \"file\" | \"folder\"; includeTrashed?: boolean }) => Promise<VfsNode<TMeta>[]>;\n getTrashed: () => Promise<VfsNode<TMeta>[]>;\n getSnapshots: (fileId: string) => Promise<VfsFileSnapshot[]>;\n}\n\nexport interface VfsStatusApi {\n pending: boolean;\n error: Error | null;\n version: number;\n}\n\nexport interface UseVfsEngineReturn<TMeta = Record<string, unknown>> {\n fs: VfsFsApi<TMeta>;\n tree: VfsTreeApi<TMeta>;\n status: VfsStatusApi;\n}\n\n// ── Hook ───────────────────────────────────────────────────────────────────\nexport function useVfsEngine<TMeta extends Record<string, unknown> | undefined = Record<string, unknown>>(\n workspaceId?: string\n): UseVfsEngineReturn<TMeta> {\n const ctx = useContext(VfsContext);\n const id = workspaceId ?? ctx?.activeWorkspaceId;\n const engine = ctx?.workspaces.get(id)?.engine;\n\n const subscribe = useCallback((cb: () => void) => engine.subscribe(cb), [engine]);\n const getVersion = useCallback(() => engine.version, [engine]);\n const getPending = useCallback(() => engine.pending, [engine]);\n const getError = useCallback(() => engine.lastError, [engine]);\n\n const version = useSyncExternalStore(subscribe, getVersion);\n const pending = useSyncExternalStore(subscribe, getPending);\n const error = useSyncExternalStore(subscribe, getError);\n\n // ── fs API ─────────────────────────────────────────────────────────────\n\n const fs = useCallback((): VfsFsApi<TMeta> => {\n const toArray = (ids: string | string[]) =>\n Array.isArray(ids) ? ids : [ids];\n\n return {\n execute: (command) => engine.execute(command),\n\n createFile: (parentId, name, opts) =>\n engine.execute({ op: \"create\", kind: \"file\", parentId, name, ...opts }),\n\n createFolder: (parentId, name, opts) =>\n engine.execute({ op: \"create\", kind: \"folder\", parentId, name, ...opts }),\n\n rename: (id, newName) =>\n engine.execute({ op: \"rename\", id, newName }),\n\n delete: (ids, permanent) =>\n engine.execute({ op: \"delete\", ids: toArray(ids), permanent }),\n\n restore: (ids) =>\n engine.execute({ op: \"restore\", ids: toArray(ids) }),\n\n purge: (ids) =>\n engine.execute({ op: \"purge\", ids: toArray(ids) }),\n\n move: (ids, newParentId) =>\n engine.execute({ op: \"move\", ids: toArray(ids), newParentId }),\n\n write: (id, content) =>\n engine.execute({ op: \"write\", id, content }),\n\n lock: (ids) =>\n engine.execute({ op: \"lock\", ids: toArray(ids) }),\n\n unlock: (ids) =>\n engine.execute({ op: \"unlock\", ids: toArray(ids) }),\n\n reorder: (parentId, orderedIds) =>\n engine.execute({ op: \"reorder\", parentId, orderedIds }),\n\n snapshot: (fileId, label) =>\n engine.execute({ op: \"snapshot\", fileId, label }),\n };\n }, [engine])();\n\n const tree = useCallback((): VfsTreeApi<TMeta> => ({\n getNode: (id) => engine.getNode(id),\n getChildren: (parentId, opts) => engine.getChildren(parentId, opts),\n getPath: (id) => engine.getPath(id),\n readFile: (id) => engine.readFile(id),\n\n readJSON: async <T>(id: string): Promise<T> => {\n const bytes = await engine.readFile(id);\n return JSON.parse(new TextDecoder().decode(bytes)) as T;\n },\n\n writeJSON: async <T>(id: string, data: T): Promise<void> => {\n const bytes = new TextEncoder().encode(JSON.stringify(data, null, 2));\n await engine.execute({ op: \"write\", id, content: bytes });\n },\n\n search: (query, opts) => engine.search(query, opts),\n getTrashed: () => engine.getTrashed(),\n getSnapshots: (fileId) => engine.getSnapshots(fileId),\n }), [engine])();\n\n return { fs, tree, status: { pending, error, version } };\n}","import { useCallback, useEffect, useMemo, useReducer, useRef } from \"react\";\nimport { useVfsContext, useVfsWorkspace } from \"../context/VfsContext\";\n\nexport interface VfsTab {\n id: string;\n nodeId: string;\n workspaceId: string;\n title: string;\n isDirty: boolean;\n isLocked: boolean;\n savedContent: Uint8Array | null;\n currentContent: Uint8Array | null;\n lastSavedAt: number | null;\n}\n\nexport type DirtyChecker = (params: {\n nodeId: string;\n savedContent: Uint8Array | null;\n currentContent: Uint8Array | null;\n lastSavedAt: number | null;\n}) => boolean;\n\nexport interface UseVfsTabsOptions {\n workspaceIds?: string[];\n dirtyChecker?: DirtyChecker;\n}\n\nexport interface VfsTabsApi {\n tabs: VfsTab[];\n activeTabId: string | null;\n activeTab: VfsTab | null;\n\n open: (nodeId: string, workspaceId: string) => Promise<void>;\n close: (tabId: string) => void;\n closeOthers: (tabId: string) => void;\n closeAll: (workspaceId?: string) => void;\n setActive: (tabId: string) => void;\n reorder: (activeId: string, overId: string) => void;\n lock: (tabId: string) => void;\n unlock: (tabId: string) => void;\n markDirty: (tabId: string, currentContent: Uint8Array) => void;\n markSaved: (tabId: string) => void;\n}\n\ninterface TabState {\n tabs: VfsTab[];\n activeTabId: string | null;\n}\n\ntype TabAction =\n | { type: \"OPEN\"; tab: VfsTab }\n | { type: \"CLOSE\"; tabId: string }\n | { type: \"CLOSE_OTHERS\"; tabId: string }\n | { type: \"CLOSE_ALL\"; workspaceId?: string }\n | { type: \"SET_ACTIVE\"; tabId: string }\n | { type: \"REORDER\"; activeId: string; overId: string }\n | { type: \"LOCK\"; tabId: string }\n | { type: \"UNLOCK\"; tabId: string }\n | { type: \"MARK_DIRTY\"; tabId: string; currentContent: Uint8Array }\n | { type: \"MARK_SAVED\"; tabId: string }\n | { type: \"RENAME\"; nodeId: string; newTitle: string }\n | { type: \"REMOVE_NODE\"; nodeId: string }\n | { type: \"HYDRATE\"; tabs: VfsTab[]; activeTabId: string | null };\n\nconst defaultDirtyChecker: DirtyChecker = ({\n savedContent,\n currentContent,\n}) => {\n if (!savedContent && !currentContent) return false;\n if (!savedContent || !currentContent) return true;\n if (savedContent.byteLength !== currentContent.byteLength) return true;\n for (let i = 0; i < savedContent.byteLength; i++) {\n if (savedContent[i] !== currentContent[i]) return true;\n }\n return false;\n};\n\nfunction tabReducer(state: TabState, action: TabAction): TabState {\n switch (action.type) {\n case \"OPEN\": {\n const existing = state.tabs.find(\n t => t.nodeId === action.tab.nodeId &&\n t.workspaceId === action.tab.workspaceId\n );\n if (existing) return { ...state, activeTabId: existing.id };\n return {\n tabs: [...state.tabs, action.tab],\n activeTabId: action.tab.id,\n };\n }\n\n case \"CLOSE\": {\n const tab = state.tabs.find(t => t.id === action.tabId);\n if (tab?.isLocked) return state;\n const filtered = state.tabs.filter(t => t.id !== action.tabId);\n const nextActive = state.activeTabId === action.tabId\n ? filtered[filtered.length - 1]?.id ?? null\n : state.activeTabId;\n return { tabs: filtered, activeTabId: nextActive };\n }\n\n case \"CLOSE_OTHERS\": {\n const keep = state.tabs.filter(\n t => t.id === action.tabId || t.isLocked\n );\n return { tabs: keep, activeTabId: action.tabId };\n }\n\n case \"CLOSE_ALL\": {\n const keep = state.tabs.filter(\n t => t.isLocked ||\n (action.workspaceId ? t.workspaceId !== action.workspaceId : false)\n );\n const activeStillExists = keep.find(t => t.id === state.activeTabId);\n return {\n tabs: keep,\n activeTabId: activeStillExists\n ? state.activeTabId\n : keep[keep.length - 1]?.id ?? null,\n };\n }\n\n case \"SET_ACTIVE\":\n return { ...state, activeTabId: action.tabId };\n\n case \"REORDER\": {\n const from = state.tabs.findIndex(t => t.id === action.activeId);\n const to = state.tabs.findIndex(t => t.id === action.overId);\n if (from === -1 || to === -1) return state;\n const reordered = [...state.tabs];\n const [moved] = reordered.splice(from, 1);\n reordered.splice(to, 0, moved);\n return { ...state, tabs: reordered };\n }\n\n case \"LOCK\":\n return {\n ...state,\n tabs: state.tabs.map(t =>\n t.id === action.tabId ? { ...t, isLocked: true } : t\n ),\n };\n\n case \"UNLOCK\":\n return {\n ...state,\n tabs: state.tabs.map(t =>\n t.id === action.tabId ? { ...t, isLocked: false } : t\n ),\n };\n\n case \"MARK_DIRTY\":\n return {\n ...state,\n tabs: state.tabs.map(t =>\n t.id === action.tabId\n ? { ...t, currentContent: action.currentContent, isDirty: true }\n : t\n ),\n };\n\n case \"MARK_SAVED\":\n return {\n ...state,\n tabs: state.tabs.map(t =>\n t.id === action.tabId\n ? {\n ...t,\n isDirty: false,\n savedContent: t.currentContent,\n lastSavedAt: Date.now(),\n }\n : t\n ),\n };\n\n case \"RENAME\":\n return {\n ...state,\n tabs: state.tabs.map(t =>\n t.nodeId === action.nodeId ? { ...t, title: action.newTitle } : t\n ),\n };\n\n case \"REMOVE_NODE\": {\n const filtered = state.tabs.filter(t => t.nodeId !== action.nodeId);\n const nextActive = state.tabs.find(t => t.nodeId === action.nodeId)?.id === state.activeTabId\n ? filtered[filtered.length - 1]?.id ?? null\n : state.activeTabId;\n return { tabs: filtered, activeTabId: nextActive };\n }\n\n case \"HYDRATE\":\n return { tabs: action.tabs, activeTabId: action.activeTabId };\n\n default:\n return state;\n }\n}\n\n// ── Persistence helpers ────────────────────────────────────────────────────\n\nconst SESSION_KEY = (workspaceId: string) => `vfs-tabs:${workspaceId}`;\n\ninterface PersistedTabState {\n tabs: Pick<VfsTab, \"id\" | \"nodeId\" | \"workspaceId\" | \"title\" | \"isLocked\">[];\n activeTabId: string | null;\n}\n\nfunction saveToSession(workspaceId: string, state: TabState): void {\n const payload: PersistedTabState = {\n tabs: state.tabs\n .filter(t => t.workspaceId === workspaceId)\n .map(({ id, nodeId, workspaceId, title, isLocked }) =>\n ({ id, nodeId, workspaceId, title, isLocked })\n ),\n activeTabId: state.activeTabId,\n };\n try {\n sessionStorage.setItem(SESSION_KEY(workspaceId), JSON.stringify(payload));\n } catch { /* sessionStorage unavailable */ }\n}\n\nfunction loadFromSession(workspaceId: string): PersistedTabState | null {\n try {\n const raw = sessionStorage.getItem(SESSION_KEY(workspaceId));\n return raw ? JSON.parse(raw) : null;\n } catch { return null; }\n}\n\nexport function useVfsTabs(options: UseVfsTabsOptions = {}): VfsTabsApi {\n const ctx = useVfsContext();\n const { dirtyChecker = defaultDirtyChecker, workspaceIds } = options;\n \n const resolvedIds = useMemo(\n () => workspaceIds ?? [ctx.activeWorkspaceId],\n [workspaceIds?.join(\",\"), ctx.activeWorkspaceId]\n );\n\n const [state, dispatch] = useReducer(tabReducer, {\n tabs: [],\n activeTabId: null,\n });\n\n useEffect(() => {\n if (ctx.tabPersistence.strategy === \"none\") return;\n\n const allTabs: VfsTab[] = [];\n let activeId: string | null = null;\n\n for (const wsId of resolvedIds) {\n const workspace = ctx.workspaces.get(wsId);\n if (!workspace) continue;\n\n const persisted = loadFromSession(wsId);\n if (!persisted) continue;\n\n for (const t of persisted.tabs) {\n allTabs.push({\n ...t,\n isDirty: false,\n savedContent: null,\n currentContent: null,\n lastSavedAt: null,\n });\n }\n if (persisted.activeTabId) activeId = persisted.activeTabId;\n }\n\n if (allTabs.length > 0) {\n dispatch({ type: \"HYDRATE\", tabs: allTabs, activeTabId: activeId });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n if (ctx.tabPersistence.strategy === \"none\") return;\n for (const wsId of resolvedIds) {\n saveToSession(wsId, state);\n }\n }, [state, ctx.tabPersistence.strategy, resolvedIds]);\n\n const stateRef = useRef(state);\n useEffect(() => { stateRef.current = state; }, [state]);\n useEffect(() => {\n const unsubs: (() => void)[] = [];\n\n for (const wsId of resolvedIds) {\n const workspace = ctx.workspaces.get(wsId);\n if (!workspace) continue;\n const { engine } = workspace;\n\n unsubs.push(engine.on(\"renamed\", (node) => {\n dispatch({ type: \"RENAME\", nodeId: node.id, newTitle: node.name });\n }));\n\n unsubs.push(engine.on(\"deleted\", ({ ids }) => {\n for (const id of ids) dispatch({ type: \"REMOVE_NODE\", nodeId: id });\n }));\n\n unsubs.push(engine.on(\"change\", () => {\n if (ctx.tabPersistence.strategy !== \"none\") {\n saveToSession(wsId, stateRef.current);\n }\n }));\n }\n\n return () => unsubs.forEach(u => u());\n }, [resolvedIds, ctx.workspaces, ctx.tabPersistence.strategy]);\n\n const open = useCallback(async (nodeId: string, workspaceId: string) => {\n const workspace = ctx.workspaces.get(workspaceId);\n if (!workspace) throw new Error(`Workspace \"${workspaceId}\" not found`);\n\n const node = await workspace.engine.getNode(nodeId);\n if (!node) throw new Error(`Node \"${nodeId}\" not found`);\n\n const content = node.kind === \"file\"\n ? await workspace.engine.readFile(nodeId)\n : null;\n\n const tab: VfsTab = {\n id: crypto.randomUUID(),\n nodeId,\n workspaceId,\n title: node.name,\n isDirty: false,\n isLocked: false,\n savedContent: content,\n currentContent: content,\n lastSavedAt: null,\n };\n\n dispatch({ type: \"OPEN\", tab });\n }, [ctx.workspaces]);\n\n const close = useCallback((tabId: string) => {\n const tab = state.tabs.find(t => t.id === tabId);\n if (tab?.isLocked) {\n const workspace = ctx.workspaces.get(tab.workspaceId);\n workspace?.engine.emit(\"warning\", {\n code: \"LOCKED_TAB_CLOSE\",\n tabId,\n nodeId: tab.nodeId,\n });\n return;\n }\n dispatch({ type: \"CLOSE\", tabId });\n }, [state.tabs, ctx.workspaces]);\n\n const markDirty = useCallback((tabId: string, currentContent: Uint8Array) => {\n const tab = state.tabs.find(t => t.id === tabId);\n if (!tab) return;\n const isDirty = dirtyChecker({\n nodeId: tab.nodeId,\n savedContent: tab.savedContent,\n currentContent,\n lastSavedAt: tab.lastSavedAt,\n });\n if (isDirty) dispatch({ type: \"MARK_DIRTY\", tabId, currentContent });\n }, [state.tabs, dirtyChecker]);\n\n const activeTab = state.tabs.find(t => t.id === state.activeTabId) ?? null;\n\n return {\n tabs: state.tabs,\n activeTabId: state.activeTabId,\n activeTab,\n\n open,\n close,\n closeOthers: (tabId) => dispatch({ type: \"CLOSE_OTHERS\", tabId }),\n closeAll: (workspaceId) => dispatch({ type: \"CLOSE_ALL\", workspaceId }),\n setActive: (tabId) => dispatch({ type: \"SET_ACTIVE\", tabId }),\n reorder: (a, o) => dispatch({ type: \"REORDER\", activeId: a, overId: o }),\n lock: (tabId) => dispatch({ type: \"LOCK\", tabId }),\n unlock: (tabId) => dispatch({ type: \"UNLOCK\", tabId }),\n markDirty,\n markSaved: (tabId) => dispatch({ type: \"MARK_SAVED\", tabId }),\n };\n}","import { useCallback, useReducer } from \"react\";\n\nexport interface UseVfsSelectionOptions {\n multiSelect?: boolean; \n rangeSelect?: boolean;\n}\n\nexport interface VfsSelectionApi {\n selection: string[];\n lastSelectedId: string | null;\n isSelected: (id: string) => boolean;\n\n select: (id: string) => void;\n toggle: (id: string) => void;\n selectRange: (ids: string[], anchorId: string, targetId: string) => void;\n deselect: (id: string) => void;\n deselectAll: () => void;\n selectAll: (ids: string[]) => void;\n}\n\ninterface SelectionState {\n selection: string[];\n lastSelectedId: string | null;\n}\n\ntype SelectionAction =\n | { type: \"SELECT\"; id: string }\n | { type: \"TOGGLE\"; id: string }\n | { type: \"SELECT_RANGE\"; ids: string[] }\n | { type: \"DESELECT\"; id: string }\n | { type: \"DESELECT_ALL\" }\n | { type: \"SELECT_ALL\"; ids: string[] };\n\nfunction selectionReducer(\n state: SelectionState,\n action: SelectionAction\n): SelectionState {\n switch (action.type) {\n case \"SELECT\":\n return {\n selection: [action.id],\n lastSelectedId: action.id,\n };\n\n case \"TOGGLE\": {\n const isSelected = state.selection.includes(action.id);\n return {\n selection: isSelected\n ? state.selection.filter(id => id !== action.id)\n : [...state.selection, action.id],\n lastSelectedId: action.id,\n };\n }\n\n case \"SELECT_RANGE\":\n return {\n selection: Array.from(new Set([...state.selection, ...action.ids])),\n lastSelectedId: action.ids[action.ids.length - 1] ?? state.lastSelectedId,\n };\n\n case \"DESELECT\":\n return {\n ...state,\n selection: state.selection.filter(id => id !== action.id),\n };\n\n case \"DESELECT_ALL\":\n return { selection: [], lastSelectedId: null };\n\n case \"SELECT_ALL\":\n return {\n selection: action.ids,\n lastSelectedId: action.ids[action.ids.length - 1] ?? null,\n };\n\n default:\n return state;\n }\n}\n\nfunction resolveRange(\n orderedIds: string[],\n anchorId: string,\n targetId: string\n): string[] {\n const anchorIdx = orderedIds.indexOf(anchorId);\n const targetIdx = orderedIds.indexOf(targetId);\n if (anchorIdx === -1 || targetIdx === -1) return [targetId];\n const [from, to] = anchorIdx < targetIdx\n ? [anchorIdx, targetIdx]\n : [targetIdx, anchorIdx];\n return orderedIds.slice(from, to + 1);\n}\n\n// ── Hook ───────────────────────────────────────────────────────────────────\n\nexport function useVfsSelection(\n options: UseVfsSelectionOptions = {}\n): VfsSelectionApi {\n const {\n multiSelect = true,\n rangeSelect = true,\n } = options;\n\n const [state, dispatch] = useReducer(selectionReducer, {\n selection: [],\n lastSelectedId: null,\n });\n\n const select = useCallback((id: string) => {\n dispatch({ type: \"SELECT\", id });\n }, []);\n\n const toggle = useCallback((id: string) => {\n if (!multiSelect) {\n dispatch({ type: \"SELECT\", id });\n return;\n }\n dispatch({ type: \"TOGGLE\", id });\n }, [multiSelect]);\n\n const selectRange = useCallback((\n orderedIds: string[],\n anchorId: string,\n targetId: string,\n ) => {\n if (!rangeSelect) {\n dispatch({ type: \"SELECT\", id: targetId });\n return;\n }\n const range = resolveRange(orderedIds, anchorId, targetId);\n dispatch({ type: \"SELECT_RANGE\", ids: range });\n }, [rangeSelect]);\n\n const deselect = useCallback((id: string) => dispatch({ type: \"DESELECT\", id }), []);\n const deselectAll = useCallback(() => dispatch({ type: \"DESELECT_ALL\" }), []);\n const selectAll = useCallback((ids: string[]) => dispatch({ type: \"SELECT_ALL\", ids }), []);\n\n const isSelected = useCallback((id: string) =>\n state.selection.includes(id),\n [state.selection]);\n\n return {\n selection: state.selection,\n lastSelectedId: state.lastSelectedId,\n isSelected,\n select,\n toggle,\n selectRange,\n deselect,\n deselectAll,\n selectAll,\n };\n}","import { useCallback, useEffect, useMemo, useReducer } from \"react\";\nimport { useVfsContext } from \"../context/VfsContext\";\n\nexport interface UseVfsExpandedOptions {\n workspaceIds?: string[];\n defaultExpanded?: string[];\n persistKey?: string;\n}\n\nexport interface VfsExpandedApi {\n expandedIds: Set<string>;\n isExpanded: (id: string) => boolean;\n\n expand: (id: string) => void;\n collapse: (id: string) => void;\n toggle: (id: string) => void;\n expandAll: (ids: string[]) => void;\n collapseAll: () => void;\n\n expandToNode: (id: string, workspaceId?: string) => Promise<void>;\n}\n\ntype ExpandedAction =\n | { type: \"EXPAND\"; id: string }\n | { type: \"COLLAPSE\"; id: string }\n | { type: \"TOGGLE\"; id: string }\n | { type: \"EXPAND_ALL\"; ids: string[] }\n | { type: \"COLLAPSE_ALL\" }\n | { type: \"HYDRATE\"; ids: string[] };\n\nfunction expandedReducer(\n state: Set<string>,\n action: ExpandedAction\n): Set<string> {\n switch (action.type) {\n case \"EXPAND\": {\n if (state.has(action.id)) return state;\n const next = new Set(state);\n next.add(action.id);\n return next;\n }\n\n case \"COLLAPSE\": {\n if (!state.has(action.id)) return state;\n const next = new Set(state);\n next.delete(action.id);\n return next;\n }\n\n case \"TOGGLE\": {\n const next = new Set(state);\n next.has(action.id) ? next.delete(action.id) : next.add(action.id);\n return next;\n }\n\n case \"EXPAND_ALL\": {\n const next = new Set(state);\n for (const id of action.ids) next.add(id);\n return next;\n }\n\n case \"COLLAPSE_ALL\":\n return new Set();\n\n case \"HYDRATE\":\n return new Set(action.ids);\n\n default:\n return state;\n }\n}\n\nconst PERSIST_KEY = (key: string) => `vfs-expanded:${key}`;\n\nfunction saveExpanded(key: string, ids: Set<string>): void {\n try {\n sessionStorage.setItem(PERSIST_KEY(key), JSON.stringify([...ids]));\n } catch { /* sessionStorage unavailable */ }\n}\n\nfunction loadExpanded(key: string): string[] | null {\n try {\n const raw = sessionStorage.getItem(PERSIST_KEY(key));\n return raw ? JSON.parse(raw) : null;\n } catch { return null; }\n}\n\nexport function useVfsExpanded(\n options: UseVfsExpandedOptions = {}\n): VfsExpandedApi {\n const {\n workspaceIds,\n defaultExpanded = [],\n persistKey,\n } = options;\n\n const ctx = useVfsContext();\n const resolvedIds = useMemo(\n () => workspaceIds ?? [ctx.activeWorkspaceId],\n [workspaceIds?.join(\",\"), ctx.activeWorkspaceId]\n );\n\n const [expandedIds, dispatch] = useReducer(\n expandedReducer,\n undefined,\n () => {\n if (persistKey) {\n const persisted = loadExpanded(persistKey);\n if (persisted) return new Set(persisted);\n }\n return new Set<string>(defaultExpanded);\n }\n );\n\n useEffect(() => {\n if (!persistKey) return;\n saveExpanded(persistKey, expandedIds);\n }, [expandedIds, persistKey]);\n\n useEffect(() => {\n const unsubs: (() => void)[] = [];\n\n for (const wsId of resolvedIds) {\n const workspace = ctx.workspaces.get(wsId);\n if (!workspace) continue;\n\n unsubs.push(workspace.engine.on(\"deleted\", ({ ids }) => {\n for (const id of ids) {\n dispatch({ type: \"COLLAPSE\", id });\n }\n }));\n }\n\n return () => unsubs.forEach(u => u());\n }, [resolvedIds, ctx.workspaces]);\n\n const expandToNode = useCallback(async (\n nodeId: string,\n workspaceId?: string,\n ): Promise<void> => {\n const wsId = workspaceId ?? ctx.activeWorkspaceId;\n const workspace = ctx.workspaces.get(wsId);\n if (!workspace) return;\n\n const { engine } = workspace;\n const ancestorIds: string[] = [];\n\n let current = await engine.getNode(nodeId);\n while (current?.parentId) {\n ancestorIds.push(current.parentId);\n current = await engine.getNode(current.parentId);\n }\n\n dispatch({ type: \"EXPAND_ALL\", ids: ancestorIds });\n }, [ctx.workspaces, ctx.activeWorkspaceId]);\n\n const isExpanded = useCallback(\n (id: string) => expandedIds.has(id),\n [expandedIds]\n );\n\n return {\n expandedIds,\n isExpanded,\n expand: (id) => dispatch({ type: \"EXPAND\", id }),\n collapse: (id) => dispatch({ type: \"COLLAPSE\", id }),\n toggle: (id) => dispatch({ type: \"TOGGLE\", id }),\n expandAll: (ids) => dispatch({ type: \"EXPAND_ALL\", ids }),\n collapseAll: () => dispatch({ type: \"COLLAPSE_ALL\" }),\n expandToNode,\n };\n}"],"mapp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AI,UAAU,CAAC;AAEhC,QAAM,eAAeC,aAAY,CAC7B,QACA,gBACgB;AAChB,UAAM,OAAW,oCAAe,IAAI;AACpC,UAAM,YAAY,IAAI,WAAW,IAAI,IAAI;AACzC,QAAI,CAAC,UAAW;AAEhB,UAAM,EAAE,OAAO,IAAI;AACnB,UAAM,cAAwB,CAAC;AAE/B,QAAI,UAAU,MAAM,OAAO,QAAQ,MAAM;AACzC,WAAO,mCAAS,UAAU;AACtB,kBAAY,KAAK,QAAQ,QAAQ;AACjC,gBAAU,MAAM,OAAO,QAAQ,QAAQ,QAAQ;AAAA,IACnD;AAEA,aAAS,EAAE,MAAM,cAAc,KAAK,YAAY,CAAC;AAAA,EACrD,IAAG,CAAC,IAAI,YAAY,IAAI,iBAAiB,CAAC;AAE1C,QAAM,aAAaA;AAAA,IACf,CAAC,OAAe,YAAY,IAAI,EAAE;AAAA,IAClC,CAAC,WAAW;AAAA,EAChB;AAEA,SAAO;AAAA,IACH;AAAA,IACA;AAAA,IACA,QAAa,CAAC,OAAS,SAAS,EAAE,MAAM,UAAe,GAAG,CAAC;AAAA,IAC3D,UAAa,CAAC,OAAS,SAAS,EAAE,MAAM,YAAe,GAAG,CAAC;AAAA,IAC3D,QAAa,CAAC,OAAS,SAAS,EAAE,MAAM,UAAe,GAAG,CAAC;AAAA,IAC3D,WAAa,CAAC,QAAS,SAAS,EAAE,MAAM,cAAe,IAAI,CAAC;AAAA,IAC5D,aAAa,MAAU,SAAS,EAAE,MAAM,eAAkB,CAAC;AAAA,IAC3D;AAAA,EACJ;AACJ;","names":["id","useCallback","workspaceId","useCallback","useCallback","useReducer","useReducer","useCallback","useCallback","useEffect","useMemo","useReducer","useMemo","useReducer","useEffect","useCallback"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
// src/core/VfsAdapter.ts
|
|
4
|
+
var VfsAdapter = class {
|
|
5
|
+
// ── History ───────────────────────────────────────────────────
|
|
6
|
+
getSnapshots(fileId) {
|
|
7
|
+
throw new Error(`Adapter does not support history. Check supportsHistory before calling.`);
|
|
8
|
+
}
|
|
9
|
+
saveSnapshot(fileId, content, label) {
|
|
10
|
+
throw new Error(`Adapter does not support history. Check supportsHistory before calling.`);
|
|
11
|
+
}
|
|
12
|
+
restoreSnapshot(fileId, index) {
|
|
13
|
+
throw new Error(`Adapter does not support history. Check supportsHistory before calling.`);
|
|
14
|
+
}
|
|
15
|
+
deleteSnapshot(fileId, index) {
|
|
16
|
+
throw new Error(`Adapter does not support history. Check supportsHistory before calling.`);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
exports.VfsAdapter = VfsAdapter;
|
|
23
|
+
//# sourceMappingURL=chunk-R3ROYAMW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/ben/Data/Projects/vfs/vfs-kit%20v2/dist/chunk-R3ROYAMW.js"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACA;AACA,IAAI,WAAW,EAAE,MAAM;AACvB;AACA,EAAE,YAAY,CAAC,MAAM,EAAE;AACvB,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,uEAAuE,CAAC,CAAC;AAC9F,EAAE;AACF,EAAE,YAAY,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE;AACvC,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,uEAAuE,CAAC,CAAC;AAC9F,EAAE;AACF,EAAE,eAAe,CAAC,MAAM,EAAE,KAAK,EAAE;AACjC,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,uEAAuE,CAAC,CAAC;AAC9F,EAAE;AACF,EAAE,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE;AAChC,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,uEAAuE,CAAC,CAAC;AAC9F,EAAE;AACF,CAAC;AACD;AACA;AACE;AACF,gCAAC","file":"/Users/ben/Data/Projects/vfs/vfs-kit v2/dist/chunk-R3ROYAMW.js","sourcesContent":[null]}
|