@evlop/commons 1.0.142 → 1.0.145
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/constants/iconInfo/types.d.ts +11 -11
- package/dist/src/constants/iconInfo/types.d.ts.map +1 -1
- package/dist/src/contexts/LayoutContext.d.ts +2 -0
- package/dist/src/contexts/LayoutContext.d.ts.map +1 -1
- package/dist/src/contexts/LayoutContext.js +1 -1
- package/dist/src/contexts/LayoutContext.js.map +1 -1
- package/dist/src/hooks/useTemplate.d.ts.map +1 -1
- package/dist/src/hooks/useTemplate.js +8 -1
- package/dist/src/hooks/useTemplate.js.map +1 -1
- package/package.json +3 -4
@@ -1,10 +1,12 @@
|
|
1
1
|
declare const LayoutContext: import("react").Context<{
|
2
2
|
type: string;
|
3
3
|
updateIndex: (...params: any) => void;
|
4
|
+
addBlock: (...params: any) => void;
|
4
5
|
}>;
|
5
6
|
export declare const LayoutProvider: import("react").Provider<{
|
6
7
|
type: string;
|
7
8
|
updateIndex: (...params: any) => void;
|
9
|
+
addBlock: (...params: any) => void;
|
8
10
|
}>;
|
9
11
|
export default LayoutContext;
|
10
12
|
//# sourceMappingURL=LayoutContext.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LayoutContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/LayoutContext.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,aAAa;;6BAAsD,GAAG;EAAQ,CAAC;
|
1
|
+
{"version":3,"file":"LayoutContext.d.ts","sourceRoot":"","sources":["../../../src/contexts/LayoutContext.tsx"],"names":[],"mappings":"AAEA,QAAA,MAAM,aAAa;;6BAAsD,GAAG;0BAA6B,GAAG;EAAQ,CAAC;AAErH,eAAO,MAAM,cAAc;;6BAF8C,GAAG;0BAA6B,GAAG;EAExD,CAAC;AAErD,eAAe,aAAa,CAAA"}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.LayoutProvider = void 0;
|
4
4
|
const react_1 = require("react");
|
5
|
-
const LayoutContext = react_1.createContext({ type: '', updateIndex: (...params) => { } });
|
5
|
+
const LayoutContext = react_1.createContext({ type: '', updateIndex: (...params) => { }, addBlock: (...params) => { } });
|
6
6
|
exports.LayoutProvider = LayoutContext.Provider;
|
7
7
|
exports.default = LayoutContext;
|
8
8
|
//# sourceMappingURL=LayoutContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LayoutContext.js","sourceRoot":"","sources":["../../../src/contexts/LayoutContext.tsx"],"names":[],"mappings":";;;AAAA,iCAAoC;AAEpC,MAAM,aAAa,GAAG,qBAAa,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,GAAG,MAAW,EAAC,EAAE,GAAC,CAAC,EAAE,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"LayoutContext.js","sourceRoot":"","sources":["../../../src/contexts/LayoutContext.tsx"],"names":[],"mappings":";;;AAAA,iCAAoC;AAEpC,MAAM,aAAa,GAAG,qBAAa,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,GAAG,MAAW,EAAC,EAAE,GAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAW,EAAC,EAAE,GAAC,CAAC,EAAE,CAAC,CAAC;AAExG,QAAA,cAAc,GAAG,aAAa,CAAC,QAAQ,CAAC;AAErD,kBAAe,aAAa,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTemplate.d.ts","sourceRoot":"","sources":["../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"useTemplate.d.ts","sourceRoot":"","sources":["../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,WAAW,oBAAqB,MAAM,QAqBlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
@@ -6,13 +6,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useTemplate = void 0;
|
7
7
|
const react_1 = require("react");
|
8
8
|
const useScope_1 = require("./useScope");
|
9
|
+
const lodash_1 = require("lodash");
|
10
|
+
const uuid_1 = require("uuid");
|
9
11
|
const handlebars_min_js_1 = __importDefault(require("handlebars/dist/handlebars.min.js"));
|
12
|
+
const handlebarsCompile = lodash_1.memoize((stringValue) => handlebars_min_js_1.default.compile(stringValue, { noEscape: true }), (stringValue) => {
|
13
|
+
if (lodash_1.size(stringValue) < 100)
|
14
|
+
return stringValue;
|
15
|
+
return uuid_1.v5(stringValue, '060c30f4-309d-4054-a62e-7d7390c63cce');
|
16
|
+
});
|
10
17
|
const useTemplate = (templateString) => {
|
11
18
|
const scope = useScope_1.useScope();
|
12
19
|
const applyTemplate = react_1.useCallback((stringValue) => {
|
13
20
|
if (stringValue !== undefined && typeof stringValue === "string") {
|
14
21
|
try {
|
15
|
-
const template =
|
22
|
+
const template = handlebarsCompile(stringValue);
|
16
23
|
return template(scope, { allowProtoMethodsByDefault: true, allowProtoPropertiesByDefault: true });
|
17
24
|
}
|
18
25
|
catch (e) { }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTemplate.js","sourceRoot":"","sources":["../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":";;;;;;AAAA,iCAA2C;AAC3C,yCAAoC;AACpC,0FAA2D;
|
1
|
+
{"version":3,"file":"useTemplate.js","sourceRoot":"","sources":["../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":";;;;;;AAAA,iCAA2C;AAC3C,yCAAoC;AACpC,mCAAuC;AACvC,+BAAoC;AACpC,0FAA2D;AAE3D,MAAM,iBAAiB,GAAG,gBAAO,CACzB,CAAC,WAAkB,EAAE,EAAE,CAAC,2BAAU,CAAC,OAAO,CAAC,WAAW,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,EACzE,CAAC,WAAW,EAAE,EAAE;IACZ,IAAG,aAAI,CAAC,WAAW,CAAC,GAAC,GAAG;QAAE,OAAO,WAAW,CAAA;IAC5C,OAAO,SAAM,CAAC,WAAW,EAAE,sCAAsC,CAAC,CAAA;AACtE,CAAC,CACJ,CAAA;AAEE,MAAM,WAAW,GAAG,CAAC,cAAuB,EAAC,EAAE;IAElD,MAAM,KAAK,GAAG,mBAAQ,EAAE,CAAC;IACzB,MAAM,aAAa,GAAG,mBAAW,CAAC,CAAC,WAAmB,EAAC,EAAE;QACrD,IAAI,WAAW,KAAK,SAAS,IAAI,OAAO,WAAW,KAAM,QAAQ,EAAE;YAC/D,IAAG;gBACC,MAAM,QAAQ,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;gBAChD,OAAO,QAAQ,CAAC,KAAK,EAAE,EAAC,0BAA0B,EAAE,IAAI,EAAE,6BAA6B,EAAE,IAAI,EAAC,CAAC,CAAC;aACnG;YAAC,OAAM,CAAC,EAAC,GAAE;SACf;QACD,OAAO,WAAW,CAAC;IACvB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,MAAM,UAAU,GAAG,eAAO,CAAC,GAAE,EAAE;QAC3B,IAAG,cAAc;YAAE,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC;QACxD,OAAO,cAAc,CAAC;IAC1B,CAAC,EAAE,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;IAEpC,IAAG,cAAc,KAAK,SAAS;QAAE,OAAO,aAAa,CAAC;IAEtD,OAAO,UAAU,CAAC;AACtB,CAAC,CAAC;AArBW,QAAA,WAAW,eAqBtB;AAEF,kBAAe,mBAAW,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@evlop/commons",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.145",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/main.js",
|
6
6
|
"peerDependencies": {
|
@@ -31,12 +31,11 @@
|
|
31
31
|
"react-native-base64": "^0.2.1"
|
32
32
|
},
|
33
33
|
"scripts": {
|
34
|
-
"prepack": " rm -rf dist &&
|
34
|
+
"prepack": " rm -rf dist && npm run build",
|
35
35
|
"docs": "jsdoc -c jsdoc.json",
|
36
36
|
"dev": "tsc --watch",
|
37
37
|
"test": "mocha -r ts-node/register src/**/*.test.ts",
|
38
|
-
"build": "
|
39
|
-
"generate-icon-names": "ts-node ./generateIcons.ts"
|
38
|
+
"build": "ts-node bin/generate-icons-type.ts && tsc"
|
40
39
|
},
|
41
40
|
"files": [
|
42
41
|
"dist/*"
|