@phis/ui 0.5.3 → 0.5.4

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 (144) hide show
  1. package/components/controls/phi-cascader-control.d.ts +9 -1
  2. package/components/controls/phi-cascader-control.js +25 -3
  3. package/components/controls/phi-money-control.d.ts +39 -0
  4. package/components/controls/phi-money-control.js +34 -0
  5. package/components/controls/phi-number-control.d.ts +6 -1
  6. package/components/controls/phi-number-control.js +3 -3
  7. package/components/controls/phi-options-provider.d.ts +7 -0
  8. package/components/controls/phi-options-provider.js +11 -0
  9. package/components/forms/extended-form-field-controls.d.ts +1 -0
  10. package/components/forms/extended-form-field-controls.js +23 -1
  11. package/components/forms/form-descriptor-runtime-client.js +13 -0
  12. package/components/forms/form-provider-contract.d.ts +43 -0
  13. package/components/forms/form-provider-contract.js +40 -0
  14. package/components/forms/money-field.d.ts +27 -0
  15. package/components/forms/money-field.js +78 -0
  16. package/components/forms/shared-form-provider-registry.js +4 -0
  17. package/components/media/phi-media-picker-binding.js +6 -1
  18. package/components/media/phi-site-font-assets.js +6 -1
  19. package/components/motion/phi-sequence-run.d.ts +14 -1
  20. package/components/motion/phi-sequence-run.js +22 -3
  21. package/components/motion/phi-sequence-viewport.js +3 -1
  22. package/components/regions/presets/content-entry-editor-page-tree.js +3 -1
  23. package/components/tables/client/phi-table-binding.js +16 -3
  24. package/components/trees/client/phi-tree-binding.js +6 -2
  25. package/components/widgets/client/shared/phi-collection-view-binding.js +10 -2
  26. package/components/widgets/client/shared/phi-rendered-value.d.ts +9 -1
  27. package/components/widgets/client/shared/phi-rendered-value.js +20 -1
  28. package/components/widgets/config/choice-shared.d.ts +2 -2
  29. package/components/widgets/label-sets/gallery.js +6 -0
  30. package/components/widgets/label-sets/interval.d.ts +4 -0
  31. package/components/widgets/label-sets/interval.js +31 -0
  32. package/components/widgets/label-sets/record.js +6 -1
  33. package/components/widgets/label-sets/slot-upload.d.ts +4 -0
  34. package/components/widgets/label-sets/slot-upload.js +36 -0
  35. package/components/widgets/label-sets/table.js +6 -1
  36. package/components/widgets/label-types/gallery.d.ts +7 -0
  37. package/components/widgets/label-types/gallery.js +6 -0
  38. package/components/widgets/label-types/interval.d.ts +16 -0
  39. package/components/widgets/label-types/interval.js +21 -0
  40. package/components/widgets/label-types/record.d.ts +3 -0
  41. package/components/widgets/label-types/record.js +2 -0
  42. package/components/widgets/label-types/slot-upload.d.ts +24 -0
  43. package/components/widgets/label-types/slot-upload.js +16 -0
  44. package/components/widgets/label-types/table.d.ts +3 -0
  45. package/components/widgets/label-types/table.js +2 -0
  46. package/constants/record-field-kinds.d.ts +1 -1
  47. package/constants/record-field-kinds.js +1 -1
  48. package/constants/runtime-module-ownership.js +1 -0
  49. package/controls.d.ts +7 -0
  50. package/controls.js +4 -0
  51. package/helpers/cms-dialog.d.ts +39 -3
  52. package/helpers/cms-dialog.js +46 -4
  53. package/helpers/cms-page-catalog.d.ts +8 -0
  54. package/helpers/cms-page-catalog.js +18 -2
  55. package/helpers/cms-preset-nodes.d.ts +13 -3
  56. package/helpers/cms-preset-nodes.js +3 -2
  57. package/helpers/money-amount.d.ts +48 -0
  58. package/helpers/money-amount.js +131 -0
  59. package/helpers/page-layout-check.js +15 -2
  60. package/helpers/record-fields.d.ts +18 -5
  61. package/helpers/record-fields.js +38 -13
  62. package/module-records.d.ts +6 -3
  63. package/module-records.js +4 -2
  64. package/package.json +2 -2
  65. package/plugins/runtime-modules/accounting/module.d.ts +1 -1
  66. package/plugins/runtime-modules/app/module.d.ts +1 -1
  67. package/plugins/runtime-modules/asset/services/collection.js +1 -0
  68. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -2
  69. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +3 -0
  70. package/plugins/runtime-modules/builder/offered-page-catalog.js +3 -3
  71. package/plugins/runtime-modules/builder/options-providers.js +7 -0
  72. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -3
  73. package/plugins/runtime-modules/contracts.d.ts +1 -1
  74. package/plugins/runtime-modules/core/definition.d.ts +43 -0
  75. package/plugins/runtime-modules/core/form-providers.d.ts +43 -0
  76. package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +6 -3
  77. package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +6 -5
  78. package/plugins/runtime-modules/core/widgets/breadcrumb/plugin.js +1 -1
  79. package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +9 -1
  80. package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +29 -3
  81. package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
  82. package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +3 -3
  83. package/plugins/runtime-modules/core/widgets/cascader/client.js +1 -1
  84. package/plugins/runtime-modules/core/widgets/cascader/config.d.ts +8 -2
  85. package/plugins/runtime-modules/core/widgets/cascader/config.js +22 -0
  86. package/plugins/runtime-modules/core/widgets/checkbox-group/config.d.ts +1 -1
  87. package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
  88. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
  89. package/plugins/runtime-modules/core/widgets/gallery/authoring.js +12 -3
  90. package/plugins/runtime-modules/core/widgets/gallery/client.js +10 -1
  91. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +3 -1
  92. package/plugins/runtime-modules/core/widgets/gallery/config.js +8 -0
  93. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
  94. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
  95. package/plugins/runtime-modules/core/widgets/multi-select/config.d.ts +1 -1
  96. package/plugins/runtime-modules/core/widgets/record/client.js +8 -2
  97. package/plugins/runtime-modules/core/widgets/record/config.js +4 -0
  98. package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
  99. package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +1 -1
  100. package/plugins/runtime-modules/core/widgets/select-box/config.d.ts +1 -1
  101. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
  102. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +1 -1
  103. package/plugins/runtime-modules/core/widgets/slot-upload/authoring.js +2 -1
  104. package/plugins/runtime-modules/core/widgets/slot-upload/client.d.ts +3 -1
  105. package/plugins/runtime-modules/core/widgets/slot-upload/client.js +45 -24
  106. package/plugins/runtime-modules/core/widgets/slot-upload/config.d.ts +12 -4
  107. package/plugins/runtime-modules/core/widgets/slot-upload/config.js +18 -1
  108. package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +4 -2
  109. package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +9 -3
  110. package/plugins/runtime-modules/core/widgets/slot-upload/server.js +17 -3
  111. package/plugins/runtime-modules/core/widgets/steps/config.d.ts +1 -1
  112. package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
  113. package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
  114. package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
  115. package/plugins/runtime-modules/descriptor-compiler.d.ts +11 -1
  116. package/plugins/runtime-modules/descriptor-compiler.js +49 -8
  117. package/plugins/runtime-modules/groups/definition.d.ts +1 -1
  118. package/plugins/runtime-modules/groups/forms.d.ts +18 -0
  119. package/plugins/runtime-modules/groups/forms.js +2 -2
  120. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +6 -4
  121. package/plugins/runtime-modules/public/module.d.ts +1 -1
  122. package/plugins/runtime-modules/resolver.js +5 -0
  123. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
  124. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +4 -2
  125. package/plugins/runtime-modules/user-management/controller/client.js +6 -1
  126. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +3 -3
  127. package/runtime-render-client.d.ts +1 -1
  128. package/runtime-render-client.js +2 -1
  129. package/server-helpers/cms-page-record.d.ts +2 -2
  130. package/server-helpers/cms-page-record.js +15 -5
  131. package/server-helpers/record-fields.d.ts +1 -1
  132. package/server-helpers/record-fields.js +1 -2
  133. package/server-helpers/record-samples.d.ts +4 -4
  134. package/server-helpers/record-samples.js +10 -2
  135. package/types/cms-module-descriptors.d.ts +3 -0
  136. package/types/cms-plugins.d.ts +8 -0
  137. package/types/collection-provider.d.ts +7 -0
  138. package/types/core-widget-placements.d.ts +32 -0
  139. package/types/record-provider.d.ts +19 -3
  140. package/types/table-widget.d.ts +33 -1
  141. package/types/table-widget.js +1 -0
  142. package/types/tree-widget.d.ts +7 -0
  143. package/types/widget-runtime.d.ts +1 -1
  144. package/types.d.ts +1 -0
@@ -1,10 +1,24 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "server-only";
2
3
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../runtime-render-client";
4
+ import { getPhiSlotUploadWidgetLabels } from "../../../../../components/widgets/label-sets/slot-upload";
5
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
6
+ import { trBulk, trBulkForLocale } from "../../../../../server-helpers/translate";
3
7
  import { PHI_SLOT_UPLOAD_WIDGET_TYPE } from "./config";
4
8
  /**
5
9
  * Handed to the Render Client by type: what a slot holds depends on who is asking and on which row a
6
- * surface is about, and neither is knowable where a page is rendered for a cache.
10
+ * surface is about, and neither is knowable where a page is rendered for a cache. Its texts are read
11
+ * here, in the page's language, and travel with it: the field's own captions from its Label Set, the
12
+ * label somebody wrote into the config through the Site's translation unless the node says not to.
7
13
  */
8
- export function PhiSlotUploadWidget({ config }) {
9
- return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PHI_SLOT_UPLOAD_WIDGET_TYPE, componentProps: { config } }));
14
+ export async function PhiSlotUploadWidget({ config, runtime, translate = true, }) {
15
+ const label = config?.label?.trim();
16
+ const [labels, translatedLabel] = await Promise.all([
17
+ getPhiSlotUploadWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
18
+ translate && label
19
+ ? (runtime.locale.current ? trBulkForLocale(runtime.locale.current, [label]) : trBulk([label]))
20
+ .then(([text]) => text?.trim() || label)
21
+ : Promise.resolve(label),
22
+ ]);
23
+ return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PHI_SLOT_UPLOAD_WIDGET_TYPE, componentProps: { config: config && translatedLabel ? { ...config, label: translatedLabel } : config, labels } }));
10
24
  }
@@ -79,7 +79,7 @@ export declare const PHI_STEPS_WIDGET_DEFINITION: {
79
79
  key: string;
80
80
  type: "collection";
81
81
  label: string;
82
- editorPlacement: "toolbar" | "inspector";
82
+ editorPlacement: "inspector" | "toolbar";
83
83
  itemKeyField: string;
84
84
  itemLabelField: string;
85
85
  defaultItem: {
@@ -56,8 +56,8 @@ const PHI_TABLE_ACTION_BUTTON_STYLE = { whiteSpace: "nowrap" };
56
56
  function formatTableActionTemplate(value, templateValue) {
57
57
  return value && templateValue != null ? formatPhiTableWidgetLabel(value, templateValue) : value;
58
58
  }
59
- function renderTableValue(value, column, row) {
60
- const content = renderPhiValueContent(value, column);
59
+ function renderTableValue(value, column, row, labels) {
60
+ const content = renderPhiValueContent(value, column, labels);
61
61
  if (!column.iconFieldKey) {
62
62
  return content;
63
63
  }
@@ -640,7 +640,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
640
640
  proposedValue,
641
641
  }).catch(() => undefined);
642
642
  } : undefined,
643
- render: (value, row) => renderTableValue(value, column, row),
643
+ render: (value, row) => renderTableValue(value, column, row, labels),
644
644
  }));
645
645
  if (rowActions.length || features.rowReordering?.enabled) {
646
646
  result.push({
@@ -665,7 +665,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
665
665
  });
666
666
  }
667
667
  return result;
668
- }, [activateAction, commitField, conditionSources, features.actions?.rowLayout, features.editing?.disabledWhen, features.editing?.mode, features.rowReordering?.enabled, isFieldMutationPending, labels.actions, loading, presentation.columns, resolvedControlSize, resource, rowActions]);
668
+ }, [activateAction, commitField, conditionSources, features.actions?.rowLayout, features.editing?.disabledWhen, features.editing?.mode, features.rowReordering?.enabled, isFieldMutationPending, labels, loading, presentation.columns, resolvedControlSize, resource, rowActions]);
669
669
  const resolveSummaryValue = useCallback((item) => {
670
670
  if (item.value.source === "provider")
671
671
  return summary[item.value.fieldKey];
@@ -137,7 +137,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
137
137
  heading?: string;
138
138
  } & {
139
139
  type: "record-field";
140
- kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
140
+ kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
141
141
  }) | ({
142
142
  key: string;
143
143
  label: string;
@@ -461,7 +461,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
461
461
  editorPlacement?: "inspector" | "geometry" | "toolbar";
462
462
  heading?: string;
463
463
  type: "record-field";
464
- kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
464
+ kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
465
465
  } | {
466
466
  visibleWhen: {
467
467
  field: string;
@@ -840,7 +840,7 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
840
840
  editorPlacement?: "inspector" | "geometry" | "toolbar";
841
841
  heading?: string;
842
842
  type: "record-field";
843
- kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
843
+ kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
844
844
  } | {
845
845
  visibleWhen: {
846
846
  field: string;
@@ -123,6 +123,7 @@ const PHI_TABLE_ACTION_CONFIG_FIELDS = [
123
123
  ];
124
124
  const PHI_TABLE_COLUMN_RENDERERS = [
125
125
  "text", "email", "date", "datetime", "badge", "tags", "link", "code", "json", "switch", "checkbox", "icon",
126
+ "money", "interval",
126
127
  ];
127
128
  const PHI_TABLE_COLUMN_EDITOR_CONTROLS = [
128
129
  "switch", "checkbox", "select", "radio", "segmented", "multi-select", "checkbox-group", "icon-picker", "textarea",
@@ -633,6 +634,8 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
633
634
  { value: "switch", label: "Switch" },
634
635
  { value: "checkbox", label: "Checkbox" },
635
636
  { value: "icon", label: "Icon" },
637
+ { value: "money", label: "Money" },
638
+ { value: "interval", label: "Interval" },
636
639
  ],
637
640
  },
638
641
  {
@@ -1,4 +1,5 @@
1
1
  import { type PhiCmsAreaKey } from "../../constants/cms-areas";
2
+ import type { PhiFormDescriptor } from "@phis/contracts/forms";
2
3
  import { type PhiCmsInstanceId } from "../../types/cms-instance-id";
3
4
  import type { PhiThemeFontsBlock, PhiThemeGroundBlock, PhiThemeSetBlock, PhiThemeStyleBlock } from "../../theme/phi-theme-blocks";
4
5
  import type { PhiCmsActiveRouteTable, PhiCmsAreaDefinition, PhiCmsAreaShellPresetBinding, PhiCmsCompiledDescriptorCatalog, PhiCmsCompiledRoutePattern, PhiCmsNavigationOverlay, PhiCmsNavigationOverlayResolution, PhiCmsResolvedNavigationSurface, PhiCmsRoutePresetBinding, PhiCmsRoutePresetDescriptor, PhiCmsCompiledThemeDescriptors, PhiCmsThemeDescriptorContribution, PhiCmsThemePresetBinding, PhiRuntimeModuleId } from "../../types/cms-module-descriptors";
@@ -78,7 +79,15 @@ export declare function instantiatePhiCmsThemeBlocks(catalog: PhiCmsCompiledThem
78
79
  fonts: PhiThemeFontsBlock[];
79
80
  sets: PhiThemeSetBlock[];
80
81
  }>;
81
- export declare function assertPhiCmsPresetTreeContract(tree: PhiResolvedCmsPageTree, expectedPage?: PhiCmsPageNode): void;
82
+ /** What the tree contract reads of a Form a Module ships: its descriptor, for a dialog's width. */
83
+ type PhiCmsPresetTreeForm = {
84
+ descriptor: PhiFormDescriptor;
85
+ };
86
+ /**
87
+ * `forms` are the Forms the compiler can see -- the ones the catalog's Modules ship, by id. A Form it
88
+ * cannot see (one stored on the Site, one of a Module outside the catalog) is not judged.
89
+ */
90
+ export declare function assertPhiCmsPresetTreeContract(tree: PhiResolvedCmsPageTree, expectedPage?: PhiCmsPageNode, forms?: ReadonlyMap<string, PhiCmsPresetTreeForm>): void;
82
91
  export declare function composePhiCmsActiveAreaOverlayPresets({ tree, catalog, activeModuleIds, siteId, area, path, runtime, }: {
83
92
  tree: PhiResolvedCmsAreaPresetTree;
84
93
  catalog: PhiCmsCompiledDescriptorCatalog;
@@ -104,3 +113,4 @@ export declare function instantiatePhiCmsRoutePreset({ binding, catalog, activeM
104
113
  runtime: PhiBlockRuntime;
105
114
  resolveMissingPageTitle?: (sourceTitle: string) => string | Promise<string>;
106
115
  }): Promise<PhiResolvedCmsPageTree>;
116
+ export {};
@@ -9,7 +9,7 @@ import { mergePhiCmsShellTrees, omitPhiCmsShellCompositionNodes, } from "./shell
9
9
  import { resolvePhiRuntimeModuleAreaRoutePath } from "../../helpers/runtime-module-route-path";
10
10
  import { choosePhiAreaRootApplicant, orderPhiAreaPathClaimsByCover, isPhiAssignablePublicRoutePath, } from "../../helpers/cms-area-config";
11
11
  import { resolvePhiLayoutCreationPreset } from "../../helpers/cms-layout-defaults";
12
- import { PHI_DIALOG_BLEED_BODY_CONFIG, PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, } from "../../helpers/cms-dialog";
12
+ import { PHI_DIALOG_BLEED_BODY_CONFIG, PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH, isPhiFormSingleColumn, } from "../../helpers/cms-dialog";
13
13
  import { PhiCmsWidgetType } from "../../constants/cms-widget-types";
14
14
  import { buildPhiBasePageLayoutNode, PHI_BASE_PAGE_LAYOUT_NODE_ID, } from "../../components/regions/presets/phi-base-page-layout";
15
15
  import { concatPhiCmsTreeControllerSettings } from "../../helpers/cms-tree-controller-settings";
@@ -263,8 +263,12 @@ export function compilePhiCmsDescriptorCatalog({ catalog, areaDefinitions, }) {
263
263
  const themeByKey = new Map();
264
264
  const themeBlockByKey = new Map();
265
265
  const sourceLocaleByModuleId = new Map();
266
+ const formDefinitionsById = new Map();
266
267
  for (const [moduleId, entry] of catalog) {
267
268
  sourceLocaleByModuleId.set(moduleId, resolvePhiRuntimeModuleSourceLocale(entry.definition));
269
+ for (const form of entry.forms ?? []) {
270
+ formDefinitionsById.set(form.formId, form);
271
+ }
268
272
  const descriptorKeys = new Set();
269
273
  const registerIdentity = (presetKey) => {
270
274
  normalizeRequiredKey(presetKey, `${moduleId} preset key`);
@@ -621,6 +625,7 @@ export function compilePhiCmsDescriptorCatalog({ catalog, areaDefinitions, }) {
621
625
  themeByKey,
622
626
  themeBlockByKey,
623
627
  sourceLocaleByModuleId,
628
+ formDefinitionsById,
624
629
  };
625
630
  }
626
631
  const descriptorCatalogByRuntimeCatalog = new WeakMap();
@@ -1415,7 +1420,11 @@ function assertPhiCmsBasePageLayoutNode(tree, layoutsById) {
1415
1420
  `${stablePresetNodeJson(node[mismatch])}, canonical is ${stablePresetNodeJson(canonical[mismatch])}.`);
1416
1421
  }
1417
1422
  }
1418
- export function assertPhiCmsPresetTreeContract(tree, expectedPage) {
1423
+ /**
1424
+ * `forms` are the Forms the compiler can see -- the ones the catalog's Modules ship, by id. A Form it
1425
+ * cannot see (one stored on the Site, one of a Module outside the catalog) is not judged.
1426
+ */
1427
+ export function assertPhiCmsPresetTreeContract(tree, expectedPage, forms) {
1419
1428
  const layoutIds = new Set();
1420
1429
  const allIds = new Set();
1421
1430
  if (expectedPage &&
@@ -1503,6 +1512,8 @@ export function assertPhiCmsPresetTreeContract(tree, expectedPage) {
1503
1512
  for (const overlay of tree.overlays) {
1504
1513
  if (overlay.overlayType === "modal") {
1505
1514
  assertPhiCmsDialogBody(overlay.id, layoutsById.get(overlay.bodyLayoutNodeId));
1515
+ if (forms)
1516
+ assertPhiCmsDialogWidth(overlay, tree, forms);
1506
1517
  }
1507
1518
  }
1508
1519
  for (const rootLayoutNodeId of [
@@ -1518,8 +1529,8 @@ export function assertPhiCmsPresetTreeContract(tree, expectedPage) {
1518
1529
  }
1519
1530
  }
1520
1531
  }
1521
- function assertPhiCmsAreaOverlayTree(descriptor, tree, page) {
1522
- assertPhiCmsPresetTreeContract(tree, page);
1532
+ function assertPhiCmsAreaOverlayTree(descriptor, tree, page, forms) {
1533
+ assertPhiCmsPresetTreeContract(tree, page, forms);
1523
1534
  if (tree.regions.length > 0) {
1524
1535
  throw new Error(`${descriptor.ownerModuleId}/${descriptor.presetKey}: Area Overlay preset must not contribute Regions.`);
1525
1536
  }
@@ -1553,7 +1564,7 @@ export async function composePhiCmsActiveAreaOverlayPresets({ tree, catalog, act
1553
1564
  const contributions = await Promise.all(descriptors.map((descriptor) => descriptor.loadTree({ page, runtime: targetRuntime, catalog })));
1554
1565
  for (const [index, descriptor] of descriptors.entries()) {
1555
1566
  const contribution = contributions[index];
1556
- assertPhiCmsAreaOverlayTree(descriptor, contribution, page);
1567
+ assertPhiCmsAreaOverlayTree(descriptor, contribution, page, catalog.formDefinitionsById);
1557
1568
  for (const node of [
1558
1569
  ...contribution.overlays,
1559
1570
  ...contribution.layoutNodes,
@@ -1591,13 +1602,13 @@ async function loadShellTree(descriptor, catalog, page, runtime) {
1591
1602
  composedTree = composedTree ? mergePhiCmsShellTrees(composedTree, sourceTree) : sourceTree;
1592
1603
  }
1593
1604
  const ownTree = await descriptor.loadTree({ page, runtime, catalog });
1594
- assertPhiCmsPresetTreeContract(ownTree, page);
1605
+ assertPhiCmsPresetTreeContract(ownTree, page, catalog.formDefinitionsById);
1595
1606
  return composedTree ? mergePhiCmsShellTrees(composedTree, ownTree) : ownTree;
1596
1607
  }
1597
1608
  export async function instantiatePhiCmsAreaShellPreset({ binding, catalog, siteId, path, runtime, }) {
1598
1609
  const page = createSyntheticPresetPage({ siteId, area: binding.descriptor.area, path });
1599
1610
  const tree = await loadShellTree(binding.descriptor, catalog, page, resolveTargetRuntime(runtime, binding.descriptor.area));
1600
- assertPhiCmsPresetTreeContract(tree, page);
1611
+ assertPhiCmsPresetTreeContract(tree, page, catalog.formDefinitionsById);
1601
1612
  return tree;
1602
1613
  }
1603
1614
  export async function instantiatePhiCmsRoutePreset({ binding, catalog, activeModuleIds, siteId, path, runtime, resolveMissingPageTitle, }) {
@@ -1630,7 +1641,7 @@ export async function instantiatePhiCmsRoutePreset({ binding, catalog, activeMod
1630
1641
  description: loadedTree.pageMeta?.description ?? null,
1631
1642
  },
1632
1643
  };
1633
- assertPhiCmsPresetTreeContract(tree, page);
1644
+ assertPhiCmsPresetTreeContract(tree, page, catalog.formDefinitionsById);
1634
1645
  return tree;
1635
1646
  }
1636
1647
  /*
@@ -1662,3 +1673,33 @@ function assertPhiCmsDialogCommands(overlayId, footerLayoutId, widgets) {
1662
1673
  }
1663
1674
  }
1664
1675
  }
1676
+ /*
1677
+ * A dialog is as wide as its Form needs (`helpers/cms-dialog.ts`): one column takes
1678
+ * `PHI_DIALOG_WIDTH_SINGLE_COLUMN`, two keep `PHI_DIALOG_WIDTH`. What is refused is the one width a Preset
1679
+ * did not choose -- the default, holding nothing but Forms of one column. Any other width was stated, by a
1680
+ * caller that knows what else the body holds; a Form the compiler cannot see is not judged.
1681
+ */
1682
+ function assertPhiCmsDialogWidth(overlay, tree, forms) {
1683
+ if (stablePresetNodeJson(overlay.config.width) !== stablePresetNodeJson(PHI_DIALOG_WIDTH))
1684
+ return;
1685
+ const bodyLayoutIds = new Set([overlay.bodyLayoutNodeId]);
1686
+ for (let grown = true; grown;) {
1687
+ grown = false;
1688
+ for (const node of tree.layoutNodes) {
1689
+ if (node.parentLayoutNodeId != null && bodyLayoutIds.has(node.parentLayoutNodeId) && !bodyLayoutIds.has(node.id)) {
1690
+ bodyLayoutIds.add(node.id);
1691
+ grown = true;
1692
+ }
1693
+ }
1694
+ }
1695
+ const formIds = tree.contentWidgets
1696
+ .filter((widget) => widget.widgetType === PhiCmsWidgetType.Form && bodyLayoutIds.has(widget.parentLayoutNodeId))
1697
+ .map((widget) => widget.config.formId);
1698
+ if (formIds.length === 0)
1699
+ return;
1700
+ const descriptors = formIds.map((formId) => (typeof formId === "string" ? forms.get(formId) : undefined)?.descriptor);
1701
+ if (descriptors.every((descriptor) => descriptor != null && isPhiFormSingleColumn(descriptor))) {
1702
+ throw new Error(`Preset Overlay "${overlay.id}" holds the one-column Form "${String(formIds[0])}" at the full dialog width ` +
1703
+ "(PHI_DIALOG_WIDTH). Hand the Form to `dialog` as `body.form`, or state `width: PHI_DIALOG_WIDTH_SINGLE_COLUMN`.");
1704
+ }
1705
+ }
@@ -250,7 +250,7 @@ export declare const PHI_GROUPS_RUNTIME_MODULE_DEFINITION: {
250
250
  iconFamily: string;
251
251
  mediaSpaces: {
252
252
  group: {
253
- kinds: ("image" | "markdown" | "video" | "audio" | "pdf" | "document" | "archive")[];
253
+ kinds: ("image" | "video" | "markdown" | "audio" | "pdf" | "document" | "archive")[];
254
254
  };
255
255
  };
256
256
  threadKinds: ("group" | "crossGroup")[];
@@ -1,8 +1,26 @@
1
+ import type { PhiFormDescriptor } from "../../../types";
1
2
  export declare const PHI_GROUPS_FORM_IDS: {
2
3
  readonly create: `${string}/forms/${string}`;
3
4
  readonly membership: `${string}/forms/${string}`;
4
5
  readonly myMembership: `${string}/forms/${string}`;
5
6
  };
7
+ /**
8
+ * Creating a group is Site administration, not group membership: a group is an authorization unit that
9
+ * Pages, Navigation, and Assets refer to. The Core route this relays to enforces that -- the form only
10
+ * carries the two values a group starts with.
11
+ */
12
+ export declare const PHI_GROUPS_CREATE_FORM_DESCRIPTOR: PhiFormDescriptor;
13
+ /**
14
+ * Writing one membership.
15
+ *
16
+ * Every value is named explicitly, including the group: a Form relays to a fixed path, so it cannot
17
+ * inherit the row a table happens to have selected.
18
+ *
19
+ * This adds a member. Someone already in the group is listed but not selectable here, because the level
20
+ * they already hold is changed in the cell it is read in -- the route accepts either, but a control
21
+ * that means one thing is better than one that quietly means two.
22
+ */
23
+ export declare const PHI_GROUPS_MEMBERSHIP_FORM_DESCRIPTOR: PhiFormDescriptor;
6
24
  export declare const PHI_GROUPS_RUNTIME_MODULE_FORMS: readonly [import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition, import("../contracts").PhiRuntimeModuleFormDefinition];
7
25
  export declare const PHI_GROUPS_FORM_HANDLER_PROVIDER_DESCRIPTORS: ({
8
26
  key: `${string}/${string}`;
@@ -23,7 +23,7 @@ const LABEL_SET_KEY = "@phis/ui/modules/groups/labels/forms";
23
23
  * Pages, Navigation, and Assets refer to. The Core route this relays to enforces that -- the form only
24
24
  * carries the two values a group starts with.
25
25
  */
26
- const PHI_GROUPS_CREATE_FORM_DESCRIPTOR = {
26
+ export const PHI_GROUPS_CREATE_FORM_DESCRIPTOR = {
27
27
  schemaVersion: 1,
28
28
  key: PHI_GROUPS_FORM_IDS.create,
29
29
  labelSetKey: LABEL_SET_KEY,
@@ -68,7 +68,7 @@ const PHI_GROUPS_CREATE_FORM_DESCRIPTOR = {
68
68
  * they already hold is changed in the cell it is read in -- the route accepts either, but a control
69
69
  * that means one thing is better than one that quietly means two.
70
70
  */
71
- const PHI_GROUPS_MEMBERSHIP_FORM_DESCRIPTOR = {
71
+ export const PHI_GROUPS_MEMBERSHIP_FORM_DESCRIPTOR = {
72
72
  schemaVersion: 1,
73
73
  key: PHI_GROUPS_FORM_IDS.membership,
74
74
  labelSetKey: LABEL_SET_KEY,
@@ -8,7 +8,7 @@ import { PHI_GROUPS_PAGE_LAYOUT_IDS, PHI_GROUPS_PAGE_OVERLAY_IDS, PHI_GROUPS_PAG
8
8
  import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID } from "../../../../components/regions/presets/phi-base-page-layout";
9
9
  import { getPhiGroupFormLabels } from "../labels";
10
10
  import { buildPhiGroupMembersTable, buildPhiGroupRetireAction, buildPhiGroupSettingColumns, buildPhiGroupsFooter, } from "./group-tables";
11
- import { PHI_GROUPS_FORM_IDS } from "../forms";
11
+ import { PHI_GROUPS_CREATE_FORM_DESCRIPTOR, PHI_GROUPS_FORM_IDS, PHI_GROUPS_MEMBERSHIP_FORM_DESCRIPTOR, } from "../forms";
12
12
  import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
13
13
  const SYNTHETIC_ADMIN_GROUPS_REGION_IDS = {
14
14
  regionContent: -451,
@@ -44,12 +44,14 @@ export async function buildPhiDefaultAdminGroupsPageTree({ page, runtime, }) {
44
44
  * speak to their receiver directly -- the dialog closes, the Form submits -- so nothing has to relay
45
45
  * them. The Form's success goes to the Controller, which reloads and closes the dialog.
46
46
  */
47
- const dialog = (workflow, ids, text, formId, openActionKey, overlayAddress, formAddress, sortOrder) => {
47
+ const dialog = (workflow, ids, text, formId, descriptor, openActionKey, overlayAddress, formAddress, sortOrder) => {
48
48
  const built = nodes.dialog({
49
49
  id: ids.overlay,
50
50
  bodyLayoutNodeId: ids.body,
51
51
  sortOrder,
52
52
  label: `admin-groups-${workflow}-modal`,
53
+ // The dialog takes the width its Form needs.
54
+ body: { form: { descriptor } },
53
55
  config: {
54
56
  title: text.title,
55
57
  // Opened afresh each time, so a dialog cancelled half filled starts empty again.
@@ -174,14 +176,14 @@ export async function buildPhiDefaultAdminGroupsPageTree({ page, runtime, }) {
174
176
  footer: PHI_GROUPS_PAGE_LAYOUT_IDS.layoutCreateFooter,
175
177
  form: PHI_GROUPS_PAGE_WIDGET_IDS.widgetCreateForm,
176
178
  commands: PHI_GROUPS_PAGE_WIDGET_IDS.widgetCreateCommands,
177
- }, { title: labels.create.title, submit: labels.actions.create }, PHI_GROUPS_FORM_IDS.create, "create", createOverlayAddress, createFormAddress, 0);
179
+ }, { title: labels.create.title, submit: labels.actions.create }, PHI_GROUPS_FORM_IDS.create, PHI_GROUPS_CREATE_FORM_DESCRIPTOR, "create", createOverlayAddress, createFormAddress, 0);
178
180
  const membershipDialog = dialog("membership", {
179
181
  overlay: PHI_GROUPS_PAGE_OVERLAY_IDS.overlayMembership,
180
182
  body: PHI_GROUPS_PAGE_LAYOUT_IDS.layoutMembership,
181
183
  footer: PHI_GROUPS_PAGE_LAYOUT_IDS.layoutMembershipFooter,
182
184
  form: PHI_GROUPS_PAGE_WIDGET_IDS.widgetMembershipForm,
183
185
  commands: PHI_GROUPS_PAGE_WIDGET_IDS.widgetMembershipCommands,
184
- }, { title: labels.membership.title, submit: labels.membership.submit }, PHI_GROUPS_FORM_IDS.membership, "addMember", membershipOverlayAddress, membershipFormAddress, 1);
186
+ }, { title: labels.membership.title, submit: labels.membership.submit }, PHI_GROUPS_FORM_IDS.membership, PHI_GROUPS_MEMBERSHIP_FORM_DESCRIPTOR, "addMember", membershipOverlayAddress, membershipFormAddress, 1);
185
187
  return {
186
188
  page: nodes.page({ pageType: PhiCmsPageType.Standard }),
187
189
  pageMeta: {
@@ -4,10 +4,10 @@
4
4
  * to the Core Runtime Controller; a Module's own goes into that Module's Controller, mounted on demand.
5
5
  */
6
6
  export declare const PHI_PUBLIC_RUNTIME_MODULE: {
7
- icon: string;
8
7
  moduleId: "@phis/ui/modules/public";
9
8
  category: "foundation";
10
9
  description: string;
10
+ icon: string;
11
11
  serverBinding: import("../../../types").PhiRuntimeModuleServerBinding;
12
12
  formProviders: {
13
13
  handlers: readonly [{
@@ -8,6 +8,7 @@ import { PHI_VIEWER_ACCESS_ANYONE, } from "../../types/access";
8
8
  import { stripRenderableBlockDefaults } from "../../helpers/renderable-block-serialization";
9
9
  import { PhiCmsWidgetType } from "../../constants/cms-widget-types";
10
10
  import { parsePhiFormWidgetConfig } from "../../components/forms/form-widget-config";
11
+ import { buildPhiRecordDeclarationsByKey } from "../../helpers/record-fields";
11
12
  function loadRuntimeWidgetPlugin(entry) {
12
13
  return entry.loadRuntime();
13
14
  }
@@ -620,6 +621,10 @@ export async function resolvePhiRuntimeRenderRegistry({ catalog, moduleSet, tree
620
621
  recordProviderLoadersByKey: new Map([...moduleSet.moduleDefinitionsById.keys()].flatMap((moduleId) => (catalog.get(moduleId)?.recordProviders ?? []).map((provider) => [provider.key, provider.load]))),
621
622
  recordFieldsLoadersByKey: new Map([...moduleSet.moduleDefinitionsById.keys()].flatMap((moduleId) => (catalog.get(moduleId)?.recordProviders ?? []).flatMap((provider) => provider.loadFields ? [[provider.key, provider.loadFields]] : []))),
622
623
  recordSamplesLoadersByKey: new Map([...moduleSet.moduleDefinitionsById.keys()].flatMap((moduleId) => (catalog.get(moduleId)?.recordProviders ?? []).flatMap((provider) => provider.loadSamples ? [[provider.key, provider.loadSamples]] : []))),
624
+ recordDeclarationsByKey: buildPhiRecordDeclarationsByKey([...moduleSet.moduleDefinitionsById.keys()].flatMap((moduleId) => {
625
+ const entry = catalog.get(moduleId);
626
+ return entry ? [entry] : [];
627
+ })),
623
628
  dataProviderDescriptorsByKey,
624
629
  formDefinitionsById: moduleSet.formDefinitionsById,
625
630
  };
@@ -11,7 +11,7 @@ import { createPhiRevisionsControllerAddress, PHI_REVISIONS_CONTROLLER_INSTANCE_
11
11
  import { PHI_REVISIONS_FORM_IDS } from "../forms";
12
12
  import { PHI_REVISIONS_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
13
13
  import { PHI_REVISIONS_DELETE_AREA_LAYOUT_IDS, PHI_REVISIONS_DELETE_AREA_OVERLAY_IDS, PHI_REVISIONS_DELETE_AREA_WIDGET_IDS, PHI_REVISIONS_PAGE_LAYOUT_IDS, PHI_REVISIONS_PAGE_WIDGET_IDS, PHI_REVISIONS_TABLE_WIDGET_ID, } from "../page-ids";
14
- import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../../helpers/cms-dialog";
14
+ import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH_SINGLE_COLUMN, } from "../../../../helpers/cms-dialog";
15
15
  import { PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM } from "../../../../helpers/cms-scope-search-params";
16
16
  /** Where the history's kind stands in the address, for a `page` condition. */
17
17
  const KIND_QUERY_PATH = `query.${PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM}`;
@@ -94,7 +94,7 @@ export async function buildPhiDefaultBuilderRevisionsPageTree({ page, runtime, }
94
94
  label: "Builder delete area",
95
95
  config: {
96
96
  title: revisionsLabels.deleteArea.title,
97
- width: { compact: "calc(100vw - 32px)", medium: 520, wide: 560 },
97
+ width: PHI_DIALOG_WIDTH_SINGLE_COLUMN,
98
98
  /*
99
99
  * `remount` rather than `lazy-keep`: the field is the confirmation, and a dialog that kept a
100
100
  * half-typed Area key from the last time it was opened would carry an answer across to a
@@ -11,7 +11,7 @@ import { PHI_SHARED_FORM_IDS } from "../../../../components/forms/shared-form-id
11
11
  import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID } from "../../../../components/regions/presets/phi-base-page-layout";
12
12
  import { getPhiThreadPageLabels } from "../labels";
13
13
  import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
14
- import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../../helpers/cms-dialog";
14
+ import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH_SINGLE_COLUMN, } from "../../../../helpers/cms-dialog";
15
15
  /** The content region of each Area's conversations Page. */
16
16
  const SYNTHETIC_THREADS_REGION_ID_BY_AREA = {
17
17
  app: -453,
@@ -72,6 +72,8 @@ export async function buildPhiDefaultThreadsPageTree({ page, runtime, area, }) {
72
72
  label: "app-threads-reply-modal",
73
73
  config: {
74
74
  title: labels.composerLabel,
75
+ // Core's Reply Form is one column, and not this Module's to hand to `dialog` (`body.form`).
76
+ width: PHI_DIALOG_WIDTH_SINGLE_COLUMN,
75
77
  mountPolicy: "remount",
76
78
  closeMode: "immediate",
77
79
  openActionKey: "reply",
@@ -263,7 +265,7 @@ export async function buildPhiDefaultThreadsPageTree({ page, runtime, area, }) {
263
265
  label: "app-threads-new-modal",
264
266
  config: {
265
267
  title: labels.newConversationLabel,
266
- width: { compact: "calc(100vw - 32px)", medium: 560, wide: 600 },
268
+ width: PHI_DIALOG_WIDTH_SINGLE_COLUMN,
267
269
  mountPolicy: "remount",
268
270
  closeMode: "request",
269
271
  signalRoutes: {
@@ -10,6 +10,7 @@ import { usePhiRuntimeConditionStateResponder } from "../../../../components/run
10
10
  import { usePhiSignalDispatcher, usePhiSignalListener } from "../../../../components/runtime/runtime-signal-bus";
11
11
  import { dispatchPhiSignalCapability } from "../../../../components/runtime/runtime-signal-identity";
12
12
  import { usePhiTableProvider } from "../../../../components/widgets/client/shared/phi-table-provider";
13
+ import { usePhiIntlLocale, usePhiIntlTimeZone } from "../../../../components/root/phi-intl-locale";
13
14
  import { PHI_USER_MANAGEMENT_RUNTIME_CONTROLLER_DEFINITION, } from "../controller/definition";
14
15
  /*
15
16
  * The workflow a signal belongs to, read off its channel: the Page routes the create and the edit half
@@ -30,6 +31,8 @@ function PhiUserManagementControllerView({ address, runtime, config, }) {
30
31
  resourceKey: "users",
31
32
  }), []);
32
33
  const { provider } = usePhiTableProvider(source);
34
+ const locale = usePhiIntlLocale();
35
+ const timeZone = usePhiIntlTimeZone();
33
36
  // The route lets a Developer in; only a Site admin may change anything. Stated as the policy the
34
37
  // rest of the system speaks rather than as a role check, so a widened admin mask carries here too.
35
38
  const readOnly = !canPhiViewerAccess(runtime.viewer, PHI_VIEWER_ACCESS_SITE_ADMIN);
@@ -68,6 +71,8 @@ function PhiUserManagementControllerView({ address, runtime, config, }) {
68
71
  resourceKey: "users",
69
72
  rowIdentity,
70
73
  params: {},
74
+ locale,
75
+ timeZone,
71
76
  signal: new AbortController().signal,
72
77
  });
73
78
  if (workflowRef.current.correlationId !== correlationId)
@@ -78,7 +83,7 @@ function PhiUserManagementControllerView({ address, runtime, config, }) {
78
83
  catch {
79
84
  workflowRef.current.selectedSelf = true;
80
85
  }
81
- }, [conditionState, emitCapability, provider]);
86
+ }, [conditionState, emitCapability, locale, provider, timeZone]);
82
87
  usePhiRuntimeConditionStateResponder({ address, scope: "page", state: conditionState });
83
88
  usePhiSignalListener(useCallback((signal) => {
84
89
  if (signal.receiver !== address)
@@ -9,7 +9,7 @@ import { createPhiSignalAddress, createPhiSignalSubcontrolAddress, PHI_SIGNAL_VA
9
9
  import { createPhiUserManagementControllerAddress, PHI_USER_MANAGEMENT_CONTROLLER_INSTANCE_KEY, PHI_USER_MANAGEMENT_CONTROLLER_TYPE, } from "../controller/address";
10
10
  import { PHI_USER_MANAGEMENT_FORM_IDS } from "../forms";
11
11
  import { PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS, PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS, PHI_USER_MANAGEMENT_PAGE_WIDGET_IDS, } from "../addresses";
12
- import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../../helpers/cms-dialog";
12
+ import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH_SINGLE_COLUMN, } from "../../../../helpers/cms-dialog";
13
13
  import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
14
14
  const SYNTHETIC_ADMIN_USERS_REGION_IDS = {
15
15
  regionContent: -431,
@@ -200,8 +200,8 @@ export async function buildPhiDefaultAdminUsersPageTree({ page, runtime, }) {
200
200
  },
201
201
  }],
202
202
  overlays: [
203
- overlay(PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS.overlayCreate, PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS.layoutCreate, widgetLabels.editor.addTitle, { compact: "calc(100vw - 32px)", medium: 600, wide: 640 }, "admin-users-create-modal", "create"),
204
- overlay(PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS.overlayEdit, PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS.layoutEdit, widgetLabels.editor.editTitle, { compact: "calc(100vw - 32px)", medium: 600, wide: 640 }, "admin-users-edit-modal", "edit"),
203
+ overlay(PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS.overlayCreate, PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS.layoutCreate, widgetLabels.editor.addTitle, PHI_DIALOG_WIDTH_SINGLE_COLUMN, "admin-users-create-modal", "create"),
204
+ overlay(PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS.overlayEdit, PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS.layoutEdit, widgetLabels.editor.editTitle, PHI_DIALOG_WIDTH_SINGLE_COLUMN, "admin-users-edit-modal", "edit"),
205
205
  overlay(PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS.overlayHistory, PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS.layoutHistory, widgetLabels.history.title, { compact: "calc(100vw - 32px)", medium: "90vw", wide: 980 }, "admin-users-history-modal"),
206
206
  ],
207
207
  regions: [scaffold.region],
@@ -1,3 +1,3 @@
1
1
  export { PhiRuntimeModuleRenderClientHost, PhiRuntimeModuleRenderClientManifestProvider, createPhiRuntimeModuleRenderClientManifest, definePhiRuntimeModuleRenderClient, extendPhiRuntimeModuleRenderClientManifest, } from "./components/runtime/runtime-module-render-client-manifest";
2
2
  export type { PhiRuntimeModuleRenderClient, PhiRuntimeModuleRenderClientManifest, PhiRuntimeModuleRenderClientProps, } from "./components/runtime/runtime-module-render-client-manifest";
3
- export { usePhiIntlLocale } from "./components/root/phi-intl-locale";
3
+ export { usePhiIntlLocale, usePhiIntlTimeZone } from "./components/root/phi-intl-locale";
@@ -1,2 +1,3 @@
1
1
  export { PhiRuntimeModuleRenderClientHost, PhiRuntimeModuleRenderClientManifestProvider, createPhiRuntimeModuleRenderClientManifest, definePhiRuntimeModuleRenderClient, extendPhiRuntimeModuleRenderClientManifest, } from "./components/runtime/runtime-module-render-client-manifest";
2
- export { usePhiIntlLocale } from "./components/root/phi-intl-locale";
2
+ // The page's language and the Site's time zone, which a Module's own binding sends with a Provider request.
3
+ export { usePhiIntlLocale, usePhiIntlTimeZone } from "./components/root/phi-intl-locale";
@@ -2,7 +2,7 @@ import "server-only";
2
2
  import type { PhiBlockRuntime } from "../types";
3
3
  import type { PhiCmsRoutePresetBinding } from "../types/cms-module-descriptors";
4
4
  import type { PhiRuntimeModuleCatalog, PhiRuntimeModuleId } from "../types/cms-plugins";
5
- import type { PhiRuntimeDataProviderBinding } from "../types/runtime-data-provider";
5
+ import type { PhiPageRecordBinding } from "../types/record-provider";
6
6
  /**
7
7
  * The record a route's Page is about, read before anything is drawn (MODULES.md, "The fields of a record,
8
8
  * and the record a Page is about").
@@ -14,7 +14,7 @@ export type PhiCmsPageRecord = {
14
14
  status: "missing";
15
15
  } | {
16
16
  status: "ok";
17
- binding: PhiRuntimeDataProviderBinding;
17
+ binding: PhiPageRecordBinding;
18
18
  title: string | null;
19
19
  description: string | null;
20
20
  };
@@ -1,4 +1,5 @@
1
1
  import "server-only";
2
+ import { buildPhiRecordDeclarationsByKey } from "../helpers/record-fields";
2
3
  import { readPhiPageRecordField, resolvePhiRecordFields } from "./record-fields";
3
4
  import { resolvePhiRecordSource } from "./record-source";
4
5
  /** What the record Providers of the active Modules offer, as a render's registry holds it. */
@@ -10,7 +11,7 @@ function buildRecordRegistry(runtimeModuleCatalog, activeModuleIds) {
10
11
  return {
11
12
  recordProviderLoadersByKey: new Map(entries.flatMap((entry) => (entry.recordProviders ?? []).map((provider) => [provider.key, provider.load]))),
12
13
  recordFieldsLoadersByKey: new Map(entries.flatMap((entry) => (entry.recordProviders ?? []).flatMap((provider) => provider.loadFields ? [[provider.key, provider.loadFields]] : []))),
13
- dataProviderDescriptorsByKey: new Map(entries.flatMap((entry) => (entry.definition.dataProviders ?? []).map((provider) => [provider.key, provider]))),
14
+ recordDeclarationsByKey: buildPhiRecordDeclarationsByKey(entries),
14
15
  };
15
16
  }
16
17
  export async function resolvePhiCmsPageRecord({ binding, runtime, runtimeModuleCatalog, activeModuleIds }) {
@@ -20,12 +21,12 @@ export async function resolvePhiCmsPageRecord({ binding, runtime, runtimeModuleC
20
21
  }
21
22
  const route = `${binding.descriptor.ownerModuleId}/${binding.descriptor.presetKey}`;
22
23
  const registry = buildRecordRegistry(runtimeModuleCatalog, activeModuleIds);
23
- const descriptor = registry.dataProviderDescriptorsByKey.get(declaration.providerKey);
24
- if (descriptor?.kind !== "record" || !descriptor.record) {
24
+ const declared = registry.recordDeclarationsByKey.get(declaration.providerKey);
25
+ if (!declared) {
25
26
  throw new Error(`${route}: its page record names "${declaration.providerKey}", which is no active record Provider with declared fields.`);
26
27
  }
27
28
  // A Public page is rendered once for everybody, so it cannot be about what only one account may read.
28
- if (descriptor.record.audience === "viewer" && binding.descriptor.area === "public") {
29
+ if (declared.audience === "viewer" && binding.descriptor.area === "public") {
29
30
  throw new Error(`${route}: a Public route cannot be about a record of audience "viewer".`);
30
31
  }
31
32
  const record = {
@@ -38,5 +39,14 @@ export async function resolvePhiCmsPageRecord({ binding, runtime, runtimeModuleC
38
39
  }
39
40
  const fields = await resolvePhiRecordFields({ registry, runtime, binding: record });
40
41
  const text = (key) => readPhiPageRecordField(fields, key, ["text"])?.value.trim() || null;
41
- return { status: "ok", binding: record, title: text(declaration.titleField), description: text(declaration.descriptionField) };
42
+ /*
43
+ * The Page's binding is the read's own, plus the two names the route gave. They are added after the
44
+ * reads and the reads were keyed by `record`, so the names are no part of what is asked or memoised.
45
+ */
46
+ const pageBinding = {
47
+ ...record,
48
+ ...(declaration.titleField ? { titleField: declaration.titleField } : {}),
49
+ ...(declaration.descriptionField ? { descriptionField: declaration.descriptionField } : {}),
50
+ };
51
+ return { status: "ok", binding: pageBinding, title: text(declaration.titleField), description: text(declaration.descriptionField) };
42
52
  }
@@ -3,7 +3,7 @@ import type { PhiBlockRuntime } from "../types";
3
3
  import type { PhiCmsRuntimeRenderRegistry } from "../types/cms-plugins";
4
4
  import type { PhiRecordField, PhiRecordFieldKind } from "../types/record-provider";
5
5
  import type { PhiRuntimeDataProviderBinding } from "../types/runtime-data-provider";
6
- type PhiRecordFieldsRegistry = Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey" | "recordFieldsLoadersByKey" | "dataProviderDescriptorsByKey">;
6
+ type PhiRecordFieldsRegistry = Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey" | "recordFieldsLoadersByKey" | "recordDeclarationsByKey">;
7
7
  /**
8
8
  * The declared fields of one record (MODULES.md, "The fields of a record, and the record a Page is about").
9
9
  *
@@ -6,8 +6,7 @@ import { resolvePhiRecordSource } from "./record-source";
6
6
  import { definePhiRequestMemoWith } from "./request-memo";
7
7
  const resolveFields = definePhiRequestMemoWith(async (key, using) => {
8
8
  const providerKey = key.providerKey;
9
- const descriptor = using.registry.dataProviderDescriptorsByKey.get(providerKey);
10
- const declared = descriptor?.kind === "record" ? descriptor.record?.fields : undefined;
9
+ const declared = using.registry.recordDeclarationsByKey.get(providerKey)?.fields;
11
10
  const loadFields = using.registry.recordFieldsLoadersByKey.get(providerKey);
12
11
  if (!declared || !loadFields) {
13
12
  return { status: "none" };