@evlop/commons 1.0.313 → 1.0.315
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/cjs/src/components/RenderTemplate.d.ts +7 -0
- package/dist/cjs/src/components/RenderTemplate.d.ts.map +1 -0
- package/dist/cjs/src/components/RenderTemplate.js +11 -0
- package/dist/cjs/src/components/RenderTemplate.js.map +1 -0
- package/dist/cjs/src/components/index.d.ts +1 -0
- package/dist/cjs/src/components/index.d.ts.map +1 -1
- package/dist/cjs/src/components/index.js +1 -0
- package/dist/cjs/src/components/index.js.map +1 -1
- package/dist/cjs/src/hooks/useScope.d.ts +1 -1
- package/dist/cjs/src/hooks/useScope.d.ts.map +1 -1
- package/dist/cjs/src/hooks/useScope.js +6 -6
- package/dist/cjs/src/hooks/useScope.js.map +1 -1
- package/dist/cjs/src/hooks/useTemplate.d.ts.map +1 -1
- package/dist/cjs/src/hooks/useTemplate.js +4 -5
- package/dist/cjs/src/hooks/useTemplate.js.map +1 -1
- package/dist/esm/src/components/RenderTemplate.d.ts +7 -0
- package/dist/esm/src/components/RenderTemplate.d.ts.map +1 -0
- package/dist/esm/src/components/RenderTemplate.js +7 -0
- package/dist/esm/src/components/RenderTemplate.js.map +1 -0
- package/dist/esm/src/components/index.d.ts +1 -0
- package/dist/esm/src/components/index.d.ts.map +1 -1
- package/dist/esm/src/components/index.js +1 -0
- package/dist/esm/src/components/index.js.map +1 -1
- package/dist/esm/src/hooks/useScope.d.ts +1 -1
- package/dist/esm/src/hooks/useScope.d.ts.map +1 -1
- package/dist/esm/src/hooks/useScope.js +6 -6
- package/dist/esm/src/hooks/useScope.js.map +1 -1
- package/dist/esm/src/hooks/useTemplate.d.ts.map +1 -1
- package/dist/esm/src/hooks/useTemplate.js +6 -7
- package/dist/esm/src/hooks/useTemplate.js.map +1 -1
- package/dist/types/src/components/RenderTemplate.d.ts +7 -0
- package/dist/types/src/components/RenderTemplate.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useScope.d.ts +1 -1
- package/dist/types/src/hooks/useScope.d.ts.map +1 -1
- package/dist/types/src/hooks/useTemplate.d.ts.map +1 -1
- package/package.json +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RenderTemplate.d.ts","sourceRoot":"","sources":["../../../../src/components/RenderTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,KAAK,mBAAmB,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAGxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.RenderTemplate = void 0;
|
4
|
+
const hooks_1 = require("../hooks");
|
5
|
+
const RenderTemplate = ({ template }) => {
|
6
|
+
const applyTemplate = (0, hooks_1.useTemplate)();
|
7
|
+
return applyTemplate(template);
|
8
|
+
};
|
9
|
+
exports.RenderTemplate = RenderTemplate;
|
10
|
+
exports.default = exports.RenderTemplate;
|
11
|
+
//# sourceMappingURL=RenderTemplate.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RenderTemplate.js","sourceRoot":"","sources":["../../../../src/components/RenderTemplate.tsx"],"names":[],"mappings":";;;AACA,oCAAuC;AAMhC,MAAM,cAAc,GAAkC,CAAC,EAAC,QAAQ,EAAC,EAAE,EAAE;IACxE,MAAM,aAAa,GAAG,IAAA,mBAAW,GAAE,CAAC;IACpC,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB;AAEF,kBAAe,sBAAc,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAgBA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAgBA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
|
@@ -34,5 +34,6 @@ __exportStar(require("./EmptyComponent"), exports);
|
|
34
34
|
// export * from './BackgroundCho';
|
35
35
|
__exportStar(require("./hoc"), exports);
|
36
36
|
__exportStar(require("./SkipSSR"), exports);
|
37
|
+
__exportStar(require("./RenderTemplate"), exports);
|
37
38
|
// export {default as Modal} from './Modal';
|
38
39
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,iCAAiC;AACjC,qCAAqC;AACrC,qCAAqC;AACrC,uCAAuC;AACvC,mCAAmC;AACnC,iCAAiC;AACjC,mCAAmC;AACnC,iCAAiC;AACjC,sCAAsC;AACtC,wCAAwC;AACxC,kCAAkC;AAClC,iCAAiC;AACjC,iCAAiC;AACjC,qCAAqC;AACrC,gCAAgC;AAChC,mDAAiC;AACjC,mCAAmC;AACnC,wCAAsB;AACtB,4CAA0B;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,iCAAiC;AACjC,qCAAqC;AACrC,qCAAqC;AACrC,uCAAuC;AACvC,mCAAmC;AACnC,iCAAiC;AACjC,mCAAmC;AACnC,iCAAiC;AACjC,sCAAsC;AACtC,wCAAwC;AACxC,kCAAkC;AAClC,iCAAiC;AACjC,iCAAiC;AACjC,qCAAqC;AACrC,gCAAgC;AAChC,mDAAiC;AACjC,mCAAmC;AACnC,wCAAsB;AACtB,4CAA0B;AAC1B,mDAAiC;AAEjC,4CAA4C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"
|
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
|
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
|
10
|
-
return (0, lodash_1.get)(scope,
|
10
|
+
if (typeof scopeSelector === 'string') {
|
11
|
+
return (0, lodash_1.get)(scope, scopeSelector, defaultValue);
|
11
12
|
}
|
12
|
-
else
|
13
|
-
return
|
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;
|
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"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTemplate.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAI,iBAAiB,MAAM,
|
1
|
+
{"version":3,"file":"useTemplate.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAI,iBAAiB,MAAM,QAqBlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
@@ -10,18 +10,17 @@ const react_1 = require("react");
|
|
10
10
|
const useScope_1 = require("./useScope");
|
11
11
|
const handlebarsCompile = (0, lodash_1.memoize)((stringValue) => handlebars_min_js_1.default.compile(stringValue, { noEscape: true }));
|
12
12
|
const useTemplate = (templateString) => {
|
13
|
-
const
|
14
|
-
const deferredScope = (0, react_1.useDeferredValue)(_scope);
|
13
|
+
const scope = (0, useScope_1.useScope)();
|
15
14
|
const applyTemplate = (0, react_1.useCallback)((stringValue) => {
|
16
|
-
if (
|
15
|
+
if (typeof stringValue === 'string') {
|
17
16
|
try {
|
18
17
|
const template = handlebarsCompile(stringValue);
|
19
|
-
return template(
|
18
|
+
return template(scope, { allowProtoMethodsByDefault: true, allowProtoPropertiesByDefault: true });
|
20
19
|
}
|
21
20
|
catch (e) { }
|
22
21
|
}
|
23
22
|
return stringValue;
|
24
|
-
}, [
|
23
|
+
}, [scope]);
|
25
24
|
const finalValue = (0, react_1.useMemo)(() => {
|
26
25
|
if (templateString)
|
27
26
|
return applyTemplate(templateString);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTemplate.js","sourceRoot":"","sources":["../../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":";;;;;;AAAA,0FAA2D;AAC3D,
|
1
|
+
{"version":3,"file":"useTemplate.js","sourceRoot":"","sources":["../../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":";;;;;;AAAA,0FAA2D;AAC3D,mCAAiC;AACjC,iCAA6C;AAC7C,yCAAsC;AAEtC,MAAM,iBAAiB,GAAG,IAAA,gBAAO,EAAC,CAAC,WAAkB,EAAE,EAAE,CAAC,2BAAU,CAAC,OAAO,CAAC,WAAW,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC,CAAA;AAErG,MAAM,WAAW,GAAG,CAAC,cAAuB,EAAC,EAAE;IAElD,MAAM,KAAK,GAAG,IAAA,mBAAQ,GAAE,CAAC;IACzB,MAAM,aAAa,GAAG,IAAA,mBAAW,EAAC,CAAC,WAAmB,EAAC,EAAE;QACrD,IAAG,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACjC,IAAG,CAAC;gBACA,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;YACpG,CAAC;YAAC,OAAM,CAAC,EAAC,CAAC,CAAA,CAAC;QAChB,CAAC;QACD,OAAO,WAAW,CAAC;IACvB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,MAAM,UAAU,GAAG,IAAA,eAAO,EAAC,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"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RenderTemplate.d.ts","sourceRoot":"","sources":["../../../../src/components/RenderTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,KAAK,mBAAmB,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAGxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RenderTemplate.js","sourceRoot":"","sources":["../../../../src/components/RenderTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAMvC,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAAC,QAAQ,EAAC,EAAE,EAAE;IACxE,MAAM,aAAa,GAAG,WAAW,EAAE,CAAC;IACpC,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAgBA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAgBA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,iCAAiC;AACjC,qCAAqC;AACrC,qCAAqC;AACrC,uCAAuC;AACvC,mCAAmC;AACnC,iCAAiC;AACjC,mCAAmC;AACnC,iCAAiC;AACjC,sCAAsC;AACtC,wCAAwC;AACxC,kCAAkC;AAClC,iCAAiC;AACjC,iCAAiC;AACjC,qCAAqC;AACrC,gCAAgC;AAChC,cAAc,kBAAkB,CAAC;AACjC,mCAAmC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,iCAAiC;AACjC,qCAAqC;AACrC,qCAAqC;AACrC,uCAAuC;AACvC,mCAAmC;AACnC,iCAAiC;AACjC,mCAAmC;AACnC,iCAAiC;AACjC,sCAAsC;AACtC,wCAAwC;AACxC,kCAAkC;AAClC,iCAAiC;AACjC,iCAAiC;AACjC,qCAAqC;AACrC,gCAAgC;AAChC,cAAc,kBAAkB,CAAC;AACjC,mCAAmC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AAEjC,4CAA4C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"
|
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
|
-
|
4
|
+
const defaultScopeSelector = (scope) => scope;
|
5
|
+
export const useScope = (scopeSelector = defaultScopeSelector, defaultValue) => {
|
5
6
|
const scope = useContext(DataContext);
|
6
|
-
if (typeof
|
7
|
-
return get(scope,
|
7
|
+
if (typeof scopeSelector === 'string') {
|
8
|
+
return get(scope, scopeSelector, defaultValue);
|
8
9
|
}
|
9
|
-
else
|
10
|
-
return
|
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,
|
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"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTemplate.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAI,iBAAiB,MAAM,
|
1
|
+
{"version":3,"file":"useTemplate.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAI,iBAAiB,MAAM,QAqBlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
@@ -1,21 +1,20 @@
|
|
1
1
|
import Handlebars from 'handlebars/dist/handlebars.min.js';
|
2
|
-
import {
|
3
|
-
import { useCallback,
|
2
|
+
import { memoize } from 'lodash';
|
3
|
+
import { useCallback, useMemo } from 'react';
|
4
4
|
import { useScope } from "./useScope";
|
5
5
|
const handlebarsCompile = memoize((stringValue) => Handlebars.compile(stringValue, { noEscape: true }));
|
6
6
|
export const useTemplate = (templateString) => {
|
7
|
-
const
|
8
|
-
const deferredScope = useDeferredValue(_scope);
|
7
|
+
const scope = useScope();
|
9
8
|
const applyTemplate = useCallback((stringValue) => {
|
10
|
-
if (
|
9
|
+
if (typeof stringValue === 'string') {
|
11
10
|
try {
|
12
11
|
const template = handlebarsCompile(stringValue);
|
13
|
-
return template(
|
12
|
+
return template(scope, { allowProtoMethodsByDefault: true, allowProtoPropertiesByDefault: true });
|
14
13
|
}
|
15
14
|
catch (e) { }
|
16
15
|
}
|
17
16
|
return stringValue;
|
18
|
-
}, [
|
17
|
+
}, [scope]);
|
19
18
|
const finalValue = useMemo(() => {
|
20
19
|
if (templateString)
|
21
20
|
return applyTemplate(templateString);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useTemplate.js","sourceRoot":"","sources":["../../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"useTemplate.js","sourceRoot":"","sources":["../../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,iBAAiB,GAAG,OAAO,CAAC,CAAC,WAAkB,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,CAAC,CAAA;AAE5G,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,cAAuB,EAAC,EAAE;IAElD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,aAAa,GAAG,WAAW,CAAC,CAAC,WAAmB,EAAC,EAAE;QACrD,IAAG,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YACjC,IAAG,CAAC;gBACA,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;YACpG,CAAC;YAAC,OAAM,CAAC,EAAC,CAAC,CAAA,CAAC;QAChB,CAAC;QACD,OAAO,WAAW,CAAC;IACvB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IAEX,MAAM,UAAU,GAAG,OAAO,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;AAEF,eAAe,WAAW,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RenderTemplate.d.ts","sourceRoot":"","sources":["../../../../src/components/RenderTemplate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,KAAK,mBAAmB,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAGxD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAgBA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.tsx"],"names":[],"mappings":"AAgBA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useScope.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useScope.tsx"],"names":[],"mappings":"
|
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 +1 @@
|
|
1
|
-
{"version":3,"file":"useTemplate.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAI,iBAAiB,MAAM,
|
1
|
+
{"version":3,"file":"useTemplate.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useTemplate.tsx"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,GAAI,iBAAiB,MAAM,QAqBlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|