@cloudscape-design/board-components 3.0.37 → 3.0.39
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.
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
3
|
+
import { useRuntimeVisualRefresh } from "@cloudscape-design/component-toolkit/internal";
|
|
4
4
|
import { ALWAYS_VISUAL_REFRESH } from "../environment";
|
|
5
|
-
export const useVisualRefresh = ALWAYS_VISUAL_REFRESH ? () => true :
|
|
6
|
-
// We expect VR is to be set only once and before the application is rendered.
|
|
7
|
-
let visualRefreshState = undefined;
|
|
8
|
-
function detectVisualRefresh() {
|
|
9
|
-
return typeof document !== "undefined" && !!document.querySelector(".awsui-visual-refresh");
|
|
10
|
-
}
|
|
11
|
-
function useVisualRefreshDynamic() {
|
|
12
|
-
if (visualRefreshState === undefined) {
|
|
13
|
-
visualRefreshState = detectVisualRefresh();
|
|
14
|
-
}
|
|
15
|
-
if (isDevelopment) {
|
|
16
|
-
const newVisualRefreshState = detectVisualRefresh();
|
|
17
|
-
if (newVisualRefreshState !== visualRefreshState) {
|
|
18
|
-
warnOnce("Visual Refresh", "Dynamic visual refresh change detected. This is not supported. " +
|
|
19
|
-
"Make sure `awsui-visual-refresh` is attached to the `<body>` element before initial React render");
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return visualRefreshState;
|
|
23
|
-
}
|
|
5
|
+
export const useVisualRefresh = ALWAYS_VISUAL_REFRESH ? () => true : useRuntimeVisualRefresh;
|
package/internal/environment.js
CHANGED
package/internal/manifest.json
CHANGED