@next-core/brick-kit 2.104.5 → 2.105.1
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/CHANGELOG.md +42 -0
- package/dist/index.bundle.js +53 -27
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +53 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/types/BrickAsComponent.d.ts.map +1 -1
- package/dist/types/core/LocationContext.d.ts.map +1 -1
- package/dist/types/core/StoryboardContext.d.ts +1 -0
- package/dist/types/core/StoryboardContext.d.ts.map +1 -1
- package/dist/types/internal/evaluate.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,48 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.105.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.105.0...@next-core/brick-kit@2.105.1) (2022-02-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix useBrick lifeCycle couldn't get TPL ([6bbb1ff](https://github.com/easyops-cn/next-core/commit/6bbb1fff00427af2bfca30074a7a8003118763b3))
|
|
12
|
+
* fix useBrick lifeCycle couldn't get TPL ([af1232f](https://github.com/easyops-cn/next-core/commit/af1232fce2fe425a24d841b05ef4d5f2b284a23e))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [2.105.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.104.7...@next-core/brick-kit@2.105.0) (2022-02-17)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* 新增`PATH_NAME`常量 ([094fe48](https://github.com/easyops-cn/next-core/commit/094fe4877581b7594ea297a3da5c4ae047d9cc4d))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## [2.104.7](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.104.6...@next-core/brick-kit@2.104.7) (2022-02-17)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* mark lazy useBrick for tpl property merge ([5794719](https://github.com/easyops-cn/next-core/commit/579471913e569856772e24ccdf024519b6680aaa))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## [2.104.6](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.104.5...@next-core/brick-kit@2.104.6) (2022-02-15)
|
|
41
|
+
|
|
42
|
+
**Note:** Version bump only for package @next-core/brick-kit
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
6
48
|
## [2.104.5](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.104.4...@next-core/brick-kit@2.104.5) (2022-02-15)
|
|
7
49
|
|
|
8
50
|
|
package/dist/index.bundle.js
CHANGED
|
@@ -1979,17 +1979,38 @@
|
|
|
1979
1979
|
|
|
1980
1980
|
return _asyncToGenerator__default["default"](function* () {
|
|
1981
1981
|
if (Array.isArray(contextConfs)) {
|
|
1982
|
-
|
|
1982
|
+
var {
|
|
1983
|
+
mergedContext,
|
|
1984
|
+
keyword
|
|
1985
|
+
} = _this.getResolveOptions(coreContext);
|
|
1986
|
+
|
|
1987
|
+
yield brickUtils.resolveContextConcurrently(contextConfs, contextConf => resolveStoryboardContext(contextConf, mergedContext, _this, brick), keyword);
|
|
1983
1988
|
}
|
|
1984
1989
|
})();
|
|
1985
1990
|
}
|
|
1986
1991
|
|
|
1987
1992
|
syncDefine(contextConfs, coreContext, brick) {
|
|
1988
1993
|
if (Array.isArray(contextConfs)) {
|
|
1989
|
-
|
|
1994
|
+
var {
|
|
1995
|
+
mergedContext,
|
|
1996
|
+
keyword
|
|
1997
|
+
} = this.getResolveOptions(coreContext);
|
|
1998
|
+
brickUtils.syncResolveContextConcurrently(contextConfs, contextConf => syncResolveStoryboardContext(contextConf, mergedContext, this, brick), keyword);
|
|
1990
1999
|
}
|
|
1991
2000
|
}
|
|
1992
2001
|
|
|
2002
|
+
getResolveOptions(coreContext) {
|
|
2003
|
+
return this.tplContextId ? {
|
|
2004
|
+
mergedContext: _objectSpread__default["default"](_objectSpread__default["default"]({}, coreContext), {}, {
|
|
2005
|
+
tplContextId: this.tplContextId
|
|
2006
|
+
}),
|
|
2007
|
+
keyword: "STATE"
|
|
2008
|
+
} : {
|
|
2009
|
+
mergedContext: coreContext,
|
|
2010
|
+
keyword: "CTX"
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
|
|
1993
2014
|
}
|
|
1994
2015
|
|
|
1995
2016
|
function resolveStoryboardContext(_x, _x2, _x3, _x4) {
|
|
@@ -2024,23 +2045,23 @@
|
|
|
2024
2045
|
}
|
|
2025
2046
|
|
|
2026
2047
|
function _resolveNormalStoryboardContext() {
|
|
2027
|
-
_resolveNormalStoryboardContext = _asyncToGenerator__default["default"](function* (contextConf,
|
|
2028
|
-
if (!looseCheckIf(contextConf,
|
|
2048
|
+
_resolveNormalStoryboardContext = _asyncToGenerator__default["default"](function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2049
|
+
if (!looseCheckIf(contextConf, mergedContext)) {
|
|
2029
2050
|
return false;
|
|
2030
2051
|
}
|
|
2031
2052
|
|
|
2032
2053
|
var isResolve = false;
|
|
2033
|
-
var value = getDefinedTemplateState(
|
|
2054
|
+
var value = getDefinedTemplateState(!!storyboardContextWrapper.tplContextId, contextConf, brick);
|
|
2034
2055
|
|
|
2035
2056
|
if (value === undefined) {
|
|
2036
2057
|
if (contextConf.resolve) {
|
|
2037
|
-
if (looseCheckIf(contextConf.resolve,
|
|
2058
|
+
if (looseCheckIf(contextConf.resolve, mergedContext)) {
|
|
2038
2059
|
isResolve = true;
|
|
2039
2060
|
var valueConf = {};
|
|
2040
2061
|
yield _internalApiGetResolver().resolveOne("reference", _objectSpread__default["default"]({
|
|
2041
2062
|
transform: "value",
|
|
2042
2063
|
transformMapArray: false
|
|
2043
|
-
}, contextConf.resolve), valueConf, null,
|
|
2064
|
+
}, contextConf.resolve), valueConf, null, mergedContext);
|
|
2044
2065
|
value = valueConf.value;
|
|
2045
2066
|
} else if (!brickUtils.hasOwnProperty(contextConf, "value")) {
|
|
2046
2067
|
return false;
|
|
@@ -2048,18 +2069,18 @@
|
|
|
2048
2069
|
}
|
|
2049
2070
|
|
|
2050
2071
|
if (!isResolve && contextConf.value !== undefined) {
|
|
2051
|
-
value = computeRealValue(contextConf.value,
|
|
2072
|
+
value = computeRealValue(contextConf.value, mergedContext, true);
|
|
2052
2073
|
}
|
|
2053
2074
|
}
|
|
2054
2075
|
|
|
2055
|
-
resolveFreeVariableValue(value, contextConf,
|
|
2076
|
+
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick);
|
|
2056
2077
|
return true;
|
|
2057
2078
|
});
|
|
2058
2079
|
return _resolveNormalStoryboardContext.apply(this, arguments);
|
|
2059
2080
|
}
|
|
2060
2081
|
|
|
2061
|
-
function syncResolveStoryboardContext(contextConf,
|
|
2062
|
-
if (!looseCheckIf(contextConf,
|
|
2082
|
+
function syncResolveStoryboardContext(contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2083
|
+
if (!looseCheckIf(contextConf, mergedContext)) {
|
|
2063
2084
|
return false;
|
|
2064
2085
|
}
|
|
2065
2086
|
|
|
@@ -2067,23 +2088,23 @@
|
|
|
2067
2088
|
throw new Error("resolve is not allowed here");
|
|
2068
2089
|
}
|
|
2069
2090
|
|
|
2070
|
-
var value = getDefinedTemplateState(
|
|
2091
|
+
var value = getDefinedTemplateState(!!storyboardContextWrapper.tplContextId, contextConf, brick);
|
|
2071
2092
|
|
|
2072
2093
|
if (value === undefined) {
|
|
2073
|
-
value = computeRealValue(contextConf.value,
|
|
2094
|
+
value = computeRealValue(contextConf.value, mergedContext, true);
|
|
2074
2095
|
}
|
|
2075
2096
|
|
|
2076
|
-
resolveFreeVariableValue(value, contextConf,
|
|
2097
|
+
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick);
|
|
2077
2098
|
return true;
|
|
2078
2099
|
}
|
|
2079
2100
|
|
|
2080
|
-
function getDefinedTemplateState(
|
|
2081
|
-
if (
|
|
2101
|
+
function getDefinedTemplateState(isTemplateState, contextConf, brick) {
|
|
2102
|
+
if (isTemplateState && brick.properties && brickUtils.hasOwnProperty(brick.properties, contextConf.name)) {
|
|
2082
2103
|
return brick.properties[contextConf.name];
|
|
2083
2104
|
}
|
|
2084
2105
|
}
|
|
2085
2106
|
|
|
2086
|
-
function resolveFreeVariableValue(value, contextConf,
|
|
2107
|
+
function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2087
2108
|
var newContext = {
|
|
2088
2109
|
type: "free-variable",
|
|
2089
2110
|
value,
|
|
@@ -2093,13 +2114,7 @@
|
|
|
2093
2114
|
|
|
2094
2115
|
if (contextConf.onChange) {
|
|
2095
2116
|
for (var handler of [].concat(contextConf.onChange)) {
|
|
2096
|
-
|
|
2097
|
-
newContext.eventTarget.addEventListener("state.change", listenerFactory(handler, _objectSpread__default["default"](_objectSpread__default["default"]({}, coreContext), {}, {
|
|
2098
|
-
tplContextId: storyboardContextWrapper.tplContextId
|
|
2099
|
-
}), brick));
|
|
2100
|
-
} else {
|
|
2101
|
-
newContext.eventTarget.addEventListener("context.change", listenerFactory(handler, coreContext, brick));
|
|
2102
|
-
}
|
|
2117
|
+
newContext.eventTarget.addEventListener(storyboardContextWrapper.tplContextId ? "state.change" : "context.change", listenerFactory(handler, mergedContext, brick));
|
|
2103
2118
|
}
|
|
2104
2119
|
}
|
|
2105
2120
|
|
|
@@ -2277,6 +2292,7 @@
|
|
|
2277
2292
|
sys,
|
|
2278
2293
|
flags,
|
|
2279
2294
|
hash,
|
|
2295
|
+
pathname,
|
|
2280
2296
|
segues,
|
|
2281
2297
|
storyboardContext
|
|
2282
2298
|
} = _internalApiGetCurrentContext();
|
|
@@ -2317,6 +2333,9 @@
|
|
|
2317
2333
|
case "HASH":
|
|
2318
2334
|
return hash;
|
|
2319
2335
|
|
|
2336
|
+
case "PATH_NAME":
|
|
2337
|
+
return pathname;
|
|
2338
|
+
|
|
2320
2339
|
case "INSTALLED_APPS":
|
|
2321
2340
|
return {
|
|
2322
2341
|
has: (appId, matchVersion) => getRuntime().hasInstalledApp(appId, matchVersion)
|
|
@@ -8492,6 +8511,7 @@
|
|
|
8492
8511
|
var auth = getAuth();
|
|
8493
8512
|
var context = {
|
|
8494
8513
|
hash: this.location.hash,
|
|
8514
|
+
pathname: this.location.pathname,
|
|
8495
8515
|
query: this.query,
|
|
8496
8516
|
match,
|
|
8497
8517
|
app: this.kernel.nextApp,
|
|
@@ -10129,7 +10149,9 @@
|
|
|
10129
10149
|
// Use an approach like template-literal's quasis:
|
|
10130
10150
|
// `quasi0${0}quais1${1}quasi2...`
|
|
10131
10151
|
// Every quasi can be merged with multiple items.
|
|
10132
|
-
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true
|
|
10152
|
+
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
|
|
10153
|
+
$$lazyForUseBrick: true
|
|
10154
|
+
}) : [];
|
|
10133
10155
|
var quasis = [];
|
|
10134
10156
|
var size = computedBaseValue.length + 1;
|
|
10135
10157
|
|
|
@@ -11283,7 +11305,9 @@
|
|
|
11283
11305
|
yield resolver.resolve({
|
|
11284
11306
|
brick: useBrick.brick,
|
|
11285
11307
|
lifeCycle: useBrick.lifeCycle
|
|
11286
|
-
}, brick, _internalApiGetCurrentContext())
|
|
11308
|
+
}, brick, _objectSpread__default["default"](_objectSpread__default["default"]({}, _internalApiGetCurrentContext()), {}, {
|
|
11309
|
+
tplContextId: useBrick[symbolForTplContextId]
|
|
11310
|
+
}));
|
|
11287
11311
|
}
|
|
11288
11312
|
|
|
11289
11313
|
return brick;
|
|
@@ -11479,7 +11503,9 @@
|
|
|
11479
11503
|
yield resolver.resolve({
|
|
11480
11504
|
brick: useBrick.brick,
|
|
11481
11505
|
lifeCycle: useBrick.lifeCycle
|
|
11482
|
-
}, brick, _internalApiGetCurrentContext())
|
|
11506
|
+
}, brick, _objectSpread__default["default"](_objectSpread__default["default"]({}, _internalApiGetCurrentContext()), {}, {
|
|
11507
|
+
tplContextId: useBrick[symbolForTplContextId]
|
|
11508
|
+
}));
|
|
11483
11509
|
}
|
|
11484
11510
|
|
|
11485
11511
|
return brick;
|