@semcore/core 16.4.0-prerelease.0 → 16.5.0-prerelease.3
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/CHANGELOG.md +8 -0
- package/lib/core-types/Component.js +2 -5
- package/lib/core-types/Component.js.map +1 -1
- package/lib/core-types/Component.mjs +1 -6
- package/lib/core-types/Component.mjs.map +1 -1
- package/lib/coreFactory.js +7 -11
- package/lib/coreFactory.js.map +1 -1
- package/lib/coreFactory.mjs +2 -13
- package/lib/coreFactory.mjs.map +1 -1
- package/lib/esm/core-types/Component.mjs +1 -6
- package/lib/esm/coreFactory.mjs +2 -13
- package/lib/esm/utils/createHoc.mjs +1 -6
- package/lib/esm/utils/enhances/WithI18n.mjs +1 -6
- package/lib/esm/utils/enhances/i18nEnhance.mjs +7 -10
- package/lib/theme/dark.json +41 -41
- package/lib/theme/light.json +41 -41
- package/lib/theme/processor.js +14 -15
- package/lib/theme/processor.js.map +1 -1
- package/lib/theme/processor.mjs +14 -15
- package/lib/theme/processor.mjs.map +1 -1
- package/lib/theme/themes/auto.css +20 -20
- package/lib/theme/themes/dark.css +11 -11
- package/lib/theme/themes/dark.d.ts +2 -2
- package/lib/theme/themes/dark.js +8 -8
- package/lib/theme/themes/dark.js.map +1 -1
- package/lib/theme/themes/dark.mjs +8 -8
- package/lib/theme/themes/dark.mjs.map +1 -1
- package/lib/theme/themes/default.css +9 -9
- package/lib/theme/themes/default.d.ts +2 -2
- package/lib/theme/themes/default.js +6 -6
- package/lib/theme/themes/default.js.map +1 -1
- package/lib/theme/themes/default.mjs +6 -6
- package/lib/theme/themes/default.mjs.map +1 -1
- package/lib/theme/themes/highlights-dark.css +1 -1
- package/lib/theme/themes/highlights-dark.js +1 -1
- package/lib/theme/themes/highlights-dark.js.map +1 -1
- package/lib/theme/themes/highlights-dark.mjs +1 -1
- package/lib/theme/themes/highlights-dark.mjs.map +1 -1
- package/lib/theme/themes/highlights-light.css +1 -1
- package/lib/theme/themes/highlights-light.js +1 -1
- package/lib/theme/themes/highlights-light.js.map +1 -1
- package/lib/theme/themes/highlights-light.mjs +1 -1
- package/lib/theme/themes/highlights-light.mjs.map +1 -1
- package/lib/theme/themes/light.css +9 -9
- package/lib/theme/themes/light.d.ts +2 -2
- package/lib/theme/themes/light.js +6 -6
- package/lib/theme/themes/light.js.map +1 -1
- package/lib/theme/themes/light.mjs +6 -6
- package/lib/theme/themes/light.mjs.map +1 -1
- package/lib/utils/createHoc.js +2 -5
- package/lib/utils/createHoc.js.map +1 -1
- package/lib/utils/createHoc.mjs +1 -6
- package/lib/utils/createHoc.mjs.map +1 -1
- package/lib/utils/enhances/WithAutoFocus.js +2 -5
- package/lib/utils/enhances/WithAutoFocus.js.map +1 -1
- package/lib/utils/enhances/WithAutoFocus.mjs +1 -4
- package/lib/utils/enhances/WithAutoFocus.mjs.map +1 -1
- package/lib/utils/enhances/WithCSS.js +2 -5
- package/lib/utils/enhances/WithCSS.js.map +1 -1
- package/lib/utils/enhances/WithCSS.mjs +1 -4
- package/lib/utils/enhances/WithCSS.mjs.map +1 -1
- package/lib/utils/enhances/WithI18n.js +2 -5
- package/lib/utils/enhances/WithI18n.js.map +1 -1
- package/lib/utils/enhances/WithI18n.mjs +1 -6
- package/lib/utils/enhances/WithI18n.mjs.map +1 -1
- package/lib/utils/enhances/WithKeyboardFocus.js +2 -5
- package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -1
- package/lib/utils/enhances/WithKeyboardFocus.mjs +1 -4
- package/lib/utils/enhances/WithKeyboardFocus.mjs.map +1 -1
- package/lib/utils/enhances/i18nEnhance.js +7 -10
- package/lib/utils/enhances/i18nEnhance.js.map +1 -1
- package/lib/utils/enhances/i18nEnhance.mjs +7 -10
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -1
- package/lib/utils/injectStyle.js +1 -1
- package/lib/utils/injectStyle.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
-
import
|
|
3
|
+
import _regenerator from "@babel/runtime/helpers/esm/regenerator";
|
|
4
4
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
5
5
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
6
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
@@ -15,22 +15,19 @@ var useAsyncI18nMessages = function useAsyncI18nMessages2(primaryContainer, loca
|
|
|
15
15
|
var container2 = {};
|
|
16
16
|
var _loop = function _loop2(_locale2) {
|
|
17
17
|
if (typeof primaryContainer[_locale2] === "function" || typeof fallbackContainer[_locale2] === "function") {
|
|
18
|
-
container2[_locale2] = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */
|
|
18
|
+
container2[_locale2] = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee() {
|
|
19
19
|
var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
|
|
20
|
-
return
|
|
21
|
-
while (1) switch (_context.
|
|
20
|
+
return _regenerator().w(function(_context) {
|
|
21
|
+
while (1) switch (_context.n) {
|
|
22
22
|
case 0:
|
|
23
|
-
_context.
|
|
23
|
+
_context.n = 1;
|
|
24
24
|
return Promise.all([primaryContainer[_locale2], fallbackContainer[_locale2]]);
|
|
25
25
|
case 1:
|
|
26
|
-
_yield$Promise$all = _context.
|
|
26
|
+
_yield$Promise$all = _context.v;
|
|
27
27
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
28
28
|
primary = _yield$Promise$all2[0];
|
|
29
29
|
fallback = _yield$Promise$all2[1];
|
|
30
|
-
return _context.
|
|
31
|
-
case 2:
|
|
32
|
-
case "end":
|
|
33
|
-
return _context.stop();
|
|
30
|
+
return _context.a(2, _objectSpread(_objectSpread({}, primary), fallback));
|
|
34
31
|
}
|
|
35
32
|
}, _callee);
|
|
36
33
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18nEnhance.mjs","names":["React","useI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","_store$locale","container","useMemo","_loop","_locale","_asyncToGenerator","
|
|
1
|
+
{"version":3,"file":"i18nEnhance.mjs","names":["React","useI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","_store$locale","container","useMemo","_loop","_locale","_asyncToGenerator","_regenerator","m","_callee","_yield$Promise$all","_yield$Promise$all2","primary","fallback","w","_context","n","Promise","all","v","_slicedToArray","a","_objectSpread","_primaryContainer$_lo","_fallbackContainer$_l","initStore","store","_typeof","_React$useState","useState","_React$useState2","setStore","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","_defineProperty","err","console","error","props","i18n","getI18nText"],"sources":["../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport { type LocaleKeys, useI18n } from './WithI18n';\nimport type { UnknownProperties } from '../../core-types/UnknownProperties';\n\n/** @deprecated */\nexport interface IWithI18nEnhanceProps extends WithI18nEnhanceProps, UnknownProperties {}\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(err);\n });\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAA0BC,OAAO,QAAQ,gBAAY;;AAGrD;;AAkBA,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAC/BC,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,EAClC;EAAA,IAAAC,aAAA;EACH,IAAMC,SAAS,GAAGP,KAA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