@evlop/commons 1.0.314 → 1.0.316

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.
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface RenderInBackgroundProps {
3
+ children: React.ReactNode;
4
+ fallback?: React.ReactNode;
5
+ }
6
+ export declare const RenderInBackground: ({ children, fallback }: RenderInBackgroundProps) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=RenderInBackground.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderInBackground.d.ts","sourceRoot":"","sources":["../../../../src/components/RenderInBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAK9E,UAAU,uBAAuB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,GAAI,wBAGhC,uBAAuB,8EAczB,CAAA"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.RenderInBackground = void 0;
40
+ const react_1 = __importStar(require("react"));
41
+ const EmptyComponent_1 = __importDefault(require("./EmptyComponent"));
42
+ const defaultFallback = react_1.default.createElement(EmptyComponent_1.default, null);
43
+ const RenderInBackground = ({ children, fallback = defaultFallback }) => {
44
+ const [isReady, setIsReady] = (0, react_1.useState)(false);
45
+ (0, react_1.useEffect)(() => {
46
+ (0, react_1.startTransition)(() => {
47
+ setIsReady(true);
48
+ });
49
+ }, []);
50
+ if (!isReady) {
51
+ return fallback;
52
+ }
53
+ return react_1.default.createElement(react_1.Suspense, { fallback: fallback }, children);
54
+ };
55
+ exports.RenderInBackground = RenderInBackground;
56
+ //# sourceMappingURL=RenderInBackground.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderInBackground.js","sourceRoot":"","sources":["../../../../src/components/RenderInBackground.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA8E;AAC9E,sEAA8C;AAE9C,MAAM,eAAe,GAAG,8BAAC,wBAAc,OAAG,CAAC;AAOpC,MAAM,kBAAkB,GAAG,CAAC,EAC/B,QAAQ,EACR,QAAQ,GAAG,eAAe,EACJ,EAAE,EAAE;IAC1B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,IAAA,uBAAe,EAAC,GAAG,EAAE;YACjB,UAAU,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,OAAO,8BAAC,gBAAQ,IAAC,QAAQ,EAAE,QAAQ,IAAG,QAAQ,CAAY,CAAC;AAC/D,CAAC,CAAA;AAjBY,QAAA,kBAAkB,sBAiB9B"}
@@ -1,3 +1,3 @@
1
- export declare const useScope: (scopeVariable?: string | Function, defaultValue?: any) => any;
1
+ export declare const useScope: (scopeSelector?: string | Function, defaultValue?: any) => any;
2
2
  export { useScope as useData };
3
3
  //# sourceMappingURL=useScope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,GAAI,gBAAgB,MAAM,GAAG,QAAQ,EAAE,eAAe,GAAG,QAQ7E,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
1
+ {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,GAAI,gBAAe,MAAM,GAAG,QAA+B,EAAE,eAAe,GAAG,QAOnG,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
@@ -4,15 +4,15 @@ exports.useData = exports.useScope = void 0;
4
4
  const lodash_1 = require("lodash");
5
5
  const react_1 = require("react");
6
6
  const contexts_1 = require("../contexts");
7
- const useScope = (scopeVariable, defaultValue) => {
7
+ const defaultScopeSelector = (scope) => scope;
8
+ const useScope = (scopeSelector = defaultScopeSelector, defaultValue) => {
8
9
  const scope = (0, react_1.useContext)(contexts_1.DataContext);
9
- if (typeof scopeVariable === 'string') {
10
- return (0, lodash_1.get)(scope, scopeVariable, defaultValue);
10
+ if (typeof scopeSelector === 'string') {
11
+ return (0, lodash_1.get)(scope, scopeSelector, defaultValue);
11
12
  }
12
- else if (typeof scopeVariable === 'function') {
13
- return scopeVariable(scope);
13
+ else {
14
+ return scopeSelector?.(scope);
14
15
  }
15
- return scope;
16
16
  };
17
17
  exports.useScope = useScope;
18
18
  exports.useData = exports.useScope;
@@ -1 +1 @@
1
- {"version":3,"file":"useScope.js","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":";;;AAAA,mCAA6B;AAC7B,iCAAmC;AACnC,0CAA0C;AAEnC,MAAM,QAAQ,GAAG,CAAC,aAAiC,EAAE,YAAkB,EAAC,EAAE;IAC7E,MAAM,KAAK,GAAS,IAAA,kBAAU,EAAC,sBAAW,CAAC,CAAC;IAC5C,IAAG,OAAO,aAAa,KAAK,QAAQ,EAAC,CAAC;QAClC,OAAO,IAAA,YAAG,EAAC,KAAK,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;SAAM,IAAG,OAAO,aAAa,KAAK,UAAU,EAAC,CAAC;QAC3C,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,QAAQ,YAQnB;AAEkB,kBAVP,gBAAQ,CAUM"}
1
+ {"version":3,"file":"useScope.js","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":";;;AAAA,mCAA6B;AAC7B,iCAAmC;AACnC,0CAA0C;AAE1C,MAAM,oBAAoB,GAAG,CAAC,KAAU,EAAC,EAAE,CAAC,KAAK,CAAC;AAE3C,MAAM,QAAQ,GAAG,CAAC,gBAAmC,oBAAoB,EAAE,YAAkB,EAAC,EAAE;IACnG,MAAM,KAAK,GAAS,IAAA,kBAAU,EAAC,sBAAW,CAAC,CAAC;IAC5C,IAAG,OAAO,aAAa,KAAK,QAAQ,EAAC,CAAC;QAClC,OAAO,IAAA,YAAG,EAAC,KAAK,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;SAAK,CAAC;QACH,OAAO,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;AACL,CAAC,CAAC;AAPW,QAAA,QAAQ,YAOnB;AAEkB,kBATP,gBAAQ,CASM"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface RenderInBackgroundProps {
3
+ children: React.ReactNode;
4
+ fallback?: React.ReactNode;
5
+ }
6
+ export declare const RenderInBackground: ({ children, fallback }: RenderInBackgroundProps) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=RenderInBackground.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderInBackground.d.ts","sourceRoot":"","sources":["../../../../src/components/RenderInBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAK9E,UAAU,uBAAuB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,GAAI,wBAGhC,uBAAuB,8EAczB,CAAA"}
@@ -0,0 +1,16 @@
1
+ import React, { Suspense, useEffect, useState, startTransition } from 'react';
2
+ import EmptyComponent from './EmptyComponent';
3
+ const defaultFallback = React.createElement(EmptyComponent, null);
4
+ export const RenderInBackground = ({ children, fallback = defaultFallback }) => {
5
+ const [isReady, setIsReady] = useState(false);
6
+ useEffect(() => {
7
+ startTransition(() => {
8
+ setIsReady(true);
9
+ });
10
+ }, []);
11
+ if (!isReady) {
12
+ return fallback;
13
+ }
14
+ return React.createElement(Suspense, { fallback: fallback }, children);
15
+ };
16
+ //# sourceMappingURL=RenderInBackground.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderInBackground.js","sourceRoot":"","sources":["../../../../src/components/RenderInBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,MAAM,eAAe,GAAG,oBAAC,cAAc,OAAG,CAAC;AAO3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAC/B,QAAQ,EACR,QAAQ,GAAG,eAAe,EACJ,EAAE,EAAE;IAC1B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,SAAS,CAAC,GAAG,EAAE;QACX,eAAe,CAAC,GAAG,EAAE;YACjB,UAAU,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,OAAO,oBAAC,QAAQ,IAAC,QAAQ,EAAE,QAAQ,IAAG,QAAQ,CAAY,CAAC;AAC/D,CAAC,CAAA"}
@@ -1,3 +1,3 @@
1
- export declare const useScope: (scopeVariable?: string | Function, defaultValue?: any) => any;
1
+ export declare const useScope: (scopeSelector?: string | Function, defaultValue?: any) => any;
2
2
  export { useScope as useData };
3
3
  //# sourceMappingURL=useScope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,GAAI,gBAAgB,MAAM,GAAG,QAAQ,EAAE,eAAe,GAAG,QAQ7E,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
1
+ {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,GAAI,gBAAe,MAAM,GAAG,QAA+B,EAAE,eAAe,GAAG,QAOnG,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
@@ -1,15 +1,15 @@
1
1
  import { get } from 'lodash';
2
2
  import { useContext } from 'react';
3
3
  import { DataContext } from '../contexts';
4
- export const useScope = (scopeVariable, defaultValue) => {
4
+ const defaultScopeSelector = (scope) => scope;
5
+ export const useScope = (scopeSelector = defaultScopeSelector, defaultValue) => {
5
6
  const scope = useContext(DataContext);
6
- if (typeof scopeVariable === 'string') {
7
- return get(scope, scopeVariable, defaultValue);
7
+ if (typeof scopeSelector === 'string') {
8
+ return get(scope, scopeSelector, defaultValue);
8
9
  }
9
- else if (typeof scopeVariable === 'function') {
10
- return scopeVariable(scope);
10
+ else {
11
+ return scopeSelector?.(scope);
11
12
  }
12
- return scope;
13
13
  };
14
14
  export { useScope as useData };
15
15
  //# sourceMappingURL=useScope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScope.js","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,aAAiC,EAAE,YAAkB,EAAC,EAAE;IAC7E,MAAM,KAAK,GAAS,UAAU,CAAC,WAAW,CAAC,CAAC;IAC5C,IAAG,OAAO,aAAa,KAAK,QAAQ,EAAC,CAAC;QAClC,OAAO,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;SAAM,IAAG,OAAO,aAAa,KAAK,UAAU,EAAC,CAAC;QAC3C,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
1
+ {"version":3,"file":"useScope.js","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,oBAAoB,GAAG,CAAC,KAAU,EAAC,EAAE,CAAC,KAAK,CAAC;AAElD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,gBAAmC,oBAAoB,EAAE,YAAkB,EAAC,EAAE;IACnG,MAAM,KAAK,GAAS,UAAU,CAAC,WAAW,CAAC,CAAC;IAC5C,IAAG,OAAO,aAAa,KAAK,QAAQ,EAAC,CAAC;QAClC,OAAO,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;SAAK,CAAC;QACH,OAAO,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface RenderInBackgroundProps {
3
+ children: React.ReactNode;
4
+ fallback?: React.ReactNode;
5
+ }
6
+ export declare const RenderInBackground: ({ children, fallback }: RenderInBackgroundProps) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=RenderInBackground.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderInBackground.d.ts","sourceRoot":"","sources":["../../../../src/components/RenderInBackground.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAK9E,UAAU,uBAAuB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,GAAI,wBAGhC,uBAAuB,8EAczB,CAAA"}
@@ -1,3 +1,3 @@
1
- export declare const useScope: (scopeVariable?: string | Function, defaultValue?: any) => any;
1
+ export declare const useScope: (scopeSelector?: string | Function, defaultValue?: any) => any;
2
2
  export { useScope as useData };
3
3
  //# sourceMappingURL=useScope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,GAAI,gBAAgB,MAAM,GAAG,QAAQ,EAAE,eAAe,GAAG,QAQ7E,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
1
+ {"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,GAAI,gBAAe,MAAM,GAAG,QAA+B,EAAE,eAAe,GAAG,QAOnG,CAAC;AAEF,OAAO,EAAC,QAAQ,IAAI,OAAO,EAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evlop/commons",
3
- "version": "1.0.314",
3
+ "version": "1.0.316",
4
4
  "description": "",
5
5
  "main": "dist/cjs/main.js",
6
6
  "module": "dist/esm/main.js",