@next-core/runtime 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Dialog.js +2 -3
- package/dist/cjs/Dialog.js.map +1 -1
- package/dist/cjs/Notification.js +2 -3
- package/dist/cjs/Notification.js.map +1 -1
- package/dist/cjs/createRoot.js +122 -0
- package/dist/cjs/createRoot.js.map +1 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/internal/Renderer.js +1 -3
- package/dist/cjs/internal/Renderer.js.map +1 -1
- package/dist/cjs/internal/RendererContext.js +13 -8
- package/dist/cjs/internal/RendererContext.js.map +1 -1
- package/dist/cjs/internal/Router.js +1 -1
- package/dist/cjs/internal/Router.js.map +1 -1
- package/dist/cjs/internal/Runtime.js +12 -4
- package/dist/cjs/internal/Runtime.js.map +1 -1
- package/dist/cjs/internal/bootstrapData.js +13 -0
- package/dist/cjs/internal/bootstrapData.js.map +1 -0
- package/dist/cjs/internal/matchStoryboard.js +6 -1
- package/dist/cjs/internal/matchStoryboard.js.map +1 -1
- package/dist/cjs/internal/secret_internals.js +6 -75
- package/dist/cjs/internal/secret_internals.js.map +1 -1
- package/dist/esm/Dialog.js +2 -2
- package/dist/esm/Dialog.js.map +1 -1
- package/dist/esm/Notification.js +2 -2
- package/dist/esm/Notification.js.map +1 -1
- package/dist/esm/createRoot.js +122 -0
- package/dist/esm/createRoot.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/Renderer.js +1 -3
- package/dist/esm/internal/Renderer.js.map +1 -1
- package/dist/esm/internal/RendererContext.js +13 -8
- package/dist/esm/internal/RendererContext.js.map +1 -1
- package/dist/esm/internal/Router.js +1 -1
- package/dist/esm/internal/Router.js.map +1 -1
- package/dist/esm/internal/Runtime.js +10 -3
- package/dist/esm/internal/Runtime.js.map +1 -1
- package/dist/esm/internal/bootstrapData.js +6 -0
- package/dist/esm/internal/bootstrapData.js.map +1 -0
- package/dist/esm/internal/matchStoryboard.js +6 -1
- package/dist/esm/internal/matchStoryboard.js.map +1 -1
- package/dist/esm/internal/secret_internals.js +6 -82
- package/dist/esm/internal/secret_internals.js.map +1 -1
- package/dist/types/createRoot.d.ts +17 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/internal/RendererContext.d.ts +6 -2
- package/dist/types/internal/Runtime.d.ts +2 -1
- package/dist/types/internal/bootstrapData.d.ts +2 -0
- package/dist/types/internal/matchStoryboard.d.ts +1 -0
- package/dist/types/internal/secret_internals.d.ts +4 -10
- package/package.json +3 -3
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.initializePlayground = initializePlayground;
|
|
7
7
|
exports.legacyDoTransform = legacyDoTransform;
|
|
8
|
-
exports.loadBricks =
|
|
8
|
+
exports.loadBricks = void 0;
|
|
9
9
|
exports.mountUseBrick = mountUseBrick;
|
|
10
|
-
exports.renderPreviewBricks = renderPreviewBricks;
|
|
11
10
|
exports.renderUseBrick = renderUseBrick;
|
|
12
11
|
exports.unmountUseBrick = unmountUseBrick;
|
|
13
12
|
exports.updateSnippetPreviewSettings = void 0;
|
|
@@ -22,8 +21,6 @@ var _Runtime = require("./Runtime.js");
|
|
|
22
21
|
var _Renderer = require("./Renderer.js");
|
|
23
22
|
var _RendererContext = require("./RendererContext.js");
|
|
24
23
|
var _mount = require("./mount.js");
|
|
25
|
-
var _handleHttpError = require("../handleHttpError.js");
|
|
26
|
-
var _themeAndMode = require("../themeAndMode.js");
|
|
27
24
|
var _enums = require("./enums.js");
|
|
28
25
|
var _computeRealValue = require("./compute/computeRealValue.js");
|
|
29
26
|
var _isStrictMode = require("../isStrictMode.js");
|
|
@@ -41,7 +38,7 @@ async function renderUseBrick(useBrick, data) {
|
|
|
41
38
|
tplStateStoreScope
|
|
42
39
|
};
|
|
43
40
|
(_runtimeContext$tplSt = runtimeContext.tplStateStoreMap) !== null && _runtimeContext$tplSt !== void 0 ? _runtimeContext$tplSt : runtimeContext.tplStateStoreMap = new Map();
|
|
44
|
-
const rendererContext = new _RendererContext.RendererContext("
|
|
41
|
+
const rendererContext = new _RendererContext.RendererContext("fragment");
|
|
45
42
|
const renderRoot = {
|
|
46
43
|
tag: _enums.RenderTag.ROOT,
|
|
47
44
|
// Will set during `mountUseBrick`
|
|
@@ -106,74 +103,11 @@ function unmountUseBrick({
|
|
|
106
103
|
rendererContext.dispatchOnUnmount();
|
|
107
104
|
rendererContext.dispose();
|
|
108
105
|
}
|
|
109
|
-
|
|
110
|
-
function initializePreviewBootstrap(bootstrapData) {
|
|
111
|
-
(0, _Runtime._internalApiSetBootstrapData)(bootstrapData);
|
|
106
|
+
function initializePlayground() {
|
|
112
107
|
// Todo: allow configuration of notification bricks.
|
|
113
108
|
(0, _Notification.loadNotificationService)("shoelace.show-notification");
|
|
114
109
|
(0, _Dialog.loadDialogService)("shoelace.show-dialog");
|
|
115
110
|
}
|
|
116
|
-
async function renderPreviewBricks(bricks, mountPoints, options = {}) {
|
|
117
|
-
const runtimeContext = {
|
|
118
|
-
pendingPermissionsPreCheck: [],
|
|
119
|
-
tplStateStoreMap: new Map()
|
|
120
|
-
};
|
|
121
|
-
const previousRendererContext = _rendererContext;
|
|
122
|
-
const rendererContext = _rendererContext = new _RendererContext.RendererContext("router");
|
|
123
|
-
const renderRoot = {
|
|
124
|
-
tag: _enums.RenderTag.ROOT,
|
|
125
|
-
container: mountPoints.main,
|
|
126
|
-
createPortal: mountPoints.portal
|
|
127
|
-
};
|
|
128
|
-
let failed = false;
|
|
129
|
-
let output;
|
|
130
|
-
try {
|
|
131
|
-
output = await (0, _Renderer.renderBricks)(renderRoot, bricks, runtimeContext, rendererContext);
|
|
132
|
-
output.blockingList.push(...[...runtimeContext.tplStateStoreMap.values()].map(store => store.waitForAll()), ...runtimeContext.pendingPermissionsPreCheck);
|
|
133
|
-
(0, _loader.flushStableLoadBricks)();
|
|
134
|
-
await Promise.all(output.blockingList);
|
|
135
|
-
} catch (error) {
|
|
136
|
-
failed = true;
|
|
137
|
-
output = {
|
|
138
|
-
node: {
|
|
139
|
-
tag: _enums.RenderTag.BRICK,
|
|
140
|
-
type: "div",
|
|
141
|
-
properties: {
|
|
142
|
-
textContent: (0, _handleHttpError.httpErrorToString)(error)
|
|
143
|
-
},
|
|
144
|
-
return: renderRoot,
|
|
145
|
-
runtimeContext: null
|
|
146
|
-
},
|
|
147
|
-
blockingList: [],
|
|
148
|
-
menuRequests: []
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
renderRoot.child = output.node;
|
|
152
|
-
previousRendererContext === null || previousRendererContext === void 0 ? void 0 : previousRendererContext.dispose();
|
|
153
|
-
(0, _mount.unmountTree)(mountPoints.main);
|
|
154
|
-
(0, _mount.unmountTree)(mountPoints.portal);
|
|
155
|
-
if (options.sandbox) {
|
|
156
|
-
var _options$theme;
|
|
157
|
-
(0, _themeAndMode.setTheme)((_options$theme = options.theme) !== null && _options$theme !== void 0 ? _options$theme : "light");
|
|
158
|
-
(0, _themeAndMode.setMode)("default");
|
|
159
|
-
if (!failed) {
|
|
160
|
-
rendererContext.dispatchBeforePageLoad();
|
|
161
|
-
}
|
|
162
|
-
(0, _themeAndMode.applyTheme)();
|
|
163
|
-
(0, _themeAndMode.applyMode)();
|
|
164
|
-
}
|
|
165
|
-
(0, _mount.mountTree)(renderRoot);
|
|
166
|
-
if (options.sandbox) {
|
|
167
|
-
window.scrollTo(0, 0);
|
|
168
|
-
}
|
|
169
|
-
if (!failed) {
|
|
170
|
-
rendererContext.dispatchPageLoad();
|
|
171
|
-
// rendererContext.dispatchAnchorLoad();
|
|
172
|
-
rendererContext.dispatchOnMount();
|
|
173
|
-
rendererContext.initializeScrollIntoView();
|
|
174
|
-
rendererContext.initializeMediaChange();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
111
|
function legacyDoTransform(data, to, options) {
|
|
178
112
|
if (options) {
|
|
179
113
|
throw new Error("Legacy doTransform does not support options in v3");
|
|
@@ -185,11 +119,8 @@ function legacyDoTransform(data, to, options) {
|
|
|
185
119
|
noInject: true
|
|
186
120
|
});
|
|
187
121
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
function loadBricks(bricks) {
|
|
191
|
-
return (0, _loader.loadBricksImperatively)(bricks, (0, _Runtime.getBrickPackages)());
|
|
192
|
-
}
|
|
122
|
+
const loadBricks = _Runtime._internalApiLoadBricks;
|
|
123
|
+
exports.loadBricks = loadBricks;
|
|
193
124
|
function updateStoryboard(appId, storyboardPatch) {
|
|
194
125
|
const storyboard = (0, _Runtime._internalApiGetStoryboardInBootstrapData)(appId);
|
|
195
126
|
Object.assign(storyboard, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret_internals.js","names":["_loader","require","_lodash","_Runtime","_Renderer","_RendererContext","_mount","_handleHttpError","_themeAndMode","_enums","_computeRealValue","_isStrictMode","_CustomTemplates","_registerAppI18n","_Notification","_Dialog","renderUseBrick","useBrick","data","_runtimeContext$tplSt","_output$node","tplStateStoreScope","runtimeContext","_internalApiGetRuntimeContext","pendingPermissionsPreCheck","tplStateStoreMap","Map","rendererContext","RendererContext","renderRoot","tag","RenderTag","ROOT","createPortal","transform","strict","isStrictMode","warnAboutStrictMode","output","renderBrick","properties","flushStableLoadBricks","Promise","all","blockingList","map","store","waitForAll","node","portal","Error","child","tagName","type","mountUseBrick","element","portalRoot","document","querySelector","createElement","appendChild","mountTree","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","unmountUseBrick","mountResult","unmountTree","remove","dispatchOnUnmount","dispose","_rendererContext","initializePreviewBootstrap","bootstrapData","_internalApiSetBootstrapData","loadNotificationService","loadDialogService","renderPreviewBricks","bricks","mountPoints","options","previousRendererContext","container","main","failed","renderBricks","push","values","error","BRICK","textContent","httpErrorToString","return","menuRequests","sandbox","_options$theme","setTheme","theme","setMode","dispatchBeforePageLoad","applyTheme","applyMode","window","scrollTo","dispatchPageLoad","legacyDoTransform","to","computeRealValue","noInject","loadBricks","loadBricksImperatively","getBrickPackages","updateStoryboard","appId","storyboardPatch","storyboard","_internalApiGetStoryboardInBootstrapData","Object","assign","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","registerAppI18n","updateStoryboardByRoute","newRoute","match","getKey","route","path","exact","replaceRoute","routes","key","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","customTemplates","define","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","pick","updateStoryboardBySnippet","snippetData","_snippetData$bricks","snippetId","length","updateSnippetPreviewSettings","exports","previewRouteIndex","findIndex","newPreviewRoute","menu","splice"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BootstrapData,\n BrickConf,\n CustomTemplate,\n RouteConf,\n SiteTheme,\n Storyboard,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport {\n flushStableLoadBricks,\n loadBricksImperatively,\n} from \"@next-core/loader\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n _internalApiSetBootstrapData,\n getBrickPackages,\n} from \"./Runtime.js\";\nimport { RenderOutput, renderBrick, renderBricks } from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { httpErrorToString } from \"../handleHttpError.js\";\nimport { applyMode, applyTheme, setMode, setTheme } from \"../themeAndMode.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 { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n}\n\nexport async function renderUseBrick(\n useBrick: UseSingleBrickConf,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const runtimeContext: RuntimeContext = {\n ..._internalApiGetRuntimeContext()!,\n data,\n pendingPermissionsPreCheck: [],\n tplStateStoreScope,\n };\n\n runtimeContext.tplStateStoreMap ??= new Map();\n\n const rendererContext = new RendererContext(\"useBrick\");\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 runtimeContext,\n rendererContext\n );\n\n flushStableLoadBricks();\n\n await Promise.all([\n ...output.blockingList,\n // Wait for local tpl state stores belong to current `useBrick` only.\n ...tplStateStoreScope.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\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 };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext }: 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\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\nlet _rendererContext: RendererContext;\n\nexport function initializePreviewBootstrap(\n bootstrapData: Partial<BootstrapData>\n) {\n _internalApiSetBootstrapData(bootstrapData);\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n}\n\nexport async function renderPreviewBricks(\n bricks: BrickConf[],\n mountPoints: {\n main: HTMLElement;\n portal: HTMLElement;\n },\n options: {\n sandbox?: boolean;\n theme?: SiteTheme;\n } = {}\n) {\n const runtimeContext = {\n pendingPermissionsPreCheck: [],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n } as Partial<RuntimeContext> as RuntimeContext;\n\n const previousRendererContext = _rendererContext;\n const rendererContext = (_rendererContext = new RendererContext(\"router\"));\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container: mountPoints.main,\n createPortal: mountPoints.portal,\n };\n\n let failed = false;\n let output: RenderOutput;\n try {\n output = await renderBricks(\n renderRoot,\n bricks,\n runtimeContext,\n rendererContext\n );\n\n output.blockingList.push(\n ...[...runtimeContext.tplStateStoreMap.values()].map((store) =>\n store.waitForAll()\n ),\n ...runtimeContext.pendingPermissionsPreCheck\n );\n\n flushStableLoadBricks();\n\n await Promise.all(output.blockingList);\n } catch (error) {\n failed = true;\n output = {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n return: renderRoot,\n runtimeContext: null!,\n },\n blockingList: [],\n menuRequests: [],\n };\n }\n\n renderRoot.child = output.node;\n\n previousRendererContext?.dispose();\n unmountTree(mountPoints.main);\n unmountTree(mountPoints.portal);\n\n if (options.sandbox) {\n setTheme(options.theme ?? \"light\");\n setMode(\"default\");\n\n if (!failed) {\n rendererContext.dispatchBeforePageLoad();\n }\n\n applyTheme();\n applyMode();\n }\n\n mountTree(renderRoot);\n\n if (options.sandbox) {\n window.scrollTo(0, 0);\n }\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n // rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n }\n}\n\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\n// istanbul ignore next\nexport function loadBricks(bricks: string[] | Set<string>) {\n return loadBricksImperatively(bricks, getBrickPackages());\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\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetData.snippetId}`,\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }]\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\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"],"mappings":";;;;;;;;;;;;;;;;;;AASA,IAAAA,OAAA,GAAAC,OAAA;AAIA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAMA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAGA,IAAAK,M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I,EAACX,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS;EAClE,CAAC,CACF,CACF;AACH;AAEO,SAASY,yBAAyBA,CACvCpC,KAAa,EACbqC,WAGC,EACK;EAAA,IAAAC,mBAAA;EACNL,sBAAsB,CACpBjC,KAAK,EACJ,+CAA8CqC,WAAW,CAACE,SAAU,EAAC,EACtE,CAAAD,mBAAA,GAAAD,WAAW,CAACxE,MAAM,cAAAyE,mBAAA,eAAlBA,mBAAA,CAAoBE,MAAM,GAAGH,WAAW,CAACxE,MAAM,GAAG,CAAC;IAAEqE,KAAK,EAAE;EAAO,CAAC,CAAC,CACtE;AACH;AAEO,MAAMO,4BAA4B,GAAGL,yBAAyB;AAACM,OAAA,CAAAD,4BAAA,GAAAA,4BAAA;AAEtE,SAASR,sBAAsBA,CAC7BjC,KAAa,EACbe,IAAY,EACZlD,MAAmB,EACnB;EACA,MAAM;IAAEqD;EAAO,CAAC,GAAG,IAAAf,iDAAwC,EAACH,KAAK,CAAE;EACnE,MAAM2C,iBAAiB,GAAGzB,MAAM,CAAC0B,SAAS,CAAE9B,KAAK,IAAKA,KAAK,CAACC,IAAI,KAAKA,IAAI,CAAC;EAC1E,MAAM8B,eAA0B,GAAG;IACjC9B,IAAI;IACJlD,MAAM;IACNiF,IAAI,EAAE,KAAK;IACX9B,KAAK,EAAE;EACT,CAAC;EACD,IAAI2B,iBAAiB,KAAK,CAAC,CAAC,EAAE;IAC5BzB,MAAM,CAACG,OAAO,CAACwB,eAAe,CAAC;EACjC,CAAC,MAAM;IACL3B,MAAM,CAAC6B,MAAM,CAACJ,iBAAiB,EAAE,CAAC,EAAEE,eAAe,CAAC;EACtD;AACF"}
|
|
1
|
+
{"version":3,"file":"secret_internals.js","names":["_loader","require","_lodash","_Runtime","_Renderer","_RendererContext","_mount","_enums","_computeRealValue","_isStrictMode","_CustomTemplates","_registerAppI18n","_Notification","_Dialog","renderUseBrick","useBrick","data","_runtimeContext$tplSt","_output$node","tplStateStoreScope","runtimeContext","_internalApiGetRuntimeContext","pendingPermissionsPreCheck","tplStateStoreMap","Map","rendererContext","RendererContext","renderRoot","tag","RenderTag","ROOT","createPortal","transform","strict","isStrictMode","warnAboutStrictMode","output","renderBrick","properties","flushStableLoadBricks","Promise","all","blockingList","map","store","waitForAll","node","portal","Error","child","tagName","type","mountUseBrick","element","portalRoot","document","querySelector","createElement","appendChild","mountTree","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","unmountUseBrick","mountResult","unmountTree","remove","dispatchOnUnmount","dispose","initializePlayground","loadNotificationService","loadDialogService","legacyDoTransform","to","options","computeRealValue","noInject","loadBricks","_internalApiLoadBricks","exports","updateStoryboard","appId","storyboardPatch","storyboard","_internalApiGetStoryboardInBootstrapData","Object","assign","$$fulfilling","$$fulfilled","$$registerCustomTemplateProcessed","registerAppI18n","updateStoryboardByRoute","newRoute","match","getKey","route","path","exact","replaceRoute","routes","key","routeKey","unshift","updateStoryboardByTemplate","newTemplate","settings","tplName","name","customTemplates","define","bricks","proxy","state","updateTemplatePreviewSettings","templateId","_updatePreviewSettings","brick","pick","updateStoryboardBySnippet","snippetData","_snippetData$bricks","snippetId","length","updateSnippetPreviewSettings","previewRouteIndex","findIndex","newPreviewRoute","menu","splice"],"sources":["../../../src/internal/secret_internals.ts"],"sourcesContent":["import type {\n BrickConf,\n CustomTemplate,\n RouteConf,\n Storyboard,\n UseSingleBrickConf,\n} from \"@next-core/types\";\nimport { flushStableLoadBricks } from \"@next-core/loader\";\nimport { pick } from \"lodash\";\nimport {\n _internalApiGetRuntimeContext,\n _internalApiGetStoryboardInBootstrapData,\n _internalApiLoadBricks,\n} from \"./Runtime.js\";\nimport { renderBrick } from \"./Renderer.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport type { DataStore } from \"./data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } 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 { loadNotificationService } from \"../Notification.js\";\nimport { loadDialogService } from \"../Dialog.js\";\n\nexport interface RenderUseBrickResult {\n tagName: string | null;\n renderRoot: RenderRoot;\n rendererContext: RendererContext;\n}\n\nexport async function renderUseBrick(\n useBrick: UseSingleBrickConf,\n data: unknown\n): Promise<RenderUseBrickResult> {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const runtimeContext: RuntimeContext = {\n ..._internalApiGetRuntimeContext()!,\n data,\n pendingPermissionsPreCheck: [],\n tplStateStoreScope,\n };\n\n runtimeContext.tplStateStoreMap ??= 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 runtimeContext,\n rendererContext\n );\n\n flushStableLoadBricks();\n\n await Promise.all([\n ...output.blockingList,\n // Wait for local tpl state stores belong to current `useBrick` only.\n ...tplStateStoreScope.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\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 };\n}\n\nexport interface MountUseBrickResult {\n portal?: HTMLElement;\n}\n\nexport function mountUseBrick(\n { renderRoot, rendererContext }: 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\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\nexport function initializePlayground() {\n // Todo: allow configuration of notification bricks.\n loadNotificationService(\"shoelace.show-notification\");\n loadDialogService(\"shoelace.show-dialog\");\n}\n\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 const loadBricks = _internalApiLoadBricks;\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\nexport function updateStoryboardBySnippet(\n appId: string,\n snippetData: {\n snippetId: string;\n bricks?: BrickConf[];\n }\n): void {\n _updatePreviewSettings(\n appId,\n `\\${APP.homepage}/_dev_only_/snippet-preview/${snippetData.snippetId}`,\n snippetData.bricks?.length ? snippetData.bricks : [{ brick: \"span\" }]\n );\n}\n\nexport const updateSnippetPreviewSettings = updateStoryboardBySnippet;\n\nfunction _updatePreviewSettings(\n appId: string,\n path: string,\n bricks: BrickConf[]\n) {\n const { routes } = _internalApiGetStoryboardInBootstrapData(appId)!;\n const previewRouteIndex = routes.findIndex((route) => route.path === path);\n const newPreviewRoute: RouteConf = {\n path,\n bricks,\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"],"mappings":";;;;;;;;;;;;;;;;;AAOA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,Q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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { _internalApiLoadBricks } from "./internal/Runtime.js";
|
|
2
2
|
var brick;
|
|
3
3
|
function show(options) {
|
|
4
4
|
if (brick) {
|
|
@@ -23,7 +23,7 @@ function show(options) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
export function loadDialogService(tagName) {
|
|
26
|
-
|
|
26
|
+
_internalApiLoadBricks([tagName]).then(() => {
|
|
27
27
|
brick = document.createElement(tagName);
|
|
28
28
|
}, error => {
|
|
29
29
|
// eslint-disable-next-line no-console
|
package/dist/esm/Dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","names":["
|
|
1
|
+
{"version":3,"file":"Dialog.js","names":["_internalApiLoadBricks","brick","show","options","resolve","type","confirm","content","Promise","setTimeout","reject","alert","loadDialogService","tagName","then","document","createElement","error","console","Dialog","Object","freeze"],"sources":["../../src/Dialog.ts"],"sourcesContent":["import { _internalApiLoadBricks } from \"./internal/Runtime.js\";\n\nlet brick: {\n resolve(options: DialogOptions): Promise<void>;\n};\n\nfunction show(options: DialogOptions): Promise<void> {\n if (brick) {\n return brick.resolve(options);\n } else {\n if (options.type === \"confirm\") {\n if (confirm(options.content)) {\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1)\n );\n } else {\n return new Promise((resolve, reject) =>\n setTimeout(() => {\n reject();\n }, 1)\n );\n }\n } else {\n alert(options.content);\n return new Promise((resolve) =>\n setTimeout(() => {\n resolve();\n }, 1000)\n );\n }\n }\n}\n\nexport function loadDialogService(tagName: string) {\n _internalApiLoadBricks([tagName]).then(\n () => {\n brick = document.createElement(tagName) as any;\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load dialog service failed:\", error);\n }\n );\n}\n\nexport interface DialogOptions {\n type?: \"success\" | \"error\" | \"warn\" | \"info\" | \"confirm\";\n title?: string | null;\n content: string;\n contentStyle?: object;\n}\n\nexport const Dialog = Object.freeze({\n show,\n});\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,uBAAuB;AAE9D,IAAIC,KAEH;AAED,SAASC,IAAIA,CAACC,OAAsB,EAAiB;EACnD,IAAIF,KAAK,EAAE;IACT,OAAOA,KAAK,CAACG,OAAO,CAACD,OAAO,CAAC;EAC/B,CAAC,MAAM;IACL,IAAIA,OAAO,CAACE,IAAI,KAAK,SAAS,EAAE;MAC9B,IAAIC,OAAO,CAACH,OAAO,CAACI,OAAO,CAAC,EAAE;QAC5B,OAAO,IAAIC,OAAO,CAAEJ,OAAO,IACzBK,UAAU,CAAC,MAAM;UACfL,OAAO,EAAE;QACX,CAAC,EAAE,CAAC,CAAC,CACN;MACH,CAAC,MAAM;QACL,OAAO,IAAII,OAAO,CAAC,CAACJ,OAAO,EAAEM,MAAM,KACjCD,UAAU,CAAC,MAAM;UACfC,MAAM,EAAE;QACV,CAAC,EAAE,CAAC,CAAC,CACN;MACH;IACF,CAAC,MAAM;MACLC,KAAK,CAACR,OAAO,CAACI,OAAO,CAAC;MACtB,OAAO,IAAIC,OAAO,CAAEJ,OAAO,IACzBK,UAAU,CAAC,MAAM;QACfL,OAAO,EAAE;MACX,CAAC,EAAE,IAAI,CAAC,CACT;IACH;EACF;AACF;AAEA,OAAO,SAASQ,iBAAiBA,CAACC,OAAe,EAAE;EACjDb,sBAAsB,CAAC,CAACa,OAAO,CAAC,CAAC,CAACC,IAAI,CACpC,MAAM;IACJb,KAAK,GAAGc,QAAQ,CAACC,aAAa,CAACH,OAAO,CAAQ;EAChD,CAAC,EACAI,KAAc,IAAK;IAClB;IACAC,OAAO,CAACD,KAAK,CAAC,6BAA6B,EAAEA,KAAK,CAAC;EACrD,CAAC,CACF;AACH;AASA,OAAO,IAAME,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;EAClCnB;AACF,CAAC,CAAC"}
|
package/dist/esm/Notification.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { _internalApiLoadBricks } from "./internal/Runtime.js";
|
|
2
2
|
var brick;
|
|
3
3
|
function show(options) {
|
|
4
4
|
if (brick) {
|
|
@@ -8,7 +8,7 @@ function show(options) {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
export function loadNotificationService(tagName) {
|
|
11
|
-
|
|
11
|
+
_internalApiLoadBricks([tagName]).then(() => {
|
|
12
12
|
brick = document.createElement(tagName);
|
|
13
13
|
}, error => {
|
|
14
14
|
// eslint-disable-next-line no-console
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.js","names":["
|
|
1
|
+
{"version":3,"file":"Notification.js","names":["_internalApiLoadBricks","brick","show","options","resolve","alert","message","loadNotificationService","tagName","then","document","createElement","error","console","Notification","Object","freeze"],"sources":["../../src/Notification.ts"],"sourcesContent":["import { _internalApiLoadBricks } from \"./internal/Runtime.js\";\n\nlet brick: {\n resolve(options: NotificationOptions): void;\n};\n\nfunction show(options: NotificationOptions) {\n if (brick) {\n brick.resolve(options);\n } else {\n alert(options.message);\n }\n}\n\nexport function loadNotificationService(tagName: string) {\n _internalApiLoadBricks([tagName]).then(\n () => {\n brick = document.createElement(tagName) as any;\n },\n (error: unknown) => {\n // eslint-disable-next-line no-console\n console.error(\"Load notification service failed:\", error);\n }\n );\n}\n\nexport interface NotificationOptions {\n type?: \"success\" | \"error\" | \"warn\" | \"info\";\n message: string;\n}\n\nexport const Notification = Object.freeze({\n show,\n});\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,uBAAuB;AAE9D,IAAIC,KAEH;AAED,SAASC,IAAIA,CAACC,OAA4B,EAAE;EAC1C,IAAIF,KAAK,EAAE;IACTA,KAAK,CAACG,OAAO,CAACD,OAAO,CAAC;EACxB,CAAC,MAAM;IACLE,KAAK,CAACF,OAAO,CAACG,OAAO,CAAC;EACxB;AACF;AAEA,OAAO,SAASC,uBAAuBA,CAACC,OAAe,EAAE;EACvDR,sBAAsB,CAAC,CAACQ,OAAO,CAAC,CAAC,CAACC,IAAI,CACpC,MAAM;IACJR,KAAK,GAAGS,QAAQ,CAACC,aAAa,CAACH,OAAO,CAAQ;EAChD,CAAC,EACAI,KAAc,IAAK;IAClB;IACAC,OAAO,CAACD,KAAK,CAAC,mCAAmC,EAAEA,KAAK,CAAC;EAC3D,CAAC,CACF;AACH;AAOA,OAAO,IAAME,YAAY,GAAGC,MAAM,CAACC,MAAM,CAAC;EACxCd;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import { flushStableLoadBricks } from "@next-core/loader";
|
|
3
|
+
import { renderBricks } from "./internal/Renderer.js";
|
|
4
|
+
import { RendererContext } from "./internal/RendererContext.js";
|
|
5
|
+
import { mountTree, unmountTree } from "./internal/mount.js";
|
|
6
|
+
import { httpErrorToString } from "./handleHttpError.js";
|
|
7
|
+
import { applyMode, applyTheme, setMode, setTheme } from "./themeAndMode.js";
|
|
8
|
+
import { RenderTag } from "./internal/enums.js";
|
|
9
|
+
export function unstable_createRoot(container) {
|
|
10
|
+
var {
|
|
11
|
+
portal: _portal,
|
|
12
|
+
scope = "fragment"
|
|
13
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
14
|
+
var portal = _portal;
|
|
15
|
+
var createPortal;
|
|
16
|
+
if (_portal) {
|
|
17
|
+
createPortal = _portal;
|
|
18
|
+
} else {
|
|
19
|
+
// Create portal container when necessary.
|
|
20
|
+
createPortal = () => {
|
|
21
|
+
portal = document.createElement("div");
|
|
22
|
+
portal.style.position = "absolute";
|
|
23
|
+
portal.style.width = portal.style.height = "0";
|
|
24
|
+
document.body.append(portal);
|
|
25
|
+
return portal;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
var unmounted = false;
|
|
29
|
+
var rendererContext;
|
|
30
|
+
return {
|
|
31
|
+
render(brick) {
|
|
32
|
+
var _arguments = arguments;
|
|
33
|
+
return _asyncToGenerator(function* () {
|
|
34
|
+
var {
|
|
35
|
+
theme
|
|
36
|
+
} = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : {};
|
|
37
|
+
if (unmounted) {
|
|
38
|
+
throw new Error("The root is unmounted and cannot be rendered any more");
|
|
39
|
+
}
|
|
40
|
+
var bricks = [].concat(brick);
|
|
41
|
+
var runtimeContext = {
|
|
42
|
+
pendingPermissionsPreCheck: [],
|
|
43
|
+
tplStateStoreMap: new Map()
|
|
44
|
+
};
|
|
45
|
+
var previousRendererContext = rendererContext;
|
|
46
|
+
rendererContext = new RendererContext(scope);
|
|
47
|
+
var renderRoot = {
|
|
48
|
+
tag: RenderTag.ROOT,
|
|
49
|
+
container,
|
|
50
|
+
createPortal
|
|
51
|
+
};
|
|
52
|
+
var failed = false;
|
|
53
|
+
var output;
|
|
54
|
+
try {
|
|
55
|
+
output = yield renderBricks(renderRoot, bricks, runtimeContext, rendererContext);
|
|
56
|
+
output.blockingList.push(...[...runtimeContext.tplStateStoreMap.values()].map(store => store.waitForAll()), ...runtimeContext.pendingPermissionsPreCheck);
|
|
57
|
+
flushStableLoadBricks();
|
|
58
|
+
yield Promise.all(output.blockingList);
|
|
59
|
+
} catch (error) {
|
|
60
|
+
failed = true;
|
|
61
|
+
output = {
|
|
62
|
+
node: {
|
|
63
|
+
tag: RenderTag.BRICK,
|
|
64
|
+
type: "div",
|
|
65
|
+
properties: {
|
|
66
|
+
textContent: httpErrorToString(error)
|
|
67
|
+
},
|
|
68
|
+
return: renderRoot,
|
|
69
|
+
runtimeContext: null
|
|
70
|
+
},
|
|
71
|
+
blockingList: [],
|
|
72
|
+
menuRequests: []
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
renderRoot.child = output.node;
|
|
76
|
+
previousRendererContext === null || previousRendererContext === void 0 ? void 0 : previousRendererContext.dispose();
|
|
77
|
+
unmountTree(container);
|
|
78
|
+
if (portal) {
|
|
79
|
+
unmountTree(portal);
|
|
80
|
+
}
|
|
81
|
+
if (scope === "page") {
|
|
82
|
+
setTheme(theme !== null && theme !== void 0 ? theme : "light");
|
|
83
|
+
setMode("default");
|
|
84
|
+
if (!failed) {
|
|
85
|
+
rendererContext.dispatchBeforePageLoad();
|
|
86
|
+
}
|
|
87
|
+
applyTheme();
|
|
88
|
+
applyMode();
|
|
89
|
+
}
|
|
90
|
+
mountTree(renderRoot);
|
|
91
|
+
if (scope === "page") {
|
|
92
|
+
window.scrollTo(0, 0);
|
|
93
|
+
}
|
|
94
|
+
if (!failed) {
|
|
95
|
+
if (scope === "page") {
|
|
96
|
+
rendererContext.dispatchPageLoad();
|
|
97
|
+
// rendererContext.dispatchAnchorLoad();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
rendererContext.dispatchOnMount();
|
|
101
|
+
rendererContext.initializeScrollIntoView();
|
|
102
|
+
rendererContext.initializeMediaChange();
|
|
103
|
+
}
|
|
104
|
+
})();
|
|
105
|
+
},
|
|
106
|
+
unmount() {
|
|
107
|
+
if (unmounted) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
unmounted = true;
|
|
111
|
+
unmountTree(container);
|
|
112
|
+
if (portal) {
|
|
113
|
+
unmountTree(portal);
|
|
114
|
+
// Only remove the portal from its parent when it's dynamic created.
|
|
115
|
+
if (!_portal) {
|
|
116
|
+
portal.remove();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=createRoot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRoot.js","names":["flushStableLoadBricks","renderBricks","RendererContext","mountTree","unmountTree","httpErrorToString","applyMode","applyTheme","setMode","setTheme","RenderTag","unstable_createRoot","container","portal","_portal","scope","arguments","length","undefined","createPortal","document","createElement","style","position","width","height","body","append","unmounted","rendererContext","render","brick","_arguments","_asyncToGenerator","theme","Error","bricks","concat","runtimeContext","pendingPermissionsPreCheck","tplStateStoreMap","Map","previousRendererContext","renderRoot","tag","ROOT","failed","output","blockingList","push","values","map","store","waitForAll","Promise","all","error","node","BRICK","type","properties","textContent","return","menuRequests","child","dispose","dispatchBeforePageLoad","window","scrollTo","dispatchPageLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","unmount","remove"],"sources":["../../src/createRoot.ts"],"sourcesContent":["import type { BrickConf, SiteTheme } from \"@next-core/types\";\nimport { flushStableLoadBricks } from \"@next-core/loader\";\nimport { RenderOutput, renderBricks } from \"./internal/Renderer.js\";\nimport { RendererContext } from \"./internal/RendererContext.js\";\nimport type { DataStore } from \"./internal/data/DataStore.js\";\nimport type { RenderRoot, RuntimeContext } from \"./internal/interfaces.js\";\nimport { mountTree, unmountTree } from \"./internal/mount.js\";\nimport { httpErrorToString } from \"./handleHttpError.js\";\nimport { applyMode, applyTheme, setMode, setTheme } from \"./themeAndMode.js\";\nimport { RenderTag } from \"./internal/enums.js\";\n\nexport interface CreateRootOptions {\n portal?: HTMLElement;\n /**\n * Defaults to \"fragment\"\n * - page: render as whole page, triggering page life cycles.\n * - fragment: render as fragment, not triggering page life cycles.\n */\n scope?: \"page\" | \"fragment\";\n}\n\nexport interface RenderOptions {\n theme?: SiteTheme;\n}\n\nexport function unstable_createRoot(\n container: HTMLElement,\n { portal: _portal, scope = \"fragment\" }: CreateRootOptions = {}\n) {\n let portal = _portal;\n let createPortal: RenderRoot[\"createPortal\"];\n if (_portal) {\n createPortal = _portal;\n } else {\n // Create portal container when necessary.\n createPortal = () => {\n portal = document.createElement(\"div\");\n portal.style.position = \"absolute\";\n portal.style.width = portal.style.height = \"0\";\n document.body.append(portal);\n return portal;\n };\n }\n let unmounted = false;\n let rendererContext: RendererContext | undefined;\n\n return {\n async render(\n brick: BrickConf | BrickConf[],\n { theme }: RenderOptions = {}\n ) {\n if (unmounted) {\n throw new Error(\n \"The root is unmounted and cannot be rendered any more\"\n );\n }\n const bricks = ([] as BrickConf[]).concat(brick);\n const runtimeContext = {\n pendingPermissionsPreCheck: [],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n } as Partial<RuntimeContext> as RuntimeContext;\n\n const previousRendererContext = rendererContext;\n rendererContext = new RendererContext(scope);\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container,\n createPortal,\n };\n\n let failed = false;\n let output: RenderOutput;\n try {\n output = await renderBricks(\n renderRoot,\n bricks,\n runtimeContext,\n rendererContext\n );\n\n output.blockingList.push(\n ...[...runtimeContext.tplStateStoreMap.values()].map((store) =>\n store.waitForAll()\n ),\n ...runtimeContext.pendingPermissionsPreCheck\n );\n\n flushStableLoadBricks();\n\n await Promise.all(output.blockingList);\n } catch (error) {\n failed = true;\n output = {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n return: renderRoot,\n runtimeContext: null!,\n },\n blockingList: [],\n menuRequests: [],\n };\n }\n\n renderRoot.child = output.node;\n\n previousRendererContext?.dispose();\n unmountTree(container);\n if (portal) {\n unmountTree(portal);\n }\n\n if (scope === \"page\") {\n setTheme(theme ?? \"light\");\n setMode(\"default\");\n\n if (!failed) {\n rendererContext.dispatchBeforePageLoad();\n }\n\n applyTheme();\n applyMode();\n }\n\n mountTree(renderRoot);\n\n if (scope === \"page\") {\n window.scrollTo(0, 0);\n }\n\n if (!failed) {\n if (scope === \"page\") {\n rendererContext.dispatchPageLoad();\n // rendererContext.dispatchAnchorLoad();\n }\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n }\n },\n unmount() {\n if (unmounted) {\n return;\n }\n unmounted = true;\n unmountTree(container);\n if (portal) {\n unmountTree(portal);\n // Only remove the portal from its parent when it's dynamic created.\n if (!_portal) {\n portal.remove();\n }\n }\n },\n };\n}\n"],"mappings":";AACA,SAASA,qBAAqB,QAAQ,mBAAmB;AACzD,SAAuBC,YAAY,QAAQ,wBAAwB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AuB,uBAAvBA,uBAAuB,CAAEuB,OAAO,EAAE;QAClC7D,WAAW,CAACQ,SAAS,CAAC;QACtB,IAAIC,MAAM,EAAE;UACVT,WAAW,CAACS,MAAM,CAAC;QACrB;QAEA,IAAIE,KAAK,KAAK,MAAM,EAAE;UACpBN,QAAQ,CAACyB,KAAK,aAALA,KAAK,cAALA,KAAK,GAAI,OAAO,CAAC;UAC1B1B,OAAO,CAAC,SAAS,CAAC;UAElB,IAAI,CAACsC,MAAM,EAAE;YACXjB,eAAe,CAACqC,sBAAsB,EAAE;UAC1C;UAEA3D,UAAU,EAAE;UACZD,SAAS,EAAE;QACb;QAEAH,SAAS,CAACwC,UAAU,CAAC;QAErB,IAAI5B,KAAK,KAAK,MAAM,EAAE;UACpBoD,MAAM,CAACC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;QACvB;QAEA,IAAI,CAACtB,MAAM,EAAE;UACX,IAAI/B,KAAK,KAAK,MAAM,EAAE;YACpBc,eAAe,CAACwC,gBAAgB,EAAE;YAClC;UACF;;UACAxC,eAAe,CAACyC,eAAe,EAAE;UACjCzC,eAAe,CAAC0C,wBAAwB,EAAE;UAC1C1C,eAAe,CAAC2C,qBAAqB,EAAE;QACzC;MAAC;IACH,CAAC;IACDC,OAAOA,CAAA,EAAG;MACR,IAAI7C,SAAS,EAAE;QACb;MACF;MACAA,SAAS,GAAG,IAAI;MAChBxB,WAAW,CAACQ,SAAS,CAAC;MACtB,IAAIC,MAAM,EAAE;QACVT,WAAW,CAACS,MAAM,CAAC;QACnB;QACA,IAAI,CAACC,OAAO,EAAE;UACZD,MAAM,CAAC6D,MAAM,EAAE;QACjB;MACF;IACF;EACF,CAAC;AACH"}
|
package/dist/esm/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./getBasePath.js";
|
|
|
6
6
|
export * from "./getPageInfo.js";
|
|
7
7
|
export * from "./handleHttpError.js";
|
|
8
8
|
export * from "./history.js";
|
|
9
|
+
export * from "./createRoot.js";
|
|
9
10
|
export { createRuntime, getRuntime } from "./internal/Runtime.js";
|
|
10
11
|
import * as __secret_internals from "./internal/secret_internals.js";
|
|
11
12
|
export { __secret_internals };
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["createRuntime","getRuntime","__secret_internals","getCssPropertyValue","getCurrentTheme","getCurrentMode","batchSetAppsLocalTheme","applyTheme","checkIfOfComputed","checkIfByTransform","registerWidgetFunctions","registerWidgetI18n","StoryboardFunctionRegistryFactory","matchPath","Notification","Dialog"],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./auth.js\";\nexport * from \"./CustomProcessors.js\";\nexport * from \"./CustomTemplates.js\";\nexport * from \"./fetchByProvider.js\";\nexport * from \"./getBasePath.js\";\nexport * from \"./getPageInfo.js\";\nexport * from \"./handleHttpError.js\";\nexport * from \"./history.js\";\nexport { createRuntime, getRuntime } from \"./internal/Runtime.js\";\nimport * as __secret_internals from \"./internal/secret_internals.js\";\nexport { __secret_internals };\nexport {\n getCssPropertyValue,\n getCurrentTheme,\n getCurrentMode,\n batchSetAppsLocalTheme,\n applyTheme,\n} from \"./themeAndMode.js\";\nexport {\n checkIfOfComputed,\n checkIfByTransform,\n} from \"./internal/compute/checkIf.js\";\nexport { registerWidgetFunctions } from \"./internal/compute/WidgetFunctions.js\";\nexport { registerWidgetI18n } from \"./internal/compute/WidgetI18n.js\";\nexport { StoryboardFunctionRegistryFactory } from \"./StoryboardFunctionRegistry.js\";\nexport { matchPath } from \"./internal/matchPath.js\";\nexport { Notification, type NotificationOptions } from \"./Notification.js\";\nexport { Dialog, type DialogOptions } from \"./Dialog.js\";\n"],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,uBAAuB;AACrC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,sBAAsB;AACpC,cAAc,cAAc;AAC5B,SAASA,aAAa,EAAEC,UAAU,QAAQ,uBAAuB;AACjE,OAAO,KAAKC,kBAAkB,MAAM,gCAAgC;AACpE,SAASA,kBAAkB;AAC3B,SACEC,mBAAmB,EACnBC,eAAe,EACfC,cAAc,EACdC,sBAAsB,EACtBC,UAAU,QACL,mBAAmB;AAC1B,SACEC,iBAAiB,EACjBC,kBAAkB,QACb,+BAA+B;AACtC,SAASC,uBAAuB,QAAQ,uCAAuC;AAC/E,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,iCAAiC,QAAQ,iCAAiC;AACnF,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,YAAY,QAAkC,mBAAmB;AAC1E,SAASC,MAAM,QAA4B,aAAa"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["createRuntime","getRuntime","__secret_internals","getCssPropertyValue","getCurrentTheme","getCurrentMode","batchSetAppsLocalTheme","applyTheme","checkIfOfComputed","checkIfByTransform","registerWidgetFunctions","registerWidgetI18n","StoryboardFunctionRegistryFactory","matchPath","Notification","Dialog"],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./auth.js\";\nexport * from \"./CustomProcessors.js\";\nexport * from \"./CustomTemplates.js\";\nexport * from \"./fetchByProvider.js\";\nexport * from \"./getBasePath.js\";\nexport * from \"./getPageInfo.js\";\nexport * from \"./handleHttpError.js\";\nexport * from \"./history.js\";\nexport * from \"./createRoot.js\";\nexport { createRuntime, getRuntime } from \"./internal/Runtime.js\";\nimport * as __secret_internals from \"./internal/secret_internals.js\";\nexport { __secret_internals };\nexport {\n getCssPropertyValue,\n getCurrentTheme,\n getCurrentMode,\n batchSetAppsLocalTheme,\n applyTheme,\n} from \"./themeAndMode.js\";\nexport {\n checkIfOfComputed,\n checkIfByTransform,\n} from \"./internal/compute/checkIf.js\";\nexport { registerWidgetFunctions } from \"./internal/compute/WidgetFunctions.js\";\nexport { registerWidgetI18n } from \"./internal/compute/WidgetI18n.js\";\nexport { StoryboardFunctionRegistryFactory } from \"./StoryboardFunctionRegistry.js\";\nexport { matchPath } from \"./internal/matchPath.js\";\nexport { Notification, type NotificationOptions } from \"./Notification.js\";\nexport { Dialog, type DialogOptions } from \"./Dialog.js\";\n"],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,uBAAuB;AACrC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,kBAAkB;AAChC,cAAc,kBAAkB;AAChC,cAAc,sBAAsB;AACpC,cAAc,cAAc;AAC5B,cAAc,iBAAiB;AAC/B,SAASA,aAAa,EAAEC,UAAU,QAAQ,uBAAuB;AACjE,OAAO,KAAKC,kBAAkB,MAAM,gCAAgC;AACpE,SAASA,kBAAkB;AAC3B,SACEC,mBAAmB,EACnBC,eAAe,EACfC,cAAc,EACdC,sBAAsB,EACtBC,UAAU,QACL,mBAAmB;AAC1B,SACEC,iBAAiB,EACjBC,kBAAkB,QACb,+BAA+B;AACtC,SAASC,uBAAuB,QAAQ,uCAAuC;AAC/E,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,SAASC,iCAAiC,QAAQ,iCAAiC;AACnF,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,YAAY,QAAkC,mBAAmB;AAC1E,SAASC,MAAM,QAA4B,aAAa"}
|
|
@@ -277,6 +277,7 @@ function _renderBrick() {
|
|
|
277
277
|
brick.properties[propName] = propValue;
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
|
+
listenOnTrackingContext(brick, trackingContextList);
|
|
280
281
|
return brick.properties;
|
|
281
282
|
});
|
|
282
283
|
return function loadProperties() {
|
|
@@ -285,9 +286,6 @@ function _renderBrick() {
|
|
|
285
286
|
}();
|
|
286
287
|
var asyncProperties = loadProperties();
|
|
287
288
|
blockingList.push(asyncProperties);
|
|
288
|
-
asyncProperties.then(() => {
|
|
289
|
-
listenOnTrackingContext(brick, trackingContextList);
|
|
290
|
-
});
|
|
291
289
|
rendererContext.registerBrickLifeCycle(brick, brickConf.lifeCycle);
|
|
292
290
|
var expandedBrickConf = brickConf;
|
|
293
291
|
if (tplTagName) {
|