vfs-kit 1.0.1 → 1.0.3
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 +618 -35
- 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 +38 -3
- package/dist/index.js +528 -13
- 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 +59 -61
- package/dist/index.cjs +0 -43
- package/dist/index.d.cts +0 -7
- package/index.js +0 -7
- package/src/components/TreeView.tsx +0 -5
- package/src/components/index.ts +0 -1
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useVfs.ts +0 -3
- package/src/index.ts +0 -2
- package/tsconfig.json +0 -44
- package/tsup.config.ts +0 -10
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
interface VfsTab {
|
|
2
|
+
id: string;
|
|
3
|
+
nodeId: string;
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
title: string;
|
|
6
|
+
isDirty: boolean;
|
|
7
|
+
isLocked: boolean;
|
|
8
|
+
savedContent: Uint8Array | null;
|
|
9
|
+
currentContent: Uint8Array | null;
|
|
10
|
+
lastSavedAt: number | null;
|
|
11
|
+
}
|
|
12
|
+
type DirtyChecker = (params: {
|
|
13
|
+
nodeId: string;
|
|
14
|
+
savedContent: Uint8Array | null;
|
|
15
|
+
currentContent: Uint8Array | null;
|
|
16
|
+
lastSavedAt: number | null;
|
|
17
|
+
}) => boolean;
|
|
18
|
+
interface UseVfsTabsOptions {
|
|
19
|
+
workspaceIds?: string[];
|
|
20
|
+
dirtyChecker?: DirtyChecker;
|
|
21
|
+
}
|
|
22
|
+
interface VfsTabsApi {
|
|
23
|
+
tabs: VfsTab[];
|
|
24
|
+
activeTabId: string | null;
|
|
25
|
+
activeTab: VfsTab | null;
|
|
26
|
+
open: (nodeId: string, workspaceId: string) => Promise<void>;
|
|
27
|
+
close: (tabId: string) => void;
|
|
28
|
+
closeOthers: (tabId: string) => void;
|
|
29
|
+
closeAll: (workspaceId?: string) => void;
|
|
30
|
+
setActive: (tabId: string) => void;
|
|
31
|
+
reorder: (activeId: string, overId: string) => void;
|
|
32
|
+
lock: (tabId: string) => void;
|
|
33
|
+
unlock: (tabId: string) => void;
|
|
34
|
+
markDirty: (tabId: string, currentContent: Uint8Array) => void;
|
|
35
|
+
markSaved: (tabId: string) => void;
|
|
36
|
+
}
|
|
37
|
+
declare function useVfsTabs(options?: UseVfsTabsOptions): VfsTabsApi;
|
|
38
|
+
|
|
39
|
+
export { type DirtyChecker as D, type UseVfsTabsOptions as U, type VfsTabsApi as V, type VfsTab as a, useVfsTabs as u };
|
package/package.json
CHANGED
|
@@ -1,72 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vfs-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A headless-first Virtual File System for React. Complete with drag-and-drop hierarchy, tab management and pluggable storage adapters.",
|
|
5
|
-
"
|
|
6
|
-
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": ["dist"],
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./hooks": {
|
|
16
|
+
"types": "./dist/hooks/index.d.ts",
|
|
17
|
+
"import": "./dist/hooks/index.mjs",
|
|
18
|
+
"require": "./dist/hooks/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./adapters": {
|
|
21
|
+
"types": "./dist/adapters/index.d.ts",
|
|
22
|
+
"import": "./dist/adapters/index.mjs",
|
|
23
|
+
"require": "./dist/adapters/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./components": {
|
|
26
|
+
"types": "./dist/components/index.d.ts",
|
|
27
|
+
"import": "./dist/components/index.mjs",
|
|
28
|
+
"require": "./dist/components/index.js"
|
|
29
|
+
}
|
|
7
30
|
},
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup",
|
|
33
|
+
"dev": "tsup --watch",
|
|
34
|
+
"typecheck": "tsc --noEmit"
|
|
11
35
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@dnd-kit/core": ">=6.0.0",
|
|
38
|
+
"@dnd-kit/modifiers": ">=6.0.0",
|
|
39
|
+
"@dnd-kit/sortable": ">=7.0.0",
|
|
40
|
+
"@dnd-kit/utilities": ">=3.0.0",
|
|
41
|
+
"@tanstack/react-virtual": ">=3.0.0",
|
|
42
|
+
"react": ">=18.0.0",
|
|
43
|
+
"react-dom": ">=18.0.0"
|
|
16
44
|
},
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"vfs",
|
|
24
|
-
"file-explorer",
|
|
25
|
-
"file-manager",
|
|
26
|
-
"tree-view",
|
|
27
|
-
"drag-and-drop",
|
|
28
|
-
"dnd",
|
|
29
|
-
"tabs",
|
|
30
|
-
"state-management",
|
|
31
|
-
"headless",
|
|
32
|
-
"virtual-fs",
|
|
33
|
-
"history"
|
|
34
|
-
],
|
|
35
|
-
"type": "module",
|
|
36
|
-
"exports": "./dist/index.js",
|
|
37
|
-
"bin": {
|
|
38
|
-
"@vfs-kit": "./dist/index.js"
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"@dnd-kit/core": { "optional": true },
|
|
47
|
+
"@dnd-kit/modifiers": { "optional": true },
|
|
48
|
+
"@dnd-kit/sortable": { "optional": true },
|
|
49
|
+
"@dnd-kit/utilities": { "optional": true },
|
|
50
|
+
"@tanstack/react-virtual": { "optional": true }
|
|
39
51
|
},
|
|
40
52
|
"dependencies": {
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"execa": "^7.0.0",
|
|
44
|
-
"fs-extra": "^11.1.0",
|
|
45
|
-
"node-fetch": "^3.3.0",
|
|
46
|
-
"ora": "^6.1.2",
|
|
47
|
-
"prompts": "^2.4.2",
|
|
48
|
-
"zod": "^3.20.2"
|
|
53
|
+
"idb": "^8.0.3",
|
|
54
|
+
"nanoid": "^5.0.0"
|
|
49
55
|
},
|
|
50
56
|
"devDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"start:dev": "cross-env COMPONENTS_BASE_URL=http://localhost:3000 node dist/index.js",
|
|
64
|
-
"start": "node dist/index.js",
|
|
65
|
-
"format:write": "prettier --write \"**/*.{ts,tsx,mdx}\" --cache",
|
|
66
|
-
"format:check": "prettier --check \"**/*.{ts,tsx,mdx}\" --cache",
|
|
67
|
-
"release": "changeset version",
|
|
68
|
-
"pub:beta": "pnpm build && pnpm publish --no-git-checks --access public --tag beta",
|
|
69
|
-
"pub:next": "pnpm build && pnpm publish --no-git-checks --access public --tag next",
|
|
70
|
-
"pub:release": "pnpm build && pnpm publish --access public"
|
|
57
|
+
"@dnd-kit/core": "^6.3.1",
|
|
58
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
59
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
60
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
61
|
+
"@tanstack/react-virtual": "^3.13.21",
|
|
62
|
+
"@types/node": "^22.0.0",
|
|
63
|
+
"@types/react": "^19.2.14",
|
|
64
|
+
"@types/react-dom": "^19.0.0",
|
|
65
|
+
"react": "^19.0.0",
|
|
66
|
+
"react-dom": "^19.0.0",
|
|
67
|
+
"tsup": "^8.5.1",
|
|
68
|
+
"typescript": "^5.7.0"
|
|
71
69
|
}
|
|
72
|
-
}
|
|
70
|
+
}
|
package/dist/index.cjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
TreeView: () => TreeView,
|
|
24
|
-
useVfs: () => useVfs
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
|
|
28
|
-
// src/components/TreeView.tsx
|
|
29
|
-
var import_react = require("react");
|
|
30
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
|
-
function TreeView() {
|
|
32
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Placeholder TreeView" });
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// src/hooks/useVfs.ts
|
|
36
|
-
function useVfs() {
|
|
37
|
-
return {};
|
|
38
|
-
}
|
|
39
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 && (module.exports = {
|
|
41
|
-
TreeView,
|
|
42
|
-
useVfs
|
|
43
|
-
});
|
package/dist/index.d.cts
DELETED
package/index.js
DELETED
package/src/components/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./TreeView.js";
|
package/src/hooks/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useVfs.js";
|
package/src/hooks/useVfs.ts
DELETED
package/src/index.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Visit https://aka.ms/tsconfig to read more about this file
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
// File Layout
|
|
5
|
-
// "rootDir": "./src",
|
|
6
|
-
// "outDir": "./dist",
|
|
7
|
-
|
|
8
|
-
// Environment Settings
|
|
9
|
-
// See also https://aka.ms/tsconfig/module
|
|
10
|
-
"module": "nodenext",
|
|
11
|
-
"target": "esnext",
|
|
12
|
-
"types": [],
|
|
13
|
-
// For nodejs:
|
|
14
|
-
// "lib": ["esnext"],
|
|
15
|
-
// "types": ["node"],
|
|
16
|
-
// and npm install -D @types/node
|
|
17
|
-
|
|
18
|
-
// Other Outputs
|
|
19
|
-
"sourceMap": true,
|
|
20
|
-
"declaration": true,
|
|
21
|
-
"declarationMap": true,
|
|
22
|
-
|
|
23
|
-
// Stricter Typechecking Options
|
|
24
|
-
"noUncheckedIndexedAccess": true,
|
|
25
|
-
"exactOptionalPropertyTypes": true,
|
|
26
|
-
|
|
27
|
-
// Style Options
|
|
28
|
-
// "noImplicitReturns": true,
|
|
29
|
-
// "noImplicitOverride": true,
|
|
30
|
-
// "noUnusedLocals": true,
|
|
31
|
-
// "noUnusedParameters": true,
|
|
32
|
-
// "noFallthroughCasesInSwitch": true,
|
|
33
|
-
// "noPropertyAccessFromIndexSignature": true,
|
|
34
|
-
|
|
35
|
-
// Recommended Options
|
|
36
|
-
"strict": true,
|
|
37
|
-
"jsx": "react-jsx",
|
|
38
|
-
"verbatimModuleSyntax": true,
|
|
39
|
-
"isolatedModules": true,
|
|
40
|
-
"noUncheckedSideEffectImports": true,
|
|
41
|
-
"moduleDetection": "force",
|
|
42
|
-
"skipLibCheck": true,
|
|
43
|
-
}
|
|
44
|
-
}
|