@next-core/brick-kit 2.104.4 → 2.105.0
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 +41 -0
- package/dist/index.bundle.js +54 -31
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +54 -31
- package/dist/index.esm.js.map +1 -1
- package/dist/types/BrickAsComponent.d.ts.map +1 -1
- package/dist/types/core/CustomTemplates/handleProxyOfCustomTemplate.d.ts +1 -1
- package/dist/types/core/CustomTemplates/handleProxyOfCustomTemplate.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/dist/index.esm.js
CHANGED
|
@@ -1980,17 +1980,38 @@ class StoryboardContextWrapper {
|
|
|
1980
1980
|
|
|
1981
1981
|
return _asyncToGenerator$4(function* () {
|
|
1982
1982
|
if (Array.isArray(contextConfs)) {
|
|
1983
|
-
|
|
1983
|
+
var {
|
|
1984
|
+
mergedContext,
|
|
1985
|
+
keyword
|
|
1986
|
+
} = _this.getResolveOptions(coreContext);
|
|
1987
|
+
|
|
1988
|
+
yield resolveContextConcurrently(contextConfs, contextConf => resolveStoryboardContext(contextConf, mergedContext, _this, brick), keyword);
|
|
1984
1989
|
}
|
|
1985
1990
|
})();
|
|
1986
1991
|
}
|
|
1987
1992
|
|
|
1988
1993
|
syncDefine(contextConfs, coreContext, brick) {
|
|
1989
1994
|
if (Array.isArray(contextConfs)) {
|
|
1990
|
-
|
|
1995
|
+
var {
|
|
1996
|
+
mergedContext,
|
|
1997
|
+
keyword
|
|
1998
|
+
} = this.getResolveOptions(coreContext);
|
|
1999
|
+
syncResolveContextConcurrently(contextConfs, contextConf => syncResolveStoryboardContext(contextConf, mergedContext, this, brick), keyword);
|
|
1991
2000
|
}
|
|
1992
2001
|
}
|
|
1993
2002
|
|
|
2003
|
+
getResolveOptions(coreContext) {
|
|
2004
|
+
return this.tplContextId ? {
|
|
2005
|
+
mergedContext: _objectSpread(_objectSpread({}, coreContext), {}, {
|
|
2006
|
+
tplContextId: this.tplContextId
|
|
2007
|
+
}),
|
|
2008
|
+
keyword: "STATE"
|
|
2009
|
+
} : {
|
|
2010
|
+
mergedContext: coreContext,
|
|
2011
|
+
keyword: "CTX"
|
|
2012
|
+
};
|
|
2013
|
+
}
|
|
2014
|
+
|
|
1994
2015
|
}
|
|
1995
2016
|
|
|
1996
2017
|
function resolveStoryboardContext(_x, _x2, _x3, _x4) {
|
|
@@ -2025,23 +2046,23 @@ function resolveNormalStoryboardContext(_x5, _x6, _x7, _x8) {
|
|
|
2025
2046
|
}
|
|
2026
2047
|
|
|
2027
2048
|
function _resolveNormalStoryboardContext() {
|
|
2028
|
-
_resolveNormalStoryboardContext = _asyncToGenerator$4(function* (contextConf,
|
|
2029
|
-
if (!looseCheckIf(contextConf,
|
|
2049
|
+
_resolveNormalStoryboardContext = _asyncToGenerator$4(function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2050
|
+
if (!looseCheckIf(contextConf, mergedContext)) {
|
|
2030
2051
|
return false;
|
|
2031
2052
|
}
|
|
2032
2053
|
|
|
2033
2054
|
var isResolve = false;
|
|
2034
|
-
var value = getDefinedTemplateState(
|
|
2055
|
+
var value = getDefinedTemplateState(!!storyboardContextWrapper.tplContextId, contextConf, brick);
|
|
2035
2056
|
|
|
2036
2057
|
if (value === undefined) {
|
|
2037
2058
|
if (contextConf.resolve) {
|
|
2038
|
-
if (looseCheckIf(contextConf.resolve,
|
|
2059
|
+
if (looseCheckIf(contextConf.resolve, mergedContext)) {
|
|
2039
2060
|
isResolve = true;
|
|
2040
2061
|
var valueConf = {};
|
|
2041
2062
|
yield _internalApiGetResolver().resolveOne("reference", _objectSpread({
|
|
2042
2063
|
transform: "value",
|
|
2043
2064
|
transformMapArray: false
|
|
2044
|
-
}, contextConf.resolve), valueConf, null,
|
|
2065
|
+
}, contextConf.resolve), valueConf, null, mergedContext);
|
|
2045
2066
|
value = valueConf.value;
|
|
2046
2067
|
} else if (!hasOwnProperty(contextConf, "value")) {
|
|
2047
2068
|
return false;
|
|
@@ -2049,18 +2070,18 @@ function _resolveNormalStoryboardContext() {
|
|
|
2049
2070
|
}
|
|
2050
2071
|
|
|
2051
2072
|
if (!isResolve && contextConf.value !== undefined) {
|
|
2052
|
-
value = computeRealValue(contextConf.value,
|
|
2073
|
+
value = computeRealValue(contextConf.value, mergedContext, true);
|
|
2053
2074
|
}
|
|
2054
2075
|
}
|
|
2055
2076
|
|
|
2056
|
-
resolveFreeVariableValue(value, contextConf,
|
|
2077
|
+
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick);
|
|
2057
2078
|
return true;
|
|
2058
2079
|
});
|
|
2059
2080
|
return _resolveNormalStoryboardContext.apply(this, arguments);
|
|
2060
2081
|
}
|
|
2061
2082
|
|
|
2062
|
-
function syncResolveStoryboardContext(contextConf,
|
|
2063
|
-
if (!looseCheckIf(contextConf,
|
|
2083
|
+
function syncResolveStoryboardContext(contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2084
|
+
if (!looseCheckIf(contextConf, mergedContext)) {
|
|
2064
2085
|
return false;
|
|
2065
2086
|
}
|
|
2066
2087
|
|
|
@@ -2068,23 +2089,23 @@ function syncResolveStoryboardContext(contextConf, coreContext, storyboardContex
|
|
|
2068
2089
|
throw new Error("resolve is not allowed here");
|
|
2069
2090
|
}
|
|
2070
2091
|
|
|
2071
|
-
var value = getDefinedTemplateState(
|
|
2092
|
+
var value = getDefinedTemplateState(!!storyboardContextWrapper.tplContextId, contextConf, brick);
|
|
2072
2093
|
|
|
2073
2094
|
if (value === undefined) {
|
|
2074
|
-
value = computeRealValue(contextConf.value,
|
|
2095
|
+
value = computeRealValue(contextConf.value, mergedContext, true);
|
|
2075
2096
|
}
|
|
2076
2097
|
|
|
2077
|
-
resolveFreeVariableValue(value, contextConf,
|
|
2098
|
+
resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick);
|
|
2078
2099
|
return true;
|
|
2079
2100
|
}
|
|
2080
2101
|
|
|
2081
|
-
function getDefinedTemplateState(
|
|
2082
|
-
if (
|
|
2102
|
+
function getDefinedTemplateState(isTemplateState, contextConf, brick) {
|
|
2103
|
+
if (isTemplateState && brick.properties && hasOwnProperty(brick.properties, contextConf.name)) {
|
|
2083
2104
|
return brick.properties[contextConf.name];
|
|
2084
2105
|
}
|
|
2085
2106
|
}
|
|
2086
2107
|
|
|
2087
|
-
function resolveFreeVariableValue(value, contextConf,
|
|
2108
|
+
function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick) {
|
|
2088
2109
|
var newContext = {
|
|
2089
2110
|
type: "free-variable",
|
|
2090
2111
|
value,
|
|
@@ -2094,13 +2115,7 @@ function resolveFreeVariableValue(value, contextConf, coreContext, storyboardCon
|
|
|
2094
2115
|
|
|
2095
2116
|
if (contextConf.onChange) {
|
|
2096
2117
|
for (var handler of [].concat(contextConf.onChange)) {
|
|
2097
|
-
|
|
2098
|
-
newContext.eventTarget.addEventListener("state.change", listenerFactory(handler, _objectSpread(_objectSpread({}, coreContext), {}, {
|
|
2099
|
-
tplContextId: storyboardContextWrapper.tplContextId
|
|
2100
|
-
}), brick));
|
|
2101
|
-
} else {
|
|
2102
|
-
newContext.eventTarget.addEventListener("context.change", listenerFactory(handler, coreContext, brick));
|
|
2103
|
-
}
|
|
2118
|
+
newContext.eventTarget.addEventListener(storyboardContextWrapper.tplContextId ? "state.change" : "context.change", listenerFactory(handler, mergedContext, brick));
|
|
2104
2119
|
}
|
|
2105
2120
|
}
|
|
2106
2121
|
|
|
@@ -2278,6 +2293,7 @@ function evaluate(raw) {
|
|
|
2278
2293
|
sys,
|
|
2279
2294
|
flags,
|
|
2280
2295
|
hash,
|
|
2296
|
+
pathname,
|
|
2281
2297
|
segues,
|
|
2282
2298
|
storyboardContext
|
|
2283
2299
|
} = _internalApiGetCurrentContext();
|
|
@@ -2318,6 +2334,9 @@ function evaluate(raw) {
|
|
|
2318
2334
|
case "HASH":
|
|
2319
2335
|
return hash;
|
|
2320
2336
|
|
|
2337
|
+
case "PATH_NAME":
|
|
2338
|
+
return pathname;
|
|
2339
|
+
|
|
2321
2340
|
case "INSTALLED_APPS":
|
|
2322
2341
|
return {
|
|
2323
2342
|
has: (appId, matchVersion) => getRuntime().hasInstalledApp(appId, matchVersion)
|
|
@@ -8493,6 +8512,7 @@ class LocationContext {
|
|
|
8493
8512
|
var auth = getAuth();
|
|
8494
8513
|
var context = {
|
|
8495
8514
|
hash: this.location.hash,
|
|
8515
|
+
pathname: this.location.pathname,
|
|
8496
8516
|
query: this.query,
|
|
8497
8517
|
match,
|
|
8498
8518
|
app: this.kernel.nextApp,
|
|
@@ -10130,7 +10150,9 @@ function propertyMergeAllOfArray(_ref, object) {
|
|
|
10130
10150
|
// Use an approach like template-literal's quasis:
|
|
10131
10151
|
// `quasi0${0}quais1${1}quasi2...`
|
|
10132
10152
|
// Every quasi can be merged with multiple items.
|
|
10133
|
-
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true
|
|
10153
|
+
var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
|
|
10154
|
+
$$lazyForUseBrick: true
|
|
10155
|
+
}) : [];
|
|
10134
10156
|
var quasis = [];
|
|
10135
10157
|
var size = computedBaseValue.length + 1;
|
|
10136
10158
|
|
|
@@ -10520,7 +10542,7 @@ function getTagNameOfCustomTemplate(brick, appId) {
|
|
|
10520
10542
|
return false;
|
|
10521
10543
|
}
|
|
10522
10544
|
|
|
10523
|
-
function handleProxyOfCustomTemplate(brick
|
|
10545
|
+
function handleProxyOfCustomTemplate(brick) {
|
|
10524
10546
|
// Ignore non-tpl bricks.
|
|
10525
10547
|
if (!brick.proxyRefs) {
|
|
10526
10548
|
return;
|
|
@@ -10534,17 +10556,18 @@ function handleProxyOfCustomTemplate(brick, reRun) {
|
|
|
10534
10556
|
|
|
10535
10557
|
return (_brick$proxyRefs$get$ = brick.proxyRefs.get(ref).brick) === null || _brick$proxyRefs$get$ === void 0 ? void 0 : _brick$proxyRefs$get$.element;
|
|
10536
10558
|
}
|
|
10537
|
-
}
|
|
10538
|
-
// `tpl.$$getElementByRef(ref)` will return the ref element inside a custom template.
|
|
10559
|
+
}
|
|
10539
10560
|
|
|
10561
|
+
var firstRun = !node.$$getElementByRef; // For usages of `targetRef: "..."`.
|
|
10562
|
+
// `tpl.$$getElementByRef(ref)` will return the ref element inside a custom template.
|
|
10540
10563
|
|
|
10541
|
-
if (
|
|
10564
|
+
if (firstRun) {
|
|
10542
10565
|
Object.defineProperty(node, "$$getElementByRef", {
|
|
10543
10566
|
value: getElementByRef
|
|
10544
10567
|
});
|
|
10545
10568
|
}
|
|
10546
10569
|
|
|
10547
|
-
if (
|
|
10570
|
+
if (firstRun && brick.stateNames) {
|
|
10548
10571
|
(function () {
|
|
10549
10572
|
// Define properties from state for tpl.
|
|
10550
10573
|
var getState = () => getCustomTemplateContext(brick.tplContextId).state;
|
|
@@ -11204,7 +11227,7 @@ var handleProxyOfParentTemplate = (brick, tplContextId) => {
|
|
|
11204
11227
|
handleProxyOfCustomTemplate(_objectSpread(_objectSpread({}, tplBrick), {}, {
|
|
11205
11228
|
proxyRefs: singleRefBrickProxyMap,
|
|
11206
11229
|
proxy: getFilterProxy(tplBrick.proxy, brick.ref)
|
|
11207
|
-
})
|
|
11230
|
+
}));
|
|
11208
11231
|
setRealProperties(tplBrick.element, tplBrick.properties || {});
|
|
11209
11232
|
}
|
|
11210
11233
|
}
|