@cloudscape-design/components-themeable 3.0.1254 → 3.0.1255
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/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
- package/lib/internal/template/i18n/providers/remote-provider.d.ts.map +1 -1
- package/lib/internal/template/i18n/providers/remote-provider.js +10 -1
- package/lib/internal/template/i18n/providers/remote-provider.js.map +1 -1
- package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
- package/lib/internal/template/internal/environment.js +2 -2
- package/lib/internal/template/internal/environment.json +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-provider.d.ts","sourceRoot":"","sources":["../../../../src/i18n/providers/remote-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA0C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"remote-provider.d.ts","sourceRoot":"","sources":["../../../../src/i18n/providers/remote-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAO/D,OAAO,EAAE,cAAc,EAAuB,MAAM,YAAY,CAAC;AAGjE,UAAU,sBAAsB;IAC9B,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,aAAa,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;IAEpF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,uBAAuB,eAuC9F"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import React, { useContext, useEffect, useState } from 'react';
|
|
4
|
+
import { getGlobalFlag } from '@cloudscape-design/component-toolkit/internal';
|
|
4
5
|
// NOTE: Ensure that direct or transitive dependencies never pull in
|
|
5
6
|
// intl-messageformat or any `@formatjs` dependencies! Otherwise, it
|
|
6
7
|
// would harm any bundle size improvements this component brings.
|
|
@@ -21,13 +22,18 @@ export default function RemoteI18nProvider({ loadFormatter, children }) {
|
|
|
21
22
|
const [locale] = useState(() => determineAppLocale());
|
|
22
23
|
const [staticLoadFormatter] = useState(() => loadFormatter);
|
|
23
24
|
useEffect(() => {
|
|
25
|
+
let mounted = true;
|
|
24
26
|
// Translations are already provided from a local provider, so skip.
|
|
25
27
|
if (hasWrapperContext) {
|
|
26
28
|
return;
|
|
27
29
|
}
|
|
30
|
+
// Skip trying to load remote provider if the app layout widget is not available
|
|
31
|
+
if (!getGlobalFlag('appLayoutWidget')) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
28
34
|
staticLoadFormatter({ locale })
|
|
29
35
|
.then(formatter => {
|
|
30
|
-
if (formatter) {
|
|
36
|
+
if (formatter && mounted) {
|
|
31
37
|
setFormatFunction(() => formatter.format.bind(formatter));
|
|
32
38
|
}
|
|
33
39
|
// If formatter isn't available, do nothing.
|
|
@@ -35,6 +41,9 @@ export default function RemoteI18nProvider({ loadFormatter, children }) {
|
|
|
35
41
|
.catch(() => {
|
|
36
42
|
// Do nothing. Failure in fetching the formatter should not be fatal.
|
|
37
43
|
});
|
|
44
|
+
return () => {
|
|
45
|
+
mounted = false;
|
|
46
|
+
};
|
|
38
47
|
}, [hasWrapperContext, locale, staticLoadFormatter]);
|
|
39
48
|
const value = wrapperContext || (formatFunction && { locale, format: formatFunction });
|
|
40
49
|
return React.createElement(InternalI18nContext.Provider, { value: value }, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-provider.js","sourceRoot":"","sources":["../../../../src/i18n/providers/remote-provider.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE/D,oEAAoE;AACpE,oEAAoE;AACpE,iEAAiE;AACjE,OAAO,EAAkB,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAiBtD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,aAAa,EAAE,QAAQ,EAA2B;IAC7F,MAAM,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IACvD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAA8B,CAAC;IAEnF,qEAAqE;IACrE,8EAA8E;IAC9E,4CAA4C;IAC5C,MAAM,iBAAiB,GAAG,CAAC,CAAC,cAAc,CAAC;IAC3C,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACtD,MAAM,CAAC,mBAAmB,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC;IAE5D,SAAS,CAAC,GAAG,EAAE;QACb,oEAAoE;QACpE,IAAI,iBAAiB,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;aAC5B,IAAI,CAAC,SAAS,CAAC,EAAE;YAChB,IAAI,SAAS,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"remote-provider.js","sourceRoot":"","sources":["../../../../src/i18n/providers/remote-provider.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAE,aA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,CAAC,CAAC;QACL,OAAO,GAAG,EAAE;YACV,OAAO,GAAG,KAAK,CAAC;QAClB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAErD,MAAM,KAAK,GAAG,cAAc,IAAI,CAAC,cAAc,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IACvF,OAAO,oBAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAAgC,CAAC;AAC/F,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useContext, useEffect, useState } from 'react';\n\nimport { getGlobalFlag } from '@cloudscape-design/component-toolkit/internal';\n\n// NOTE: Ensure that direct or transitive dependencies never pull in\n// intl-messageformat or any `@formatjs` dependencies! Otherwise, it\n// would harm any bundle size improvements this component brings.\nimport { FormatFunction, InternalI18nContext } from '../context';\nimport { determineAppLocale } from '../utils/locales';\n\ninterface I18nFormatterInterface {\n format: FormatFunction;\n}\n\nexport interface RemoteI18nProviderProps {\n /**\n * A format function, loaded dynamically from the result of this callback. If\n * the callback returns null, it means that the provider isn't available for\n * whatever reason, and nothing happens.\n */\n loadFormatter: (args: { locale: string }) => Promise<I18nFormatterInterface | null>;\n\n children: React.ReactNode;\n}\n\n/**\n * A lightweight implementation of the I18nProvider context wrapper that expects both the\n * messages and the formatting logic to be provided from a remote source. Explicitly does\n * nothing if it's wrapped by a LocalI18nProvider.\n */\nexport default function RemoteI18nProvider({ loadFormatter, children }: RemoteI18nProviderProps) {\n const wrapperContext = useContext(InternalI18nContext);\n const [formatFunction, setFormatFunction] = useState<FormatFunction | undefined>();\n\n // Ensure that every dependency of the effect below can never change.\n // The locale comes from the document, and the formatter only depends on that,\n // so it should never need to update either.\n const hasWrapperContext = !!wrapperContext;\n const [locale] = useState(() => determineAppLocale());\n const [staticLoadFormatter] = useState(() => loadFormatter);\n\n useEffect(() => {\n let mounted = true;\n // Translations are already provided from a local provider, so skip.\n if (hasWrapperContext) {\n return;\n }\n // Skip trying to load remote provider if the app layout widget is not available\n if (!getGlobalFlag('appLayoutWidget')) {\n return;\n }\n\n staticLoadFormatter({ locale })\n .then(formatter => {\n if (formatter && mounted) {\n setFormatFunction(() => formatter.format.bind(formatter));\n }\n // If formatter isn't available, do nothing.\n })\n .catch(() => {\n // Do nothing. Failure in fetching the formatter should not be fatal.\n });\n return () => {\n mounted = false;\n };\n }, [hasWrapperContext, locale, staticLoadFormatter]);\n\n const value = wrapperContext || (formatFunction && { locale, format: formatFunction });\n return <InternalI18nContext.Provider value={value}>{children}</InternalI18nContext.Provider>;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (bd81b05d)";
|
|
3
|
+
export var GIT_SHA = "bd81b05d";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "core";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|