@next-core/runtime 1.22.3 → 1.22.5
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/internal/CustomTemplates/constants.js +3 -1
- package/dist/cjs/internal/CustomTemplates/constants.js.map +1 -1
- package/dist/cjs/internal/CustomTemplates/expandCustomTemplate.js +1 -0
- package/dist/cjs/internal/CustomTemplates/expandCustomTemplate.js.map +1 -1
- package/dist/cjs/internal/CustomTemplates/setupTemplateProxy.js +7 -6
- package/dist/cjs/internal/CustomTemplates/setupTemplateProxy.js.map +1 -1
- package/dist/cjs/internal/FormRenderer/expandFormRenderer.js +1 -0
- package/dist/cjs/internal/FormRenderer/expandFormRenderer.js.map +1 -1
- package/dist/cjs/internal/Renderer.js +31 -25
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/RendererContext.js +36 -7
- package/dist/cjs/internal/RendererContext.js.map +1 -1
- package/dist/cjs/internal/compute/evaluate.js +10 -6
- package/dist/cjs/internal/compute/evaluate.js.map +1 -1
- package/dist/cjs/internal/enums.js +1 -0
- package/dist/cjs/internal/enums.js.map +1 -1
- package/dist/cjs/internal/interfaces.js.map +1 -1
- package/dist/cjs/internal/mount.js +41 -39
- package/dist/cjs/internal/mount.js.map +1 -1
- package/dist/cjs/internal/secret_internals.js +5 -2
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/constants.js +1 -0
- package/dist/esm/internal/CustomTemplates/constants.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/expandCustomTemplate.js +1 -0
- package/dist/esm/internal/CustomTemplates/expandCustomTemplate.js.map +1 -1
- package/dist/esm/internal/CustomTemplates/setupTemplateProxy.js +8 -7
- package/dist/esm/internal/CustomTemplates/setupTemplateProxy.js.map +1 -1
- package/dist/esm/internal/FormRenderer/expandFormRenderer.js +1 -0
- package/dist/esm/internal/FormRenderer/expandFormRenderer.js.map +1 -1
- package/dist/esm/internal/Renderer.js +53 -42
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/RendererContext.js +36 -7
- package/dist/esm/internal/RendererContext.js.map +1 -1
- package/dist/esm/internal/compute/evaluate.js +10 -6
- package/dist/esm/internal/compute/evaluate.js.map +1 -1
- package/dist/esm/internal/enums.js +1 -0
- package/dist/esm/internal/enums.js.map +1 -1
- package/dist/esm/internal/interfaces.js.map +1 -1
- package/dist/esm/internal/mount.js +41 -39
- package/dist/esm/internal/mount.js.map +1 -1
- package/dist/esm/internal/secret_internals.js +5 -2
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/internal/CustomTemplates/constants.d.ts +2 -0
- package/dist/types/internal/Renderer.d.ts +5 -5
- package/dist/types/internal/RendererContext.d.ts +5 -5
- package/dist/types/internal/enums.d.ts +2 -1
- package/dist/types/internal/interfaces.d.ts +12 -5
- package/package.json +2 -2
|
@@ -260,13 +260,17 @@ runtimeContext) {
|
|
|
260
260
|
});
|
|
261
261
|
break;
|
|
262
262
|
case "ITEM":
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
263
|
+
case "INDEX":
|
|
264
|
+
{
|
|
265
|
+
var property = variableName === "ITEM" ? "forEachItem" : "forEachIndex";
|
|
266
|
+
if (!hasOwnProperty(runtimeContext, property)) {
|
|
267
|
+
// eslint-disable-next-line no-console
|
|
268
|
+
console.error("Using `".concat(variableName, "` but no `:forEach` is found, check your expression: \"").concat(raw, "\""));
|
|
269
|
+
} else {
|
|
270
|
+
globalVariables[variableName] = runtimeContext[property];
|
|
271
|
+
}
|
|
272
|
+
break;
|
|
268
273
|
}
|
|
269
|
-
break;
|
|
270
274
|
case "LOCAL_STORAGE":
|
|
271
275
|
globalVariables[variableName] = getReadOnlyProxy({
|
|
272
276
|
getItem: getStorageItem("local")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.js","names":["cook","preevaluate","shouldAllowRecursiveEvaluations","loadProcessorsImperatively","supply","hasOwnProperty","strictCollectMemberUsage","collectAppGetMenuUsage","collectInstalledAppsHasUsage","cloneDeep","omit","customProcessors","checkPermissionsUsage","storyboardFunctions","getGeneralGlobals","getDynamicReadOnlyProxy","getReadOnlyProxy","devtoolsHookEmit","getDevHook","getMedia","getStorageItem","_internalApiGetStoryboardInBootstrapData","getBrickPackages","getRuntime","hooks","getTplStateStore","widgetFunctions","widgetI18nFactory","hasInstalledApp","isStrictMode","warnAboutStrictMode","getFormStateStore","resolveData","asyncComputeRealValue","symbolForRaw","Symbol","for","symbolForContext","isPreEvaluated","raw","getPreEvaluatedRaw","pre","shouldDismissMarkingComputed","possibleErrorConstructs","WeakSet","SyntaxError","TypeError","ReferenceError","getCookErrorConstructor","error","has","constructor","asyncEvaluate","_x","_x2","_x3","_asyncEvaluate","apply","arguments","_asyncToGenerator","runtimeContext","options","blockingList","run","lowLevelEvaluate","Promise","all","evaluate","length","undefined","isAsync","passByRuntimeContext","_objectSpread","menuUsage","usedArgs","Set","hasAppUsage","precooked","withParent","beforeVisitGlobal","node","parent","message","concat","errorConstructor","hasNonStaticUsage","Error","globalVariables","attemptToVisitGlobals","lazy","Object","keys","usedCtx","usedProcessors","usedStates","tplStateStore","strict","usedFormStates","formStateStore","devHook","push","ctxStore","waitFor","usedTpls","tpl","add","attemptToCheckPermissions","usedFunctions","pendingPermissionsPreCheck","size","menu","usedMenuIds","map","menuId","fetchMenuById","getStoryboardByAppId","_hooks$checkInstalled","checkInstalledApps","waitForCheckingApps","_runtimeContext$overr","_hooks$menu","_match$params","_hooks$images","app","currentApp","location","query","match","flags","sys","data","event","overrideApp","variableName","hash","substring","getMenu","getMenuById","get","target","key","getValue","ownKeys","Array","from","console","forEachItem","getItem","getMiscSettings","URLSearchParams","params","pathname","pkg","t","k","processor","namespace","split","fromEntries","getAll","images","widgetImagesFactory","assign","appendI18nNamespace","result","expression","source","detail","context"],"sources":["../../../../src/internal/compute/evaluate.ts"],"sourcesContent":["import {\n cook,\n preevaluate,\n PreevaluateResult,\n shouldAllowRecursiveEvaluations,\n} from \"@next-core/cook\";\nimport { loadProcessorsImperatively } from \"@next-core/loader\";\nimport { supply } from \"@next-core/supply\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport {\n strictCollectMemberUsage,\n collectAppGetMenuUsage,\n collectInstalledAppsHasUsage,\n MemberCallUsage,\n} from \"@next-core/utils/storyboard\";\nimport { cloneDeep, omit } from \"lodash\";\nimport type { RuntimeContext } from \"../interfaces.js\";\nimport { customProcessors } from \"../../CustomProcessors.js\";\nimport {\n checkPermissionsUsage,\n storyboardFunctions,\n} from \"./StoryboardFunctions.js\";\nimport { getGeneralGlobals } from \"./getGeneralGlobals.js\";\nimport {\n getDynamicReadOnlyProxy,\n getReadOnlyProxy,\n} from \"../proxyFactories.js\";\nimport { devtoolsHookEmit, getDevHook } from \"../devtools.js\";\nimport { getMedia } from \"../mediaQuery.js\";\nimport { getStorageItem } from \"./getStorageItem.js\";\nimport {\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n getRuntime,\n hooks,\n} from \"../Runtime.js\";\nimport type { DataStore } from \"../data/DataStore.js\";\nimport { getTplStateStore } from \"../CustomTemplates/utils.js\";\nimport { widgetFunctions } from \"./WidgetFunctions.js\";\nimport { widgetI18nFactory } from \"./WidgetI18n.js\";\nimport { hasInstalledApp } from \"../hasInstalledApp.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../../isStrictMode.js\";\nimport { getFormStateStore } from \"../FormRenderer/utils.js\";\nimport { resolveData } from \"../data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./computeRealValue.js\";\n\nconst symbolForRaw = Symbol.for(\"pre.evaluated.raw\");\nconst symbolForContext = Symbol.for(\"pre.evaluated.context\");\n\nexport interface PreEvaluated {\n [symbolForRaw]: string;\n [symbolForContext]: RuntimeContext;\n}\n\nexport interface EvaluateOptions {\n lazy?: boolean;\n evaluationId?: number;\n}\n\nexport function isPreEvaluated(raw: unknown): raw is PreEvaluated {\n return !!(raw as PreEvaluated)?.[symbolForRaw];\n}\n\nexport function getPreEvaluatedRaw(pre: PreEvaluated): string {\n return pre[symbolForRaw];\n}\n\nexport function shouldDismissMarkingComputed(\n raw: string | PreEvaluated\n): boolean {\n if (typeof raw === \"string\") {\n return shouldAllowRecursiveEvaluations(raw);\n }\n return shouldAllowRecursiveEvaluations(raw[symbolForRaw]);\n}\n\nconst possibleErrorConstructs = new WeakSet<ErrorConstructor>([\n SyntaxError,\n TypeError,\n ReferenceError,\n]);\n\nexport function getCookErrorConstructor(error: any): ErrorConstructor {\n return possibleErrorConstructs.has(error.constructor)\n ? error.constructor\n : TypeError;\n}\n\nexport async function asyncEvaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options?: EvaluateOptions\n): Promise<unknown> {\n const { blockingList, run } = lowLevelEvaluate(\n raw,\n runtimeContext,\n options,\n true\n );\n await Promise.all(blockingList);\n return run();\n}\n\nexport function evaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options?: EvaluateOptions\n): Promise<unknown> {\n const { run } = lowLevelEvaluate(raw, runtimeContext, options, false);\n return run();\n}\n\nfunction lowLevelEvaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options: EvaluateOptions = {},\n isAsync?: boolean\n): {\n blockingList: (Promise<unknown> | undefined)[];\n run: Function;\n} {\n const blockingList: (Promise<unknown> | undefined)[] = [];\n if (typeof raw !== \"string\") {\n // If the `raw` is not a string, it must be a pre-evaluated object.\n // Then fulfil the context, and restore the original `raw`.\n\n const passByRuntimeContext = omit(runtimeContext, [\n \"pendingPermissionsPreCheck\",\n \"tplStateStoreMap\",\n \"tplStateStoreScope\",\n \"formStateStoreMap\",\n \"formStateStoreScope\",\n ]);\n\n runtimeContext = {\n ...raw[symbolForContext],\n ...passByRuntimeContext,\n };\n raw = raw[symbolForRaw];\n }\n\n // Collect `APP.getMenu(...)` usage before evaluating.\n const menuUsage: MemberCallUsage = {\n usedArgs: new Set(),\n };\n const hasAppUsage: MemberCallUsage = {\n usedArgs: new Set(),\n };\n\n // A `SyntaxError` maybe thrown.\n let precooked: PreevaluateResult;\n try {\n precooked = preevaluate(raw, {\n withParent: true,\n hooks: {\n beforeVisitGlobal(node, parent) {\n collectAppGetMenuUsage(menuUsage, node, parent!);\n collectInstalledAppsHasUsage(hasAppUsage, node, parent!);\n },\n },\n });\n } catch (error: any) {\n const message = `${error.message}, in \"${raw}\"`;\n const errorConstructor = getCookErrorConstructor(error);\n throw new errorConstructor(message);\n }\n\n if (menuUsage.hasNonStaticUsage) {\n throw new Error(\n `Non-static usage of \"APP.getMenu\" is prohibited in v3, check your expression: \"${raw}\"`\n );\n }\n\n if (hasAppUsage.hasNonStaticUsage) {\n throw new Error(\n `Non-static usage of \"INSTALLED_APPS.has\" is prohibited in v3, check your expression: \"${raw}\"`\n );\n }\n\n const globalVariables: Record<string, unknown> = {};\n const { attemptToVisitGlobals } = precooked;\n\n // Ignore evaluating if required `event/DATA` is missing in\n // context. Since they are are provided in different context, whenever\n // missing one of them, memorize the current context for later consuming.\n if (\n options.lazy ||\n (attemptToVisitGlobals.has(\"EVENT\") &&\n !hasOwnProperty(runtimeContext, \"event\")) ||\n (attemptToVisitGlobals.has(\"DATA\") &&\n !hasOwnProperty(runtimeContext, \"data\"))\n ) {\n return {\n blockingList,\n run() {\n return Object.keys(runtimeContext).length > 0\n ? ({\n [symbolForRaw]: raw,\n [symbolForContext]: runtimeContext,\n } as PreEvaluated)\n : raw;\n },\n };\n }\n\n let usedCtx: Set<string>;\n let usedProcessors: Set<string>;\n let usedStates: Set<string>;\n let tplStateStore: DataStore<\"STATE\"> | undefined;\n const strict = isStrictMode(runtimeContext);\n\n // For existed TPL usage, treat it as a STATE.\n if (\n attemptToVisitGlobals.has(\"STATE\") ||\n (!strict && attemptToVisitGlobals.has(\"TPL\"))\n ) {\n tplStateStore = getTplStateStore(runtimeContext, \"STATE\", `: \"${raw}\"`);\n }\n\n let usedFormStates: Set<string>;\n let formStateStore: DataStore<\"FORM_STATE\"> | undefined;\n if (attemptToVisitGlobals.has(\"FORM_STATE\")) {\n formStateStore = getFormStateStore(\n runtimeContext,\n \"FORM_STATE\",\n `: \"${raw}\"`\n );\n }\n\n const devHook = getDevHook();\n if (isAsync || devHook) {\n if (attemptToVisitGlobals.has(\"CTX\")) {\n usedCtx = strictCollectMemberUsage(raw, \"CTX\");\n isAsync && blockingList.push(runtimeContext.ctxStore.waitFor(usedCtx));\n }\n\n if (tplStateStore) {\n usedStates = strictCollectMemberUsage(raw, \"STATE\");\n // istanbul ignore if\n if (!strict) {\n const usedTpls = strictCollectMemberUsage(raw, \"TPL\");\n for (const tpl of usedTpls) {\n usedStates.add(tpl);\n }\n }\n isAsync && blockingList.push(tplStateStore.waitFor(usedStates));\n }\n\n if (formStateStore) {\n usedFormStates = strictCollectMemberUsage(raw, \"FORM_STATE\");\n isAsync && blockingList.push(formStateStore.waitFor(usedFormStates));\n }\n\n if (attemptToVisitGlobals.has(\"PROCESSORS\")) {\n usedProcessors = strictCollectMemberUsage(raw, \"PROCESSORS\", 2);\n isAsync &&\n blockingList.push(\n loadProcessorsImperatively(usedProcessors, getBrickPackages())\n );\n }\n }\n\n if (isAsync) {\n let attemptToCheckPermissions = attemptToVisitGlobals.has(\"PERMISSIONS\");\n // There maybe `PERMISSIONS.check()` usage in functions\n if (!attemptToCheckPermissions && attemptToVisitGlobals.has(\"FN\")) {\n const usedFunctions = [...strictCollectMemberUsage(raw, \"FN\")];\n attemptToCheckPermissions = checkPermissionsUsage(usedFunctions);\n }\n\n if (attemptToCheckPermissions) {\n blockingList.push(...runtimeContext.pendingPermissionsPreCheck);\n }\n\n if (menuUsage.usedArgs.size > 0 && hooks?.menu) {\n // Block evaluating if has `APP.getMenu(...)` usage.\n const usedMenuIds = [...menuUsage.usedArgs];\n blockingList.push(\n Promise.all(\n usedMenuIds.map((menuId) =>\n hooks!.menu!.fetchMenuById(menuId, runtimeContext, {\n getStoryboardByAppId: _internalApiGetStoryboardInBootstrapData,\n resolveData,\n asyncComputeRealValue,\n })\n )\n )\n );\n }\n\n if (hasAppUsage.usedArgs.size > 0) {\n // Only wait for specific apps\n blockingList.push(\n hooks?.checkInstalledApps?.waitForCheckingApps([\n ...hasAppUsage.usedArgs,\n ])\n );\n }\n }\n\n return {\n blockingList,\n run() {\n const {\n app: currentApp,\n location,\n query,\n match,\n flags,\n sys,\n ctxStore,\n data,\n event,\n } = runtimeContext;\n const app = runtimeContext.overrideApp ?? currentApp;\n\n for (const variableName of attemptToVisitGlobals) {\n switch (variableName) {\n // case \"ALIAS\":\n case \"ANCHOR\":\n globalVariables[variableName] = location.hash\n ? location.hash.substring(1)\n : null;\n break;\n case \"APP\":\n globalVariables[variableName] = {\n ...cloneDeep(app),\n getMenu: hooks?.menu?.getMenuById,\n };\n break;\n case \"CTX\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(target, key) {\n return ctxStore.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedCtx);\n },\n });\n break;\n case \"DATA\":\n globalVariables[variableName] = data;\n break;\n case \"EVENT\":\n globalVariables[variableName] = event;\n break;\n case \"FLAGS\":\n globalVariables[variableName] = getReadOnlyProxy(flags);\n break;\n case \"FORM_STATE\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(target, key) {\n return formStateStore!.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedFormStates);\n },\n });\n break;\n case \"HASH\":\n globalVariables[variableName] = location.hash;\n break;\n case \"INSTALLED_APPS\":\n globalVariables[variableName] = getReadOnlyProxy({\n has: hasInstalledApp,\n });\n break;\n case \"ITEM\":\n if (!hasOwnProperty(runtimeContext, \"forEachItem\")) {\n // eslint-disable-next-line no-console\n console.error(\n `Using \\`ITEM\\` but no \\`:forEach\\` is found, check your expression: \"${raw}\"`\n );\n } else {\n globalVariables[variableName] = runtimeContext.forEachItem;\n }\n break;\n case \"LOCAL_STORAGE\":\n globalVariables[variableName] = getReadOnlyProxy({\n getItem: getStorageItem(\"local\"),\n });\n break;\n case \"MEDIA\":\n globalVariables[variableName] = getReadOnlyProxy(getMedia());\n break;\n case \"MISC\":\n globalVariables[variableName] = getRuntime().getMiscSettings();\n break;\n case \"PARAMS\":\n globalVariables[variableName] = new URLSearchParams(query);\n break;\n case \"PATH\":\n globalVariables[variableName] = getReadOnlyProxy(\n match?.params ?? {}\n );\n break;\n case \"PATH_NAME\":\n globalVariables[variableName] = location.pathname;\n break;\n case \"PROCESSORS\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(target, key) {\n const pkg = customProcessors.get(key as string);\n if (!pkg) {\n throw new Error(\n `'PROCESSORS.${\n key as string\n }' is not registered! Have you installed the relevant brick package?`\n );\n }\n return getDynamicReadOnlyProxy({\n get(t, k) {\n return pkg.get(k as string);\n },\n ownKeys() {\n return Array.from(pkg.keys());\n },\n });\n },\n ownKeys() {\n const keys = new Set<string>();\n for (const processor of usedProcessors) {\n const namespace = processor.split(\".\")[0];\n keys.add(namespace);\n }\n return Array.from(keys);\n },\n });\n break;\n case \"QUERY\":\n globalVariables[variableName] = Object.fromEntries(\n Array.from(query.keys()).map((key) => [key, query.get(key)])\n );\n break;\n case \"QUERY_ARRAY\":\n globalVariables[variableName] = Object.fromEntries(\n Array.from(query.keys()).map((key) => [key, query.getAll(key)])\n );\n // case \"SEGUE\":\n break;\n case \"SESSION_STORAGE\":\n globalVariables[variableName] = getReadOnlyProxy({\n getItem: getStorageItem(\"session\"),\n });\n break;\n // istanbul ignore next\n case \"TPL\":\n warnAboutStrictMode(\n strict,\n 'Using \"TPL\" in expression',\n `check your expression: \"${raw}\"`\n );\n if (strict) {\n break;\n }\n // eslint-disable-next-line no-fallthrough\n case \"STATE\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(target, key) {\n return tplStateStore!.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedStates);\n },\n });\n break;\n case \"SYS\":\n globalVariables[variableName] = getReadOnlyProxy(sys ?? {});\n break;\n case \"__WIDGET_FN__\":\n globalVariables[variableName] = widgetFunctions;\n break;\n case \"__WIDGET_IMG__\":\n globalVariables[variableName] = hooks?.images?.widgetImagesFactory;\n break;\n case \"__WIDGET_I18N__\":\n globalVariables[variableName] = widgetI18nFactory;\n break;\n }\n }\n\n Object.assign(\n globalVariables,\n getGeneralGlobals(precooked.attemptToVisitGlobals, {\n storyboardFunctions,\n app: runtimeContext.app,\n appendI18nNamespace: runtimeContext.appendI18nNamespace,\n })\n );\n\n try {\n const result = cook(precooked.expression, precooked.source, {\n globalVariables: supply(\n precooked.attemptToVisitGlobals,\n globalVariables\n ),\n });\n const detail = { raw, context: globalVariables, result };\n devtoolsHookEmit(\"evaluation\", detail);\n return result;\n } catch (error: any) {\n const message = `${error.message}, in \"${raw}\"`;\n const errorConstructor = getCookErrorConstructor(error);\n throw new errorConstructor(message);\n }\n },\n };\n}\n"],"mappings":";;AAAA,SACEA,IAAI,EACJC,WAAW,EAEXC,+BAA+B,QAC1B,iBAAiB;AACxB,SAASC,0BAA0B,QAAQ,mBAAmB;AAC9D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SACEC,wBAAwB,EACxBC,sBAAsB,EACtBC,4BAA4B,QAEvB,6BAA6B;AACpC,SAASC,SAAS,EAAEC,IAAI,QAAQ,QAAQ;AAExC,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SACEC,qBAAqB,EACrBC,mBAAmB,QACd,0BAA0B;AACjC,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SACEC,uBAAuB,EACvBC,gBAAgB,QACX,sBAAsB;AAC7B,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,gBAAgB;AAC7D,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SACEC,wCAAwC,EACxCC,gBAAgB,EAChBC,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MAAM,CACX3E,eAAe,EACfzE,iBAAiB,CAAC+D,SAAS,CAACW,qBAAqB,EAAE;QACjD3E,mBAAmB;QACnB8G,GAAG,EAAE/D,cAAc,CAAC+D,GAAG;QACvBwC,mBAAmB,EAAEvG,cAAc,CAACuG;MACtC,CAAC,CACH,CAAC;MAED,IAAI;QACF,IAAMC,MAAM,GAAGpK,IAAI,CAAC6E,SAAS,CAACwF,UAAU,EAAExF,SAAS,CAACyF,MAAM,EAAE;UAC1D/E,eAAe,EAAEnF,MAAM,CACrByE,SAAS,CAACW,qBAAqB,EAC/BD,eACF;QACF,CAAC,CAAC;QACF,IAAMgF,MAAM,GAAG;UAAEhI,GAAG;UAAEiI,OAAO,EAAEjF,eAAe;UAAE6E;QAAO,CAAC;QACxDnJ,gBAAgB,CAAC,YAAY,EAAEsJ,MAAM,CAAC;QACtC,OAAOH,MAAM;MACf,CAAC,CAAC,OAAOnH,KAAU,EAAE;QACnB,IAAMiC,QAAO,MAAAC,MAAA,CAAMlC,KAAK,CAACiC,OAAO,aAAAC,MAAA,CAAS5C,GAAG,OAAG;QAC/C,IAAM6C,iBAAgB,GAAGpC,uBAAuB,CAACC,KAAK,CAAC;QACvD,MAAM,IAAImC,iBAAgB,CAACF,QAAO,CAAC;MACrC;IACF;EACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"evaluate.js","names":["cook","preevaluate","shouldAllowRecursiveEvaluations","loadProcessorsImperatively","supply","hasOwnProperty","strictCollectMemberUsage","collectAppGetMenuUsage","collectInstalledAppsHasUsage","cloneDeep","omit","customProcessors","checkPermissionsUsage","storyboardFunctions","getGeneralGlobals","getDynamicReadOnlyProxy","getReadOnlyProxy","devtoolsHookEmit","getDevHook","getMedia","getStorageItem","_internalApiGetStoryboardInBootstrapData","getBrickPackages","getRuntime","hooks","getTplStateStore","widgetFunctions","widgetI18nFactory","hasInstalledApp","isStrictMode","warnAboutStrictMode","getFormStateStore","resolveData","asyncComputeRealValue","symbolForRaw","Symbol","for","symbolForContext","isPreEvaluated","raw","getPreEvaluatedRaw","pre","shouldDismissMarkingComputed","possibleErrorConstructs","WeakSet","SyntaxError","TypeError","ReferenceError","getCookErrorConstructor","error","has","constructor","asyncEvaluate","_x","_x2","_x3","_asyncEvaluate","apply","arguments","_asyncToGenerator","runtimeContext","options","blockingList","run","lowLevelEvaluate","Promise","all","evaluate","length","undefined","isAsync","passByRuntimeContext","_objectSpread","menuUsage","usedArgs","Set","hasAppUsage","precooked","withParent","beforeVisitGlobal","node","parent","message","concat","errorConstructor","hasNonStaticUsage","Error","globalVariables","attemptToVisitGlobals","lazy","Object","keys","usedCtx","usedProcessors","usedStates","tplStateStore","strict","usedFormStates","formStateStore","devHook","push","ctxStore","waitFor","usedTpls","tpl","add","attemptToCheckPermissions","usedFunctions","pendingPermissionsPreCheck","size","menu","usedMenuIds","map","menuId","fetchMenuById","getStoryboardByAppId","_hooks$checkInstalled","checkInstalledApps","waitForCheckingApps","_runtimeContext$overr","_hooks$menu","_match$params","_hooks$images","app","currentApp","location","query","match","flags","sys","data","event","overrideApp","variableName","hash","substring","getMenu","getMenuById","get","target","key","getValue","ownKeys","Array","from","property","console","getItem","getMiscSettings","URLSearchParams","params","pathname","pkg","t","k","processor","namespace","split","fromEntries","getAll","images","widgetImagesFactory","assign","appendI18nNamespace","result","expression","source","detail","context"],"sources":["../../../../src/internal/compute/evaluate.ts"],"sourcesContent":["import {\n cook,\n preevaluate,\n PreevaluateResult,\n shouldAllowRecursiveEvaluations,\n} from \"@next-core/cook\";\nimport { loadProcessorsImperatively } from \"@next-core/loader\";\nimport { supply } from \"@next-core/supply\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport {\n strictCollectMemberUsage,\n collectAppGetMenuUsage,\n collectInstalledAppsHasUsage,\n MemberCallUsage,\n} from \"@next-core/utils/storyboard\";\nimport { cloneDeep, omit } from \"lodash\";\nimport type { RuntimeContext } from \"../interfaces.js\";\nimport { customProcessors } from \"../../CustomProcessors.js\";\nimport {\n checkPermissionsUsage,\n storyboardFunctions,\n} from \"./StoryboardFunctions.js\";\nimport { getGeneralGlobals } from \"./getGeneralGlobals.js\";\nimport {\n getDynamicReadOnlyProxy,\n getReadOnlyProxy,\n} from \"../proxyFactories.js\";\nimport { devtoolsHookEmit, getDevHook } from \"../devtools.js\";\nimport { getMedia } from \"../mediaQuery.js\";\nimport { getStorageItem } from \"./getStorageItem.js\";\nimport {\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n getRuntime,\n hooks,\n} from \"../Runtime.js\";\nimport type { DataStore } from \"../data/DataStore.js\";\nimport { getTplStateStore } from \"../CustomTemplates/utils.js\";\nimport { widgetFunctions } from \"./WidgetFunctions.js\";\nimport { widgetI18nFactory } from \"./WidgetI18n.js\";\nimport { hasInstalledApp } from \"../hasInstalledApp.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../../isStrictMode.js\";\nimport { getFormStateStore } from \"../FormRenderer/utils.js\";\nimport { resolveData } from \"../data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./computeRealValue.js\";\n\nconst symbolForRaw = Symbol.for(\"pre.evaluated.raw\");\nconst symbolForContext = Symbol.for(\"pre.evaluated.context\");\n\nexport interface PreEvaluated {\n [symbolForRaw]: string;\n [symbolForContext]: RuntimeContext;\n}\n\nexport interface EvaluateOptions {\n lazy?: boolean;\n evaluationId?: number;\n}\n\nexport function isPreEvaluated(raw: unknown): raw is PreEvaluated {\n return !!(raw as PreEvaluated)?.[symbolForRaw];\n}\n\nexport function getPreEvaluatedRaw(pre: PreEvaluated): string {\n return pre[symbolForRaw];\n}\n\nexport function shouldDismissMarkingComputed(\n raw: string | PreEvaluated\n): boolean {\n if (typeof raw === \"string\") {\n return shouldAllowRecursiveEvaluations(raw);\n }\n return shouldAllowRecursiveEvaluations(raw[symbolForRaw]);\n}\n\nconst possibleErrorConstructs = new WeakSet<ErrorConstructor>([\n SyntaxError,\n TypeError,\n ReferenceError,\n]);\n\nexport function getCookErrorConstructor(error: any): ErrorConstructor {\n return possibleErrorConstructs.has(error.constructor)\n ? error.constructor\n : TypeError;\n}\n\nexport async function asyncEvaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options?: EvaluateOptions\n): Promise<unknown> {\n const { blockingList, run } = lowLevelEvaluate(\n raw,\n runtimeContext,\n options,\n true\n );\n await Promise.all(blockingList);\n return run();\n}\n\nexport function evaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options?: EvaluateOptions\n): Promise<unknown> {\n const { run } = lowLevelEvaluate(raw, runtimeContext, options, false);\n return run();\n}\n\nfunction lowLevelEvaluate(\n raw: string | PreEvaluated, // string or pre-evaluated object.\n runtimeContext: RuntimeContext,\n options: EvaluateOptions = {},\n isAsync?: boolean\n): {\n blockingList: (Promise<unknown> | undefined)[];\n run: Function;\n} {\n const blockingList: (Promise<unknown> | undefined)[] = [];\n if (typeof raw !== \"string\") {\n // If the `raw` is not a string, it must be a pre-evaluated object.\n // Then fulfil the context, and restore the original `raw`.\n\n const passByRuntimeContext = omit(runtimeContext, [\n \"pendingPermissionsPreCheck\",\n \"tplStateStoreMap\",\n \"tplStateStoreScope\",\n \"formStateStoreMap\",\n \"formStateStoreScope\",\n ]);\n\n runtimeContext = {\n ...raw[symbolForContext],\n ...passByRuntimeContext,\n };\n raw = raw[symbolForRaw];\n }\n\n // Collect `APP.getMenu(...)` usage before evaluating.\n const menuUsage: MemberCallUsage = {\n usedArgs: new Set(),\n };\n const hasAppUsage: MemberCallUsage = {\n usedArgs: new Set(),\n };\n\n // A `SyntaxError` maybe thrown.\n let precooked: PreevaluateResult;\n try {\n precooked = preevaluate(raw, {\n withParent: true,\n hooks: {\n beforeVisitGlobal(node, parent) {\n collectAppGetMenuUsage(menuUsage, node, parent!);\n collectInstalledAppsHasUsage(hasAppUsage, node, parent!);\n },\n },\n });\n } catch (error: any) {\n const message = `${error.message}, in \"${raw}\"`;\n const errorConstructor = getCookErrorConstructor(error);\n throw new errorConstructor(message);\n }\n\n if (menuUsage.hasNonStaticUsage) {\n throw new Error(\n `Non-static usage of \"APP.getMenu\" is prohibited in v3, check your expression: \"${raw}\"`\n );\n }\n\n if (hasAppUsage.hasNonStaticUsage) {\n throw new Error(\n `Non-static usage of \"INSTALLED_APPS.has\" is prohibited in v3, check your expression: \"${raw}\"`\n );\n }\n\n const globalVariables: Record<string, unknown> = {};\n const { attemptToVisitGlobals } = precooked;\n\n // Ignore evaluating if required `event/DATA` is missing in\n // context. Since they are are provided in different context, whenever\n // missing one of them, memorize the current context for later consuming.\n if (\n options.lazy ||\n (attemptToVisitGlobals.has(\"EVENT\") &&\n !hasOwnProperty(runtimeContext, \"event\")) ||\n (attemptToVisitGlobals.has(\"DATA\") &&\n !hasOwnProperty(runtimeContext, \"data\"))\n ) {\n return {\n blockingList,\n run() {\n return Object.keys(runtimeContext).length > 0\n ? ({\n [symbolForRaw]: raw,\n [symbolForContext]: runtimeContext,\n } as PreEvaluated)\n : raw;\n },\n };\n }\n\n let usedCtx: Set<string>;\n let usedProcessors: Set<string>;\n let usedStates: Set<string>;\n let tplStateStore: DataStore<\"STATE\"> | undefined;\n const strict = isStrictMode(runtimeContext);\n\n // For existed TPL usage, treat it as a STATE.\n if (\n attemptToVisitGlobals.has(\"STATE\") ||\n (!strict && attemptToVisitGlobals.has(\"TPL\"))\n ) {\n tplStateStore = getTplStateStore(runtimeContext, \"STATE\", `: \"${raw}\"`);\n }\n\n let usedFormStates: Set<string>;\n let formStateStore: DataStore<\"FORM_STATE\"> | undefined;\n if (attemptToVisitGlobals.has(\"FORM_STATE\")) {\n formStateStore = getFormStateStore(\n runtimeContext,\n \"FORM_STATE\",\n `: \"${raw}\"`\n );\n }\n\n const devHook = getDevHook();\n if (isAsync || devHook) {\n if (attemptToVisitGlobals.has(\"CTX\")) {\n usedCtx = strictCollectMemberUsage(raw, \"CTX\");\n isAsync && blockingList.push(runtimeContext.ctxStore.waitFor(usedCtx));\n }\n\n if (tplStateStore) {\n usedStates = strictCollectMemberUsage(raw, \"STATE\");\n // istanbul ignore if\n if (!strict) {\n const usedTpls = strictCollectMemberUsage(raw, \"TPL\");\n for (const tpl of usedTpls) {\n usedStates.add(tpl);\n }\n }\n isAsync && blockingList.push(tplStateStore.waitFor(usedStates));\n }\n\n if (formStateStore) {\n usedFormStates = strictCollectMemberUsage(raw, \"FORM_STATE\");\n isAsync && blockingList.push(formStateStore.waitFor(usedFormStates));\n }\n\n if (attemptToVisitGlobals.has(\"PROCESSORS\")) {\n usedProcessors = strictCollectMemberUsage(raw, \"PROCESSORS\", 2);\n isAsync &&\n blockingList.push(\n loadProcessorsImperatively(usedProcessors, getBrickPackages())\n );\n }\n }\n\n if (isAsync) {\n let attemptToCheckPermissions = attemptToVisitGlobals.has(\"PERMISSIONS\");\n // There maybe `PERMISSIONS.check()` usage in functions\n if (!attemptToCheckPermissions && attemptToVisitGlobals.has(\"FN\")) {\n const usedFunctions = [...strictCollectMemberUsage(raw, \"FN\")];\n attemptToCheckPermissions = checkPermissionsUsage(usedFunctions);\n }\n\n if (attemptToCheckPermissions) {\n blockingList.push(...runtimeContext.pendingPermissionsPreCheck);\n }\n\n if (menuUsage.usedArgs.size > 0 && hooks?.menu) {\n // Block evaluating if has `APP.getMenu(...)` usage.\n const usedMenuIds = [...menuUsage.usedArgs];\n blockingList.push(\n Promise.all(\n usedMenuIds.map((menuId) =>\n hooks!.menu!.fetchMenuById(menuId, runtimeContext, {\n getStoryboardByAppId: _internalApiGetStoryboardInBootstrapData,\n resolveData,\n asyncComputeRealValue,\n })\n )\n )\n );\n }\n\n if (hasAppUsage.usedArgs.size > 0) {\n // Only wait for specific apps\n blockingList.push(\n hooks?.checkInstalledApps?.waitForCheckingApps([\n ...hasAppUsage.usedArgs,\n ])\n );\n }\n }\n\n return {\n blockingList,\n run() {\n const {\n app: currentApp,\n location,\n query,\n match,\n flags,\n sys,\n ctxStore,\n data,\n event,\n } = runtimeContext;\n const app = runtimeContext.overrideApp ?? currentApp;\n\n for (const variableName of attemptToVisitGlobals) {\n switch (variableName) {\n // case \"ALIAS\":\n case \"ANCHOR\":\n globalVariables[variableName] = location.hash\n ? location.hash.substring(1)\n : null;\n break;\n case \"APP\":\n globalVariables[variableName] = {\n ...cloneDeep(app),\n getMenu: hooks?.menu?.getMenuById,\n };\n break;\n case \"CTX\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(target, key) {\n return ctxStore.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedCtx);\n },\n });\n break;\n case \"DATA\":\n globalVariables[variableName] = data;\n break;\n case \"EVENT\":\n globalVariables[variableName] = event;\n break;\n case \"FLAGS\":\n globalVariables[variableName] = getReadOnlyProxy(flags);\n break;\n case \"FORM_STATE\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(target, key) {\n return formStateStore!.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedFormStates);\n },\n });\n break;\n case \"HASH\":\n globalVariables[variableName] = location.hash;\n break;\n case \"INSTALLED_APPS\":\n globalVariables[variableName] = getReadOnlyProxy({\n has: hasInstalledApp,\n });\n break;\n case \"ITEM\":\n case \"INDEX\": {\n const property =\n variableName === \"ITEM\" ? \"forEachItem\" : \"forEachIndex\";\n if (!hasOwnProperty(runtimeContext, property)) {\n // eslint-disable-next-line no-console\n console.error(\n `Using \\`${variableName}\\` but no \\`:forEach\\` is found, check your expression: \"${raw}\"`\n );\n } else {\n globalVariables[variableName] = runtimeContext[property];\n }\n break;\n }\n case \"LOCAL_STORAGE\":\n globalVariables[variableName] = getReadOnlyProxy({\n getItem: getStorageItem(\"local\"),\n });\n break;\n case \"MEDIA\":\n globalVariables[variableName] = getReadOnlyProxy(getMedia());\n break;\n case \"MISC\":\n globalVariables[variableName] = getRuntime().getMiscSettings();\n break;\n case \"PARAMS\":\n globalVariables[variableName] = new URLSearchParams(query);\n break;\n case \"PATH\":\n globalVariables[variableName] = getReadOnlyProxy(\n match?.params ?? {}\n );\n break;\n case \"PATH_NAME\":\n globalVariables[variableName] = location.pathname;\n break;\n case \"PROCESSORS\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(target, key) {\n const pkg = customProcessors.get(key as string);\n if (!pkg) {\n throw new Error(\n `'PROCESSORS.${\n key as string\n }' is not registered! Have you installed the relevant brick package?`\n );\n }\n return getDynamicReadOnlyProxy({\n get(t, k) {\n return pkg.get(k as string);\n },\n ownKeys() {\n return Array.from(pkg.keys());\n },\n });\n },\n ownKeys() {\n const keys = new Set<string>();\n for (const processor of usedProcessors) {\n const namespace = processor.split(\".\")[0];\n keys.add(namespace);\n }\n return Array.from(keys);\n },\n });\n break;\n case \"QUERY\":\n globalVariables[variableName] = Object.fromEntries(\n Array.from(query.keys()).map((key) => [key, query.get(key)])\n );\n break;\n case \"QUERY_ARRAY\":\n globalVariables[variableName] = Object.fromEntries(\n Array.from(query.keys()).map((key) => [key, query.getAll(key)])\n );\n // case \"SEGUE\":\n break;\n case \"SESSION_STORAGE\":\n globalVariables[variableName] = getReadOnlyProxy({\n getItem: getStorageItem(\"session\"),\n });\n break;\n // istanbul ignore next\n case \"TPL\":\n warnAboutStrictMode(\n strict,\n 'Using \"TPL\" in expression',\n `check your expression: \"${raw}\"`\n );\n if (strict) {\n break;\n }\n // eslint-disable-next-line no-fallthrough\n case \"STATE\":\n globalVariables[variableName] = getDynamicReadOnlyProxy({\n get(target, key) {\n return tplStateStore!.getValue(key as string);\n },\n ownKeys() {\n return Array.from(usedStates);\n },\n });\n break;\n case \"SYS\":\n globalVariables[variableName] = getReadOnlyProxy(sys ?? {});\n break;\n case \"__WIDGET_FN__\":\n globalVariables[variableName] = widgetFunctions;\n break;\n case \"__WIDGET_IMG__\":\n globalVariables[variableName] = hooks?.images?.widgetImagesFactory;\n break;\n case \"__WIDGET_I18N__\":\n globalVariables[variableName] = widgetI18nFactory;\n break;\n }\n }\n\n Object.assign(\n globalVariables,\n getGeneralGlobals(precooked.attemptToVisitGlobals, {\n storyboardFunctions,\n app: runtimeContext.app,\n appendI18nNamespace: runtimeContext.appendI18nNamespace,\n })\n );\n\n try {\n const result = cook(precooked.expression, precooked.source, {\n globalVariables: supply(\n precooked.attemptToVisitGlobals,\n globalVariables\n ),\n });\n const detail = { raw, context: globalVariables, result };\n devtoolsHookEmit(\"evaluation\", detail);\n return result;\n } catch (error: any) {\n const message = `${error.message}, in \"${raw}\"`;\n const errorConstructor = getCookErrorConstructor(error);\n throw new errorConstructor(message);\n }\n },\n };\n}\n"],"mappings":";;AAAA,SACEA,IAAI,EACJC,WAAW,EAEXC,+BAA+B,QAC1B,iBAAiB;AACxB,SAASC,0BAA0B,QAAQ,mBAAmB;AAC9D,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SACEC,wBAAwB,EACxBC,sBAAsB,EACtBC,4BAA4B,QAEvB,6BAA6B;AACpC,SAASC,SAAS,EAAEC,IAAI,QAAQ,QAAQ;AAExC,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SACEC,qBAAqB,EACrBC,mBAAmB,QACd,0BAA0B;AACjC,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SACEC,uBAAuB,EACvBC,gBAAgB,QACX,sBAAsB;AAC7B,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,gBAAgB;AAC7D,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,cAAc,QAAQ,qBAAqB;AACpD,SACEC,wCAAwC,EACxCC,gBAAgB,EAChBC,UAAU,EACVC,KAAK,QACA,eAAe;AAEtB,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,uBAAuB;AACzE,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,qBA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uG;MACtC,CAAC,CACH,CAAC;MAED,IAAI;QACF,IAAMC,MAAM,GAAGpK,IAAI,CAAC6E,SAAS,CAACwF,UAAU,EAAExF,SAAS,CAACyF,MAAM,EAAE;UAC1D/E,eAAe,EAAEnF,MAAM,CACrByE,SAAS,CAACW,qBAAqB,EAC/BD,eACF;QACF,CAAC,CAAC;QACF,IAAMgF,MAAM,GAAG;UAAEhI,GAAG;UAAEiI,OAAO,EAAEjF,eAAe;UAAE6E;QAAO,CAAC;QACxDnJ,gBAAgB,CAAC,YAAY,EAAEsJ,MAAM,CAAC;QACtC,OAAOH,MAAM;MACf,CAAC,CAAC,OAAOnH,KAAU,EAAE;QACnB,IAAMiC,QAAO,MAAAC,MAAA,CAAMlC,KAAK,CAACiC,OAAO,aAAAC,MAAA,CAAS5C,GAAG,OAAG;QAC/C,IAAM6C,iBAAgB,GAAGpC,uBAAuB,CAACC,KAAK,CAAC;QACvD,MAAM,IAAImC,iBAAgB,CAACF,QAAO,CAAC;MACrC;IACF;EACF,CAAC;AACH"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export var RenderTag = /*#__PURE__*/function (RenderTag) {
|
|
2
2
|
RenderTag[RenderTag["ROOT"] = 1] = "ROOT";
|
|
3
3
|
RenderTag[RenderTag["BRICK"] = 2] = "BRICK";
|
|
4
|
+
RenderTag[RenderTag["PLACEHOLDER"] = 3] = "PLACEHOLDER";
|
|
4
5
|
return RenderTag;
|
|
5
6
|
}({});
|
|
6
7
|
//# sourceMappingURL=enums.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","names":["RenderTag"],"sources":["../../../src/internal/enums.ts"],"sourcesContent":["export enum RenderTag {\n ROOT = 1,\n BRICK = 2,\n}\n"],"mappings":"AAAA,WAAYA,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA"}
|
|
1
|
+
{"version":3,"file":"enums.js","names":["RenderTag"],"sources":["../../../src/internal/enums.ts"],"sourcesContent":["export enum RenderTag {\n ROOT = 1,\n BRICK = 2,\n PLACEHOLDER = 3,\n}\n"],"mappings":"AAAA,WAAYA,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","names":[],"sources":["../../../src/internal/interfaces.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\nimport type {\n BrickEventHandler,\n BrickEventsMap,\n CustomTemplate,\n RouteConf,\n RuntimeSnippet,\n CustomTemplateProxy,\n CustomTemplateProxyBasicProperty,\n CustomTemplateProxySlot,\n SlotsConfOfBricks,\n} from \"@next-core/types\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { RuntimeBrickConfOfFormSymbols } from \"./FormRenderer/constants.js\";\n\nexport interface RuntimeContext extends LegacyCompatibleRuntimeContext {\n ctxStore: DataStore<\"CTX\">;\n tplStateStoreMap: Map<string, DataStore<\"STATE\">>;\n pendingPermissionsPreCheck: (Promise<unknown> | undefined)[];\n tplStateStoreId?: string;\n // `useBrick` has a local tpl state store scope\n tplStateStoreScope?: DataStore<\"STATE\">[];\n forEachItem?: unknown;\n appendI18nNamespace?: string;\n\n formStateStoreMap: Map<string, DataStore<\"FORM_STATE\">>;\n formStateStoreId?: string;\n formStateStoreScope?: DataStore<\"FORM_STATE\">[];\n}\n\nexport type AsyncPropertyEntry = [\n name: string,\n value: Promise<unknown>,\n ignoreUndefined?: boolean
|
|
1
|
+
{"version":3,"file":"interfaces.js","names":[],"sources":["../../../src/internal/interfaces.ts"],"sourcesContent":["import type { LegacyCompatibleRuntimeContext } from \"@next-core/inject\";\nimport type {\n BrickEventHandler,\n BrickEventsMap,\n CustomTemplate,\n RouteConf,\n RuntimeSnippet,\n CustomTemplateProxy,\n CustomTemplateProxyBasicProperty,\n CustomTemplateProxySlot,\n SlotsConfOfBricks,\n} from \"@next-core/types\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { RuntimeBrickConfWithTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { RuntimeBrickConfOfFormSymbols } from \"./FormRenderer/constants.js\";\n\nexport interface RuntimeContext extends LegacyCompatibleRuntimeContext {\n ctxStore: DataStore<\"CTX\">;\n tplStateStoreMap: Map<string, DataStore<\"STATE\">>;\n pendingPermissionsPreCheck: (Promise<unknown> | undefined)[];\n tplStateStoreId?: string;\n // `useBrick` has a local tpl state store scope\n tplStateStoreScope?: DataStore<\"STATE\">[];\n forEachItem?: unknown;\n forEachIndex?: number;\n appendI18nNamespace?: string;\n\n formStateStoreMap: Map<string, DataStore<\"FORM_STATE\">>;\n formStateStoreId?: string;\n formStateStoreScope?: DataStore<\"FORM_STATE\">[];\n}\n\nexport type AsyncPropertyEntry = [\n name: string,\n value: Promise<unknown>,\n ignoreUndefined?: boolean,\n];\n\nexport interface ElementHolder {\n element?: HTMLElement | null;\n}\n\nexport interface RenderRoot extends BaseRenderNode {\n tag: RenderTag.ROOT;\n container?: HTMLElement | DocumentFragment;\n createPortal:\n | HTMLElement\n | DocumentFragment\n | (() => HTMLElement | DocumentFragment);\n}\n\nexport interface RenderBrick extends BaseRenderNode, RuntimeBrick {\n tag: RenderTag.BRICK;\n return: RenderReturnNode;\n hasTrackingControls?: boolean;\n}\n\nexport interface RenderPlaceholder extends BaseRenderNode {\n tag: RenderTag.PLACEHOLDER;\n return: RenderReturnNode;\n}\n\nexport interface BaseRenderNode {\n tag: RenderTag;\n child?: RenderChildNode;\n sibling?: RenderChildNode;\n return?: RenderReturnNode | null;\n childElements?: HTMLElement[];\n}\n\nexport type RenderNode = RenderRoot | RenderBrick | RenderPlaceholder;\n\nexport type RenderChildNode = RenderBrick | RenderPlaceholder;\nexport type RenderReturnNode = RenderRoot | RenderBrick;\n\nexport interface RuntimeBrick {\n type: string;\n properties?: Record<string, unknown>;\n events?: BrickEventsMap;\n slotId?: string;\n element?: RuntimeBrickElement | null;\n iid?: string;\n runtimeContext: RuntimeContext;\n tplHostMetadata?: TemplateHostMetadata;\n portal?: boolean;\n ref?: string;\n}\n\nexport type MetaInfoOfEventListener = [\n string,\n // For compatibility of devtools, leave the second argument there.\n null | undefined,\n BrickEventHandler,\n];\n\nexport type RememberedEventListener = [string, EventListener];\n\nexport interface RuntimeBrickElement extends HTMLElement {\n $$typeof?: \"brick\" | \"provider\" | \"custom-template\" | \"native\" | \"invalid\";\n /** Meta info of listeners, for devtools only */\n $$eventListeners?: MetaInfoOfEventListener[];\n /** Remembered listeners for unbinding */\n $$listeners?: RememberedEventListener[];\n /** Remembered proxy listeners for unbinding */\n $$proxyListeners?: RememberedEventListener[];\n /** Find element by ref in a custom template */\n $$getElementByRef?: (ref: string) => HTMLElement | null | undefined;\n $$tplStateStore?: DataStore<\"STATE\">;\n}\n\nexport interface TemplateHostMetadata {\n internalBricksByRef: Map<string, RuntimeBrick>;\n tplStateStoreId: string;\n proxy?: CustomTemplateProxy;\n}\n\nexport type TemplateHostBrick = RuntimeBrick & {\n tplHostMetadata: TemplateHostMetadata;\n};\n\nexport interface TemplateHostContext {\n reversedProxies: ReversedProxies;\n asyncHostPropertyEntries: AsyncPropertyEntry[];\n externalSlots?: SlotsConfOfBricks;\n tplStateStoreId: string;\n hostBrick: TemplateHostBrick;\n}\n\ninterface ReversedProxies {\n properties: Map<string, ReversedPropertyProxy[]>;\n slots: Map<string, ReversedSlotProxy[]>;\n}\n\ninterface ReversedPropertyProxy {\n from: string;\n to: CustomTemplateProxyBasicProperty;\n}\n\ninterface ReversedSlotProxy {\n from: string;\n to: CustomTemplateProxySlot;\n}\n\nexport type RuntimeBrickConfWithSymbols = RuntimeBrickConfWithTplSymbols &\n RuntimeBrickConfOfFormSymbols;\n\nexport interface DataValueOption {\n tplStateStoreId?: string;\n}\n\nexport type PreviewStoryboardPatch =\n | CustomTemplate\n | RouteConf\n | RuntimeSnippet;\n\nexport interface PreviewOption {\n appId: string;\n formId?: string;\n updateStoryboardType?: \"route\" | \"template\" | \"snippet\";\n provider?: string;\n}\n"],"mappings":""}
|
|
@@ -10,47 +10,49 @@ export function mountTree(root, initializedElement) {
|
|
|
10
10
|
var current = root.child;
|
|
11
11
|
var portalElements = [];
|
|
12
12
|
while (current) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
if (current.tag === RenderTag.BRICK) {
|
|
14
|
+
var _current$tplHostMetad;
|
|
15
|
+
var tagName = current.type;
|
|
16
|
+
if (tagName.includes("-") && !customElements.get(tagName)) {
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
18
|
+
console.error("Undefined custom element: ".concat(tagName));
|
|
19
|
+
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
21
|
+
// istanbul ignore if
|
|
22
|
+
if (tagName === "basic-bricks.script-brick") {
|
|
23
|
+
// eslint-disable-next-line no-console
|
|
24
|
+
console.warn("`basic-bricks.script-brick` is deprecated, please take caution when using it");
|
|
25
|
+
}
|
|
26
|
+
var element = initializedElement && current === root.child ? initializedElement : document.createElement(tagName);
|
|
27
|
+
current.element = element;
|
|
28
|
+
if (current.slotId) {
|
|
29
|
+
element.setAttribute("slot", current.slotId);
|
|
30
|
+
}
|
|
31
|
+
if (current.iid) {
|
|
32
|
+
element.dataset.iid = current.iid;
|
|
33
|
+
}
|
|
34
|
+
if ((_current$tplHostMetad = current.tplHostMetadata) !== null && _current$tplHostMetad !== void 0 && _current$tplHostMetad.tplStateStoreId) {
|
|
35
|
+
element.dataset.tplStateStoreId = current.tplHostMetadata.tplStateStoreId;
|
|
36
|
+
}
|
|
37
|
+
setRealProperties(element, current.properties);
|
|
38
|
+
bindListeners(element, current.events, current.runtimeContext);
|
|
39
|
+
if (current.tplHostMetadata) {
|
|
40
|
+
// 先设置属性,再设置 `$$tplStateStore`,这样,当触发属性设置时,
|
|
41
|
+
// 避免初始化的一次 state update 操作及其 onChange 事件。
|
|
42
|
+
element.$$tplStateStore = getTplStateStore({
|
|
43
|
+
tplStateStoreId: current.tplHostMetadata.tplStateStoreId,
|
|
44
|
+
tplStateStoreMap: current.runtimeContext.tplStateStoreMap
|
|
45
|
+
}, "mount");
|
|
46
|
+
}
|
|
47
|
+
bindTemplateProxy(current);
|
|
48
|
+
if (current.portal) {
|
|
49
|
+
portalElements.push(element);
|
|
50
|
+
} else if (current.return) {
|
|
51
|
+
if (!current.return.childElements) {
|
|
52
|
+
current.return.childElements = [];
|
|
53
|
+
}
|
|
54
|
+
current.return.childElements.push(element);
|
|
52
55
|
}
|
|
53
|
-
current.return.childElements.push(element);
|
|
54
56
|
}
|
|
55
57
|
if (current.child) {
|
|
56
58
|
current = current.child;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","names":["bindTemplateProxy","getTplStateStore","bindListeners","setRealProperties","RenderTag","unmountTree","mountPoint","replaceChildren","mountTree","root","initializedElement","current","child","portalElements","_current$tplHostMetad","tagName","type","includes","customElements","get","console","error","concat","warn","element","document","createElement","slotId","setAttribute","iid","dataset","tplHostMetadata","tplStateStoreId","properties","events","runtimeContext","$$tplStateStore","tplStateStoreMap","portal","push","return","childElements","sibling","_currentReturn","currentReturn","
|
|
1
|
+
{"version":3,"file":"mount.js","names":["bindTemplateProxy","getTplStateStore","bindListeners","setRealProperties","RenderTag","unmountTree","mountPoint","replaceChildren","mountTree","root","initializedElement","current","child","portalElements","tag","BRICK","_current$tplHostMetad","tagName","type","includes","customElements","get","console","error","concat","warn","element","document","createElement","slotId","setAttribute","iid","dataset","tplHostMetadata","tplStateStoreId","properties","events","runtimeContext","$$tplStateStore","tplStateStoreMap","portal","push","return","childElements","sibling","_currentReturn","currentReturn","ROOT","_currentReturn$contai","container","append","undefined","length","createPortal"],"sources":["../../../src/internal/mount.ts"],"sourcesContent":["import { bindTemplateProxy } from \"./CustomTemplates/bindTemplateProxy.js\";\nimport { getTplStateStore } from \"./CustomTemplates/utils.js\";\nimport { bindListeners } from \"./bindListeners.js\";\nimport { setRealProperties } from \"./compute/setRealProperties.js\";\nimport { RenderTag } from \"./enums.js\";\nimport type {\n RenderReturnNode,\n RenderRoot,\n RuntimeBrickElement,\n} from \"./interfaces.js\";\n\nexport function unmountTree(mountPoint: HTMLElement | DocumentFragment) {\n mountPoint.replaceChildren();\n}\n\nexport function mountTree(\n root: RenderRoot,\n initializedElement?: RuntimeBrickElement\n): void {\n let current = root.child;\n const portalElements: RuntimeBrickElement[] = [];\n while (current) {\n if (current.tag === RenderTag.BRICK) {\n const tagName = current.type;\n\n if (tagName.includes(\"-\") && !customElements.get(tagName)) {\n // eslint-disable-next-line no-console\n console.error(`Undefined custom element: ${tagName}`);\n }\n\n // istanbul ignore if\n if (tagName === \"basic-bricks.script-brick\") {\n // eslint-disable-next-line no-console\n console.warn(\n \"`basic-bricks.script-brick` is deprecated, please take caution when using it\"\n );\n }\n\n const element: RuntimeBrickElement =\n initializedElement && current === root.child\n ? initializedElement\n : document.createElement(tagName);\n current.element = element;\n\n if (current.slotId) {\n element.setAttribute(\"slot\", current.slotId);\n }\n if (current.iid) {\n element.dataset.iid = current.iid;\n }\n if (current.tplHostMetadata?.tplStateStoreId) {\n element.dataset.tplStateStoreId =\n current.tplHostMetadata.tplStateStoreId;\n }\n setRealProperties(element, current.properties);\n bindListeners(element, current.events, current.runtimeContext);\n if (current.tplHostMetadata) {\n // 先设置属性,再设置 `$$tplStateStore`,这样,当触发属性设置时,\n // 避免初始化的一次 state update 操作及其 onChange 事件。\n element.$$tplStateStore = getTplStateStore(\n {\n tplStateStoreId: current.tplHostMetadata.tplStateStoreId,\n tplStateStoreMap: current.runtimeContext.tplStateStoreMap,\n },\n \"mount\"\n );\n }\n bindTemplateProxy(current);\n\n if (current.portal) {\n portalElements.push(element);\n } else if (current.return) {\n if (!current.return.childElements) {\n current.return.childElements = [];\n }\n current.return.childElements.push(element);\n }\n }\n\n if (current.child) {\n current = current.child;\n } else if (current.sibling) {\n current = current.sibling;\n } else {\n let currentReturn: RenderReturnNode | null | undefined = current.return;\n while (currentReturn) {\n // Append elements inside out\n if (currentReturn.childElements) {\n if (currentReturn.tag === RenderTag.ROOT) {\n currentReturn.container?.append(...currentReturn.childElements);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n currentReturn.element!.append(...currentReturn.childElements);\n }\n currentReturn.childElements = undefined;\n }\n\n if (currentReturn.tag === RenderTag.ROOT && portalElements.length > 0) {\n const portal =\n typeof currentReturn.createPortal === \"function\"\n ? currentReturn.createPortal()\n : currentReturn.createPortal;\n portal.append(...portalElements);\n }\n\n if (currentReturn.sibling) {\n break;\n }\n currentReturn = currentReturn.return;\n }\n current = currentReturn?.sibling;\n }\n }\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,wCAAwC;AAC1E,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,SAAS,QAAQ,YAAY;AAOtC,OAAO,SAASC,WAAWA,CAACC,UAA0C,EAAE;EACtEA,UAAU,CAACC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AACH,aAAa,CAAC;UACjE,CAAC,MAAM;YACL;YACAG,aAAa,CAACpB,OAAO,CAAEwB,MAAM,CAAC,GAAGJ,aAAa,CAACH,aAAa,CAAC;UAC/D;UACAG,aAAa,CAACH,aAAa,GAAGQ,SAAS;QACzC;QAEA,IAAIL,aAAa,CAAChC,GAAG,KAAKV,SAAS,CAAC2C,IAAI,IAAIlC,cAAc,CAACuC,MAAM,GAAG,CAAC,EAAE;UACrE,IAAMZ,MAAM,GACV,OAAOM,aAAa,CAACO,YAAY,KAAK,UAAU,GAC5CP,aAAa,CAACO,YAAY,CAAC,CAAC,GAC5BP,aAAa,CAACO,YAAY;UAChCb,MAAM,CAACU,MAAM,CAAC,GAAGrC,cAAc,CAAC;QAClC;QAEA,IAAIiC,aAAa,CAACF,OAAO,EAAE;UACzB;QACF;QACAE,aAAa,GAAGA,aAAa,CAACJ,MAAM;MACtC;MACA/B,OAAO,IAAAkC,cAAA,GAAGC,aAAa,cAAAD,cAAA,uBAAbA,cAAA,CAAeD,OAAO;IAClC;EACF;AACF"}
|
|
@@ -17,7 +17,7 @@ export function renderUseBrick(_x, _x2) {
|
|
|
17
17
|
}
|
|
18
18
|
function _renderUseBrick() {
|
|
19
19
|
_renderUseBrick = _asyncToGenerator(function* (useBrick, data) {
|
|
20
|
-
var _scopedRuntimeContext, _scopedRuntimeContext2, _output$node;
|
|
20
|
+
var _scopedRuntimeContext, _scopedRuntimeContext2, _output$node, _output$node2;
|
|
21
21
|
var [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] = createScopedRuntimeContext(_objectSpread(_objectSpread({}, _internalApiGetRuntimeContext()), {}, {
|
|
22
22
|
data,
|
|
23
23
|
pendingPermissionsPreCheck: []
|
|
@@ -40,7 +40,10 @@ function _renderUseBrick() {
|
|
|
40
40
|
}), scopedRuntimeContext, rendererContext, []);
|
|
41
41
|
var scopedStores = [...tplStateStoreScope, ...formStateStoreScope];
|
|
42
42
|
yield postAsyncRender(output, scopedRuntimeContext, scopedStores);
|
|
43
|
-
if ((_output$node = output.node)
|
|
43
|
+
if (((_output$node = output.node) === null || _output$node === void 0 ? void 0 : _output$node.tag) === RenderTag.PLACEHOLDER) {
|
|
44
|
+
throw new Error("The root brick of useBrick cannot be an ignored control node");
|
|
45
|
+
}
|
|
46
|
+
if ((_output$node2 = output.node) !== null && _output$node2 !== void 0 && _output$node2.portal) {
|
|
44
47
|
throw new Error("The root brick of useBrick cannot be a portal brick");
|
|
45
48
|
}
|
|
46
49
|
renderRoot.child = output.node;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret_internals.js","names":["loadBricksImperatively","pick","_internalApiGetRenderId","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","getBrickPackages","createScopedRuntimeContext","postAsyncRender","renderBrick","RendererContext","mountTree","unmountTree","RenderTag","computeRealValue","isStrictMode","warnAboutStrictMode","customTemplates","registerAppI18n","getTplStateStore","renderUseBrick","_x","_x2","_renderUseBrick","apply","arguments","_asyncToGenerator","useBrick","data","_scopedRuntimeContext","_scopedRuntimeContext2","_output$node","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","_objectSpread","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","rendererContext","renderRoot","tag","ROOT","createPortal","transform","strict","output","properties","scopedStores","node","portal","Error","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","legacyDoTransform","to","options","noInject","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","updateStoryboardByRoute","newRoute","match","getKey","route","concat","path","exact","replaceRoute","routes","key","map","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","getSnippetPreviewPath","snippetId","updateStoryboardBySnippet","snippetData","_snippetData$bricks","length","context","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice","getContextValue","_ref3","tplStateStoreId","runtimeContext","tplStateStore","getValue","ctxStore","getAllContextValues","_ref4","getAllValues","getBrickPackagesById","id","find","pkg","filePath","startsWith","getRenderId","getAddedContracts","_x3","_x4","_getAddedContracts","_ref5","updateStoryboardType","provider","collectContractProvider","updatedStoryboard","meta","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","resolve","forEach","api","_storyboard$meta","_","namespaceId","contracts","some","contract","push"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n RuntimeSnippet,\n ContextConf,\n} from \"@next-core/types\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRenderId,\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n} from \"./Runtime.js\";\nimport {\n createScopedRuntimeContext,\n postAsyncRender,\n renderBrick,\n} from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport type {\n DataValueOption,\n PreviewOption,\n PreviewStoryboardPatch,\n RenderRoot,\n} from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { getTplStateStore } from \"./CustomTemplates/utils.js\";\n\nexport type { DataValueOption, RuntimeContext } from \"./interfaces.js\";\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[];\n}\n\nexport async function renderUseBrick(\n useBrick: UseSingleBrickConf,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext({\n ..._internalApiGetRuntimeContext()!,\n data,\n pendingPermissionsPreCheck: [],\n });\n\n scopedRuntimeContext.tplStateStoreMap ??= new Map();\n scopedRuntimeContext.formStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict\n ? useBrick\n : {\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n scopedRuntimeContext,\n rendererContext,\n []\n );\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n\n await postAsyncRender(output, scopedRuntimeContext, scopedStores);\n\n if (output.node?.portal) {\n throw new Error(\"The root brick of useBrick cannot be a portal brick\");\n }\n\n renderRoot.child = output.node;\n\n const tagName = output.node ? output.node.type : null;\n\n return { tagName, renderRoot, rendererContext, scopedStores };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext, scopedStores }: RenderUseBrickResult,\n element: HTMLElement\n): MountUseBrickResult {\n let portal: HTMLElement | undefined;\n renderRoot.createPortal = () => {\n const portalRoot = document.querySelector(\n \"#portal-mount-point\"\n ) as HTMLElement;\n portal = document.createElement(\"div\");\n portalRoot.appendChild(portal);\n return portal;\n };\n\n mountTree(renderRoot, element);\n\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n\n return {\n portal,\n };\n}\n\nexport function unmountUseBrick(\n { rendererContext }: RenderUseBrickResult,\n mountResult: MountUseBrickResult\n): void {\n // if (mountResult.mainBrick) {\n // mountResult.mainBrick.unmount();\n // }\n if (mountResult.portal) {\n unmountTree(mountResult.portal);\n mountResult.portal.remove();\n }\n rendererContext.dispatchOnUnmount();\n rendererContext.dispose();\n}\n\n/** For v2 compatibility of `doTransform` from brick-kit. */\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport function updateStoryboard(\n appId: string,\n storyboardPatch: Partial<Storyboard>\n): void {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n Object.assign(storyboard, {\n ...storyboardPatch,\n $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(settings, \"properties\", \"events\", \"lifeCycle\", \"context\"),\n },\n ]\n );\n}\n\nfunction getSnippetPreviewPath(snippetId: string): string {\n return `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetId}`;\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n context?: ContextConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n getSnippetPreviewPath(snippetData.snippetId),\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }],\n snippetData.context\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[],\n context?: ContextConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n context,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1, newPreviewRoute);\n }\n}\n\nexport function getContextValue(\n name: string,\n { tplStateStoreId }: DataValueOption\n): unknown {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getValue(name);\n }\n\n return runtimeContext.ctxStore.getValue(name);\n}\n\nexport function getAllContextValues({\n tplStateStoreId,\n}: DataValueOption): Record<string, unknown> {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getAllValues();\n }\n\n return runtimeContext.ctxStore.getAllValues();\n}\n\nexport function getBrickPackagesById(id: string) {\n return getBrickPackages().find((pkg) =>\n pkg.id ? pkg.id === id : pkg.filePath.startsWith(id)\n );\n}\n\nexport function getRenderId() {\n return _internalApiGetRenderId();\n}\n\nexport async function getAddedContracts(\n storyboardPatch: PreviewStoryboardPatch,\n {\n appId,\n updateStoryboardType,\n provider: collectContractProvider,\n }: PreviewOption\n): Promise<string[]> {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId);\n let updatedStoryboard;\n\n // 拿到更新部分的 storyboard 配置,然后扫描一遍,找到新增的 contracts\n if (updateStoryboardType === \"route\") {\n updatedStoryboard = {\n routes: [storyboardPatch as RouteConf],\n } as Storyboard;\n } else if (updateStoryboardType === \"template\") {\n updatedStoryboard = {\n meta: {\n customTemplates: [storyboardPatch as CustomTemplate],\n },\n } as Storyboard;\n } else if (updateStoryboardType === \"snippet\") {\n // snippet 是放在挂载 route 里预览,通过 previewPath 拿到当前修改 route\n const snippetPreviewPath = getSnippetPreviewPath(\n (storyboardPatch as RuntimeSnippet).snippetId\n );\n const currentRoute = storyboard?.routes?.find(\n (route) => route.path === snippetPreviewPath\n );\n\n updatedStoryboard = {\n routes: [currentRoute],\n } as Storyboard;\n }\n\n const addedContracts: string[] = [];\n\n if (updatedStoryboard && collectContractProvider) {\n await loadBricksImperatively([collectContractProvider], getBrickPackages());\n\n const provider = document.createElement(collectContractProvider) as any;\n const contractApis = await provider.resolve(updatedStoryboard);\n\n contractApis.forEach((api: string) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, namespaceId, name] = api.match(\n /(.*)@(.*):\\d\\.\\d\\.\\d/\n ) as string[];\n\n if (\n !storyboard?.meta?.contracts?.some(\n (contract) =>\n contract.namespaceId === namespaceId && contract.name === name\n )\n ) {\n addedContracts.push(api);\n }\n });\n }\n\n return addedContracts;\n}\n"],"mappings":";;AASA,SAASA,sBAAsB,QAAQ,mBAAmB;AAC1D,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SACEC,uBAAuB,EACvBC,6BAA6B,EAC7BC,wCAAwC,EACxCC,gBAAgB,QACX,cAAc;AACrB,SACEC,0BAA0B,EAC1BC,eAAe,EACfC,WAAW,QACN,eAAe;AACtB,SAASC,eAAe,QAAQ,sBAAsB;AAQtD,SAASC,SAAS,EAAEC,WAAW,QAAQ,YAAY;AACnD,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,oBAAoB;AACtE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,gBAAgB,QAAQ,4BAA4B;AAW7D,gBAAsBC,cAAcA,CAAAC,EAAA,EAAAC,GAAA;EAAA,OAAAC,eAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AA+DnC,SAAAF,gBAAA;EAAAA,eAAA,GAAAG,iBAAA,CA/DM,WACLC,QAA4B,EAC5BC,IAAa,EACkB;IAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,YAAA;IAC/B,IAAM,CAACC,oBAAoB,EAAEC,kBAAkB,EAAEC,mBAAmB,CAAC,GACnE3B,0BAA0B,CAAA4B,aAAA,CAAAA,aAAA,KACrB/B,6BAA6B,CAAC,CAAC;MAClCwB,IAAI;MACJQ,0BAA0B,EAAE;IAAE,EAC/B,CAAC;IAEJ,CAAAP,qBAAA,GAAAG,oBAAoB,CAACK,gBAAgB,cAAAR,qBAAA,cAAAA,qBAAA,GAArCG,oBAAoB,CAACK,gBAAgB,GAAK,IAAIC,GAAG,CAAC,CAAC;IACnD,CAAAR,sBAAA,GAAAE,oBAAoB,CAACO,iBAAiB,cAAA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,QAAQ,IACPA,QAAQ,CAACH,WAAW,KAAKA,WAAW,IAAIG,QAAQ,CAAC9D,IAAI,KAAKA,IAC9D,CAAC,GACD;UACAoD,cAAc,CAACW,IAAI,CAACP,GAAG,CAAC;QAC1B;MACF,CAAC,CAAC;IACJ;IAEA,OAAOJ,cAAc;EACvB,CAAC;EAAA,OAAAV,kBAAA,CAAA7H,KAAA,OAAAC,SAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"secret_internals.js","names":["loadBricksImperatively","pick","_internalApiGetRenderId","_internalApiGetRuntimeContext","_internalApiGetStoryboardInBootstrapData","getBrickPackages","createScopedRuntimeContext","postAsyncRender","renderBrick","RendererContext","mountTree","unmountTree","RenderTag","computeRealValue","isStrictMode","warnAboutStrictMode","customTemplates","registerAppI18n","getTplStateStore","renderUseBrick","_x","_x2","_renderUseBrick","apply","arguments","_asyncToGenerator","useBrick","data","_scopedRuntimeContext","_scopedRuntimeContext2","_output$node","_output$node2","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","_objectSpread","pendingPermissionsPreCheck","tplStateStoreMap","Map","formStateStoreMap","rendererContext","renderRoot","tag","ROOT","createPortal","transform","strict","output","properties","scopedStores","node","PLACEHOLDER","Error","portal","child","tagName","type","mountUseBrick","_ref","element","portalRoot","document","querySelector","createElement","appendChild","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","unmountUseBrick","_ref2","mountResult","remove","dispatchOnUnmount","dispose","legacyDoTransform","to","options","noInject","updateStoryboard","appId","storyboardPatch","storyboard","Object","assign","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","updateStoryboardByRoute","newRoute","match","getKey","route","concat","path","exact","replaceRoute","routes","key","map","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","getSnippetPreviewPath","snippetId","updateStoryboardBySnippet","snippetData","_snippetData$bricks","length","context","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice","getContextValue","_ref3","tplStateStoreId","runtimeContext","tplStateStore","getValue","ctxStore","getAllContextValues","_ref4","getAllValues","getBrickPackagesById","id","find","pkg","filePath","startsWith","getRenderId","getAddedContracts","_x3","_x4","_getAddedContracts","_ref5","updateStoryboardType","provider","collectContractProvider","updatedStoryboard","meta","_storyboard$routes","snippetPreviewPath","currentRoute","addedContracts","contractApis","resolve","forEach","api","_storyboard$meta","_","namespaceId","contracts","some","contract","push"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n RuntimeSnippet,\n ContextConf,\n} from \"@next-core/types\";\nimport { loadBricksImperatively } from \"@next-core/loader\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRenderId,\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n getBrickPackages,\n} from \"./Runtime.js\";\nimport {\n createScopedRuntimeContext,\n postAsyncRender,\n renderBrick,\n} from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport type {\n DataValueOption,\n PreviewOption,\n PreviewStoryboardPatch,\n RenderRoot,\n} from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { computeRealValue } from \"./compute/computeRealValue.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport { registerAppI18n } from \"./registerAppI18n.js\";\nimport { getTplStateStore } from \"./CustomTemplates/utils.js\";\n\nexport type { DataValueOption, RuntimeContext } from \"./interfaces.js\";\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[];\n}\n\nexport async function renderUseBrick(\n useBrick: UseSingleBrickConf,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext({\n ..._internalApiGetRuntimeContext()!,\n data,\n pendingPermissionsPreCheck: [],\n });\n\n scopedRuntimeContext.tplStateStoreMap ??= new Map();\n scopedRuntimeContext.formStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"fragment\");\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n // Will set during `mountUseBrick`\n createPortal: null!,\n };\n\n const transform = (useBrick as { transform?: Record<string, unknown> })\n .transform;\n const strict = isStrictMode();\n if (transform) {\n warnAboutStrictMode(\n strict,\n \"`useBrick.transform`\",\n 'please use \"properties\" instead, check your useBrick:',\n useBrick\n );\n }\n\n const output = await renderBrick(\n renderRoot,\n strict\n ? useBrick\n : {\n ...useBrick,\n properties: {\n ...useBrick.properties,\n ...transform,\n },\n },\n scopedRuntimeContext,\n rendererContext,\n []\n );\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n\n await postAsyncRender(output, scopedRuntimeContext, scopedStores);\n\n if (output.node?.tag === RenderTag.PLACEHOLDER) {\n throw new Error(\n \"The root brick of useBrick cannot be an ignored control node\"\n );\n }\n\n if (output.node?.portal) {\n throw new Error(\"The root brick of useBrick cannot be a portal brick\");\n }\n\n renderRoot.child = output.node;\n\n const tagName = output.node ? output.node.type : null;\n\n return { tagName, renderRoot, rendererContext, scopedStores };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext, scopedStores }: RenderUseBrickResult,\n element: HTMLElement\n): MountUseBrickResult {\n let portal: HTMLElement | undefined;\n renderRoot.createPortal = () => {\n const portalRoot = document.querySelector(\n \"#portal-mount-point\"\n ) as HTMLElement;\n portal = document.createElement(\"div\");\n portalRoot.appendChild(portal);\n return portal;\n };\n\n mountTree(renderRoot, element);\n\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n\n return {\n portal,\n };\n}\n\nexport function unmountUseBrick(\n { rendererContext }: RenderUseBrickResult,\n mountResult: MountUseBrickResult\n): void {\n // if (mountResult.mainBrick) {\n // mountResult.mainBrick.unmount();\n // }\n if (mountResult.portal) {\n unmountTree(mountResult.portal);\n mountResult.portal.remove();\n }\n rendererContext.dispatchOnUnmount();\n rendererContext.dispose();\n}\n\n/** For v2 compatibility of `doTransform` from brick-kit. */\nexport function legacyDoTransform(\n data: unknown,\n to: unknown,\n options?: unknown\n) {\n if (options) {\n throw new Error(\"Legacy doTransform does not support options in v3\");\n }\n return computeRealValue(\n to,\n {\n ..._internalApiGetRuntimeContext()!,\n data,\n },\n {\n noInject: true,\n }\n );\n}\n\nexport function updateStoryboard(\n appId: string,\n storyboardPatch: Partial<Storyboard>\n): void {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n Object.assign(storyboard, {\n ...storyboardPatch,\n $$fulfilling: null,\n $$fulfilled: true,\n $$registerCustomTemplateProcessed: false,\n });\n registerAppI18n(storyboard);\n}\n\nexport function updateStoryboardByRoute(appId: string, newRoute: RouteConf) {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId)!;\n let match = false;\n const getKey = (route: RouteConf): string => `${route.path}.${route.exact}`;\n const replaceRoute = (routes: RouteConf[], key: string): RouteConf[] => {\n return routes.map((route) => {\n const routeKey = getKey(route);\n if (route.type === \"routes\") {\n route.routes = replaceRoute(route.routes, key);\n return route;\n } else if (routeKey === key) {\n match = true;\n return newRoute;\n } else {\n return route;\n }\n });\n };\n storyboard.routes = replaceRoute(storyboard.routes, getKey(newRoute));\n if (!match) {\n storyboard.routes.unshift(newRoute);\n }\n}\n\nexport function updateStoryboardByTemplate(\n appId: string,\n newTemplate: CustomTemplate,\n settings: unknown\n): void {\n const tplName = `${appId}.${newTemplate.name}`;\n // customTemplateRegistry.delete(tplName);\n customTemplates.define(tplName, {\n bricks: newTemplate.bricks,\n proxy: newTemplate.proxy,\n state: newTemplate.state,\n });\n updateTemplatePreviewSettings(appId, newTemplate.name, settings);\n}\n\nexport function updateTemplatePreviewSettings(\n appId: string,\n templateId: string,\n settings?: unknown\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/template-preview/${templateId}`,\n [\n {\n brick: templateId,\n ...pick(settings, \"properties\", \"events\", \"lifeCycle\", \"context\"),\n },\n ]\n );\n}\n\nfunction getSnippetPreviewPath(snippetId: string): string {\n return `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetId}`;\n}\n\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n context?: ContextConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n getSnippetPreviewPath(snippetData.snippetId),\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }],\n snippetData.context\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[],\n context?: ContextConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\n context,\n menu: false,\n exact: true,\n };\n if (previewRouteIndex === -1) {\n routes.unshift(newPreviewRoute);\n } else {\n routes.splice(previewRouteIndex, 1, newPreviewRoute);\n }\n}\n\nexport function getContextValue(\n name: string,\n { tplStateStoreId }: DataValueOption\n): unknown {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getValue(name);\n }\n\n return runtimeContext.ctxStore.getValue(name);\n}\n\nexport function getAllContextValues({\n tplStateStoreId,\n}: DataValueOption): Record<string, unknown> {\n const runtimeContext = _internalApiGetRuntimeContext()!;\n\n if (tplStateStoreId) {\n const tplStateStore = getTplStateStore(\n {\n ...runtimeContext,\n tplStateStoreId,\n },\n \"STATE\"\n );\n return tplStateStore.getAllValues();\n }\n\n return runtimeContext.ctxStore.getAllValues();\n}\n\nexport function getBrickPackagesById(id: string) {\n return getBrickPackages().find((pkg) =>\n pkg.id ? pkg.id === id : pkg.filePath.startsWith(id)\n );\n}\n\nexport function getRenderId() {\n return _internalApiGetRenderId();\n}\n\nexport async function getAddedContracts(\n storyboardPatch: PreviewStoryboardPatch,\n {\n appId,\n updateStoryboardType,\n provider: collectContractProvider,\n }: PreviewOption\n): Promise<string[]> {\n const storyboard = _internalApiGetStoryboardInBootstrapData(appId);\n let updatedStoryboard;\n\n // 拿到更新部分的 storyboard 配置,然后扫描一遍,找到新增的 contracts\n if (updateStoryboardType === \"route\") {\n updatedStoryboard = {\n routes: [storyboardPatch as RouteConf],\n } as Storyboard;\n } else if (updateStoryboardType === \"template\") {\n updatedStoryboard = {\n meta: {\n customTemplates: [storyboardPatch as CustomTemplate],\n },\n } as Storyboard;\n } else if (updateStoryboardType === \"snippet\") {\n // snippet 是放在挂载 route 里预览,通过 previewPath 拿到当前修改 route\n const snippetPreviewPath = getSnippetPreviewPath(\n (storyboardPatch as RuntimeSnippet).snippetId\n );\n const currentRoute = storyboard?.routes?.find(\n (route) => route.path === snippetPreviewPath\n );\n\n updatedStoryboard = {\n routes: [currentRoute],\n } as Storyboard;\n }\n\n const addedContracts: string[] = [];\n\n if (updatedStoryboard && collectContractProvider) {\n await loadBricksImperatively([collectContractProvider], getBrickPackages());\n\n const provider = document.createElement(collectContractProvider) as any;\n const contractApis = await provider.resolve(updatedStoryboard);\n\n contractApis.forEach((api: string) => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const [_, namespaceId, name] = api.match(\n /(.*)@(.*):\\d\\.\\d\\.\\d/\n ) as string[];\n\n if (\n !storyboard?.meta?.contracts?.some(\n (contract) =>\n contract.namespaceId === namespaceId && contract.name === name\n )\n ) {\n addedContracts.push(api);\n }\n });\n }\n\n return addedContracts;\n}\n"],"mappings":";;AASA,SAASA,sBAAsB,QAAQ,mBAAmB;AAC1D,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SACEC,uBAAuB,EACvBC,6BAA6B,EAC7BC,wCAAwC,EACxCC,gBAAgB,QACX,cAAc;AACrB,SACEC,0BAA0B,EAC1BC,eAAe,EACfC,WAAW,QACN,eAAe;AACtB,SAASC,eAAe,QAAQ,sBAAsB;AAQtD,SAASC,SAAS,EAAEC,WAAW,QAAQ,YAAY;AACnD,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,YAAY,EAAEC,mBAAmB,QAAQ,oBAAoB;AACtE,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,gBAAgB,QAAQ,4BAA4B;AAW7D,gBAAsBC,cAAcA,CAAAC,EAAA,EAAAC,GAAA;EAAA,OAAAC,eAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAqEnC,SAAAF,gBAAA;EAAAA,eAAA,GAAAG,iBAAA,CArEM,WACLC,QAA4B,EAC5BC,IAAa,EACkB;IAAA,IAAAC,qBAAA,EAAAC,sBAAA,EAAAC,YAAA,EAAAC,aAAA;IAC/B,IAAM,CAACC,oBAAoB,EAAEC,kBAAkB,EAAEC,mBAAmB,CAAC,GACnE5B,0BAA0B,CAAA6B,aAAA,CAAAA,aAAA,KACrBhC,6BAA6B,CAAC,CAAC;MAClCwB,IAAI;MACJS,0BAA0B,EAAE;IAAE,EAC/B,CAAC;IAEJ,CAAAR,qBAAA,GAAAI,oBAAoB,CAACK,gBAAgB,cAAAT,qBAAA,cAAAA,qBAAA,GAArCI,oBAAoB,CAACK,gBAAgB,GAAK,IAAIC,GAAG,CAAC,CAAC;IACnD,CAAAT,sBAAA,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sBACF,CAAa;QAEb,IACE,EAACR,UAAU,aAAVA,UAAU,gBAAAiF,gBAAA,GAAVjF,UAAU,CAAEwE,IAAI,cAAAS,gBAAA,gBAAAA,gBAAA,GAAhBA,gBAAA,CAAkBG,SAAS,cAAAH,gBAAA,eAA3BA,gBAAA,CAA6BI,IAAI,CAC/BC,QAAQ,IACPA,QAAQ,CAACH,WAAW,KAAKA,WAAW,IAAIG,QAAQ,CAAC9D,IAAI,KAAKA,IAC9D,CAAC,GACD;UACAoD,cAAc,CAACW,IAAI,CAACP,GAAG,CAAC;QAC1B;MACF,CAAC,CAAC;IACJ;IAEA,OAAOJ,cAAc;EACvB,CAAC;EAAA,OAAAV,kBAAA,CAAA/H,KAAA,OAAAC,SAAA;AAAA"}
|
|
@@ -3,9 +3,11 @@ import type { AsyncPropertyEntry } from "../interfaces.js";
|
|
|
3
3
|
export declare const symbolForAsyncComputedPropsFromHost: unique symbol;
|
|
4
4
|
export declare const symbolForTplStateStoreId: unique symbol;
|
|
5
5
|
export declare const symbolForTPlExternalForEachItem: unique symbol;
|
|
6
|
+
export declare const symbolForTPlExternalForEachIndex: unique symbol;
|
|
6
7
|
export type RuntimeBrickConfWithTplSymbols = BrickConf & RuntimeBrickConfOfTplSymbols;
|
|
7
8
|
export interface RuntimeBrickConfOfTplSymbols {
|
|
8
9
|
[symbolForAsyncComputedPropsFromHost]?: AsyncPropertyEntry[];
|
|
9
10
|
[symbolForTplStateStoreId]?: string;
|
|
10
11
|
[symbolForTPlExternalForEachItem]?: unknown;
|
|
12
|
+
[symbolForTPlExternalForEachIndex]?: number;
|
|
11
13
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { BrickConf, RouteConf, SlotsConf, StaticMenuConf } from "@next-core/types";
|
|
2
2
|
import { RendererContext } from "./RendererContext.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { RenderChildNode, RenderReturnNode, RuntimeBrickConfWithSymbols, RuntimeContext } from "./interfaces.js";
|
|
4
4
|
import type { NextHistoryState } from "./historyExtended.js";
|
|
5
5
|
import type { DataStore, DataStoreType } from "./data/DataStore.js";
|
|
6
6
|
export interface RenderOutput {
|
|
7
|
-
node?:
|
|
7
|
+
node?: RenderChildNode;
|
|
8
8
|
unauthenticated?: boolean;
|
|
9
9
|
redirect?: {
|
|
10
10
|
path: string;
|
|
@@ -15,9 +15,9 @@ export interface RenderOutput {
|
|
|
15
15
|
menuRequests: Promise<StaticMenuConf>[];
|
|
16
16
|
hasTrackingControls?: boolean;
|
|
17
17
|
}
|
|
18
|
-
export declare function renderRoutes(returnNode:
|
|
19
|
-
export declare function renderBricks(returnNode:
|
|
20
|
-
export declare function renderBrick(returnNode:
|
|
18
|
+
export declare function renderRoutes(returnNode: RenderReturnNode, routes: RouteConf[], _runtimeContext: RuntimeContext, rendererContext: RendererContext, parentRoutes: RouteConf[], slotId?: string, isIncremental?: boolean): Promise<RenderOutput>;
|
|
19
|
+
export declare function renderBricks(returnNode: RenderReturnNode, bricks: BrickConf[], runtimeContext: RuntimeContext, rendererContext: RendererContext, parentRoutes: RouteConf[], slotId?: string, tplStack?: Map<string, number>, keyPath?: number[]): Promise<RenderOutput>;
|
|
20
|
+
export declare function renderBrick(returnNode: RenderReturnNode, brickConf: RuntimeBrickConfWithSymbols, _runtimeContext: RuntimeContext, rendererContext: RendererContext, parentRoutes: RouteConf[], slotId?: string, keyPath?: number[], tplStack?: Map<string, number>): Promise<RenderOutput>;
|
|
21
21
|
export declare function getDataStores(runtimeContext: RuntimeContext): (DataStore<"STATE"> | DataStore<"FORM_STATE"> | DataStore<"CTX">)[];
|
|
22
22
|
export declare function postAsyncRender(output: RenderOutput, runtimeContext: RuntimeContext, stores: DataStore<DataStoreType>[]): Promise<unknown[]>;
|
|
23
23
|
export declare function createScopedRuntimeContext(runtimeContext: RuntimeContext): [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BrickLifeCycle, RouteConf, StaticMenuConf } from "@next-core/types";
|
|
2
2
|
import type { Action, Location } from "history";
|
|
3
3
|
import { NextHistoryState, NextLocation } from "../history.js";
|
|
4
|
-
import type { RenderBrick,
|
|
4
|
+
import type { RenderBrick, RenderChildNode, RenderReturnNode } from "./interfaces.js";
|
|
5
5
|
import type { RenderOutput } from "./Renderer.js";
|
|
6
6
|
type LocationChangeCallback = (location: Location<NextHistoryState>) => Promise<boolean>;
|
|
7
7
|
export interface RendererContextOptions {
|
|
@@ -11,7 +11,7 @@ export interface RendererContextOptions {
|
|
|
11
11
|
export interface RouteHelper {
|
|
12
12
|
bailout: (output: RenderOutput) => true | undefined;
|
|
13
13
|
mergeMenus: (menuRequests: Promise<StaticMenuConf>[]) => Promise<void>;
|
|
14
|
-
catch: (error: unknown, returnNode:
|
|
14
|
+
catch: (error: unknown, returnNode: RenderReturnNode) => undefined | {
|
|
15
15
|
failed: true;
|
|
16
16
|
output: RenderOutput;
|
|
17
17
|
};
|
|
@@ -29,7 +29,7 @@ export declare class RendererContext {
|
|
|
29
29
|
memoizeMenuRequests(route: RouteConf, menuRequests: Promise<StaticMenuConf>[]): void;
|
|
30
30
|
reMergeMenuRequests(routes: RouteConf[], currentRoute: RouteConf | undefined, menuRequests: Promise<StaticMenuConf>[]): Promise<void>;
|
|
31
31
|
reBailout(output: RenderOutput): true | undefined;
|
|
32
|
-
reCatch(error: unknown, returnNode:
|
|
32
|
+
reCatch(error: unknown, returnNode: RenderReturnNode): {
|
|
33
33
|
failed: true;
|
|
34
34
|
output: RenderOutput;
|
|
35
35
|
} | undefined;
|
|
@@ -41,8 +41,8 @@ export declare class RendererContext {
|
|
|
41
41
|
performIncrementalRender(callback: LocationChangeCallback): void;
|
|
42
42
|
registerBrickLifeCycle(brick: RenderBrick, lifeCycle: BrickLifeCycle | undefined): void;
|
|
43
43
|
registerArbitraryLifeCycle(lifeCycle: string, fn: () => void): void;
|
|
44
|
-
memoize(slotId: string | undefined, keyPath: number[], node:
|
|
45
|
-
reRender(slotId: string | undefined, keyPath: number[], node:
|
|
44
|
+
memoize(slotId: string | undefined, keyPath: number[], node: RenderChildNode | undefined, returnNode: RenderReturnNode): void;
|
|
45
|
+
reRender(slotId: string | undefined, keyPath: number[], node: RenderChildNode | undefined, returnNode: RenderReturnNode): void;
|
|
46
46
|
dispose(): void;
|
|
47
47
|
dispatchBeforePageLoad(): void;
|
|
48
48
|
dispatchPageLoad(): void;
|