@mirai/core 0.1.18 → 0.1.19

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 CHANGED
@@ -22,16 +22,16 @@ const Core = _ref => {
22
22
  children,
23
23
  components = []
24
24
  } = _ref;
25
+ const {
26
+ isMobile,
27
+ isDesktop
28
+ } = (0, _ui.useDevice)();
25
29
  const {
26
30
  value: {
27
31
  currency,
28
32
  locale = _locale.DEFAULT_LOCALE
29
33
  }
30
34
  } = (0, _dataSources.useStore)();
31
- const {
32
- isMobile,
33
- isDesktop
34
- } = (0, _ui.useDevice)();
35
35
  const [dictionary, setDictionary] = (0, _react.useState)();
36
36
  (0, _react.useEffect)(() => {
37
37
  (async () => {
package/build/Core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Core.js","names":["ghosts","Core","children","components","value","currency","locale","DEFAULT_LOCALE","useStore","isMobile","isDesktop","useDevice","dictionary","setDictionary","useState","useEffect","next","ServiceDictionary","get","filter","desktop","mobile","map","index","el","component","props","getGhost","ReactDOM","createPortal","React","createElement","COMPONENTS","undefined","ghost","propTypes","PropTypes","node","arrayOf","shape","oneOf","Object","keys","any"],"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 from './components';\nimport { getGhost } from './helpers';\n\nconst ghosts = {};\n\nconst Core = ({ children, components = [] }) => {\n const {\n value: { currency, locale = DEFAULT_LOCALE },\n } = useStore();\n\n const { isMobile, isDesktop } = useDevice();\n const [dictionary, setDictionary] = useState();\n\n useEffect(() => {\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 {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\n return ReactDOM.createPortal(\n <Suspense fallback={<small>Loading...</small>}>\n {React.createElement(COMPONENTS[component], {\n ...props,\n ['data-testid']: process.env.NODE_ENV === 'production' ? component : undefined,\n ghost: ghosts[index],\n el,\n })}\n </Suspense>,\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};\n\nexport { Core };\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAqC;AAAA;AAAA;AAErC,MAAMA,MAAM,GAAG,CAAC,CAAC;AAEjB,MAAMC,IAAI,GAAG,QAAmC;EAAA,IAAlC;IAAEC,QAAQ;IAAEC,UAAU,GAAG;EAAG,CAAC;EACzC,MAAM;IACJC,KAAK,EAAE;MAAEC,QAAQ;MAAEC,MAAM,GAAGC;IAAe;EAC7C,CAAC,GAAG,IAAAC,qBAAQ,GAAE;EAEd,MAAM;IAAEC,QAAQ;IAAEC;EAAU,CAAC,GAAG,IAAAC,aAAS,GAAE;EAC3C,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,GAAE;EAE9C,IAAAC,gBAAS,EAAC,MAAM;IACd,CAAC,YAAY;MACX,MAAMC,IAAI,GAAG,MAAMC,2BAAiB,CAACC,GAAG,CAACZ,MAAM,CAAC;MAChD,IAAIU,IAAI,EAAEH,aAAa,CAACG,IAAI,CAAC;IAC/B,CAAC,GAAG;EACN,CAAC,EAAE,CAACV,MAAM,CAAC,CAAC;EAEZ,oBACE,6BAAC,sBAAc;IAAOD,QAAQ;IAAEO,UAAU;IAAEN;EAAM,gBAChD,4DACGH,UAAU,CACRgB,MAAM,CAAC;IAAA,IAAC;MAAEC,OAAO;MAAEC;IAAO,CAAC;IAAA,OAAK,EAAEZ,QAAQ,IAAIY,MAAM,KAAK,OAAO,CAAC,IAAI,EAAEX,SAAS,IAAIU,OAAO,KAAK,OAAO,CAAC;EAAA,EAAC,CACzGE,GAAG,CAAC,QAA8BC,KAAK,KAAK;IAAA,IAAvC;MAAEC,EAAE;MAAEC,SAAS;MAAE,GAAGC;IAAM,CAAC;IAC/B,IAAI,CAAC1B,MAAM,CAACuB,KAAK,CAAC,EAAEvB,MAAM,CAACuB,KAAK,CAAC,GAAG,IAAAI,iBAAQ,EAACH,EAAE,CAAC;IAEhD,oBAAOI,iBAAQ,CAACC,YAAY,eAC1B,6BAAC,eAAQ;MAAC,QAAQ,eAAE;IAA0B,gBAC3CC,cAAK,CAACC,aAAa,CAACC,mBAAU,CAACP,SAAS,CAAC,EAAE;MAC1C,GAAGC,KAAK;MACR,CAAC,aAAa,GAAG,qEAAyB,YAAY,GAAGD,SAAS,GAAGQ,SAAS;MAC9EC,KAAK,EAAElC,MAAM,CAACuB,KAAK,CAAC;MACpBC;IACF,CAAC,CAAC,CACO,EACXA,EAAE,CACH;EACH,CAAC,CAAC,CACH,EACFtB,QAAQ,CACM;AAErB,CAAC;AAAC;AAEFD,IAAI,CAACkC,SAAS,GAAG;EACfjC,QAAQ,EAAEkC,kBAAS,CAACC,IAAI;EACxBlC,UAAU,EAAEiC,kBAAS,CAACE,OAAO,CAC3BF,kBAAS,CAACG,KAAK,CAAC;IACdd,SAAS,EAAEW,kBAAS,CAACI,KAAK,CAACC,MAAM,CAACC,IAAI,CAACV,mBAAU,CAAC,CAAC;IACnDR,EAAE,EAAEY,kBAAS,CAACO;EAChB,CAAC,CAAC;AAEN,CAAC"}
1
+ {"version":3,"file":"Core.js","names":["ghosts","Core","children","components","isMobile","isDesktop","useDevice","value","currency","locale","DEFAULT_LOCALE","useStore","dictionary","setDictionary","useState","useEffect","next","ServiceDictionary","get","filter","desktop","mobile","map","index","el","component","props","getGhost","ReactDOM","createPortal","React","createElement","COMPONENTS","undefined","ghost","propTypes","PropTypes","node","arrayOf","shape","oneOf","Object","keys","any"],"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 from './components';\nimport { getGhost } from './helpers';\n\nconst ghosts = {};\n\nconst Core = ({ children, components = [] }) => {\n const { isMobile, isDesktop } = useDevice();\n const {\n value: { currency, locale = DEFAULT_LOCALE },\n } = useStore();\n\n const [dictionary, setDictionary] = useState();\n\n useEffect(() => {\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 {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\n return ReactDOM.createPortal(\n <Suspense fallback={<small>Loading...</small>}>\n {React.createElement(COMPONENTS[component], {\n ...props,\n ['data-testid']: process.env.NODE_ENV === 'production' ? component : undefined,\n ghost: ghosts[index],\n el,\n })}\n </Suspense>,\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};\n\nexport { Core };\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAqC;AAAA;AAAA;A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,mBAAU,CAACP,SAAS,CAAC,EAAE;MAC1C,GAAGC,KAAK;MACR,CAAC,aAAa,GAAG,qEAAyB,YAAY,GAAGD,SAAS,GAAGQ,SAAS;MAC9EC,KAAK,EAAElC,MAAM,CAACuB,KAAK,CAAC;MACpBC;IACF,CAAC,CAAC,CACO,EACXA,EAAE,CACH;EACH,CAAC,CAAC,CACH,EACFtB,QAAQ,CACM;AAErB,CAAC;AAAC;AAEFD,IAAI,CAACkC,SAAS,GAAG;EACfjC,QAAQ,EAAEkC,kBAAS,CAACC,IAAI;EACxBlC,UAAU,EAAEiC,kBAAS,CAACE,OAAO,CAC3BF,kBAAS,CAACG,KAAK,CAAC;IACdd,SAAS,EAAEW,kBAAS,CAACI,KAAK,CAACC,MAAM,CAACC,IAAI,CAACV,mBAAU,CAAC,CAAC;IACnDR,EAAE,EAAEY,kBAAS,CAACO;EAChB,CAAC,CAAC;AAEN,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/core",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "source": "src/index.js",
5
5
  "repository": "https://gitlab.com/miraicorp/dev/frontend/core",
6
6
  "author": "JΛVI <hello@soyjavi.com>",