@next-core/brick-kit 2.165.6 → 2.166.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.
@@ -644,10 +644,25 @@
644
644
  };
645
645
  }
646
646
 
647
- function imagesFactory(appId, isBuildPush) {
647
+ function imagesFactory(appId, isBuildPush, version) {
648
648
  return {
649
649
  get(name) {
650
- return isBuildPush ? "api/gateway/object_store.object_store.GetObject/api/v1/objectStore/bucket/next-builder/object/".concat(name) : "".concat(window.APP_ROOT ? "".concat(window.APP_ROOT, "-/") : "", "micro-apps/").concat(appId, "/images/").concat(name);
650
+ var getSuffix = () => {
651
+ var suffix = window.APP_ROOT ? "".concat(window.APP_ROOT, "-/") : "";
652
+ if (!suffix.startsWith("/")) {
653
+ suffix = getBasePath() + suffix;
654
+ }
655
+ if (window.APP_ID && window.APP_ID !== appId) {
656
+ return suffix.replace(new RegExp("/(".concat(window.APP_ID, "|\\d+.\\d+.\\d+)/"), "g"), (_, p1) => {
657
+ if (p1 === window.APP_ID) {
658
+ return "/".concat(appId, "/");
659
+ }
660
+ return "/".concat(version, "/");
661
+ });
662
+ }
663
+ return suffix;
664
+ };
665
+ return isBuildPush ? "".concat(getBasePath(), "api/gateway/object_store.object_store.GetObject/api/v1/objectStore/bucket/next-builder/object/").concat(name) : "".concat(getSuffix(), "micro-apps/").concat(appId, "/images/").concat(name);
651
666
  }
652
667
  };
653
668
  }
@@ -1402,7 +1417,7 @@
1402
1417
  case "FN":
1403
1418
  return storyboardFunctions;
1404
1419
  case "IMG":
1405
- return collectCoverage ? fakeImageFactory() : widgetId ? widgetImagesFactory(widgetId, widgetVersion) : imagesFactory(app.id, app.isBuildPush);
1420
+ return collectCoverage ? fakeImageFactory() : widgetId ? widgetImagesFactory(widgetId, widgetVersion) : imagesFactory(app.id, app.isBuildPush, app.currentVersion);
1406
1421
  case "I18N":
1407
1422
  return collectCoverage ? _.identity : widgetId ? widgetI18nFactory(widgetId) : i18next.getFixedT(null, [appendI18nNamespace, getI18nNamespace("app", app.id)].filter(Boolean));
1408
1423
  case "I18N_TEXT":
@@ -2415,232 +2430,6 @@
2415
2430
  }
2416
2431
  }
2417
2432
 
2418
- function isBasicProperty(propRef) {
2419
- return !!propRef.refProperty;
2420
- }
2421
- function isTransformableProperty(propRef) {
2422
- return !!propRef.refTransform;
2423
- }
2424
- function isMergeableProperty(propRef) {
2425
- return !!propRef.mergeProperty;
2426
- }
2427
- function isRefProperty(propRef) {
2428
- return !!propRef.ref;
2429
- }
2430
- function isVariableProperty(propRef) {
2431
- return !!propRef.asVariable;
2432
- }
2433
-
2434
- var customTemplateRegistry = new Map();
2435
- var appRegistered = new Set();
2436
- var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
2437
- var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
2438
- var symbolForTplContextId = Symbol.for("tpl.contextId");
2439
-
2440
- function propertyMerge(conf, value, object) {
2441
- return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
2442
- }
2443
- function propertyMergeAll(mergeBase, object) {
2444
- if (mergeBase.mergeType === "array") {
2445
- return propertyMergeAllOfArray(mergeBase, object);
2446
- }
2447
- if (mergeBase.mergeType === "object") {
2448
- return propertyMergeAllOfObject(mergeBase, object);
2449
- }
2450
- // istanbul ignore next: should never reach
2451
- throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
2452
- }
2453
- function propertyMergeAllOfArray(_ref, object) {
2454
- var _$1, _proxy$mergeArgs;
2455
- var {
2456
- baseValue,
2457
- context,
2458
- proxies
2459
- } = _ref;
2460
- // Use an approach like template-literal's quasis:
2461
- // `quasi0${0}quais1${1}quasi2...`
2462
- // Every quasi can be merged with multiple items.
2463
- var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
2464
- $$lazyForUseBrick: true
2465
- }) : [];
2466
- var quasis = [];
2467
- var size = computedBaseValue.length + 1;
2468
- for (var i = 0; i < size; i += 1) {
2469
- quasis.push([]);
2470
- }
2471
- for (var proxy of proxies) {
2472
- var position = void 0;
2473
- switch (proxy.mergeMethod) {
2474
- case "append":
2475
- position = computedBaseValue.length;
2476
- break;
2477
- case "prepend":
2478
- position = 0;
2479
- break;
2480
- case "insertAt":
2481
- // Defaults to `-1`.
2482
- position = (_$1 = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _$1 !== void 0 ? _$1 : -1;
2483
- if (position < 0) {
2484
- // It's counted from the end if position is negative.
2485
- position += quasis.length;
2486
- }
2487
- position = _.clamp(position, 0, computedBaseValue.length);
2488
- break;
2489
- // istanbul ignore next: should never reach
2490
- default:
2491
- throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
2492
- }
2493
- var patchValue = object[proxy.$$reversedRef];
2494
- if (!Array.isArray(patchValue)) {
2495
- patchValue = [];
2496
- }
2497
- quasis[position].push(...patchValue);
2498
- }
2499
- return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
2500
- }
2501
- function propertyMergeAllOfObject(_ref2, object) {
2502
- var {
2503
- baseValue,
2504
- proxies,
2505
- context
2506
- } = _ref2;
2507
- var computedBaseValue = brickUtils.isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
2508
- return proxies.reduce((acc, proxy) => {
2509
- switch (proxy.mergeMethod) {
2510
- case "extend":
2511
- return _objectSpread__default["default"](_objectSpread__default["default"]({}, acc), object[proxy.$$reversedRef]);
2512
- // istanbul ignore next: should never reach
2513
- default:
2514
- throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
2515
- }
2516
- }, computedBaseValue);
2517
- }
2518
-
2519
- function setupTemplateProxy(proxyContext, ref, slots) {
2520
- var computedPropsFromProxy = {};
2521
- var refForProxy;
2522
- var {
2523
- reversedProxies,
2524
- templateProperties,
2525
- externalSlots,
2526
- templateContextId,
2527
- proxyBrick
2528
- } = proxyContext;
2529
- if (ref && reversedProxies) {
2530
- refForProxy = {};
2531
- proxyBrick.proxyRefs.set(ref, refForProxy);
2532
-
2533
- // Reversed proxies are used for expand storyboard before rendering page.
2534
- if (reversedProxies.properties.has(ref)) {
2535
- Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
2536
- // `propValue` is computed.
2537
- var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
2538
- if (isTransformableProperty(propRef)) {
2539
- return Object.entries(preprocessTransformProperties({
2540
- [propRef.$$reversedRef]: propValue
2541
- }, propRef.refTransform));
2542
- }
2543
- if (isBasicProperty(propRef)) {
2544
- return [[propRef.refProperty, propValue]];
2545
- }
2546
- // Ignore Variable properties.
2547
- // And mergeable properties are processed later.
2548
- return [];
2549
- }).filter(propRef => propRef[1] !== undefined)));
2550
-
2551
- // Brick properties can be merged multiple times.
2552
- if (reversedProxies.mergeBases.has(ref)) {
2553
- Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
2554
- var [mergeProperty, mergeBase] = _ref;
2555
- return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
2556
- }).filter(item => item[1] !== undefined)));
2557
- }
2558
- }
2559
-
2560
- // Use an approach like template-literal's quasis:
2561
- // `quasi0${0}quais1${1}quasi2...`
2562
- // Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
2563
- var quasisMap = new Map();
2564
- if (reversedProxies.slots.has(ref)) {
2565
- for (var item of reversedProxies.slots.get(ref)) {
2566
- var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
2567
- if (!quasisMap.has(item.refSlot)) {
2568
- var quasis = [];
2569
- // The size of quasis should be the existed slotted bricks' size plus one.
2570
- var size = brickUtils.hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
2571
- for (var i = 0; i < size; i += 1) {
2572
- quasis.push([]);
2573
- }
2574
- quasisMap.set(item.refSlot, quasis);
2575
- }
2576
- var expandableSlot = quasisMap.get(item.refSlot);
2577
- var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
2578
- expandableSlot[_.clamp(refPosition < 0 ? expandableSlot.length + refPosition : refPosition, 0, expandableSlot.length - 1)].push(...((_externalSlots$item$$ = externalSlots === null || externalSlots === void 0 ? void 0 : (_externalSlots$item$$2 = externalSlots[item.$$reversedRef]) === null || _externalSlots$item$$2 === void 0 ? void 0 : _externalSlots$item$$2.bricks) !== null && _externalSlots$item$$ !== void 0 ? _externalSlots$item$$ : []));
2579
- }
2580
- }
2581
- var _loop = function (slotName, _quasis) {
2582
- if (!brickUtils.hasOwnProperty(slots, slotName)) {
2583
- slots[slotName] = {
2584
- type: "bricks",
2585
- bricks: []
2586
- };
2587
- }
2588
- var slotConf = slots[slotName];
2589
- slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
2590
- if (slotConf.bricks.length === 0) {
2591
- delete slots[slotName];
2592
- }
2593
- };
2594
- for (var [slotName, _quasis] of quasisMap.entries()) {
2595
- _loop(slotName, _quasis);
2596
- }
2597
- }
2598
- return {
2599
- [symbolForComputedPropsFromProxy]: computedPropsFromProxy,
2600
- [symbolForRefForProxy]: refForProxy,
2601
- [symbolForTplContextId]: templateContextId
2602
- };
2603
- }
2604
-
2605
- function setupUseBrickInTemplate(props, proxyContext) {
2606
- function walk(props) {
2607
- if (!props) {
2608
- return;
2609
- }
2610
- for (var [key, value] of Object.entries(props)) {
2611
- if (brickUtils.isObject(value)) {
2612
- if (key === "useBrick") {
2613
- if (Array.isArray(value)) {
2614
- value.forEach(setup);
2615
- } else {
2616
- setup(value);
2617
- }
2618
- } else {
2619
- walk(value);
2620
- }
2621
- }
2622
- }
2623
- }
2624
- function setup(item) {
2625
- var {
2626
- ref,
2627
- slots: slotsInTemplate
2628
- } = item;
2629
- item.slots = Object.fromEntries(Object.entries(slotsInTemplate !== null && slotsInTemplate !== void 0 ? slotsInTemplate : {}).map(_ref => {
2630
- var _slotConf$bricks;
2631
- var [slotName, slotConf] = _ref;
2632
- return [slotName, {
2633
- type: "bricks",
2634
- bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
2635
- }];
2636
- }));
2637
- Object.assign(item, setupTemplateProxy(proxyContext, ref, item.slots));
2638
- walk(item.properties);
2639
- return item;
2640
- }
2641
- walk(props);
2642
- }
2643
-
2644
2433
  var computeRealValue = (value, context, injectDeep, internalOptions) => {
2645
2434
  var preEvaluated = isPreEvaluated(value);
2646
2435
  if (preEvaluated || typeof value === "string") {
@@ -2692,11 +2481,6 @@
2692
2481
  };
2693
2482
  function setProperties(bricks, properties, context, injectDeep) {
2694
2483
  var realProps = computeRealProperties(properties, context, injectDeep);
2695
- if (context.tplContextId) {
2696
- setupUseBrickInTemplate(realProps, {
2697
- templateContextId: context.tplContextId
2698
- });
2699
- }
2700
2484
  if (!Array.isArray(bricks)) {
2701
2485
  bricks = [bricks];
2702
2486
  }
@@ -2764,7 +2548,7 @@
2764
2548
  }) : internalOptions;
2765
2549
  }
2766
2550
 
2767
- var _excluded$6 = ["children"],
2551
+ var _excluded$7 = ["children"],
2768
2552
  _excluded2$2 = ["children"],
2769
2553
  _excluded3 = ["items", "app"];
2770
2554
  var symbolAppId = Symbol("appId");
@@ -3027,7 +2811,7 @@
3027
2811
  var {
3028
2812
  children
3029
2813
  } = _ref,
3030
- rest = _objectWithoutProperties__default["default"](_ref, _excluded$6);
2814
+ rest = _objectWithoutProperties__default["default"](_ref, _excluded$7);
3031
2815
  var overrideAppId = rest[symbolAppId];
3032
2816
  if (!rest[symbolMenuI18nNamespace] && overrideAppId !== contextAppId && !appIds.has(overrideAppId) && attemptToVisit(rest, ["I18N"])) {
3033
2817
  appIds.add(overrideAppId);
@@ -3138,7 +2922,7 @@
3138
2922
  function _computeRealValueWithOverrideApp() {
3139
2923
  _computeRealValueWithOverrideApp = _asyncToGenerator__default["default"](function* (data, overrideAppId, context, kernel) {
3140
2924
  var newContext = context;
3141
- if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N"])) {
2925
+ if (overrideAppId !== context.app.id && attemptToVisit(data, ["APP", "I18N", "IMG"])) {
3142
2926
  if (window.STANDALONE_MICRO_APPS) {
3143
2927
  if (data[symbolOverrideApp]) {
3144
2928
  data[symbolOverrideApp].config = brickUtils.deepFreeze(_.merge({}, data[symbolOverrideApp].defaultConfig, data[symbolOverrideApp].userConfig));
@@ -3649,7 +3433,7 @@
3649
3433
  return kernel.loadDynamicBricksInBrickConf(brickConf);
3650
3434
  }
3651
3435
 
3652
- var _excluded$5 = ["extraQuery", "clear", "keepHash"];
3436
+ var _excluded$6 = ["extraQuery", "clear", "keepHash"];
3653
3437
  var blocked = false;
3654
3438
  function getUserConfirmation(message, callback) {
3655
3439
  blocked = !confirm(message);
@@ -3679,7 +3463,7 @@
3679
3463
  clear,
3680
3464
  keepHash
3681
3465
  } = options,
3682
- state = _objectWithoutProperties__default["default"](options, _excluded$5);
3466
+ state = _objectWithoutProperties__default["default"](options, _excluded$6);
3683
3467
  var urlSearchParams = new URLSearchParams(clear ? "" : browserHistory.location.search);
3684
3468
  var params = {};
3685
3469
  Object.assign(params, query, extraQuery);
@@ -6750,7 +6534,7 @@
6750
6534
  };
6751
6535
  }();
6752
6536
 
6753
- var _excluded$4 = ["feature_flags"],
6537
+ var _excluded$5 = ["feature_flags"],
6754
6538
  _excluded2$1 = ["featureFlags", "misc"];
6755
6539
  function standaloneBootstrap() {
6756
6540
  return _standaloneBootstrap.apply(this, arguments);
@@ -6796,7 +6580,7 @@
6796
6580
  var {
6797
6581
  feature_flags: featureFlags
6798
6582
  } = sys_settings,
6799
- rest = _objectWithoutProperties__default["default"](sys_settings, _excluded$4);
6583
+ rest = _objectWithoutProperties__default["default"](sys_settings, _excluded$5);
6800
6584
  settings = _objectSpread__default["default"]({
6801
6585
  featureFlags
6802
6586
  }, rest);
@@ -7754,6 +7538,28 @@
7754
7538
  var filterProperties = ["instanceId", "brick", "slots", "properties", "events", "if", "context", "bricks", "mountPoint"];
7755
7539
  var symbolForFormContextId = Symbol.for("form.contextId");
7756
7540
 
7541
+ var customTemplateRegistry = new Map();
7542
+ var appRegistered = new Set();
7543
+ var symbolForComputedPropsFromProxy = Symbol.for("tpl.computedPropsFromProxy");
7544
+ var symbolForRefForProxy = Symbol.for("tpl.refForProxy");
7545
+ var symbolForTplContextId = Symbol.for("tpl.contextId");
7546
+
7547
+ function isBasicProperty(propRef) {
7548
+ return !!propRef.refProperty;
7549
+ }
7550
+ function isTransformableProperty(propRef) {
7551
+ return !!propRef.refTransform;
7552
+ }
7553
+ function isMergeableProperty(propRef) {
7554
+ return !!propRef.mergeProperty;
7555
+ }
7556
+ function isRefProperty(propRef) {
7557
+ return !!propRef.ref;
7558
+ }
7559
+ function isVariableProperty(propRef) {
7560
+ return !!propRef.asVariable;
7561
+ }
7562
+
7757
7563
  function collectRefsInTemplate(template) {
7758
7564
  var refMap = new Map();
7759
7565
  collectRefsInBrickConfs(template.bricks, refMap);
@@ -7809,6 +7615,207 @@
7809
7615
  }
7810
7616
  }
7811
7617
 
7618
+ function propertyMerge(conf, value, object) {
7619
+ return propertyMergeAll(conf.$$mergeBase, Object.fromEntries(conf.$$mergeBase.proxies.map(proxy => [proxy.$$reversedRef, proxy === conf ? value : object[proxy.$$reversedRef]])));
7620
+ }
7621
+ function propertyMergeAll(mergeBase, object) {
7622
+ if (mergeBase.mergeType === "array") {
7623
+ return propertyMergeAllOfArray(mergeBase, object);
7624
+ }
7625
+ if (mergeBase.mergeType === "object") {
7626
+ return propertyMergeAllOfObject(mergeBase, object);
7627
+ }
7628
+ // istanbul ignore next: should never reach
7629
+ throw new TypeError("unsupported mergeType: \"".concat(mergeBase.mergeType, "\""));
7630
+ }
7631
+ function propertyMergeAllOfArray(_ref, object) {
7632
+ var _$1, _proxy$mergeArgs;
7633
+ var {
7634
+ baseValue,
7635
+ context,
7636
+ proxies
7637
+ } = _ref;
7638
+ // Use an approach like template-literal's quasis:
7639
+ // `quasi0${0}quais1${1}quasi2...`
7640
+ // Every quasi can be merged with multiple items.
7641
+ var computedBaseValue = Array.isArray(baseValue) ? computeRealValue(baseValue, context, true, {
7642
+ $$lazyForUseBrick: true
7643
+ }) : [];
7644
+ var quasis = [];
7645
+ var size = computedBaseValue.length + 1;
7646
+ for (var i = 0; i < size; i += 1) {
7647
+ quasis.push([]);
7648
+ }
7649
+ for (var proxy of proxies) {
7650
+ var position = void 0;
7651
+ switch (proxy.mergeMethod) {
7652
+ case "append":
7653
+ position = computedBaseValue.length;
7654
+ break;
7655
+ case "prepend":
7656
+ position = 0;
7657
+ break;
7658
+ case "insertAt":
7659
+ // Defaults to `-1`.
7660
+ position = (_$1 = (_proxy$mergeArgs = proxy.mergeArgs) === null || _proxy$mergeArgs === void 0 ? void 0 : _proxy$mergeArgs[0]) !== null && _$1 !== void 0 ? _$1 : -1;
7661
+ if (position < 0) {
7662
+ // It's counted from the end if position is negative.
7663
+ position += quasis.length;
7664
+ }
7665
+ position = _.clamp(position, 0, computedBaseValue.length);
7666
+ break;
7667
+ // istanbul ignore next: should never reach
7668
+ default:
7669
+ throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
7670
+ }
7671
+ var patchValue = object[proxy.$$reversedRef];
7672
+ if (!Array.isArray(patchValue)) {
7673
+ patchValue = [];
7674
+ }
7675
+ quasis[position].push(...patchValue);
7676
+ }
7677
+ return quasis.flatMap((item, index) => index < computedBaseValue.length ? item.concat(computedBaseValue[index]) : item);
7678
+ }
7679
+ function propertyMergeAllOfObject(_ref2, object) {
7680
+ var {
7681
+ baseValue,
7682
+ proxies,
7683
+ context
7684
+ } = _ref2;
7685
+ var computedBaseValue = brickUtils.isObject(baseValue) ? computeRealValue(baseValue, context, true) : {};
7686
+ return proxies.reduce((acc, proxy) => {
7687
+ switch (proxy.mergeMethod) {
7688
+ case "extend":
7689
+ return _objectSpread__default["default"](_objectSpread__default["default"]({}, acc), object[proxy.$$reversedRef]);
7690
+ // istanbul ignore next: should never reach
7691
+ default:
7692
+ throw new TypeError("unsupported mergeMethod: \"".concat(proxy.mergeMethod, "\" for mergeType \"").concat(proxy.mergeType, "\""));
7693
+ }
7694
+ }, computedBaseValue);
7695
+ }
7696
+
7697
+ function setupTemplateProxy(proxyContext, ref, slots) {
7698
+ var computedPropsFromProxy = {};
7699
+ var refForProxy;
7700
+ var {
7701
+ reversedProxies,
7702
+ templateProperties,
7703
+ externalSlots,
7704
+ templateContextId,
7705
+ proxyBrick
7706
+ } = proxyContext;
7707
+ if (ref && reversedProxies) {
7708
+ refForProxy = {};
7709
+ proxyBrick.proxyRefs.set(ref, refForProxy);
7710
+
7711
+ // Reversed proxies are used for expand storyboard before rendering page.
7712
+ if (reversedProxies.properties.has(ref)) {
7713
+ Object.assign(computedPropsFromProxy, Object.fromEntries(reversedProxies.properties.get(ref).flatMap(propRef => {
7714
+ // `propValue` is computed.
7715
+ var propValue = templateProperties === null || templateProperties === void 0 ? void 0 : templateProperties[propRef.$$reversedRef];
7716
+ if (isTransformableProperty(propRef)) {
7717
+ return Object.entries(preprocessTransformProperties({
7718
+ [propRef.$$reversedRef]: propValue
7719
+ }, propRef.refTransform));
7720
+ }
7721
+ if (isBasicProperty(propRef)) {
7722
+ return [[propRef.refProperty, propValue]];
7723
+ }
7724
+ // Ignore Variable properties.
7725
+ // And mergeable properties are processed later.
7726
+ return [];
7727
+ }).filter(propRef => propRef[1] !== undefined)));
7728
+
7729
+ // Brick properties can be merged multiple times.
7730
+ if (reversedProxies.mergeBases.has(ref)) {
7731
+ Object.assign(computedPropsFromProxy, Object.fromEntries(Array.from(reversedProxies.mergeBases.get(ref).entries()).map(_ref => {
7732
+ var [mergeProperty, mergeBase] = _ref;
7733
+ return [mergeProperty, propertyMergeAll(mergeBase, templateProperties !== null && templateProperties !== void 0 ? templateProperties : {})];
7734
+ }).filter(item => item[1] !== undefined)));
7735
+ }
7736
+ }
7737
+
7738
+ // Use an approach like template-literal's quasis:
7739
+ // `quasi0${0}quais1${1}quasi2...`
7740
+ // Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.
7741
+ var quasisMap = new Map();
7742
+ if (reversedProxies.slots.has(ref)) {
7743
+ for (var item of reversedProxies.slots.get(ref)) {
7744
+ var _item$refPosition, _externalSlots$item$$, _externalSlots$item$$2;
7745
+ if (!quasisMap.has(item.refSlot)) {
7746
+ var quasis = [];
7747
+ // The size of quasis should be the existed slotted bricks' size plus one.
7748
+ var size = brickUtils.hasOwnProperty(slots, item.refSlot) ? slots[item.refSlot].bricks.length + 1 : 1;
7749
+ for (var i = 0; i < size; i += 1) {
7750
+ quasis.push([]);
7751
+ }
7752
+ quasisMap.set(item.refSlot, quasis);
7753
+ }
7754
+ var expandableSlot = quasisMap.get(item.refSlot);
7755
+ var refPosition = (_item$refPosition = item.refPosition) !== null && _item$refPosition !== void 0 ? _item$refPosition : -1;
7756
+ expandableSlot[_.clamp(refPosition < 0 ? expandableSlot.length + refPosition : refPosition, 0, expandableSlot.length - 1)].push(...((_externalSlots$item$$ = externalSlots === null || externalSlots === void 0 ? void 0 : (_externalSlots$item$$2 = externalSlots[item.$$reversedRef]) === null || _externalSlots$item$$2 === void 0 ? void 0 : _externalSlots$item$$2.bricks) !== null && _externalSlots$item$$ !== void 0 ? _externalSlots$item$$ : []));
7757
+ }
7758
+ }
7759
+ var _loop = function (slotName, _quasis) {
7760
+ if (!brickUtils.hasOwnProperty(slots, slotName)) {
7761
+ slots[slotName] = {
7762
+ type: "bricks",
7763
+ bricks: []
7764
+ };
7765
+ }
7766
+ var slotConf = slots[slotName];
7767
+ slotConf.bricks = _quasis.flatMap((bricks, index) => index < slotConf.bricks.length ? bricks.concat(slotConf.bricks[index]) : bricks);
7768
+ if (slotConf.bricks.length === 0) {
7769
+ delete slots[slotName];
7770
+ }
7771
+ };
7772
+ for (var [slotName, _quasis] of quasisMap.entries()) {
7773
+ _loop(slotName, _quasis);
7774
+ }
7775
+ }
7776
+ return {
7777
+ [symbolForComputedPropsFromProxy]: computedPropsFromProxy,
7778
+ [symbolForRefForProxy]: refForProxy,
7779
+ [symbolForTplContextId]: templateContextId
7780
+ };
7781
+ }
7782
+
7783
+ var _excluded$4 = ["properties", "slots"];
7784
+ function setupUseBrickInTemplate(props, proxyContext) {
7785
+ function walk(props) {
7786
+ if (!brickUtils.isObject(props)) {
7787
+ return props;
7788
+ }
7789
+ if (Array.isArray(props)) {
7790
+ return props.map(walk);
7791
+ }
7792
+ return Object.fromEntries(Object.entries(props).map(_ref => {
7793
+ var [key, value] = _ref;
7794
+ return brickUtils.isObject(value) && key === "useBrick" ? Array.isArray(value) ? [key, value.map(setup)] : [key, setup(value)] : [key, walk(value)];
7795
+ }).concat(Object.getOwnPropertySymbols(props).map(k => [k, props[k]])));
7796
+ }
7797
+ function setup(item) {
7798
+ var {
7799
+ properties,
7800
+ slots: originalSlots
7801
+ } = item,
7802
+ restConf = _objectWithoutProperties__default["default"](item, _excluded$4);
7803
+ var slots = Object.fromEntries(Object.entries(originalSlots !== null && originalSlots !== void 0 ? originalSlots : {}).map(_ref2 => {
7804
+ var _slotConf$bricks;
7805
+ var [slotName, slotConf] = _ref2;
7806
+ return [slotName, {
7807
+ type: "bricks",
7808
+ bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(setup)
7809
+ }];
7810
+ }));
7811
+ return _objectSpread__default["default"](_objectSpread__default["default"]({}, restConf), {}, {
7812
+ properties: walk(properties),
7813
+ slots
7814
+ }, setupTemplateProxy(proxyContext, restConf.ref, slots));
7815
+ }
7816
+ return walk(props);
7817
+ }
7818
+
7812
7819
  var _excluded$3 = ["properties", "slots"],
7813
7820
  _excluded2 = ["ref", "slots"];
7814
7821
  function expandCustomTemplate(brickConf, proxyBrick, context) {
@@ -7965,8 +7972,8 @@
7965
7972
  bricks: ((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : []).map(item => expandBrickInTemplate(item, proxyContext))
7966
7973
  }];
7967
7974
  }));
7968
- setupUseBrickInTemplate(brickConfInTemplate.properties, proxyContext);
7969
7975
  return _objectSpread__default["default"](_objectSpread__default["default"]({}, restBrickConfInTemplate), {}, {
7976
+ properties: setupUseBrickInTemplate(brickConfInTemplate.properties, proxyContext),
7970
7977
  slots
7971
7978
  }, setupTemplateProxy(proxyContext, ref, slots));
7972
7979
  }