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.
Files changed (61) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +618 -35
  3. package/dist/VfsAdapter-BWjniD9Y.d.mts +57 -0
  4. package/dist/VfsAdapter-DOBt_TyL.d.ts +57 -0
  5. package/dist/VfsEngine-B6nhgyjQ.d.mts +152 -0
  6. package/dist/VfsEngine-DLx0iUpi.d.ts +152 -0
  7. package/dist/VfsNode-D10gxL5W.d.mts +48 -0
  8. package/dist/VfsNode-D10gxL5W.d.ts +48 -0
  9. package/dist/adapters/index.d.mts +201 -0
  10. package/dist/adapters/index.d.ts +201 -0
  11. package/dist/adapters/index.js +1159 -0
  12. package/dist/adapters/index.js.map +1 -0
  13. package/dist/adapters/index.mjs +1159 -0
  14. package/dist/adapters/index.mjs.map +1 -0
  15. package/dist/chunk-2FEJBM4N.js +60 -0
  16. package/dist/chunk-2FEJBM4N.js.map +1 -0
  17. package/dist/chunk-7OQI6PNM.mjs +60 -0
  18. package/dist/chunk-7OQI6PNM.mjs.map +1 -0
  19. package/dist/chunk-ALWOZGZI.mjs +23 -0
  20. package/dist/chunk-ALWOZGZI.mjs.map +1 -0
  21. package/dist/chunk-POSVS4C7.mjs +531 -0
  22. package/dist/chunk-POSVS4C7.mjs.map +1 -0
  23. package/dist/chunk-R3ROYAMW.js +23 -0
  24. package/dist/chunk-R3ROYAMW.js.map +1 -0
  25. package/dist/chunk-SWRBVSS6.mjs +16 -0
  26. package/dist/chunk-SWRBVSS6.mjs.map +1 -0
  27. package/dist/chunk-U2CKTXY7.js +16 -0
  28. package/dist/chunk-U2CKTXY7.js.map +1 -0
  29. package/dist/chunk-WZVVI3HX.js +531 -0
  30. package/dist/chunk-WZVVI3HX.js.map +1 -0
  31. package/dist/components/index.d.mts +193 -0
  32. package/dist/components/index.d.ts +193 -0
  33. package/dist/components/index.js +1197 -0
  34. package/dist/components/index.js.map +1 -0
  35. package/dist/components/index.mjs +1197 -0
  36. package/dist/components/index.mjs.map +1 -0
  37. package/dist/hooks/index.d.mts +120 -0
  38. package/dist/hooks/index.d.ts +120 -0
  39. package/dist/hooks/index.js +51 -0
  40. package/dist/hooks/index.js.map +1 -0
  41. package/dist/hooks/index.mjs +51 -0
  42. package/dist/hooks/index.mjs.map +1 -0
  43. package/dist/index.d.mts +42 -0
  44. package/dist/index.d.ts +38 -3
  45. package/dist/index.js +528 -13
  46. package/dist/index.js.map +1 -0
  47. package/dist/index.mjs +530 -0
  48. package/dist/index.mjs.map +1 -0
  49. package/dist/useVfsTabs-ZHDaLrM1.d.mts +39 -0
  50. package/dist/useVfsTabs-ZHDaLrM1.d.ts +39 -0
  51. package/package.json +59 -61
  52. package/dist/index.cjs +0 -43
  53. package/dist/index.d.cts +0 -7
  54. package/index.js +0 -7
  55. package/src/components/TreeView.tsx +0 -5
  56. package/src/components/index.ts +0 -1
  57. package/src/hooks/index.ts +0 -1
  58. package/src/hooks/useVfs.ts +0 -3
  59. package/src/index.ts +0 -2
  60. package/tsconfig.json +0 -44
  61. 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.1",
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
- "publishConfig": {
6
- "access": "public"
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
- "license": "MIT",
9
- "author": {
10
- "name": "Benjamin Gruber"
31
+ "scripts": {
32
+ "build": "tsup",
33
+ "dev": "tsup --watch",
34
+ "typecheck": "tsc --noEmit"
11
35
  },
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/bengru07/vfs-kit.git",
15
- "directory": "packages/cli"
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
- "keywords": [
18
- "react",
19
- "typescript",
20
- "tailwind",
21
- "shadcn",
22
- "file-system",
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
- "chalk": "5.2.0",
42
- "commander": "^10.0.0",
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
- "@types/fs-extra": "^11.0.1",
52
- "@types/prompts": "^2.4.2",
53
- "rimraf": "^4.1.3",
54
- "tsup": "^6.6.3",
55
- "type-fest": "^3.6.1",
56
- "typescript": "^4.9.5"
57
- },
58
- "scripts": {
59
- "dev": "tsup --watch",
60
- "build": "tsup",
61
- "typecheck": "tsc --noEmit",
62
- "clean": "rimraf dist && rimraf components",
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
@@ -1,7 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
-
3
- declare function TreeView(): react_jsx_runtime.JSX.Element;
4
-
5
- declare function useVfs(): {};
6
-
7
- export { TreeView, useVfs };
package/index.js DELETED
@@ -1,7 +0,0 @@
1
- function test(a, b) {
2
- console.log("Hello, world!");
3
-
4
- return a * b;
5
- }
6
-
7
- module.exports = test;
@@ -1,5 +0,0 @@
1
- import React from "react";
2
-
3
- export function TreeView() {
4
- return <div>Placeholder TreeView</div>;
5
- }
@@ -1 +0,0 @@
1
- export * from "./TreeView.js";
@@ -1 +0,0 @@
1
- export * from "./useVfs.js";
@@ -1,3 +0,0 @@
1
- export function useVfs() {
2
- return {};
3
- }
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./components/index.js";
2
- export * from "./hooks/index.js";
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
- }
package/tsup.config.ts DELETED
@@ -1,10 +0,0 @@
1
- import { defineConfig } from "tsup"
2
-
3
- export default defineConfig({
4
- format: ["cjs", "esm"],
5
- entry: ["./src/index.ts"],
6
- dts: true,
7
- shims: true,
8
- skipNodeModulesBundle: true,
9
- clean: true
10
- })