@ui5/webcomponents-react-base
Advanced tools
Comparing version 2.0.0-rc.3 to 2.0.0
@@ -6,2 +6,8 @@ # Change Log | ||
# [2.0.0](https://github.com/SAP/ui5-webcomponents-react/compare/v2.0.0-rc.3...v2.0.0) (2024-08-23) | ||
### Bug Fixes | ||
- add runtime index to global Modal and Style store ([#6248](https://github.com/SAP/ui5-webcomponents-react/issues/6248)) ([8184b4e](https://github.com/SAP/ui5-webcomponents-react/commit/8184b4e98fea38ec1b1ba40a43fb31651bba8ac8)) | ||
# [2.0.0-rc.3](https://github.com/SAP/ui5-webcomponents-react/compare/v2.0.0-rc.2...v2.0.0-rc.3) (2024-08-21) | ||
@@ -8,0 +14,0 @@ |
import { getI18nBundle } from '@ui5/webcomponents-base/dist/i18nBundle.js'; | ||
globalThis['@ui5/webcomponents-react'] ??= {}; | ||
const STORE_LOCATION = globalThis['@ui5/webcomponents-react']; | ||
const STORE_SYMBOL_LISTENERS = Symbol.for('@ui5/webcomponents-react/I18nStore/Listeners'); | ||
@@ -6,4 +8,4 @@ const STORE_SYMBOL = Symbol.for('@ui5/webcomponents-react/I18nStore'); | ||
function getListeners() { | ||
globalThis[STORE_SYMBOL_LISTENERS] ??= []; | ||
return globalThis[STORE_SYMBOL_LISTENERS]; | ||
STORE_LOCATION[STORE_SYMBOL_LISTENERS] ??= []; | ||
return STORE_LOCATION[STORE_SYMBOL_LISTENERS]; | ||
} | ||
@@ -16,10 +18,10 @@ function emitChange() { | ||
function getSnapshot() { | ||
globalThis[STORE_SYMBOL] ??= initialStore; | ||
return globalThis[STORE_SYMBOL]; | ||
STORE_LOCATION[STORE_SYMBOL] ??= initialStore; | ||
return STORE_LOCATION[STORE_SYMBOL]; | ||
} | ||
function subscribe(listener) { | ||
const listeners = getListeners(); | ||
globalThis[STORE_SYMBOL_LISTENERS] = [...listeners, listener]; | ||
STORE_LOCATION[STORE_SYMBOL_LISTENERS] = [...listeners, listener]; | ||
return () => { | ||
globalThis[STORE_SYMBOL_LISTENERS] = listeners.filter((l) => l !== listener); | ||
STORE_LOCATION[STORE_SYMBOL_LISTENERS] = listeners.filter((l) => l !== listener); | ||
}; | ||
@@ -37,4 +39,4 @@ } | ||
void getI18nBundle(bundleName).then((bundle) => { | ||
globalThis[STORE_SYMBOL] = { | ||
...globalThis[STORE_SYMBOL], | ||
STORE_LOCATION[STORE_SYMBOL] = { | ||
...STORE_LOCATION[STORE_SYMBOL], | ||
[bundleName]: bundle | ||
@@ -49,3 +51,3 @@ }; | ||
const newBundles = await Promise.all(Object.keys(bundles).map((bundleName) => getI18nBundle(bundleName))); | ||
globalThis[STORE_SYMBOL] = newBundles.reduce((acc, bundle) => ({ | ||
STORE_LOCATION[STORE_SYMBOL] = newBundles.reduce((acc, bundle) => ({ | ||
...acc, | ||
@@ -52,0 +54,0 @@ [bundle.packageName]: bundle |
@@ -1,3 +0,10 @@ | ||
const STORE_SYMBOL_LISTENERS = Symbol.for('@ui5/webcomponents-react/StyleStore/Listeners'); | ||
const STORE_SYMBOL = Symbol.for('@ui5/webcomponents-react/StyleStore'); | ||
import { getCurrentRuntimeIndex } from '@ui5/webcomponents-base/dist/Runtimes.js'; | ||
globalThis['@ui5/webcomponents-react'] ??= {}; | ||
const STORE_LOCATION = globalThis['@ui5/webcomponents-react']; | ||
function getStyleStoreListenersSymbol() { | ||
return Symbol.for(`@ui5/webcomponents-react/StyleStore-${getCurrentRuntimeIndex()}/Listeners`); | ||
} | ||
function getStyleStoreSymbol() { | ||
return Symbol.for(`@ui5/webcomponents-react/StyleStore-${getCurrentRuntimeIndex()}`); | ||
} | ||
const initialStore = { | ||
@@ -8,4 +15,4 @@ staticCssInjected: false, | ||
function getListeners() { | ||
globalThis[STORE_SYMBOL_LISTENERS] ??= []; | ||
return globalThis[STORE_SYMBOL_LISTENERS]; | ||
STORE_LOCATION[getStyleStoreListenersSymbol()] ??= []; | ||
return STORE_LOCATION[getStyleStoreListenersSymbol()]; | ||
} | ||
@@ -18,10 +25,10 @@ function emitChange() { | ||
function getSnapshot() { | ||
globalThis[STORE_SYMBOL] ??= initialStore; | ||
return globalThis[STORE_SYMBOL]; | ||
STORE_LOCATION[getStyleStoreSymbol()] ??= initialStore; | ||
return STORE_LOCATION[getStyleStoreSymbol()]; | ||
} | ||
function subscribe(listener) { | ||
const listeners = getListeners(); | ||
globalThis[STORE_SYMBOL_LISTENERS] = [...listeners, listener]; | ||
STORE_LOCATION[getStyleStoreListenersSymbol()] = [...listeners, listener]; | ||
return () => { | ||
globalThis[STORE_SYMBOL_LISTENERS] = listeners.filter((l) => l !== listener); | ||
STORE_LOCATION[getStyleStoreListenersSymbol()] = listeners.filter((l) => l !== listener); | ||
}; | ||
@@ -37,3 +44,3 @@ } | ||
const curr = getSnapshot(); | ||
globalThis[STORE_SYMBOL] = { | ||
STORE_LOCATION[getStyleStoreSymbol()] = { | ||
...curr, | ||
@@ -40,0 +47,0 @@ staticCssInjected |
{ | ||
"name": "@ui5/webcomponents-react-base", | ||
"version": "2.0.0-rc.3", | ||
"version": "2.0.0", | ||
"description": "Base for ui5-webcomponents-react", | ||
@@ -62,3 +62,3 @@ "type": "module", | ||
}, | ||
"gitHead": "7626d0d88a835d025e1d3a01b19280cd2bb0fd16" | ||
"gitHead": "c331ebe5b63346d73e30a5bde34b0d544398dad4" | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
182873
3228
0