@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
|
@@ -3,6 +3,7 @@ export declare const PHI_PUBLIC_RUNTIME_AREA_DEFINITIONS: {
|
|
|
3
3
|
area: "public";
|
|
4
4
|
baseModuleId: `${string}/${string}`;
|
|
5
5
|
shellPresetKey: string;
|
|
6
|
+
shellProviders: "module";
|
|
6
7
|
accessPolicy: {
|
|
7
8
|
readonly access: "anyone";
|
|
8
9
|
};
|
|
@@ -48,6 +49,7 @@ export declare const PHI_APP_RUNTIME_AREA_DEFINITIONS: {
|
|
|
48
49
|
area: "app";
|
|
49
50
|
baseModuleId: `${string}/${string}`;
|
|
50
51
|
shellPresetKey: string;
|
|
52
|
+
shellProviders: "module";
|
|
51
53
|
accessPolicy: {
|
|
52
54
|
readonly access: "authenticated";
|
|
53
55
|
};
|
|
@@ -104,6 +106,7 @@ export declare const PHI_ACCOUNTING_RUNTIME_AREA_DEFINITIONS: {
|
|
|
104
106
|
area: "accounting";
|
|
105
107
|
baseModuleId: `${string}/${string}`;
|
|
106
108
|
shellPresetKey: string;
|
|
109
|
+
shellProviders: "base";
|
|
107
110
|
accessPolicy: {
|
|
108
111
|
readonly access: "roles";
|
|
109
112
|
readonly providerId: "@phis/server/core";
|
|
@@ -144,6 +147,7 @@ export declare const PHI_ADMIN_RUNTIME_AREA_DEFINITIONS: {
|
|
|
144
147
|
area: "admin";
|
|
145
148
|
baseModuleId: `${string}/${string}`;
|
|
146
149
|
shellPresetKey: string;
|
|
150
|
+
shellProviders: "base";
|
|
147
151
|
accessPolicy: {
|
|
148
152
|
readonly access: "roles";
|
|
149
153
|
readonly providerId: "@phis/server/core";
|
|
@@ -196,6 +200,7 @@ export declare const PHI_EDITOR_RUNTIME_AREA_DEFINITIONS: {
|
|
|
196
200
|
area: "editor";
|
|
197
201
|
baseModuleId: `${string}/${string}`;
|
|
198
202
|
shellPresetKey: string;
|
|
203
|
+
shellProviders: "base";
|
|
199
204
|
accessPolicy: {
|
|
200
205
|
readonly access: "roles";
|
|
201
206
|
readonly providerId: "@phis/server/core";
|
|
@@ -215,6 +220,7 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
|
|
|
215
220
|
area: "public";
|
|
216
221
|
baseModuleId: `${string}/${string}`;
|
|
217
222
|
shellPresetKey: string;
|
|
223
|
+
shellProviders: "module";
|
|
218
224
|
accessPolicy: {
|
|
219
225
|
readonly access: "anyone";
|
|
220
226
|
};
|
|
@@ -258,6 +264,7 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
|
|
|
258
264
|
area: "app";
|
|
259
265
|
baseModuleId: `${string}/${string}`;
|
|
260
266
|
shellPresetKey: string;
|
|
267
|
+
shellProviders: "module";
|
|
261
268
|
accessPolicy: {
|
|
262
269
|
readonly access: "authenticated";
|
|
263
270
|
};
|
|
@@ -313,6 +320,7 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
|
|
|
313
320
|
area: "accounting";
|
|
314
321
|
baseModuleId: `${string}/${string}`;
|
|
315
322
|
shellPresetKey: string;
|
|
323
|
+
shellProviders: "base";
|
|
316
324
|
accessPolicy: {
|
|
317
325
|
readonly access: "roles";
|
|
318
326
|
readonly providerId: "@phis/server/core";
|
|
@@ -352,6 +360,7 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
|
|
|
352
360
|
area: "admin";
|
|
353
361
|
baseModuleId: `${string}/${string}`;
|
|
354
362
|
shellPresetKey: string;
|
|
363
|
+
shellProviders: "base";
|
|
355
364
|
accessPolicy: {
|
|
356
365
|
readonly access: "roles";
|
|
357
366
|
readonly providerId: "@phis/server/core";
|
|
@@ -403,6 +412,7 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
|
|
|
403
412
|
area: "editor";
|
|
404
413
|
baseModuleId: `${string}/${string}`;
|
|
405
414
|
shellPresetKey: string;
|
|
415
|
+
shellProviders: "base";
|
|
406
416
|
accessPolicy: {
|
|
407
417
|
readonly access: "roles";
|
|
408
418
|
readonly providerId: "@phis/server/core";
|
|
@@ -421,6 +431,7 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
|
|
|
421
431
|
area: "builder";
|
|
422
432
|
baseModuleId: `${string}/${string}`;
|
|
423
433
|
shellPresetKey: string;
|
|
434
|
+
shellProviders: "base";
|
|
424
435
|
accessPolicy: {
|
|
425
436
|
readonly access: "roles";
|
|
426
437
|
readonly providerId: "@phis/server/core";
|
|
@@ -481,6 +492,7 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
|
|
|
481
492
|
area: "public";
|
|
482
493
|
baseModuleId: `${string}/${string}`;
|
|
483
494
|
shellPresetKey: string;
|
|
495
|
+
shellProviders: "module";
|
|
484
496
|
accessPolicy: {
|
|
485
497
|
readonly access: "anyone";
|
|
486
498
|
};
|
|
@@ -524,6 +536,7 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
|
|
|
524
536
|
area: "app";
|
|
525
537
|
baseModuleId: `${string}/${string}`;
|
|
526
538
|
shellPresetKey: string;
|
|
539
|
+
shellProviders: "module";
|
|
527
540
|
accessPolicy: {
|
|
528
541
|
readonly access: "authenticated";
|
|
529
542
|
};
|
|
@@ -579,6 +592,7 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
|
|
|
579
592
|
area: "accounting";
|
|
580
593
|
baseModuleId: `${string}/${string}`;
|
|
581
594
|
shellPresetKey: string;
|
|
595
|
+
shellProviders: "base";
|
|
582
596
|
accessPolicy: {
|
|
583
597
|
readonly access: "roles";
|
|
584
598
|
readonly providerId: "@phis/server/core";
|
|
@@ -618,6 +632,7 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
|
|
|
618
632
|
area: "admin";
|
|
619
633
|
baseModuleId: `${string}/${string}`;
|
|
620
634
|
shellPresetKey: string;
|
|
635
|
+
shellProviders: "base";
|
|
621
636
|
accessPolicy: {
|
|
622
637
|
readonly access: "roles";
|
|
623
638
|
readonly providerId: "@phis/server/core";
|
|
@@ -669,6 +684,7 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
|
|
|
669
684
|
area: "editor";
|
|
670
685
|
baseModuleId: `${string}/${string}`;
|
|
671
686
|
shellPresetKey: string;
|
|
687
|
+
shellProviders: "base";
|
|
672
688
|
accessPolicy: {
|
|
673
689
|
readonly access: "roles";
|
|
674
690
|
readonly providerId: "@phis/server/core";
|
|
@@ -687,6 +703,7 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
|
|
|
687
703
|
area: "builder";
|
|
688
704
|
baseModuleId: `${string}/${string}`;
|
|
689
705
|
shellPresetKey: string;
|
|
706
|
+
shellProviders: "base";
|
|
690
707
|
accessPolicy: {
|
|
691
708
|
readonly access: "roles";
|
|
692
709
|
readonly providerId: "@phis/server/core";
|
|
@@ -154,6 +154,7 @@ export const PHI_PUBLIC_RUNTIME_AREA_DEFINITIONS = [
|
|
|
154
154
|
area: "public",
|
|
155
155
|
baseModuleId: PHI_PUBLIC_RUNTIME_MODULE_ID,
|
|
156
156
|
shellPresetKey: PHI_DEFAULT_PUB_AREA_PRESET_KEY,
|
|
157
|
+
shellProviders: "module",
|
|
157
158
|
accessPolicy: PHI_VIEWER_ACCESS_ANYONE,
|
|
158
159
|
navigationSurfaces: publicNavigationSurfaces,
|
|
159
160
|
},
|
|
@@ -165,6 +166,7 @@ export const PHI_APP_RUNTIME_AREA_DEFINITIONS = [
|
|
|
165
166
|
area: "app",
|
|
166
167
|
baseModuleId: PHI_APP_RUNTIME_MODULE_ID,
|
|
167
168
|
shellPresetKey: "app-area-preset",
|
|
169
|
+
shellProviders: "module",
|
|
168
170
|
accessPolicy: PHI_VIEWER_ACCESS_AUTHENTICATED,
|
|
169
171
|
navigationSurfaces: [
|
|
170
172
|
{
|
|
@@ -237,6 +239,7 @@ export const PHI_ACCOUNTING_RUNTIME_AREA_DEFINITIONS = [
|
|
|
237
239
|
area: "accounting",
|
|
238
240
|
baseModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
|
|
239
241
|
shellPresetKey: "accounting-area-preset",
|
|
242
|
+
shellProviders: "base",
|
|
240
243
|
accessPolicy: PHI_VIEWER_ACCESS_ACCOUNTING,
|
|
241
244
|
navigationSurfaces: [{
|
|
242
245
|
navKey: "accounting:sidebar",
|
|
@@ -265,6 +268,7 @@ export const PHI_ADMIN_RUNTIME_AREA_DEFINITIONS = [
|
|
|
265
268
|
area: "admin",
|
|
266
269
|
baseModuleId: PHI_ADMIN_RUNTIME_MODULE_ID,
|
|
267
270
|
shellPresetKey: "admin-area-preset",
|
|
271
|
+
shellProviders: "base",
|
|
268
272
|
accessPolicy: PHI_VIEWER_ACCESS_DEVELOPER_TOOLS,
|
|
269
273
|
navigationSurfaces: [
|
|
270
274
|
{
|
|
@@ -311,6 +315,7 @@ export const PHI_EDITOR_RUNTIME_AREA_DEFINITIONS = [
|
|
|
311
315
|
area: "editor",
|
|
312
316
|
baseModuleId: PHI_EDITOR_RUNTIME_MODULE_ID,
|
|
313
317
|
shellPresetKey: "editor-area-preset",
|
|
318
|
+
shellProviders: "base",
|
|
314
319
|
accessPolicy: PHI_VIEWER_ACCESS_CONTENT_EDITING,
|
|
315
320
|
/*
|
|
316
321
|
* The surface, and nothing in it: every Page in this Area is contributed by the Module that owns its
|
|
@@ -331,6 +336,7 @@ const PHI_BUILDER_RUNTIME_AREA_DEFINITIONS = [
|
|
|
331
336
|
area: "builder",
|
|
332
337
|
baseModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
|
|
333
338
|
shellPresetKey: "builder-area-preset",
|
|
339
|
+
shellProviders: "base",
|
|
334
340
|
accessPolicy: PHI_VIEWER_ACCESS_STRUCTURE_AUTHORING,
|
|
335
341
|
navigationSurfaces: [{
|
|
336
342
|
navKey: "builder:sidebar",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import type { PhiCmsTreeControllerSettings } from "../../../types/cms";
|
|
3
|
+
import type { PhiCmsPresetSource } from "../../../types/cms-module-descriptors";
|
|
3
4
|
import type { PhiRuntimeModuleCatalog, PhiRuntimeModuleId } from "../../../types";
|
|
4
5
|
import type { PhiBlockRuntime } from "../../../types/widget-runtime";
|
|
5
6
|
import { type PhiAreaLandingSelection, type PhiAreaRootRoute, type PhiAreaMeta, type PhiPublicRoutePathAssignment } from "../../../helpers/cms-area-config";
|
|
6
7
|
import type { PhiDeveloperBuilderArea, PhiDeveloperBuilderRegionDraft } from "./developer-workspace-types";
|
|
8
|
+
import type { PhiWorkspaceAreaShellState } from "../../../components/workspace/catalog-state";
|
|
7
9
|
type PhiBuilderAreaModulesConfig = {
|
|
8
10
|
moduleIds: PhiRuntimeModuleId[];
|
|
9
11
|
/**
|
|
@@ -47,9 +49,10 @@ export declare function buildPhiBuilderRuntimeModulesConfigForArea(runtime: PhiB
|
|
|
47
49
|
/**
|
|
48
50
|
* The Modules the published Area answers with, as opposed to the draft the Builder edits.
|
|
49
51
|
*
|
|
50
|
-
* Without a published
|
|
51
|
-
*
|
|
52
|
-
*
|
|
52
|
+
* Without a published selection the Area's default list decides, which is what a visitor is served in
|
|
53
|
+
* that case too. Read for the collision dialog, which has to say whether an address it asks to move
|
|
54
|
+
* already stands on the live Site. The structures read answers the published selection only where no
|
|
55
|
+
* Module draft is open; with one open, the live read says what is published.
|
|
53
56
|
*/
|
|
54
57
|
export declare const buildPhiBuilderPublishedRuntimeModuleIdsForArea: (runtime: PhiBlockRuntime, area: PhiDeveloperBuilderArea, runtimeModuleCatalog: PhiRuntimeModuleCatalog) => Promise<PhiRuntimeModuleId[]>;
|
|
55
58
|
export declare function buildPhiBuilderRuntimeModuleIdsForArea(runtime: PhiBlockRuntime, area: PhiDeveloperBuilderArea, runtimeModuleCatalog: PhiRuntimeModuleCatalog): Promise<`${string}/${string}`[]>;
|
|
@@ -81,9 +84,22 @@ export declare function buildPhiBuilderAreaRootRoutesByArea(runtime: PhiBlockRun
|
|
|
81
84
|
export declare function buildPhiBuilderAreaMetaByArea(runtime: PhiBlockRuntime, runtimeModuleCatalog: PhiRuntimeModuleCatalog): Promise<Record<string, PhiAreaMeta | null>>;
|
|
82
85
|
/**
|
|
83
86
|
* What every Area's Shell tells its Controllers, from the same chain the drafts come from: the open
|
|
84
|
-
* structure draft, else what is published, else the code-owned Shell. Carried into every structure save
|
|
85
|
-
*
|
|
87
|
+
* structure draft, else what is published, else the code-owned Shell. Carried into every structure save,
|
|
88
|
+
* which states the tree whole.
|
|
86
89
|
*/
|
|
87
90
|
export declare function buildPhiBuilderAreaControllerSettingsByArea(runtime: PhiBlockRuntime, runtimeModuleCatalog: PhiRuntimeModuleCatalog): Promise<Record<string, PhiCmsTreeControllerSettings>>;
|
|
88
91
|
export declare function buildPhiBuilderStructureShellPresetDraftsByArea(runtime: PhiBlockRuntime, runtimeModuleCatalog: PhiRuntimeModuleCatalog): Promise<Record<PhiDeveloperBuilderArea, Record<string, PhiDeveloperBuilderRegionDraft>>>;
|
|
92
|
+
/**
|
|
93
|
+
* The shell every Area takes, as the identity a structure save, a draft read and a Revisions scope name:
|
|
94
|
+
* the shell of the one Module that brings one and is selected there, else the base Module's.
|
|
95
|
+
*/
|
|
96
|
+
export declare function buildPhiBuilderAreaPresetSourcesByArea(runtime: PhiBlockRuntime, runtimeModuleCatalog: PhiRuntimeModuleCatalog): Promise<Partial<Record<PhiDeveloperBuilderArea, PhiCmsPresetSource>>>;
|
|
97
|
+
/**
|
|
98
|
+
* Per Area, which Modules bring a shell for it and which shell its stored structure stands on.
|
|
99
|
+
*
|
|
100
|
+
* The first is what the Modules table refuses a second provider by; the second is what it warns about
|
|
101
|
+
* when a provider is switched on over a stored structure of another shell, and what "Clear Area" and a
|
|
102
|
+
* refused structure save name.
|
|
103
|
+
*/
|
|
104
|
+
export declare function buildPhiBuilderAreaShellsByArea(runtime: PhiBlockRuntime, runtimeModuleCatalog: PhiRuntimeModuleCatalog): Promise<Partial<Record<PhiDeveloperBuilderArea, PhiWorkspaceAreaShellState>>>;
|
|
89
105
|
export {};
|
|
@@ -3,13 +3,13 @@ import { applyPhiPresetTreesCurrentContent } from "../../../server-helpers/cms-b
|
|
|
3
3
|
import { cache } from "react";
|
|
4
4
|
import { cookies } from "next/headers";
|
|
5
5
|
import { PHI_BUILDER_AREA_KEYS } from "../../../constants/cms-areas";
|
|
6
|
-
import { getSiteAreaStructures } from "../../../gateway/site-area";
|
|
7
|
-
import { readPhiRuntimeModuleIdsForArea } from "../../../plugins/runtime-modules/settings";
|
|
8
|
-
import {
|
|
6
|
+
import { getExactSiteArea, getSiteAreaStructures } from "../../../gateway/site-area";
|
|
7
|
+
import { listPhiAlwaysActiveRuntimeModuleIds, readPhiRuntimeModuleIdsForArea, } from "../../../plugins/runtime-modules/settings";
|
|
8
|
+
import { buildPhiAreaShellPresetConfig, readPhiAreaSelectionRuntimeModuleIds, readPhiAreaPublicRoutePaths, readPhiAreaRootRoute, readPhiAreaMeta, resolvePhiAreaLandingSelection, } from "../../../helpers/cms-area-config";
|
|
9
9
|
import { PHI_BUILDER_SHELL_REGION_KEYS } from "./region-keys";
|
|
10
10
|
import { buildPhiProjectedBuilderRegionDrafts } from "./draft-background-assets.server";
|
|
11
11
|
import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
|
|
12
|
-
import { instantiatePhiCmsAreaShellPreset, resolvePhiCmsAreaShellPresetBinding, resolvePhiCmsDescriptorCatalog, } from "../../../plugins/runtime-modules/descriptor-compiler";
|
|
12
|
+
import { instantiatePhiCmsAreaShellPreset, listPhiCmsAreaShellProviders, resolvePhiCmsAreaBaseShellPresetBinding, resolvePhiCmsAreaShellPresetBinding, resolvePhiCmsDescriptorCatalog, } from "../../../plugins/runtime-modules/descriptor-compiler";
|
|
13
13
|
import { PHI_BUILDER_AREA_SEARCH_PARAM, normalizePhiBuilderAreaSearchParam, } from "../../../helpers/cms-scope-search-params";
|
|
14
14
|
import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
|
|
15
15
|
import { createPhiModuleMediaLoader } from "../../../gateway/server-module-media";
|
|
@@ -21,8 +21,9 @@ import { createPhiModuleMediaLoader } from "../../../gateway/server-module-media
|
|
|
21
21
|
*/
|
|
22
22
|
const loadInstalledAreaShellPresetTrees = cache(async function loadInstalledAreaShellPresetTrees(runtime, runtimeModuleCatalog) {
|
|
23
23
|
const catalog = resolvePhiCmsDescriptorCatalog(runtimeModuleCatalog);
|
|
24
|
+
const states = await loadPhiBuilderAreaStoredStates(runtime.site.key, runtime.locale.current, readPhiServerApiCredentials().apiBaseUrl, readPhiServerApiCredentials().internalToken, runtimeModuleCatalog);
|
|
24
25
|
const installed = (await Promise.all(PHI_BUILDER_AREA_KEYS.map(async (area) => {
|
|
25
|
-
const binding =
|
|
26
|
+
const binding = states.get(area)?.shellBinding ?? null;
|
|
26
27
|
if (!binding) {
|
|
27
28
|
return null;
|
|
28
29
|
}
|
|
@@ -46,16 +47,6 @@ const loadInstalledAreaShellPresetTrees = cache(async function loadInstalledArea
|
|
|
46
47
|
async function instantiateAreaShellPresetTree(runtime, area, runtimeModuleCatalog) {
|
|
47
48
|
return (await loadInstalledAreaShellPresetTrees(runtime, runtimeModuleCatalog)).get(area) ?? null;
|
|
48
49
|
}
|
|
49
|
-
function resolveAreaPresetSource(area, runtimeModuleCatalog) {
|
|
50
|
-
const binding = resolvePhiCmsAreaShellPresetBinding(resolvePhiCmsDescriptorCatalog(runtimeModuleCatalog), resolvePhiBuilderAreaAsCmsArea(area));
|
|
51
|
-
if (!binding) {
|
|
52
|
-
throw new Error(`Builder target Area "${area}" has no shell preset binding.`);
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
ownerModuleId: binding.descriptor.ownerModuleId,
|
|
56
|
-
presetKey: binding.descriptor.presetKey,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
50
|
function buildInstalledShellDraftsForArea(runtime, area, runtimeModuleCatalog) {
|
|
60
51
|
return instantiateAreaShellPresetTree(runtime, area, runtimeModuleCatalog).then((installedTree) => {
|
|
61
52
|
if (!installedTree) {
|
|
@@ -81,48 +72,114 @@ function resolveStructureAreaPath(area) {
|
|
|
81
72
|
return "/";
|
|
82
73
|
}
|
|
83
74
|
}
|
|
84
|
-
function
|
|
85
|
-
const
|
|
86
|
-
const reading = readPhiRuntimeModuleIdsForArea(area, readPhiAreaPresetRuntimeModuleIds(presetTree, area), [...runtimeModuleCatalog.values()].map((entry) => entry.definition));
|
|
75
|
+
function readRuntimeModulesConfig(selection, area, runtimeModuleCatalog) {
|
|
76
|
+
const reading = readPhiRuntimeModuleIdsForArea(area, readPhiAreaSelectionRuntimeModuleIds(selection, area), [...runtimeModuleCatalog.values()].map((entry) => entry.definition));
|
|
87
77
|
if (reading.unresolved.length > 0) {
|
|
88
78
|
console.warn("[phi-builder] Stored Module selection names Modules this build cannot serve.", { area, unresolved: reading.unresolved });
|
|
89
79
|
}
|
|
90
80
|
return {
|
|
91
81
|
moduleIds: reading.moduleIds,
|
|
92
82
|
unresolvedModuleIds: reading.unresolved.map((entry) => entry.moduleId),
|
|
93
|
-
publicRoutePaths: readPhiAreaPublicRoutePaths(
|
|
83
|
+
publicRoutePaths: readPhiAreaPublicRoutePaths(selection?.config),
|
|
94
84
|
};
|
|
95
85
|
}
|
|
86
|
+
function toPresetIdentityKey(source) {
|
|
87
|
+
return `${source.ownerModuleId}\u001f${source.presetKey}`;
|
|
88
|
+
}
|
|
89
|
+
/** As many identities as Core answers in one structures read. */
|
|
90
|
+
const PHI_BUILDER_AREA_STRUCTURES_READ_LIMIT = 16;
|
|
91
|
+
/**
|
|
92
|
+
* The Area's effective shell under a selection, as the Builder sees it.
|
|
93
|
+
*
|
|
94
|
+
* The selection the Builder holds -- the open Module draft first -- with the Modules every Area runs
|
|
95
|
+
* anyway, so a Module that brings its own shell applies here as soon as it is selected, before the
|
|
96
|
+
* selection is published.
|
|
97
|
+
*/
|
|
98
|
+
function resolveBuilderAreaShellBinding(area, selection, runtimeModuleCatalog) {
|
|
99
|
+
const catalog = resolvePhiCmsDescriptorCatalog(runtimeModuleCatalog);
|
|
100
|
+
const cmsArea = resolvePhiBuilderAreaAsCmsArea(area);
|
|
101
|
+
const definitions = [...runtimeModuleCatalog.values()].map((entry) => entry.definition);
|
|
102
|
+
const activeModuleIds = new Set([
|
|
103
|
+
...readRuntimeModulesConfig(selection, area, runtimeModuleCatalog).moduleIds,
|
|
104
|
+
...listPhiAlwaysActiveRuntimeModuleIds(cmsArea, definitions),
|
|
105
|
+
]);
|
|
106
|
+
return resolvePhiCmsAreaShellPresetBinding(catalog, cmsArea, activeModuleIds);
|
|
107
|
+
}
|
|
96
108
|
/**
|
|
97
|
-
* What the Site stores about every Area
|
|
98
|
-
*
|
|
109
|
+
* What the Site stores about every Area: per Area its Module selection and its one structure. One
|
|
110
|
+
* request for all of them, once per request.
|
|
99
111
|
*
|
|
100
112
|
* The Builder needs every Area on every view -- the Modules page edits their selections together, and
|
|
101
113
|
* the Area switch carries the next Area's selection -- and read them with a draft read and, where no
|
|
102
114
|
* draft was open, a published read per Area: eleven of a Builder view's seventeen Core calls
|
|
103
115
|
* (AUDIT-2026-10-13, PM3). Keyed by the values the request turns on and never by an object, and read
|
|
104
|
-
* whole, so the Shell drafts, the Area config and the Module selection all come from one
|
|
116
|
+
* whole, so the Shell drafts, the Area config and the Module selection all come from one answer. The
|
|
105
117
|
* cookie header is read inside, where it is one value per request anyway.
|
|
118
|
+
*
|
|
119
|
+
* A structure answers only under the identity it is stored under, and an Area of `shellProviders:
|
|
120
|
+
* "module"` may stand on the base shell or on any Module's: so each Area is asked under every shell it
|
|
121
|
+
* could take, in the same request, and whichever answers is the one it stores. That is also how the
|
|
122
|
+
* Builder learns a structure stands on a shell the Area no longer takes.
|
|
106
123
|
*/
|
|
107
|
-
const
|
|
108
|
-
const
|
|
124
|
+
const loadPhiBuilderAreaStoredStates = cache(async function loadPhiBuilderAreaStoredStates(siteKey, locale, apiBaseUrl, internalToken, runtimeModuleCatalog) {
|
|
125
|
+
const catalog = resolvePhiCmsDescriptorCatalog(runtimeModuleCatalog);
|
|
126
|
+
const requests = PHI_BUILDER_AREA_KEYS.flatMap((area) => {
|
|
127
|
+
const cmsArea = resolvePhiBuilderAreaAsCmsArea(area);
|
|
128
|
+
const base = resolvePhiCmsAreaBaseShellPresetBinding(catalog, cmsArea);
|
|
129
|
+
if (!base) {
|
|
130
|
+
throw new Error(`Builder target Area "${area}" has no shell preset binding.`);
|
|
131
|
+
}
|
|
132
|
+
return [base, ...listPhiCmsAreaShellProviders(catalog, cmsArea)].map(({ descriptor }) => ({
|
|
133
|
+
area,
|
|
134
|
+
ownerModuleId: descriptor.ownerModuleId,
|
|
135
|
+
presetKey: descriptor.presetKey,
|
|
136
|
+
}));
|
|
137
|
+
});
|
|
109
138
|
const cookieHeader = (await cookies()).toString();
|
|
139
|
+
const chunks = [];
|
|
140
|
+
for (let index = 0; index < requests.length; index += PHI_BUILDER_AREA_STRUCTURES_READ_LIMIT) {
|
|
141
|
+
chunks.push(requests.slice(index, index + PHI_BUILDER_AREA_STRUCTURES_READ_LIMIT));
|
|
142
|
+
}
|
|
110
143
|
// A failed read is not "never asked": answering with the preset default would let the Builder show and
|
|
111
144
|
// save it over what the Area actually stores.
|
|
112
|
-
const
|
|
145
|
+
const answers = (await Promise.all(chunks.map((areas) => getSiteAreaStructures({
|
|
113
146
|
apiBaseUrl,
|
|
114
147
|
internalToken,
|
|
115
148
|
siteKey,
|
|
116
149
|
locale,
|
|
117
150
|
cookieHeader,
|
|
118
|
-
areas
|
|
119
|
-
}).
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
151
|
+
areas,
|
|
152
|
+
})))).flat();
|
|
153
|
+
const states = new Map();
|
|
154
|
+
for (const area of PHI_BUILDER_AREA_KEYS) {
|
|
155
|
+
const entries = answers.filter((answer) => answer.area === area);
|
|
156
|
+
if (entries.length === 0) {
|
|
157
|
+
throw new Error(`The builder structure read did not answer for area "${area}".`);
|
|
158
|
+
}
|
|
159
|
+
const { modules } = entries[0];
|
|
160
|
+
const selection = modules.draft ?? modules.published;
|
|
161
|
+
const answered = entries.find((entry) => entry.draft != null || entry.published != null) ?? null;
|
|
162
|
+
const storedPayload = answered?.draft ?? answered?.published ?? null;
|
|
163
|
+
const stored = answered && storedPayload
|
|
164
|
+
? {
|
|
165
|
+
sourcePreset: storedPayload.sourcePreset,
|
|
166
|
+
draft: answered.draft?.preset ?? null,
|
|
167
|
+
published: answered.draft ? null : answered.published?.preset ?? null,
|
|
168
|
+
}
|
|
169
|
+
: null;
|
|
170
|
+
const shellBinding = resolveBuilderAreaShellBinding(area, selection, runtimeModuleCatalog);
|
|
171
|
+
const standsOnShell = stored != null && shellBinding != null &&
|
|
172
|
+
toPresetIdentityKey(stored.sourcePreset) === toPresetIdentityKey(shellBinding.descriptor);
|
|
173
|
+
states.set(area, {
|
|
174
|
+
modules: selection,
|
|
175
|
+
modulesDraftOpen: modules.draft != null,
|
|
176
|
+
stored,
|
|
177
|
+
shellBinding,
|
|
178
|
+
draft: standsOnShell ? stored.draft : null,
|
|
179
|
+
published: standsOnShell ? stored.published : null,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return states;
|
|
126
183
|
});
|
|
127
184
|
/**
|
|
128
185
|
* The Areas whose structure has an open draft, from the one read every Builder view makes.
|
|
@@ -131,15 +188,15 @@ const loadPhiBuilderAreaStructures = cache(async function loadPhiBuilderAreaStru
|
|
|
131
188
|
* and it is still one request for every Area.
|
|
132
189
|
*/
|
|
133
190
|
export async function readPhiBuilderAreasWithOpenDraft(runtimeModuleCatalog, { siteKey, locale, apiBaseUrl, internalToken }) {
|
|
134
|
-
const
|
|
135
|
-
return PHI_BUILDER_AREA_KEYS.filter((area) =>
|
|
191
|
+
const states = await loadPhiBuilderAreaStoredStates(siteKey, locale, apiBaseUrl, internalToken, runtimeModuleCatalog);
|
|
192
|
+
return PHI_BUILDER_AREA_KEYS.filter((area) => states.get(area)?.stored?.draft != null);
|
|
136
193
|
}
|
|
137
194
|
async function loadPhiBuilderAreaStructure(siteKey, locale, apiBaseUrl, internalToken, area, runtimeModuleCatalog) {
|
|
138
|
-
const
|
|
139
|
-
if (!
|
|
195
|
+
const state = (await loadPhiBuilderAreaStoredStates(siteKey, locale, apiBaseUrl, internalToken, runtimeModuleCatalog)).get(area);
|
|
196
|
+
if (!state) {
|
|
140
197
|
throw new Error(`The builder structure read did not answer for area "${area}".`);
|
|
141
198
|
}
|
|
142
|
-
return
|
|
199
|
+
return state;
|
|
143
200
|
}
|
|
144
201
|
const buildShellDraftsForArea = cache(async function buildShellDraftsForArea(runtime, siteKey, locale, apiBaseUrl, internalToken, area, runtimeModuleCatalog) {
|
|
145
202
|
const { draft, published } = await loadPhiBuilderAreaStructure(siteKey, locale, apiBaseUrl, internalToken, area, runtimeModuleCatalog);
|
|
@@ -157,16 +214,22 @@ const buildShellDraftsForArea = cache(async function buildShellDraftsForArea(run
|
|
|
157
214
|
* The config an Area currently states about its Shell, from the same three sources the drafts come from.
|
|
158
215
|
*
|
|
159
216
|
* An open structure draft first, because that is what the Builder is looking at; then what is
|
|
160
|
-
* published; then
|
|
161
|
-
*
|
|
162
|
-
*
|
|
217
|
+
* published; then what the effective shell proposes (`PhiCmsAreaShellPresetDescriptor.settings`), which
|
|
218
|
+
* is what a visitor is served while nothing is stored on that shell. The dialog shows that proposal as
|
|
219
|
+
* the current answer, so the first save writes it rather than losing it. A shell that proposes nothing
|
|
220
|
+
* answers null: the Area was never asked, and phis-ui's defaults stand.
|
|
163
221
|
*
|
|
164
222
|
* Read once and read whole, because everything the Shell says about itself arrives in the same
|
|
165
223
|
* revision: the root route and the two SEO answers are one fetch, not one each.
|
|
166
224
|
*/
|
|
167
225
|
async function buildPhiBuilderAreaPresetConfig(runtime, area, runtimeModuleCatalog) {
|
|
168
|
-
const { draft, published } = await loadPhiBuilderAreaStructure(runtime.site.key, runtime.locale.current, readPhiServerApiCredentials().apiBaseUrl, readPhiServerApiCredentials().internalToken, area, runtimeModuleCatalog);
|
|
169
|
-
|
|
226
|
+
const { draft, published, shellBinding } = await loadPhiBuilderAreaStructure(runtime.site.key, runtime.locale.current, readPhiServerApiCredentials().apiBaseUrl, readPhiServerApiCredentials().internalToken, area, runtimeModuleCatalog);
|
|
227
|
+
const stored = draft ?? published;
|
|
228
|
+
if (stored) {
|
|
229
|
+
return stored.preset.config ?? null;
|
|
230
|
+
}
|
|
231
|
+
const proposed = buildPhiAreaShellPresetConfig(shellBinding?.descriptor.settings);
|
|
232
|
+
return Object.keys(proposed).length > 0 ? proposed : null;
|
|
170
233
|
}
|
|
171
234
|
/** What an Area says its `/` resolves to. */
|
|
172
235
|
async function buildPhiBuilderAreaRootRoute(runtime, area, runtimeModuleCatalog) {
|
|
@@ -201,34 +264,39 @@ export const buildPhiBuilderStructureShellDraftsForArea = cache(async function b
|
|
|
201
264
|
return buildShellDraftsForArea(runtime, runtime.site.key, runtime.locale.current, readPhiServerApiCredentials().apiBaseUrl, readPhiServerApiCredentials().internalToken, area, runtimeModuleCatalog);
|
|
202
265
|
});
|
|
203
266
|
/**
|
|
204
|
-
* What an Area's
|
|
205
|
-
* published, then the
|
|
206
|
-
* config -- reading the assigned Public addresses separately
|
|
207
|
-
*
|
|
267
|
+
* What an Area's Module selection says, as the Builder sees it: the open Module draft, then what is
|
|
268
|
+
* published, then the default list the Area ships with. Both answers come from one load because they are
|
|
269
|
+
* one config -- reading the assigned Public addresses separately could read a different revision than
|
|
270
|
+
* the Module selection it belongs to.
|
|
208
271
|
*/
|
|
209
|
-
const buildRuntimeModulesConfigForArea = cache(async function buildRuntimeModulesConfigForArea(
|
|
210
|
-
const {
|
|
211
|
-
|
|
212
|
-
if (stored) {
|
|
213
|
-
return readRuntimeModulesConfigFromStructureTree(stored, area, runtimeModuleCatalog);
|
|
214
|
-
}
|
|
215
|
-
return readRuntimeModulesConfigFromStructureTree(await instantiateAreaShellPresetTree(runtime, area, runtimeModuleCatalog), area, runtimeModuleCatalog);
|
|
272
|
+
const buildRuntimeModulesConfigForArea = cache(async function buildRuntimeModulesConfigForArea(siteKey, locale, apiBaseUrl, internalToken, area, runtimeModuleCatalog) {
|
|
273
|
+
const { modules } = await loadPhiBuilderAreaStructure(siteKey, locale, apiBaseUrl, internalToken, area, runtimeModuleCatalog);
|
|
274
|
+
return readRuntimeModulesConfig(modules, area, runtimeModuleCatalog);
|
|
216
275
|
});
|
|
217
276
|
export function buildPhiBuilderRuntimeModulesConfigForArea(runtime, area, runtimeModuleCatalog) {
|
|
218
|
-
return buildRuntimeModulesConfigForArea(runtime
|
|
277
|
+
return buildRuntimeModulesConfigForArea(runtime.site.key, runtime.locale.current, readPhiServerApiCredentials().apiBaseUrl, readPhiServerApiCredentials().internalToken, area, runtimeModuleCatalog);
|
|
219
278
|
}
|
|
220
279
|
/**
|
|
221
280
|
* The Modules the published Area answers with, as opposed to the draft the Builder edits.
|
|
222
281
|
*
|
|
223
|
-
* Without a published
|
|
224
|
-
*
|
|
225
|
-
*
|
|
282
|
+
* Without a published selection the Area's default list decides, which is what a visitor is served in
|
|
283
|
+
* that case too. Read for the collision dialog, which has to say whether an address it asks to move
|
|
284
|
+
* already stands on the live Site. The structures read answers the published selection only where no
|
|
285
|
+
* Module draft is open; with one open, the live read says what is published.
|
|
226
286
|
*/
|
|
227
287
|
export const buildPhiBuilderPublishedRuntimeModuleIdsForArea = cache(async function buildPhiBuilderPublishedRuntimeModuleIdsForArea(runtime, area, runtimeModuleCatalog) {
|
|
228
288
|
const { apiBaseUrl, internalToken } = readPhiServerApiCredentials();
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
-
|
|
289
|
+
const state = await loadPhiBuilderAreaStructure(runtime.site.key, runtime.locale.current, apiBaseUrl, internalToken, area, runtimeModuleCatalog);
|
|
290
|
+
const published = state.modulesDraftOpen
|
|
291
|
+
? (await getExactSiteArea({
|
|
292
|
+
apiBaseUrl,
|
|
293
|
+
internalToken,
|
|
294
|
+
siteKey: runtime.site.key,
|
|
295
|
+
path: resolveStructureAreaPath(area),
|
|
296
|
+
locale: runtime.locale.current,
|
|
297
|
+
}))?.modules ?? null
|
|
298
|
+
: state.modules;
|
|
299
|
+
return readRuntimeModulesConfig(published, area, runtimeModuleCatalog).moduleIds;
|
|
232
300
|
});
|
|
233
301
|
export async function buildPhiBuilderRuntimeModuleIdsForArea(runtime, area, runtimeModuleCatalog) {
|
|
234
302
|
return (await buildPhiBuilderRuntimeModulesConfigForArea(runtime, area, runtimeModuleCatalog)).moduleIds;
|
|
@@ -293,8 +361,8 @@ export async function buildPhiBuilderAreaMetaByArea(runtime, runtimeModuleCatalo
|
|
|
293
361
|
}
|
|
294
362
|
/**
|
|
295
363
|
* What every Area's Shell tells its Controllers, from the same chain the drafts come from: the open
|
|
296
|
-
* structure draft, else what is published, else the code-owned Shell. Carried into every structure save
|
|
297
|
-
*
|
|
364
|
+
* structure draft, else what is published, else the code-owned Shell. Carried into every structure save,
|
|
365
|
+
* which states the tree whole.
|
|
298
366
|
*/
|
|
299
367
|
export async function buildPhiBuilderAreaControllerSettingsByArea(runtime, runtimeModuleCatalog) {
|
|
300
368
|
const areas = PHI_BUILDER_AREA_KEYS;
|
|
@@ -316,3 +384,43 @@ export async function buildPhiBuilderStructureShellPresetDraftsByArea(runtime, r
|
|
|
316
384
|
]));
|
|
317
385
|
return Object.fromEntries(entries);
|
|
318
386
|
}
|
|
387
|
+
/**
|
|
388
|
+
* The shell every Area takes, as the identity a structure save, a draft read and a Revisions scope name:
|
|
389
|
+
* the shell of the one Module that brings one and is selected there, else the base Module's.
|
|
390
|
+
*/
|
|
391
|
+
export async function buildPhiBuilderAreaPresetSourcesByArea(runtime, runtimeModuleCatalog) {
|
|
392
|
+
const states = await loadPhiBuilderAreaStoredStates(runtime.site.key, runtime.locale.current, readPhiServerApiCredentials().apiBaseUrl, readPhiServerApiCredentials().internalToken, runtimeModuleCatalog);
|
|
393
|
+
const sources = {};
|
|
394
|
+
for (const area of PHI_BUILDER_AREA_KEYS) {
|
|
395
|
+
const descriptor = states.get(area)?.shellBinding?.descriptor;
|
|
396
|
+
if (descriptor) {
|
|
397
|
+
sources[area] = {
|
|
398
|
+
ownerModuleId: descriptor.ownerModuleId,
|
|
399
|
+
presetKey: descriptor.presetKey,
|
|
400
|
+
sourcePresetVersion: descriptor.shellPresetVersion,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return sources;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Per Area, which Modules bring a shell for it and which shell its stored structure stands on.
|
|
408
|
+
*
|
|
409
|
+
* The first is what the Modules table refuses a second provider by; the second is what it warns about
|
|
410
|
+
* when a provider is switched on over a stored structure of another shell, and what "Clear Area" and a
|
|
411
|
+
* refused structure save name.
|
|
412
|
+
*/
|
|
413
|
+
export async function buildPhiBuilderAreaShellsByArea(runtime, runtimeModuleCatalog) {
|
|
414
|
+
const catalog = resolvePhiCmsDescriptorCatalog(runtimeModuleCatalog);
|
|
415
|
+
const states = await loadPhiBuilderAreaStoredStates(runtime.site.key, runtime.locale.current, readPhiServerApiCredentials().apiBaseUrl, readPhiServerApiCredentials().internalToken, runtimeModuleCatalog);
|
|
416
|
+
const shells = {};
|
|
417
|
+
for (const area of PHI_BUILDER_AREA_KEYS) {
|
|
418
|
+
const stored = states.get(area)?.stored?.sourcePreset ?? null;
|
|
419
|
+
shells[area] = {
|
|
420
|
+
providerModuleIds: listPhiCmsAreaShellProviders(catalog, resolvePhiBuilderAreaAsCmsArea(area))
|
|
421
|
+
.map((binding) => binding.moduleId),
|
|
422
|
+
storedSource: stored ? { ownerModuleId: stored.ownerModuleId, presetKey: stored.presetKey } : null,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
return shells;
|
|
426
|
+
}
|
|
@@ -39,6 +39,17 @@ export function PhiDeveloperBuilderShellsWorkspaceWidgetClient({ serverPreviewRe
|
|
|
39
39
|
*/
|
|
40
40
|
const siderLeftDraftKey = getPhiBuilderRegionDraftKey(area, "sider_left", pageKey);
|
|
41
41
|
const siderLeftDraft = usePhiDeveloperRegionDraftsValue(useCallback((drafts) => drafts[siderLeftDraftKey] ?? null, [siderLeftDraftKey]));
|
|
42
|
+
/*
|
|
43
|
+
* Whose shell this is: the base Module's, or the one an active Module brings in its place. Named under
|
|
44
|
+
* the top Region, because editing it stores a structure for exactly that shell.
|
|
45
|
+
*/
|
|
46
|
+
const shellOwnerModuleId = usePhiDeveloperBuilderStateValue((state) => state.areaPresetSourcesByArea[area]?.ownerModuleId ?? null);
|
|
47
|
+
const shellOwnerTitle = usePhiDeveloperBuilderStateValue((state) => shellOwnerModuleId
|
|
48
|
+
? state.runtimeModuleDefinitions.find((definition) => definition.moduleId === shellOwnerModuleId)?.title ?? shellOwnerModuleId
|
|
49
|
+
: null);
|
|
50
|
+
const shellOwnerSubtitle = shellOwnerTitle
|
|
51
|
+
? regionLabels.structure.surface.shellOwner.replace("%1", shellOwnerTitle)
|
|
52
|
+
: null;
|
|
42
53
|
const siderLeftFullHeight = hasPhiConfigFlag((siderLeftDraft ?? structureShellDrafts?.[siderLeftDraftKey])?.regionConfig, PhiCmsFlags.FullHeight);
|
|
43
54
|
const renderStructureRegion = (regionKey, title, subtitle) => {
|
|
44
55
|
const fallbackDraft = structureShellDrafts?.[getPhiBuilderRegionDraftKey(area, regionKey, pageKey)] ?? null;
|
|
@@ -55,7 +66,7 @@ export function PhiDeveloperBuilderShellsWorkspaceWidgetClient({ serverPreviewRe
|
|
|
55
66
|
[area]: fallbackDraft,
|
|
56
67
|
}, serverPreview: serverPreviewRegions?.[regionKey] ?? null, pickerLabels: pickerLabels, containerClassName: "phi-builder-workspace-region-scaffold" }, regionKey));
|
|
57
68
|
};
|
|
58
|
-
return (_jsx(PhiStructureDndProvider, { children: _jsx("div", { style: { minWidth: 0, width: "100%", minHeight: 0, flex: "1 1 auto" }, children: _jsx(PhiStructureRegionLayout, { labels: regionLabels, headerTop: renderStructureRegion("header_top", regionLabels.regions.headerTop.title), headerMain: renderStructureRegion("header_main", regionLabels.regions.headerMain.title), siderLeft: renderStructureRegion("sider_left", regionLabels.regions.siderLeft.title, siderLeftFullHeight
|
|
69
|
+
return (_jsx(PhiStructureDndProvider, { children: _jsx("div", { style: { minWidth: 0, width: "100%", minHeight: 0, flex: "1 1 auto" }, children: _jsx(PhiStructureRegionLayout, { labels: regionLabels, headerTop: renderStructureRegion("header_top", regionLabels.regions.headerTop.title, shellOwnerSubtitle), headerMain: renderStructureRegion("header_main", regionLabels.regions.headerMain.title), siderLeft: renderStructureRegion("sider_left", regionLabels.regions.siderLeft.title, siderLeftFullHeight
|
|
59
70
|
? regionLabels.structure.surface.siderSpansShell
|
|
60
71
|
: regionLabels.structure.surface.siderBesideContent), footerMain: renderStructureRegion("footer_main", regionLabels.regions.footerMain.title), footerBottom: renderStructureRegion("footer_bottom", regionLabels.regions.footerBottom.title), style: {
|
|
61
72
|
minWidth: 0,
|
|
@@ -11,6 +11,7 @@ export const PHI_BUILDER_RUNTIME_CONTROLLER_PLUGIN = {
|
|
|
11
11
|
!preloadData.runtimeModuleIdsByArea ||
|
|
12
12
|
!preloadData.modulePresetPagesByArea ||
|
|
13
13
|
!preloadData.areaPresetSourcesByArea ||
|
|
14
|
+
!preloadData.areaShellsByArea ||
|
|
14
15
|
!preloadData.navigationSurfacesByArea ||
|
|
15
16
|
!preloadData.unresolvedModuleIdsByArea ||
|
|
16
17
|
!preloadData.serverUnavailableModules ||
|
|
@@ -30,6 +31,7 @@ export const PHI_BUILDER_RUNTIME_CONTROLLER_PLUGIN = {
|
|
|
30
31
|
runtimeModuleIdsByArea: preloadData.runtimeModuleIdsByArea,
|
|
31
32
|
modulePresetPagesByArea: preloadData.modulePresetPagesByArea,
|
|
32
33
|
areaPresetSourcesByArea: preloadData.areaPresetSourcesByArea,
|
|
34
|
+
areaShellsByArea: preloadData.areaShellsByArea,
|
|
33
35
|
navigationSurfacesByArea: preloadData.navigationSurfacesByArea,
|
|
34
36
|
unresolvedModuleIdsByArea: preloadData.unresolvedModuleIdsByArea,
|
|
35
37
|
serverUnavailableModules: preloadData.serverUnavailableModules,
|
|
@@ -44,6 +44,7 @@ export type PhiBuilderRuntimeControllerPreload = {
|
|
|
44
44
|
areaControllerSettingsByArea: Record<string, PhiCmsTreeControllerSettings>;
|
|
45
45
|
modulePresetPagesByArea: PhiBuilderModulePresetPagesByArea;
|
|
46
46
|
areaPresetSourcesByArea: Partial<Record<PhiBuilderAreaKey, PhiCmsPresetSource>>;
|
|
47
|
+
areaShellsByArea: PhiWorkspaceCatalogState["areaShellsByArea"];
|
|
47
48
|
navigationSurfacesByArea: Partial<Record<PhiBuilderAreaKey, readonly PhiCmsResolvedNavigationSurface[]>>;
|
|
48
49
|
pageMetaLabels: PhiBuilderPageMetaPresentationLabels;
|
|
49
50
|
historyLabels: PhiHistoryLabels;
|