vzcode 0.4.0 → 0.6.0
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/README.md +47 -5
- package/dist/assets/index-41607816.js +89 -0
- package/dist/assets/index-8bac68c9.css +1 -0
- package/dist/index.html +16 -2
- package/package.json +29 -19
- package/src/{App.jsx → client/App.tsx} +83 -126
- package/src/client/Sidebar/DirectoryArrowSVG.jsx +5 -0
- package/src/client/Sidebar/DirectoryListing.tsx +76 -0
- package/src/client/Sidebar/FileListing.tsx +42 -0
- package/src/client/Sidebar/Item.jsx +43 -0
- package/src/client/Sidebar/Listing.tsx +44 -0
- package/src/client/Sidebar/index.tsx +80 -0
- package/src/client/Sidebar/styles.scss +84 -0
- package/src/client/Sidebar/useOpenDirectories.ts +37 -0
- package/src/{diff.js → client/diff.js} +1 -1
- package/src/client/featureFlags.js +3 -0
- package/src/client/getFileTree.ts +52 -0
- package/src/{getOrCreateEditor.js → client/getOrCreateEditor.js} +6 -6
- package/src/{json1PresenceDisplay.js → client/json1PresenceDisplay.js} +0 -1
- package/src/client/settings.jsx +97 -0
- package/src/client/sortFileTree.ts +19 -0
- package/src/client/style.scss +93 -0
- package/src/server/computeInitialDocument.js +69 -0
- package/src/server/featureFlags.js +4 -0
- package/{cli.js → src/server/index.js} +24 -30
- package/src/types.ts +57 -0
- package/dist/assets/index-48dbd5c3.js +0 -89
- package/dist/assets/index-8d2d4b3b.css +0 -1
- package/src/settings.jsx +0 -141
- package/src/style.css +0 -215
- /package/src/{CodeEditor.jsx → client/CodeEditor.jsx} +0 -0
- /package/src/{json1PresenceBroadcast.js → client/json1PresenceBroadcast.js} +0 -0
- /package/src/{main.jsx → client/main.jsx} +0 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// FileId
|
|
2
|
+
// * A unique ID for a file.
|
|
3
|
+
// * This is a random string.
|
|
4
|
+
export type FileId = string;
|
|
5
|
+
|
|
6
|
+
// Files
|
|
7
|
+
// * A collection of files.
|
|
8
|
+
// * Keys are _not_ file names or array indices,
|
|
9
|
+
// because based on past experience, that
|
|
10
|
+
// leads to very difficult frontend logic around
|
|
11
|
+
// OT in the case that a file is renamed or deleted.
|
|
12
|
+
// * When the file name changes, or files are added/deleted,
|
|
13
|
+
// this ID stays the same, simplifying things re:OT.
|
|
14
|
+
export interface Files {
|
|
15
|
+
[fileId: FileId]: File;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// File
|
|
19
|
+
// * A file with `name` and `text`.
|
|
20
|
+
export interface File {
|
|
21
|
+
// The file name.
|
|
22
|
+
// e.g. "index.html".
|
|
23
|
+
name: string;
|
|
24
|
+
|
|
25
|
+
// The text content of the file.
|
|
26
|
+
// e.g. "<body>Hello</body>"
|
|
27
|
+
text: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// FileTree
|
|
31
|
+
// * A tree of files.
|
|
32
|
+
// * Each node in the tree is either a directory or a file.
|
|
33
|
+
// * Each directory has a `children` array.
|
|
34
|
+
// * Each file has a `file` object.
|
|
35
|
+
// * Each file has a `fileId` string.
|
|
36
|
+
// * Each directory has a `name` string.
|
|
37
|
+
// * Each directory has a `path` string.
|
|
38
|
+
// * The `path` string is the path to the directory.
|
|
39
|
+
// e.g. "src/components".
|
|
40
|
+
// * The `path` string is the path to the file.
|
|
41
|
+
// e.g. "src/components/HelloWorld.js".
|
|
42
|
+
export interface FileTree {
|
|
43
|
+
name: string;
|
|
44
|
+
path?: string;
|
|
45
|
+
children?: Array<FileTree | FileTreeFile>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// FileTreeFile
|
|
49
|
+
// * A file in a file tree.
|
|
50
|
+
// * Each file has a `name` string.
|
|
51
|
+
// * Each file has a `file` object.
|
|
52
|
+
// * Each file has a `fileId` string.
|
|
53
|
+
export interface FileTreeFile {
|
|
54
|
+
name: string;
|
|
55
|
+
file: File;
|
|
56
|
+
fileId: FileId;
|
|
57
|
+
}
|