@cloudscape-design/code-view 3.0.55 → 3.0.56

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,8 +1,10 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { initAwsUiVersions, useComponentMetadata, } from "@cloudscape-design/component-toolkit/internal";
4
- import { PACKAGE_SOURCE, PACKAGE_VERSION } from "../environment";
4
+ import { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from "../environment";
5
+ import { getVisualTheme } from "../utils/get-visual-theme";
5
6
  import { useTelemetry } from "./use-telemetry";
7
+ import { useVisualRefresh } from "./use-visual-refresh";
6
8
  initAwsUiVersions(PACKAGE_SOURCE, PACKAGE_VERSION);
7
9
  /**
8
10
  * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be
@@ -11,7 +13,13 @@ initAwsUiVersions(PACKAGE_SOURCE, PACKAGE_VERSION);
11
13
  */
12
14
  export default function useBaseComponent(componentName, config) {
13
15
  useTelemetry(componentName, config);
14
- const elementRef = useComponentMetadata(componentName, PACKAGE_VERSION);
16
+ const isVisualRefresh = useVisualRefresh();
17
+ const theme = getVisualTheme(THEME, isVisualRefresh);
18
+ const elementRef = useComponentMetadata(componentName, {
19
+ packageName: PACKAGE_SOURCE,
20
+ version: PACKAGE_VERSION,
21
+ theme,
22
+ });
15
23
  return { __internalRootRef: elementRef };
16
24
  }
17
25
  export function getBaseProps(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"use-base-component.js","sourceRoot":"","sources":["../../../../src/internal/base-component/use-base-component.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAEL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,iBAAiB,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAMnD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAU,aAAqB,EAAE,MAA+B;IACtG,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,UAAU,GAAG,oBAAoB,CAAI,aAAa,EAAE,eAAe,CAAC,CAAC;IAC3E,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC;AAQD,MAAM,UAAU,YAAY,CAAC,KAAyB;IACpD,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAClC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YAC5B,SAAS,CAAC,IAAI,CAAC,GAAI,KAAgC,CAAC,IAAI,CAAC,CAAC;SAC3D;IACH,CAAC,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { MutableRefObject } from \"react\";\n\nimport {\n ComponentConfiguration,\n initAwsUiVersions,\n useComponentMetadata,\n} from \"@cloudscape-design/component-toolkit/internal\";\n\nimport { PACKAGE_SOURCE, PACKAGE_VERSION } from \"../environment\";\nimport { useTelemetry } from \"./use-telemetry\";\n\ninitAwsUiVersions(PACKAGE_SOURCE, PACKAGE_VERSION);\n\nexport interface InternalBaseComponentProps {\n __internalRootRef?: MutableRefObject<any> | null;\n}\n\n/**\n * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be\n * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this\n * root DOM node and emits the telemetry for this component.\n */\nexport default function useBaseComponent<T = any>(componentName: string, config?: ComponentConfiguration) {\n useTelemetry(componentName, config);\n const elementRef = useComponentMetadata<T>(componentName, PACKAGE_VERSION);\n return { __internalRootRef: elementRef };\n}\n\n// we also support data-* attributes, but they are always implicitly allowed by typescript\n// http://www.typescriptlang.org/docs/handbook/jsx.html#attribute-type-checking\n// \"Note: If an attribute name is not a valid JS identifier (like a data-* attribute), it is not considered to be an error\"\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface BaseComponentProps {}\n\nexport function getBaseProps(props: BaseComponentProps) {\n const baseProps: Record<string, string> = {};\n Object.keys(props).forEach((prop) => {\n if (prop.startsWith(\"data-\")) {\n baseProps[prop] = (props as Record<string, string>)[prop];\n }\n });\n return baseProps;\n}\n"]}
1
+ {"version":3,"file":"use-base-component.js","sourceRoot":"","sources":["../../../../src/internal/base-component/use-base-component.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAItC,OAAO,EAEL,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,iBAAiB,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAMnD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAU,aAAqB,EAAE,MAA+B;IACtG,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,oBAAoB,CAAI,aAAa,EAAE;QACxD,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE,eAAe;QACxB,KAAK;KACN,CAAC,CAAC;IACH,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC;AAQD,MAAM,UAAU,YAAY,CAAC,KAAyB;IACpD,MAAM,SAAS,GAA2B,EAAE,CAAC;IAC7C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAClC,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;YAC5B,SAAS,CAAC,IAAI,CAAC,GAAI,KAAgC,CAAC,IAAI,CAAC,CAAC;SAC3D;IACH,CAAC,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { MutableRefObject } from \"react\";\n\nimport {\n ComponentConfiguration,\n initAwsUiVersions,\n useComponentMetadata,\n} from \"@cloudscape-design/component-toolkit/internal\";\n\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from \"../environment\";\nimport { getVisualTheme } from \"../utils/get-visual-theme\";\nimport { useTelemetry } from \"./use-telemetry\";\nimport { useVisualRefresh } from \"./use-visual-refresh\";\n\ninitAwsUiVersions(PACKAGE_SOURCE, PACKAGE_VERSION);\n\nexport interface InternalBaseComponentProps {\n __internalRootRef?: MutableRefObject<any> | null;\n}\n\n/**\n * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be\n * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this\n * root DOM node and emits the telemetry for this component.\n */\nexport default function useBaseComponent<T = any>(componentName: string, config?: ComponentConfiguration) {\n useTelemetry(componentName, config);\n const isVisualRefresh = useVisualRefresh();\n const theme = getVisualTheme(THEME, isVisualRefresh);\n const elementRef = useComponentMetadata<T>(componentName, {\n packageName: PACKAGE_SOURCE,\n version: PACKAGE_VERSION,\n theme,\n });\n return { __internalRootRef: elementRef };\n}\n\n// we also support data-* attributes, but they are always implicitly allowed by typescript\n// http://www.typescriptlang.org/docs/handbook/jsx.html#attribute-type-checking\n// \"Note: If an attribute name is not a valid JS identifier (like a data-* attribute), it is not considered to be an error\"\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface BaseComponentProps {}\n\nexport function getBaseProps(props: BaseComponentProps) {\n const baseProps: Record<string, string> = {};\n Object.keys(props).forEach((prop) => {\n if (prop.startsWith(\"data-\")) {\n baseProps[prop] = (props as Record<string, string>)[prop];\n }\n });\n return baseProps;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export const PACKAGE_SOURCE = "code-view";
2
- export const PACKAGE_VERSION = "3.0.0 (df9c975e)";
2
+ export const PACKAGE_VERSION = "3.0.0 (ab7efdac)";
3
3
  export const THEME = "open-source-visual-refresh";
4
4
  export const ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "code-view",
3
- "PACKAGE_VERSION": "3.0.0 (df9c975e)",
3
+ "PACKAGE_VERSION": "3.0.0 (ab7efdac)",
4
4
  "THEME": "open-source-visual-refresh",
5
5
  "ALWAYS_VISUAL_REFRESH": true
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "df9c975e322ad97e219401498e1a31ef89010fa1"
2
+ "commit": "ab7efdac7016a3edf0d290b6269b6f730ac5da76"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudscape-design/code-view",
3
- "version": "3.0.55",
3
+ "version": "3.0.56",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cloudscape-design/code-view.git"