vzcode 0.63.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-cVB2xPdw.js"></script>
24
- <link rel="stylesheet" crossorigin href="/assets/index-7hPfA_d2.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.63.0",
3
+ "version": "0.64.0",
4
4
  "description": "Multiplayer code editor system",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -113,13 +113,13 @@
113
113
  },
114
114
  "devDependencies": {
115
115
  "@types/react": "^18.2.55",
116
- "@types/react-dom": "^18.2.18",
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
+ };