@vuu-ui/vuu-shell 0.8.94 → 0.8.96
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/cjs/app-status-bar/AppStatusBar.css.js +1 -1
- package/cjs/connection-status/ConnectionStateDisplay.css.js +1 -1
- package/cjs/connection-status/ConnectionStateDisplay.js +15 -7
- package/cjs/connection-status/ConnectionStateDisplay.js.map +1 -1
- package/cjs/connection-status/ConnectionStatusIndicator.css.js +1 -1
- package/cjs/connection-status/ConnectionStatusIndicator.js +2 -0
- package/cjs/connection-status/ConnectionStatusIndicator.js.map +1 -1
- package/esm/app-status-bar/AppStatusBar.css.js +1 -1
- package/esm/connection-status/ConnectionStateDisplay.css.js +1 -1
- package/esm/connection-status/ConnectionStateDisplay.js +15 -7
- package/esm/connection-status/ConnectionStateDisplay.js.map +1 -1
- package/esm/connection-status/ConnectionStatusIndicator.css.js +1 -1
- package/esm/connection-status/ConnectionStatusIndicator.js +2 -0
- package/esm/connection-status/ConnectionStatusIndicator.js.map +1 -1
- package/package.json +12 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var appStatusBarCss = ".vuuAppStatusBar {\n align-items: center;\n background-color: var(--salt-container-secondary-background);\n display: flex;\n height: 36px;\n justify-content: flex-end;\n
|
|
3
|
+
var appStatusBarCss = ".vuuAppStatusBar {\n align-items: center;\n background-color: var(--salt-container-secondary-background);\n display: flex;\n height: 36px;\n justify-content: flex-end;\n}\n.vuuAppStatusBar-hidden {\n display: none;\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = appStatusBarCss;
|
|
6
6
|
//# sourceMappingURL=AppStatusBar.css.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var connectionStateDisplayCss = ".vuuConnectionStateDisplay {\n --ballbox-height:
|
|
3
|
+
var connectionStateDisplayCss = ".vuuConnectionStateDisplay {\n --ballbox-height: 24px;\n --message-height: 14px;\n --row-gap: 3px;\n --top-row: calc(var(--ballbox-height) + var(--message-height));\n --bottom-row: 0px;\n\n align-items: center;\n background: var(--salt-container-secondary-background);\n column-gap: var(--salt-spacing-200);\n display: grid;\n grid-template-columns: auto 1fr;\n grid-template-rows: var(--top-row) var(--bottom-row);\n justify-items: end;\n height: calc(var(--ballbox-height) + var(--message-height) + var(--row-gap));\n padding: 0 var(--salt-spacing-200);\n transition: grid-template-rows 0.4s linear;\n row-gap: var(--row-gap);\n width: max-content;\n\n .vuuTrafficLightControl {\n grid-area: 1/2/2/3;\n padding-left: 20px;\n }\n\n &.vuuConnectionStateDisplay-disconnected {\n --top-row: var(--ballbox-height);\n --bottom-row: var(--message-height);\n }\n\n .vuuConnectionRetryCountdown {\n color: var(--salt-content-secondary-foreground);\n grid-area: 2/2/3/3;\n font-size: 11px;\n text-align: end;\n width: 100%;\n }\n}\n\n.vuuConnectionStateDisplay-text {\n grid-area: 1/1/2/2;\n text-transform: capitalize;\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = connectionStateDisplayCss;
|
|
6
6
|
//# sourceMappingURL=ConnectionStateDisplay.css.js.map
|
|
@@ -7,6 +7,7 @@ var window = require('@salt-ds/window');
|
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var ConnectionRetryCountdown = require('./ConnectionRetryCountdown.js');
|
|
9
9
|
var ConnectionStatusIndicator = require('./ConnectionStatusIndicator.js');
|
|
10
|
+
var cx = require('clsx');
|
|
10
11
|
var ConnectionStateDisplay$1 = require('./ConnectionStateDisplay.css.js');
|
|
11
12
|
|
|
12
13
|
const classBase = "vuuConnectionStateDisplay";
|
|
@@ -20,11 +21,11 @@ const DefaultConnectionState = {
|
|
|
20
21
|
const getDisplayText = (connectionState) => {
|
|
21
22
|
switch (connectionState.connectionStatus) {
|
|
22
23
|
case "closed":
|
|
23
|
-
return "
|
|
24
|
+
return "Unable to connect to data service";
|
|
24
25
|
case "failed":
|
|
25
26
|
return connectionState.connectionPhase === "connecting" ? "Failed to connect" : "Failed to re-connect";
|
|
26
27
|
case "disconnected":
|
|
27
|
-
return connectionState.connectionPhase === "connecting" ? "
|
|
28
|
+
return connectionState.connectionPhase === "connecting" ? "Attempting to connect to data service" : "Attempting to reconnect to data service";
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
const ConnectionStateDisplay = ({
|
|
@@ -46,11 +47,18 @@ const ConnectionStateDisplay = ({
|
|
|
46
47
|
}
|
|
47
48
|
}, [connectionStateProp]);
|
|
48
49
|
const { connectionStatus, secondsToNextRetry } = connectionState;
|
|
49
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
51
|
+
"div",
|
|
52
|
+
{
|
|
53
|
+
...htmlAttributes,
|
|
54
|
+
className: cx(classBase, `${classBase}-${connectionStatus}`),
|
|
55
|
+
children: [
|
|
56
|
+
showText ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classBase}-text`, children: getDisplayText(connectionState) }) : null,
|
|
57
|
+
connectionStatus === "disconnected" && secondsToNextRetry > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ConnectionRetryCountdown.ConnectionRetryCountdown, { seconds: secondsToNextRetry }) : null,
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsx(ConnectionStatusIndicator.ConnectionStatusIndicator, { connectionState })
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
54
62
|
};
|
|
55
63
|
|
|
56
64
|
exports.ConnectionStateDisplay = ConnectionStateDisplay;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionStateDisplay.js","sources":["../../src/connection-status/ConnectionStateDisplay.tsx"],"sourcesContent":["import { ConnectionManager } from \"@vuu-ui/vuu-data-remote\";\nimport type { WebSocketConnectionState } from \"@vuu-ui/vuu-data-remote/src/WebSocketConnection\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { HTMLAttributes, useMemo, useState } from \"react\";\nimport { ConnectionRetryCountdown } from \"./ConnectionRetryCountdown\";\nimport { ConnectionStatusIndicator } from \"./ConnectionStatusIndicator\";\n\nimport connectionStateDisplayCss from \"./ConnectionStateDisplay.css\";\n\nconst classBase = \"vuuConnectionStateDisplay\";\n\nconst DefaultConnectionState: WebSocketConnectionState = {\n connectionPhase: \"connecting\",\n connectionStatus: \"closed\",\n secondsToNextRetry: -1,\n retryAttemptsRemaining: 0,\n retryAttemptsTotal: 1,\n};\n\ninterface ConnectionStateDisplayProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n connectionState?: WebSocketConnectionState;\n showText?: boolean;\n}\n\nconst getDisplayText = (connectionState: WebSocketConnectionState) => {\n switch (connectionState.connectionStatus) {\n case \"closed\":\n return \"
|
|
1
|
+
{"version":3,"file":"ConnectionStateDisplay.js","sources":["../../src/connection-status/ConnectionStateDisplay.tsx"],"sourcesContent":["import { ConnectionManager } from \"@vuu-ui/vuu-data-remote\";\nimport type { WebSocketConnectionState } from \"@vuu-ui/vuu-data-remote/src/WebSocketConnection\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { HTMLAttributes, useMemo, useState } from \"react\";\nimport { ConnectionRetryCountdown } from \"./ConnectionRetryCountdown\";\nimport { ConnectionStatusIndicator } from \"./ConnectionStatusIndicator\";\nimport cx from \"clsx\";\n\nimport connectionStateDisplayCss from \"./ConnectionStateDisplay.css\";\n\nconst classBase = \"vuuConnectionStateDisplay\";\n\nconst DefaultConnectionState: WebSocketConnectionState = {\n connectionPhase: \"connecting\",\n connectionStatus: \"closed\",\n secondsToNextRetry: -1,\n retryAttemptsRemaining: 0,\n retryAttemptsTotal: 1,\n};\n\ninterface ConnectionStateDisplayProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n connectionState?: WebSocketConnectionState;\n showText?: boolean;\n}\n\nconst getDisplayText = (connectionState: WebSocketConnectionState) => {\n switch (connectionState.connectionStatus) {\n case \"closed\":\n return \"Unable to connect to data service\";\n case \"failed\":\n return connectionState.connectionPhase === \"connecting\"\n ? \"Failed to connect\"\n : \"Failed to re-connect\";\n\n case \"disconnected\":\n return connectionState.connectionPhase === \"connecting\"\n ? \"Attempting to connect to data service\"\n : \"Attempting to reconnect to data service\";\n }\n};\n\nexport const ConnectionStateDisplay = ({\n connectionState: connectionStateProp,\n showText = true,\n ...htmlAttributes\n}: ConnectionStateDisplayProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-connection-status-indicator\",\n css: connectionStateDisplayCss,\n window: targetWindow,\n });\n const [connectionState, setConnectionState] =\n useState<WebSocketConnectionState>(DefaultConnectionState);\n\n useMemo(() => {\n ConnectionManager.on(\"connection-status\", setConnectionState);\n if (connectionStateProp) {\n setConnectionState(connectionStateProp);\n }\n }, [connectionStateProp]);\n\n const { connectionStatus, secondsToNextRetry } = connectionState;\n\n return (\n <div\n {...htmlAttributes}\n className={cx(classBase, `${classBase}-${connectionStatus}`)}\n >\n {showText ? (\n <div className={`${classBase}-text`}>\n {getDisplayText(connectionState)}\n </div>\n ) : null}\n {connectionStatus === \"disconnected\" && secondsToNextRetry > 0 ? (\n <ConnectionRetryCountdown seconds={secondsToNextRetry} />\n ) : null}\n <ConnectionStatusIndicator connectionState={connectionState} />\n </div>\n );\n};\n"],"names":["useWindow","useComponentCssInjection","connectionStateDisplayCss","useState","useMemo","ConnectionManager","jsxs","jsx","ConnectionRetryCountdown","ConnectionStatusIndicator"],"mappings":";;;;;;;;;;;;AAWA,MAAM,SAAY,GAAA,2BAAA,CAAA;AAElB,MAAM,sBAAmD,GAAA;AAAA,EACvD,eAAiB,EAAA,YAAA;AAAA,EACjB,gBAAkB,EAAA,QAAA;AAAA,EAClB,kBAAoB,EAAA,CAAA,CAAA;AAAA,EACpB,sBAAwB,E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AAAA,MACJ,WAAW,EAAG,CAAA,SAAA,EAAW,GAAG,SAAS,CAAA,CAAA,EAAI,gBAAgB,CAAE,CAAA,CAAA;AAAA,MAE1D,QAAA,EAAA;AAAA,QACC,QAAA,mBAAAC,cAAA,CAAC,SAAI,SAAW,EAAA,CAAA,EAAG,SAAS,CACzB,KAAA,CAAA,EAAA,QAAA,EAAA,cAAA,CAAe,eAAe,CAAA,EACjC,CACE,GAAA,IAAA;AAAA,QACH,gBAAA,KAAqB,kBAAkB,kBAAqB,GAAA,CAAA,kCAC1DC,iDAAyB,EAAA,EAAA,OAAA,EAAS,oBAAoB,CACrD,GAAA,IAAA;AAAA,wBACJD,cAAA,CAACE,uDAA0B,eAAkC,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GAC/D,CAAA;AAEJ;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var connectionStatusIndicatorCss = "@keyframes squeeze {\n 0% {\n transform: scale(1);\n }\n\n 50% {\n transform: scale(0.85);\n }\n\n 100% {\n transform: scale(1);\n }\n}\n\n.ConnectionStatusIndicator {\n --ball-size-large: 20px;\n --ball-size-small: 14px;\n --ballbox-padding: 4px;\n
|
|
3
|
+
var connectionStatusIndicatorCss = "@keyframes squeeze {\n 0% {\n transform: scale(1);\n }\n\n 50% {\n transform: scale(0.85);\n }\n\n 100% {\n transform: scale(1);\n }\n}\n\n.ConnectionStatusIndicator {\n --ball-size-large: 20px;\n --ball-size-small: 14px;\n --ballbox-padding: 4px;\n --retry-count: 0;\n --height: var(\n --ballbox-height,\n calc(var(--ball-size-large) + var(--salt-spacing-100))\n );\n height: var(--height);\n padding: 0 4px;\n position: relative;\n width: calc(\n var(--ball-size-large) + var(--salt-spacing-400) +\n (var(--ball-size-small) + var(--salt-spacing-100)) * var(--retry-count)\n );\n\n &.expanded {\n transition-delay: 1s;\n .Ball.large {\n animation-duration: 0.8s;\n animation-name: squeeze;\n transform-origin: center;\n }\n .Ball.small {\n transform: translateX(calc(var(--ball-size-large) * var(--i)));\n }\n }\n}\n\n.ConnectionStatusIndicator-inactive {\n --ball-color: lightgray;\n}\n\n.ConnectionStatusIndicator-closed {\n --ball-color: red;\n opacity: 0.8;\n .Ball.large {\n transition: background-color 1s linear;\n }\n}\n\n.ConnectionStatusIndicator-connected {\n --ball-color: green;\n}\n\n.ConnectionStatusIndicator-disconnected {\n --ball-color: red;\n}\n\n.Ball.large {\n background-color: var(--ball-color);\n border-radius: calc(var(--ball-size-large) / 2);\n height: var(--ball-size-large);\n right: var(--ballbox-padding);\n top: calc(var(--height) / 2 - (var(--ball-size-large) / 2));\n position: absolute;\n transition: transform 0.8s linear;\n\n width: var(--ball-size-large);\n z-index: 1;\n}\n\n.Ball.small {\n background-color: var(--ball-color);\n border-radius: calc(var(--ball-size-small) / 2);\n height: var(--ball-size-small);\n position: absolute;\n right: calc(\n var(--ballbox-padding) + (var(--ball-size-large) - var(--ball-size-small)) /\n 2\n );\n top: calc(var(--height) / 2 - (var(--ball-size-small) / 2));\n width: var(--ball-size-small);\n\n transition: transform 0.4s ease-out;\n transition-delay: 0.1s;\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = connectionStatusIndicatorCss;
|
|
6
6
|
//# sourceMappingURL=ConnectionStatusIndicator.css.js.map
|
|
@@ -60,6 +60,7 @@ const ConnectionStatusIndicator = ({
|
|
|
60
60
|
};
|
|
61
61
|
const balls = getSmallBalls();
|
|
62
62
|
const displayState = connectionStatus;
|
|
63
|
+
const retryCount = connectionStatus === "disconnected" ? retryAttemptsTotal : 0;
|
|
63
64
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
64
65
|
"div",
|
|
65
66
|
{
|
|
@@ -67,6 +68,7 @@ const ConnectionStatusIndicator = ({
|
|
|
67
68
|
expanded: expandedRef.current
|
|
68
69
|
}),
|
|
69
70
|
ref: ballbox,
|
|
71
|
+
style: { "--retry-count": retryCount },
|
|
70
72
|
children: [
|
|
71
73
|
/* @__PURE__ */ jsxRuntime.jsx(Ball, { large: true }),
|
|
72
74
|
balls
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionStatusIndicator.js","sources":["../../src/connection-status/ConnectionStatusIndicator.tsx"],"sourcesContent":["import { CSSProperties, memo, useMemo, useRef } from \"react\";\nimport type { WebSocketConnectionState } from \"@vuu-ui/vuu-data-remote\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nimport cx from \"clsx\";\n\nimport connectionStatusIndicatorCss from \"./ConnectionStatusIndicator.css\";\n\nconst classBase = \"ConnectionStatusIndicator\";\n\ninterface BallProps {\n background?: string;\n i?: number;\n large?: boolean;\n}\nconst Ball = memo(({ background, i = 0, large = false }: BallProps) => {\n if (large) {\n return <div className=\"Ball large\" key={i} style={{ background }} />;\n } else {\n return (\n <div\n className=\"Ball small\"\n key={i}\n style={{ \"--i\": -(i + 1), background } as CSSProperties}\n />\n );\n }\n});\nBall.displayName = \"Ball\";\n\ninterface ConnectionStatusIndicatorProps {\n connectionState: WebSocketConnectionState;\n}\n\nexport const ConnectionStatusIndicator = ({\n connectionState,\n}: ConnectionStatusIndicatorProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-connection-status-indicator\",\n css: connectionStatusIndicatorCss,\n window: targetWindow,\n });\n\n const ballbox = useRef<HTMLDivElement>(null);\n const expandedRef = useRef(false);\n const { connectionStatus, retryAttemptsRemaining, retryAttemptsTotal } =\n connectionState;\n\n if (connectionStatus === \"disconnected\") {\n // one way switch\n expandedRef.current = true;\n }\n const finalState =\n connectionStatus === \"connected\" || connectionStatus === \"closed\";\n\n useMemo(() => {\n if (finalState) {\n expandedRef.current = false;\n }\n }, [finalState]);\n\n const getSmallBalls = () => {\n const colors = Array(retryAttemptsTotal).fill(\"lightgray\");\n const index = retryAttemptsTotal - retryAttemptsRemaining;\n if (retryAttemptsRemaining) {\n colors[index] = \"orange\";\n for (let i = 0; i < index; i++) {\n colors[i] = \"red\";\n }\n } else {\n colors.fill(\"red\");\n }\n colors.reverse();\n return colors.map((background, i) => (\n <Ball key={i} i={i} background={background} />\n ));\n };\n\n const balls = getSmallBalls();\n\n // const displayState = balls.length > 0 ? \"disconnected\" : connectionStatus;\n const displayState = connectionStatus;\n\n return (\n <div\n className={cx(classBase, `${classBase}-${displayState}`, {\n expanded: expandedRef.current,\n })}\n ref={ballbox}\n >\n <Ball large />\n {balls}\n </div>\n );\n};\n"],"names":["memo","jsx","useWindow","useComponentCssInjection","connectionStatusIndicatorCss","useRef","useMemo","jsxs"],"mappings":";;;;;;;;;AASA,MAAM,SAAY,GAAA,2BAAA,CAAA;AAOlB,MAAM,IAAA,GAAOA,WAAK,CAAC,EAAE,YAAY,CAAI,GAAA,CAAA,EAAG,KAAQ,GAAA,KAAA,EAAuB,KAAA;AACrE,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAAC,cAAA,CAAC,SAAI,SAAU,EAAA,YAAA,EAAqB,OAAO,EAAE,UAAA,MAAZ,CAA0B,CAAA,CAAA;AAAA,GAC7D,MAAA;AACL,IACE,uBAAAA,cAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAU,EAAA,YAAA;AAAA,QAEV,OAAO,EAAE,KAAA,EAAO,EAAE,CAAA,GAAI,IAAI,UAAW,EAAA;AAAA,OAAA;AAAA,MADhC,CAAA;AAAA,KAEP,CAAA;AAAA,GAEJ;AACF,CAAC,CAAA,CAAA;AACD,IAAA,CAAK,WAAc,GAAA,MAAA,CAAA;AAMZ,MAAM,4BAA4B,CAAC;AAAA,EACxC,eAAA;AACF,CAAsC,KAAA;AACpC,EAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,EAAyBC,+BAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,iCAAA;AAAA,IACR,GAAK,EAAAC,2BAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAA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A,CAAA;AAAA,GACH,CAAA;AAEA,EAAA,MAAM,QAAQ,aAAc,EAAA,CAAA;AAG5B,EAAA,MAAM,YAAe,GAAA,gBAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"ConnectionStatusIndicator.js","sources":["../../src/connection-status/ConnectionStatusIndicator.tsx"],"sourcesContent":["import { CSSProperties, memo, useMemo, useRef } from \"react\";\nimport type { WebSocketConnectionState } from \"@vuu-ui/vuu-data-remote\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nimport cx from \"clsx\";\n\nimport connectionStatusIndicatorCss from \"./ConnectionStatusIndicator.css\";\n\nconst classBase = \"ConnectionStatusIndicator\";\n\ninterface BallProps {\n background?: string;\n i?: number;\n large?: boolean;\n}\nconst Ball = memo(({ background, i = 0, large = false }: BallProps) => {\n if (large) {\n return <div className=\"Ball large\" key={i} style={{ background }} />;\n } else {\n return (\n <div\n className=\"Ball small\"\n key={i}\n style={{ \"--i\": -(i + 1), background } as CSSProperties}\n />\n );\n }\n});\nBall.displayName = \"Ball\";\n\ninterface ConnectionStatusIndicatorProps {\n connectionState: WebSocketConnectionState;\n}\n\nexport const ConnectionStatusIndicator = ({\n connectionState,\n}: ConnectionStatusIndicatorProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-connection-status-indicator\",\n css: connectionStatusIndicatorCss,\n window: targetWindow,\n });\n\n const ballbox = useRef<HTMLDivElement>(null);\n const expandedRef = useRef(false);\n const { connectionStatus, retryAttemptsRemaining, retryAttemptsTotal } =\n connectionState;\n\n if (connectionStatus === \"disconnected\") {\n // one way switch\n expandedRef.current = true;\n }\n const finalState =\n connectionStatus === \"connected\" || connectionStatus === \"closed\";\n\n useMemo(() => {\n if (finalState) {\n expandedRef.current = false;\n }\n }, [finalState]);\n\n const getSmallBalls = () => {\n const colors = Array(retryAttemptsTotal).fill(\"lightgray\");\n const index = retryAttemptsTotal - retryAttemptsRemaining;\n if (retryAttemptsRemaining) {\n colors[index] = \"orange\";\n for (let i = 0; i < index; i++) {\n colors[i] = \"red\";\n }\n } else {\n colors.fill(\"red\");\n }\n colors.reverse();\n return colors.map((background, i) => (\n <Ball key={i} i={i} background={background} />\n ));\n };\n\n const balls = getSmallBalls();\n\n // const displayState = balls.length > 0 ? \"disconnected\" : connectionStatus;\n const displayState = connectionStatus;\n const retryCount =\n connectionStatus === \"disconnected\" ? retryAttemptsTotal : 0;\n\n return (\n <div\n className={cx(classBase, `${classBase}-${displayState}`, {\n expanded: expandedRef.current,\n })}\n ref={ballbox}\n style={{ \"--retry-count\": retryCount } as CSSProperties}\n >\n <Ball large />\n {balls}\n </div>\n );\n};\n"],"names":["memo","jsx","useWindow","useComponentCssInjection","connectionStatusIndicatorCss","useRef","useMemo","jsxs"],"mappings":";;;;;;;;;AASA,MAAM,SAAY,GAAA,2BAAA,CAAA;AAOlB,MAAM,IAAA,GAAOA,WAAK,CAAC,EAAE,YAAY,CAAI,GAAA,CAAA,EAAG,KAAQ,GAAA,KAAA,EAAuB,KAAA;AACrE,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAAC,cAAA,CAAC,SAAI,SAAU,EAAA,YAAA,EAAqB,OAAO,EAAE,UAAA,MAAZ,CAA0B,CAAA,CAAA;AAAA,GAC7D,MAAA;AACL,IACE,uBAAAA,cAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAU,EAAA,YAAA;AAAA,QAEV,OAAO,EAAE,KAAA,EAAO,EAAE,CAAA,GAAI,IAAI,UAAW,EAAA;AAAA,OAAA;AAAA,MADhC,CAAA;AAAA,KAEP,CAAA;AAAA,GAEJ;AACF,CAAC,CAAA,CAAA;AACD,IAAA,CAAK,WAAc,GAAA,MAAA,CAAA;AAMZ,MAAM,4BAA4B,CAAC;AAAA,EACxC,eAAA;AACF,CAAsC,KAAA;AACpC,EAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,EAAyBC,+BAAA,CAAA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AAI,CAAA,CAAC,UAAY,EAAA,CAAA,oCAC5B,IAAa,EAAA,EAAA,CAAA,EAAM,UAAT,EAAA,EAAA,CAAiC,CAC7C,CAAA,CAAA;AAAA,GACH,CAAA;AAEA,EAAA,MAAM,QAAQ,aAAc,EAAA,CAAA;AAG5B,EAAA,MAAM,YAAe,GAAA,gBAAA,CAAA;AACrB,EAAM,MAAA,UAAA,GACJ,gBAAqB,KAAA,cAAA,GAAiB,kBAAqB,GAAA,CAAA,CAAA;AAE7D,EACE,uBAAAC,eAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAW,EAAG,CAAA,SAAA,EAAW,GAAG,SAAS,CAAA,CAAA,EAAI,YAAY,CAAI,CAAA,EAAA;AAAA,QACvD,UAAU,WAAY,CAAA,OAAA;AAAA,OACvB,CAAA;AAAA,MACD,GAAK,EAAA,OAAA;AAAA,MACL,KAAA,EAAO,EAAE,eAAA,EAAiB,UAAW,EAAA;AAAA,MAErC,QAAA,EAAA;AAAA,wBAACN,cAAA,CAAA,IAAA,EAAA,EAAK,OAAK,IAAC,EAAA,CAAA;AAAA,QACX,KAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var appStatusBarCss = ".vuuAppStatusBar {\n align-items: center;\n background-color: var(--salt-container-secondary-background);\n display: flex;\n height: 36px;\n justify-content: flex-end;\n
|
|
1
|
+
var appStatusBarCss = ".vuuAppStatusBar {\n align-items: center;\n background-color: var(--salt-container-secondary-background);\n display: flex;\n height: 36px;\n justify-content: flex-end;\n}\n.vuuAppStatusBar-hidden {\n display: none;\n}\n";
|
|
2
2
|
|
|
3
3
|
export { appStatusBarCss as default };
|
|
4
4
|
//# sourceMappingURL=AppStatusBar.css.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var connectionStateDisplayCss = ".vuuConnectionStateDisplay {\n --ballbox-height:
|
|
1
|
+
var connectionStateDisplayCss = ".vuuConnectionStateDisplay {\n --ballbox-height: 24px;\n --message-height: 14px;\n --row-gap: 3px;\n --top-row: calc(var(--ballbox-height) + var(--message-height));\n --bottom-row: 0px;\n\n align-items: center;\n background: var(--salt-container-secondary-background);\n column-gap: var(--salt-spacing-200);\n display: grid;\n grid-template-columns: auto 1fr;\n grid-template-rows: var(--top-row) var(--bottom-row);\n justify-items: end;\n height: calc(var(--ballbox-height) + var(--message-height) + var(--row-gap));\n padding: 0 var(--salt-spacing-200);\n transition: grid-template-rows 0.4s linear;\n row-gap: var(--row-gap);\n width: max-content;\n\n .vuuTrafficLightControl {\n grid-area: 1/2/2/3;\n padding-left: 20px;\n }\n\n &.vuuConnectionStateDisplay-disconnected {\n --top-row: var(--ballbox-height);\n --bottom-row: var(--message-height);\n }\n\n .vuuConnectionRetryCountdown {\n color: var(--salt-content-secondary-foreground);\n grid-area: 2/2/3/3;\n font-size: 11px;\n text-align: end;\n width: 100%;\n }\n}\n\n.vuuConnectionStateDisplay-text {\n grid-area: 1/1/2/2;\n text-transform: capitalize;\n}\n";
|
|
2
2
|
|
|
3
3
|
export { connectionStateDisplayCss as default };
|
|
4
4
|
//# sourceMappingURL=ConnectionStateDisplay.css.js.map
|
|
@@ -5,6 +5,7 @@ import { useWindow } from '@salt-ds/window';
|
|
|
5
5
|
import { useState, useMemo } from 'react';
|
|
6
6
|
import { ConnectionRetryCountdown } from './ConnectionRetryCountdown.js';
|
|
7
7
|
import { ConnectionStatusIndicator } from './ConnectionStatusIndicator.js';
|
|
8
|
+
import cx from 'clsx';
|
|
8
9
|
import connectionStateDisplayCss from './ConnectionStateDisplay.css.js';
|
|
9
10
|
|
|
10
11
|
const classBase = "vuuConnectionStateDisplay";
|
|
@@ -18,11 +19,11 @@ const DefaultConnectionState = {
|
|
|
18
19
|
const getDisplayText = (connectionState) => {
|
|
19
20
|
switch (connectionState.connectionStatus) {
|
|
20
21
|
case "closed":
|
|
21
|
-
return "
|
|
22
|
+
return "Unable to connect to data service";
|
|
22
23
|
case "failed":
|
|
23
24
|
return connectionState.connectionPhase === "connecting" ? "Failed to connect" : "Failed to re-connect";
|
|
24
25
|
case "disconnected":
|
|
25
|
-
return connectionState.connectionPhase === "connecting" ? "
|
|
26
|
+
return connectionState.connectionPhase === "connecting" ? "Attempting to connect to data service" : "Attempting to reconnect to data service";
|
|
26
27
|
}
|
|
27
28
|
};
|
|
28
29
|
const ConnectionStateDisplay = ({
|
|
@@ -44,11 +45,18 @@ const ConnectionStateDisplay = ({
|
|
|
44
45
|
}
|
|
45
46
|
}, [connectionStateProp]);
|
|
46
47
|
const { connectionStatus, secondsToNextRetry } = connectionState;
|
|
47
|
-
return /* @__PURE__ */ jsxs(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
return /* @__PURE__ */ jsxs(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
...htmlAttributes,
|
|
52
|
+
className: cx(classBase, `${classBase}-${connectionStatus}`),
|
|
53
|
+
children: [
|
|
54
|
+
showText ? /* @__PURE__ */ jsx("div", { className: `${classBase}-text`, children: getDisplayText(connectionState) }) : null,
|
|
55
|
+
connectionStatus === "disconnected" && secondsToNextRetry > 0 ? /* @__PURE__ */ jsx(ConnectionRetryCountdown, { seconds: secondsToNextRetry }) : null,
|
|
56
|
+
/* @__PURE__ */ jsx(ConnectionStatusIndicator, { connectionState })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
52
60
|
};
|
|
53
61
|
|
|
54
62
|
export { ConnectionStateDisplay };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionStateDisplay.js","sources":["../../src/connection-status/ConnectionStateDisplay.tsx"],"sourcesContent":["import { ConnectionManager } from \"@vuu-ui/vuu-data-remote\";\nimport type { WebSocketConnectionState } from \"@vuu-ui/vuu-data-remote/src/WebSocketConnection\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { HTMLAttributes, useMemo, useState } from \"react\";\nimport { ConnectionRetryCountdown } from \"./ConnectionRetryCountdown\";\nimport { ConnectionStatusIndicator } from \"./ConnectionStatusIndicator\";\n\nimport connectionStateDisplayCss from \"./ConnectionStateDisplay.css\";\n\nconst classBase = \"vuuConnectionStateDisplay\";\n\nconst DefaultConnectionState: WebSocketConnectionState = {\n connectionPhase: \"connecting\",\n connectionStatus: \"closed\",\n secondsToNextRetry: -1,\n retryAttemptsRemaining: 0,\n retryAttemptsTotal: 1,\n};\n\ninterface ConnectionStateDisplayProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n connectionState?: WebSocketConnectionState;\n showText?: boolean;\n}\n\nconst getDisplayText = (connectionState: WebSocketConnectionState) => {\n switch (connectionState.connectionStatus) {\n case \"closed\":\n return \"
|
|
1
|
+
{"version":3,"file":"ConnectionStateDisplay.js","sources":["../../src/connection-status/ConnectionStateDisplay.tsx"],"sourcesContent":["import { ConnectionManager } from \"@vuu-ui/vuu-data-remote\";\nimport type { WebSocketConnectionState } from \"@vuu-ui/vuu-data-remote/src/WebSocketConnection\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { HTMLAttributes, useMemo, useState } from \"react\";\nimport { ConnectionRetryCountdown } from \"./ConnectionRetryCountdown\";\nimport { ConnectionStatusIndicator } from \"./ConnectionStatusIndicator\";\nimport cx from \"clsx\";\n\nimport connectionStateDisplayCss from \"./ConnectionStateDisplay.css\";\n\nconst classBase = \"vuuConnectionStateDisplay\";\n\nconst DefaultConnectionState: WebSocketConnectionState = {\n connectionPhase: \"connecting\",\n connectionStatus: \"closed\",\n secondsToNextRetry: -1,\n retryAttemptsRemaining: 0,\n retryAttemptsTotal: 1,\n};\n\ninterface ConnectionStateDisplayProps extends HTMLAttributes<HTMLDivElement> {\n className?: string;\n connectionState?: WebSocketConnectionState;\n showText?: boolean;\n}\n\nconst getDisplayText = (connectionState: WebSocketConnectionState) => {\n switch (connectionState.connectionStatus) {\n case \"closed\":\n return \"Unable to connect to data service\";\n case \"failed\":\n return connectionState.connectionPhase === \"connecting\"\n ? \"Failed to connect\"\n : \"Failed to re-connect\";\n\n case \"disconnected\":\n return connectionState.connectionPhase === \"connecting\"\n ? \"Attempting to connect to data service\"\n : \"Attempting to reconnect to data service\";\n }\n};\n\nexport const ConnectionStateDisplay = ({\n connectionState: connectionStateProp,\n showText = true,\n ...htmlAttributes\n}: ConnectionStateDisplayProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-connection-status-indicator\",\n css: connectionStateDisplayCss,\n window: targetWindow,\n });\n const [connectionState, setConnectionState] =\n useState<WebSocketConnectionState>(DefaultConnectionState);\n\n useMemo(() => {\n ConnectionManager.on(\"connection-status\", setConnectionState);\n if (connectionStateProp) {\n setConnectionState(connectionStateProp);\n }\n }, [connectionStateProp]);\n\n const { connectionStatus, secondsToNextRetry } = connectionState;\n\n return (\n <div\n {...htmlAttributes}\n className={cx(classBase, `${classBase}-${connectionStatus}`)}\n >\n {showText ? (\n <div className={`${classBase}-text`}>\n {getDisplayText(connectionState)}\n </div>\n ) : null}\n {connectionStatus === \"disconnected\" && secondsToNextRetry > 0 ? (\n <ConnectionRetryCountdown seconds={secondsToNextRetry} />\n ) : null}\n <ConnectionStatusIndicator connectionState={connectionState} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAWA,MAAM,SAAY,GAAA,2BAAA,CAAA;AAElB,MAAM,sBAAmD,GAAA;AAAA,EACvD,eAAiB,EAAA,YAAA;AAAA,EACjB,gBAAkB,EAAA,QAAA;AAAA,EAClB,kBAAoB,EAAA,CAAA,CAAA;AAAA,EACpB,sBAAwB,EAAA,CAAA;AAAA,EACxB,kBAAoB,EAAA,CAAA;AACtB,CAAA,CAAA;AAQA,MAAM,cAAA,GAAiB,CAAC,eAA8C,KAAA;AACpE,EAAA,QAAQ,gBAAgB,gBAAkB;AAAA,IACxC,KAAK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AW,EAAA,CAAA,EAAG,SAAS,CACzB,KAAA,CAAA,EAAA,QAAA,EAAA,cAAA,CAAe,eAAe,CAAA,EACjC,CACE,GAAA,IAAA;AAAA,QACH,gBAAA,KAAqB,kBAAkB,kBAAqB,GAAA,CAAA,uBAC1D,wBAAyB,EAAA,EAAA,OAAA,EAAS,oBAAoB,CACrD,GAAA,IAAA;AAAA,wBACJ,GAAA,CAAC,6BAA0B,eAAkC,EAAA,CAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GAC/D,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var connectionStatusIndicatorCss = "@keyframes squeeze {\n 0% {\n transform: scale(1);\n }\n\n 50% {\n transform: scale(0.85);\n }\n\n 100% {\n transform: scale(1);\n }\n}\n\n.ConnectionStatusIndicator {\n --ball-size-large: 20px;\n --ball-size-small: 14px;\n --ballbox-padding: 4px;\n
|
|
1
|
+
var connectionStatusIndicatorCss = "@keyframes squeeze {\n 0% {\n transform: scale(1);\n }\n\n 50% {\n transform: scale(0.85);\n }\n\n 100% {\n transform: scale(1);\n }\n}\n\n.ConnectionStatusIndicator {\n --ball-size-large: 20px;\n --ball-size-small: 14px;\n --ballbox-padding: 4px;\n --retry-count: 0;\n --height: var(\n --ballbox-height,\n calc(var(--ball-size-large) + var(--salt-spacing-100))\n );\n height: var(--height);\n padding: 0 4px;\n position: relative;\n width: calc(\n var(--ball-size-large) + var(--salt-spacing-400) +\n (var(--ball-size-small) + var(--salt-spacing-100)) * var(--retry-count)\n );\n\n &.expanded {\n transition-delay: 1s;\n .Ball.large {\n animation-duration: 0.8s;\n animation-name: squeeze;\n transform-origin: center;\n }\n .Ball.small {\n transform: translateX(calc(var(--ball-size-large) * var(--i)));\n }\n }\n}\n\n.ConnectionStatusIndicator-inactive {\n --ball-color: lightgray;\n}\n\n.ConnectionStatusIndicator-closed {\n --ball-color: red;\n opacity: 0.8;\n .Ball.large {\n transition: background-color 1s linear;\n }\n}\n\n.ConnectionStatusIndicator-connected {\n --ball-color: green;\n}\n\n.ConnectionStatusIndicator-disconnected {\n --ball-color: red;\n}\n\n.Ball.large {\n background-color: var(--ball-color);\n border-radius: calc(var(--ball-size-large) / 2);\n height: var(--ball-size-large);\n right: var(--ballbox-padding);\n top: calc(var(--height) / 2 - (var(--ball-size-large) / 2));\n position: absolute;\n transition: transform 0.8s linear;\n\n width: var(--ball-size-large);\n z-index: 1;\n}\n\n.Ball.small {\n background-color: var(--ball-color);\n border-radius: calc(var(--ball-size-small) / 2);\n height: var(--ball-size-small);\n position: absolute;\n right: calc(\n var(--ballbox-padding) + (var(--ball-size-large) - var(--ball-size-small)) /\n 2\n );\n top: calc(var(--height) / 2 - (var(--ball-size-small) / 2));\n width: var(--ball-size-small);\n\n transition: transform 0.4s ease-out;\n transition-delay: 0.1s;\n}\n";
|
|
2
2
|
|
|
3
3
|
export { connectionStatusIndicatorCss as default };
|
|
4
4
|
//# sourceMappingURL=ConnectionStatusIndicator.css.js.map
|
|
@@ -58,6 +58,7 @@ const ConnectionStatusIndicator = ({
|
|
|
58
58
|
};
|
|
59
59
|
const balls = getSmallBalls();
|
|
60
60
|
const displayState = connectionStatus;
|
|
61
|
+
const retryCount = connectionStatus === "disconnected" ? retryAttemptsTotal : 0;
|
|
61
62
|
return /* @__PURE__ */ jsxs(
|
|
62
63
|
"div",
|
|
63
64
|
{
|
|
@@ -65,6 +66,7 @@ const ConnectionStatusIndicator = ({
|
|
|
65
66
|
expanded: expandedRef.current
|
|
66
67
|
}),
|
|
67
68
|
ref: ballbox,
|
|
69
|
+
style: { "--retry-count": retryCount },
|
|
68
70
|
children: [
|
|
69
71
|
/* @__PURE__ */ jsx(Ball, { large: true }),
|
|
70
72
|
balls
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionStatusIndicator.js","sources":["../../src/connection-status/ConnectionStatusIndicator.tsx"],"sourcesContent":["import { CSSProperties, memo, useMemo, useRef } from \"react\";\nimport type { WebSocketConnectionState } from \"@vuu-ui/vuu-data-remote\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nimport cx from \"clsx\";\n\nimport connectionStatusIndicatorCss from \"./ConnectionStatusIndicator.css\";\n\nconst classBase = \"ConnectionStatusIndicator\";\n\ninterface BallProps {\n background?: string;\n i?: number;\n large?: boolean;\n}\nconst Ball = memo(({ background, i = 0, large = false }: BallProps) => {\n if (large) {\n return <div className=\"Ball large\" key={i} style={{ background }} />;\n } else {\n return (\n <div\n className=\"Ball small\"\n key={i}\n style={{ \"--i\": -(i + 1), background } as CSSProperties}\n />\n );\n }\n});\nBall.displayName = \"Ball\";\n\ninterface ConnectionStatusIndicatorProps {\n connectionState: WebSocketConnectionState;\n}\n\nexport const ConnectionStatusIndicator = ({\n connectionState,\n}: ConnectionStatusIndicatorProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-connection-status-indicator\",\n css: connectionStatusIndicatorCss,\n window: targetWindow,\n });\n\n const ballbox = useRef<HTMLDivElement>(null);\n const expandedRef = useRef(false);\n const { connectionStatus, retryAttemptsRemaining, retryAttemptsTotal } =\n connectionState;\n\n if (connectionStatus === \"disconnected\") {\n // one way switch\n expandedRef.current = true;\n }\n const finalState =\n connectionStatus === \"connected\" || connectionStatus === \"closed\";\n\n useMemo(() => {\n if (finalState) {\n expandedRef.current = false;\n }\n }, [finalState]);\n\n const getSmallBalls = () => {\n const colors = Array(retryAttemptsTotal).fill(\"lightgray\");\n const index = retryAttemptsTotal - retryAttemptsRemaining;\n if (retryAttemptsRemaining) {\n colors[index] = \"orange\";\n for (let i = 0; i < index; i++) {\n colors[i] = \"red\";\n }\n } else {\n colors.fill(\"red\");\n }\n colors.reverse();\n return colors.map((background, i) => (\n <Ball key={i} i={i} background={background} />\n ));\n };\n\n const balls = getSmallBalls();\n\n // const displayState = balls.length > 0 ? \"disconnected\" : connectionStatus;\n const displayState = connectionStatus;\n\n return (\n <div\n className={cx(classBase, `${classBase}-${displayState}`, {\n expanded: expandedRef.current,\n })}\n ref={ballbox}\n >\n <Ball large />\n {balls}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AASA,MAAM,SAAY,GAAA,2BAAA,CAAA;AAOlB,MAAM,IAAA,GAAO,KAAK,CAAC,EAAE,YAAY,CAAI,GAAA,CAAA,EAAG,KAAQ,GAAA,KAAA,EAAuB,KAAA;AACrE,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,GAAA,CAAC,SAAI,SAAU,EAAA,YAAA,EAAqB,OAAO,EAAE,UAAA,MAAZ,CAA0B,CAAA,CAAA;AAAA,GAC7D,MAAA;AACL,IACE,uBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAU,EAAA,YAAA;AAAA,QAEV,OAAO,EAAE,KAAA,EAAO,EAAE,CAAA,GAAI,IAAI,UAAW,EAAA;AAAA,OAAA;AAAA,MADhC,CAAA;AAAA,KAEP,CAAA;AAAA,GAEJ;AACF,CAAC,CAAA,CAAA;AACD,IAAA,CAAK,WAAc,GAAA,MAAA,CAAA;AAMZ,MAAM,4BAA4B,CAAC;AAAA,EACxC,eAAA;AACF,CAAsC,KAAA;AACpC,EAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,iCAAA;AAAA,IACR,GAAK,EAAA,4BAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAM,MAAA,OAAA,GAAU,OAAuB,IAAI,CAAA,CAAA;AAC3C,EAAM,MAAA,WAAA,GAAc,OAAO,KAAK,CAAA,CAAA;AAChC,EAAA,MAAM,EAAE,gBAAA,EAAkB,sBAAwB,EAAA,kBAAA,EAChD,GAAA,eAAA,CAAA;AAEF,EAAA,IAAI,qBAAqB,cAAgB,EAAA;AAEvC,IAAA,WAAA,CAAY,OAAU,GAAA,IAAA,CAAA;AAAA,GACxB;AACA,EAAM,MAAA,UAAA,GACJ,gBAAqB,KAAA,WAAA,IAAe,gBAAqB,KAAA,QAAA,CAAA;AAE3D,EAAA,OAAA,CAAQ,MAAM;AACZ,IAAA,IAAI,UAAY,EAAA;AACd,MAAA,WAAA,CAAY,OAAU,GAAA,KAAA,CAAA;AAAA,KACxB;AAAA,GACF,EAAG,CAAC,UAAU,CAAC,CAAA,CAAA;AAEf,EAAA,MAAM,gBAAgB,MAAM;AAC1B,IAAA,MAAM,MAAS,GAAA,KAAA,CAAM,kBAAkB,CAAA,CAAE,KAAK,WAAW,CAAA,CAAA;AACzD,IAAA,MAAM,QAAQ,kBAAqB,GAAA,sBAAA,CAAA;AACnC,IAAA,IAAI,sBAAwB,EAAA;AAC1B,MAAA,MAAA,CAAO,KAAK,CAAI,GAAA,QAAA,CAAA;AAChB,MAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,EAAO,CAAK,EAAA,EAAA;AAC9B,QAAA,MAAA,CAAO,CAAC,CAAI,GAAA,KAAA,CAAA;AAAA,OACd;AAAA,KACK,MAAA;AACL,MAAA,MAAA,CAAO,KAAK,KAAK,CAAA,CAAA;AAAA,KACnB;AACA,IAAA,MAAA,CAAO,OAAQ,EAAA,CAAA;AACf,IAAO,OAAA,MAAA,CAAO,GAAI,CAAA,CAAC,UAAY,EAAA,CAAA,yBAC5B,IAAa,EAAA,EAAA,CAAA,EAAM,UAAT,EAAA,EAAA,CAAiC,CAC7C,CAAA,CAAA;AAAA,GACH,CAAA;AAEA,EAAA,MAAM,QAAQ,aAAc,EAAA,CAAA;AAG5B,EAAA,MAAM,YAAe,GAAA,gBAAA,CAAA;
|
|
1
|
+
{"version":3,"file":"ConnectionStatusIndicator.js","sources":["../../src/connection-status/ConnectionStatusIndicator.tsx"],"sourcesContent":["import { CSSProperties, memo, useMemo, useRef } from \"react\";\nimport type { WebSocketConnectionState } from \"@vuu-ui/vuu-data-remote\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nimport cx from \"clsx\";\n\nimport connectionStatusIndicatorCss from \"./ConnectionStatusIndicator.css\";\n\nconst classBase = \"ConnectionStatusIndicator\";\n\ninterface BallProps {\n background?: string;\n i?: number;\n large?: boolean;\n}\nconst Ball = memo(({ background, i = 0, large = false }: BallProps) => {\n if (large) {\n return <div className=\"Ball large\" key={i} style={{ background }} />;\n } else {\n return (\n <div\n className=\"Ball small\"\n key={i}\n style={{ \"--i\": -(i + 1), background } as CSSProperties}\n />\n );\n }\n});\nBall.displayName = \"Ball\";\n\ninterface ConnectionStatusIndicatorProps {\n connectionState: WebSocketConnectionState;\n}\n\nexport const ConnectionStatusIndicator = ({\n connectionState,\n}: ConnectionStatusIndicatorProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-connection-status-indicator\",\n css: connectionStatusIndicatorCss,\n window: targetWindow,\n });\n\n const ballbox = useRef<HTMLDivElement>(null);\n const expandedRef = useRef(false);\n const { connectionStatus, retryAttemptsRemaining, retryAttemptsTotal } =\n connectionState;\n\n if (connectionStatus === \"disconnected\") {\n // one way switch\n expandedRef.current = true;\n }\n const finalState =\n connectionStatus === \"connected\" || connectionStatus === \"closed\";\n\n useMemo(() => {\n if (finalState) {\n expandedRef.current = false;\n }\n }, [finalState]);\n\n const getSmallBalls = () => {\n const colors = Array(retryAttemptsTotal).fill(\"lightgray\");\n const index = retryAttemptsTotal - retryAttemptsRemaining;\n if (retryAttemptsRemaining) {\n colors[index] = \"orange\";\n for (let i = 0; i < index; i++) {\n colors[i] = \"red\";\n }\n } else {\n colors.fill(\"red\");\n }\n colors.reverse();\n return colors.map((background, i) => (\n <Ball key={i} i={i} background={background} />\n ));\n };\n\n const balls = getSmallBalls();\n\n // const displayState = balls.length > 0 ? \"disconnected\" : connectionStatus;\n const displayState = connectionStatus;\n const retryCount =\n connectionStatus === \"disconnected\" ? retryAttemptsTotal : 0;\n\n return (\n <div\n className={cx(classBase, `${classBase}-${displayState}`, {\n expanded: expandedRef.current,\n })}\n ref={ballbox}\n style={{ \"--retry-count\": retryCount } as CSSProperties}\n >\n <Ball large />\n {balls}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;AASA,MAAM,SAAY,GAAA,2BAAA,CAAA;AAOlB,MAAM,IAAA,GAAO,KAAK,CAAC,EAAE,YAAY,CAAI,GAAA,CAAA,EAAG,KAAQ,GAAA,KAAA,EAAuB,KAAA;AACrE,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,GAAA,CAAC,SAAI,SAAU,EAAA,YAAA,EAAqB,OAAO,EAAE,UAAA,MAAZ,CAA0B,CAAA,CAAA;AAAA,GAC7D,MAAA;AACL,IACE,uBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAU,EAAA,YAAA;AAAA,QAEV,OAAO,EAAE,KAAA,EAAO,EAAE,CAAA,GAAI,IAAI,UAAW,EAAA;AAAA,OAAA;AAAA,MADhC,CAAA;AAAA,KAEP,CAAA;AAAA,GAEJ;AACF,CAAC,CAAA,CAAA;AACD,IAAA,CAAK,WAAc,GAAA,MAAA,CAAA;AAMZ,MAAM,4BAA4B,CAAC;AAAA,EACxC,eAAA;AACF,CAAsC,KAAA;AACpC,EAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,iCAAA;AAAA,IACR,GAAK,EAAA,4BAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAM,MAAA,OAAA,GAAU,OAAuB,IAAI,CAAA,CAAA;AAC3C,EAAM,MAAA,WAAA,GAAc,OAAO,KAAK,CAAA,CAAA;AAChC,EAAA,MAAM,EAAE,gBAAA,EAAkB,sBAAwB,EAAA,kBAAA,EAChD,GAAA,eAAA,CAAA;AAEF,EAAA,IAAI,qBAAqB,cAAgB,EAAA;AAEvC,IAAA,WAA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,WAAW,EAAG,CAAA,SAAA,EAAW,GAAG,SAAS,CAAA,CAAA,EAAI,YAAY,CAAI,CAAA,EAAA;AAAA,QACvD,UAAU,WAAY,CAAA,OAAA;AAAA,OACvB,CAAA;AAAA,MACD,GAAK,EAAA,OAAA;AAAA,MACL,KAAA,EAAO,EAAE,eAAA,EAAiB,UAAW,EAAA;AAAA,MAErC,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,OAAK,IAAC,EAAA,CAAA;AAAA,QACX,KAAA;AAAA,OAAA;AAAA,KAAA;AAAA,GACH,CAAA;AAEJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.8.
|
|
2
|
+
"version": "0.8.96",
|
|
3
3
|
"description": "VUU UI Shell",
|
|
4
4
|
"author": "heswell",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"@vuu-ui/vuu-data-types": "0.8.
|
|
8
|
-
"@vuu-ui/vuu-protocol-types": "0.8.
|
|
9
|
-
"@vuu-ui/vuu-table-types": "0.8.
|
|
7
|
+
"@vuu-ui/vuu-data-types": "0.8.96",
|
|
8
|
+
"@vuu-ui/vuu-protocol-types": "0.8.96",
|
|
9
|
+
"@vuu-ui/vuu-table-types": "0.8.96"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@salt-ds/core": "1.34.0",
|
|
13
13
|
"@salt-ds/styles": "0.2.1",
|
|
14
14
|
"@salt-ds/window": "0.1.1",
|
|
15
|
-
"@vuu-ui/vuu-data-react": "0.8.
|
|
16
|
-
"@vuu-ui/vuu-data-remote": "0.8.
|
|
17
|
-
"@vuu-ui/vuu-icons": "0.8.
|
|
18
|
-
"@vuu-ui/vuu-layout": "0.8.
|
|
19
|
-
"@vuu-ui/vuu-popups": "0.8.
|
|
20
|
-
"@vuu-ui/vuu-table": "0.8.
|
|
21
|
-
"@vuu-ui/vuu-ui-controls": "0.8.
|
|
22
|
-
"@vuu-ui/vuu-utils": "0.8.
|
|
15
|
+
"@vuu-ui/vuu-data-react": "0.8.96",
|
|
16
|
+
"@vuu-ui/vuu-data-remote": "0.8.96",
|
|
17
|
+
"@vuu-ui/vuu-icons": "0.8.96",
|
|
18
|
+
"@vuu-ui/vuu-layout": "0.8.96",
|
|
19
|
+
"@vuu-ui/vuu-popups": "0.8.96",
|
|
20
|
+
"@vuu-ui/vuu-table": "0.8.96",
|
|
21
|
+
"@vuu-ui/vuu-ui-controls": "0.8.96",
|
|
22
|
+
"@vuu-ui/vuu-utils": "0.8.96",
|
|
23
23
|
"html-to-image": "^1.11.11"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|