vzcode 1.28.0 → 1.30.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 (39) hide show
  1. package/dist/assets/index-DjhIoHhX.js +234 -0
  2. package/dist/index.html +1 -1
  3. package/package.json +2 -1
  4. package/src/client/AIAssist/AIAssistCodeMirrorKeyMap.ts +3 -6
  5. package/src/client/AIAssist/AIAssistWidget/index.tsx +3 -2
  6. package/src/client/AIAssist/formatFile.ts +2 -2
  7. package/src/client/AIAssist/startAIAssist.ts +7 -8
  8. package/src/client/App/usePending.ts +3 -2
  9. package/src/client/App/useShareDB.ts +7 -5
  10. package/src/client/CodeEditor/getOrCreateEditor.ts +4 -5
  11. package/src/client/CodeEditor/json1PresenceDisplay.ts +2 -2
  12. package/src/client/CodeErrorOverlay/index.tsx +2 -2
  13. package/src/client/TabList/Tab.tsx +5 -4
  14. package/src/client/VZCodeContext.tsx +12 -23
  15. package/src/client/VZSidebar/FileListing.tsx +5 -4
  16. package/src/client/VZSidebar/Listing.tsx +4 -7
  17. package/src/client/VZSidebar/Search.tsx +5 -4
  18. package/src/client/VZSidebar/index.tsx +4 -4
  19. package/src/client/getFileTree.ts +4 -3
  20. package/src/client/tabsSearchParameters.test.ts +3 -2
  21. package/src/client/tabsSearchParameters.ts +8 -7
  22. package/src/client/themes/vizhubTheme/index.ts +13 -16
  23. package/src/client/useActions.ts +6 -7
  24. package/src/client/useEditorCache.ts +3 -2
  25. package/src/client/useFileCRUD.ts +15 -18
  26. package/src/client/useKeyboardShortcuts.ts +4 -3
  27. package/src/client/usePrettier/index.ts +6 -10
  28. package/src/client/usePrettier/worker.ts +3 -3
  29. package/src/client/useRunCode.tsx +3 -2
  30. package/src/client/useTypeScript/index.ts +3 -3
  31. package/src/client/useTypeScript/worker/handleMessageUpdateContent.ts +8 -4
  32. package/src/client/useURLSync.ts +8 -5
  33. package/src/client/vzReducer/closeTabsReducer.ts +3 -7
  34. package/src/client/vzReducer/createInitialState.ts +1 -1
  35. package/src/client/vzReducer/index.ts +7 -8
  36. package/src/client/vzReducer/searchReducer.ts +2 -2
  37. package/src/client/vzReducer/updatePane.ts +3 -7
  38. package/src/types.ts +7 -52
  39. package/dist/assets/index-DQm1t_Hp.js +0 -183
@@ -1,14 +1,13 @@
1
1
  import { useCallback } from 'react';
2
2
  import { ThemeLabel } from './themes';
3
3
  import {
4
- FileId,
5
4
  PresenceIndicator,
6
5
  SearchFileVisibility,
7
6
  ShareDBDoc,
8
7
  TabState,
9
8
  Username,
10
- VZCodeContent,
11
9
  } from '../types';
10
+ import { VizFileId, VizContent } from '@vizhub/viz-types';
12
11
  import { VZAction } from './vzReducer';
13
12
 
14
13
  // This is a custom hook that returns a set of functions
@@ -17,7 +16,7 @@ export const useActions = (
17
16
  dispatch: (action: VZAction) => void,
18
17
  ) => {
19
18
  const setActiveFileId = useCallback(
20
- (activeFileId: FileId) => {
19
+ (activeFileId: VizFileId) => {
21
20
  dispatch({
22
21
  type: 'set_active_file_id',
23
22
  activeFileId,
@@ -46,7 +45,7 @@ export const useActions = (
46
45
  );
47
46
 
48
47
  const closeTabs = useCallback(
49
- (fileIdsToClose: Array<FileId>) => {
48
+ (fileIdsToClose: Array<VizFileId>) => {
50
49
  dispatch({
51
50
  type: 'close_tabs',
52
51
  fileIdsToClose,
@@ -89,7 +88,7 @@ export const useActions = (
89
88
 
90
89
  // Update search results based on current pattern
91
90
  const setSearchResults = useCallback(
92
- (files: ShareDBDoc<VZCodeContent>) => {
91
+ (files: ShareDBDoc<VizContent>) => {
93
92
  dispatch({
94
93
  type: 'set_search_results',
95
94
  files: files,
@@ -101,7 +100,7 @@ export const useActions = (
101
100
  // Update search results file visibility based on current pattern
102
101
  const setSearchFileVisibility = useCallback(
103
102
  (
104
- files: ShareDBDoc<VZCodeContent>,
103
+ files: ShareDBDoc<VizContent>,
105
104
  id: string,
106
105
  visibility: SearchFileVisibility,
107
106
  ) => {
@@ -118,7 +117,7 @@ export const useActions = (
118
117
  // Update search results file matching line visibility to be
119
118
  const setSearchLineVisibility = useCallback(
120
119
  (
121
- files: ShareDBDoc<VZCodeContent>,
120
+ files: ShareDBDoc<VizContent>,
122
121
  id: string,
123
122
  line: number,
124
123
  ) => {
@@ -1,5 +1,6 @@
1
1
  import { useRef } from 'react';
2
- import { FileId, PaneId } from '../types';
2
+ import { VizFileId } from '@vizhub/viz-types';
3
+ import { PaneId } from '../types';
3
4
  import { EditorView } from 'codemirror';
4
5
 
5
6
  export type EditorCacheValue = {
@@ -11,7 +12,7 @@ export type EditorCacheValue = {
11
12
  export type EditorCacheKey = string;
12
13
 
13
14
  export const editorCacheKey = (
14
- fileId: FileId,
15
+ fileId: VizFileId,
15
16
  paneId: PaneId,
16
17
  ): EditorCacheKey => fileId + '|' + paneId;
17
18
 
@@ -1,9 +1,6 @@
1
1
  import { useCallback } from 'react';
2
- import {
3
- FileId,
4
- FileTreePath,
5
- VZCodeContent,
6
- } from '../types';
2
+ import { FileTreePath } from '../types';
3
+ import { VizFileId, VizContent } from '@vizhub/viz-types';
7
4
  import { randomId } from '../randomId';
8
5
 
9
6
  // CRUD operations for files and directories
@@ -14,14 +11,14 @@ export const useFileCRUD = ({
14
11
  openTab,
15
12
  }: {
16
13
  submitOperation: (
17
- operation: (document: VZCodeContent) => VZCodeContent,
14
+ operation: (document: VizContent) => VizContent,
18
15
  ) => void;
19
- closeTabs: (idsToDelete: Array<FileId>) => void;
16
+ closeTabs: (idsToDelete: Array<VizFileId>) => void;
20
17
  openTab: ({
21
18
  fileId,
22
19
  isTransient,
23
20
  }: {
24
- fileId: FileId;
21
+ fileId: VizFileId;
25
22
  isTransient: boolean;
26
23
  }) => void;
27
24
  }) => {
@@ -29,8 +26,8 @@ export const useFileCRUD = ({
29
26
  const createFile = useCallback(
30
27
  (name: string, text = '') => {
31
28
  if (name) {
32
- const fileId: FileId = randomId();
33
- submitOperation((document: VZCodeContent) => ({
29
+ const fileId: VizFileId = randomId();
30
+ submitOperation((document: VizContent) => ({
34
31
  ...document,
35
32
  files: {
36
33
  ...document.files,
@@ -49,8 +46,8 @@ export const useFileCRUD = ({
49
46
  (name: string, text = null) => {
50
47
  if (name) {
51
48
  name += '/';
52
- const fileId: FileId = randomId();
53
- submitOperation((document: VZCodeContent) => ({
49
+ const fileId: VizFileId = randomId();
50
+ submitOperation((document: VizContent) => ({
54
51
  ...document,
55
52
  files: {
56
53
  ...document.files,
@@ -64,8 +61,8 @@ export const useFileCRUD = ({
64
61
 
65
62
  // Called when a file in the sidebar is renamed.
66
63
  const renameFile = useCallback(
67
- (fileId: FileId, newName: string) => {
68
- submitOperation((document: VZCodeContent) => ({
64
+ (fileId: VizFileId, newName: string) => {
65
+ submitOperation((document: VizContent) => ({
69
66
  ...document,
70
67
  files: {
71
68
  ...document.files,
@@ -94,7 +91,7 @@ export const useFileCRUD = ({
94
91
  ) => {
95
92
  console.log(path);
96
93
  console.log(oldName);
97
- submitOperation((document: VZCodeContent) => {
94
+ submitOperation((document: VizContent) => {
98
95
  const updatedFiles = Object.keys(
99
96
  document.files,
100
97
  ).reduce((acc, key) => {
@@ -131,7 +128,7 @@ export const useFileCRUD = ({
131
128
 
132
129
  // Deletes a file
133
130
  const deleteFile = useCallback(
134
- (fileId: FileId) => {
131
+ (fileId: VizFileId) => {
135
132
  closeTabs([fileId]);
136
133
  submitOperation((document) => {
137
134
  const updatedFiles = { ...document.files };
@@ -145,8 +142,8 @@ export const useFileCRUD = ({
145
142
  // Deletes a directory and all files within it
146
143
  const deleteDirectory = useCallback(
147
144
  (path: FileTreePath) => {
148
- const tabsToClose: Array<FileId> = [];
149
- submitOperation((document: VZCodeContent) => {
145
+ const tabsToClose: Array<VizFileId> = [];
146
+ submitOperation((document: VizContent) => {
150
147
  const updatedFiles = { ...document.files };
151
148
  for (const key in updatedFiles) {
152
149
  if (updatedFiles[key].name.includes(path + '/')) {
@@ -4,7 +4,8 @@ import { syntaxTree } from '@codemirror/language';
4
4
  import { SyntaxNode, SyntaxNodeRef } from '@lezer/common';
5
5
  import { EditorView } from '@codemirror/view';
6
6
  import { EditorState } from '@codemirror/state';
7
- import { FileId, PaneId } from '../types';
7
+ import { VizFileId } from '@vizhub/viz-types';
8
+ import { PaneId } from '../types';
8
9
  import { editorCacheKey } from './useEditorCache';
9
10
 
10
11
  /*
@@ -187,8 +188,8 @@ export const useKeyboardShortcuts = ({
187
188
  editorCache,
188
189
  codeEditorRef,
189
190
  }: {
190
- closeTabs: (fileIds: FileId[]) => void;
191
- activeFileId: FileId | null;
191
+ closeTabs: (fileIds: VizFileId[]) => void;
192
+ activeFileId: VizFileId | null;
192
193
  activePaneId: PaneId;
193
194
  handleOpenCreateFileModal: () => void;
194
195
  setActiveFileLeft: () => void;
@@ -1,10 +1,7 @@
1
1
  import { shouldTriggerRun } from '../shouldTriggerRun';
2
2
  import { JSONOp } from '../../ot';
3
- import {
4
- FileId,
5
- ShareDBDoc,
6
- VZCodeContent,
7
- } from '../../types';
3
+ import { VizFileId, VizContent } from '@vizhub/viz-types';
4
+ import { ShareDBDoc } from '../../types';
8
5
  import { useEffect, useRef, useState } from 'react';
9
6
 
10
7
  // The time in milliseconds by which auto-saving is debounced.
@@ -32,16 +29,15 @@ export const usePrettier = ({
32
29
  submitOperation,
33
30
  prettierWorker,
34
31
  }: {
35
- shareDBDoc: ShareDBDoc<VZCodeContent> | null;
32
+ shareDBDoc: ShareDBDoc<VizContent> | null;
36
33
  submitOperation: (
37
- next: (content: VZCodeContent) => VZCodeContent,
34
+ next: (content: VizContent) => VizContent,
38
35
  ) => void;
39
36
  prettierWorker: Worker;
40
37
  }) => {
41
38
  // The set of files that have been modified
42
39
  // since the last Prettier run.
43
- // const dirtyFiles: Set<FileId> = new Set<FileId>();
44
- const dirtyFilesRef = useRef<Set<FileId>>(new Set());
40
+ const dirtyFilesRef = useRef<Set<VizFileId>>(new Set());
45
41
 
46
42
  // State to hold the error from Prettier
47
43
  // `null` means no errors
@@ -157,7 +153,7 @@ export const usePrettier = ({
157
153
  op[2] === 'text'
158
154
  ) {
159
155
  // Get the file id
160
- const fileId: FileId = op[1];
156
+ const fileId: VizFileId = op[1];
161
157
 
162
158
  // Add the file id to the set of dirty files
163
159
  dirtyFilesRef.current.add(fileId);
@@ -7,7 +7,7 @@ import * as prettierPluginCSS from 'prettier/plugins/postcss';
7
7
  import * as prettierPluginTypescript from 'prettier/plugins/typescript';
8
8
  import * as prettierPluginSvelte from 'prettier-plugin-svelte/browser';
9
9
 
10
- import { FileId } from '../../types';
10
+ import { VizFileId } from '@vizhub/viz-types';
11
11
 
12
12
  const enableSvelte = true;
13
13
 
@@ -41,7 +41,7 @@ const plugins = [
41
41
  prettierPluginMarkdown,
42
42
  prettierPluginTypescript,
43
43
  prettierPluginCSS,
44
- ];
44
+ ] as any; // Cast to any to resolve type conflict
45
45
 
46
46
  if (enableSvelte) {
47
47
  // @ts-ignore
@@ -68,7 +68,7 @@ onmessage = async ({
68
68
  fileExtension: string;
69
69
 
70
70
  // The file id
71
- fileId: FileId;
71
+ fileId: VizFileId;
72
72
  };
73
73
  }) => {
74
74
  const { fileExtension, fileText, fileId } = data;
@@ -1,5 +1,6 @@
1
1
  import { useEffect, useRef } from 'react';
2
- import { SubmitOperation, VZCodeContent } from '../types';
2
+ import { SubmitOperation } from '../types';
3
+ import { VizContent } from '@vizhub/viz-types';
3
4
 
4
5
  // Runs the code by flashing `isInteracting` to `true`.
5
6
  export const useRunCode = (
@@ -8,7 +9,7 @@ export const useRunCode = (
8
9
  const runCodeRef = useRef(null);
9
10
  useEffect(() => {
10
11
  const runCode = () => {
11
- submitOperation((content: VZCodeContent) => ({
12
+ submitOperation((content: VizContent) => ({
12
13
  ...content,
13
14
  isInteracting: true,
14
15
  }));
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useEffect, useRef } from 'react';
2
- import { VZCodeContent } from '../../types';
2
+ import { VizContent } from '@vizhub/viz-types';
3
3
  import { autoPrettierDebounceTimeMS } from '../usePrettier';
4
4
 
5
5
  // We don't want to send the message _before_ Prettier runs,
@@ -16,7 +16,7 @@ export const useTypeScript = ({
16
16
  content,
17
17
  typeScriptWorker,
18
18
  }: {
19
- content: VZCodeContent;
19
+ content: VizContent;
20
20
  typeScriptWorker: Worker;
21
21
  }) => {
22
22
  // When Content changes, update the TypeScript worker
@@ -26,7 +26,7 @@ export const useTypeScript = ({
26
26
  const debounceTimeoutId = useRef<number | null>(null);
27
27
 
28
28
  const debounceUpdateContent = useCallback(
29
- (content: VZCodeContent) => {
29
+ (content: VizContent) => {
30
30
  // Handle the case where the content has not yet been loaded.
31
31
  if (content === null) {
32
32
  return;
@@ -1,4 +1,8 @@
1
- import { File, Files, VZCodeContent } from '../../../types';
1
+ import {
2
+ VizFile,
3
+ VizFiles,
4
+ VizContent,
5
+ } from '@vizhub/viz-types';
2
6
  import { getTSFileName } from './getTSFileName';
3
7
  import { isTS } from './isTS';
4
8
 
@@ -16,12 +20,12 @@ export const handleMessageUpdateContent = async ({
16
20
  console.log('update-content message received');
17
21
  }
18
22
  // Unpack the files
19
- const content: VZCodeContent = data.details;
20
- const files: Files = content.files;
23
+ const content: VizContent = data.details;
24
+ const files: VizFiles = content.files;
21
25
 
22
26
  // Iterate over the files
23
27
  for (const fileId of Object.keys(files)) {
24
- const file: File = files[fileId];
28
+ const file: VizFile = files[fileId];
25
29
  const { name, text } = file;
26
30
 
27
31
  const tsFileName = getTSFileName(name);
@@ -1,5 +1,6 @@
1
- import { useSearchParams } from 'react-router-dom';
2
- import { FileId, TabState, VZCodeContent } from '../types';
1
+ import * as reactRouterDOM from 'react-router-dom';
2
+ import { TabState } from '../types';
3
+ import { VizFileId, VizContent } from '@vizhub/viz-types';
3
4
  import { useEffect, useMemo, useRef } from 'react';
4
5
  import {
5
6
  TabStateParams,
@@ -7,6 +8,8 @@ import {
7
8
  encodeTabs,
8
9
  } from './tabsSearchParameters';
9
10
 
11
+ const { useSearchParams } = reactRouterDOM;
12
+
10
13
  // Synchronizes the tab state with the URL parameters.
11
14
  export const useURLSync = ({
12
15
  content,
@@ -15,11 +18,11 @@ export const useURLSync = ({
15
18
  tabList,
16
19
  activeFileId,
17
20
  }: {
18
- content: VZCodeContent | null;
21
+ content: VizContent | null;
19
22
  openTab: (tabState: TabState) => void;
20
- setActiveFileId: (activeFileId: FileId) => void;
23
+ setActiveFileId: (activeFileId: VizFileId) => void;
21
24
  tabList: Array<TabState>;
22
- activeFileId: FileId | null;
25
+ activeFileId: VizFileId | null;
23
26
  }) => {
24
27
  // Use React router to get and set the search parameters.
25
28
  const [searchParams, setSearchParams] = useSearchParams();
@@ -1,10 +1,6 @@
1
1
  import { VZAction, VZState } from '.';
2
- import {
3
- FileId,
4
- Pane,
5
- PaneId,
6
- TabState,
7
- } from '../../types';
2
+ import { Pane, PaneId, TabState } from '../../types';
3
+ import { VizFileId } from '@vizhub/viz-types';
8
4
  import { findPane } from './findPane';
9
5
  import { updatePane } from './updatePane';
10
6
 
@@ -49,7 +45,7 @@ export const closeTabsReducer = (
49
45
  }
50
46
 
51
47
  // Otherwise, we'll need to also find a new active tab.
52
- let newActiveFileId: FileId | null = null;
48
+ let newActiveFileId: VizFileId | null = null;
53
49
 
54
50
  // The question becomes: which tab should be active now?
55
51
  // - Either the tab to the left or right of the closed tab.
@@ -29,6 +29,6 @@ export const createInitialState = ({
29
29
  isDocOpen: false,
30
30
  editorWantsFocus: false,
31
31
  username: initialUsername,
32
- enableAutoFollow: false,
32
+ enableAutoFollow: true,
33
33
  sidebarPresenceIndicators: [],
34
34
  });
@@ -1,5 +1,4 @@
1
1
  import {
2
- FileId,
3
2
  Pane,
4
3
  PaneId,
5
4
  PresenceIndicator,
@@ -7,8 +6,8 @@ import {
7
6
  SearchResults,
8
7
  ShareDBDoc,
9
8
  Username,
10
- VZCodeContent,
11
9
  } from '../../types';
10
+ import { VizFileId, VizContent } from '@vizhub/viz-types';
12
11
  import { ThemeLabel } from '../themes';
13
12
  import { closeTabsReducer } from './closeTabsReducer';
14
13
  import { openTabReducer } from './openTabReducer';
@@ -78,7 +77,7 @@ export type VZState = {
78
77
  export type VZAction =
79
78
  // `set_active_file_id`
80
79
  // * Sets the active file ID.
81
- | { type: 'set_active_file_id'; activeFileId: FileId }
80
+ | { type: 'set_active_file_id'; activeFileId: VizFileId }
82
81
 
83
82
  // `set_active_file_left' 'set_active_file_right`
84
83
  // * Sets the active file ID to be the tab directly to the left or right
@@ -91,7 +90,7 @@ export type VZAction =
91
90
  // * Also serves to change an already open transient tab to persistent.
92
91
  | {
93
92
  type: 'open_tab';
94
- fileId: FileId;
93
+ fileId: VizFileId;
95
94
  isTransient?: boolean;
96
95
  }
97
96
 
@@ -99,7 +98,7 @@ export type VZAction =
99
98
  // * Closes a set of tabs.
100
99
  | {
101
100
  type: 'close_tabs';
102
- fileIdsToClose: Array<FileId>;
101
+ fileIdsToClose: Array<VizFileId>;
103
102
  // The pane id to close tabs from.
104
103
  }
105
104
 
@@ -124,14 +123,14 @@ export type VZAction =
124
123
  // * Sets the current search pattern
125
124
  | {
126
125
  type: 'set_search_results';
127
- files: ShareDBDoc<VZCodeContent>;
126
+ files: ShareDBDoc<VizContent>;
128
127
  }
129
128
 
130
129
  // `set_search_results_visibility`
131
130
  // * Sets the visibility of a current search pattern file
132
131
  | {
133
132
  type: 'set_search_file_visibility';
134
- files: ShareDBDoc<VZCodeContent>;
133
+ files: ShareDBDoc<VizContent>;
135
134
  id: string;
136
135
  visibility: SearchFileVisibility;
137
136
  }
@@ -140,7 +139,7 @@ export type VZAction =
140
139
  // * Hides a current search pattern file's specific matching line
141
140
  | {
142
141
  type: 'hide_search_results_line';
143
- files: ShareDBDoc<VZCodeContent>;
142
+ files: ShareDBDoc<VizContent>;
144
143
  id: string;
145
144
  line: number;
146
145
  }
@@ -4,11 +4,11 @@ import {
4
4
  SearchFileVisibility,
5
5
  SearchResult,
6
6
  ShareDBDoc,
7
- VZCodeContent,
8
7
  } from '../../types';
8
+ import { VizContent } from '@vizhub/viz-types';
9
9
 
10
10
  function searchPattern(
11
- shareDBDoc: ShareDBDoc<VZCodeContent>,
11
+ shareDBDoc: ShareDBDoc<VizContent>,
12
12
  pattern: string,
13
13
  ): SearchResult {
14
14
  const files = shareDBDoc.data.files;
@@ -1,9 +1,5 @@
1
- import {
2
- FileId,
3
- Pane,
4
- PaneId,
5
- TabState,
6
- } from '../../types';
1
+ import { Pane, PaneId, TabState } from '../../types';
2
+ import { VizFileId } from '@vizhub/viz-types';
7
3
 
8
4
  // Immutable update pattern for updating a pane's tab list.
9
5
  export const updatePane = ({
@@ -15,7 +11,7 @@ export const updatePane = ({
15
11
  pane: Pane;
16
12
  activePaneId: PaneId;
17
13
  newTabList?: Array<TabState>;
18
- newActiveFileId?: FileId | null;
14
+ newActiveFileId?: VizFileId | null;
19
15
  }): Pane =>
20
16
  pane.type === 'splitPane'
21
17
  ? {
package/src/types.ts CHANGED
@@ -1,36 +1,9 @@
1
- // FileId
2
- // * A unique ID for a file.
3
- // * This is a random string.
4
- export type FileId = string;
1
+ import { VizContent, VizFileId } from '@vizhub/viz-types';
5
2
 
6
3
  // ItemId
7
4
  // * A unique ID for an item in the sidebar.
8
5
  // * This could be either a file ID or a directory path.
9
- export type ItemId = FileId | FileTreePath;
10
-
11
- // Files
12
- // * A collection of files.
13
- // * Keys are _not_ file names or array indices,
14
- // because based on past experience, that
15
- // leads to very difficult frontend logic around
16
- // OT in the case that a file is renamed or deleted.
17
- // * When the file name changes, or files are added/deleted,
18
- // this ID stays the same, simplifying things re:OT.
19
- export interface Files {
20
- [fileId: FileId]: File;
21
- }
22
-
23
- // File
24
- // * A file with `name` and `text`.
25
- export interface File {
26
- // The file name.
27
- // e.g. "index.html".
28
- name: string;
29
-
30
- // The text content of the file.
31
- // e.g. "<body>Hello</body>"
32
- text: string;
33
- }
6
+ export type ItemId = VizFileId | FileTreePath;
34
7
 
35
8
  // FileTreePath
36
9
  // * The path to the directory, e.g. "src/components", OR
@@ -59,7 +32,7 @@ export interface FileTree {
59
32
  export interface FileTreeFile {
60
33
  name: string;
61
34
  file: File;
62
- fileId: FileId;
35
+ fileId: VizFileId;
63
36
  }
64
37
  export type SearchMatch = Array<{
65
38
  line: number;
@@ -89,7 +62,7 @@ export interface SearchResults {
89
62
  export type TabState = {
90
63
  // `fileId`
91
64
  // The ID of the file that the tab represents.
92
- fileId: FileId;
65
+ fileId: VizFileId;
93
66
 
94
67
  // `isTransient`
95
68
  // Represents whether the tab is temporary or persistent.
@@ -119,7 +92,7 @@ export type LeafPane = {
119
92
  // The ID of the file that is currently active
120
93
  // within this leaf pane.
121
94
  // Invariant: `activeFileId` is always in `tabList`.
122
- activeFileId: FileId | null;
95
+ activeFileId: VizFileId | null;
123
96
  };
124
97
 
125
98
  // Internal node of the tree data structure
@@ -176,24 +149,6 @@ export type ShareDBDoc<T> = {
176
149
  whenNothingPending: (callback: () => void) => void;
177
150
  };
178
151
 
179
- // A unique ID for an AI stream.
180
- // Generated by the client.
181
- export type AIStreamId = string;
182
-
183
- // The ShareDB document type for VZCode.
184
- export type VZCodeContent = {
185
- // `files`
186
- // * The files in the VZCode instance.
187
- files?: Files;
188
-
189
- // `isInteracting`
190
- // * `true` when the user is interacting
191
- // via interactive code widgets (e.g. Alt+drag)
192
- // * Hot reloading is throttled when this is `true`.
193
- // * `false` or `undefined` when they are not (e.g. normal typing)
194
- // * Hot reloading is debounced when this is `false`.
195
- isInteracting?: boolean;
196
- };
197
152
  // Example Presence object, from ShareDB:
198
153
  // {
199
154
  // "start": [
@@ -222,7 +177,7 @@ export type Presence = {
222
177
  // * What file the presence is associated with
223
178
  export type PresenceIndicator = {
224
179
  username: Username;
225
- fileId: FileId;
180
+ fileId: VizFileId;
226
181
  };
227
182
 
228
183
  // An id used for presence.
@@ -234,5 +189,5 @@ export type Username = string;
234
189
  // The type of a convenience function called `submitOperation`,
235
190
  // to submit an operation to ShareDB.
236
191
  export type SubmitOperation = (
237
- next: (content: VZCodeContent) => VZCodeContent,
192
+ next: (content: VizContent) => VizContent,
238
193
  ) => void;