@ui5/webcomponents-react-base
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -6,2 +6,9 @@ # Change Log | ||
## [2.1.1](https://github.com/SAP/ui5-webcomponents-react/compare/v2.1.0...v2.1.1) (2024-09-24) | ||
### Bug Fixes | ||
- ensure availability of internal CSS vars ([#6393](https://github.com/SAP/ui5-webcomponents-react/issues/6393)) ([d8a8df3](https://github.com/SAP/ui5-webcomponents-react/commit/d8a8df3054ebaa079dddd5ef4a243346824c959a)) | ||
- **useStyleSheet:** scope component name to ui5wc runtime ([#6395](https://github.com/SAP/ui5-webcomponents-react/issues/6395)) ([1383b37](https://github.com/SAP/ui5-webcomponents-react/commit/1383b3757f546a417071a31297a1f413d0711a56)) | ||
# [2.1.0](https://github.com/SAP/ui5-webcomponents-react/compare/v2.0.2...v2.1.0) (2024-09-05) | ||
@@ -8,0 +15,0 @@ |
const VersionInfo = { | ||
version: '2.1.0', | ||
version: '2.1.1', | ||
major: 2, | ||
minor: 1, | ||
patch: 0, | ||
patch: 1, | ||
suffix: '', | ||
isNext: false, | ||
buildTime: 1725526479 | ||
buildTime: 1727169353 | ||
}; | ||
export default VersionInfo; |
import type { StyleDataCSP } from '@ui5/webcomponents-base/dist/ManagedStyles.js'; | ||
export declare function useStylesheet(styles: StyleDataCSP, componentName: string): void; | ||
interface UseStyleSheetOptions { | ||
alwaysInject?: boolean; | ||
} | ||
export declare function useStylesheet(styles: StyleDataCSP, componentName: string, options?: UseStyleSheetOptions): void; | ||
export {}; |
'use client'; | ||
import { createOrUpdateStyle, removeStyle } from '@ui5/webcomponents-base/dist/ManagedStyles.js'; | ||
import { getCurrentRuntimeIndex } from '@ui5/webcomponents-base/dist/Runtimes.js'; | ||
import { useSyncExternalStore } from 'use-sync-external-store/shim/index.js'; | ||
import { StyleStore } from '../stores/StyleStore.js'; | ||
import { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect.js'; | ||
export function useStylesheet(styles, componentName) { | ||
export function useStylesheet(styles, componentName, options) { | ||
const { staticCssInjected, componentsMap } = useSyncExternalStore(StyleStore.subscribe, StyleStore.getSnapshot, StyleStore.getServerSnapshot); | ||
useIsomorphicLayoutEffect(() => { | ||
const shouldInject = !staticCssInjected; | ||
const scopedComponentName = `${componentName}-${getCurrentRuntimeIndex()}`; | ||
const shouldInject = options?.alwaysInject || !staticCssInjected; | ||
if (shouldInject) { | ||
createOrUpdateStyle(styles, 'data-ui5wcr-component', componentName); | ||
createOrUpdateStyle(styles, 'data-ui5wcr-component', scopedComponentName); | ||
StyleStore.mountComponent(componentName); | ||
@@ -19,3 +21,3 @@ } | ||
if (numberOfMountedComponents <= 0) { | ||
removeStyle('data-ui5wcr-component', componentName); | ||
removeStyle('data-ui5wcr-component', scopedComponentName); | ||
} | ||
@@ -22,0 +24,0 @@ } |
{ | ||
"name": "@ui5/webcomponents-react-base", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Base for ui5-webcomponents-react", | ||
@@ -63,3 +63,3 @@ "type": "module", | ||
}, | ||
"gitHead": "f7a004acc7bf1a853da91134e8d21d450610cbe4" | ||
"gitHead": "62429e5a8e7d6b715da38c0ad7ec76e500e3cec1" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
185224
3254