@next-core/runtime 1.34.0 → 1.34.2

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.
@@ -106,21 +106,22 @@ function setupTemplateExternalBricks(bricks, hasForEach, forEachItem, forEachInd
106
106
  } : {
107
107
  [_constants.symbolForTPlExternalNoForEach]: true
108
108
  }),
109
- slots: Object.fromEntries(Object.entries((_childrenToSlots = (0, _Renderer.childrenToSlots)(children, slots)) !== null && _childrenToSlots !== void 0 ? _childrenToSlots : {}).map(([slotName, slotConf]) => {
110
- var _slotConf$bricks;
111
- return [slotName, slotConf.type === "routes" ? {
112
- type: "routes",
113
- routes: setupTemplateExternalRoutes(slotConf.routes, hasForEach, forEachItem, forEachIndex)
114
- } : {
115
- type: "bricks",
116
- bricks: setupTemplateExternalBricks((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : [], hasForEach, forEachItem, forEachIndex)
117
- }];
118
- }))
109
+ // Keep `:forEach` bricks as original, since they have their own forEachItem context.
110
+ slots: brick.brick === ":forEach" ? (0, _Renderer.childrenToSlots)(children, slots) : Object.fromEntries(Object.entries((_childrenToSlots = (0, _Renderer.childrenToSlots)(children, slots)) !== null && _childrenToSlots !== void 0 ? _childrenToSlots : {}).map(([slotName, slotConf]) => [slotName, slotConf.type === "routes" ? {
111
+ type: "routes",
112
+ routes: setupTemplateExternalRoutes(slotConf.routes, hasForEach, forEachItem, forEachIndex)
113
+ } : {
114
+ type: "bricks",
115
+ bricks: setupTemplateExternalBricks(slotConf.bricks, hasForEach, forEachItem, forEachIndex)
116
+ }]))
119
117
  };
120
118
  });
121
119
  }
122
120
  function setupTemplateExternalRoutes(routes, hasForEach, forEachItem, forEachIndex) {
123
- return routes.map(route => route.type && route.type !== "bricks" ? route : {
121
+ return routes.map(route => route.type === "routes" ? {
122
+ ...route,
123
+ routes: setupTemplateExternalRoutes(route.routes, hasForEach, forEachItem, forEachIndex)
124
+ } : route.type === "redirect" ? route : {
124
125
  ...route,
125
126
  bricks: setupTemplateExternalBricks(route.bricks, hasForEach, forEachItem, forEachIndex)
126
127
  });
@@ -1 +1 @@
1
- {"version":3,"file":"setupTemplateProxy.js","names":["_general","require","_lodash","_constants","_computeRealProperties","_Renderer","setupTemplateProxy","hostContext","ref","slots","reversedProxies","asyncHostPropertyEntries","externalSlots","tplStateStoreId","hostBrick","asyncComputedProps","propertyProxies","properties","get","getComputedProps","asyncHostProps","map","from","to","filtered","filter","entry","length","refProperty","computePropertyValue","Boolean","slotProxies","quasisMap","Map","_externalSlots$from$b","_externalSlots$from","_to$refSlot","_to$refPosition","insertBricks","bricks","refToSlot","refSlot","expandableSlot","size","hasOwnProperty","i","push","set","refPosition","hostHasForEach","runtimeContext","clamp","__temporary_tpl_tag_name","setupTemplateExternalBricks","forEachItem","forEachIndex","slotName","quasis","entries","type","slotConf","flatMap","index","concat","symbolForAsyncComputedPropsFromHost","symbolForTplStateStoreId","hasForEach","children","symbolForTPlExternalForEachItem","a","symbolForTPlExternalForEachIndex","b","symbolForTPlExternalNoForEach","c","brick","_childrenToSlots","Object","fromEntries","childrenToSlots","_slotConf$bricks","routes","setupTemplateExternalRoutes","route"],"sources":["../../../../src/internal/CustomTemplates/setupTemplateProxy.ts"],"sourcesContent":["import type { BrickConf, RouteConf, SlotsConfOfBricks } from \"@next-core/types\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { clamp } from \"lodash\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n type RuntimeBrickConfWithTplSymbols,\n} from \"./constants.js\";\nimport type { AsyncPropertyEntry, TemplateHostContext } from \"../interfaces.js\";\nimport { computePropertyValue } from \"../compute/computeRealProperties.js\";\nimport { childrenToSlots } from \"../Renderer.js\";\n\nexport function setupTemplateProxy(\n hostContext: TemplateHostContext,\n ref: string | undefined,\n slots: SlotsConfOfBricks\n) {\n const {\n reversedProxies,\n asyncHostPropertyEntries,\n externalSlots,\n tplStateStoreId,\n hostBrick,\n } = hostContext;\n\n let asyncComputedProps: AsyncPropertyEntry[] | undefined;\n\n if (ref && reversedProxies) {\n const propertyProxies = reversedProxies.properties.get(ref);\n if (propertyProxies) {\n const getComputedProps = (\n asyncHostProps: AsyncPropertyEntry[]\n ): AsyncPropertyEntry[] => {\n return propertyProxies!\n .map(({ from, to }) => {\n const filtered = asyncHostProps.filter(\n (entry) => entry[0] === from\n );\n if (filtered.length > 0 && to.refProperty) {\n return [\n to.refProperty,\n computePropertyValue(filtered, from),\n true,\n ];\n }\n })\n .filter(Boolean) as [string, Promise<unknown>][];\n };\n\n asyncComputedProps = getComputedProps(asyncHostPropertyEntries);\n }\n\n const slotProxies = reversedProxies.slots.get(ref);\n if (slotProxies && externalSlots) {\n // Use an approach like template-literal's quasis:\n // `quasi0${0}quais1${1}quasi2...`\n // Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.\n const quasisMap = new Map<string, BrickConf[][]>();\n\n for (const { from, to } of slotProxies) {\n const insertBricks = externalSlots[from]?.bricks ?? [];\n if (!insertBricks.length) {\n continue;\n }\n const refToSlot = to.refSlot ?? from;\n let expandableSlot = quasisMap.get(refToSlot);\n if (!expandableSlot) {\n expandableSlot = [];\n // The size of quasis should be the existed slotted bricks' size plus one.\n const size = hasOwnProperty(slots, refToSlot)\n ? slots[refToSlot].bricks.length + 1\n : 1;\n for (let i = 0; i < size; i += 1) {\n expandableSlot.push([]);\n }\n quasisMap.set(refToSlot, expandableSlot);\n }\n const refPosition = to.refPosition ?? -1;\n // External bricks of a template, should not access the template internal forEach `ITEM`.\n // For some existing templates who is *USING* this bug, we keep the old behavior.\n const hostHasForEach = hasOwnProperty(\n hostBrick.runtimeContext,\n \"forEachItem\"\n );\n expandableSlot[\n clamp(\n refPosition < 0 ? expandableSlot.length + refPosition : refPosition,\n 0,\n expandableSlot.length - 1\n )\n ].push(\n ...((hostContext.__temporary_tpl_tag_name ===\n \"base-layout-v3.tpl-scroll-load-list\" ||\n hostContext.__temporary_tpl_tag_name ===\n \"shrcb-homepage.tpl-custom-scroll-load-list\") &&\n !hostHasForEach\n ? insertBricks\n : setupTemplateExternalBricks(\n insertBricks,\n hostHasForEach,\n hostBrick.runtimeContext.forEachItem,\n hostBrick.runtimeContext.forEachIndex!\n ))\n );\n }\n\n for (const [slotName, quasis] of quasisMap.entries()) {\n if (!hasOwnProperty(slots, slotName)) {\n slots[slotName] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n const slotConf = slots[slotName];\n slotConf.bricks = quasis.flatMap((bricks, index) =>\n index < slotConf.bricks.length\n ? bricks.concat(slotConf.bricks[index])\n : bricks\n );\n\n if (slotConf.bricks.length === 0) {\n delete slots[slotName];\n }\n }\n }\n }\n\n return {\n [symbolForAsyncComputedPropsFromHost]: asyncComputedProps,\n [symbolForTplStateStoreId]: tplStateStoreId,\n };\n}\n\n// External bricks of a template, have the same forEachItem context as their host.\nfunction setupTemplateExternalBricks(\n bricks: BrickConf[],\n hasForEach: boolean,\n forEachItem: unknown,\n forEachIndex: number\n): BrickConf[] {\n return (bricks as RuntimeBrickConfWithTplSymbols[]).map(\n ({\n children,\n slots,\n [symbolForTPlExternalForEachItem]: a,\n [symbolForTPlExternalForEachIndex]: b,\n [symbolForTPlExternalNoForEach]: c,\n ...brick\n }) => ({\n ...brick,\n ...(hasForEach\n ? {\n [symbolForTPlExternalForEachItem]: forEachItem,\n [symbolForTPlExternalForEachIndex]: forEachIndex,\n }\n : {\n [symbolForTPlExternalNoForEach]: true,\n }),\n slots: Object.fromEntries(\n Object.entries(childrenToSlots(children, slots) ?? {}).map(\n ([slotName, slotConf]) => [\n slotName,\n slotConf.type === \"routes\"\n ? {\n type: \"routes\",\n routes: setupTemplateExternalRoutes(\n slotConf.routes,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n : {\n type: \"bricks\",\n bricks: setupTemplateExternalBricks(\n slotConf.bricks ?? [],\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n },\n ]\n )\n ),\n })\n );\n}\n\nfunction setupTemplateExternalRoutes(\n routes: RouteConf[],\n hasForEach: boolean,\n forEachItem: unknown,\n forEachIndex: number\n): RouteConf[] {\n return routes.map((route) =>\n route.type && route.type !== \"bricks\"\n ? route\n : {\n ...route,\n bricks: setupTemplateExternalBricks(\n route.bricks,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AASA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAEO,SAASK,kBAAkBA,CAChCC,WAAgC,EAChCC,GAAuB,EACvBC,KAAwB,EACxB;EACA,MAAM;IACJC,eAAe;IACfC,wBAAwB;IACxBC,aAAa;IACbC,eAAe;IACfC;EACF,CAAC,GAAGP,WAAW;EAEf,IAAIQ,kBAAoD;EAExD,IAAIP,GAAG,IAAIE,eAAe,EAAE;IAC1B,MAAMM,eAAe,GAAGN,eAAe,CAACO,UAAU,CAACC,GAAG,CAACV,GAAG,CAAC;IAC3D,IAAIQ,eAAe,EAAE;MACnB,MAAMG,gBAAgB,GACpBC,cAAoC,IACX;QACzB,OAAOJ,eAAe,CACnBK,GAAG,CAAC,CAAC;UAAEC,IAAI;UAAEC;QAAG,CAAC,KAAK;UACrB,MAAMC,QAAQ,GAAGJ,cAAc,CAACK,MAAM,CACnCC,KAAK,IAAKA,KAAK,CAAC,CAAC,CAAC,KAAKJ,IAC1B,CAAC;UACD,IAAIE,QAAQ,CAACG,MAAM,GAAG,CAAC,IAAIJ,EAAE,CAACK,WAAW,EAAE;YACzC,OAAO,CACLL,EAAE,CAACK,WAAW,EACd,IAAAC,2CAAoB,EAACL,QAAQ,EAAEF,IAAI,CAAC,EACpC,IAAI,CACL;UACH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AAM,EAAEc,2BAA2B,EAAA0B,gBAAA,GACjCnB,QAAQ,CAACrB,MAAM,cAAAwC,gBAAA,cAAAA,gBAAA,GAAI,EAAE,EACrBb,UAAU,EACVZ,WAAW,EACXC,YACF;QACF,CAAC,CACN;MAAA,CACH,CACF;IACF,CAAC;EAAA,CACH,CAAC;AACH;AAEA,SAAS0B,2BAA2BA,CAClCD,MAAmB,EACnBd,UAAmB,EACnBZ,WAAoB,EACpBC,YAAoB,EACP;EACb,OAAOyB,MAAM,CAAC3D,GAAG,CAAE6D,KAAK,IACtBA,KAAK,CAACvB,IAAI,IAAIuB,KAAK,CAACvB,IAAI,KAAK,QAAQ,GACjCuB,KAAK,GACL;IACE,GAAGA,KAAK;IACR3C,MAAM,EAAEc,2BAA2B,CACjC6B,KAAK,CAAC3C,MAAM,EACZ2B,UAAU,EACVZ,WAAW,EACXC,YACF;EACF,CACN,CAAC;AACH"}
1
+ {"version":3,"file":"setupTemplateProxy.js","names":["_general","require","_lodash","_constants","_computeRealProperties","_Renderer","setupTemplateProxy","hostContext","ref","slots","reversedProxies","asyncHostPropertyEntries","externalSlots","tplStateStoreId","hostBrick","asyncComputedProps","propertyProxies","properties","get","getComputedProps","asyncHostProps","map","from","to","filtered","filter","entry","length","refProperty","computePropertyValue","Boolean","slotProxies","quasisMap","Map","_externalSlots$from$b","_externalSlots$from","_to$refSlot","_to$refPosition","insertBricks","bricks","refToSlot","refSlot","expandableSlot","size","hasOwnProperty","i","push","set","refPosition","hostHasForEach","runtimeContext","clamp","__temporary_tpl_tag_name","setupTemplateExternalBricks","forEachItem","forEachIndex","slotName","quasis","entries","type","slotConf","flatMap","index","concat","symbolForAsyncComputedPropsFromHost","symbolForTplStateStoreId","hasForEach","children","symbolForTPlExternalForEachItem","a","symbolForTPlExternalForEachIndex","b","symbolForTPlExternalNoForEach","c","brick","_childrenToSlots","childrenToSlots","Object","fromEntries","routes","setupTemplateExternalRoutes","route"],"sources":["../../../../src/internal/CustomTemplates/setupTemplateProxy.ts"],"sourcesContent":["import type { BrickConf, RouteConf, SlotsConfOfBricks } from \"@next-core/types\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { clamp } from \"lodash\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n type RuntimeBrickConfWithTplSymbols,\n} from \"./constants.js\";\nimport type { AsyncPropertyEntry, TemplateHostContext } from \"../interfaces.js\";\nimport { computePropertyValue } from \"../compute/computeRealProperties.js\";\nimport { childrenToSlots } from \"../Renderer.js\";\n\nexport function setupTemplateProxy(\n hostContext: TemplateHostContext,\n ref: string | undefined,\n slots: SlotsConfOfBricks\n) {\n const {\n reversedProxies,\n asyncHostPropertyEntries,\n externalSlots,\n tplStateStoreId,\n hostBrick,\n } = hostContext;\n\n let asyncComputedProps: AsyncPropertyEntry[] | undefined;\n\n if (ref && reversedProxies) {\n const propertyProxies = reversedProxies.properties.get(ref);\n if (propertyProxies) {\n const getComputedProps = (\n asyncHostProps: AsyncPropertyEntry[]\n ): AsyncPropertyEntry[] => {\n return propertyProxies!\n .map(({ from, to }) => {\n const filtered = asyncHostProps.filter(\n (entry) => entry[0] === from\n );\n if (filtered.length > 0 && to.refProperty) {\n return [\n to.refProperty,\n computePropertyValue(filtered, from),\n true,\n ];\n }\n })\n .filter(Boolean) as [string, Promise<unknown>][];\n };\n\n asyncComputedProps = getComputedProps(asyncHostPropertyEntries);\n }\n\n const slotProxies = reversedProxies.slots.get(ref);\n if (slotProxies && externalSlots) {\n // Use an approach like template-literal's quasis:\n // `quasi0${0}quais1${1}quasi2...`\n // Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.\n const quasisMap = new Map<string, BrickConf[][]>();\n\n for (const { from, to } of slotProxies) {\n const insertBricks = externalSlots[from]?.bricks ?? [];\n if (!insertBricks.length) {\n continue;\n }\n const refToSlot = to.refSlot ?? from;\n let expandableSlot = quasisMap.get(refToSlot);\n if (!expandableSlot) {\n expandableSlot = [];\n // The size of quasis should be the existed slotted bricks' size plus one.\n const size = hasOwnProperty(slots, refToSlot)\n ? slots[refToSlot].bricks.length + 1\n : 1;\n for (let i = 0; i < size; i += 1) {\n expandableSlot.push([]);\n }\n quasisMap.set(refToSlot, expandableSlot);\n }\n const refPosition = to.refPosition ?? -1;\n // External bricks of a template, should not access the template internal forEach `ITEM`.\n // For some existing templates who is *USING* this bug, we keep the old behavior.\n const hostHasForEach = hasOwnProperty(\n hostBrick.runtimeContext,\n \"forEachItem\"\n );\n expandableSlot[\n clamp(\n refPosition < 0 ? expandableSlot.length + refPosition : refPosition,\n 0,\n expandableSlot.length - 1\n )\n ].push(\n ...((hostContext.__temporary_tpl_tag_name ===\n \"base-layout-v3.tpl-scroll-load-list\" ||\n hostContext.__temporary_tpl_tag_name ===\n \"shrcb-homepage.tpl-custom-scroll-load-list\") &&\n !hostHasForEach\n ? insertBricks\n : setupTemplateExternalBricks(\n insertBricks,\n hostHasForEach,\n hostBrick.runtimeContext.forEachItem,\n hostBrick.runtimeContext.forEachIndex!\n ))\n );\n }\n\n for (const [slotName, quasis] of quasisMap.entries()) {\n if (!hasOwnProperty(slots, slotName)) {\n slots[slotName] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n const slotConf = slots[slotName];\n slotConf.bricks = quasis.flatMap((bricks, index) =>\n index < slotConf.bricks.length\n ? bricks.concat(slotConf.bricks[index])\n : bricks\n );\n\n if (slotConf.bricks.length === 0) {\n delete slots[slotName];\n }\n }\n }\n }\n\n return {\n [symbolForAsyncComputedPropsFromHost]: asyncComputedProps,\n [symbolForTplStateStoreId]: tplStateStoreId,\n };\n}\n\n// External bricks of a template, have the same forEachItem context as their host.\nfunction setupTemplateExternalBricks(\n bricks: BrickConf[],\n hasForEach: boolean,\n forEachItem: unknown,\n forEachIndex: number\n): BrickConf[] {\n return (bricks as RuntimeBrickConfWithTplSymbols[]).map(\n ({\n children,\n slots,\n [symbolForTPlExternalForEachItem]: a,\n [symbolForTPlExternalForEachIndex]: b,\n [symbolForTPlExternalNoForEach]: c,\n ...brick\n }) => ({\n ...brick,\n ...(hasForEach\n ? {\n [symbolForTPlExternalForEachItem]: forEachItem,\n [symbolForTPlExternalForEachIndex]: forEachIndex,\n }\n : {\n [symbolForTPlExternalNoForEach]: true,\n }),\n // Keep `:forEach` bricks as original, since they have their own forEachItem context.\n slots:\n brick.brick === \":forEach\"\n ? childrenToSlots(children, slots)\n : Object.fromEntries(\n Object.entries(childrenToSlots(children, slots) ?? {}).map(\n ([slotName, slotConf]) => [\n slotName,\n slotConf.type === \"routes\"\n ? {\n type: \"routes\",\n routes: setupTemplateExternalRoutes(\n slotConf.routes,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n : {\n type: \"bricks\",\n bricks: setupTemplateExternalBricks(\n slotConf.bricks,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n },\n ]\n )\n ),\n })\n );\n}\n\nfunction setupTemplateExternalRoutes(\n routes: RouteConf[],\n hasForEach: boolean,\n forEachItem: unknown,\n forEachIndex: number\n): RouteConf[] {\n return routes.map((route) =>\n route.type === \"routes\"\n ? {\n ...route,\n routes: setupTemplateExternalRoutes(\n route.routes,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n : route.type === \"redirect\"\n ? route\n : {\n ...route,\n bricks: setupTemplateExternalBricks(\n route.bricks,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AASA,IAAAG,sBAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAEO,SAASK,kBAAkBA,CAChCC,WAAgC,EAChCC,GAAuB,EACvBC,KAAwB,EACxB;EACA,MAAM;IACJC,eAAe;IACfC,wBAAwB;IACxBC,aAAa;IACbC,eAAe;IACfC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,KAAK,CAAC1C,MAAM,EACZ2B,UAAU,EACVZ,WAAW,EACXC,YACF;EACF,CACR,CAAC;AACH"}
@@ -106,22 +106,24 @@ function setupTemplateExternalBricks(bricks, hasForEach, forEachItem, forEachInd
106
106
  } : {
107
107
  [symbolForTPlExternalNoForEach]: true
108
108
  }), {}, {
109
- slots: Object.fromEntries(Object.entries((_childrenToSlots = childrenToSlots(children, slots)) !== null && _childrenToSlots !== void 0 ? _childrenToSlots : {}).map(_ref3 => {
110
- var _slotConf$bricks;
109
+ // Keep `:forEach` bricks as original, since they have their own forEachItem context.
110
+ slots: brick.brick === ":forEach" ? childrenToSlots(children, slots) : Object.fromEntries(Object.entries((_childrenToSlots = childrenToSlots(children, slots)) !== null && _childrenToSlots !== void 0 ? _childrenToSlots : {}).map(_ref3 => {
111
111
  var [slotName, slotConf] = _ref3;
112
112
  return [slotName, slotConf.type === "routes" ? {
113
113
  type: "routes",
114
114
  routes: setupTemplateExternalRoutes(slotConf.routes, hasForEach, forEachItem, forEachIndex)
115
115
  } : {
116
116
  type: "bricks",
117
- bricks: setupTemplateExternalBricks((_slotConf$bricks = slotConf.bricks) !== null && _slotConf$bricks !== void 0 ? _slotConf$bricks : [], hasForEach, forEachItem, forEachIndex)
117
+ bricks: setupTemplateExternalBricks(slotConf.bricks, hasForEach, forEachItem, forEachIndex)
118
118
  }];
119
119
  }))
120
120
  });
121
121
  });
122
122
  }
123
123
  function setupTemplateExternalRoutes(routes, hasForEach, forEachItem, forEachIndex) {
124
- return routes.map(route => route.type && route.type !== "bricks" ? route : _objectSpread(_objectSpread({}, route), {}, {
124
+ return routes.map(route => route.type === "routes" ? _objectSpread(_objectSpread({}, route), {}, {
125
+ routes: setupTemplateExternalRoutes(route.routes, hasForEach, forEachItem, forEachIndex)
126
+ }) : route.type === "redirect" ? route : _objectSpread(_objectSpread({}, route), {}, {
125
127
  bricks: setupTemplateExternalBricks(route.bricks, hasForEach, forEachItem, forEachIndex)
126
128
  }));
127
129
  }
@@ -1 +1 @@
1
- {"version":3,"file":"setupTemplateProxy.js","names":["hasOwnProperty","clamp","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTPlExternalNoForEach","symbolForTplStateStoreId","computePropertyValue","childrenToSlots","setupTemplateProxy","hostContext","ref","slots","reversedProxies","asyncHostPropertyEntries","externalSlots","tplStateStoreId","hostBrick","asyncComputedProps","propertyProxies","properties","get","getComputedProps","asyncHostProps","map","_ref","from","to","filtered","filter","entry","length","refProperty","Boolean","slotProxies","quasisMap","Map","_externalSlots$from$b","_externalSlots$from","_to$refSlot","_to$refPosition","insertBricks","bricks","refToSlot","refSlot","expandableSlot","size","i","push","set","refPosition","hostHasForEach","runtimeContext","__temporary_tpl_tag_name","setupTemplateExternalBricks","forEachItem","forEachIndex","_loop","slotName","type","slotConf","quasis","flatMap","index","concat","entries","hasForEach","_ref2","_childrenToSlots","children","a","b","c","brick","_objectWithoutProperties","_toPropertyKey","_objectSpread","Object","fromEntries","_ref3","_slotConf$bricks","routes","setupTemplateExternalRoutes","route"],"sources":["../../../../src/internal/CustomTemplates/setupTemplateProxy.ts"],"sourcesContent":["import type { BrickConf, RouteConf, SlotsConfOfBricks } from \"@next-core/types\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { clamp } from \"lodash\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n type RuntimeBrickConfWithTplSymbols,\n} from \"./constants.js\";\nimport type { AsyncPropertyEntry, TemplateHostContext } from \"../interfaces.js\";\nimport { computePropertyValue } from \"../compute/computeRealProperties.js\";\nimport { childrenToSlots } from \"../Renderer.js\";\n\nexport function setupTemplateProxy(\n hostContext: TemplateHostContext,\n ref: string | undefined,\n slots: SlotsConfOfBricks\n) {\n const {\n reversedProxies,\n asyncHostPropertyEntries,\n externalSlots,\n tplStateStoreId,\n hostBrick,\n } = hostContext;\n\n let asyncComputedProps: AsyncPropertyEntry[] | undefined;\n\n if (ref && reversedProxies) {\n const propertyProxies = reversedProxies.properties.get(ref);\n if (propertyProxies) {\n const getComputedProps = (\n asyncHostProps: AsyncPropertyEntry[]\n ): AsyncPropertyEntry[] => {\n return propertyProxies!\n .map(({ from, to }) => {\n const filtered = asyncHostProps.filter(\n (entry) => entry[0] === from\n );\n if (filtered.length > 0 && to.refProperty) {\n return [\n to.refProperty,\n computePropertyValue(filtered, from),\n true,\n ];\n }\n })\n .filter(Boolean) as [string, Promise<unknown>][];\n };\n\n asyncComputedProps = getComputedProps(asyncHostPropertyEntries);\n }\n\n const slotProxies = reversedProxies.slots.get(ref);\n if (slotProxies && externalSlots) {\n // Use an approach like template-literal's quasis:\n // `quasi0${0}quais1${1}quasi2...`\n // Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.\n const quasisMap = new Map<string, BrickConf[][]>();\n\n for (const { from, to } of slotProxies) {\n const insertBricks = externalSlots[from]?.bricks ?? [];\n if (!insertBricks.length) {\n continue;\n }\n const refToSlot = to.refSlot ?? from;\n let expandableSlot = quasisMap.get(refToSlot);\n if (!expandableSlot) {\n expandableSlot = [];\n // The size of quasis should be the existed slotted bricks' size plus one.\n const size = hasOwnProperty(slots, refToSlot)\n ? slots[refToSlot].bricks.length + 1\n : 1;\n for (let i = 0; i < size; i += 1) {\n expandableSlot.push([]);\n }\n quasisMap.set(refToSlot, expandableSlot);\n }\n const refPosition = to.refPosition ?? -1;\n // External bricks of a template, should not access the template internal forEach `ITEM`.\n // For some existing templates who is *USING* this bug, we keep the old behavior.\n const hostHasForEach = hasOwnProperty(\n hostBrick.runtimeContext,\n \"forEachItem\"\n );\n expandableSlot[\n clamp(\n refPosition < 0 ? expandableSlot.length + refPosition : refPosition,\n 0,\n expandableSlot.length - 1\n )\n ].push(\n ...((hostContext.__temporary_tpl_tag_name ===\n \"base-layout-v3.tpl-scroll-load-list\" ||\n hostContext.__temporary_tpl_tag_name ===\n \"shrcb-homepage.tpl-custom-scroll-load-list\") &&\n !hostHasForEach\n ? insertBricks\n : setupTemplateExternalBricks(\n insertBricks,\n hostHasForEach,\n hostBrick.runtimeContext.forEachItem,\n hostBrick.runtimeContext.forEachIndex!\n ))\n );\n }\n\n for (const [slotName, quasis] of quasisMap.entries()) {\n if (!hasOwnProperty(slots, slotName)) {\n slots[slotName] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n const slotConf = slots[slotName];\n slotConf.bricks = quasis.flatMap((bricks, index) =>\n index < slotConf.bricks.length\n ? bricks.concat(slotConf.bricks[index])\n : bricks\n );\n\n if (slotConf.bricks.length === 0) {\n delete slots[slotName];\n }\n }\n }\n }\n\n return {\n [symbolForAsyncComputedPropsFromHost]: asyncComputedProps,\n [symbolForTplStateStoreId]: tplStateStoreId,\n };\n}\n\n// External bricks of a template, have the same forEachItem context as their host.\nfunction setupTemplateExternalBricks(\n bricks: BrickConf[],\n hasForEach: boolean,\n forEachItem: unknown,\n forEachIndex: number\n): BrickConf[] {\n return (bricks as RuntimeBrickConfWithTplSymbols[]).map(\n ({\n children,\n slots,\n [symbolForTPlExternalForEachItem]: a,\n [symbolForTPlExternalForEachIndex]: b,\n [symbolForTPlExternalNoForEach]: c,\n ...brick\n }) => ({\n ...brick,\n ...(hasForEach\n ? {\n [symbolForTPlExternalForEachItem]: forEachItem,\n [symbolForTPlExternalForEachIndex]: forEachIndex,\n }\n : {\n [symbolForTPlExternalNoForEach]: true,\n }),\n slots: Object.fromEntries(\n Object.entries(childrenToSlots(children, slots) ?? {}).map(\n ([slotName, slotConf]) => [\n slotName,\n slotConf.type === \"routes\"\n ? {\n type: \"routes\",\n routes: setupTemplateExternalRoutes(\n slotConf.routes,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n : {\n type: \"bricks\",\n bricks: setupTemplateExternalBricks(\n slotConf.bricks ?? [],\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n },\n ]\n )\n ),\n })\n );\n}\n\nfunction setupTemplateExternalRoutes(\n routes: RouteConf[],\n hasForEach: boolean,\n forEachItem: unknown,\n forEachIndex: number\n): RouteConf[] {\n return routes.map((route) =>\n route.type && route.type !== \"bricks\"\n ? route\n : {\n ...route,\n bricks: setupTemplateExternalBricks(\n route.bricks,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n );\n}\n"],"mappings":";;;AACA,SAASA,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,QAAQ,QAAQ;AAC9B,SACEC,mCAAmC,EACnCC,gCAAgC,EAChCC,+BAA+B,EAC/BC,6BAA6B,EAC7BC,wBAAwB,QAEnB,gBAAgB;AAEvB,SAASC,oBAAoB,QAAQ,qCAAqC;AAC1E,SAASC,eAAe,QAAQ,gBAAgB;AAEhD,OAAO,SAASC,kBAAkBA,CAChCC,WAAgC,EAChCC,GAAuB,EACvBC,KAAwB,EACxB;EACA,IAAM;IACJC,eAAe;IACfC,wBAAwB;IACxBC,aAAa;IACbC,eAAe;IACfC;EACF,CAAC,GAAGP,WAAW;EAEf,IAAIQ,kBAAoD;EAExD,IAAIP,GAAG,IAAIE,eAAe,EAAE;IAC1B,IAAMM,eAAe,GAAGN,eAAe,CAACO,UAAU,CAACC,GAAG,CAACV,GAAG,CAAC;IAC3D,IAAIQ,eAAe,EAAE;MACnB,IAAMG,gBAAgB,GACpBC,cAAoC,IACX;QACzB,OAAOJ,eAAe,CACnBK,GAAG,CAACC,IAAA,IAAkB;UAAA,IAAjB;YAAEC,IAAI;YAAEC;UAAG,CAAC,GAAAF,IAAA;UAChB,IAAMG,QAAQ,GAAGL,cAAc,CAACM,MAAM,CACnCC,KAAK,IAAKA,KAAK,CAAC,CAAC,CAAC,KAAKJ,IAC1B,CAAC;UACD,IAAIE,QAAQ,CAACG,MAAM,GAAG,CAAC,IAAIJ,EAAE,CAACK,WAAW,EAAE;YACzC,OAAO,CACLL,EAAE,CAACK,WAAW,EACdzB,oBAAoB,CAACqB,QAAQ,EAAEF,IAA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QAAA,OAAK,CACxBrB,QAAQ,EACRE,QAAQ,CAACD,IAAI,KAAK,QAAQ,GACtB;UACEA,IAAI,EAAE,QAAQ;UACdsB,MAAM,EAAEC,2BAA2B,CACjCtB,QAAQ,CAACqB,MAAM,EACff,UAAU,EACVX,WAAW,EACXC,YACF;QACF,CAAC,GACD;UACEG,IAAI,EAAE,QAAQ;UACdjB,MAAM,EAAEY,2BAA2B,EAAA0B,gBAAA,GACjCpB,QAAQ,CAAClB,MAAM,cAAAsC,gBAAA,cAAAA,gBAAA,GAAI,EAAE,EACrBd,UAAU,EACVX,WAAW,EACXC,YACF;QACF,CAAC,CACN;MAAA,CACH,CACF;IAAC;EAAA,CAEL,CAAC;AACH;AAEA,SAAS0B,2BAA2BA,CAClCD,MAAmB,EACnBf,UAAmB,EACnBX,WAAoB,EACpBC,YAAoB,EACP;EACb,OAAOyB,MAAM,CAACzD,GAAG,CAAE2D,KAAK,IACtBA,KAAK,CAACxB,IAAI,IAAIwB,KAAK,CAACxB,IAAI,KAAK,QAAQ,GACjCwB,KAAK,GAAAP,aAAA,CAAAA,aAAA,KAEAO,KAAK;IACRzC,MAAM,EAAEY,2BAA2B,CACjC6B,KAAK,CAACzC,MAAM,EACZwB,UAAU,EACVX,WAAW,EACXC,YACF;EAAC,EAET,CAAC;AACH"}
1
+ {"version":3,"file":"setupTemplateProxy.js","names":["hasOwnProperty","clamp","symbolForAsyncComputedPropsFromHost","symbolForTPlExternalForEachIndex","symbolForTPlExternalForEachItem","symbolForTPlExternalNoForEach","symbolForTplStateStoreId","computePropertyValue","childrenToSlots","setupTemplateProxy","hostContext","ref","slots","reversedProxies","asyncHostPropertyEntries","externalSlots","tplStateStoreId","hostBrick","asyncComputedProps","propertyProxies","properties","get","getComputedProps","asyncHostProps","map","_ref","from","to","filtered","filter","entry","length","refProperty","Boolean","slotProxies","quasisMap","Map","_externalSlots$from$b","_externalSlots$from","_to$refSlot","_to$refPosition","insertBricks","bricks","refToSlot","refSlot","expandableSlot","size","i","push","set","refPosition","hostHasForEach","runtimeContext","__temporary_tpl_tag_name","setupTemplateExternalBricks","forEachItem","forEachIndex","_loop","slotName","type","slotConf","quasis","flatMap","index","concat","entries","hasForEach","_ref2","_childrenToSlots","children","a","b","c","brick","_objectWithoutProperties","_toPropertyKey","_objectSpread","Object","fromEntries","_ref3","routes","setupTemplateExternalRoutes","route"],"sources":["../../../../src/internal/CustomTemplates/setupTemplateProxy.ts"],"sourcesContent":["import type { BrickConf, RouteConf, SlotsConfOfBricks } from \"@next-core/types\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { clamp } from \"lodash\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTPlExternalNoForEach,\n symbolForTplStateStoreId,\n type RuntimeBrickConfWithTplSymbols,\n} from \"./constants.js\";\nimport type { AsyncPropertyEntry, TemplateHostContext } from \"../interfaces.js\";\nimport { computePropertyValue } from \"../compute/computeRealProperties.js\";\nimport { childrenToSlots } from \"../Renderer.js\";\n\nexport function setupTemplateProxy(\n hostContext: TemplateHostContext,\n ref: string | undefined,\n slots: SlotsConfOfBricks\n) {\n const {\n reversedProxies,\n asyncHostPropertyEntries,\n externalSlots,\n tplStateStoreId,\n hostBrick,\n } = hostContext;\n\n let asyncComputedProps: AsyncPropertyEntry[] | undefined;\n\n if (ref && reversedProxies) {\n const propertyProxies = reversedProxies.properties.get(ref);\n if (propertyProxies) {\n const getComputedProps = (\n asyncHostProps: AsyncPropertyEntry[]\n ): AsyncPropertyEntry[] => {\n return propertyProxies!\n .map(({ from, to }) => {\n const filtered = asyncHostProps.filter(\n (entry) => entry[0] === from\n );\n if (filtered.length > 0 && to.refProperty) {\n return [\n to.refProperty,\n computePropertyValue(filtered, from),\n true,\n ];\n }\n })\n .filter(Boolean) as [string, Promise<unknown>][];\n };\n\n asyncComputedProps = getComputedProps(asyncHostPropertyEntries);\n }\n\n const slotProxies = reversedProxies.slots.get(ref);\n if (slotProxies && externalSlots) {\n // Use an approach like template-literal's quasis:\n // `quasi0${0}quais1${1}quasi2...`\n // Every quasi (indexed by `refPosition`) can be slotted with multiple bricks.\n const quasisMap = new Map<string, BrickConf[][]>();\n\n for (const { from, to } of slotProxies) {\n const insertBricks = externalSlots[from]?.bricks ?? [];\n if (!insertBricks.length) {\n continue;\n }\n const refToSlot = to.refSlot ?? from;\n let expandableSlot = quasisMap.get(refToSlot);\n if (!expandableSlot) {\n expandableSlot = [];\n // The size of quasis should be the existed slotted bricks' size plus one.\n const size = hasOwnProperty(slots, refToSlot)\n ? slots[refToSlot].bricks.length + 1\n : 1;\n for (let i = 0; i < size; i += 1) {\n expandableSlot.push([]);\n }\n quasisMap.set(refToSlot, expandableSlot);\n }\n const refPosition = to.refPosition ?? -1;\n // External bricks of a template, should not access the template internal forEach `ITEM`.\n // For some existing templates who is *USING* this bug, we keep the old behavior.\n const hostHasForEach = hasOwnProperty(\n hostBrick.runtimeContext,\n \"forEachItem\"\n );\n expandableSlot[\n clamp(\n refPosition < 0 ? expandableSlot.length + refPosition : refPosition,\n 0,\n expandableSlot.length - 1\n )\n ].push(\n ...((hostContext.__temporary_tpl_tag_name ===\n \"base-layout-v3.tpl-scroll-load-list\" ||\n hostContext.__temporary_tpl_tag_name ===\n \"shrcb-homepage.tpl-custom-scroll-load-list\") &&\n !hostHasForEach\n ? insertBricks\n : setupTemplateExternalBricks(\n insertBricks,\n hostHasForEach,\n hostBrick.runtimeContext.forEachItem,\n hostBrick.runtimeContext.forEachIndex!\n ))\n );\n }\n\n for (const [slotName, quasis] of quasisMap.entries()) {\n if (!hasOwnProperty(slots, slotName)) {\n slots[slotName] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n const slotConf = slots[slotName];\n slotConf.bricks = quasis.flatMap((bricks, index) =>\n index < slotConf.bricks.length\n ? bricks.concat(slotConf.bricks[index])\n : bricks\n );\n\n if (slotConf.bricks.length === 0) {\n delete slots[slotName];\n }\n }\n }\n }\n\n return {\n [symbolForAsyncComputedPropsFromHost]: asyncComputedProps,\n [symbolForTplStateStoreId]: tplStateStoreId,\n };\n}\n\n// External bricks of a template, have the same forEachItem context as their host.\nfunction setupTemplateExternalBricks(\n bricks: BrickConf[],\n hasForEach: boolean,\n forEachItem: unknown,\n forEachIndex: number\n): BrickConf[] {\n return (bricks as RuntimeBrickConfWithTplSymbols[]).map(\n ({\n children,\n slots,\n [symbolForTPlExternalForEachItem]: a,\n [symbolForTPlExternalForEachIndex]: b,\n [symbolForTPlExternalNoForEach]: c,\n ...brick\n }) => ({\n ...brick,\n ...(hasForEach\n ? {\n [symbolForTPlExternalForEachItem]: forEachItem,\n [symbolForTPlExternalForEachIndex]: forEachIndex,\n }\n : {\n [symbolForTPlExternalNoForEach]: true,\n }),\n // Keep `:forEach` bricks as original, since they have their own forEachItem context.\n slots:\n brick.brick === \":forEach\"\n ? childrenToSlots(children, slots)\n : Object.fromEntries(\n Object.entries(childrenToSlots(children, slots) ?? {}).map(\n ([slotName, slotConf]) => [\n slotName,\n slotConf.type === \"routes\"\n ? {\n type: \"routes\",\n routes: setupTemplateExternalRoutes(\n slotConf.routes,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n : {\n type: \"bricks\",\n bricks: setupTemplateExternalBricks(\n slotConf.bricks,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n },\n ]\n )\n ),\n })\n );\n}\n\nfunction setupTemplateExternalRoutes(\n routes: RouteConf[],\n hasForEach: boolean,\n forEachItem: unknown,\n forEachIndex: number\n): RouteConf[] {\n return routes.map((route) =>\n route.type === \"routes\"\n ? {\n ...route,\n routes: setupTemplateExternalRoutes(\n route.routes,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n : route.type === \"redirect\"\n ? route\n : {\n ...route,\n bricks: setupTemplateExternalBricks(\n route.bricks,\n hasForEach,\n forEachItem,\n forEachIndex\n ),\n }\n );\n}\n"],"mappings":";;;AACA,SAASA,cAAc,QAAQ,0BAA0B;AACz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D;UACEG,IAAI,EAAE,QAAQ;UACdjB,MAAM,EAAEY,2BAA2B,CACjCM,QAAQ,CAAClB,MAAM,EACfwB,UAAU,EACVX,WAAW,EACXC,YACF;QACF,CAAC,CACN;MAAA,CACH,CACF;IAAC;EAAA,CAEX,CAAC;AACH;AAEA,SAASyB,2BAA2BA,CAClCD,MAAmB,EACnBd,UAAmB,EACnBX,WAAoB,EACpBC,YAAoB,EACP;EACb,OAAOwB,MAAM,CAACxD,GAAG,CAAE0D,KAAK,IACtBA,KAAK,CAACvB,IAAI,KAAK,QAAQ,GAAAiB,aAAA,CAAAA,aAAA,KAEdM,KAAK;IACRF,MAAM,EAAEC,2BAA2B,CACjCC,KAAK,CAACF,MAAM,EACZd,UAAU,EACVX,WAAW,EACXC,YACF;EAAC,KAEH0B,KAAK,CAACvB,IAAI,KAAK,UAAU,GACvBuB,KAAK,GAAAN,aAAA,CAAAA,aAAA,KAEAM,KAAK;IACRxC,MAAM,EAAEY,2BAA2B,CACjC4B,KAAK,CAACxC,MAAM,EACZwB,UAAU,EACVX,WAAW,EACXC,YACF;EAAC,EAEX,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-core/runtime",
3
- "version": "1.34.0",
3
+ "version": "1.34.2",
4
4
  "homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/runtime",
5
5
  "license": "GPL-3.0",
6
6
  "repository": {
@@ -66,5 +66,5 @@
66
66
  "@next-core/build-next-libs": "^1.0.13",
67
67
  "@next-core/test-next": "^1.0.16"
68
68
  },
69
- "gitHead": "dc144c4ca80fddf7077db0e4fdc51e6b9844c129"
69
+ "gitHead": "5f9936f459699885f4f7c85fea49be8540ed865c"
70
70
  }