@e1011/es-kit 1.0.222 → 1.0.226
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/dist/hooks/esm/index.css +42 -42
- package/dist/hooks/esm/src/core/hooks/index.js +1 -1
- package/dist/hooks/index.css +42 -42
- package/dist/hooks/src/core/hooks/index.js +1 -1
- package/dist/lib/cjs/src/core/ui/components/container/lazyComponent/LazyComponent.js +1 -1
- package/dist/lib/cjs/src/core/ui/components/container/lazyComponent/LazyComponent.js.map +1 -1
- package/dist/lib/cjs/src/index.js +1 -1
- package/dist/lib/esm/src/core/ui/components/container/lazyComponent/LazyComponent.js +1 -1
- package/dist/lib/esm/src/core/ui/components/container/lazyComponent/LazyComponent.js.map +1 -1
- package/dist/lib/esm/src/index.js +1 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/core/hooks/index.d.ts +0 -1
- package/dist/types/src/core/hooks/index.d.ts.map +1 -1
- package/dist/types/src/core/ui/components/container/lazyComponent/LazyComponent.d.ts.map +1 -1
- package/dist/ui/esm/src/core/ui/components/container/lazyComponent/LazyComponent.js +1 -1
- package/dist/ui/esm/src/core/ui/components/container/lazyComponent/LazyComponent.js.map +1 -1
- package/dist/ui/src/core/ui/components/container/lazyComponent/LazyComponent.js +1 -1
- package/dist/ui/src/core/ui/components/container/lazyComponent/LazyComponent.js.map +1 -1
- package/dist/utils/esm/index.css +42 -42
- package/dist/utils/index.css +42 -42
- package/package.json +5 -10
- package/dist/hooks/esm/src/core/hooks/useTranslations.js +0 -2
- package/dist/hooks/esm/src/core/hooks/useTranslations.js.map +0 -1
- package/dist/hooks/src/core/hooks/useTranslations.js +0 -2
- package/dist/hooks/src/core/hooks/useTranslations.js.map +0 -1
- package/dist/lib/cjs/src/core/hooks/useTranslations.js +0 -2
- package/dist/lib/cjs/src/core/hooks/useTranslations.js.map +0 -1
- package/dist/lib/esm/src/core/hooks/useTranslations.js +0 -2
- package/dist/lib/esm/src/core/hooks/useTranslations.js.map +0 -1
- package/dist/types/src/core/hooks/useTranslations.d.ts +0 -10
- package/dist/types/src/core/hooks/useTranslations.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LazyComponent.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/container/lazyComponent/LazyComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAwB,aAAa,EAAE,iBAAiB,EAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"LazyComponent.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/container/lazyComponent/LazyComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAwB,aAAa,EAAE,iBAAiB,EAAmB,MAAM,OAAO,CAAA;AAWnG,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;CAC5B,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,GAAG,CAAC,GAAG;IACxD,iBAAiB,CAAC,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;IACtC,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK;IAAE,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAA;AAEhH,eAAO,MAAM,WAAW,EAAE,eA0BzB,CAAA;AAGD,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAkB/C,CAAA;AAIF,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,GAAG;IACrD,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;IAC1B,cAAc,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAA;CAClD,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAenD,CAAA;AAKF,eAAO,MAAM,gBAAgB,iBACb,MAAM,QAAQ,WAAW,CAAC,eAC3B,MAAM,iBACL,OAAO,MAAM,EAAE,OAAO,CAAC,KACpC,GAAG,OAAO,CAUZ,CAAA;AAGD,eAAO,MAAM,yBAAyB,2CACd,CAAC,KAAK,QAAQ,WAAW,CAAC,eACnC,MAAM,gBACL,OAAO,MAAM,EAAE,OAAO,CAAC,aAC5B,CAAC,KAAK,GAAG,aAAa,CAU9B,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{extends as e}from"../../../../../../_virtual/_rollupPluginBabelHelpers.js";import{memo as t,
|
|
1
|
+
import{extends as e}from"../../../../../../_virtual/_rollupPluginBabelHelpers.js";import{memo as t,useMemo as r,Suspense as n,useRef as l,lazy as a}from"react";import{ErrorBoundary as o}from"../../error/ErrorBoundary.js";import c from"./lazyComponent.module.scss.js";const s={},i=e=>{let t,r="pending";const n=("function"==typeof e?e():e).then((e=>{r="success",t=e}),(e=>{r="error",t=e}));return{read(){if("pending"===r)throw n;if("error"===r)throw t;if("success"===r)return t}}},m=t((e=>{let{children:t,Component:l,LoaderJSX:a,...s}=e;const i=r((()=>React.createElement("div",{className:c.loader},React.createElement("svg",{className:"spinner",viewBox:"0 0 50 50"},React.createElement("circle",{className:"path",cx:"25",cy:"25",r:"20",fill:"none",strokeWidth:"5"})))),[]);return React.createElement(o,null,React.createElement(n,{fallback:a||i},l&&React.createElement(l,s),t&&t))}));m.displayName="LazyComponent";const d=t((e=>{let{pendingPromise:t,promise:n,fallback:a,children:o}=e;const c=l(t||n&&i(n)),s=r((()=>e=>{var t,r;let{children:n}=e;const l=null===(t=c.current)||void 0===t||null===(r=t.read)||void 0===r?void 0:r.call(t);return null!=l&&l.then?null:n}),[]);return React.createElement(m,{LoaderJSX:a},React.createElement(s,null,o))}));d.displayName="PendingBoundary";const u=function(r,n){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!s[n]){const o=a(r);s[n]=t((t=>React.createElement(m,e({Component:o},l,t)))),s[n].displayName=n}return s[n]},p=(r,n,l)=>o=>{if(!s[n]){const c=a((()=>r(o)));s[n]=t((t=>React.createElement(m,e({Component:c},l,t)))),s[n].displayName=n}return s[n]};export{m as LazyComponent,d as PendingBoundary,u as createLazyModule,p as createLazyModuleWithStore,i as wrapPromise};
|
|
2
2
|
//# sourceMappingURL=LazyComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LazyComponent.js","sources":["../../../../../../../../../src/core/ui/components/container/lazyComponent/LazyComponent.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport { FC, memo, Suspense, lazy, ComponentType, PropsWithChildren, useRef, useMemo } from 'react'\n\nimport { ErrorBoundary } from '../../error/ErrorBoundary'\n\nimport classes from './lazyComponent.module.scss'\n\n\
|
|
1
|
+
{"version":3,"file":"LazyComponent.js","sources":["../../../../../../../../../src/core/ui/components/container/lazyComponent/LazyComponent.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport { FC, memo, Suspense, lazy, ComponentType, PropsWithChildren, useRef, useMemo } from 'react'\n\nimport { ErrorBoundary } from '../../error/ErrorBoundary'\n\nimport classes from './lazyComponent.module.scss'\n\n\n// not always necessary, since createLayzModule is called once per module,\n// but when nesting, inside loaded modules...\nconst map: Record<string, FC<any>> = {}\n\ntype ReactModule = {\n default: ComponentType<any>\n}\n\nexport type LazyComponentProps = PropsWithChildren<any> & {\n PropsWithChildren?: ComponentType<any>\n LoaderJSX?: JSX.Element\n}\n\nexport type wrapPromiseType = (promise: (() => Promise<any>) | Promise<any>) => { read: () => Promise<unknown> }\n\nexport const wrapPromise: wrapPromiseType = (promise: (() => Promise<any>) | Promise<any>) => {\n let status = 'pending'\n let result: any\n const suspend = (typeof promise === 'function' ? promise() : promise).then(\n (res) => {\n status = 'success'\n result = res\n },\n (err) => {\n status = 'error'\n result = err\n },\n )\n\n return {\n // eslint-disable-next-line consistent-return\n read(): any {\n if (status === 'pending') {\n throw suspend\n } else if (status === 'error') {\n throw result\n } else if (status === 'success') {\n return result\n }\n },\n }\n}\n\n\nexport const LazyComponent: FC<LazyComponentProps>\n= memo<LazyComponentProps>(({ children, Component, LoaderJSX, ...props }: LazyComponentProps) => {\n const Loader: React.ReactNode = useMemo(() => (\n <div className={classes.loader}>\n <svg className='spinner' viewBox='0 0 50 50'>\n <circle className='path' cx='25' cy='25' r='20' fill='none' strokeWidth='5' />\n </svg>\n </div>\n ), [])\n\n return (\n <ErrorBoundary>\n <Suspense fallback={LoaderJSX || Loader}>\n {Component && <Component {...props} />}\n {children && children}\n </Suspense>\n </ErrorBoundary>\n )\n})\n\nLazyComponent.displayName = 'LazyComponent'\n\nexport type PendingBoundaryProps = PropsWithChildren & {\n fallback?: JSX.Element\n promise?: Promise<unknown>\n pendingPromise?: { read: () => Promise<unknown> }\n}\n\nexport const PendingBoundary: FC<PendingBoundaryProps>\n= memo<PendingBoundaryProps>(({ pendingPromise, promise, fallback, children }: PendingBoundaryProps) => {\n const wrappedPromiseRef = useRef(pendingPromise || (promise && wrapPromise(promise)))\n\n const InnerComponent: FC<PropsWithChildren<any>> = useMemo(() => ({ children }: PropsWithChildren<any>) => {\n const innerPromise = wrappedPromiseRef.current?.read?.()\n\n return innerPromise?.then ? null : children\n }, [])\n\n return (\n <LazyComponent LoaderJSX={fallback}>\n <InnerComponent>{children}</InnerComponent>\n </LazyComponent>\n )\n})\n\nPendingBoundary.displayName = 'PendingBoundary'\n\n\nexport const createLazyModule = (\n lazyResolver: () => Promise<ReactModule>,\n displayName: string,\n defaultProps: Record<string, unknown> = {},\n): FC<unknown> => {\n if (!map[displayName]) {\n const Component = lazy(lazyResolver)\n\n // eslint-disable-next-line react/display-name\n map[displayName] = memo((props) => (<LazyComponent Component={Component} {...defaultProps} {...props} />))\n map[displayName].displayName = displayName\n }\n\n return map[displayName]\n}\n\n\nexport const createLazyModuleWithStore = <T, ComponentType>(\n lazyResolver: (store: T) => Promise<ReactModule>,\n displayName: string,\n defaultProps: Record<string, unknown>,\n): (store: T) => FC<ComponentType> => (store: T) => {\n if (!map[displayName]) {\n const Component = lazy(() => lazyResolver(store))\n\n // eslint-disable-next-line react/display-name\n map[displayName] = memo((props) => (<LazyComponent Component={Component} {...defaultProps} {...props} />))\n map[displayName].displayName = displayName\n }\n\n return map[displayName]\n }\n"],"names":["map","wrapPromise","promise","result","status","suspend","then","res","err","read","LazyComponent","memo","_ref","children","Component","LoaderJSX","props","Loader","useMemo","React","createElement","className","classes","loader","viewBox","cx","cy","r","fill","strokeWidth","ErrorBoundary","Suspense","fallback","displayName","PendingBoundary","_ref2","pendingPromise","wrappedPromiseRef","useRef","InnerComponent","_ref3","_wrappedPromiseRef$cu","_wrappedPromiseRef$cu2","innerPromise","current","call","createLazyModule","lazyResolver","defaultProps","arguments","length","undefined","lazy","_extends","createLazyModuleWithStore","store"],"mappings":"2QAUA,MAAMA,EAA+B,CAAA,EAaxBC,EAAgCC,IAC3C,IACIC,EADAC,EAAS,UAEb,MAAMC,GAA8B,mBAAZH,EAAyBA,IAAYA,GAASI,MACnEC,IACCH,EAAS,UACTD,EAASI,CAAG,IAEbC,IACCJ,EAAS,QACTD,EAASK,CAAG,IAIhB,MAAO,CAELC,IAAAA,GACE,GAAe,YAAXL,EACF,MAAMC,EACD,GAAe,UAAXD,EACT,MAAMD,EACD,GAAe,YAAXC,EACT,OAAOD,CAEX,EACD,EAIUO,EACXC,GAAyBC,IAAsE,IAArEC,SAAEA,EAAQC,UAAEA,EAASC,UAAEA,KAAcC,GAA2BJ,EAC1F,MAAMK,EAA0BC,GAAQ,IACtCC,MAAAC,cAAA,MAAA,CAAKC,UAAWC,EAAQC,QACtBJ,MAAAC,cAAA,MAAA,CAAKC,UAAU,UAAUG,QAAQ,aAC/BL,MAAAC,cAAA,SAAA,CAAQC,UAAU,OAAOI,GAAG,KAAKC,GAAG,KAAKC,EAAE,KAAKC,KAAK,OAAOC,YAAY,SAG3E,IAEH,OACEV,MAAAC,cAACU,OACCX,MAAAC,cAACW,EAAQ,CAACC,SAAUjB,GAAaE,GAC9BH,GAAaK,MAAAC,cAACN,EAAcE,GAC5BH,GAAYA,GAED,IAIpBH,EAAcuB,YAAc,sBAQfC,EACXvB,GAA2BwB,IAA2E,IAA1EC,eAAEA,EAAclC,QAAEA,EAAO8B,SAAEA,EAAQnB,SAAEA,GAAgCsB,EACjG,MAAME,EAAoBC,EAAOF,GAAmBlC,GAAWD,EAAYC,IAErEqC,EAA6CrB,GAAQ,IAAMsB,IAA0C,IAAAC,EAAAC,EAAA,IAAzC7B,SAAEA,GAAkC2B,EACpG,MAAMG,EAAwCF,QAA5BA,EAAGJ,EAAkBO,eAAOF,IAAAD,GAAM,QAANC,EAAzBD,EAA2BhC,YAAI,IAAAiC,OAAA,EAA/BA,EAAAG,KAAAJ,GAErB,OAAOE,SAAAA,EAAcrC,KAAO,KAAOO,CAAQ,GAC1C,IAEH,OACEM,MAAAC,cAACV,EAAa,CAACK,UAAWiB,GACxBb,MAAAC,cAACmB,EAAgB1B,KAAAA,GACH,IAIpBqB,EAAgBD,YAAc,kBAGvB,MAAMa,EAAmB,SAC9BC,EACAd,GAEgB,IADhBe,EAAqCC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EAExC,IAAKjD,EAAIiC,GAAc,CACrB,MAAMnB,EAAYsC,EAAKL,GAGvB/C,EAAIiC,GAAetB,GAAMK,GAAWG,MAAAC,cAACV,EAAa2C,EAAA,CAACvC,UAAWA,GAAekC,EAAkBhC,MAC/FhB,EAAIiC,GAAaA,YAAcA,CACjC,CAEA,OAAOjC,EAAIiC,EACb,EAGaqB,EAA4BA,CACvCP,EACAd,EACAe,IACqCO,IACnC,IAAKvD,EAAIiC,GAAc,CACrB,MAAMnB,EAAYsC,GAAK,IAAML,EAAaQ,KAG1CvD,EAAIiC,GAAetB,GAAMK,GAAWG,MAAAC,cAACV,EAAa2C,EAAA,CAACvC,UAAWA,GAAekC,EAAkBhC,MAC/FhB,EAAIiC,GAAaA,YAAcA,CACjC,CAEA,OAAOjC,EAAIiC,EAAY"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../../error/ErrorBoundary.js"),n=require("./lazyComponent.module.scss.js");const a=
|
|
1
|
+
"use strict";var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../../error/ErrorBoundary.js"),n=require("./lazyComponent.module.scss.js");const a={},o=e=>{let r,t="pending";const n=("function"==typeof e?e():e).then((e=>{t="success",r=e}),(e=>{t="error",r=e}));return{read(){if("pending"===t)throw n;if("error"===t)throw r;if("success"===t)return r}}},l=r.memo((e=>{let{children:a,Component:o,LoaderJSX:l,...c}=e;const s=r.useMemo((()=>React.createElement("div",{className:n.default.loader},React.createElement("svg",{className:"spinner",viewBox:"0 0 50 50"},React.createElement("circle",{className:"path",cx:"25",cy:"25",r:"20",fill:"none",strokeWidth:"5"})))),[]);return React.createElement(t.ErrorBoundary,null,React.createElement(r.Suspense,{fallback:l||s},o&&React.createElement(o,c),a&&a))}));l.displayName="LazyComponent";const c=r.memo((e=>{let{pendingPromise:t,promise:n,fallback:a,children:c}=e;const s=r.useRef(t||n&&o(n)),i=r.useMemo((()=>e=>{var r,t;let{children:n}=e;const a=null===(r=s.current)||void 0===r||null===(t=r.read)||void 0===t?void 0:t.call(r);return null!=a&&a.then?null:n}),[]);return React.createElement(l,{LoaderJSX:a},React.createElement(i,null,c))}));c.displayName="PendingBoundary";exports.LazyComponent=l,exports.PendingBoundary=c,exports.createLazyModule=function(t,n){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!a[n]){const c=r.lazy(t);a[n]=r.memo((r=>React.createElement(l,e.extends({Component:c},o,r)))),a[n].displayName=n}return a[n]},exports.createLazyModuleWithStore=(t,n,o)=>c=>{if(!a[n]){const s=r.lazy((()=>t(c)));a[n]=r.memo((r=>React.createElement(l,e.extends({Component:s},o,r)))),a[n].displayName=n}return a[n]},exports.wrapPromise=o;
|
|
2
2
|
//# sourceMappingURL=LazyComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LazyComponent.js","sources":["../../../../../../../../src/core/ui/components/container/lazyComponent/LazyComponent.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport { FC, memo, Suspense, lazy, ComponentType, PropsWithChildren, useRef, useMemo } from 'react'\n\nimport { ErrorBoundary } from '../../error/ErrorBoundary'\n\nimport classes from './lazyComponent.module.scss'\n\n\
|
|
1
|
+
{"version":3,"file":"LazyComponent.js","sources":["../../../../../../../../src/core/ui/components/container/lazyComponent/LazyComponent.tsx"],"sourcesContent":["/* eslint-disable react/display-name */\nimport { FC, memo, Suspense, lazy, ComponentType, PropsWithChildren, useRef, useMemo } from 'react'\n\nimport { ErrorBoundary } from '../../error/ErrorBoundary'\n\nimport classes from './lazyComponent.module.scss'\n\n\n// not always necessary, since createLayzModule is called once per module,\n// but when nesting, inside loaded modules...\nconst map: Record<string, FC<any>> = {}\n\ntype ReactModule = {\n default: ComponentType<any>\n}\n\nexport type LazyComponentProps = PropsWithChildren<any> & {\n PropsWithChildren?: ComponentType<any>\n LoaderJSX?: JSX.Element\n}\n\nexport type wrapPromiseType = (promise: (() => Promise<any>) | Promise<any>) => { read: () => Promise<unknown> }\n\nexport const wrapPromise: wrapPromiseType = (promise: (() => Promise<any>) | Promise<any>) => {\n let status = 'pending'\n let result: any\n const suspend = (typeof promise === 'function' ? promise() : promise).then(\n (res) => {\n status = 'success'\n result = res\n },\n (err) => {\n status = 'error'\n result = err\n },\n )\n\n return {\n // eslint-disable-next-line consistent-return\n read(): any {\n if (status === 'pending') {\n throw suspend\n } else if (status === 'error') {\n throw result\n } else if (status === 'success') {\n return result\n }\n },\n }\n}\n\n\nexport const LazyComponent: FC<LazyComponentProps>\n= memo<LazyComponentProps>(({ children, Component, LoaderJSX, ...props }: LazyComponentProps) => {\n const Loader: React.ReactNode = useMemo(() => (\n <div className={classes.loader}>\n <svg className='spinner' viewBox='0 0 50 50'>\n <circle className='path' cx='25' cy='25' r='20' fill='none' strokeWidth='5' />\n </svg>\n </div>\n ), [])\n\n return (\n <ErrorBoundary>\n <Suspense fallback={LoaderJSX || Loader}>\n {Component && <Component {...props} />}\n {children && children}\n </Suspense>\n </ErrorBoundary>\n )\n})\n\nLazyComponent.displayName = 'LazyComponent'\n\nexport type PendingBoundaryProps = PropsWithChildren & {\n fallback?: JSX.Element\n promise?: Promise<unknown>\n pendingPromise?: { read: () => Promise<unknown> }\n}\n\nexport const PendingBoundary: FC<PendingBoundaryProps>\n= memo<PendingBoundaryProps>(({ pendingPromise, promise, fallback, children }: PendingBoundaryProps) => {\n const wrappedPromiseRef = useRef(pendingPromise || (promise && wrapPromise(promise)))\n\n const InnerComponent: FC<PropsWithChildren<any>> = useMemo(() => ({ children }: PropsWithChildren<any>) => {\n const innerPromise = wrappedPromiseRef.current?.read?.()\n\n return innerPromise?.then ? null : children\n }, [])\n\n return (\n <LazyComponent LoaderJSX={fallback}>\n <InnerComponent>{children}</InnerComponent>\n </LazyComponent>\n )\n})\n\nPendingBoundary.displayName = 'PendingBoundary'\n\n\nexport const createLazyModule = (\n lazyResolver: () => Promise<ReactModule>,\n displayName: string,\n defaultProps: Record<string, unknown> = {},\n): FC<unknown> => {\n if (!map[displayName]) {\n const Component = lazy(lazyResolver)\n\n // eslint-disable-next-line react/display-name\n map[displayName] = memo((props) => (<LazyComponent Component={Component} {...defaultProps} {...props} />))\n map[displayName].displayName = displayName\n }\n\n return map[displayName]\n}\n\n\nexport const createLazyModuleWithStore = <T, ComponentType>(\n lazyResolver: (store: T) => Promise<ReactModule>,\n displayName: string,\n defaultProps: Record<string, unknown>,\n): (store: T) => FC<ComponentType> => (store: T) => {\n if (!map[displayName]) {\n const Component = lazy(() => lazyResolver(store))\n\n // eslint-disable-next-line react/display-name\n map[displayName] = memo((props) => (<LazyComponent Component={Component} {...defaultProps} {...props} />))\n map[displayName].displayName = displayName\n }\n\n return map[displayName]\n }\n"],"names":["map","wrapPromise","promise","result","status","suspend","then","res","err","read","LazyComponent","memo","_ref","children","Component","LoaderJSX","props","Loader","useMemo","React","createElement","className","classes","default","loader","viewBox","cx","cy","r","fill","strokeWidth","ErrorBoundary","Suspense","fallback","displayName","PendingBoundary","_ref2","pendingPromise","wrappedPromiseRef","useRef","InnerComponent","_ref3","_wrappedPromiseRef$cu","_wrappedPromiseRef$cu2","innerPromise","current","call","lazyResolver","defaultProps","arguments","length","undefined","lazy","_extends","createLazyModuleWithStore","store"],"mappings":"+LAUA,MAAMA,EAA+B,CAAA,EAaxBC,EAAgCC,IAC3C,IACIC,EADAC,EAAS,UAEb,MAAMC,GAA8B,mBAAZH,EAAyBA,IAAYA,GAASI,MACnEC,IACCH,EAAS,UACTD,EAASI,CAAG,IAEbC,IACCJ,EAAS,QACTD,EAASK,CAAG,IAIhB,MAAO,CAELC,IAAAA,GACE,GAAe,YAAXL,EACF,MAAMC,EACD,GAAe,UAAXD,EACT,MAAMD,EACD,GAAe,YAAXC,EACT,OAAOD,CAEX,EACD,EAIUO,EACXC,EAAIA,MAAqBC,IAAsE,IAArEC,SAAEA,EAAQC,UAAEA,EAASC,UAAEA,KAAcC,GAA2BJ,EAC1F,MAAMK,EAA0BC,EAAOA,SAAC,IACtCC,MAAAC,cAAA,MAAA,CAAKC,UAAWC,EAAOC,QAACC,QACtBL,MAAAC,cAAA,MAAA,CAAKC,UAAU,UAAUI,QAAQ,aAC/BN,MAAAC,cAAA,SAAA,CAAQC,UAAU,OAAOK,GAAG,KAAKC,GAAG,KAAKC,EAAE,KAAKC,KAAK,OAAOC,YAAY,SAG3E,IAEH,OACEX,MAAAC,cAACW,EAAaA,mBACZZ,MAAAC,cAACY,WAAQ,CAACC,SAAUlB,GAAaE,GAC9BH,GAAaK,MAAAC,cAACN,EAAcE,GAC5BH,GAAYA,GAED,IAIpBH,EAAcwB,YAAc,sBAQfC,EACXxB,EAAIA,MAAuByB,IAA2E,IAA1EC,eAAEA,EAAcnC,QAAEA,EAAO+B,SAAEA,EAAQpB,SAAEA,GAAgCuB,EACjG,MAAME,EAAoBC,EAAAA,OAAOF,GAAmBnC,GAAWD,EAAYC,IAErEsC,EAA6CtB,WAAQ,IAAMuB,IAA0C,IAAAC,EAAAC,EAAA,IAAzC9B,SAAEA,GAAkC4B,EACpG,MAAMG,EAAwCF,QAA5BA,EAAGJ,EAAkBO,eAAOF,IAAAD,GAAM,QAANC,EAAzBD,EAA2BjC,YAAI,IAAAkC,OAAA,EAA/BA,EAAAG,KAAAJ,GAErB,OAAOE,SAAAA,EAActC,KAAO,KAAOO,CAAQ,GAC1C,IAEH,OACEM,MAAAC,cAACV,EAAa,CAACK,UAAWkB,GACxBd,MAAAC,cAACoB,EAAgB3B,KAAAA,GACH,IAIpBsB,EAAgBD,YAAc,6FAGE,SAC9Ba,EACAb,GAEgB,IADhBc,EAAqCC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EAExC,IAAKjD,EAAIkC,GAAc,CACrB,MAAMpB,EAAYsC,OAAKL,GAGvB/C,EAAIkC,GAAevB,QAAMK,GAAWG,MAAAC,cAACV,EAAa2C,UAAA,CAACvC,UAAWA,GAAekC,EAAkBhC,MAC/FhB,EAAIkC,GAAaA,YAAcA,CACjC,CAEA,OAAOlC,EAAIkC,EACb,oCAGyCoB,CACvCP,EACAb,EACAc,IACqCO,IACnC,IAAKvD,EAAIkC,GAAc,CACrB,MAAMpB,EAAYsC,EAAIA,MAAC,IAAML,EAAaQ,KAG1CvD,EAAIkC,GAAevB,QAAMK,GAAWG,MAAAC,cAACV,EAAa2C,UAAA,CAACvC,UAAWA,GAAekC,EAAkBhC,MAC/FhB,EAAIkC,GAAaA,YAAcA,CACjC,CAEA,OAAOlC,EAAIkC,EAAY"}
|
package/dist/utils/esm/index.css
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
.errorBoundary-module_errorBoundary__gk9ps {
|
|
2
|
+
background: #EFEFEF;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.errorBoundary-module_StyledIcon__IYHiU {
|
|
8
|
+
margin-right: 10px;
|
|
9
|
+
}
|
|
10
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm {
|
|
11
|
+
transform-origin: 0% 0%;
|
|
12
|
+
opacity: 0;
|
|
13
|
+
overflow: clip;
|
|
14
|
+
}
|
|
15
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN {
|
|
16
|
+
transition: opacity 0.2s ease-in-out, height 0.2s ease-in-out, max-height 0.2s ease-in-out;
|
|
17
|
+
will-change: opacity, height, max-height;
|
|
18
|
+
}
|
|
19
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN.CollapsibleContainer-module_collapsed__q8fs8 {
|
|
20
|
+
height: 0;
|
|
21
|
+
max-height: 0;
|
|
22
|
+
opacity: 0;
|
|
23
|
+
}
|
|
24
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN.CollapsibleContainer-module_expanded__O6Vh8 {
|
|
25
|
+
height: var(--prop-value);
|
|
26
|
+
max-height: var(--prop-value);
|
|
27
|
+
opacity: 1;
|
|
28
|
+
}
|
|
29
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI- {
|
|
30
|
+
transition: opacity 0.2s ease-in-out, width 0.2s ease-in-out, max-width 0.2s ease-in-out;
|
|
31
|
+
will-change: opacity, width, max-width;
|
|
32
|
+
}
|
|
33
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI-.CollapsibleContainer-module_collapsed__q8fs8 {
|
|
34
|
+
width: 0;
|
|
35
|
+
max-width: 0;
|
|
36
|
+
opacity: 0;
|
|
37
|
+
}
|
|
38
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI-.CollapsibleContainer-module_expanded__O6Vh8 {
|
|
39
|
+
width: var(--prop-value);
|
|
40
|
+
max-width: var(--prop-value);
|
|
41
|
+
opacity: 1;
|
|
42
|
+
}
|
|
1
43
|
.icon-module_icon-base-parent__nOMvW {
|
|
2
44
|
line-height: 1px !important;
|
|
3
45
|
}
|
|
@@ -28,15 +70,6 @@
|
|
|
28
70
|
width: var(--height);
|
|
29
71
|
height: var(--width);
|
|
30
72
|
}
|
|
31
|
-
.errorBoundary-module_errorBoundary__gk9ps {
|
|
32
|
-
background: #EFEFEF;
|
|
33
|
-
width: 100%;
|
|
34
|
-
height: 100%;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.errorBoundary-module_StyledIcon__IYHiU {
|
|
38
|
-
margin-right: 10px;
|
|
39
|
-
}
|
|
40
73
|
.divider-module_divider-line__6CesR {
|
|
41
74
|
position: relative;
|
|
42
75
|
display: block;
|
|
@@ -56,39 +89,6 @@
|
|
|
56
89
|
height: var(--height);
|
|
57
90
|
margin: var(--margin);
|
|
58
91
|
}
|
|
59
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm {
|
|
60
|
-
transform-origin: 0% 0%;
|
|
61
|
-
opacity: 0;
|
|
62
|
-
overflow: clip;
|
|
63
|
-
}
|
|
64
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN {
|
|
65
|
-
transition: opacity 0.2s ease-in-out, height 0.2s ease-in-out, max-height 0.2s ease-in-out;
|
|
66
|
-
will-change: opacity, height, max-height;
|
|
67
|
-
}
|
|
68
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN.CollapsibleContainer-module_collapsed__q8fs8 {
|
|
69
|
-
height: 0;
|
|
70
|
-
max-height: 0;
|
|
71
|
-
opacity: 0;
|
|
72
|
-
}
|
|
73
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN.CollapsibleContainer-module_expanded__O6Vh8 {
|
|
74
|
-
height: var(--prop-value);
|
|
75
|
-
max-height: var(--prop-value);
|
|
76
|
-
opacity: 1;
|
|
77
|
-
}
|
|
78
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI- {
|
|
79
|
-
transition: opacity 0.2s ease-in-out, width 0.2s ease-in-out, max-width 0.2s ease-in-out;
|
|
80
|
-
will-change: opacity, width, max-width;
|
|
81
|
-
}
|
|
82
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI-.CollapsibleContainer-module_collapsed__q8fs8 {
|
|
83
|
-
width: 0;
|
|
84
|
-
max-width: 0;
|
|
85
|
-
opacity: 0;
|
|
86
|
-
}
|
|
87
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI-.CollapsibleContainer-module_expanded__O6Vh8 {
|
|
88
|
-
width: var(--prop-value);
|
|
89
|
-
max-width: var(--prop-value);
|
|
90
|
-
opacity: 1;
|
|
91
|
-
}
|
|
92
92
|
.layoutBox-module_layout-box__ZIID8 {
|
|
93
93
|
display: flex;
|
|
94
94
|
position: relative;
|
package/dist/utils/index.css
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
.errorBoundary-module_errorBoundary__gk9ps {
|
|
2
|
+
background: #EFEFEF;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.errorBoundary-module_StyledIcon__IYHiU {
|
|
8
|
+
margin-right: 10px;
|
|
9
|
+
}
|
|
10
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm {
|
|
11
|
+
transform-origin: 0% 0%;
|
|
12
|
+
opacity: 0;
|
|
13
|
+
overflow: clip;
|
|
14
|
+
}
|
|
15
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN {
|
|
16
|
+
transition: opacity 0.2s ease-in-out, height 0.2s ease-in-out, max-height 0.2s ease-in-out;
|
|
17
|
+
will-change: opacity, height, max-height;
|
|
18
|
+
}
|
|
19
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN.CollapsibleContainer-module_collapsed__q8fs8 {
|
|
20
|
+
height: 0;
|
|
21
|
+
max-height: 0;
|
|
22
|
+
opacity: 0;
|
|
23
|
+
}
|
|
24
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN.CollapsibleContainer-module_expanded__O6Vh8 {
|
|
25
|
+
height: var(--prop-value);
|
|
26
|
+
max-height: var(--prop-value);
|
|
27
|
+
opacity: 1;
|
|
28
|
+
}
|
|
29
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI- {
|
|
30
|
+
transition: opacity 0.2s ease-in-out, width 0.2s ease-in-out, max-width 0.2s ease-in-out;
|
|
31
|
+
will-change: opacity, width, max-width;
|
|
32
|
+
}
|
|
33
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI-.CollapsibleContainer-module_collapsed__q8fs8 {
|
|
34
|
+
width: 0;
|
|
35
|
+
max-width: 0;
|
|
36
|
+
opacity: 0;
|
|
37
|
+
}
|
|
38
|
+
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI-.CollapsibleContainer-module_expanded__O6Vh8 {
|
|
39
|
+
width: var(--prop-value);
|
|
40
|
+
max-width: var(--prop-value);
|
|
41
|
+
opacity: 1;
|
|
42
|
+
}
|
|
1
43
|
.icon-module_icon-base-parent__nOMvW {
|
|
2
44
|
line-height: 1px !important;
|
|
3
45
|
}
|
|
@@ -28,15 +70,6 @@
|
|
|
28
70
|
width: var(--height);
|
|
29
71
|
height: var(--width);
|
|
30
72
|
}
|
|
31
|
-
.errorBoundary-module_errorBoundary__gk9ps {
|
|
32
|
-
background: #EFEFEF;
|
|
33
|
-
width: 100%;
|
|
34
|
-
height: 100%;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.errorBoundary-module_StyledIcon__IYHiU {
|
|
38
|
-
margin-right: 10px;
|
|
39
|
-
}
|
|
40
73
|
.divider-module_divider-line__6CesR {
|
|
41
74
|
position: relative;
|
|
42
75
|
display: block;
|
|
@@ -56,39 +89,6 @@
|
|
|
56
89
|
height: var(--height);
|
|
57
90
|
margin: var(--margin);
|
|
58
91
|
}
|
|
59
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm {
|
|
60
|
-
transform-origin: 0% 0%;
|
|
61
|
-
opacity: 0;
|
|
62
|
-
overflow: clip;
|
|
63
|
-
}
|
|
64
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN {
|
|
65
|
-
transition: opacity 0.2s ease-in-out, height 0.2s ease-in-out, max-height 0.2s ease-in-out;
|
|
66
|
-
will-change: opacity, height, max-height;
|
|
67
|
-
}
|
|
68
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN.CollapsibleContainer-module_collapsed__q8fs8 {
|
|
69
|
-
height: 0;
|
|
70
|
-
max-height: 0;
|
|
71
|
-
opacity: 0;
|
|
72
|
-
}
|
|
73
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_vertical__w7MVN.CollapsibleContainer-module_expanded__O6Vh8 {
|
|
74
|
-
height: var(--prop-value);
|
|
75
|
-
max-height: var(--prop-value);
|
|
76
|
-
opacity: 1;
|
|
77
|
-
}
|
|
78
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI- {
|
|
79
|
-
transition: opacity 0.2s ease-in-out, width 0.2s ease-in-out, max-width 0.2s ease-in-out;
|
|
80
|
-
will-change: opacity, width, max-width;
|
|
81
|
-
}
|
|
82
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI-.CollapsibleContainer-module_collapsed__q8fs8 {
|
|
83
|
-
width: 0;
|
|
84
|
-
max-width: 0;
|
|
85
|
-
opacity: 0;
|
|
86
|
-
}
|
|
87
|
-
.CollapsibleContainer-module_collapsible-container__u0Jmm.CollapsibleContainer-module_horizontal__QJWI-.CollapsibleContainer-module_expanded__O6Vh8 {
|
|
88
|
-
width: var(--prop-value);
|
|
89
|
-
max-width: var(--prop-value);
|
|
90
|
-
opacity: 1;
|
|
91
|
-
}
|
|
92
92
|
.layoutBox-module_layout-box__ZIID8 {
|
|
93
93
|
display: flex;
|
|
94
94
|
position: relative;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e1011/es-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.226",
|
|
4
4
|
"main": "dist/lib/cjs/src/index.js",
|
|
5
5
|
"module": "dist/lib/esm/src/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -128,6 +128,7 @@
|
|
|
128
128
|
"reflect-metadata": "^0.1.13",
|
|
129
129
|
"reselect": "^4.1.8",
|
|
130
130
|
"rollup": "^4.9.2",
|
|
131
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
131
132
|
"rollup-plugin-postcss": "^4.0.2",
|
|
132
133
|
"rollup-plugin-tsconfig-paths": "^1.5.2",
|
|
133
134
|
"sass": "^1.59.3",
|
|
@@ -136,30 +137,24 @@
|
|
|
136
137
|
"ts-jest": "^29.0.5",
|
|
137
138
|
"ts-node": "^10.9.1",
|
|
138
139
|
"typed-scss-modules": "^8.0.0",
|
|
139
|
-
"typescript": "^5.3.3"
|
|
140
|
+
"typescript": "^5.3.3",
|
|
141
|
+
"vite": "^5.2.6"
|
|
140
142
|
},
|
|
141
143
|
"dependencies": {
|
|
142
144
|
"core-js": "^3.20.2",
|
|
143
145
|
"dayjs": "^1.10.7",
|
|
144
|
-
"i18next": "^21.6.14",
|
|
145
146
|
"lodash-es": "^4.17.21",
|
|
146
147
|
"ramda": "^0.27.1",
|
|
147
148
|
"react": "^17.0.2 || ^18.2.0",
|
|
148
|
-
"react-dom": "^17.0.2 || ^18.2.0",
|
|
149
|
-
"react-i18next": "^11.16.2",
|
|
150
149
|
"sanitize-html": "^2.6.1",
|
|
151
|
-
"styled-components": "^6.1.8"
|
|
152
|
-
"vite": "^5.2.6"
|
|
150
|
+
"styled-components": "^6.1.8"
|
|
153
151
|
},
|
|
154
152
|
"peerDdependencies": {
|
|
155
153
|
"core-js": "^3.20.2",
|
|
156
154
|
"dayjs": "^1.10.7",
|
|
157
|
-
"i18next": "^21.6.14",
|
|
158
155
|
"lodash-es": "^4.17.21",
|
|
159
156
|
"ramda": "^0.27.1",
|
|
160
157
|
"react": "^17.0.2 || ^18.2.0",
|
|
161
|
-
"react-dom": "^17.0.2 || ^18.2.0",
|
|
162
|
-
"react-i18next": "^11.16.2",
|
|
163
158
|
"sanitize-html": "^2.6.1",
|
|
164
159
|
"styled-components": "^6.1.8"
|
|
165
160
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"../../../node_modules/core-js/modules/web.dom-collections.iterator.js";import{useTranslation as t}from"react-i18next";const e=new Map;let r=t;const o=t=>{r=t},n=t=>{if(e.has(t))return e.get(t);const r=(e,r)=>{if(!e)return"";const o=e.split(" ");return 2===o.length?t(o[0],{...r,limit:o[1]}):t(e,r)};return e.set(t,r),r},s=t=>{const{t:e}=r(t);return{t:n(e)}};export{n as createSafeT,o as setUseTranslation,s as useTranslations};
|
|
2
|
-
//# sourceMappingURL=useTranslations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslations.js","sources":["../../../../../../src/core/hooks/useTranslations.ts"],"sourcesContent":["import { TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\n\ntype tValuFunction = (key: string | undefined, params?: Record<string, any>) => string\nconst cache: Map<TFunction, tValuFunction> = new Map()\n\nlet resolvedUseTranslation = useTranslation\n\nexport const setUseTranslation = (useTrans: any): void => {\n resolvedUseTranslation = useTrans\n}\n\nexport const createSafeT = (t: TFunction): tValuFunction => {\n if (cache.has(t)) {\n return cache.get(t) as tValuFunction\n }\n const value: tValuFunction = ((key: string | undefined, params?: Record<string, any>): string => {\n if (!key) {\n return ''\n }\n const limits = key.split(' ')\n\n if (limits.length === 2) {\n return t(limits[0], { ...params, limit: limits[1] })\n }\n return t(key, params)\n })\n\n cache.set(t, value)\n return value\n}\n\ntype safeTF = { t: (key: string | undefined, params?: Record<string, any>) => string }\n\n// TODO memoize\nexport const useTranslations = (namespaces: string[]): safeTF => {\n const { t } = resolvedUseTranslation(namespaces)\n\n return { t: createSafeT(t) as tValuFunction }\n}\n"],"names":["cache","Map","resolvedUseTranslation","useTranslation","setUseTranslation","useTrans","createSafeT","t","has","get","value","key","params","limits","split","length","limit","set","useTranslations","namespaces"],"mappings":"6HAIA,MAAMA,EAAuC,IAAIC,IAEjD,IAAIC,EAAyBC,EAEhBC,MAAAA,EAAqBC,IAChCH,EAAyBG,CAAQ,EAGtBC,EAAeC,IAC1B,GAAIP,EAAMQ,IAAID,GACZ,OAAOP,EAAMS,IAAIF,GAEnB,MAAMG,EAAwBA,CAACC,EAAyBC,KACtD,IAAKD,EACH,MAAO,GAET,MAAME,EAASF,EAAIG,MAAM,KAEzB,OAAsB,IAAlBD,EAAOE,OACFR,EAAEM,EAAO,GAAI,IAAKD,EAAQI,MAAOH,EAAO,KAE1CN,EAAEI,EAAKC,EAAO,EAIvB,OADAZ,EAAMiB,IAAIV,EAAGG,GACNA,CAAK,EAMDQ,EAAmBC,IAC9B,MAAMZ,EAAEA,GAAML,EAAuBiB,GAErC,MAAO,CAAEZ,EAAGD,EAAYC,GAAqB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";require("../../../node_modules/core-js/modules/web.dom-collections.iterator.js");var e=require("react-i18next");const t=new Map;let r=e.useTranslation;const s=e=>{if(t.has(e))return t.get(e);const r=(t,r)=>{if(!t)return"";const s=t.split(" ");return 2===s.length?e(s[0],{...r,limit:s[1]}):e(t,r)};return t.set(e,r),r};exports.createSafeT=s,exports.setUseTranslation=e=>{r=e},exports.useTranslations=e=>{const{t:t}=r(e);return{t:s(t)}};
|
|
2
|
-
//# sourceMappingURL=useTranslations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslations.js","sources":["../../../../../src/core/hooks/useTranslations.ts"],"sourcesContent":["import { TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\n\ntype tValuFunction = (key: string | undefined, params?: Record<string, any>) => string\nconst cache: Map<TFunction, tValuFunction> = new Map()\n\nlet resolvedUseTranslation = useTranslation\n\nexport const setUseTranslation = (useTrans: any): void => {\n resolvedUseTranslation = useTrans\n}\n\nexport const createSafeT = (t: TFunction): tValuFunction => {\n if (cache.has(t)) {\n return cache.get(t) as tValuFunction\n }\n const value: tValuFunction = ((key: string | undefined, params?: Record<string, any>): string => {\n if (!key) {\n return ''\n }\n const limits = key.split(' ')\n\n if (limits.length === 2) {\n return t(limits[0], { ...params, limit: limits[1] })\n }\n return t(key, params)\n })\n\n cache.set(t, value)\n return value\n}\n\ntype safeTF = { t: (key: string | undefined, params?: Record<string, any>) => string }\n\n// TODO memoize\nexport const useTranslations = (namespaces: string[]): safeTF => {\n const { t } = resolvedUseTranslation(namespaces)\n\n return { t: createSafeT(t) as tValuFunction }\n}\n"],"names":["cache","Map","resolvedUseTranslation","useTranslation","setUseTranslation","createSafeT","t","has","get","value","key","params","limits","split","length","limit","set","useTrans","namespaces"],"mappings":"6HAIA,MAAMA,EAAuC,IAAIC,IAEjD,IAAIC,EAAyBC,EAAAA,eAEhBC,MAIAC,EAAeC,IAC1B,GAAIN,EAAMO,IAAID,GACZ,OAAON,EAAMQ,IAAIF,GAEnB,MAAMG,EAAwBA,CAACC,EAAyBC,KACtD,IAAKD,EACH,MAAO,GAET,MAAME,EAASF,EAAIG,MAAM,KAEzB,OAAsB,IAAlBD,EAAOE,OACFR,EAAEM,EAAO,GAAI,IAAKD,EAAQI,MAAOH,EAAO,KAE1CN,EAAEI,EAAKC,EAAO,EAIvB,OADAX,EAAMgB,IAAIV,EAAGG,GACNA,CAAK,kDArBoBQ,IAChCf,EAAyBe,CAAQ,0BA0BHC,IAC9B,MAAMZ,EAAEA,GAAMJ,EAAuBgB,GAErC,MAAO,CAAEZ,EAAGD,EAAYC,GAAqB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";require("../../../node_modules/core-js/modules/web.dom-collections.iterator.js");var e=require("react-i18next");const t=new Map;let r=e.useTranslation;const s=e=>{if(t.has(e))return t.get(e);const r=(t,r)=>{if(!t)return"";const s=t.split(" ");return 2===s.length?e(s[0],{...r,limit:s[1]}):e(t,r)};return t.set(e,r),r};exports.createSafeT=s,exports.setUseTranslation=e=>{r=e},exports.useTranslations=e=>{const{t:t}=r(e);return{t:s(t)}};
|
|
2
|
-
//# sourceMappingURL=useTranslations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslations.js","sources":["../../../../../../src/core/hooks/useTranslations.ts"],"sourcesContent":["import { TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\n\ntype tValuFunction = (key: string | undefined, params?: Record<string, any>) => string\nconst cache: Map<TFunction, tValuFunction> = new Map()\n\nlet resolvedUseTranslation = useTranslation\n\nexport const setUseTranslation = (useTrans: any): void => {\n resolvedUseTranslation = useTrans\n}\n\nexport const createSafeT = (t: TFunction): tValuFunction => {\n if (cache.has(t)) {\n return cache.get(t) as tValuFunction\n }\n const value: tValuFunction = ((key: string | undefined, params?: Record<string, any>): string => {\n if (!key) {\n return ''\n }\n const limits = key.split(' ')\n\n if (limits.length === 2) {\n return t(limits[0], { ...params, limit: limits[1] })\n }\n return t(key, params)\n })\n\n cache.set(t, value)\n return value\n}\n\ntype safeTF = { t: (key: string | undefined, params?: Record<string, any>) => string }\n\n// TODO memoize\nexport const useTranslations = (namespaces: string[]): safeTF => {\n const { t } = resolvedUseTranslation(namespaces)\n\n return { t: createSafeT(t) as tValuFunction }\n}\n"],"names":["cache","Map","resolvedUseTranslation","useTranslation","setUseTranslation","createSafeT","t","has","get","value","key","params","limits","split","length","limit","set","useTrans","namespaces"],"mappings":"6HAIA,MAAMA,EAAuC,IAAIC,IAEjD,IAAIC,EAAyBC,EAAAA,eAEhBC,MAIAC,EAAeC,IAC1B,GAAIN,EAAMO,IAAID,GACZ,OAAON,EAAMQ,IAAIF,GAEnB,MAAMG,EAAwBA,CAACC,EAAyBC,KACtD,IAAKD,EACH,MAAO,GAET,MAAME,EAASF,EAAIG,MAAM,KAEzB,OAAsB,IAAlBD,EAAOE,OACFR,EAAEM,EAAO,GAAI,IAAKD,EAAQI,MAAOH,EAAO,KAE1CN,EAAEI,EAAKC,EAAO,EAIvB,OADAX,EAAMgB,IAAIV,EAAGG,GACNA,CAAK,kDArBoBQ,IAChCf,EAAyBe,CAAQ,0BA0BHC,IAC9B,MAAMZ,EAAEA,GAAMJ,EAAuBgB,GAErC,MAAO,CAAEZ,EAAGD,EAAYC,GAAqB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import"../../../node_modules/core-js/modules/web.dom-collections.iterator.js";import{useTranslation as t}from"react-i18next";const e=new Map;let r=t;const o=t=>{r=t},n=t=>{if(e.has(t))return e.get(t);const r=(e,r)=>{if(!e)return"";const o=e.split(" ");return 2===o.length?t(o[0],{...r,limit:o[1]}):t(e,r)};return e.set(t,r),r},s=t=>{const{t:e}=r(t);return{t:n(e)}};export{n as createSafeT,o as setUseTranslation,s as useTranslations};
|
|
2
|
-
//# sourceMappingURL=useTranslations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslations.js","sources":["../../../../../../src/core/hooks/useTranslations.ts"],"sourcesContent":["import { TFunction } from 'i18next'\nimport { useTranslation } from 'react-i18next'\n\ntype tValuFunction = (key: string | undefined, params?: Record<string, any>) => string\nconst cache: Map<TFunction, tValuFunction> = new Map()\n\nlet resolvedUseTranslation = useTranslation\n\nexport const setUseTranslation = (useTrans: any): void => {\n resolvedUseTranslation = useTrans\n}\n\nexport const createSafeT = (t: TFunction): tValuFunction => {\n if (cache.has(t)) {\n return cache.get(t) as tValuFunction\n }\n const value: tValuFunction = ((key: string | undefined, params?: Record<string, any>): string => {\n if (!key) {\n return ''\n }\n const limits = key.split(' ')\n\n if (limits.length === 2) {\n return t(limits[0], { ...params, limit: limits[1] })\n }\n return t(key, params)\n })\n\n cache.set(t, value)\n return value\n}\n\ntype safeTF = { t: (key: string | undefined, params?: Record<string, any>) => string }\n\n// TODO memoize\nexport const useTranslations = (namespaces: string[]): safeTF => {\n const { t } = resolvedUseTranslation(namespaces)\n\n return { t: createSafeT(t) as tValuFunction }\n}\n"],"names":["cache","Map","resolvedUseTranslation","useTranslation","setUseTranslation","useTrans","createSafeT","t","has","get","value","key","params","limits","split","length","limit","set","useTranslations","namespaces"],"mappings":"6HAIA,MAAMA,EAAuC,IAAIC,IAEjD,IAAIC,EAAyBC,EAEhBC,MAAAA,EAAqBC,IAChCH,EAAyBG,CAAQ,EAGtBC,EAAeC,IAC1B,GAAIP,EAAMQ,IAAID,GACZ,OAAOP,EAAMS,IAAIF,GAEnB,MAAMG,EAAwBA,CAACC,EAAyBC,KACtD,IAAKD,EACH,MAAO,GAET,MAAME,EAASF,EAAIG,MAAM,KAEzB,OAAsB,IAAlBD,EAAOE,OACFR,EAAEM,EAAO,GAAI,IAAKD,EAAQI,MAAOH,EAAO,KAE1CN,EAAEI,EAAKC,EAAO,EAIvB,OADAZ,EAAMiB,IAAIV,EAAGG,GACNA,CAAK,EAMDQ,EAAmBC,IAC9B,MAAMZ,EAAEA,GAAML,EAAuBiB,GAErC,MAAO,CAAEZ,EAAGD,EAAYC,GAAqB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { TFunction } from 'i18next';
|
|
2
|
-
type tValuFunction = (key: string | undefined, params?: Record<string, any>) => string;
|
|
3
|
-
export declare const setUseTranslation: (useTrans: any) => void;
|
|
4
|
-
export declare const createSafeT: (t: TFunction) => tValuFunction;
|
|
5
|
-
type safeTF = {
|
|
6
|
-
t: (key: string | undefined, params?: Record<string, any>) => string;
|
|
7
|
-
};
|
|
8
|
-
export declare const useTranslations: (namespaces: string[]) => safeTF;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=useTranslations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslations.d.ts","sourceRoot":"","sources":["../../../../../src/core/hooks/useTranslations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGnC,KAAK,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,CAAA;AAKtF,eAAO,MAAM,iBAAiB,aAAc,GAAG,KAAG,IAEjD,CAAA;AAED,eAAO,MAAM,WAAW,MAAO,SAAS,KAAG,aAkB1C,CAAA;AAED,KAAK,MAAM,GAAG;IAAE,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,MAAM,CAAA;CAAE,CAAA;AAGtF,eAAO,MAAM,eAAe,eAAgB,MAAM,EAAE,KAAG,MAItD,CAAA"}
|