vzcode 0.39.0 → 0.40.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/assets/{index-an0ZIKQ3.js → index-oU3BPloT.js} +3 -3
- package/dist/assets/{worker-pw8iYY3X.js → worker-i-gsyYZ1.js} +28 -28
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/src/client/CodeEditor/json1PresenceDisplay.ts +6 -0
- package/src/client/CodeEditor/typeScriptCompletions.ts +11 -0
- package/src/client/CodeEditor/widgets.ts +4 -2
- package/src/client/useTypeScript/worker.ts +2 -2
package/dist/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
href="https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css"
|
|
25
25
|
rel="stylesheet"
|
|
26
26
|
/>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-oU3BPloT.js"></script>
|
|
28
28
|
<link rel="stylesheet" crossorigin href="/assets/index-ZDmwFqlb.css">
|
|
29
29
|
</head>
|
|
30
30
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vzcode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "Multiplayer code editor system",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
"react-dom": "^18.2.0",
|
|
85
85
|
"sharedb": "^4.1.1",
|
|
86
86
|
"sharedb-client-browser": "^4.4.0",
|
|
87
|
-
"vizhub-ui": "^3.
|
|
87
|
+
"vizhub-ui": "^3.8.0",
|
|
88
88
|
"ws": "^8.14.2"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
|
-
"@types/react": "^18.2.
|
|
91
|
+
"@types/react": "^18.2.41",
|
|
92
92
|
"@types/react-dom": "^18.2.17",
|
|
93
93
|
"@vitejs/plugin-react": "^4.2.0",
|
|
94
94
|
"prettier": "^3.1.0",
|
|
@@ -174,6 +174,12 @@ class PresenceWidget extends WidgetType {
|
|
|
174
174
|
);
|
|
175
175
|
span.appendChild(userDiv);
|
|
176
176
|
|
|
177
|
+
// after 2 seconds of inactivity, username is made less visible
|
|
178
|
+
setTimeout(() => {
|
|
179
|
+
userDiv.style.backgroundColor = `rgba(${this.color}, 0.2)`;
|
|
180
|
+
userDiv.style.color = 'rgba(0,0,0,0.2)';
|
|
181
|
+
}, 2000);
|
|
182
|
+
|
|
177
183
|
return span;
|
|
178
184
|
}
|
|
179
185
|
|
|
@@ -41,6 +41,17 @@ export const typeScriptCompletions = ({
|
|
|
41
41
|
requestId,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
//Prevent completions from appearing on certain characters
|
|
45
|
+
if (
|
|
46
|
+
fileContent[completionContext.pos - 1] === '"' ||
|
|
47
|
+
fileContent[completionContext.pos - 1] === "'" ||
|
|
48
|
+
fileContent[completionContext.pos - 1] === ';' ||
|
|
49
|
+
fileContent[completionContext.pos - 1] === '(' ||
|
|
50
|
+
fileContent[completionContext.pos - 1] === ')'
|
|
51
|
+
) {
|
|
52
|
+
return { from: completionContext.pos, options: [] };
|
|
53
|
+
}
|
|
54
|
+
|
|
44
55
|
//Post message to our sharedWorker to get completions.
|
|
45
56
|
typeScriptWorker.postMessage(autocompleteRequest);
|
|
46
57
|
|
|
@@ -17,7 +17,7 @@ import { EditorView } from 'codemirror';
|
|
|
17
17
|
// * Number dragger
|
|
18
18
|
// * Boolean toggler
|
|
19
19
|
// * URL clicker
|
|
20
|
-
// *
|
|
20
|
+
// * color picker
|
|
21
21
|
// Inspired by:
|
|
22
22
|
// https://github.com/replit/codemirror-interact/blob/master/dev/index.ts
|
|
23
23
|
// `onInteract` is called when the user interacts with a widget.
|
|
@@ -51,7 +51,7 @@ export const widgets = ({
|
|
|
51
51
|
|
|
52
52
|
const updateHex = (e: Event) => {
|
|
53
53
|
const el = e.target as HTMLInputElement;
|
|
54
|
-
|
|
54
|
+
if (onInteract) onInteract();
|
|
55
55
|
if (el.value) {
|
|
56
56
|
setText(
|
|
57
57
|
`"${
|
|
@@ -140,6 +140,8 @@ export const widgets = ({
|
|
|
140
140
|
|
|
141
141
|
const updateRGB = (e: Event) => {
|
|
142
142
|
const el = e.target as HTMLInputElement;
|
|
143
|
+
if (onInteract) onInteract();
|
|
144
|
+
|
|
143
145
|
if (el.value) {
|
|
144
146
|
const [r, g, b] = hex2RGB(el.value);
|
|
145
147
|
setText(`rgb(${r}, ${g}, ${b})`);
|
|
@@ -163,7 +163,7 @@ onmessage = async ({ data }) => {
|
|
|
163
163
|
const tsFileName = getTSFileName(fileName);
|
|
164
164
|
|
|
165
165
|
let completions = null;
|
|
166
|
-
if (isTS(tsFileName)) {
|
|
166
|
+
if (isTS(tsFileName) && fileContent !== '') {
|
|
167
167
|
// Update the file in the file system to the
|
|
168
168
|
// absolute latest version. This is critical
|
|
169
169
|
// for correct completions.
|
|
@@ -197,7 +197,7 @@ onmessage = async ({ data }) => {
|
|
|
197
197
|
const tsFileName = getTSFileName(fileName);
|
|
198
198
|
let tsErrors = [];
|
|
199
199
|
// Since we are also updating the server when we autocomplete we do not need to update
|
|
200
|
-
if (isTS(tsFileName)) {
|
|
200
|
+
if (isTS(tsFileName) && fileContent !== '') {
|
|
201
201
|
setFile(tsFileName, fileContent);
|
|
202
202
|
// Creates an array of diagnostic objects containing
|
|
203
203
|
// both semantic and syntactic diagnostics.
|