vzcode 1.0.0 → 1.2.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/dist/index.html CHANGED
@@ -20,7 +20,7 @@
20
20
  href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap"
21
21
  rel="stylesheet"
22
22
  />
23
- <script type="module" crossorigin src="/assets/index-DacyImKg.js"></script>
23
+ <script type="module" crossorigin src="/assets/index-Blj_0vZF.js"></script>
24
24
  <link rel="stylesheet" crossorigin href="/assets/index-CWMOj-be.css">
25
25
  </head>
26
26
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vzcode",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Multiplayer code editor system",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "homepage": "https://github.com/vizhub-core/vzcode#readme",
89
89
  "dependencies": {
90
- "@codemirror/autocomplete": "^6.16.0",
90
+ "@codemirror/autocomplete": "^6.16.2",
91
91
  "@codemirror/lang-css": "^6.2.1",
92
92
  "@codemirror/lang-html": "^6.4.9",
93
93
  "@codemirror/lang-javascript": "^6.2.2",
@@ -95,23 +95,23 @@
95
95
  "@codemirror/lang-markdown": "^6.2.5",
96
96
  "@codemirror/state": "^6.4.1",
97
97
  "@codemirror/theme-one-dark": "^6.1.2",
98
- "@codemirror/view": "^6.26.3",
98
+ "@codemirror/view": "^6.27.0",
99
99
  "@lezer/highlight": "^1.2.0",
100
- "@replit/codemirror-indentation-markers": "^6.5.1",
100
+ "@replit/codemirror-indentation-markers": "^6.5.2",
101
101
  "@replit/codemirror-interact": "^6.3.1",
102
102
  "@replit/codemirror-lang-svelte": "^6.0.0",
103
103
  "@replit/codemirror-vscode-keymap": "^6.0.2",
104
104
  "@teamwork/websocket-json-stream": "^2.0.0",
105
- "@typescript/vfs": "^1.5.0",
106
- "@uiw/codemirror-theme-abcdef": "^4.22.0",
107
- "@uiw/codemirror-theme-dracula": "^4.22.0",
108
- "@uiw/codemirror-theme-eclipse": "^4.22.0",
109
- "@uiw/codemirror-theme-github": "^4.22.0",
110
- "@uiw/codemirror-theme-material": "^4.22.0",
111
- "@uiw/codemirror-theme-nord": "^4.22.0",
112
- "@uiw/codemirror-theme-okaidia": "^4.22.0",
113
- "@uiw/codemirror-theme-xcode": "^4.22.0",
114
- "@uiw/codemirror-themes": "^4.22.0",
105
+ "@typescript/vfs": "^1.5.2",
106
+ "@uiw/codemirror-theme-abcdef": "^4.22.1",
107
+ "@uiw/codemirror-theme-dracula": "^4.22.1",
108
+ "@uiw/codemirror-theme-eclipse": "^4.22.1",
109
+ "@uiw/codemirror-theme-github": "^4.22.1",
110
+ "@uiw/codemirror-theme-material": "^4.22.1",
111
+ "@uiw/codemirror-theme-nord": "^4.22.1",
112
+ "@uiw/codemirror-theme-okaidia": "^4.22.1",
113
+ "@uiw/codemirror-theme-xcode": "^4.22.1",
114
+ "@uiw/codemirror-themes": "^4.22.1",
115
115
  "body-parser": "^1.20.2",
116
116
  "codemirror": "^6.0.1",
117
117
  "codemirror-ot": "^4.4.0",
@@ -124,26 +124,30 @@
124
124
  "json0-ot-diff": "^1.1.2",
125
125
  "ngrok": "^4.3.3",
126
126
  "open": "^10.1.0",
127
- "openai": "^4.40.0",
127
+ "openai": "^4.48.2",
128
128
  "prettier-plugin-svelte": "^3.2.3",
129
129
  "react": "^18.3.1",
130
130
  "react-bootstrap": "^2.10.2",
131
131
  "react-dom": "^18.3.1",
132
- "react-router-dom": "^6.23.0",
133
- "sharedb": "^4.1.4",
134
- "sharedb-client-browser": "^4.5.0",
132
+ "react-router-dom": "^6.23.1",
133
+ "sharedb": "^5.0.1",
134
+ "sharedb-client-browser": "^5.0.1",
135
135
  "vizhub-ui": "^3.23.0",
136
136
  "ws": "^8.17.0"
137
137
  },
138
138
  "devDependencies": {
139
- "@types/react": "^18.3.1",
139
+ "@types/react": "^18.3.3",
140
140
  "@types/react-dom": "^18.3.0",
141
- "@vitejs/plugin-react": "^4.2.1",
141
+ "@vitejs/plugin-react": "^4.3.0",
142
142
  "concurrently": "^8.2.2",
143
- "prettier": "^3.2.5",
144
- "sass": "^1.76.0",
143
+ "prettier": "^3.3.1",
144
+ "sass": "^1.77.4",
145
145
  "typescript": "^5.4.5",
146
- "vite": "^5.2.10",
147
- "vitest": "^1.5.3"
146
+ "vite": "^5.2.12",
147
+ "vitest": "^1.6.0"
148
+ },
149
+ "optionalDependencies": {
150
+ "@rollup/rollup-win32-x64-msvc": "^4.18.0",
151
+ "@rollup/rollup-darwin-arm64": "^4.18.0"
148
152
  }
149
153
  }
@@ -111,12 +111,17 @@ export const CodeEditor = ({
111
111
  if (!ref.current) return;
112
112
  if (!content) return;
113
113
 
114
- // Add the editor to the DOM.
114
+ // Add the editor and apply the prior scroll position to the DOM.
115
115
  ref.current.appendChild(editorCacheValue.editor.dom);
116
+ editorCacheValue.editor.scrollDOM.scrollTo({
117
+ top: editorCacheValue.scrollPosition ?? 0,
118
+ });
116
119
 
117
120
  return () => {
118
- // Remove the old editor from the DOM.
121
+ // Remove the old editor from the DOM and store the current scroll position.
119
122
  // This happens every time `activeFileId` changes.
123
+ editorCacheValue.scrollPosition =
124
+ editorCacheValue.editor.scrollDOM.scrollTop;
120
125
  ref.current.removeChild(editorCacheValue.editor.dom);
121
126
  };
122
127
  }, [shareDBDoc, editorCacheValue]);
@@ -56,7 +56,9 @@ export const json1PresenceDisplay = ({
56
56
  const { start, end } = presence;
57
57
  const from = start[start.length - 1];
58
58
  const to = end[end.length - 1];
59
- const userColor = new ColorHash().rgb(id);
59
+ const userColor = new ColorHash({
60
+ lightness: 0.75,
61
+ }).rgb(id);
60
62
  const { username } = presence;
61
63
 
62
64
  presenceDecorations.push({
@@ -5,6 +5,7 @@ import { EditorView } from 'codemirror';
5
5
  export type EditorCacheValue = {
6
6
  editor: EditorView;
7
7
  themeCompartment: any;
8
+ scrollPosition?: number;
8
9
  };
9
10
 
10
11
  export type EditorCache = Map<FileId, EditorCacheValue>;
@@ -310,9 +310,9 @@ server.listen(port, async () => {
310
310
  open(url);
311
311
  })();
312
312
  } else {
313
- // console.log(
314
- // `Editor is live at http://localhost:${port}`,
315
- // );
316
- // open(`http://localhost:${port}`);
313
+ console.log(
314
+ `Editor is live at http://localhost:${port}`,
315
+ );
316
+ open(`http://localhost:${port}`);
317
317
  }
318
318
  });