@phis/ui 0.6.11 → 0.7.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/components/cms/phi-cms-area-render-scope.d.ts +2 -0
- package/components/cms/phi-cms-area-render-scope.js +1 -1
- package/components/cms/phi-cms-error-page.js +1 -1
- package/components/cms/phi-cms-page-render-scope.d.ts +0 -1
- package/components/cms/phi-cms-page-render-scope.js +1 -1
- package/components/cms/phi-cms-root-layout.js +1 -0
- package/components/cms/phi-cms-runtime-registry.d.ts +4 -4
- package/components/cms/phi-cms-runtime-registry.js +4 -4
- package/components/widgets/label-sets/region.js +2 -0
- package/components/widgets/label-types/region.d.ts +2 -0
- package/components/widgets/label-types/region.js +1 -0
- package/components/widgets/label-types/revisions.js +2 -2
- package/components/workspace/catalog-state.d.ts +17 -1
- package/components/workspace/catalog-store.js +1 -0
- package/gateway/dashboard-cards-route.js +4 -9
- package/gateway/form-handler-resolution.js +10 -34
- package/gateway/navigation-target-route.js +4 -10
- package/gateway/page-references-route.js +3 -8
- package/gateway/site-area.d.ts +43 -6
- package/gateway/site-area.js +70 -17
- package/helpers/cms-area-config.d.ts +36 -14
- package/helpers/cms-area-config.js +72 -26
- package/next/seo-routes.js +24 -28
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/presets.d.ts +0 -1
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-area-preset-tree.js +0 -2
- package/plugins/runtime-modules/admin/presets.d.ts +0 -1
- package/plugins/runtime-modules/admin/trees/phi-default-admin-area-preset-tree.js +0 -2
- package/plugins/runtime-modules/app/presets.d.ts +0 -1
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.js +0 -2
- package/plugins/runtime-modules/area-definitions.d.ts +17 -0
- package/plugins/runtime-modules/area-definitions.js +6 -0
- package/plugins/runtime-modules/builder/area-shell-presets.server.d.ts +21 -5
- package/plugins/runtime-modules/builder/area-shell-presets.server.js +171 -63
- package/plugins/runtime-modules/builder/clients/shells-workspace.js +12 -1
- package/plugins/runtime-modules/builder/controller/client.js +2 -0
- package/plugins/runtime-modules/builder/controller/definition.d.ts +1 -0
- package/plugins/runtime-modules/builder/controller/draft-command-controller.d.ts +2 -3
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +56 -25
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +13 -7
- package/plugins/runtime-modules/builder/controller/server-definition.d.ts +1 -0
- package/plugins/runtime-modules/builder/controller/server-definition.js +7 -4
- package/plugins/runtime-modules/builder/controller/workspace-controller.d.ts +2 -1
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +9 -3
- package/plugins/runtime-modules/builder/data-providers.d.ts +1 -1
- package/plugins/runtime-modules/builder/definition.d.ts +1 -1
- package/plugins/runtime-modules/builder/developer-workspace-store.js +1 -0
- package/plugins/runtime-modules/builder/page-preset-catalog.server.d.ts +0 -2
- package/plugins/runtime-modules/builder/page-preset-catalog.server.js +0 -16
- package/plugins/runtime-modules/builder/persistence.d.ts +20 -25
- package/plugins/runtime-modules/builder/persistence.js +67 -75
- package/plugins/runtime-modules/builder/services/runtime-modules-table.d.ts +17 -0
- package/plugins/runtime-modules/builder/services/runtime-modules-table.js +79 -2
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.d.ts +0 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +0 -2
- package/plugins/runtime-modules/builder/workspace-catalog-actions.d.ts +2 -1
- package/plugins/runtime-modules/builder/workspace-catalog-actions.js +3 -1
- package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +1 -1
- package/plugins/runtime-modules/descriptor-compiler.d.ts +16 -2
- package/plugins/runtime-modules/descriptor-compiler.js +69 -13
- package/plugins/runtime-modules/editor/services/releases-table.js +26 -14
- package/plugins/runtime-modules/editor/trees/phi-default-editor-area-preset-tree.js +0 -2
- package/plugins/runtime-modules/groups/definition.d.ts +1 -1
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +0 -2
- package/plugins/runtime-modules/revisions/controller/client.js +13 -7
- package/plugins/runtime-modules/revisions/services/table.js +10 -3
- package/plugins/runtime-modules/shell-tree-composition.d.ts +0 -2
- package/plugins/runtime-modules/shell-tree-composition.js +0 -3
- package/server-helpers/area-root-door-warmup.d.ts +5 -2
- package/server-helpers/area-root-door-warmup.js +2 -10
- package/server-helpers/cms-area.d.ts +9 -1
- package/server-helpers/cms-area.js +16 -11
- package/server-helpers/cms-lookup.js +1 -1
- package/server-helpers/cms-request.d.ts +58 -13
- package/server-helpers/cms-request.js +103 -33
- package/server-helpers/cms-root.d.ts +4 -0
- package/server-helpers/cms-root.js +48 -35
- package/server-helpers/cms.d.ts +5 -5
- package/server-helpers/public-login-route.js +4 -9
- package/server-helpers/search-index.js +9 -14
- package/styles/shell.css +12 -0
- package/types/cms-module-descriptors.d.ts +26 -1
- package/types/cms-plugins.d.ts +3 -0
- package/types/cms.d.ts +10 -3
|
@@ -24,7 +24,7 @@ import { resolvePhiCmsReviewParams, resolvePhiCmsRevisionFromSearchParams, resol
|
|
|
24
24
|
import { maybeGetPhiRequestRuntime, setPhiRequestNavigationContext, setPhiRequestRuntime, } from "./request-runtime";
|
|
25
25
|
import { buildPhiBlockRuntime, loadPhiSiteRequestContext, } from "./runtime";
|
|
26
26
|
import { trForLocale } from "./translate";
|
|
27
|
-
import {
|
|
27
|
+
import { buildPhiAreaShellPresetConfig, readPhiAreaLandingSelection, readPhiAreaPublicRoutePaths, readPhiAreaSelectionRuntimeModuleIds, } from "../helpers/cms-area-config";
|
|
28
28
|
import { readPhiServerApiCredentials } from "../helpers/phis-server-credentials";
|
|
29
29
|
import { createPhiModuleMediaLoader } from "../gateway/server-module-media";
|
|
30
30
|
async function instantiatePhiRoutePresetPage({ binding, requestedPath, areaMask, siteId, runtime, runtimeModuleCatalog, activeModuleKeys, }) {
|
|
@@ -64,26 +64,88 @@ function resolveAreaOwnedStoragePath(path, areaMask) {
|
|
|
64
64
|
}
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
|
+
function isPhiCmsAreaShellStructure(structure, binding) {
|
|
68
|
+
return structure != null
|
|
69
|
+
&& structure.sourcePreset?.ownerModuleId === binding.descriptor.ownerModuleId
|
|
70
|
+
&& structure.sourcePreset?.presetKey === binding.descriptor.presetKey;
|
|
71
|
+
}
|
|
67
72
|
/**
|
|
68
|
-
* What an Area answers
|
|
73
|
+
* What an Area answers: the active Module ids, the effective shell, the stored structure where it
|
|
74
|
+
* stands on that shell, and the route table compiled from them.
|
|
75
|
+
*
|
|
76
|
+
* In that order, because each step needs the one before. The selection decides the active Modules; the
|
|
77
|
+
* active Modules decide the shell (`resolvePhiCmsAreaShellPresetBinding`: the one active Module that
|
|
78
|
+
* brings one, otherwise the base); and a stored structure applies only when its identity is that
|
|
79
|
+
* shell's -- a Site that stored a base structure and then switched a shell provider on sees the
|
|
80
|
+
* provider's shell, and its own structure again once the provider is off. `structure` is null where
|
|
81
|
+
* the shell's preset answers; the caller builds it (`buildPhiLocalCmsAreaPayload`) only if it needs it.
|
|
69
82
|
*
|
|
70
83
|
* Nine readers -- the page request, the root shell, the dashboard cards, the navigation targets, the
|
|
71
|
-
* page references, the public login, the search index and two more -- each wrote these
|
|
72
|
-
*
|
|
73
|
-
* config they compile from.
|
|
84
|
+
* page references, the public login, the search index and two more -- each wrote these steps out.
|
|
85
|
+
* Stated once, the readers cannot drift in which shell and which config they compile from.
|
|
74
86
|
*/
|
|
75
87
|
export function resolvePhiAreaRouteScope(input) {
|
|
76
|
-
const activeModuleIds = resolveActivePresetModuleKeys(input.runtimeModuleCatalog, input.area, input.
|
|
88
|
+
const activeModuleIds = resolveActivePresetModuleKeys(input.runtimeModuleCatalog, input.area, input.read?.modules ?? null, input.serverCapabilities);
|
|
89
|
+
const shellBinding = resolvePhiCmsAreaShellPresetBinding(input.catalog, input.area, activeModuleIds);
|
|
90
|
+
if (!shellBinding) {
|
|
91
|
+
throw new Error(`Area "${input.area}" has no shell preset binding.`);
|
|
92
|
+
}
|
|
93
|
+
const structure = isPhiCmsAreaShellStructure(input.read?.structure, shellBinding)
|
|
94
|
+
? input.read.structure
|
|
95
|
+
: null;
|
|
77
96
|
const routeTable = compilePhiCmsActiveRouteTable({
|
|
78
97
|
catalog: input.catalog,
|
|
79
98
|
area: input.area,
|
|
80
99
|
activeModuleIds,
|
|
81
|
-
publicRoutePaths: readPhiAreaPublicRoutePaths(input.
|
|
82
|
-
|
|
100
|
+
publicRoutePaths: readPhiAreaPublicRoutePaths(input.read?.modules?.config),
|
|
101
|
+
// The stored answer, else what the shell proposes (`settings`): the same config the root route reads.
|
|
102
|
+
landingSelection: readPhiAreaLandingSelection(structure ? structure.preset.preset.config : buildPhiAreaShellPresetConfig(shellBinding.descriptor.settings)),
|
|
83
103
|
});
|
|
84
|
-
return { activeModuleIds, routeTable };
|
|
104
|
+
return { activeModuleIds, routeTable, shellBinding, structure };
|
|
85
105
|
}
|
|
86
|
-
|
|
106
|
+
/**
|
|
107
|
+
* What the Area stores for a request that may preview or review one of its revisions.
|
|
108
|
+
*
|
|
109
|
+
* A live request is one read without an identity: the selection and the one stored structure come
|
|
110
|
+
* together, and `resolvePhiAreaRouteScope` drops the structure if it stands on another shell. A
|
|
111
|
+
* revision or a review of the Area answers a structure only under the identity it names, and the shell
|
|
112
|
+
* that identity has to be depends on the selection -- which the reviewed revision may itself be. So it
|
|
113
|
+
* reads the live Area first, asks the reviewed revision under the shell the live selection chooses, and
|
|
114
|
+
* takes, under the shell the reviewed selection chooses, the reviewed structure or else the live one.
|
|
115
|
+
* Only previews pay the second read.
|
|
116
|
+
*/
|
|
117
|
+
export async function readPhiCmsAreaForRequest({ loadArea, previewsArea, resolveShellSource, }) {
|
|
118
|
+
const live = await loadArea({ sourcePreset: null, stage: "live" });
|
|
119
|
+
const liveRead = { modules: live?.modules ?? null, structure: live?.structure ?? null };
|
|
120
|
+
if (!previewsArea) {
|
|
121
|
+
return liveRead;
|
|
122
|
+
}
|
|
123
|
+
const reviewed = await loadArea({
|
|
124
|
+
sourcePreset: await resolveShellSource(liveRead.modules),
|
|
125
|
+
stage: "requested",
|
|
126
|
+
});
|
|
127
|
+
// Not there, or a structure revision of a shell the Area does not take: what is live answers.
|
|
128
|
+
if (!reviewed) {
|
|
129
|
+
return liveRead;
|
|
130
|
+
}
|
|
131
|
+
const shellSource = await resolveShellSource(reviewed.modules);
|
|
132
|
+
const standsOnShell = (structure) => structure?.sourcePreset.ownerModuleId === shellSource.ownerModuleId
|
|
133
|
+
&& structure.sourcePreset.presetKey === shellSource.presetKey;
|
|
134
|
+
return {
|
|
135
|
+
modules: reviewed.modules,
|
|
136
|
+
structure: [reviewed.structure, liveRead.structure].find(standsOnShell) ?? null,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/** The identity of the shell an Area takes under a selection, for `readPhiCmsAreaForRequest`. */
|
|
140
|
+
export function resolvePhiCmsAreaShellSource(input) {
|
|
141
|
+
const catalog = resolvePhiCmsDescriptorCatalog(input.runtimeModuleCatalog);
|
|
142
|
+
const binding = resolvePhiCmsAreaShellPresetBinding(catalog, input.area, resolveActivePresetModuleKeys(input.runtimeModuleCatalog, input.area, input.modules, input.serverCapabilities));
|
|
143
|
+
if (!binding) {
|
|
144
|
+
throw new Error(`Area "${input.area}" has no shell preset binding.`);
|
|
145
|
+
}
|
|
146
|
+
return { ownerModuleId: binding.descriptor.ownerModuleId, presetKey: binding.descriptor.presetKey };
|
|
147
|
+
}
|
|
148
|
+
function resolveActivePresetModuleKeys(runtimeModuleCatalog, area, modules, serverCapabilities) {
|
|
87
149
|
const platformModuleId = runtimeModuleCatalog.platformModuleId;
|
|
88
150
|
if (!platformModuleId) {
|
|
89
151
|
throw new Error("Runtime module catalog has no Platform contribution.");
|
|
@@ -95,7 +157,7 @@ export function resolveActivePresetModuleKeys(runtimeModuleCatalog, area, areaPr
|
|
|
95
157
|
throw new Error(`Area "${area}" is not declared in the runtime module catalog.`);
|
|
96
158
|
}
|
|
97
159
|
activeModuleKeys.add(areaDefinition.baseModuleId);
|
|
98
|
-
const configuredModuleKeys =
|
|
160
|
+
const configuredModuleKeys = readPhiAreaSelectionRuntimeModuleIds(modules, area);
|
|
99
161
|
const moduleDefinitions = [...runtimeModuleCatalog.values()].map((entry) => entry.definition);
|
|
100
162
|
// The Modules declared `activation: "always"` come first and on the same terms as the selected ones:
|
|
101
163
|
// the active set here has to be the one `resolvePhiRuntimeModuleSet` builds for the render.
|
|
@@ -176,7 +238,7 @@ function buildPhiRuntimePage(pagePayload, record) {
|
|
|
176
238
|
...(record ? { record } : {}),
|
|
177
239
|
};
|
|
178
240
|
}
|
|
179
|
-
export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookieHeader, apiBaseUrl, internalToken, requestContext, searchParams, loadResolvedCmsPage,
|
|
241
|
+
export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookieHeader, apiBaseUrl, internalToken, requestContext, searchParams, loadResolvedCmsPage, loadCmsArea, previewsArea = false, runtimeModuleCatalog, purpose = "render", }) {
|
|
180
242
|
const areaMask = resolvePhiCmsAreaMask(area);
|
|
181
243
|
/*
|
|
182
244
|
* Whether this resolution speaks for the request.
|
|
@@ -205,19 +267,33 @@ export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookie
|
|
|
205
267
|
}
|
|
206
268
|
const catalog = resolvePhiCmsDescriptorCatalog(runtimeModuleCatalog);
|
|
207
269
|
const requestedAreaKey = resolvePhiCmsAreaKey(areaMask);
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
270
|
+
const areaOwnedStoragePath = resolveAreaOwnedStoragePath(path, areaMask);
|
|
271
|
+
/*
|
|
272
|
+
* The selection first, then the shell it chooses, then the stored structure if it stands on that
|
|
273
|
+
* shell -- one read for a page view (`readPhiCmsAreaForRequest`).
|
|
274
|
+
*/
|
|
275
|
+
const storedArea = await readPhiCmsAreaForRequest({
|
|
276
|
+
loadArea: (request) => loadCmsArea(path, request),
|
|
277
|
+
previewsArea,
|
|
278
|
+
resolveShellSource: (modules) => resolvePhiCmsAreaShellSource({
|
|
279
|
+
runtimeModuleCatalog,
|
|
280
|
+
area: requestedAreaKey,
|
|
281
|
+
modules,
|
|
282
|
+
serverCapabilities: resolvedRequestContext.serverCapabilities,
|
|
283
|
+
}),
|
|
284
|
+
});
|
|
285
|
+
const { activeModuleIds: activeModuleKeys, routeTable, shellBinding: areaShellBinding, structure: exactAreaPreset, } = resolvePhiAreaRouteScope({
|
|
286
|
+
runtimeModuleCatalog,
|
|
287
|
+
catalog,
|
|
288
|
+
area: requestedAreaKey,
|
|
289
|
+
read: storedArea,
|
|
290
|
+
serverCapabilities: resolvedRequestContext.serverCapabilities,
|
|
291
|
+
});
|
|
292
|
+
// Only where nothing is stored on this shell; see the same step in `cms-root.ts`.
|
|
218
293
|
const localAreaPreset = exactAreaPreset
|
|
219
294
|
? null
|
|
220
295
|
: await buildPhiLocalCmsAreaPayload({
|
|
296
|
+
binding: areaShellBinding,
|
|
221
297
|
areaMask,
|
|
222
298
|
siteId: resolvedRequestContext.site.id,
|
|
223
299
|
path,
|
|
@@ -226,14 +302,6 @@ export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookie
|
|
|
226
302
|
});
|
|
227
303
|
const effectiveAreaPreset = exactAreaPreset ?? localAreaPreset;
|
|
228
304
|
const siteId = localAreaPreset?.preset.preset.siteId ?? resolvedRequestContext.site.id;
|
|
229
|
-
const areaOwnedStoragePath = resolveAreaOwnedStoragePath(path, areaMask);
|
|
230
|
-
const { activeModuleIds: activeModuleKeys, routeTable } = resolvePhiAreaRouteScope({
|
|
231
|
-
runtimeModuleCatalog,
|
|
232
|
-
catalog,
|
|
233
|
-
area: requestedAreaKey,
|
|
234
|
-
preset: effectiveAreaPreset?.preset ?? null,
|
|
235
|
-
serverCapabilities: resolvedRequestContext.serverCapabilities,
|
|
236
|
-
});
|
|
237
305
|
const runtimeWithAuthProvider = {
|
|
238
306
|
...runtime,
|
|
239
307
|
authUiProvider: resolvePhiAuthUiRuntimeProjection(runtimeModuleCatalog, activeModuleKeys, requestedAreaKey),
|
|
@@ -390,6 +458,7 @@ export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookie
|
|
|
390
458
|
if (purpose === "lookup") {
|
|
391
459
|
return {
|
|
392
460
|
areaPreset: effectiveAreaPreset?.preset ?? null,
|
|
461
|
+
areaModules: storedArea.modules,
|
|
393
462
|
page: resolvedContent.page,
|
|
394
463
|
runtime: resolvedRuntime,
|
|
395
464
|
serverCapabilities: resolvedRequestContext.serverCapabilities,
|
|
@@ -417,6 +486,7 @@ export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookie
|
|
|
417
486
|
: null;
|
|
418
487
|
return {
|
|
419
488
|
areaPreset: areaPresetTree && applyPhiBackgroundAssetProjection(areaPresetTree, backgroundAssets),
|
|
489
|
+
areaModules: storedArea.modules,
|
|
420
490
|
page: applyPhiBackgroundAssetProjection(resolvedContent.page, backgroundAssets),
|
|
421
491
|
runtime: resolvedRuntime,
|
|
422
492
|
serverCapabilities: resolvedRequestContext.serverCapabilities,
|
|
@@ -444,13 +514,13 @@ export const loadPhiResolvedCmsRequest = cache(async function loadPhiResolvedCms
|
|
|
444
514
|
searchParams,
|
|
445
515
|
purpose,
|
|
446
516
|
runtimeModuleCatalog,
|
|
447
|
-
|
|
517
|
+
previewsArea: revision != null || review?.kind === "area",
|
|
518
|
+
loadCmsArea: (requestPath, { sourcePreset, stage }) => getPhiExactSiteArea({
|
|
448
519
|
path: requestPath,
|
|
449
520
|
siteKey,
|
|
450
521
|
apiBaseUrl,
|
|
451
522
|
internalToken,
|
|
452
|
-
revision,
|
|
453
|
-
review,
|
|
523
|
+
...(stage === "requested" ? { revision, review } : {}),
|
|
454
524
|
cookieHeader,
|
|
455
525
|
sourcePreset,
|
|
456
526
|
}),
|
|
@@ -25,6 +25,8 @@ export declare function hasPhiCmsRevisionPreview(searchParams?: PhiCmsRequestSea
|
|
|
25
25
|
export declare function loadPhiCmsRootScope({ root, path, cmsBridge, }: LoadPhiCmsRootRequestArgs): Promise<{
|
|
26
26
|
resolvedRoute: import("./cms-route").PhiResolvedRootRoute;
|
|
27
27
|
resolvedAreaPreset: PhiResolvedCmsAreaPresetTree | null;
|
|
28
|
+
areaModules: import("../types/cms").PhiCmsAreaModulesSelection | null;
|
|
29
|
+
routeTable: import("../types/cms-module-descriptors").PhiCmsActiveRouteTable;
|
|
28
30
|
request: PhiCmsServerRequest;
|
|
29
31
|
runtime: {
|
|
30
32
|
authUiProvider: {
|
|
@@ -68,6 +70,8 @@ export declare function loadPhiCmsRootRequest({ root, path, cmsBridge, }: LoadPh
|
|
|
68
70
|
};
|
|
69
71
|
requestContext: import("../types/site-request-context").PhiSiteRequestContext;
|
|
70
72
|
resolvedAreaPreset: PhiResolvedCmsAreaPresetTree | null;
|
|
73
|
+
areaModules: import("../types/cms").PhiCmsAreaModulesSelection | null;
|
|
74
|
+
routeTable: import("../types/cms-module-descriptors").PhiCmsActiveRouteTable;
|
|
71
75
|
resolvedRequest: PhiResolvedCmsRequest | null;
|
|
72
76
|
}>;
|
|
73
77
|
export {};
|
|
@@ -12,9 +12,9 @@ import { hasPhiCmsAuthorizedPreviewRead, resolvePhiCmsReviewParams, resolvePhiCm
|
|
|
12
12
|
import { setPhiRequestNavigationContext, setPhiRequestRuntime, } from "./request-runtime";
|
|
13
13
|
import { buildPhiBlockRuntime, loadPhiSiteRequestContext } from "./runtime";
|
|
14
14
|
import { createPhiModuleMediaLoader } from "../gateway/server-module-media";
|
|
15
|
-
import { composePhiCmsActiveAreaOverlayPresets,
|
|
15
|
+
import { composePhiCmsActiveAreaOverlayPresets, resolvePhiCmsDescriptorCatalog, } from "../plugins/runtime-modules/descriptor-compiler";
|
|
16
16
|
import { resolvePhiAuthUiRuntimeProjection } from "./auth-ui-provider";
|
|
17
|
-
import { resolvePhiAreaRouteScope } from "./cms-request";
|
|
17
|
+
import { readPhiCmsAreaForRequest, resolvePhiAreaRouteScope, resolvePhiCmsAreaShellSource, } from "./cms-request";
|
|
18
18
|
import { applyPhiBackgroundAssetProjection, resolvePhiBackgroundAssetProjection, } from "../components/widgets/helpers/background-reference-resolver.server";
|
|
19
19
|
import { PHIS_CLIENT_NAVIGATION_HEADER, PHIS_REQUEST_PATH_HEADER, PHIS_REQUEST_SEARCH_HEADER, } from "../constants/http-headers";
|
|
20
20
|
import { isPhiStaticCmsSiteBridge } from "./static-render";
|
|
@@ -83,31 +83,27 @@ const loadPhiCmsRootScopeCached = cache(async function loadPhiCmsRootScopeCached
|
|
|
83
83
|
const resolvedAreaMask = resolvePhiCmsAreaMask(resolvedRoute.area);
|
|
84
84
|
const review = resolvePhiCmsReviewParams(request.searchParams);
|
|
85
85
|
const descriptorCatalog = resolvePhiCmsDescriptorCatalog(cmsBridge.runtimeModuleCatalog);
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
throw new Error(`Area "${resolvedRoute.area}" has no shell preset binding.`);
|
|
89
|
-
}
|
|
90
|
-
/*
|
|
91
|
-
* The stored Area needs the route, the cookie and the review, none of which the request context
|
|
92
|
-
* supplies, so its read starts here and travels beside the context's. A failure is kept for the
|
|
93
|
-
* `await` below; the empty handler only stops it from being reported as unhandled when the context
|
|
94
|
-
* read fails first and that `await` is never reached.
|
|
95
|
-
*/
|
|
96
|
-
const exactAreaPresetRead = getPhiExactSiteArea({
|
|
86
|
+
const revision = resolvePhiCmsRevisionFromSearchParams(request.searchParams);
|
|
87
|
+
const loadArea = ({ sourcePreset, stage }) => getPhiExactSiteArea({
|
|
97
88
|
path: resolvedRoute.cmsPath,
|
|
98
89
|
apiBaseUrl: bridgeRuntime?.apiBaseUrl,
|
|
99
90
|
internalToken: bridgeRuntime?.internalToken,
|
|
100
91
|
siteKey,
|
|
101
92
|
locale: resolvedRoute.locale,
|
|
102
|
-
revision:
|
|
103
|
-
review,
|
|
93
|
+
...(stage === "requested" ? { revision, review } : {}),
|
|
104
94
|
cookieHeader,
|
|
105
|
-
sourcePreset
|
|
106
|
-
ownerModuleId: areaShellBinding.descriptor.ownerModuleId,
|
|
107
|
-
presetKey: areaShellBinding.descriptor.presetKey,
|
|
108
|
-
},
|
|
95
|
+
sourcePreset,
|
|
109
96
|
});
|
|
110
|
-
|
|
97
|
+
/*
|
|
98
|
+
* The stored Area needs the route, the cookie and the review, none of which the request context
|
|
99
|
+
* supplies, so its live read starts here and travels beside the context's. It is the read without an
|
|
100
|
+
* identity -- the selection and the one stored structure together -- because which shell applies is
|
|
101
|
+
* decided from the selection. A failure is kept for the `await` below; the empty handler only stops
|
|
102
|
+
* it from being reported as unhandled when the context read fails first and that `await` is never
|
|
103
|
+
* reached.
|
|
104
|
+
*/
|
|
105
|
+
const liveAreaRead = loadArea({ sourcePreset: null, stage: "live" });
|
|
106
|
+
liveAreaRead.catch(() => undefined);
|
|
111
107
|
const baseRequestContext = await loadPhiSiteRequestContext(siteKey, resolvedRoute.locale, cookieHeader, bridgeRuntime?.apiBaseUrl, bridgeRuntime?.internalToken);
|
|
112
108
|
const requestContext = await resolvePhiCmsThemeReviewRequestContext({
|
|
113
109
|
requestContext: baseRequestContext,
|
|
@@ -120,15 +116,39 @@ const loadPhiCmsRootScopeCached = cache(async function loadPhiCmsRootScopeCached
|
|
|
120
116
|
request,
|
|
121
117
|
});
|
|
122
118
|
setPhiRequestRuntime(runtime);
|
|
123
|
-
const
|
|
119
|
+
const storedArea = await readPhiCmsAreaForRequest({
|
|
120
|
+
loadArea: (areaRequest) => areaRequest.stage === "live" && areaRequest.sourcePreset === null
|
|
121
|
+
? liveAreaRead
|
|
122
|
+
: loadArea(areaRequest),
|
|
123
|
+
previewsArea: revision != null || review?.kind === "area",
|
|
124
|
+
resolveShellSource: (modules) => resolvePhiCmsAreaShellSource({
|
|
125
|
+
runtimeModuleCatalog: cmsBridge.runtimeModuleCatalog,
|
|
126
|
+
area: resolvedRoute.area,
|
|
127
|
+
modules,
|
|
128
|
+
serverCapabilities: requestContext.serverCapabilities,
|
|
129
|
+
}),
|
|
130
|
+
});
|
|
124
131
|
/*
|
|
125
|
-
* The
|
|
126
|
-
*
|
|
127
|
-
*
|
|
132
|
+
* The same table the page request compiles, from the same selection and the same shell: what the
|
|
133
|
+
* shell's navigation links has to be what the request answers, assigned Public addresses and the
|
|
134
|
+
* awarded root included.
|
|
135
|
+
*/
|
|
136
|
+
const { activeModuleIds, routeTable, shellBinding: areaShellBinding, structure: exactAreaPreset, } = resolvePhiAreaRouteScope({
|
|
137
|
+
runtimeModuleCatalog: cmsBridge.runtimeModuleCatalog,
|
|
138
|
+
catalog: descriptorCatalog,
|
|
139
|
+
area: resolvedRoute.area,
|
|
140
|
+
read: storedArea,
|
|
141
|
+
serverCapabilities: requestContext.serverCapabilities,
|
|
142
|
+
});
|
|
143
|
+
/*
|
|
144
|
+
* The code-owned Shell only where the Site has none stored on it. Building it beside the read, to save
|
|
145
|
+
* the round trip on a Site that never saved its Area, cost every other Site a full Shell instantiation
|
|
146
|
+
* -- tree loaders, translations, the preset contract check -- on every request, thrown away unread.
|
|
128
147
|
*/
|
|
129
148
|
const localAreaPreset = exactAreaPreset
|
|
130
149
|
? null
|
|
131
150
|
: await buildPhiLocalCmsAreaPayload({
|
|
151
|
+
binding: areaShellBinding,
|
|
132
152
|
areaMask: resolvedAreaMask,
|
|
133
153
|
siteId: requestContext.site.id,
|
|
134
154
|
path: resolvedRoute.cmsPath,
|
|
@@ -136,17 +156,6 @@ const loadPhiCmsRootScopeCached = cache(async function loadPhiCmsRootScopeCached
|
|
|
136
156
|
runtimeModuleCatalog: cmsBridge.runtimeModuleCatalog,
|
|
137
157
|
});
|
|
138
158
|
const baseResolvedAreaPreset = exactAreaPreset?.preset ?? localAreaPreset?.preset ?? null;
|
|
139
|
-
/*
|
|
140
|
-
* The same table the page request compiles, from the same Area config: what the shell's navigation
|
|
141
|
-
* links has to be what the request answers, assigned Public addresses and the awarded root included.
|
|
142
|
-
*/
|
|
143
|
-
const { activeModuleIds, routeTable } = resolvePhiAreaRouteScope({
|
|
144
|
-
runtimeModuleCatalog: cmsBridge.runtimeModuleCatalog,
|
|
145
|
-
catalog: descriptorCatalog,
|
|
146
|
-
area: resolvedRoute.area,
|
|
147
|
-
preset: baseResolvedAreaPreset,
|
|
148
|
-
serverCapabilities: requestContext.serverCapabilities,
|
|
149
|
-
});
|
|
150
159
|
const composedAreaPreset = baseResolvedAreaPreset
|
|
151
160
|
? await composePhiCmsActiveAreaOverlayPresets({
|
|
152
161
|
tree: baseResolvedAreaPreset,
|
|
@@ -177,6 +186,8 @@ const loadPhiCmsRootScopeCached = cache(async function loadPhiCmsRootScopeCached
|
|
|
177
186
|
return {
|
|
178
187
|
resolvedRoute,
|
|
179
188
|
resolvedAreaPreset,
|
|
189
|
+
areaModules: storedArea.modules,
|
|
190
|
+
routeTable,
|
|
180
191
|
request,
|
|
181
192
|
runtime: runtimeWithAuthProvider,
|
|
182
193
|
cookieHeader,
|
|
@@ -259,6 +270,8 @@ const loadPhiCmsRootRequestCached = cache(async function loadPhiCmsRootRequestCa
|
|
|
259
270
|
runtime: rootScope.runtime,
|
|
260
271
|
requestContext: rootScope.requestContext,
|
|
261
272
|
resolvedAreaPreset: rootScope.resolvedAreaPreset,
|
|
273
|
+
areaModules: rootScope.areaModules,
|
|
274
|
+
routeTable: rootScope.routeTable,
|
|
262
275
|
resolvedRequest: effectiveResolvedRequest,
|
|
263
276
|
};
|
|
264
277
|
});
|
package/server-helpers/cms.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
+
import { type PhiSiteAreaRead } from "../gateway/site-area";
|
|
2
3
|
import type { PhiCmsReviewParams } from "./cms-review";
|
|
3
|
-
import type {
|
|
4
|
+
import type { PhiResolvedCmsPagePayload } from "../types/cms";
|
|
4
5
|
import type { PhiCmsPresetIdentity } from "../types/cms-module-descriptors";
|
|
5
6
|
export type GetPhiCmsPageOptions = {
|
|
6
7
|
path: string;
|
|
@@ -14,7 +15,6 @@ export type GetPhiCmsPageOptions = {
|
|
|
14
15
|
sourcePreset?: PhiCmsPresetIdentity | null;
|
|
15
16
|
};
|
|
16
17
|
export declare function getPhiCmsPage({ path, apiBaseUrl, internalToken, siteKey, locale, revision, review, cookieHeader, sourcePreset, }: GetPhiCmsPageOptions): Promise<PhiResolvedCmsPagePayload | null>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
export declare function getPhiExactSiteArea({ path, apiBaseUrl, internalToken, siteKey, locale, revision, review, cookieHeader, sourcePreset, }: GetPhiCmsAreaOptions): Promise<PhiResolvedCmsAreaPresetPayload | null>;
|
|
18
|
+
/** Without `sourcePreset` the Area answers its selection and its one stored structure, whatever identity it has. */
|
|
19
|
+
export type GetPhiCmsAreaOptions = GetPhiCmsPageOptions;
|
|
20
|
+
export declare function getPhiExactSiteArea({ path, apiBaseUrl, internalToken, siteKey, locale, revision, review, cookieHeader, sourcePreset, }: GetPhiCmsAreaOptions): Promise<PhiSiteAreaRead | null>;
|
|
@@ -5,7 +5,7 @@ import { PHI_CANONICAL_SOURCE_LOCALE, localizeAreaPath } from "../helpers/locale
|
|
|
5
5
|
import { getPhiExactSiteArea } from "./cms";
|
|
6
6
|
import { getPhiCapabilitySnapshot } from "../gateway/server-capabilities";
|
|
7
7
|
import { resolvePhiRequestLocale } from "./request-locale";
|
|
8
|
-
import {
|
|
8
|
+
import { resolvePhiCmsAreaBaseShellPresetBinding, resolvePhiCmsDescriptorCatalog, resolvePhiCmsRoutePresetByPageId, } from "../plugins/runtime-modules/descriptor-compiler";
|
|
9
9
|
import { PHI_PUBLIC_LOGIN_ROUTE_IDENTITY } from "../constants/public-login-route";
|
|
10
10
|
import { createPhiPresetCmsPageId } from "../types/cms-instance-id";
|
|
11
11
|
import { resolvePhiAreaRouteScope } from "./cms-request";
|
|
@@ -49,8 +49,7 @@ function readPhiBridgeApiOptions(cmsBridge) {
|
|
|
49
49
|
*/
|
|
50
50
|
export const resolvePhiPublicLoginHref = cache(async function resolvePhiPublicLoginHref(cmsBridge, locale, serverCapabilities) {
|
|
51
51
|
const catalog = resolvePhiCmsDescriptorCatalog(cmsBridge.runtimeModuleCatalog);
|
|
52
|
-
|
|
53
|
-
if (!shellBinding) {
|
|
52
|
+
if (!resolvePhiCmsAreaBaseShellPresetBinding(catalog, "public")) {
|
|
54
53
|
/**
|
|
55
54
|
* This bridge does not carry the Public Area definition -- a staff Area catalog deliberately does
|
|
56
55
|
* not, which is what keeps its module graph small. The route cannot be verified from here, and
|
|
@@ -61,21 +60,17 @@ export const resolvePhiPublicLoginHref = cache(async function resolvePhiPublicLo
|
|
|
61
60
|
return localizeAreaPath(locale, "public", PHI_PUBLIC_LOGIN_PATH);
|
|
62
61
|
}
|
|
63
62
|
const cookieStore = await cookies();
|
|
64
|
-
const
|
|
63
|
+
const storedArea = await getPhiExactSiteArea({
|
|
65
64
|
path: "/",
|
|
66
65
|
...readPhiBridgeApiOptions(cmsBridge),
|
|
67
66
|
locale,
|
|
68
67
|
cookieHeader: cookieStore.toString(),
|
|
69
|
-
sourcePreset: {
|
|
70
|
-
ownerModuleId: shellBinding.descriptor.ownerModuleId,
|
|
71
|
-
presetKey: shellBinding.descriptor.presetKey,
|
|
72
|
-
},
|
|
73
68
|
});
|
|
74
69
|
const { routeTable } = resolvePhiAreaRouteScope({
|
|
75
70
|
runtimeModuleCatalog: cmsBridge.runtimeModuleCatalog,
|
|
76
71
|
catalog,
|
|
77
72
|
area: "public",
|
|
78
|
-
|
|
73
|
+
read: storedArea,
|
|
79
74
|
serverCapabilities: serverCapabilities ?? null,
|
|
80
75
|
});
|
|
81
76
|
const login = resolvePhiCmsRoutePresetByPageId(routeTable, PHI_PUBLIC_LOGIN_PAGE_ID);
|
|
@@ -11,7 +11,7 @@ import { onPhiSiteReadMarker } from "../gateway/site-read-marker-listeners";
|
|
|
11
11
|
import { fetchPhiSiteSearchIndexStates, putPhiSiteSearchIndexSet } from "../gateway/site-search";
|
|
12
12
|
import { buildPhiRuntimeModuleAccessRegistry, filterPhiCmsRenderableTreeForViewer, } from "../helpers/cms-access-policy";
|
|
13
13
|
import { collectPhiSitemapCandidates } from "../helpers/phi-seo";
|
|
14
|
-
import {
|
|
14
|
+
import { resolvePhiCmsAreaBaseShellPresetBinding, resolvePhiCmsDescriptorCatalog, } from "../plugins/runtime-modules/descriptor-compiler";
|
|
15
15
|
import { resolvePhiCmsAreaRuntimeModuleScope } from "../components/cms/phi-cms-runtime-registry";
|
|
16
16
|
import { canPhiViewerAccess } from "../types/access";
|
|
17
17
|
import { resolvePhiCmsLookup } from "./cms-lookup";
|
|
@@ -159,34 +159,28 @@ function asIndexingReader(context, area) {
|
|
|
159
159
|
async function indexArea({ area, bridge, credentials, heldFingerprint, failures, }) {
|
|
160
160
|
const { apiBaseUrl, internalToken, siteKey } = credentials;
|
|
161
161
|
const catalog = resolvePhiCmsDescriptorCatalog(bridge.runtimeModuleCatalog);
|
|
162
|
-
|
|
163
|
-
if (!shellBinding) {
|
|
162
|
+
if (!resolvePhiCmsAreaBaseShellPresetBinding(catalog, area)) {
|
|
164
163
|
console.warn(`[phis-ui] The ${area} Area has no shell preset; nothing to index.`);
|
|
165
164
|
return;
|
|
166
165
|
}
|
|
167
|
-
const sourcePreset = {
|
|
168
|
-
ownerModuleId: shellBinding.descriptor.ownerModuleId,
|
|
169
|
-
presetKey: shellBinding.descriptor.presetKey,
|
|
170
|
-
};
|
|
171
166
|
const areaMask = area === "public" ? 1 : 2;
|
|
172
167
|
// The Site's languages and its server, read once as the anonymous reader; the locale is per set.
|
|
173
168
|
const anonymous = await loadPhiSiteRequestContext(siteKey, "", "", apiBaseUrl, internalToken);
|
|
174
169
|
// The Site config's change markers, from the same answer the context above was built from.
|
|
175
170
|
const { readMarker, translationMarkers } = await getResolvedSiteConfig({ apiBaseUrl, internalToken, siteKey });
|
|
176
171
|
const locales = anonymous.site.availableLocales.map((option) => option.code);
|
|
177
|
-
const { area:
|
|
172
|
+
const { area: storedArea, publishedPages } = await getSiteAreaWithPublishedPages({
|
|
178
173
|
apiBaseUrl,
|
|
179
174
|
internalToken,
|
|
180
175
|
siteKey,
|
|
181
176
|
locale: anonymous.site.defaultLocale,
|
|
182
|
-
sourcePreset,
|
|
183
177
|
area,
|
|
184
178
|
});
|
|
185
|
-
const { activeModuleIds, routeTable } = resolvePhiAreaRouteScope({
|
|
179
|
+
const { activeModuleIds, routeTable, structure } = resolvePhiAreaRouteScope({
|
|
186
180
|
runtimeModuleCatalog: bridge.runtimeModuleCatalog,
|
|
187
181
|
catalog,
|
|
188
182
|
area,
|
|
189
|
-
|
|
183
|
+
read: storedArea,
|
|
190
184
|
serverCapabilities: anonymous.serverCapabilities,
|
|
191
185
|
});
|
|
192
186
|
if (!activeModuleIds.has(PHI_SEARCH_RUNTIME_MODULE_ID))
|
|
@@ -211,17 +205,18 @@ async function indexArea({ area, bridge, credentials, heldFingerprint, failures,
|
|
|
211
205
|
build: getPhiSiteBuildId(),
|
|
212
206
|
area,
|
|
213
207
|
publishedPages,
|
|
214
|
-
areaPreset:
|
|
208
|
+
areaPreset: structure?.preset ?? null,
|
|
209
|
+
areaModules: storedArea.modules,
|
|
215
210
|
activeModuleIds: [...activeModuleIds].sort(),
|
|
216
211
|
locales,
|
|
217
212
|
readMarker,
|
|
218
213
|
translationMarkers,
|
|
219
214
|
})).digest("hex");
|
|
220
|
-
// The Area's Module scope as the live render resolves it:
|
|
215
|
+
// The Area's Module scope as the live render resolves it: its selection, the locked ones implied.
|
|
221
216
|
const { moduleSet } = await resolvePhiCmsAreaRuntimeModuleScope({
|
|
222
217
|
cmsBridge: bridge,
|
|
223
218
|
area,
|
|
224
|
-
|
|
219
|
+
areaModules: storedArea.modules,
|
|
225
220
|
serverCapabilities: anonymous.serverCapabilities,
|
|
226
221
|
});
|
|
227
222
|
// The same access registry the live render filters a Page's tree with (phi-cms-page-render-scope.tsx).
|
package/styles/shell.css
CHANGED
|
@@ -24,6 +24,18 @@
|
|
|
24
24
|
container-type: inline-size;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/*
|
|
28
|
+
* Nothing makes the page wider than the window. A viewport effect moves and turns a block by a share of its
|
|
29
|
+
* own size, so a picture that fits its slot may be drawn past the window's edge -- and a transform counts
|
|
30
|
+
* toward the scrollable width, which gave the page a horizontal scroll at the widths where the block sat
|
|
31
|
+
* close to the edge. `clip`, not `hidden`: it starts no scroll container, so a sticky Header, Sider or
|
|
32
|
+
* Footer still sticks to the window, and the vertical overflow stays visible.
|
|
33
|
+
*/
|
|
34
|
+
.shell-sider-full,
|
|
35
|
+
.shell-sider-embedded {
|
|
36
|
+
overflow-x: clip;
|
|
37
|
+
}
|
|
38
|
+
|
|
27
39
|
/*
|
|
28
40
|
* A device band, not a content threshold, although it is written as a container query.
|
|
29
41
|
*
|
|
@@ -9,6 +9,7 @@ import type { PhiSignalRoute } from "./signals";
|
|
|
9
9
|
import type { PhiCmsInstanceId } from "./cms-instance-id";
|
|
10
10
|
import type { PhiRuntimeModuleFormDefinition } from "../components/forms/form-registry";
|
|
11
11
|
import type { PhiModuleMediaResolver } from "./module-media";
|
|
12
|
+
import type { PhiAreaShellSettings } from "../helpers/cms-area-config";
|
|
12
13
|
export type PhiRuntimeModuleId = `${string}/${string}`;
|
|
13
14
|
export type PhiCmsPresetIdentity = {
|
|
14
15
|
ownerModuleId: PhiRuntimeModuleId;
|
|
@@ -21,6 +22,12 @@ export type PhiCmsAreaDefinition = {
|
|
|
21
22
|
area: PhiCmsAreaKey;
|
|
22
23
|
baseModuleId: PhiRuntimeModuleId;
|
|
23
24
|
shellPresetKey: string;
|
|
25
|
+
/**
|
|
26
|
+
* Who may bring the Area's shell. `"base"`: only the base Module's `shellPresetKey`. `"module"`: an
|
|
27
|
+
* active Module eligible for the Area may bring its own `areaShells` descriptor, and while one does it
|
|
28
|
+
* replaces the base shell; one provider per Area (MODULES.md, "A Module's own Area shell").
|
|
29
|
+
*/
|
|
30
|
+
shellProviders: "base" | "module";
|
|
24
31
|
accessPolicy: PhiViewerAccessPolicy;
|
|
25
32
|
navigationSurfaces?: readonly PhiCmsNavigationSurfaceDescriptor[];
|
|
26
33
|
};
|
|
@@ -45,6 +52,16 @@ export type PhiCmsAreaShellPresetDescriptor = PhiCmsPresetIdentity & {
|
|
|
45
52
|
exportedNodeKeys?: readonly string[];
|
|
46
53
|
composition?: readonly PhiCmsAreaShellCompositionSource[];
|
|
47
54
|
loadTree: (context: PhiCmsDescriptorBuildContext) => PhiResolvedCmsPageTree | Promise<PhiResolvedCmsPageTree>;
|
|
55
|
+
/**
|
|
56
|
+
* What this shell proposes for the Area's settings -- how it is found (`meta`) and what its `/` does
|
|
57
|
+
* (`rootRoute`) -- in place of phis-ui's defaults.
|
|
58
|
+
*
|
|
59
|
+
* A proposal, like the shell itself: it stands while the Area stores no structure on this shell, and
|
|
60
|
+
* the Builder's settings dialog shows it as the current answer. The first save writes what the dialog
|
|
61
|
+
* showed, this proposal included, into the stored `config.shell`; from then on the Site's answer
|
|
62
|
+
* stands and a newer proposal no longer reaches it. A key left out keeps phis-ui's default.
|
|
63
|
+
*/
|
|
64
|
+
settings?: PhiAreaShellSettings;
|
|
48
65
|
};
|
|
49
66
|
export type PhiCmsAreaOverlayPresetDescriptor = PhiCmsPresetIdentity & {
|
|
50
67
|
presetVersion: number;
|
|
@@ -451,6 +468,10 @@ export type PhiCmsNavigationOverlayResolution = {
|
|
|
451
468
|
export type PhiCmsAreaShellPresetBinding = {
|
|
452
469
|
descriptor: PhiCmsAreaShellPresetDescriptor;
|
|
453
470
|
};
|
|
471
|
+
/** A shell an optional Module brings for an Area whose definition takes one (`shellProviders: "module"`). */
|
|
472
|
+
export type PhiCmsAreaShellProviderBinding = PhiCmsAreaShellPresetBinding & {
|
|
473
|
+
moduleId: PhiRuntimeModuleId;
|
|
474
|
+
};
|
|
454
475
|
export type PhiCmsRoutePresetBinding = {
|
|
455
476
|
descriptor: PhiCmsRoutePresetDescriptor;
|
|
456
477
|
params: Readonly<Record<string, string>>;
|
|
@@ -475,7 +496,11 @@ export type PhiCmsCompiledRoutePattern = {
|
|
|
475
496
|
};
|
|
476
497
|
export type PhiCmsCompiledDescriptorCatalog = {
|
|
477
498
|
areaDefinitions: ReadonlyMap<PhiCmsAreaKey, PhiCmsAreaDefinition>;
|
|
478
|
-
|
|
499
|
+
/** The shell of the Area's base Module: what the Area takes while no active Module brings one. */
|
|
500
|
+
areaBaseShellByArea: ReadonlyMap<PhiCmsAreaKey, PhiCmsAreaShellPresetBinding>;
|
|
501
|
+
/** The shells optional Modules bring, by Area and Module; only for `shellProviders: "module"`. */
|
|
502
|
+
areaShellProvidersByArea: ReadonlyMap<PhiCmsAreaKey, ReadonlyMap<PhiRuntimeModuleId, PhiCmsAreaShellProviderBinding>>;
|
|
503
|
+
/** Every shell, base and provider alike, by identity: what `composition` and identity lookups read. */
|
|
479
504
|
areaShellByIdentity: ReadonlyMap<string, PhiCmsAreaShellPresetBinding>;
|
|
480
505
|
areaOverlaysByArea: ReadonlyMap<PhiCmsAreaKey, readonly PhiCmsAreaOverlayPresetDescriptor[]>;
|
|
481
506
|
/** Navigation contributed by a Module that owns no Page in that Area. */
|
package/types/cms-plugins.d.ts
CHANGED
|
@@ -749,7 +749,10 @@ export type PhiCmsSiteRuntime = {
|
|
|
749
749
|
siteKey: string;
|
|
750
750
|
};
|
|
751
751
|
export type PhiResolvedCmsRequest = {
|
|
752
|
+
/** The Area's structure: the stored one where it stands on the effective shell, else that shell's preset. */
|
|
752
753
|
areaPreset: PhiResolvedCmsAreaPresetTree | null;
|
|
754
|
+
/** The Area's Module selection, stored apart from the structure; null where the Area never stored one. */
|
|
755
|
+
areaModules: import("./cms").PhiCmsAreaModulesSelection | null;
|
|
753
756
|
page: PhiResolvedCmsPageTree;
|
|
754
757
|
runtime: PhiBlockRuntime;
|
|
755
758
|
serverCapabilities: import("./server-capabilities").PhiCapabilitySnapshot | null;
|
package/types/cms.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PhiRuntimeControllerSetting
|
|
1
|
+
import type { PhiRuntimeControllerSetting } from "./cms-plugins";
|
|
2
2
|
import type { PhiCmsAreaKey } from "@phis/contracts/cms";
|
|
3
3
|
import type { PhiCmsInstanceId } from "./cms-instance-id";
|
|
4
4
|
import type { PhiCmsPresetSource } from "./cms-module-descriptors";
|
|
@@ -126,7 +126,6 @@ export type PhiCmsContentWidgetNode = PhiCmsNodeBase & {
|
|
|
126
126
|
export type PhiResolvedCmsPageTree = {
|
|
127
127
|
page: PhiCmsPageNode;
|
|
128
128
|
pageMeta?: PhiCmsResolvedPageMeta | null;
|
|
129
|
-
runtimeModuleIds?: PhiRuntimeModuleId[] | null;
|
|
130
129
|
regions: PhiCmsRegionNode[];
|
|
131
130
|
overlays: PhiCmsOverlayNode[];
|
|
132
131
|
layoutNodes: PhiCmsLayoutNode[];
|
|
@@ -174,7 +173,6 @@ export type PhiCmsAreaPresetNode = {
|
|
|
174
173
|
};
|
|
175
174
|
export type PhiResolvedCmsAreaPresetTree = {
|
|
176
175
|
preset: PhiCmsAreaPresetNode;
|
|
177
|
-
runtimeModuleIds?: PhiRuntimeModuleId[] | null;
|
|
178
176
|
regions: PhiCmsRegionNode[];
|
|
179
177
|
overlays: PhiCmsOverlayNode[];
|
|
180
178
|
layoutNodes: PhiCmsLayoutNode[];
|
|
@@ -186,6 +184,15 @@ export type PhiResolvedCmsAreaPresetPayload = {
|
|
|
186
184
|
sourcePreset: PhiCmsPresetSource;
|
|
187
185
|
preset: PhiResolvedCmsAreaPresetTree;
|
|
188
186
|
};
|
|
187
|
+
/**
|
|
188
|
+
* An Area's Module selection as Core stores it, apart from the structure: one Modules revision, whose
|
|
189
|
+
* `config` is `{ modules: { runtimeModules, publicRoutePaths, ... } }`. It names no shell identity --
|
|
190
|
+
* which shell the Area takes is decided from it (CMS.md, "The Area's Module selection").
|
|
191
|
+
*/
|
|
192
|
+
export type PhiCmsAreaModulesSelection = {
|
|
193
|
+
revisionId: number;
|
|
194
|
+
config: Record<string, unknown>;
|
|
195
|
+
};
|
|
189
196
|
export type PhiCmsLayoutRenderNode = PhiCmsLayoutNode & {
|
|
190
197
|
childLayouts: PhiCmsLayoutRenderNode[];
|
|
191
198
|
childWidgets: PhiCmsContentWidgetNode[];
|