@mirai/core 0.1.121 → 0.1.123
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/build/Core.js +1 -1
- package/build/Core.js.map +1 -1
- package/package.json +1 -1
package/build/Core.js
CHANGED
|
@@ -59,7 +59,7 @@ const Core = _ref => {
|
|
|
59
59
|
...props
|
|
60
60
|
} = _ref3;
|
|
61
61
|
if (!ghosts[index]) ghosts[index] = (0, _helpers.getGhost)(el);
|
|
62
|
-
const skeletonFallback = _components.SKELETONS[component] ? /*#__PURE__*/_react.default.createElement(_components.SKELETONS[component]) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
62
|
+
const skeletonFallback = _components.SKELETONS[component] && !ghosts[index] ? /*#__PURE__*/_react.default.createElement(_components.SKELETONS[component]) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
63
63
|
return /*#__PURE__*/_reactDom.default.createPortal(skeleton ? skeletonFallback : /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
64
64
|
fallback: skeletonFallback
|
|
65
65
|
}, /*#__PURE__*/_react.default.createElement(_components.COMPONENTS[component], {
|
package/build/Core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Core.js","names":["ghosts","Core","children","components","skeleton","isMobile","isDesktop","useDevice","value","currency","locale","DEFAULT_LOCALE","useStore","dictionary","setDictionary","useState","ServiceDictionary","cache","useEffect","next","get","filter","desktop","mobile","map","index","el","component","props","getGhost","skeletonFallback","SKELETONS","React","createElement","ReactDOM","createPortal","COMPONENTS","process","env","NODE_ENV","undefined","ghost","propTypes","PropTypes","node","arrayOf","shape","oneOf","Object","keys","any","bool"],"sources":["../src/Core.jsx"],"sourcesContent":["import { useStore } from '@mirai/data-sources';\nimport { DEFAULT_LOCALE, LocaleProvider } from '@mirai/locale';\nimport { ServiceDictionary } from '@mirai/services';\nimport { useDevice } from '@mirai/ui';\nimport PropTypes from 'prop-types';\nimport React, { useEffect, useState, Suspense } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { COMPONENTS, SKELETONS } from './components';\nimport { Notifications } from './Core.Notifications';\nimport { getGhost } from './helpers';\n\nconst ghosts = {};\n\nconst Core = ({ children, components = [], skeleton = false }) => {\n const { isMobile, isDesktop } = useDevice();\n const {\n value: { currency, locale = DEFAULT_LOCALE },\n } = useStore();\n\n const [dictionary, setDictionary] = useState(ServiceDictionary.cache(DEFAULT_LOCALE));\n\n useEffect(() => {\n if (locale !== DEFAULT_LOCALE) setDictionary(ServiceDictionary.cache(locale));\n (async () => {\n const next = await ServiceDictionary.get(locale);\n if (next) setDictionary(next);\n })();\n }, [locale]);\n\n return (\n <LocaleProvider {...{ currency, dictionary, locale }}>\n <>\n {!skeleton && <Notifications />}\n\n {components\n .filter(({ desktop, mobile }) => !(isMobile && mobile === 'false') && !(isDesktop && desktop === 'false'))\n .map(({ el, component, ...props }, index) => {\n if (!ghosts[index]) ghosts[index] = getGhost(el);\n const skeletonFallback
|
|
1
|
+
{"version":3,"file":"Core.js","names":["ghosts","Core","children","components","skeleton","isMobile","isDesktop","useDevice","value","currency","locale","DEFAULT_LOCALE","useStore","dictionary","setDictionary","useState","ServiceDictionary","cache","useEffect","next","get","filter","desktop","mobile","map","index","el","component","props","getGhost","skeletonFallback","SKELETONS","React","createElement","ReactDOM","createPortal","COMPONENTS","process","env","NODE_ENV","undefined","ghost","propTypes","PropTypes","node","arrayOf","shape","oneOf","Object","keys","any","bool"],"sources":["../src/Core.jsx"],"sourcesContent":["import { useStore } from '@mirai/data-sources';\nimport { DEFAULT_LOCALE, LocaleProvider } from '@mirai/locale';\nimport { ServiceDictionary } from '@mirai/services';\nimport { useDevice } from '@mirai/ui';\nimport PropTypes from 'prop-types';\nimport React, { useEffect, useState, Suspense } from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { COMPONENTS, SKELETONS } from './components';\nimport { Notifications } from './Core.Notifications';\nimport { getGhost } from './helpers';\n\nconst ghosts = {};\n\nconst Core = ({ children, components = [], skeleton = false }) => {\n const { isMobile, isDesktop } = useDevice();\n const {\n value: { currency, locale = DEFAULT_LOCALE },\n } = useStore();\n\n const [dictionary, setDictionary] = useState(ServiceDictionary.cache(DEFAULT_LOCALE));\n\n useEffect(() => {\n if (locale !== DEFAULT_LOCALE) setDictionary(ServiceDictionary.cache(locale));\n (async () => {\n const next = await ServiceDictionary.get(locale);\n if (next) setDictionary(next);\n })();\n }, [locale]);\n\n return (\n <LocaleProvider {...{ currency, dictionary, locale }}>\n <>\n {!skeleton && <Notifications />}\n\n {components\n .filter(({ desktop, mobile }) => !(isMobile && mobile === 'false') && !(isDesktop && desktop === 'false'))\n .map(({ el, component, ...props }, index) => {\n if (!ghosts[index]) ghosts[index] = getGhost(el);\n const skeletonFallback =\n SKELETONS[component] && !ghosts[index] ? React.createElement(SKELETONS[component]) : <></>;\n\n return ReactDOM.createPortal(\n skeleton ? (\n skeletonFallback\n ) : (\n <Suspense fallback={skeletonFallback}>\n {React.createElement(COMPONENTS[component], {\n ...props,\n ['data-testid']: process.env.NODE_ENV === 'production' ? component : undefined,\n ghost: ghosts[index],\n skeleton: skeletonFallback,\n el,\n })}\n </Suspense>\n ),\n el,\n );\n })}\n </>\n {children}\n </LocaleProvider>\n );\n};\n\nCore.propTypes = {\n children: PropTypes.node,\n components: PropTypes.arrayOf(\n PropTypes.shape({\n component: PropTypes.oneOf(Object.keys(COMPONENTS)),\n el: PropTypes.any,\n }),\n ),\n skeleton: PropTypes.bool,\n};\n\nexport { Core };\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAqC;AAAA;AAAA;AAErC,MAAMA,MAAM,GAAG,CAAC,CAAC;AAEjB,MAAMC,IAAI,GAAG,QAAqD;EAAA,IAApD;IAAEC,QAAQ;IAAEC,UAAU,GAAG,EAAE;IAAEC,QAAQ,GAAG;EAAM,CAAC;EAC3D,MAAM;IAAEC,QAAQ;IA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