vzcode 0.62.0 → 0.64.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,8 +20,8 @@
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-QfTeKC1O.js"></script>
24
- <link rel="stylesheet" crossorigin href="/assets/index-rnGm5_OY.css">
23
+ <script type="module" crossorigin src="/assets/index-ozxHHf72.js"></script>
24
+ <link rel="stylesheet" crossorigin href="/assets/index-Bh7FzEWq.css">
25
25
  </head>
26
26
  <body>
27
27
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vzcode",
3
- "version": "0.62.0",
3
+ "version": "0.64.0",
4
4
  "description": "Multiplayer code editor system",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -100,7 +100,7 @@
100
100
  "json0-ot-diff": "^1.1.2",
101
101
  "ngrok": "^4.3.3",
102
102
  "open": "^10.0.3",
103
- "openai": "^4.26.0",
103
+ "openai": "^4.26.1",
104
104
  "prettier-plugin-svelte": "^3.1.2",
105
105
  "react": "^18.2.0",
106
106
  "react-bootstrap": "^2.10.0",
@@ -112,14 +112,14 @@
112
112
  "ws": "^8.16.0"
113
113
  },
114
114
  "devDependencies": {
115
- "@types/react": "^18.2.52",
116
- "@types/react-dom": "^18.2.18",
115
+ "@types/react": "^18.2.55",
116
+ "@types/react-dom": "^18.2.19",
117
117
  "@vitejs/plugin-react": "^4.2.1",
118
118
  "concurrently": "^8.2.2",
119
119
  "prettier": "^3.2.5",
120
120
  "sass": "^1.70.0",
121
121
  "typescript": "^5.3.3",
122
- "vite": "^5.0.12",
122
+ "vite": "^5.1.0",
123
123
  "vitest": "^1.2.2"
124
124
  }
125
125
  }
@@ -14,6 +14,7 @@ import {
14
14
  import { SparklesSVG, StopSVG } from '../../Icons';
15
15
  import { startAIAssist } from '../startAIAssist';
16
16
  import './style.scss';
17
+ import { Spinner } from '../Spinner';
17
18
 
18
19
  const enableStopGeneration = false;
19
20
 
@@ -80,30 +81,28 @@ export const AIAssistWidget = ({
80
81
  : aiStreamId === null;
81
82
 
82
83
  return (
83
- showWidget && (
84
- <div className="vz-code-ai-assist-widget">
85
- <OverlayTrigger
86
- placement="left"
87
- overlay={
88
- <Tooltip id="ai-assist-widget-tooltip">
89
- {aiAssistTooltipText}
90
- </Tooltip>
91
- }
92
- >
93
- <i
94
- className="icon-button icon-button-dark"
95
- onClick={aiAssistClickOverride || handleClick}
84
+ <div className="vz-code-ai-assist-widget">
85
+ {aiStreamId ? (
86
+ <Spinner /> // Show spinner when aiStreamId is not null
87
+ ) : (
88
+ showWidget && (
89
+ <OverlayTrigger
90
+ placement="left"
91
+ overlay={
92
+ <Tooltip id="ai-assist-widget-tooltip">
93
+ {aiAssistTooltipText}
94
+ </Tooltip>
95
+ }
96
96
  >
97
- {aiStreamId ? (
98
- enableStopGeneration ? (
99
- <StopSVG />
100
- ) : null
101
- ) : (
97
+ <i
98
+ className="icon-button icon-button-dark"
99
+ onClick={aiAssistClickOverride || handleClick}
100
+ >
102
101
  <SparklesSVG />
103
- )}
104
- </i>
105
- </OverlayTrigger>
106
- </div>
107
- )
102
+ </i>
103
+ </OverlayTrigger>
104
+ )
105
+ )}
106
+ </div>
108
107
  );
109
108
  };
@@ -4,3 +4,42 @@
4
4
  right: 32px;
5
5
  color: var(--vh-color-caution-01);
6
6
  }
7
+
8
+ .vh-spinner {
9
+ display: flex;
10
+ height: 100%;
11
+ flex-direction: column;
12
+ align-items: center;
13
+ justify-content: center;
14
+ overflow: hidden;
15
+ }
16
+
17
+ /* Fade in after a delay */
18
+ /* https://stackoverflow.com/questions/29846224/css-animation-with-delay-and-opacity */
19
+ .vh-spinner.fade-in svg {
20
+ animation: 1s linear 0s normal forwards 1 fadein;
21
+ }
22
+
23
+ @keyframes fadein {
24
+ 0% {
25
+ opacity: 0;
26
+ }
27
+ 50% {
28
+ opacity: 0;
29
+ }
30
+ 100% {
31
+ opacity: 1;
32
+ }
33
+ }
34
+
35
+ /* Infinite rotation */
36
+ /* https://stackoverflow.com/questions/6410730/css-endless-rotation-animation */
37
+ .vh-spinner-dots {
38
+ animation: rotate 3s linear infinite;
39
+ }
40
+
41
+ @keyframes rotate {
42
+ to {
43
+ transform: rotate(360deg);
44
+ }
45
+ }
@@ -0,0 +1,76 @@
1
+ // From https://github.com/vizhub-core/vizhub/commit/6ca078935b9771dc6e05a6065bcfd522a4724dcf
2
+ import { useEffect, useState } from 'react';
3
+ import './AIAssistWidget/style.scss';
4
+
5
+ // const minRadius = 4;
6
+ // const maxRadius = 10;
7
+ // const numDots = 8;
8
+ // const wheelRadius = 40;
9
+ // const round = (number) => Math.floor(number * 100) / 100;
10
+ // const dots = [];
11
+ // for (let i = 0; i < numDots; i++) {
12
+ // const angle = (i / numDots) * Math.PI * 2;
13
+ // dots.push({
14
+ // x: round(Math.cos(angle) * wheelRadius),
15
+ // y: round(Math.sin(angle) * wheelRadius),
16
+ // r: round(
17
+ // minRadius +
18
+ // (i / (numDots - 1)) * (maxRadius - minRadius),
19
+ // ),
20
+ // });
21
+ // }
22
+ // console.log(JSON.stringify(dots));
23
+
24
+ // Hardcoded to avoid the computation.
25
+ const dots = [
26
+ { x: 40, y: 0, r: 4 },
27
+ { x: 28.28, y: 28.28, r: 4.85 },
28
+ { x: 0, y: 40, r: 5.71 },
29
+ { x: -28.29, y: 28.28, r: 6.57 },
30
+ { x: -40, y: 0, r: 7.42 },
31
+ { x: -28.29, y: -28.29, r: 8.28 },
32
+ { x: -0.01, y: -40, r: 9.14 },
33
+ { x: 28.28, y: -28.29, r: 10 },
34
+ ];
35
+
36
+ // From https://bl.ocks.org/curran/685fa8300650c4324d571c6b0ecc55de
37
+ // And vizhub-v2/packages/neoFrontend/src/LoadingScreen/index.js
38
+ export const Spinner = ({
39
+ height = 40,
40
+ fill = 'currentcolor',
41
+ fadeIn = true,
42
+ }) => {
43
+ const [show, setShow] = useState(false);
44
+
45
+ // Avoid SSR of all the SVG elements.
46
+ useEffect(() => {
47
+ setShow(true);
48
+ }, []);
49
+
50
+ return (
51
+ show && (
52
+ <div
53
+ className={`vh-spinner${fadeIn ? ' fade-in' : ''}`}
54
+ >
55
+ <svg
56
+ height={height}
57
+ viewBox="0 0 100 100"
58
+ style={{ opacity: 1 }}
59
+ >
60
+ <g transform="translate(50, 50)" fill={fill}>
61
+ <g className="vh-spinner-dots">
62
+ {dots.map(({ x, y, r }, i) => (
63
+ <circle
64
+ key={i}
65
+ cx={x}
66
+ cy={y}
67
+ r={r}
68
+ ></circle>
69
+ ))}
70
+ </g>
71
+ </g>
72
+ </svg>
73
+ </div>
74
+ )
75
+ );
76
+ };
@@ -12,6 +12,10 @@ export const CodeErrorOverlay = ({
12
12
  errorMessage: string | null;
13
13
  content: VZCodeContent;
14
14
  }) => {
15
+ // console.log(
16
+ // 'errorMessage in CodeErrorOverlay: ',
17
+ // errorMessage,
18
+ // );
15
19
  const [isOverlayVisible, setIsOverlayVisible] =
16
20
  useState(true);
17
21
 
@@ -23,9 +27,11 @@ export const CodeErrorOverlay = ({
23
27
  }, [errorMessage]);
24
28
 
25
29
  // If the content changes, set the overlay to be not visible.
26
- useEffect(() => {
27
- setIsOverlayVisible(false);
28
- }, [content]);
30
+ // Removed because it was interfering in the case of
31
+ // server-side build errors on page load.
32
+ // useEffect(() => {
33
+ // setIsOverlayVisible(false);
34
+ // }, [content]);
29
35
 
30
36
  // Set the visibility state to false when the button is clicked
31
37
  const handleCloseClick = useCallback(() => {
@@ -7,25 +7,27 @@
7
7
  bottom: 0;
8
8
  left: 0;
9
9
  right: 0;
10
- margin: 0;
11
- padding: 12px 16px;
10
+ margin: 0 12px;
11
+ /* Right padding is so that the wrapped text
12
+ doesn't overlap with the .error-dismiss-button */
13
+ padding: 14px 38px 14px 16px;
12
14
  border-top-left-radius: 4px;
13
15
  border-top-right-radius: 4px;
14
16
 
15
- /* Add a box shadow for a subtle effect */
16
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
17
-
18
17
  /* Style the monospace font */
19
18
  pre {
20
19
  font-family: var(--vzcode-font-family);
21
20
  font-size: var(--vzcode-font-size);
22
21
  margin: 0;
22
+
23
+ /* Wrap long lines */
24
+ white-space: pre-wrap;
23
25
  }
24
26
 
25
27
  /* Customize the dismiss button style */
26
28
  .error-dismiss-button {
27
29
  position: absolute;
28
- top: 5px; /* Adjust the top position */
29
- right: 5px; /* Adjust the right position */
30
+ top: 8px;
31
+ right: 8px;
30
32
  }
31
33
  }
@@ -149,6 +149,7 @@ export const Item = ({
149
149
  <div className="name">
150
150
  {isRenaming ? (
151
151
  <input
152
+ className="rename-input"
152
153
  ref={renameInputRef}
153
154
  type="text"
154
155
  aria-label="Field name"
@@ -88,6 +88,12 @@
88
88
  }
89
89
  }
90
90
 
91
+ .rename-input {
92
+ padding: 0px;
93
+ border: 0px;
94
+ margin: 0px;
95
+ }
96
+
91
97
  .indentation {
92
98
  margin-left: 20px;
93
99
  }