vzcode 0.26.0 → 0.27.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.
Files changed (48) hide show
  1. package/dist/assets/index-5f9f376e.css +1 -0
  2. package/dist/assets/index-70b6d947.js +111 -0
  3. package/dist/index.html +2 -2
  4. package/package.json +4 -4
  5. package/src/client/App.tsx +86 -43
  6. package/src/client/CodeEditor/getOrCreateEditor.ts +6 -1
  7. package/src/client/CodeEditor/index.tsx +60 -12
  8. package/src/client/CodeEditor/json1PresenceBroadcast.ts +6 -2
  9. package/src/client/CodeEditor/json1PresenceDisplay.ts +0 -45
  10. package/src/client/CodeEditor/style.scss +5 -1
  11. package/src/client/CodeErrorOverlay/index.tsx +27 -0
  12. package/src/client/CodeErrorOverlay/style.scss +30 -0
  13. package/src/client/PresenceNotifications/PresenceNotifications.test.ts +134 -0
  14. package/src/client/PresenceNotifications/index.tsx +118 -103
  15. package/src/client/SplitPaneResizeContext.tsx +12 -7
  16. package/src/client/TabList/Tab.tsx +20 -6
  17. package/src/client/TabList/index.tsx +18 -8
  18. package/src/client/TabList/style.scss +5 -0
  19. package/src/client/VZSettings.tsx +33 -20
  20. package/src/client/VZSidebar/{ConfirmationBox.tsx → DeleteConfirmationModal.tsx} +17 -14
  21. package/src/client/VZSidebar/DirectoryListing.tsx +27 -26
  22. package/src/client/VZSidebar/FileListing.tsx +16 -19
  23. package/src/client/VZSidebar/Item.tsx +83 -37
  24. package/src/client/VZSidebar/Listing.tsx +17 -14
  25. package/src/client/VZSidebar/index.tsx +43 -24
  26. package/src/client/style.scss +3 -0
  27. package/src/client/useActions.ts +25 -6
  28. package/src/client/useEditorCache.ts +2 -1
  29. package/src/client/useFileCRUD.ts +29 -27
  30. package/src/client/usernameLocalStorage.ts +43 -0
  31. package/src/client/vzReducer/closeTabReducer.test.ts +177 -0
  32. package/src/client/vzReducer/closeTabsReducer.ts +68 -0
  33. package/src/client/vzReducer/createInitialState.ts +19 -0
  34. package/src/client/vzReducer/editorNoLongerWantsFocusReducer.ts +9 -0
  35. package/src/client/vzReducer/index.ts +107 -0
  36. package/src/client/vzReducer/openTabReducer.test.ts +110 -0
  37. package/src/client/vzReducer/openTabReducer.ts +57 -0
  38. package/src/client/vzReducer/setActiveFileIdReducer.ts +9 -0
  39. package/src/client/vzReducer/setIsSettingsOpenReducer.ts +9 -0
  40. package/src/client/vzReducer/setThemeReducer.ts +9 -0
  41. package/src/client/vzReducer/setUsernameReducer.ts +9 -0
  42. package/src/index.ts +9 -3
  43. package/src/types.ts +12 -5
  44. package/dist/assets/index-284b7339.js +0 -111
  45. package/dist/assets/index-e160f758.css +0 -1
  46. package/src/client/PrettierErrorOverlay/index.tsx +0 -9
  47. package/src/client/PrettierErrorOverlay/style.scss +0 -9
  48. package/src/client/vzReducer.ts +0 -118
@@ -0,0 +1,9 @@
1
+ import { VZAction, VZState } from '.';
2
+
3
+ export const setIsSettingsOpenReducer = (
4
+ state: VZState,
5
+ action: VZAction,
6
+ ): VZState =>
7
+ action.type === 'set_is_settings_open'
8
+ ? { ...state, isSettingsOpen: action.value }
9
+ : state;
@@ -0,0 +1,9 @@
1
+ import { VZAction, VZState } from '.';
2
+
3
+ export const setThemeReducer = (
4
+ state: VZState,
5
+ action: VZAction,
6
+ ): VZState =>
7
+ action.type === 'set_theme'
8
+ ? { ...state, theme: action.themeLabel }
9
+ : state;
@@ -0,0 +1,9 @@
1
+ import { VZAction, VZState } from '.';
2
+
3
+ export const setUsernameReducer = (
4
+ state: VZState,
5
+ action: VZAction,
6
+ ): VZState =>
7
+ action.type === 'set_username'
8
+ ? { ...state, username: action.username }
9
+ : state;
package/src/index.ts CHANGED
@@ -15,16 +15,22 @@ export type {
15
15
 
16
16
  export { VZSidebar } from './client/VZSidebar';
17
17
  export { VZSettings } from './client/VZSettings';
18
- export { SplitPaneResizeContext } from './client/SplitPaneResizeContext';
18
+ export {
19
+ SplitPaneResizeProvider,
20
+ SplitPaneResizeContext,
21
+ } from './client/SplitPaneResizeContext';
19
22
  export { Resizer } from './client/Resizer';
20
23
  export { TabList } from './client/TabList';
21
24
  export { CodeEditor } from './client/CodeEditor';
22
25
  export { usePrettier } from './client/usePrettier';
23
- export { PrettierErrorOverlay } from './client/PrettierErrorOverlay';
26
+ export { CodeErrorOverlay } from './client/CodeErrorOverlay';
24
27
  export { PresenceNotifications } from './client/PresenceNotifications';
25
28
  export { useFileCRUD } from './client/useFileCRUD';
26
29
  export { useSubmitOperation } from './client/useSubmitOperation';
27
- export { vzReducer } from './client/vzReducer';
30
+ export {
31
+ vzReducer,
32
+ createInitialState,
33
+ } from './client/vzReducer';
28
34
  export { useActions } from './client/useActions';
29
35
  export { useOpenDirectories } from './client/useOpenDirectories';
30
36
  export {
package/src/types.ts CHANGED
@@ -30,6 +30,11 @@ export interface File {
30
30
  text: string;
31
31
  }
32
32
 
33
+ // FileTreePath
34
+ // * The path to the directory, e.g. "src/components", OR
35
+ // * The path to the file e.g. "src/components/HelloWorld.js".
36
+ export type FileTreePath = string;
37
+
33
38
  // FileTree
34
39
  // * A tree of files.
35
40
  // * Each node in the tree is either a directory or a file.
@@ -38,13 +43,9 @@ export interface File {
38
43
  // * Each file has a `fileId` string.
39
44
  // * Each directory has a `name` string.
40
45
  // * Each directory has a `path` string.
41
- // * The `path` string is the path to the directory.
42
- // e.g. "src/components".
43
- // * The `path` string is the path to the file.
44
- // e.g. "src/components/HelloWorld.js".
45
46
  export interface FileTree {
46
47
  name: string;
47
- path?: string;
48
+ path?: FileTreePath;
48
49
  children?: Array<FileTree | FileTreeFile>;
49
50
  }
50
51
 
@@ -93,3 +94,9 @@ export type VZCodeContent = {
93
94
  // * Hot reloading is debounced when this is `false`.
94
95
  isInteracting?: boolean;
95
96
  };
97
+
98
+ // An id used for presence.
99
+ export type PresenceId = string;
100
+
101
+ // A user name for display in presence.
102
+ export type Username = string;