@phis/ui 0.6.1 → 0.6.3
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-root-layout.js +2 -0
- package/components/controls/phi-mask-picker-control.d.ts +7 -1
- package/components/controls/phi-mask-picker-control.js +18 -16
- package/components/controls/phi-media-picker-control.d.ts +30 -1
- package/components/controls/phi-media-picker-control.js +15 -2
- package/components/controls/phi-media-source-item-tile-control.d.ts +22 -0
- package/components/controls/phi-media-source-item-tile-control.js +65 -0
- package/components/forms/form-field-labels.d.ts +19 -0
- package/components/forms/form-field-labels.js +78 -0
- package/components/forms/form-provider-contract.d.ts +1 -17
- package/components/forms/form-provider-contract.js +4 -18
- package/components/forms/media-asset-field-keys.d.ts +27 -0
- package/components/forms/media-asset-field-keys.js +27 -0
- package/components/forms/phi-form-widget.js +5 -1
- package/components/forms/upload-field-keys.d.ts +27 -0
- package/components/forms/upload-field-keys.js +27 -0
- package/components/forms/upload-form-control.js +11 -5
- package/components/media/asset-controller-requirement.d.ts +9 -0
- package/components/media/asset-controller-requirement.js +42 -0
- package/components/media/label-sets/media-upload.d.ts +10 -0
- package/components/media/label-sets/media-upload.js +85 -0
- package/components/media/label-sets/media.js +31 -135
- package/components/media/media-upload-labels.d.ts +43 -0
- package/components/media/media-upload-labels.js +23 -0
- package/components/media/media-upload-refusals.d.ts +12 -0
- package/components/media/media-upload-refusals.js +28 -0
- package/components/media/media-widget-labels.d.ts +33 -26
- package/components/media/media-widget-labels.js +27 -36
- package/components/media/phi-area-upload-widget.js +3 -4
- package/components/media/phi-asset-inspector-section.d.ts +2 -2
- package/components/media/phi-image-inspector-widget.d.ts +2 -5
- package/components/media/phi-media-picker-binding.d.ts +17 -0
- package/components/media/phi-media-picker-binding.js +199 -4
- package/components/media/phi-media-picker-labels.d.ts +7 -0
- package/components/media/phi-media-picker-labels.js +25 -0
- package/components/media/phi-media-sources.d.ts +69 -0
- package/components/media/phi-media-sources.js +254 -0
- package/components/media/phi-media-upload.d.ts +1 -27
- package/components/media/phi-media-upload.js +4 -48
- package/components/runtime/runtime-controller-materialization.d.ts +5 -4
- package/components/runtime/runtime-controller-materialization.js +5 -4
- package/components/runtime/runtime-module-context.d.ts +5 -1
- package/components/runtime/runtime-module-context.js +4 -1
- package/components/runtime/runtime-module-media-source-client-manifest.d.ts +17 -0
- package/components/runtime/runtime-module-media-source-client-manifest.js +53 -0
- package/components/widgets/client/shared/phi-mask-picker.js +23 -13
- package/components/widgets/client/shared/phi-widget-image-tool-button.d.ts +7 -5
- package/components/widgets/client/shared/phi-widget-image-tool-button.js +11 -7
- package/components/widgets/client/shared/phi-widget-tool-buttons.js +2 -2
- package/components/widgets/config/mask.d.ts +6 -8
- package/components/widgets/config/mask.js +14 -12
- package/components/widgets/label-sets/authoring-tools.js +55 -1
- package/components/widgets/label-sets/history.js +0 -2
- package/components/widgets/label-sets/slot-upload.js +4 -4
- package/components/widgets/label-types/authoring-tools.d.ts +10 -0
- package/components/widgets/label-types/authoring-tools.js +6 -0
- package/components/widgets/label-types/history.d.ts +1 -1
- package/components/widgets/label-types/history.js +0 -1
- package/components/widgets/label-types/mask-picker.d.ts +31 -0
- package/components/widgets/label-types/mask-picker.js +30 -0
- package/components/widgets/label-types/slot-upload.d.ts +2 -2
- package/controls.d.ts +2 -0
- package/controls.js +1 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/module-client.d.ts +5 -1
- package/module-projection-client.js +1 -0
- package/next/areas/accounting-client.js +3 -2
- package/next/areas/admin-client.js +3 -2
- package/next/areas/app-client.js +3 -2
- package/next/areas/builder-client.js +3 -2
- package/next/areas/editor-client.js +3 -2
- package/next/areas/public-client.js +3 -2
- package/next/runtime-module-client-boundary.d.ts +3 -1
- package/next/runtime-module-client-boundary.js +3 -2
- package/package.json +7 -2
- package/plugins/runtime-modules/area-module-defaults.js +4 -3
- package/plugins/runtime-modules/asset/controller/definition.d.ts +2 -2
- package/plugins/runtime-modules/asset/controller/runtime.js +2 -2
- package/plugins/runtime-modules/asset/definition.d.ts +3 -2
- package/plugins/runtime-modules/asset/definition.js +11 -3
- package/plugins/runtime-modules/asset/ids.d.ts +8 -0
- package/plugins/runtime-modules/asset/ids.js +8 -0
- package/plugins/runtime-modules/asset/labels.d.ts +4 -0
- package/plugins/runtime-modules/asset/labels.js +94 -0
- package/plugins/runtime-modules/asset/media-asset-form-control.js +32 -7
- package/plugins/runtime-modules/asset/metadata-form.js +27 -18
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +14 -11
- package/plugins/runtime-modules/asset/widgets/area-upload/config.d.ts +2 -0
- package/plugins/runtime-modules/asset/widgets/area-upload/config.js +3 -0
- package/plugins/runtime-modules/asset/widgets/area-upload/server.js +3 -3
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.d.ts +2 -0
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.js +3 -0
- package/plugins/runtime-modules/asset/widgets/image-inspector/config.d.ts +2 -0
- package/plugins/runtime-modules/asset/widgets/image-inspector/config.js +3 -0
- package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -2
- package/plugins/runtime-modules/asset/widgets/media-picker/config.d.ts +1 -0
- package/plugins/runtime-modules/asset/widgets/media-picker/config.js +3 -0
- package/plugins/runtime-modules/auth/presets.d.ts +11 -0
- package/plugins/runtime-modules/auth/presets.js +17 -8
- package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +1 -4
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +2 -2
- package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +1 -3
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +4 -5
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -8
- package/plugins/runtime-modules/builder/clients/pages-header.js +2 -0
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +4 -4
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +0 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +2 -2
- package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -1
- package/plugins/runtime-modules/builder/controller/page-controller.js +8 -8
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +4 -1
- package/plugins/runtime-modules/builder/inspector-section-widget.js +5 -2
- package/plugins/runtime-modules/builder/module-authoring-catalog.server.js +3 -1
- package/plugins/runtime-modules/builder/navigation-catalog.server.js +3 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +1 -1
- package/plugins/runtime-modules/builder/offered-page-catalog.js +8 -3
- package/plugins/runtime-modules/builder/options-providers.js +2 -2
- package/plugins/runtime-modules/builder/page-address-rule.d.ts +7 -0
- package/plugins/runtime-modules/builder/page-address-rule.js +12 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +4 -0
- package/plugins/runtime-modules/builder/persistence.js +6 -7
- package/plugins/runtime-modules/builder/public-route-collisions.d.ts +1 -1
- package/plugins/runtime-modules/builder/public-route-collisions.js +6 -1
- package/plugins/runtime-modules/builder/region-keys.d.ts +10 -0
- package/plugins/runtime-modules/builder/region-keys.js +10 -0
- package/plugins/runtime-modules/builder/runtime-module-sandbox.server.js +8 -1
- package/plugins/runtime-modules/builder/runtime-module-selection.js +5 -5
- package/plugins/runtime-modules/builder/services/runtime-modules-table.js +24 -6
- package/plugins/runtime-modules/builder/signal-endpoints.js +2 -1
- package/plugins/runtime-modules/builder/use-offered-page-catalog.d.ts +2 -2
- package/plugins/runtime-modules/builder/use-offered-page-catalog.js +5 -3
- package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +19 -12
- package/plugins/runtime-modules/client-manifests/accounting.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/accounting.js +1 -0
- package/plugins/runtime-modules/client-manifests/admin.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/admin.js +1 -0
- package/plugins/runtime-modules/client-manifests/app.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/app.js +1 -0
- package/plugins/runtime-modules/client-manifests/builder.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/builder.js +1 -0
- package/plugins/runtime-modules/client-manifests/common.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/common.js +3 -0
- package/plugins/runtime-modules/client-manifests/editor.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/editor.js +1 -0
- package/plugins/runtime-modules/client-manifests/public.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/public.js +1 -0
- package/plugins/runtime-modules/contracts.js +61 -0
- package/plugins/runtime-modules/core/client-media-sources.d.ts +5 -0
- package/plugins/runtime-modules/core/client-media-sources.js +6 -0
- package/plugins/runtime-modules/core/messaging/forms.js +2 -15
- package/plugins/runtime-modules/core/messaging/labels.d.ts +0 -12
- package/plugins/runtime-modules/core/messaging/labels.js +0 -24
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -6
- package/plugins/runtime-modules/core/widgets/collection-view/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +7 -0
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +8 -2
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +14 -2
- package/plugins/runtime-modules/core/widgets/image/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/image/editor.d.ts +1 -4
- package/plugins/runtime-modules/core/widgets/image/editor.js +2 -2
- package/plugins/runtime-modules/core/widgets/slot-upload/client.js +2 -3
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +4 -25
- package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
- package/plugins/runtime-modules/preset-contracts/pub-area.js +0 -1
- package/plugins/runtime-modules/resolver.js +27 -1
- package/plugins/runtime-modules/settings.d.ts +20 -3
- package/plugins/runtime-modules/settings.js +35 -5
- package/plugins/runtime-modules/site-module-client-manifests.d.ts +2 -0
- package/plugins/runtime-modules/site-module-client-manifests.js +2 -0
- package/plugins/runtime-modules/site-modules-client.d.ts +5 -0
- package/plugins/runtime-modules/site-modules-client.js +1 -0
- package/plugins/runtime-modules/theme/brand-theme-model.js +0 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +97 -192
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +6 -2
- package/runtime-client-manifests-accounting.d.ts +1 -1
- package/runtime-client-manifests-accounting.js +1 -1
- package/runtime-client-manifests-admin.d.ts +1 -1
- package/runtime-client-manifests-admin.js +1 -1
- package/runtime-client-manifests-app.d.ts +1 -1
- package/runtime-client-manifests-app.js +1 -1
- package/runtime-client-manifests-builder.d.ts +1 -1
- package/runtime-client-manifests-builder.js +1 -1
- package/runtime-client-manifests-editor.d.ts +1 -1
- package/runtime-client-manifests-editor.js +1 -1
- package/runtime-client-manifests-public.d.ts +2 -1
- package/runtime-client-manifests-public.js +1 -1
- package/runtime-media-source-client.d.ts +3 -0
- package/runtime-media-source-client.js +2 -0
- package/server-helpers/cms-request.js +10 -4
- package/server-helpers/search-index.js +7 -6
- package/server-helpers/site-build-id.d.ts +25 -0
- package/server-helpers/site-build-id.js +27 -0
- package/theme/phi-theme-presets.d.ts +13 -3
- package/theme/phi-theme-presets.js +20 -3
- package/theme/phi-theme-seed-derivation.d.ts +240 -0
- package/theme/phi-theme-seed-derivation.js +126 -0
- package/types/cms-plugins.d.ts +29 -0
- package/types/media-source.d.ts +48 -0
- package/types/media-source.js +1 -0
- package/types/site-config.d.ts +1 -2
- package/types/site-theme.d.ts +0 -6
- package/types.d.ts +1 -0
- package/components/media/asset-controller-routes.d.ts +0 -8
- package/components/media/asset-controller-routes.js +0 -31
- package/helpers/brand-contact.d.ts +0 -14
- package/helpers/brand-contact.js +0 -26
|
@@ -4,6 +4,7 @@ import { PHI_FORM_CONTROLLER_TYPE } from "../../components/forms/runtime-form-co
|
|
|
4
4
|
import { assertPhiRuntimeModule, buildPhiRuntimeModuleLayoutType, buildPhiRuntimeModuleControllerDescriptor, buildPhiRuntimeModuleWidgetType, hasPhiRuntimeModuleController, } from "./contracts";
|
|
5
5
|
import { readPhiRuntimeTreeRenderMode, resolvePhiRuntimeWidgetImplementationMode, } from "./render-mode";
|
|
6
6
|
import { resolvePhiRuntimeModuleServerBinding } from "./server-capabilities";
|
|
7
|
+
import { listPhiAlwaysActiveRuntimeModuleIds } from "./settings";
|
|
7
8
|
import { PHI_VIEWER_ACCESS_ANYONE, } from "../../types/access";
|
|
8
9
|
import { stripRenderableBlockDefaults } from "../../helpers/renderable-block-serialization";
|
|
9
10
|
import { PhiCmsWidgetType } from "../../constants/cms-widget-types";
|
|
@@ -59,6 +60,10 @@ function loadModule(catalog, moduleId) {
|
|
|
59
60
|
JSON.stringify(catalogEntry.definition.calendarAdapters ?? [])) {
|
|
60
61
|
throw new Error(`Runtime module "${moduleId}" Calendar adapter descriptors do not match its catalog definition.`);
|
|
61
62
|
}
|
|
63
|
+
if (JSON.stringify(runtimeModule.mediaSources ?? []) !==
|
|
64
|
+
JSON.stringify(catalogEntry.definition.mediaSources ?? [])) {
|
|
65
|
+
throw new Error(`Runtime module "${moduleId}" media source descriptors do not match its catalog definition.`);
|
|
66
|
+
}
|
|
62
67
|
if (JSON.stringify(runtimeModule.videoProviders ?? []) !==
|
|
63
68
|
JSON.stringify(catalogEntry.definition.videoProviders ?? [])) {
|
|
64
69
|
throw new Error(`Runtime module "${moduleId}" video provider descriptors do not match its catalog definition.`);
|
|
@@ -109,9 +114,22 @@ export async function resolvePhiRuntimeModuleSet({ catalog, moduleIds, area, ser
|
|
|
109
114
|
if (area && !catalogEntry.definition.eligibleAreas.includes(area)) {
|
|
110
115
|
throw new Error(`Runtime module "${moduleId}" is not eligible for Area "${area}".`);
|
|
111
116
|
}
|
|
112
|
-
if (catalogEntry.definition.kind === "platform" ||
|
|
117
|
+
if (catalogEntry.definition.kind === "platform" ||
|
|
118
|
+
catalogEntry.definition.activation === "always" ||
|
|
119
|
+
baseModuleIds.has(moduleId)) {
|
|
113
120
|
throw new Error(`Locked runtime module "${moduleId}" must not be selected in Area runtimeModules.`);
|
|
114
121
|
}
|
|
122
|
+
}
|
|
123
|
+
/*
|
|
124
|
+
* A Module declared `activation: "always"` is active in every Area it is eligible for, ahead of what
|
|
125
|
+
* the Area selects and on the same terms: where its server part is missing it stays off and is named
|
|
126
|
+
* with the selected Modules that are. Without an Area there is nothing to be eligible for.
|
|
127
|
+
*/
|
|
128
|
+
const alwaysActiveModuleIds = area
|
|
129
|
+
? listPhiAlwaysActiveRuntimeModuleIds(area, [...catalog.values()].map((entry) => entry.definition))
|
|
130
|
+
: [];
|
|
131
|
+
for (const moduleId of [...alwaysActiveModuleIds, ...selectedModuleIds]) {
|
|
132
|
+
const catalogEntry = catalog.get(moduleId);
|
|
115
133
|
const bindingResolution = resolvePhiRuntimeModuleServerBinding(catalogEntry.definition.serverBinding, serverCapabilities);
|
|
116
134
|
if (!bindingResolution.available) {
|
|
117
135
|
unavailableModuleBindings.set(moduleId, bindingResolution);
|
|
@@ -124,6 +142,7 @@ export async function resolvePhiRuntimeModuleSet({ catalog, moduleIds, area, ser
|
|
|
124
142
|
const layoutDefinitionsByType = new Map();
|
|
125
143
|
const dataProviderDescriptorsByKey = new Map();
|
|
126
144
|
const calendarAdapterDescriptorsByKey = new Map();
|
|
145
|
+
const mediaSourceDescriptorsByKey = new Map();
|
|
127
146
|
const videoProviderDescriptorsByKey = new Map();
|
|
128
147
|
const formFieldTypeProviderDescriptorsByKey = new Map();
|
|
129
148
|
const formValidationProviderDescriptorsByKey = new Map();
|
|
@@ -177,6 +196,12 @@ export async function resolvePhiRuntimeModuleSet({ catalog, moduleIds, area, ser
|
|
|
177
196
|
}
|
|
178
197
|
calendarAdapterDescriptorsByKey.set(descriptor.key, descriptor);
|
|
179
198
|
}
|
|
199
|
+
for (const descriptor of definition.mediaSources ?? []) {
|
|
200
|
+
if (mediaSourceDescriptorsByKey.has(descriptor.key)) {
|
|
201
|
+
throw new Error(`Media source "${descriptor.key}" is owned by more than one runtime module.`);
|
|
202
|
+
}
|
|
203
|
+
mediaSourceDescriptorsByKey.set(descriptor.key, descriptor);
|
|
204
|
+
}
|
|
180
205
|
for (const descriptor of definition.videoProviders ?? []) {
|
|
181
206
|
if (videoProviderDescriptorsByKey.has(descriptor.key)) {
|
|
182
207
|
throw new Error(`Video provider "${descriptor.key}" is owned by more than one runtime module.`);
|
|
@@ -247,6 +272,7 @@ export async function resolvePhiRuntimeModuleSet({ catalog, moduleIds, area, ser
|
|
|
247
272
|
layoutDefinitionsByType,
|
|
248
273
|
dataProviderDescriptorsByKey,
|
|
249
274
|
calendarAdapterDescriptorsByKey,
|
|
275
|
+
mediaSourceDescriptorsByKey,
|
|
250
276
|
videoProviderDescriptorsByKey,
|
|
251
277
|
formFieldTypeProviderDescriptorsByKey,
|
|
252
278
|
formValidationProviderDescriptorsByKey,
|
|
@@ -3,6 +3,22 @@ import type { PhisDeclarableThreadKind } from "../../types/threads";
|
|
|
3
3
|
import type { PhiDeclaredModuleSeed } from "../../types/seed";
|
|
4
4
|
import type { PhiRuntimeModuleDefinition, PhiRuntimeModuleId } from "./contracts";
|
|
5
5
|
export declare function readPhiRuntimeModuleIds(value: unknown): PhiRuntimeModuleId[] | null;
|
|
6
|
+
/**
|
|
7
|
+
* Whether a Site chooses this Module per Area, or it is active without being chosen.
|
|
8
|
+
*
|
|
9
|
+
* Three kinds of Module are locked: the Platform Module, an Area's Base Module, and a Module declared
|
|
10
|
+
* `activation: "always"`. None of them is ever part of a stored selection -- each is added where the
|
|
11
|
+
* active set is built -- so this is the one question every reader and writer of a selection asks.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isPhiRuntimeModuleSelectable(definition: Pick<PhiRuntimeModuleDefinition, "moduleId" | "kind" | "activation">): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The Modules declared `activation: "always"` that are active in an Area: every one eligible for it.
|
|
16
|
+
*
|
|
17
|
+
* In catalog order, so the active set a render builds is the same on every request. Whether its server
|
|
18
|
+
* part is there is not answered here; the callers that build an active set ask that of every Module
|
|
19
|
+
* they add, selected or not.
|
|
20
|
+
*/
|
|
21
|
+
export declare function listPhiAlwaysActiveRuntimeModuleIds(area: string, moduleDefinitions: Iterable<Pick<PhiRuntimeModuleDefinition, "moduleId" | "activation" | "eligibleAreas">>): PhiRuntimeModuleId[];
|
|
6
22
|
export declare function assertPhiRuntimeModuleIdsAllowedForArea(area: string, moduleIds: readonly PhiRuntimeModuleId[], moduleDefinitions: readonly PhiRuntimeModuleDefinition[]): void;
|
|
7
23
|
export declare function resolvePhiAuthUiProviderModuleId(moduleIds: readonly PhiRuntimeModuleId[], moduleDefinitions: readonly PhiRuntimeModuleDefinition[]): PhiRuntimeModuleId | null;
|
|
8
24
|
/** Why a stored Module id is not part of the selection this build can serve. */
|
|
@@ -27,9 +43,10 @@ export type PhiRuntimeModuleSelectionReading = {
|
|
|
27
43
|
* `assertPhiRuntimeModuleIdsAllowedForArea` is what a Builder save still goes through, so nothing
|
|
28
44
|
* unresolvable is ever written back.
|
|
29
45
|
*
|
|
30
|
-
* The Area's own Base Module
|
|
31
|
-
*
|
|
32
|
-
*
|
|
46
|
+
* The Area's own Base Module, the Platform Module and a Module declared `activation: "always"` are not
|
|
47
|
+
* part of this at all. They are implicit and added where the active set is built
|
|
48
|
+
* (`listPhiAlwaysActiveRuntimeModuleIds` for the last); a build missing a Base or the Platform Module
|
|
49
|
+
* cannot serve the Area, and that is a failure rather than a selection to trim.
|
|
33
50
|
*/
|
|
34
51
|
export declare function readPhiRuntimeModuleIdsForArea(area: string, moduleIds: readonly PhiRuntimeModuleId[] | null | undefined, moduleDefinitions: readonly PhiRuntimeModuleDefinition[]): PhiRuntimeModuleSelectionReading;
|
|
35
52
|
/**
|
|
@@ -23,6 +23,35 @@ export function readPhiRuntimeModuleIds(value) {
|
|
|
23
23
|
}
|
|
24
24
|
return moduleIds;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Whether a Site chooses this Module per Area, or it is active without being chosen.
|
|
28
|
+
*
|
|
29
|
+
* Three kinds of Module are locked: the Platform Module, an Area's Base Module, and a Module declared
|
|
30
|
+
* `activation: "always"`. None of them is ever part of a stored selection -- each is added where the
|
|
31
|
+
* active set is built -- so this is the one question every reader and writer of a selection asks.
|
|
32
|
+
*/
|
|
33
|
+
export function isPhiRuntimeModuleSelectable(definition) {
|
|
34
|
+
return (definition.kind === "module" &&
|
|
35
|
+
definition.activation !== "always" &&
|
|
36
|
+
!isPhiRuntimeAreaBaseModuleId(definition.moduleId));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The Modules declared `activation: "always"` that are active in an Area: every one eligible for it.
|
|
40
|
+
*
|
|
41
|
+
* In catalog order, so the active set a render builds is the same on every request. Whether its server
|
|
42
|
+
* part is there is not answered here; the callers that build an active set ask that of every Module
|
|
43
|
+
* they add, selected or not.
|
|
44
|
+
*/
|
|
45
|
+
export function listPhiAlwaysActiveRuntimeModuleIds(area, moduleDefinitions) {
|
|
46
|
+
const cmsArea = resolveSelectionArea(area);
|
|
47
|
+
const moduleIds = [];
|
|
48
|
+
for (const definition of moduleDefinitions) {
|
|
49
|
+
if (definition.activation === "always" && definition.eligibleAreas.includes(cmsArea)) {
|
|
50
|
+
moduleIds.push(definition.moduleId);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return moduleIds;
|
|
54
|
+
}
|
|
26
55
|
function resolveSelectionArea(area) {
|
|
27
56
|
const cmsArea = area === "public" ? "public" : area;
|
|
28
57
|
if (!isPhiCmsAreaKey(cmsArea)) {
|
|
@@ -41,7 +70,7 @@ export function assertPhiRuntimeModuleIdsAllowedForArea(area, moduleIds, moduleD
|
|
|
41
70
|
if (!definition.eligibleAreas.includes(cmsArea)) {
|
|
42
71
|
throw new Error(`Runtime module "${moduleId}" is not eligible for Area "${cmsArea}".`);
|
|
43
72
|
}
|
|
44
|
-
if (definition
|
|
73
|
+
if (!isPhiRuntimeModuleSelectable(definition)) {
|
|
45
74
|
throw new Error(`Locked runtime module "${moduleId}" must not be persisted in Area settings.`);
|
|
46
75
|
}
|
|
47
76
|
}
|
|
@@ -67,9 +96,10 @@ export function resolvePhiAuthUiProviderModuleId(moduleIds, moduleDefinitions) {
|
|
|
67
96
|
* `assertPhiRuntimeModuleIdsAllowedForArea` is what a Builder save still goes through, so nothing
|
|
68
97
|
* unresolvable is ever written back.
|
|
69
98
|
*
|
|
70
|
-
* The Area's own Base Module
|
|
71
|
-
*
|
|
72
|
-
*
|
|
99
|
+
* The Area's own Base Module, the Platform Module and a Module declared `activation: "always"` are not
|
|
100
|
+
* part of this at all. They are implicit and added where the active set is built
|
|
101
|
+
* (`listPhiAlwaysActiveRuntimeModuleIds` for the last); a build missing a Base or the Platform Module
|
|
102
|
+
* cannot serve the Area, and that is a failure rather than a selection to trim.
|
|
73
103
|
*/
|
|
74
104
|
export function readPhiRuntimeModuleIdsForArea(area, moduleIds, moduleDefinitions) {
|
|
75
105
|
const cmsArea = resolveSelectionArea(area);
|
|
@@ -85,7 +115,7 @@ export function readPhiRuntimeModuleIdsForArea(area, moduleIds, moduleDefinition
|
|
|
85
115
|
reading.unresolved.push({ moduleId, reason: "ineligible" });
|
|
86
116
|
continue;
|
|
87
117
|
}
|
|
88
|
-
if (definition
|
|
118
|
+
if (!isPhiRuntimeModuleSelectable(definition)) {
|
|
89
119
|
reading.unresolved.push({ moduleId, reason: "locked" });
|
|
90
120
|
continue;
|
|
91
121
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PhiCmsAreaKey } from "../../constants/cms-areas";
|
|
2
2
|
import { type PhiRuntimeModuleCalendarAdapterClientManifest } from "../../components/runtime/runtime-module-calendar-adapter-client-manifest";
|
|
3
|
+
import { type PhiRuntimeModuleMediaSourceClientManifest } from "../../components/runtime/runtime-module-media-source-client-manifest";
|
|
3
4
|
import { type PhiRuntimeModuleDataProviderClientManifest } from "../../components/runtime/runtime-module-data-provider-client-manifest";
|
|
4
5
|
import { type PhiRuntimeModuleRenderClientManifest } from "../../components/runtime/runtime-module-render-client-manifest";
|
|
5
6
|
import type { PhiRuntimeModuleControllerClientManifest } from "../../components/runtime/runtime-module-controller-client-manifest";
|
|
@@ -25,6 +26,7 @@ export type PhiSiteModuleClientManifests = {
|
|
|
25
26
|
render: PhiRuntimeModuleRenderClientManifest;
|
|
26
27
|
dataProvider: PhiRuntimeModuleDataProviderClientManifest;
|
|
27
28
|
calendarAdapter: PhiRuntimeModuleCalendarAdapterClientManifest;
|
|
29
|
+
mediaSource: PhiRuntimeModuleMediaSourceClientManifest;
|
|
28
30
|
uiProvider: PhiRuntimeModuleUiProviderClientManifest;
|
|
29
31
|
};
|
|
30
32
|
export declare function extendWithPhiSiteModuleClientManifests(contributions: PhiSiteModuleClientContributions, area: PhiCmsAreaKey, base: PhiSiteModuleClientManifests): PhiSiteModuleClientManifests;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { extendPhiRuntimeModuleCalendarAdapterClientManifest, } from "../../components/runtime/runtime-module-calendar-adapter-client-manifest";
|
|
3
|
+
import { extendPhiRuntimeModuleMediaSourceClientManifest, } from "../../components/runtime/runtime-module-media-source-client-manifest";
|
|
3
4
|
import { extendPhiRuntimeModuleDataProviderClientManifest, } from "../../components/runtime/runtime-module-data-provider-client-manifest";
|
|
4
5
|
import { extendPhiRuntimeModuleRenderClientManifest, } from "../../components/runtime/runtime-module-render-client-manifest";
|
|
5
6
|
import { extendPhiRuntimeModuleUiProviderClientManifest, } from "../../components/runtime/runtime-module-ui-provider-client-manifest";
|
|
@@ -14,6 +15,7 @@ export function extendWithPhiSiteModuleClientManifests(contributions, area, base
|
|
|
14
15
|
render: extendPhiRuntimeModuleRenderClientManifest(base.render, areaContributions.renderClients ?? []),
|
|
15
16
|
dataProvider: extendPhiRuntimeModuleDataProviderClientManifest(base.dataProvider, areaContributions.dataProviders ?? []),
|
|
16
17
|
calendarAdapter: extendPhiRuntimeModuleCalendarAdapterClientManifest(base.calendarAdapter, contributions.calendarAdapters),
|
|
18
|
+
mediaSource: extendPhiRuntimeModuleMediaSourceClientManifest(base.mediaSource, contributions.mediaSources),
|
|
17
19
|
uiProvider: extendPhiRuntimeModuleUiProviderClientManifest(base.uiProvider, areaContributions.uiProviders ?? []),
|
|
18
20
|
};
|
|
19
21
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PhiCmsAreaKey } from "../../constants/cms-areas";
|
|
2
2
|
import type { PhiRuntimeModuleRenderClient } from "../../components/runtime/runtime-module-render-client-manifest";
|
|
3
3
|
import type { PhiRuntimeModuleCalendarAdapterClientDefinition, PhiRuntimeModuleDataProviderClientDefinition } from "../../types/cms-plugins";
|
|
4
|
+
import type { PhiMediaSourceClientDefinition } from "../../types/media-source";
|
|
4
5
|
import type { PhiRuntimeModuleControllerClientAreaContribution } from "./area-contributions-controller-client";
|
|
5
6
|
import type { PhiRuntimeModuleUiProviderClientDefinition } from "../../components/runtime/runtime-module-ui-provider-client-manifest";
|
|
6
7
|
/**
|
|
@@ -18,6 +19,9 @@ import type { PhiRuntimeModuleUiProviderClientDefinition } from "../../component
|
|
|
18
19
|
* their type when a Widget renders; an Area dimension would model a distinction the runtime does not
|
|
19
20
|
* make.
|
|
20
21
|
*
|
|
22
|
+
* Media sources are held flat for the same reason: the picker resolves them by key, and whether one is
|
|
23
|
+
* offered is decided by its Module being active in the Area, not by a list per Area.
|
|
24
|
+
*
|
|
21
25
|
* Authoring contributions are not here either, and for a stronger reason than shape: they live in
|
|
22
26
|
* `site-modules-authoring-client.tsx` and in a generated file of their own, so that importing this
|
|
23
27
|
* projection cannot drag a Builder implementation into a live Area's bundle.
|
|
@@ -34,6 +38,7 @@ export type PhiSiteModuleClientAreaContributions = {
|
|
|
34
38
|
export type PhiSiteModuleClientContributions = {
|
|
35
39
|
areas: Readonly<Partial<Record<PhiCmsAreaKey, PhiSiteModuleClientAreaContributions>>>;
|
|
36
40
|
calendarAdapters: readonly PhiRuntimeModuleCalendarAdapterClientDefinition[];
|
|
41
|
+
mediaSources: readonly PhiMediaSourceClientDefinition[];
|
|
37
42
|
};
|
|
38
43
|
/** A Site that installed no Modules of its own. */
|
|
39
44
|
export declare const PHI_NO_SITE_MODULE_CLIENT_CONTRIBUTIONS: PhiSiteModuleClientContributions;
|