@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.
Files changed (208) hide show
  1. package/components/cms/phi-cms-root-layout.js +2 -0
  2. package/components/controls/phi-mask-picker-control.d.ts +7 -1
  3. package/components/controls/phi-mask-picker-control.js +18 -16
  4. package/components/controls/phi-media-picker-control.d.ts +30 -1
  5. package/components/controls/phi-media-picker-control.js +15 -2
  6. package/components/controls/phi-media-source-item-tile-control.d.ts +22 -0
  7. package/components/controls/phi-media-source-item-tile-control.js +65 -0
  8. package/components/forms/form-field-labels.d.ts +19 -0
  9. package/components/forms/form-field-labels.js +78 -0
  10. package/components/forms/form-provider-contract.d.ts +1 -17
  11. package/components/forms/form-provider-contract.js +4 -18
  12. package/components/forms/media-asset-field-keys.d.ts +27 -0
  13. package/components/forms/media-asset-field-keys.js +27 -0
  14. package/components/forms/phi-form-widget.js +5 -1
  15. package/components/forms/upload-field-keys.d.ts +27 -0
  16. package/components/forms/upload-field-keys.js +27 -0
  17. package/components/forms/upload-form-control.js +11 -5
  18. package/components/media/asset-controller-requirement.d.ts +9 -0
  19. package/components/media/asset-controller-requirement.js +42 -0
  20. package/components/media/label-sets/media-upload.d.ts +10 -0
  21. package/components/media/label-sets/media-upload.js +85 -0
  22. package/components/media/label-sets/media.js +31 -135
  23. package/components/media/media-upload-labels.d.ts +43 -0
  24. package/components/media/media-upload-labels.js +23 -0
  25. package/components/media/media-upload-refusals.d.ts +12 -0
  26. package/components/media/media-upload-refusals.js +28 -0
  27. package/components/media/media-widget-labels.d.ts +33 -26
  28. package/components/media/media-widget-labels.js +27 -36
  29. package/components/media/phi-area-upload-widget.js +3 -4
  30. package/components/media/phi-asset-inspector-section.d.ts +2 -2
  31. package/components/media/phi-image-inspector-widget.d.ts +2 -5
  32. package/components/media/phi-media-picker-binding.d.ts +17 -0
  33. package/components/media/phi-media-picker-binding.js +199 -4
  34. package/components/media/phi-media-picker-labels.d.ts +7 -0
  35. package/components/media/phi-media-picker-labels.js +25 -0
  36. package/components/media/phi-media-sources.d.ts +69 -0
  37. package/components/media/phi-media-sources.js +254 -0
  38. package/components/media/phi-media-upload.d.ts +1 -27
  39. package/components/media/phi-media-upload.js +4 -48
  40. package/components/runtime/runtime-controller-materialization.d.ts +5 -4
  41. package/components/runtime/runtime-controller-materialization.js +5 -4
  42. package/components/runtime/runtime-module-context.d.ts +5 -1
  43. package/components/runtime/runtime-module-context.js +4 -1
  44. package/components/runtime/runtime-module-media-source-client-manifest.d.ts +17 -0
  45. package/components/runtime/runtime-module-media-source-client-manifest.js +53 -0
  46. package/components/widgets/client/shared/phi-mask-picker.js +23 -13
  47. package/components/widgets/client/shared/phi-widget-image-tool-button.d.ts +7 -5
  48. package/components/widgets/client/shared/phi-widget-image-tool-button.js +11 -7
  49. package/components/widgets/client/shared/phi-widget-tool-buttons.js +2 -2
  50. package/components/widgets/config/mask.d.ts +6 -8
  51. package/components/widgets/config/mask.js +14 -12
  52. package/components/widgets/label-sets/authoring-tools.js +55 -1
  53. package/components/widgets/label-sets/history.js +0 -2
  54. package/components/widgets/label-sets/slot-upload.js +4 -4
  55. package/components/widgets/label-types/authoring-tools.d.ts +10 -0
  56. package/components/widgets/label-types/authoring-tools.js +6 -0
  57. package/components/widgets/label-types/history.d.ts +1 -1
  58. package/components/widgets/label-types/history.js +0 -1
  59. package/components/widgets/label-types/mask-picker.d.ts +31 -0
  60. package/components/widgets/label-types/mask-picker.js +30 -0
  61. package/components/widgets/label-types/slot-upload.d.ts +2 -2
  62. package/controls.d.ts +2 -0
  63. package/controls.js +1 -0
  64. package/helpers/cms-region-keys.d.ts +1 -1
  65. package/module-client.d.ts +5 -1
  66. package/module-projection-client.js +1 -0
  67. package/next/areas/accounting-client.js +3 -2
  68. package/next/areas/admin-client.js +3 -2
  69. package/next/areas/app-client.js +3 -2
  70. package/next/areas/builder-client.js +3 -2
  71. package/next/areas/editor-client.js +3 -2
  72. package/next/areas/public-client.js +3 -2
  73. package/next/runtime-module-client-boundary.d.ts +3 -1
  74. package/next/runtime-module-client-boundary.js +3 -2
  75. package/package.json +7 -2
  76. package/plugins/runtime-modules/area-module-defaults.js +4 -3
  77. package/plugins/runtime-modules/asset/controller/definition.d.ts +2 -2
  78. package/plugins/runtime-modules/asset/controller/runtime.js +2 -2
  79. package/plugins/runtime-modules/asset/definition.d.ts +3 -2
  80. package/plugins/runtime-modules/asset/definition.js +11 -3
  81. package/plugins/runtime-modules/asset/ids.d.ts +8 -0
  82. package/plugins/runtime-modules/asset/ids.js +8 -0
  83. package/plugins/runtime-modules/asset/labels.d.ts +4 -0
  84. package/plugins/runtime-modules/asset/labels.js +94 -0
  85. package/plugins/runtime-modules/asset/media-asset-form-control.js +32 -7
  86. package/plugins/runtime-modules/asset/metadata-form.js +27 -18
  87. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +14 -11
  88. package/plugins/runtime-modules/asset/widgets/area-upload/config.d.ts +2 -0
  89. package/plugins/runtime-modules/asset/widgets/area-upload/config.js +3 -0
  90. package/plugins/runtime-modules/asset/widgets/area-upload/server.js +3 -3
  91. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.d.ts +2 -0
  92. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.js +3 -0
  93. package/plugins/runtime-modules/asset/widgets/image-inspector/config.d.ts +2 -0
  94. package/plugins/runtime-modules/asset/widgets/image-inspector/config.js +3 -0
  95. package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -2
  96. package/plugins/runtime-modules/asset/widgets/media-picker/config.d.ts +1 -0
  97. package/plugins/runtime-modules/asset/widgets/media-picker/config.js +3 -0
  98. package/plugins/runtime-modules/auth/presets.d.ts +11 -0
  99. package/plugins/runtime-modules/auth/presets.js +17 -8
  100. package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +1 -4
  101. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +2 -2
  102. package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +1 -3
  103. package/plugins/runtime-modules/builder/clients/inspector-image-field.js +4 -5
  104. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -8
  105. package/plugins/runtime-modules/builder/clients/pages-header.js +2 -0
  106. package/plugins/runtime-modules/builder/clients/pages-workspace.js +4 -4
  107. package/plugins/runtime-modules/builder/clients/widget-inspector.js +0 -1
  108. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +2 -2
  109. package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -1
  110. package/plugins/runtime-modules/builder/controller/page-controller.js +8 -8
  111. package/plugins/runtime-modules/builder/controller/workspace-controller.js +4 -1
  112. package/plugins/runtime-modules/builder/inspector-section-widget.js +5 -2
  113. package/plugins/runtime-modules/builder/module-authoring-catalog.server.js +3 -1
  114. package/plugins/runtime-modules/builder/navigation-catalog.server.js +3 -0
  115. package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +1 -1
  116. package/plugins/runtime-modules/builder/offered-page-catalog.js +8 -3
  117. package/plugins/runtime-modules/builder/options-providers.js +2 -2
  118. package/plugins/runtime-modules/builder/page-address-rule.d.ts +7 -0
  119. package/plugins/runtime-modules/builder/page-address-rule.js +12 -0
  120. package/plugins/runtime-modules/builder/page-presets.server.js +4 -0
  121. package/plugins/runtime-modules/builder/persistence.js +6 -7
  122. package/plugins/runtime-modules/builder/public-route-collisions.d.ts +1 -1
  123. package/plugins/runtime-modules/builder/public-route-collisions.js +6 -1
  124. package/plugins/runtime-modules/builder/region-keys.d.ts +10 -0
  125. package/plugins/runtime-modules/builder/region-keys.js +10 -0
  126. package/plugins/runtime-modules/builder/runtime-module-sandbox.server.js +8 -1
  127. package/plugins/runtime-modules/builder/runtime-module-selection.js +5 -5
  128. package/plugins/runtime-modules/builder/services/runtime-modules-table.js +24 -6
  129. package/plugins/runtime-modules/builder/signal-endpoints.js +2 -1
  130. package/plugins/runtime-modules/builder/use-offered-page-catalog.d.ts +2 -2
  131. package/plugins/runtime-modules/builder/use-offered-page-catalog.js +5 -3
  132. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +19 -12
  133. package/plugins/runtime-modules/client-manifests/accounting.d.ts +1 -0
  134. package/plugins/runtime-modules/client-manifests/accounting.js +1 -0
  135. package/plugins/runtime-modules/client-manifests/admin.d.ts +1 -0
  136. package/plugins/runtime-modules/client-manifests/admin.js +1 -0
  137. package/plugins/runtime-modules/client-manifests/app.d.ts +1 -0
  138. package/plugins/runtime-modules/client-manifests/app.js +1 -0
  139. package/plugins/runtime-modules/client-manifests/builder.d.ts +1 -0
  140. package/plugins/runtime-modules/client-manifests/builder.js +1 -0
  141. package/plugins/runtime-modules/client-manifests/common.d.ts +1 -0
  142. package/plugins/runtime-modules/client-manifests/common.js +3 -0
  143. package/plugins/runtime-modules/client-manifests/editor.d.ts +1 -0
  144. package/plugins/runtime-modules/client-manifests/editor.js +1 -0
  145. package/plugins/runtime-modules/client-manifests/public.d.ts +1 -0
  146. package/plugins/runtime-modules/client-manifests/public.js +1 -0
  147. package/plugins/runtime-modules/contracts.js +61 -0
  148. package/plugins/runtime-modules/core/client-media-sources.d.ts +5 -0
  149. package/plugins/runtime-modules/core/client-media-sources.js +6 -0
  150. package/plugins/runtime-modules/core/messaging/forms.js +2 -15
  151. package/plugins/runtime-modules/core/messaging/labels.d.ts +0 -12
  152. package/plugins/runtime-modules/core/messaging/labels.js +0 -24
  153. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -6
  154. package/plugins/runtime-modules/core/widgets/collection-view/config.d.ts +1 -0
  155. package/plugins/runtime-modules/core/widgets/collection-view/config.js +7 -0
  156. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +8 -2
  157. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
  158. package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +1 -1
  159. package/plugins/runtime-modules/core/widgets/collection-view/server.js +14 -2
  160. package/plugins/runtime-modules/core/widgets/image/authoring.js +1 -1
  161. package/plugins/runtime-modules/core/widgets/image/editor.d.ts +1 -4
  162. package/plugins/runtime-modules/core/widgets/image/editor.js +2 -2
  163. package/plugins/runtime-modules/core/widgets/slot-upload/client.js +2 -3
  164. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +4 -25
  165. package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
  166. package/plugins/runtime-modules/preset-contracts/pub-area.js +0 -1
  167. package/plugins/runtime-modules/resolver.js +27 -1
  168. package/plugins/runtime-modules/settings.d.ts +20 -3
  169. package/plugins/runtime-modules/settings.js +35 -5
  170. package/plugins/runtime-modules/site-module-client-manifests.d.ts +2 -0
  171. package/plugins/runtime-modules/site-module-client-manifests.js +2 -0
  172. package/plugins/runtime-modules/site-modules-client.d.ts +5 -0
  173. package/plugins/runtime-modules/site-modules-client.js +1 -0
  174. package/plugins/runtime-modules/theme/brand-theme-model.js +0 -1
  175. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +97 -192
  176. package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +6 -2
  177. package/runtime-client-manifests-accounting.d.ts +1 -1
  178. package/runtime-client-manifests-accounting.js +1 -1
  179. package/runtime-client-manifests-admin.d.ts +1 -1
  180. package/runtime-client-manifests-admin.js +1 -1
  181. package/runtime-client-manifests-app.d.ts +1 -1
  182. package/runtime-client-manifests-app.js +1 -1
  183. package/runtime-client-manifests-builder.d.ts +1 -1
  184. package/runtime-client-manifests-builder.js +1 -1
  185. package/runtime-client-manifests-editor.d.ts +1 -1
  186. package/runtime-client-manifests-editor.js +1 -1
  187. package/runtime-client-manifests-public.d.ts +2 -1
  188. package/runtime-client-manifests-public.js +1 -1
  189. package/runtime-media-source-client.d.ts +3 -0
  190. package/runtime-media-source-client.js +2 -0
  191. package/server-helpers/cms-request.js +10 -4
  192. package/server-helpers/search-index.js +7 -6
  193. package/server-helpers/site-build-id.d.ts +25 -0
  194. package/server-helpers/site-build-id.js +27 -0
  195. package/theme/phi-theme-presets.d.ts +13 -3
  196. package/theme/phi-theme-presets.js +20 -3
  197. package/theme/phi-theme-seed-derivation.d.ts +240 -0
  198. package/theme/phi-theme-seed-derivation.js +126 -0
  199. package/types/cms-plugins.d.ts +29 -0
  200. package/types/media-source.d.ts +48 -0
  201. package/types/media-source.js +1 -0
  202. package/types/site-config.d.ts +1 -2
  203. package/types/site-theme.d.ts +0 -6
  204. package/types.d.ts +1 -0
  205. package/components/media/asset-controller-routes.d.ts +0 -8
  206. package/components/media/asset-controller-routes.js +0 -31
  207. package/helpers/brand-contact.d.ts +0 -14
  208. package/helpers/brand-contact.js +0 -26
@@ -9,6 +9,8 @@ import { getPhiInspectorWidgetLabels } from "../../../components/widgets/label-s
9
9
  import { resolvePhiInspectorSurfaceLabels } from "./clients/inspector-surface-labels";
10
10
  import { getPhiColorPickerLabels } from "../../../components/widgets/label-sets/color-picker";
11
11
  import { getPhiIconPickerLabels } from "../../../components/widgets/label-sets/icon-picker";
12
+ import { getPhiMediaWidgetLabels } from "../../../components/media/label-sets/media";
13
+ import { PhiMediaPickerLabelsProvider } from "../../../components/media/phi-media-picker-labels";
12
14
  import { PhiBuilderLayoutInspectorSectionWidgetClient, PhiBuilderRegionInspectorSectionWidgetClient, PhiBuilderWidgetInspectorSectionWidgetClient, } from "./clients/inspector-section-widget";
13
15
  import { buildPhiBuilderRuntimeModuleIdsForArea } from "./area-shell-presets.server";
14
16
  import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
@@ -39,7 +41,7 @@ export async function PhiBuilderInspectorSectionWidget({ runtime, registry, view
39
41
  ...targetDataProviderDescriptors.map((descriptor) => descriptor.key),
40
42
  ]),
41
43
  ];
42
- const [backgroundLabels, borderLabels, paddingLabels, geometryLabels, signalsLabels, colorPickerLabels, iconPickerLabels, inspectorLabels,] = await Promise.all([
44
+ const [backgroundLabels, borderLabels, paddingLabels, geometryLabels, signalsLabels, colorPickerLabels, iconPickerLabels, inspectorLabels, mediaPickerLabels,] = await Promise.all([
43
45
  getPhiBackgroundWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
44
46
  getPhiBorderWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
45
47
  getPhiPaddingWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
@@ -48,7 +50,8 @@ export async function PhiBuilderInspectorSectionWidget({ runtime, registry, view
48
50
  getPhiColorPickerLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
49
51
  getPhiIconPickerLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
50
52
  getPhiInspectorWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
53
+ getPhiMediaWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
51
54
  ]);
52
55
  const surfaceLabels = resolvePhiInspectorSurfaceLabels(inspectorLabels);
53
- return (_jsx(PhiRuntimeModuleAuthoringDataProviderHost, { providerKeys: authoringDataProviderKeys, children: _jsx(PhiRuntimeModuleDataProviderClientHost, { providerKeys: resolvePhiBuilderAuthoringPickerDataProviderKeysFromCatalog(registry.runtimeModuleCatalog), mode: "live", children: view === "region" ? (_jsx(PhiBuilderRegionInspectorSectionWidgetClient, { section: section, signalRoutes: signalRoutes, geometryLabels: geometryLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, paddingLabels: paddingLabels, surfaceLabels: surfaceLabels, visibilityLabels: inspectorLabels.regionVisibility, colorPickerLabels: colorPickerLabels })) : view === "layout" ? (_jsx(PhiBuilderLayoutInspectorSectionWidgetClient, { section: section, signalRoutes: signalRoutes, signalsLabels: signalsLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, paddingLabels: paddingLabels, surfaceLabels: surfaceLabels, gridLabels: inspectorLabels.grid, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, fieldLabels: inspectorLabels.fields })) : (_jsx(PhiBuilderWidgetInspectorSectionWidgetClient, { section: section, signalRoutes: signalRoutes, geometryLabels: geometryLabels, surfaceLabels: surfaceLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, signalsLabels: signalsLabels, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, fieldLabels: inspectorLabels.fields })) }) }));
56
+ return (_jsx(PhiMediaPickerLabelsProvider, { labels: mediaPickerLabels, children: _jsx(PhiRuntimeModuleAuthoringDataProviderHost, { providerKeys: authoringDataProviderKeys, children: _jsx(PhiRuntimeModuleDataProviderClientHost, { providerKeys: resolvePhiBuilderAuthoringPickerDataProviderKeysFromCatalog(registry.runtimeModuleCatalog), mode: "live", children: view === "region" ? (_jsx(PhiBuilderRegionInspectorSectionWidgetClient, { section: section, signalRoutes: signalRoutes, geometryLabels: geometryLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, paddingLabels: paddingLabels, surfaceLabels: surfaceLabels, visibilityLabels: inspectorLabels.regionVisibility, colorPickerLabels: colorPickerLabels })) : view === "layout" ? (_jsx(PhiBuilderLayoutInspectorSectionWidgetClient, { section: section, signalRoutes: signalRoutes, signalsLabels: signalsLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, paddingLabels: paddingLabels, surfaceLabels: surfaceLabels, gridLabels: inspectorLabels.grid, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, fieldLabels: inspectorLabels.fields })) : (_jsx(PhiBuilderWidgetInspectorSectionWidgetClient, { section: section, signalRoutes: signalRoutes, geometryLabels: geometryLabels, surfaceLabels: surfaceLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, signalsLabels: signalsLabels, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, fieldLabels: inspectorLabels.fields })) }) }) }));
54
57
  }
@@ -18,7 +18,9 @@ export function buildPhiBuilderModuleAuthoringCatalog({ catalog, area, activeMod
18
18
  areaDefinition.baseModuleId,
19
19
  ]);
20
20
  return [...catalog.entries()].flatMap(([moduleId, entry]) => {
21
- const locked = lockedModuleIds.has(moduleId);
21
+ // Locked is "active without being selected": the client keeps a locked entry whatever the Area's
22
+ // selection says, and a Module declared `activation: "always"` is in no selection.
23
+ const locked = lockedModuleIds.has(moduleId) || entry.definition.activation === "always";
22
24
  if (!activeModuleIds.has(moduleId)) {
23
25
  return [];
24
26
  }
@@ -2,6 +2,7 @@ import "server-only";
2
2
  import { PHI_BUILDER_AREA_KEYS, resolvePhiBuilderAreaAsCmsArea, } from "../../../constants/cms-areas";
3
3
  import { compilePhiCmsActiveRouteTable, resolvePhiCmsActiveNavigationSurfaces, resolvePhiCmsDescriptorCatalog, } from "../../../plugins/runtime-modules/descriptor-compiler";
4
4
  import { fetchSiteNavigationScopes } from "../../../gateway/site-nav";
5
+ import { listPhiAlwaysActiveRuntimeModuleIds } from "../settings";
5
6
  import { createPhiBuilderCustomNavigationSurface } from "../../../helpers/cms-navigation-catalog";
6
7
  import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
7
8
  export async function buildPhiBuilderNavigationSurfacesByArea(runtime, runtimeModuleCatalog, optionalModuleIdsByArea) {
@@ -15,6 +16,7 @@ export async function buildPhiBuilderNavigationSurfacesByArea(runtime, runtimeMo
15
16
  internalToken: readPhiServerApiCredentials().internalToken,
16
17
  siteKey: runtime.site.key,
17
18
  });
19
+ const moduleDefinitions = [...runtimeModuleCatalog.values()].map((entry) => entry.definition);
18
20
  return Object.fromEntries(PHI_BUILDER_AREA_KEYS.map((builderArea) => {
19
21
  const area = resolvePhiBuilderAreaAsCmsArea(builderArea);
20
22
  const areaDefinition = catalog.areaDefinitions.get(area);
@@ -24,6 +26,7 @@ export async function buildPhiBuilderNavigationSurfacesByArea(runtime, runtimeMo
24
26
  const activeModuleIds = new Set([
25
27
  platformModuleId,
26
28
  areaDefinition.baseModuleId,
29
+ ...listPhiAlwaysActiveRuntimeModuleIds(area, moduleDefinitions),
27
30
  ...(optionalModuleIdsByArea[builderArea] ?? []),
28
31
  ]);
29
32
  // The declared table: this catalog names surfaces and entries, and reads no Area config, so a
@@ -7,7 +7,7 @@ import type { PhiDeveloperBuilderWorkspaceState } from "./developer-workspace-ty
7
7
  * controller its state -- and both are the same store; saying which fields are consulted keeps that a
8
8
  * fact rather than a coincidence.
9
9
  */
10
- export type PhiBuilderOfferedCatalogState = Pick<PhiDeveloperBuilderWorkspaceState, "modulePresetPagesByArea" | "customPages" | "persistedPageCatalogByArea" | "navigationSurfacesByArea" | "runtimeModuleIdsByArea" | "areaRootRoutes">;
10
+ export type PhiBuilderOfferedCatalogState = Pick<PhiDeveloperBuilderWorkspaceState, "modulePresetPagesByArea" | "customPages" | "persistedPageCatalogByArea" | "navigationSurfacesByArea" | "runtimeModuleIdsByArea" | "runtimeModuleDefinitions" | "areaRootRoutes">;
11
11
  /**
12
12
  * Every Page that could stand at this Area's root, whether or not it applied for the job.
13
13
  *
@@ -5,6 +5,7 @@ import { findPhiBuilderPageKeyFromStoragePath, normalizePhiBuilderCmsCatalogPath
5
5
  import { findFirstPhiCmsNavigationLinkPath } from "../../../components/regions/presets/navigation-redirect";
6
6
  import { resolvePhiRuntimeAreaDefinition } from "../area-definitions";
7
7
  import { resolvePhiAreaRootRouteNavKey } from "../area-root-route";
8
+ import { listPhiAlwaysActiveRuntimeModuleIds } from "../settings";
8
9
  import { readPhiBuilderStoredAreaRootRoute } from "./developer-workspace-store";
9
10
  /**
10
11
  * Which Modules answer in this Area, and which Module the Area itself is.
@@ -12,14 +13,18 @@ import { readPhiBuilderStoredAreaRootRoute } from "./developer-workspace-store";
12
13
  * Switched on here, or the Area's own base Module -- which is never in the selection because it is
13
14
  * never switchable: the Area is its Module. Leaving it out would drop the landing every Site starts
14
15
  * with from the list of the landings it may choose, and would leave the root slot with no applicant
15
- * to fall back to.
16
+ * to fall back to. A Module declared `activation: "always"` is not in the selection either, and
17
+ * answers in every Area it is eligible for.
16
18
  */
17
19
  function resolvePhiBuilderAreaModuleActivation(state, area) {
18
20
  const baseModuleId = resolvePhiRuntimeAreaDefinition(resolvePhiBuilderAreaAsCmsArea(area))?.baseModuleId ?? null;
19
- const selectedModuleIds = new Set(state.runtimeModuleIdsByArea?.[area] ?? []);
21
+ const activeModuleIds = new Set([
22
+ ...listPhiAlwaysActiveRuntimeModuleIds(area, state.runtimeModuleDefinitions ?? []),
23
+ ...(state.runtimeModuleIdsByArea?.[area] ?? []),
24
+ ]);
20
25
  return {
21
26
  baseModuleId,
22
- isActive: (moduleId) => moduleId === baseModuleId || selectedModuleIds.has(moduleId),
27
+ isActive: (moduleId) => moduleId === baseModuleId || activeModuleIds.has(moduleId),
23
28
  };
24
29
  }
25
30
  /**
@@ -2,6 +2,7 @@
2
2
  import { PHI_WORKSPACE_CATALOG_SCOPE } from "../../../components/workspace/catalog-store";
3
3
  import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
4
4
  import { isPhiRuntimeAreaBaseModuleId, resolvePhiRuntimeAreaDefinition, } from "../../../plugins/runtime-modules/area-definitions";
5
+ import { isPhiRuntimeModuleSelectable } from "../../../plugins/runtime-modules/settings";
5
6
  import { isPhiCmsErrorPagePath } from "../../../constants/cms-error-pages";
6
7
  import { PHI_BUILDER_AREA_LANDING_PAGE_EMPTY, PHI_BUILDER_AREA_ROOT_ROUTE_AUTOMATIC, PHI_BUILDER_AREA_ROOT_ROUTE_LANDING, } from "./area-settings-values";
7
8
  import { readPhiControlOptionsProviderParam, createPhiControlOptionsProviderClient, } from "../../../components/controls/phi-options-provider";
@@ -127,8 +128,7 @@ function resolveRuntimeModulesOptions(context) {
127
128
  label: definition.title,
128
129
  description: definition.description,
129
130
  icon: definition.icon ?? (definition.iconFamily ? `@phis/ui/widgets:${definition.iconFamily}` : undefined),
130
- disabled: definition.kind === "platform" ||
131
- definition.moduleId === baseModuleId,
131
+ disabled: !isPhiRuntimeModuleSelectable(definition),
132
132
  }))
133
133
  .sort((left, right) => left.label.localeCompare(right.label, "en", { sensitivity: "base" })),
134
134
  };
@@ -1,5 +1,6 @@
1
1
  import { type PhiPresetPageNode } from "../../../helpers/cms-page-catalog";
2
2
  import type { PhiRuntimeModuleId } from "../../../types";
3
+ import type { PhiDeveloperBuilderArea, PhiDeveloperBuilderWorkspaceState } from "./developer-workspace-types";
3
4
  export type PhiBuilderPageAddressConflict = {
4
5
  kind: "collision" | "nested";
5
6
  /** The address of the Site Page the requested one conflicts with. */
@@ -40,6 +41,12 @@ export declare function findPhiBuilderModuleAddressConflict(requestedPath: strin
40
41
  /** The Area's base Module, whose Pages are edited in place rather than replaced by a Site Page. */
41
42
  baseModuleId?: PhiRuntimeModuleId | null;
42
43
  }): PhiBuilderModuleAddressConflict | null;
44
+ /**
45
+ * The Modules whose addresses an Area's Site Pages keep clear of: the ones the Area selects and the
46
+ * ones declared `activation: "always"`, which answer there without being selected. The Area's Base
47
+ * Module is named apart (`baseModuleId`), because its Pages are edited in place.
48
+ */
49
+ export declare function listPhiBuilderAddressedModuleIds(state: Pick<PhiDeveloperBuilderWorkspaceState, "runtimeModuleIdsByArea" | "runtimeModuleDefinitions">, area: PhiDeveloperBuilderArea): PhiRuntimeModuleId[];
43
50
  export declare function describePhiBuilderModuleAddressConflict(conflict: PhiBuilderModuleAddressConflict): string;
44
51
  /**
45
52
  * The first Site Page that stands on a Module's package path, per Area, or null.
@@ -1,5 +1,6 @@
1
1
  import { normalizePhiBuilderCmsCatalogPath } from "../../../helpers/cms-page-catalog";
2
2
  import { buildPhiRuntimeModulePackageRoutePrefix } from "../../../helpers/runtime-module-route-path";
3
+ import { listPhiAlwaysActiveRuntimeModuleIds } from "../settings";
3
4
  function collectSitePagePaths(nodes, paths = []) {
4
5
  for (const node of nodes) {
5
6
  // Site Pages only: a Module Page has no Site path, and folders are not Pages.
@@ -76,6 +77,17 @@ export function findPhiBuilderModuleAddressConflict(requestedPath, input) {
76
77
  };
77
78
  return visit(input.catalog);
78
79
  }
80
+ /**
81
+ * The Modules whose addresses an Area's Site Pages keep clear of: the ones the Area selects and the
82
+ * ones declared `activation: "always"`, which answer there without being selected. The Area's Base
83
+ * Module is named apart (`baseModuleId`), because its Pages are edited in place.
84
+ */
85
+ export function listPhiBuilderAddressedModuleIds(state, area) {
86
+ return [...new Set([
87
+ ...listPhiAlwaysActiveRuntimeModuleIds(area, state.runtimeModuleDefinitions ?? []),
88
+ ...(state.runtimeModuleIdsByArea?.[area] ?? []),
89
+ ])];
90
+ }
79
91
  export function describePhiBuilderModuleAddressConflict(conflict) {
80
92
  return conflict.base
81
93
  ? `${conflict.path} is one of this Area's built-in Pages. Open it in the Builder and edit it there; a second Page cannot take its address.`
@@ -12,6 +12,7 @@ import { PHI_BUILDER_PAGE_REGION_KEYS } from "./region-keys";
12
12
  import { PHI_BUILDER_AREA_SEARCH_PARAM, PHI_BUILDER_PAGE_SEARCH_PARAM, PHI_BUILDER_RUNTIME_MODULES_SEARCH_PARAM, normalizePhiBuilderAreaSearchParam, normalizePhiBuilderPageSearchParam, normalizePhiBuilderRuntimeModuleIdsSearchParam, } from "../../../helpers/cms-scope-search-params";
13
13
  import { compilePhiCmsActiveRouteTable, instantiatePhiCmsRoutePreset, resolvePhiCmsDescriptorCatalog, resolvePhiCmsRoutePreset, resolvePhiCmsRoutePresetByPageId, } from "../../../plugins/runtime-modules/descriptor-compiler";
14
14
  import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
15
+ import { listPhiAlwaysActiveRuntimeModuleIds } from "../settings";
15
16
  import { createPhiPresetCmsPageId, isPhiCmsInstanceId } from "../../../types/cms-instance-id";
16
17
  import { buildPhiBuilderAreaLandingSelection, buildPhiBuilderRuntimeModulesConfigForArea, } from "./area-shell-presets.server";
17
18
  import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
@@ -52,6 +53,9 @@ const resolvePhiBuilderAreaRouteTable = cache(async function resolvePhiBuilderAr
52
53
  }
53
54
  activeModuleKeys.add(runtimeModuleCatalog.platformModuleId);
54
55
  const cmsArea = resolvePhiBuilderAreaAsCmsArea(area);
56
+ for (const moduleId of listPhiAlwaysActiveRuntimeModuleIds(cmsArea, [...runtimeModuleCatalog.values()].map((entry) => entry.definition))) {
57
+ activeModuleKeys.add(moduleId);
58
+ }
55
59
  const catalog = resolvePhiCmsDescriptorCatalog(runtimeModuleCatalog);
56
60
  const areaDefinition = catalog.areaDefinitions.get(cmsArea);
57
61
  if (!areaDefinition) {
@@ -3,15 +3,14 @@ import { phiAreaPath } from "../../../helpers/locale";
3
3
  import { resolvePhiBuilderAreaAsCmsArea, resolvePhiBuilderAreaMask } from "../../../constants/cms-areas";
4
4
  import { PhiCmsFlags, PhiCmsStatus } from "../../../constants/phi-cms";
5
5
  import { readPhiCmsInstanceId } from "../../../types/cms-instance-id";
6
- import { getPhiBuilderRegionDraftKey, PHI_BUILDER_PAGE_REGION_KEYS, PHI_BUILDER_SHELL_REGION_KEYS, } from "./region-keys";
6
+ import { getPhiBuilderPageDraftKey, getPhiBuilderRegionDraftKey, PHI_BUILDER_PAGE_REGION_KEYS, PHI_BUILDER_SHELL_REGION_KEYS, } from "./region-keys";
7
7
  import { getPhiBuilderDefaultRegionDraft } from "./region-defaults";
8
8
  import { serializePhiDeveloperBuilderRegionConfig } from "./region-hydration";
9
9
  import { stripPhiResolvedAssetProjections } from "../../../components/media/image-presentation";
10
10
  import { resolvePhiBuilderCmsStoragePath } from "../../../helpers/cms-paths";
11
11
  import { resolvePhiCmsWidgetContentBindingForConfig } from "../../../helpers/cms-content-binding";
12
12
  import { resolvePhiCmsRegionType } from "../../../helpers/cms-region-keys";
13
- import { resolvePhiAuthUiProviderModuleId, resolvePhiDeclaredMediaSpaces, resolvePhiDeclaredSeeds, resolvePhiDeclaredThreadKinds, resolvePhiRuntimeModuleIdsForArea, } from "../../../plugins/runtime-modules/settings";
14
- import { isPhiRuntimeAreaBaseModuleId } from "../../../plugins/runtime-modules/area-definitions";
13
+ import { resolvePhiAuthUiProviderModuleId, resolvePhiDeclaredMediaSpaces, resolvePhiDeclaredSeeds, isPhiRuntimeModuleSelectable, resolvePhiDeclaredThreadKinds, resolvePhiRuntimeModuleIdsForArea, } from "../../../plugins/runtime-modules/settings";
15
14
  import { createPhiBuilderDraftAllocationKey } from "./draft-allocation-key";
16
15
  import { clearPhiBuilderDraftAllocation, storePhiBuilderDraftAllocation, commitPhiDeveloperBuilderAreaConfig, readPhiBuilderEffectiveAreaRootRoute, readPhiBuilderEffectiveAreaMeta, } from "./developer-workspace-store";
17
16
  import { resolvePhiBuilderActivePageCatalog, resolvePhiBuilderPageDefaultFlags, resolvePhiBuilderPagePresetSource, } from "../../../helpers/cms-page-catalog";
@@ -52,7 +51,7 @@ function assertPersistableAreaRuntimeModuleIds(moduleIds, moduleDefinitions) {
52
51
  if (!definition) {
53
52
  throw new Error(`Runtime module "${moduleId}" is not installed.`);
54
53
  }
55
- if (definition.kind !== "platform" && !isPhiRuntimeAreaBaseModuleId(moduleId)) {
54
+ if (isPhiRuntimeModuleSelectable(definition)) {
56
55
  continue;
57
56
  }
58
57
  throw new Error(`Locked runtime module "${moduleId}" must not be persisted in Area settings.`);
@@ -546,7 +545,7 @@ export async function savePhiDeveloperBuilderDraft(state, regionDrafts, workspac
546
545
  const pagePath = resolvePhiBuilderCmsStoragePath(area, pageKey, pages);
547
546
  const currentPagePresetSource = resolvePhiBuilderPagePresetSource(pageKey, pages);
548
547
  const currentAreaPresetSource = state.areaPresetSourcesByArea[area] ?? null;
549
- const pageMetaDraft = state.pageMetaDrafts?.[getPhiBuilderRegionDraftKey(area, "page_meta", pageKey)] ?? null;
548
+ const pageMetaDraft = state.pageMetaDrafts?.[getPhiBuilderPageDraftKey(area, "page_meta", pageKey)] ?? null;
550
549
  /*
551
550
  * The Page flags travel apart from the rest of the meta draft: the titles become translated
552
551
  * messages and this is a column on the row, so the payload splits them even though the dialog
@@ -563,7 +562,7 @@ export async function savePhiDeveloperBuilderDraft(state, regionDrafts, workspac
563
562
  const pageFlags = pageMetaDraft?.index == null
564
563
  ? resolvePhiBuilderPageDefaultFlags(pageKey, pages)
565
564
  : pageMetaDraft.index === false ? PhiCmsFlags.NoIndex : 0;
566
- const isDeletedPageDraft = state.deletedPageDrafts?.[getPhiBuilderRegionDraftKey(area, "page_delete", pageKey)] === true;
565
+ const isDeletedPageDraft = state.deletedPageDrafts?.[getPhiBuilderPageDraftKey(area, "page_delete", pageKey)] === true;
567
566
  const allocationKey = createPhiBuilderDraftAllocationKey(area, pageKey, workspaceKind === "pages" ? "page" : "area");
568
567
  const draftAllocation = state.draftAllocations[allocationKey] ??
569
568
  await getPhiDeveloperBuilderDraftAllocation({
@@ -657,7 +656,7 @@ export async function savePhiDeveloperBuilderDraft(state, regionDrafts, workspac
657
656
  overlays: [],
658
657
  layoutNodes,
659
658
  contentWidgets,
660
- controllerSettings: requirePhiBuilderControllerSettings(state.pageControllerSettings, getPhiBuilderRegionDraftKey(area, "page_meta", pageKey), `Page "${pageKey}"`),
659
+ controllerSettings: requirePhiBuilderControllerSettings(state.pageControllerSettings, getPhiBuilderPageDraftKey(area, "page_meta", pageKey), `Page "${pageKey}"`),
661
660
  });
662
661
  storePhiDeveloperBuilderDraftAllocation(allocationKey, result);
663
662
  savedDraftState = result;
@@ -14,7 +14,7 @@ export declare function resolvePhiBuilderPublicRouteCollisionAnswers(state: Pick
14
14
  * actually answer with: an address freed by switching another Module off in this session counts as
15
15
  * free, and one taken while the dialog stood counts as taken.
16
16
  */
17
- export declare function findPhiBuilderPublicRouteAnswerProblem(state: Pick<PhiDeveloperBuilderWorkspaceState, "publicRouteClaims" | "publicRoutePaths" | "runtimeModuleIdsByArea" | "persistedPageCatalogByArea">, request: Pick<PhiBuilderPublicRouteCollisionRequest, "moduleId" | "answers">): string | null;
17
+ export declare function findPhiBuilderPublicRouteAnswerProblem(state: Pick<PhiDeveloperBuilderWorkspaceState, "publicRouteClaims" | "publicRoutePaths" | "runtimeModuleIdsByArea" | "runtimeModuleDefinitions" | "persistedPageCatalogByArea">, request: Pick<PhiBuilderPublicRouteCollisionRequest, "moduleId" | "answers">): string | null;
18
18
  /**
19
19
  * The answers, written where the route table reads them.
20
20
  *
@@ -2,6 +2,7 @@ import { buildPhiRuntimeModulePackageRoutePrefix } from "../../../helpers/runtim
2
2
  import { buildPhiPublicRouteAddressMap, findPhiPublicRoutePathCollisions, } from "../../../helpers/public-route-claims";
3
3
  import { isPhiAssignablePublicRoutePath, } from "../../../helpers/cms-area-config";
4
4
  import { assignPhiWorkspacePublicRoutePaths } from "./workspace-catalog-actions";
5
+ import { listPhiAlwaysActiveRuntimeModuleIds } from "../settings";
5
6
  import { markPhiBuilderModuleAreasDirty } from "./developer-workspace-store";
6
7
  /**
7
8
  * Which Public addresses a Site Page already occupies.
@@ -30,7 +31,11 @@ function resolvePhiBuilderPersistedPublicPages(state) {
30
31
  * same unsaved selection.
31
32
  */
32
33
  function buildPhiBuilderPublicAddressMap(state, options) {
33
- const activeModuleIds = new Set((state.runtimeModuleIdsByArea?.public ?? []).filter((moduleId) => moduleId !== options?.without));
34
+ // A Module declared `activation: "always"` answers on Public without being in the selection.
35
+ const activeModuleIds = new Set([
36
+ ...listPhiAlwaysActiveRuntimeModuleIds("public", state.runtimeModuleDefinitions ?? []),
37
+ ...(state.runtimeModuleIdsByArea?.public ?? []),
38
+ ].filter((moduleId) => moduleId !== options?.without));
34
39
  return buildPhiPublicRouteAddressMap({
35
40
  claims: state.publicRouteClaims ?? [],
36
41
  activeModuleIds,
@@ -5,3 +5,13 @@ export type PhiBuilderPageRegionKey = (typeof PHI_BUILDER_PAGE_REGION_KEYS)[numb
5
5
  export type PhiBuilderRegionKey = PhiBuilderShellRegionKey | PhiBuilderPageRegionKey;
6
6
  export declare function isPhiBuilderPageScopedRegion(regionKey: string): regionKey is PhiBuilderPageRegionKey;
7
7
  export declare function getPhiBuilderRegionDraftKey(area: string, regionKey: string, pageKey?: string | null): string;
8
+ /** What the Builder keeps per Page beside its Regions: the meta as edited, and that the Page is to be deleted. */
9
+ export type PhiBuilderPageDraftKind = "page_meta" | "page_delete";
10
+ /**
11
+ * The key of a Page's own draft state in the workspace.
12
+ *
13
+ * Not a Region key: `page_meta` and `page_delete` are not Regions, so `getPhiBuilderRegionDraftKey` leaves the
14
+ * Page out of them and every Page of an Area would share one slot -- the first Page opened would fill it, and
15
+ * the rest would save its title, description and indexing as their own.
16
+ */
17
+ export declare function getPhiBuilderPageDraftKey(area: string, kind: PhiBuilderPageDraftKind, pageKey: string): string;
@@ -10,3 +10,13 @@ export function getPhiBuilderRegionDraftKey(area, regionKey, pageKey) {
10
10
  }
11
11
  return `${area}:${regionKey}`;
12
12
  }
13
+ /**
14
+ * The key of a Page's own draft state in the workspace.
15
+ *
16
+ * Not a Region key: `page_meta` and `page_delete` are not Regions, so `getPhiBuilderRegionDraftKey` leaves the
17
+ * Page out of them and every Page of an Area would share one slot -- the first Page opened would fill it, and
18
+ * the rest would save its title, description and indexing as their own.
19
+ */
20
+ export function getPhiBuilderPageDraftKey(area, kind, pageKey) {
21
+ return `${area}:${pageKey}:${kind}`;
22
+ }
@@ -1,12 +1,19 @@
1
1
  import "server-only";
2
2
  import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
3
3
  import { resolvePhiRuntimeModuleSet, resolvePhiRuntimeRenderRegistry, } from "../../../plugins/runtime-modules/resolver";
4
+ import { resolvePhiRuntimeModuleIdsForArea } from "../../../plugins/runtime-modules/settings";
4
5
  import { buildPhiRuntimeModuleAccessRegistry, filterPhiCmsRenderableTreeForViewer, } from "../../../helpers/cms-access-policy";
5
6
  export async function resolvePhiBuilderCanvasRuntimeModuleSandbox({ catalog, area, moduleIds, trees, viewer, serverCapabilities, }) {
7
+ /*
8
+ * The ids arrive from a preview snapshot, the address bar or the stored Area, and only the last was
9
+ * read tolerantly before it got here. A browser tab opened before a release keeps sending the
10
+ * selection it loaded -- one that may name a Module this build no longer has or has since locked --
11
+ * and the canvas must not go down over it, so all three are read the way a stored selection is.
12
+ */
6
13
  const moduleSet = await resolvePhiRuntimeModuleSet({
7
14
  catalog,
8
15
  area: resolvePhiBuilderAreaAsCmsArea(area),
9
- moduleIds,
16
+ moduleIds: resolvePhiRuntimeModuleIdsForArea(area, moduleIds, [...catalog.values()].map((entry) => entry.definition)),
10
17
  serverCapabilities,
11
18
  });
12
19
  const accessRegistry = buildPhiRuntimeModuleAccessRegistry(moduleSet);
@@ -1,6 +1,6 @@
1
1
  import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
2
2
  import { isPhiRuntimeAreaBaseModuleId, resolvePhiRuntimeAreaDefinition, } from "../area-definitions";
3
- import { assertPhiRuntimeModuleIdsAllowedForArea } from "../settings";
3
+ import { assertPhiRuntimeModuleIdsAllowedForArea, isPhiRuntimeModuleSelectable } from "../settings";
4
4
  import { getPhiDeveloperBuilderStateSnapshot, markPhiBuilderModuleAreasDirty } from "./developer-workspace-store";
5
5
  import { setPhiWorkspaceModuleSelection } from "./workspace-catalog-actions";
6
6
  import { capturePhiBuilderModulesHistoryState, createPhiBuilderHistoryContext, phiBuilderHistory, } from "./history";
@@ -15,8 +15,9 @@ function areRuntimeModuleIdsEqual(left, right) {
15
15
  *
16
16
  * Every id has to name an installed Module, and a Base Module id from a different Area is refused
17
17
  * outright -- selecting one would silently activate a foreign Area's own required Module. The Platform
18
- * Module and this Area's own Base Module are never taken from the input at all: they are implicit, and
19
- * `resolvePhiRuntimeModuleIdsForArea` adds them back regardless of what was asked for.
18
+ * Module, this Area's own Base Module and a Module declared `activation: "always"` are never taken from
19
+ * the input at all: they are implicit, and wherever the Area's active set is built they are added
20
+ * regardless of what was asked for.
20
21
  */
21
22
  function normalizeRuntimeModuleSelection(selectedIds, area, definitions) {
22
23
  const definitionsById = new Map(definitions.map((definition) => [definition.moduleId, definition]));
@@ -32,8 +33,7 @@ function normalizeRuntimeModuleSelection(selectedIds, area, definitions) {
32
33
  throw new Error(`Base module "${foreignBaseModuleId}" does not belong to Area "${cmsArea}".`);
33
34
  }
34
35
  const moduleIds = definitions
35
- .filter((definition) => definition.kind === "module" &&
36
- definition.moduleId !== baseModuleId &&
36
+ .filter((definition) => isPhiRuntimeModuleSelectable(definition) &&
37
37
  selectedIdSet.has(definition.moduleId))
38
38
  .map((definition) => definition.moduleId);
39
39
  /*
@@ -42,11 +42,18 @@ function readAreaLabels(params) {
42
42
  }
43
43
  return candidate;
44
44
  }
45
- function isModuleActiveInArea(state, moduleId, cmsArea) {
45
+ /**
46
+ * Whether the Module runs in an Area it is eligible for. A Module declared `activation: "always"` does
47
+ * without being in the Area's selection, the way a Base Module does in its own Area.
48
+ */
49
+ function isModuleActiveInArea(state, definition, cmsArea) {
50
+ if (definition.activation === "always") {
51
+ return true;
52
+ }
46
53
  if (!isPhiBuilderAreaKey(cmsArea)) {
47
54
  return false;
48
55
  }
49
- return (state.runtimeModuleIdsByArea[cmsArea] ?? []).includes(moduleId);
56
+ return (state.runtimeModuleIdsByArea[cmsArea] ?? []).includes(definition.moduleId);
50
57
  }
51
58
  function readRuntimeModulesTableView(query) {
52
59
  const filters = { ...(query.filters ?? {}) };
@@ -100,13 +107,15 @@ export function buildRuntimeModuleRows(state, categoryLabels, view, serverUnavai
100
107
  }
101
108
  const baseAreaKey = resolveModuleBaseAreaKey(definition.moduleId);
102
109
  const activeAreas = PHI_CMS_AREA_KEYS.filter((areaKey) => definition.eligibleAreas.includes(areaKey) &&
103
- (areaKey === baseAreaKey || isModuleActiveInArea(state, definition.moduleId, areaKey)));
110
+ (areaKey === baseAreaKey || isModuleActiveInArea(state, definition, areaKey)));
104
111
  return {
105
112
  moduleId: definition.moduleId,
106
113
  // "Runs anywhere": a base Module always does (its own Area never lets go of it), which is
107
114
  // exactly why its switch is locked -- the checkboxes carry the per-Area choice that remains.
115
+ // A Module declared `activation: "always"` runs in every Area it is eligible for and leaves
116
+ // no choice at all.
108
117
  active: activeAreas.length > 0,
109
- locked: baseAreaKey != null,
118
+ locked: baseAreaKey != null || definition.activation === "always",
110
119
  icon: definition.icon ?? (definition.iconFamily ? `@phis/ui/widgets:${definition.iconFamily}` : ""),
111
120
  title: definition.title,
112
121
  description: definition.description,
@@ -245,7 +254,7 @@ function readRuntimeModuleActiveAreas(state, moduleId) {
245
254
  }
246
255
  const baseAreaKey = resolveModuleBaseAreaKey(definition.moduleId);
247
256
  return PHI_CMS_AREA_KEYS.filter((areaKey) => definition.eligibleAreas.includes(areaKey) &&
248
- (areaKey === baseAreaKey || isModuleActiveInArea(state, definition.moduleId, areaKey)));
257
+ (areaKey === baseAreaKey || isModuleActiveInArea(state, definition, areaKey)));
249
258
  }
250
259
  function buildRuntimeModuleActiveAreasLabel(state, moduleId, areaLabels) {
251
260
  return readRuntimeModuleActiveAreas(state, moduleId)
@@ -472,7 +481,7 @@ export function PhiBuilderRuntimeModulesTableProviderClient({ children }) {
472
481
  if (proposedActive) {
473
482
  return false;
474
483
  }
475
- const areas = cmsAreas.filter((areaKey) => isPhiBuilderAreaKey(areaKey) && isModuleActiveInArea(builderState, definition.moduleId, areaKey));
484
+ const areas = cmsAreas.filter((areaKey) => isPhiBuilderAreaKey(areaKey) && isModuleActiveInArea(builderState, definition, areaKey));
476
485
  const signInLost = leavesPublicWithoutSignIn(builderState, definition, areas);
477
486
  const usage = signInLost
478
487
  ? [{
@@ -520,6 +529,15 @@ export function PhiBuilderRuntimeModulesTableProviderClient({ children }) {
520
529
  });
521
530
  applyPhiBuilderRuntimeModuleSelectionChanges(changes);
522
531
  };
532
+ // Always active: neither the row's switch nor an Area's checkbox has anything to decide.
533
+ if (definition.activation === "always") {
534
+ return {
535
+ status: "rejected",
536
+ invalidation: "none",
537
+ errorCode: "locked",
538
+ message: `"${definition.title}" is part of the platform and runs in every Area it is eligible for.`,
539
+ };
540
+ }
523
541
  // The row's switch: the Module as a whole, i.e. every eligible Area in one gesture.
524
542
  if (request.fieldKey === "active") {
525
543
  if (baseAreaKey != null) {
@@ -2,7 +2,7 @@
2
2
  import { isPhiCmsShellOwnedRegion } from "../../../helpers/cms-region-keys";
3
3
  import { resolvePhiControllerSignalEndpoints, resolvePhiLayoutSignalEndpoints, resolvePhiRegionSignalEndpoints, resolvePhiWidgetSignalEndpoints, } from "../../../components/widgets/signals/signal-endpoints";
4
4
  import { resolvePhiRuntimeAreaDefinition } from "../../../plugins/runtime-modules/area-definitions";
5
- import { resolvePhiRuntimeModuleIdsForArea } from "../../../plugins/runtime-modules/settings";
5
+ import { listPhiAlwaysActiveRuntimeModuleIds, resolvePhiRuntimeModuleIdsForArea, } from "../../../plugins/runtime-modules/settings";
6
6
  import { getPhiRegionWidgetLabelEntry } from "../../../components/widgets/label-types/region";
7
7
  import { isPhiBuilderPageScopedRegion, } from "./region-keys";
8
8
  /**
@@ -93,6 +93,7 @@ export function collectPhiBuilderControllerSignalEndpoints({ moduleDefinitions,
93
93
  const activeModuleIds = new Set([
94
94
  ...moduleDefinitions.filter((definition) => definition.kind === "platform").map((definition) => definition.moduleId),
95
95
  resolvePhiRuntimeAreaDefinition(area === "public" ? "public" : area).baseModuleId,
96
+ ...listPhiAlwaysActiveRuntimeModuleIds(area, moduleDefinitions),
96
97
  ...resolvePhiRuntimeModuleIdsForArea(area, selectedModuleIds, moduleDefinitions),
97
98
  ]);
98
99
  const endpointsByKey = new Map();
@@ -9,8 +9,8 @@ import { type PhiBuilderOfferedCatalogState } from "./offered-page-catalog";
9
9
  * looking at two entries both reading `/home` picks one by guess, with a fair chance of the one nobody
10
10
  * is ever served. The same narrowing settles `/`, which is a slot rather than an address.
11
11
  *
12
- * A hook rather than a call each time, because the answer needs six pieces of the workspace state and
13
- * a dependency list that names all six. Three surfaces had written that out themselves; two of them
12
+ * A hook rather than a call each time, because the answer needs seven pieces of the workspace state and
13
+ * a dependency list that names all seven. Three surfaces had written that out themselves; two of them
14
14
  * had written it out wrong, in the same way, and the third was written by copying one of those.
15
15
  */
16
16
  export declare function usePhiBuilderOfferedPageCatalog(state: PhiBuilderOfferedCatalogState, area: PhiBuilderPageCatalogArea): import("../../../helpers/cms-page-catalog").PhiPresetPageNode[];
@@ -10,18 +10,19 @@ import { resolvePhiBuilderOfferedPageCatalog, } from "./offered-page-catalog";
10
10
  * looking at two entries both reading `/home` picks one by guess, with a fair chance of the one nobody
11
11
  * is ever served. The same narrowing settles `/`, which is a slot rather than an address.
12
12
  *
13
- * A hook rather than a call each time, because the answer needs six pieces of the workspace state and
14
- * a dependency list that names all six. Three surfaces had written that out themselves; two of them
13
+ * A hook rather than a call each time, because the answer needs seven pieces of the workspace state and
14
+ * a dependency list that names all seven. Three surfaces had written that out themselves; two of them
15
15
  * had written it out wrong, in the same way, and the third was written by copying one of those.
16
16
  */
17
17
  export function usePhiBuilderOfferedPageCatalog(state, area) {
18
- const { modulePresetPagesByArea, customPages, persistedPageCatalogByArea, navigationSurfacesByArea, runtimeModuleIdsByArea, areaRootRoutes, } = state;
18
+ const { modulePresetPagesByArea, customPages, persistedPageCatalogByArea, navigationSurfacesByArea, runtimeModuleIdsByArea, runtimeModuleDefinitions, areaRootRoutes, } = state;
19
19
  return useMemo(() => resolvePhiBuilderOfferedPageCatalog({
20
20
  modulePresetPagesByArea,
21
21
  customPages,
22
22
  persistedPageCatalogByArea,
23
23
  navigationSurfacesByArea,
24
24
  runtimeModuleIdsByArea,
25
+ runtimeModuleDefinitions,
25
26
  areaRootRoutes,
26
27
  }, area), [
27
28
  area,
@@ -30,6 +31,7 @@ export function usePhiBuilderOfferedPageCatalog(state, area) {
30
31
  modulePresetPagesByArea,
31
32
  navigationSurfacesByArea,
32
33
  persistedPageCatalogByArea,
34
+ runtimeModuleDefinitions,
33
35
  runtimeModuleIdsByArea,
34
36
  ]);
35
37
  }
@@ -3,6 +3,8 @@ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/
3
3
  import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
4
4
  import { getPhiEffectsWidgetLabels } from "../../../../../components/widgets/label-sets/effects";
5
5
  import { getPhiAuthoringToolsLabels } from "../../../../../components/widgets/label-sets/authoring-tools";
6
+ import { getPhiMediaWidgetLabels } from "../../../../../components/media/label-sets/media";
7
+ import { PhiMediaPickerLabelsProvider } from "../../../../../components/media/phi-media-picker-labels";
6
8
  import { PHI_BUILDER_PREVIEW_SEARCH_PARAM, } from "../../../../../plugins/runtime-modules/builder/preview-transport";
7
9
  import { loadPhiBuilderPreviewSnapshot } from "../../../../../plugins/runtime-modules/builder/preview-store";
8
10
  import { buildPhiBuilderCurrentPageDrafts } from "../../page-presets.server";
@@ -25,9 +27,10 @@ export const PHI_STRUCTURE_REGION_WIDGET_PLUGIN = {
25
27
  const currentPageDrafts = isPhiBuilderPageScopedRegion(regionKey)
26
28
  ? await buildPhiBuilderCurrentPageDrafts(runtime, registry.runtimeModuleCatalog)
27
29
  : undefined;
28
- const [effectsLabels, authoringToolsLabels] = await Promise.all([
30
+ const [effectsLabels, authoringToolsLabels, mediaPickerLabels] = await Promise.all([
29
31
  getPhiEffectsWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
30
32
  getPhiAuthoringToolsLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
33
+ getPhiMediaWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
31
34
  ]);
32
35
  const fallbackStructureDraft = currentStructureDrafts.drafts[`${currentStructureDrafts.area}:${regionKey}`] ?? null;
33
36
  const fallbackPageDraft = currentPageDrafts?.drafts?.[`${currentPageDrafts.area}:${currentPageDrafts.pageKey}:${regionKey}`] ?? null;
@@ -60,17 +63,21 @@ export const PHI_STRUCTURE_REGION_WIDGET_PLUGIN = {
60
63
  return null;
61
64
  }
62
65
  const { PhiStructureRegionWidget } = await import("./built-in");
63
- return (_jsx(PhiStructureRegionWidget, { config: {
64
- slotKind: config.slotKind ?? "structure",
65
- origin: config.origin ?? PHI_STRUCTURE_REGION_WIDGET_DEFINITION.pluginKey,
66
- regionKey,
67
- title: config.title ?? config.regionKey ?? "Region",
68
- subtitle: config.subtitle ?? null,
69
- allowSelect: config.allowSelect ?? true,
70
- allowInsert: config.allowInsert ?? true,
71
- pickItems: config.pickItems ?? [],
72
- fallbackMinHeight: config.fallbackMinHeight,
73
- }, structureDraftsByArea: structureDraftsByArea, pageDraftsByScope: pageDraftsByScope, effectsLabels: effectsLabels, authoringToolsLabels: authoringToolsLabels, serverPreview: _jsx(PhiBuilderRegionServerPreview, { snapshot: snapshot, draft: resolvedPreviewDraft, regionKey: regionKey, runtime: runtime, registry: registry }) }));
66
+ /*
67
+ * The picker the tool buttons and the mask picker open says its words in the reader's language. The
68
+ * provider wraps the whole widget, so every nested scaffold below it reads the same set.
69
+ */
70
+ return (_jsx(PhiMediaPickerLabelsProvider, { labels: mediaPickerLabels, children: _jsx(PhiStructureRegionWidget, { config: {
71
+ slotKind: config.slotKind ?? "structure",
72
+ origin: config.origin ?? PHI_STRUCTURE_REGION_WIDGET_DEFINITION.pluginKey,
73
+ regionKey,
74
+ title: config.title ?? config.regionKey ?? "Region",
75
+ subtitle: config.subtitle ?? null,
76
+ allowSelect: config.allowSelect ?? true,
77
+ allowInsert: config.allowInsert ?? true,
78
+ pickItems: config.pickItems ?? [],
79
+ fallbackMinHeight: config.fallbackMinHeight,
80
+ }, structureDraftsByArea: structureDraftsByArea, pageDraftsByScope: pageDraftsByScope, effectsLabels: effectsLabels, authoringToolsLabels: authoringToolsLabels, serverPreview: _jsx(PhiBuilderRegionServerPreview, { snapshot: snapshot, draft: resolvedPreviewDraft, regionKey: regionKey, runtime: runtime, registry: registry }) }) }));
74
81
  },
75
82
  renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
76
83
  };
@@ -1,4 +1,5 @@
1
1
  export { PHI_COMMON_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST as PHI_ACCOUNTING_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST } from "./common";
2
+ export { PHI_COMMON_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST as PHI_ACCOUNTING_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST } from "./common";
2
3
  export { PHI_COMMON_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST as PHI_ACCOUNTING_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST } from "./common";
3
4
  export declare const PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST: import("../../../runtime-client-manifests-public").PhiRuntimeModuleControllerClientManifest;
4
5
  export declare const PHI_ACCOUNTING_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST: import("../../../runtime-render-client").PhiRuntimeModuleRenderClientManifest;
@@ -6,6 +6,7 @@ import { PHI_COMMON_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST } from "./commo
6
6
  import { extendPhiRuntimeModuleDataProviderClientManifest } from "../../../components/runtime/runtime-module-data-provider-client-manifest";
7
7
  import { PHI_DASHBOARD_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../dashboard/client-data-providers";
8
8
  export { PHI_COMMON_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST as PHI_ACCOUNTING_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST } from "./common";
9
+ export { PHI_COMMON_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST as PHI_ACCOUNTING_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST } from "./common";
9
10
  export { PHI_COMMON_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST as PHI_ACCOUNTING_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST } from "./common";
10
11
  export const PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST = createPhiRuntimeModuleControllerClientManifestFromAreaContributions(PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_AREA_CONTRIBUTIONS);
11
12
  export const PHI_ACCOUNTING_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST = PHI_COMMON_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST;
@@ -1,4 +1,5 @@
1
1
  export { PHI_COMMON_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST as PHI_ADMIN_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST } from "./common";
2
+ export { PHI_COMMON_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST as PHI_ADMIN_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST } from "./common";
2
3
  export { PHI_COMMON_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST as PHI_ADMIN_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST } from "./common";
3
4
  export declare const PHI_ADMIN_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST: import("../../../runtime-client-manifests-public").PhiRuntimeModuleControllerClientManifest;
4
5
  export declare const PHI_ADMIN_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST: import("../../../runtime-render-client").PhiRuntimeModuleRenderClientManifest;
@@ -11,6 +11,7 @@ import { PHI_LOCALIZATION_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../lo
11
11
  import { PHI_OBSERVABILITY_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../observability/client-data-providers";
12
12
  import { PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../user-management/client-data-providers";
13
13
  export { PHI_COMMON_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST as PHI_ADMIN_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST } from "./common";
14
+ export { PHI_COMMON_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST as PHI_ADMIN_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST } from "./common";
14
15
  export { PHI_COMMON_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST as PHI_ADMIN_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST } from "./common";
15
16
  export const PHI_ADMIN_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST = createPhiRuntimeModuleControllerClientManifestFromAreaContributions(PHI_ADMIN_RUNTIME_MODULE_CONTROLLER_CLIENT_AREA_CONTRIBUTIONS);
16
17
  export const PHI_ADMIN_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST = PHI_COMMON_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST;
@@ -1,5 +1,6 @@
1
1
  export declare const PHI_APP_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST: import("../../../runtime-client-manifests-public").PhiRuntimeModuleDataProviderClientManifest;
2
2
  export { PHI_COMMON_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST as PHI_APP_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST } from "./common";
3
+ export { PHI_COMMON_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST as PHI_APP_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST } from "./common";
3
4
  export { PHI_COMMON_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST as PHI_APP_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST } from "./common";
4
5
  export declare const PHI_APP_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST: import("../../../runtime-client-manifests-public").PhiRuntimeModuleControllerClientManifest;
5
6
  export declare const PHI_APP_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST: import("../../../runtime-render-client").PhiRuntimeModuleRenderClientManifest;