@phis/ui 0.4.8 → 0.4.12

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 (221) hide show
  1. package/components/cms/phi-cms-area-access-guard.js +9 -1
  2. package/components/cms/phi-cms-area-render-scope.d.ts +8 -4
  3. package/components/cms/phi-cms-area-render-scope.js +26 -11
  4. package/components/cms/phi-cms-root-layout.js +4 -2
  5. package/components/cms/phi-cms-runtime-registry.d.ts +2 -1
  6. package/components/cms/phi-cms-runtime-registry.js +1 -1
  7. package/components/controls/phi-color-control.js +2 -1
  8. package/components/controls/phi-drawer-control-adapter.js +2 -3
  9. package/components/controls/phi-drawer-control.js +3 -3
  10. package/components/controls/phi-dropdown-control.js +2 -1
  11. package/components/controls/phi-float-button-control.js +3 -3
  12. package/components/controls/phi-modal-control-adapter.js +2 -2
  13. package/components/controls/phi-modal-control.js +3 -3
  14. package/components/controls/phi-ribbon-wrap-control.js +2 -1
  15. package/components/controls/phi-zoom-image-overlay.js +11 -5
  16. package/components/forms/auth-admin-settings-labels.d.ts +35 -0
  17. package/components/forms/auth-admin-settings-labels.js +27 -0
  18. package/components/forms/content-entry-forms.js +1 -5
  19. package/components/forms/form-descriptor-runtime-client.js +2 -1
  20. package/components/forms/form-descriptor-text.d.ts +17 -0
  21. package/components/forms/form-descriptor-text.js +14 -0
  22. package/components/forms/runtime-form-controller-plugin.d.ts +0 -115
  23. package/components/forms/runtime-form-controller-plugin.js +1 -1
  24. package/components/forms/upload-form-control.d.ts +0 -7
  25. package/components/forms/upload-form-control.js +1 -1
  26. package/components/layouts/clients/phi-collapsible-layout-client.js +2 -1
  27. package/components/layouts/clients/phi-flex-layout-client.js +7 -1
  28. package/components/layouts/clients/phi-sequence-slot-editor.js +2 -1
  29. package/components/layouts/clients/phi-split-card-half.js +2 -1
  30. package/components/layouts/phi-base-layout.js +2 -1
  31. package/components/layouts/phi-layout-surface-box.js +2 -1
  32. package/components/media/phi-media-picker-server.js +3 -11
  33. package/components/navigation/use-phi-protected-mail.js +1 -9
  34. package/components/regions/presets/clients/sider-context.js +4 -2
  35. package/components/root/phi-config-provider.js +2 -1
  36. package/components/root/phi-dayjs-locale.d.ts +4 -1
  37. package/components/root/phi-dayjs-locale.js +2 -2
  38. package/components/root/phi-intl-locale.d.ts +7 -1
  39. package/components/root/phi-intl-locale.js +20 -15
  40. package/components/root/phi-root-layout.js +2 -1
  41. package/components/runtime/core-runtime-controller-plugin.d.ts +0 -84
  42. package/components/runtime/core-runtime-controller-plugin.js +1 -1
  43. package/components/runtime/runtime-controller-server-host.js +20 -9
  44. package/components/runtime/runtime-signal-bus.js +39 -4
  45. package/components/shell/phi-antd-icon.d.ts +3 -0
  46. package/components/shell/phi-antd-icon.js +9 -0
  47. package/components/state/use-phi-hydrated.d.ts +6 -0
  48. package/components/state/use-phi-hydrated.js +11 -0
  49. package/components/tables/phi-plain-table.d.ts +4 -0
  50. package/components/tables/phi-plain-table.js +1 -1
  51. package/components/widgets/client/shared/phi-rendered-value.js +4 -3
  52. package/components/widgets/config/parser-primitives.d.ts +5 -0
  53. package/components/widgets/config/parser-primitives.js +11 -0
  54. package/components/widgets/label-sets/runtime-options.d.ts +1 -1
  55. package/components/widgets/server/builder-chrome.js +2 -6
  56. package/components/widgets/server/search.js +2 -6
  57. package/components/widgets/shared/markdown-body-client.d.ts +7 -0
  58. package/components/widgets/shared/markdown-body-client.js +2 -0
  59. package/components/widgets/shared/markdown-render.js +48 -1
  60. package/controls.d.ts +2 -0
  61. package/controls.js +3 -0
  62. package/gateway/dashboard-cards-route.js +5 -7
  63. package/gateway/navigation-target-route.js +7 -9
  64. package/gateway/page-references-route.js +6 -8
  65. package/gateway/site-config.js +3 -0
  66. package/gateway/site-proxy.js +13 -2
  67. package/helpers/class-names.d.ts +7 -0
  68. package/helpers/class-names.js +10 -0
  69. package/helpers/cms-navigation-catalog.js +4 -2
  70. package/helpers/cms-page-catalog.js +35 -6
  71. package/helpers/cms-region-keys.d.ts +0 -1
  72. package/helpers/cms-region-keys.js +1 -1
  73. package/helpers/format-date-time.d.ts +14 -3
  74. package/helpers/format-date-time.js +27 -11
  75. package/helpers/region-page-scope.d.ts +1 -3
  76. package/helpers/region-page-scope.js +0 -4
  77. package/helpers/translation-format.d.ts +6 -0
  78. package/helpers/translation-format.js +15 -8
  79. package/package.json +2 -2
  80. package/plugins/runtime/phi-slot-child-frame-view.js +2 -1
  81. package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +1 -1
  82. package/plugins/runtime-modules/admin/forms.js +1 -1
  83. package/plugins/runtime-modules/admin/trees/phi-default-admin-settings-page-tree.js +2 -5
  84. package/plugins/runtime-modules/app/forms.js +1 -1
  85. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +2 -6
  86. package/plugins/runtime-modules/asset/metadata-form.js +2 -6
  87. package/plugins/runtime-modules/asset/settings-forms.js +1 -1
  88. package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +2 -5
  89. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -6
  90. package/plugins/runtime-modules/asset/widgets/area-upload/server.js +2 -6
  91. package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +1 -3
  92. package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -6
  93. package/plugins/runtime-modules/asset/widgets.js +5 -7
  94. package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
  95. package/plugins/runtime-modules/auth/data-providers.d.ts +5 -0
  96. package/plugins/runtime-modules/auth/data-providers.js +3 -0
  97. package/plugins/runtime-modules/auth/definition.d.ts +5 -0
  98. package/plugins/runtime-modules/auth/ids.d.ts +7 -7
  99. package/plugins/runtime-modules/auth/ids.js +7 -7
  100. package/plugins/runtime-modules/auth/services/installations-table.js +3 -1
  101. package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +2 -6
  102. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +26 -14
  103. package/plugins/runtime-modules/auth/widgets/security/client.js +5 -1
  104. package/plugins/runtime-modules/auth/widgets.d.ts +1 -2
  105. package/plugins/runtime-modules/auth/widgets.js +5 -7
  106. package/plugins/runtime-modules/avatar/overlay-tree.server.js +2 -6
  107. package/plugins/runtime-modules/avatar/widgets/account-avatar/server.js +2 -6
  108. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/server.js +2 -6
  109. package/plugins/runtime-modules/avatar/widgets.js +3 -5
  110. package/plugins/runtime-modules/builder/clients/pages-workspace.d.ts +2 -3
  111. package/plugins/runtime-modules/builder/clients/pages-workspace.js +5 -18
  112. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +1 -0
  113. package/plugins/runtime-modules/builder/controller/page-controller.js +1 -1
  114. package/plugins/runtime-modules/builder/controller/server-definition.js +3 -11
  115. package/plugins/runtime-modules/builder/controller/workspace-controller.js +2 -6
  116. package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +2 -8
  117. package/plugins/runtime-modules/builder/developer-workspace-store.js +24 -44
  118. package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +0 -5
  119. package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +2 -1
  120. package/plugins/runtime-modules/builder/inspector-section-widget.js +6 -31
  121. package/plugins/runtime-modules/builder/navigation-persistence.js +12 -3
  122. package/plugins/runtime-modules/builder/page-meta-form.js +4 -12
  123. package/plugins/runtime-modules/builder/page-presets.server.d.ts +0 -1
  124. package/plugins/runtime-modules/builder/page-presets.server.js +0 -24
  125. package/plugins/runtime-modules/builder/pages-workspace.js +6 -16
  126. package/plugins/runtime-modules/builder/persistence.d.ts +6 -4
  127. package/plugins/runtime-modules/builder/persistence.js +6 -7
  128. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +0 -1
  129. package/plugins/runtime-modules/builder/shells-workspace.js +3 -11
  130. package/plugins/runtime-modules/builder/signal-wiring-form.js +3 -7
  131. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +2 -6
  132. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -26
  133. package/plugins/runtime-modules/builder/trees/phi-default-builder-settings-page-tree.js +2 -6
  134. package/plugins/runtime-modules/builder/widgets/developer-builder-pages-header/plugin.js +2 -6
  135. package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.js +2 -6
  136. package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +3 -2
  137. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +1 -6
  138. package/plugins/runtime-modules/builder/widgets.js +10 -12
  139. package/plugins/runtime-modules/client-authoring-module.js +18 -1
  140. package/plugins/runtime-modules/contracts.d.ts +15 -1
  141. package/plugins/runtime-modules/contracts.js +10 -0
  142. package/plugins/runtime-modules/core/messaging/forms.js +1 -1
  143. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
  144. package/plugins/runtime-modules/core/widgets/description/server.js +12 -9
  145. package/plugins/runtime-modules/core/widgets/dimension/plugin.js +2 -6
  146. package/plugins/runtime-modules/core/widgets/draft-status/plugin.js +2 -6
  147. package/plugins/runtime-modules/core/widgets/entry-list/config.js +2 -9
  148. package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +1 -1
  149. package/plugins/runtime-modules/core/widgets/form-preview/client.js +2 -15
  150. package/plugins/runtime-modules/core/widgets/gallery/server.js +2 -6
  151. package/plugins/runtime-modules/core/widgets/image/server.js +2 -6
  152. package/plugins/runtime-modules/core/widgets/length/plugin.js +2 -6
  153. package/plugins/runtime-modules/core/widgets/markdown-toc/plugin.js +2 -6
  154. package/plugins/runtime-modules/core/widgets/page-title/server.js +2 -6
  155. package/plugins/runtime-modules/core/widgets/pagination/config.js +4 -8
  156. package/plugins/runtime-modules/core/widgets/result/config.d.ts +3 -0
  157. package/plugins/runtime-modules/core/widgets/result/config.js +15 -10
  158. package/plugins/runtime-modules/core/widgets/result/server.js +1 -1
  159. package/plugins/runtime-modules/core/widgets/search-results/config.js +2 -8
  160. package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.d.ts +2 -2
  161. package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.js +8 -13
  162. package/plugins/runtime-modules/core/widgets/table/client.js +1 -1
  163. package/plugins/runtime-modules/core/widgets/theme-mode-switch/server.js +2 -6
  164. package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +16 -31
  165. package/plugins/runtime-modules/core/widgets/timeline/client.js +9 -4
  166. package/plugins/runtime-modules/core/widgets/tour-button/server.js +2 -6
  167. package/plugins/runtime-modules/core/widgets/tree/client.js +1 -1
  168. package/plugins/runtime-modules/core/widgets.js +59 -61
  169. package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +7 -5
  170. package/plugins/runtime-modules/dashboard/trees/phi-default-admin-dashboard-page-tree.js +2 -6
  171. package/plugins/runtime-modules/dashboard/trees/phi-default-area-dashboard-page-tree.js +2 -6
  172. package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +2 -6
  173. package/plugins/runtime-modules/descriptor-compiler.js +6 -6
  174. package/plugins/runtime-modules/groups/controller/client.d.ts +0 -56
  175. package/plugins/runtime-modules/groups/controller/client.js +1 -1
  176. package/plugins/runtime-modules/groups/forms.js +1 -5
  177. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +2 -6
  178. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -6
  179. package/plugins/runtime-modules/localization/forms.js +2 -6
  180. package/plugins/runtime-modules/localization/services/options.js +19 -9
  181. package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -11
  182. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -11
  183. package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +3 -11
  184. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +4 -109
  185. package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +2 -2
  186. package/plugins/runtime-modules/preset-contracts/pub-area.js +0 -4
  187. package/plugins/runtime-modules/pub-area-preset.js +0 -20
  188. package/plugins/runtime-modules/public/trees/phi-default-pub-error-page-tree.js +5 -5
  189. package/plugins/runtime-modules/revisions/forms.js +1 -1
  190. package/plugins/runtime-modules/revisions/services/table.js +6 -2
  191. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
  192. package/plugins/runtime-modules/theme/controller/server-definition.js +2 -6
  193. package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +2 -6
  194. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -21
  195. package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +0 -2
  196. package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +0 -8
  197. package/plugins/runtime-modules/theme/widgets.js +6 -8
  198. package/plugins/runtime-modules/threads/controller/client.d.ts +0 -78
  199. package/plugins/runtime-modules/threads/controller/client.js +1 -1
  200. package/plugins/runtime-modules/threads/forms.js +1 -1
  201. package/plugins/runtime-modules/threads/ids.d.ts +0 -1
  202. package/plugins/runtime-modules/threads/ids.js +0 -2
  203. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +8 -6
  204. package/plugins/runtime-modules/user-management/controller/client.d.ts +0 -73
  205. package/plugins/runtime-modules/user-management/controller/client.js +1 -1
  206. package/plugins/runtime-modules/user-management/forms.js +1 -5
  207. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +3 -7
  208. package/plugins/runtime-modules/video/widgets.js +2 -4
  209. package/server-helpers/cms-request.d.ts +19 -0
  210. package/server-helpers/cms-request.js +26 -8
  211. package/server-helpers/cms-root.js +27 -21
  212. package/server-helpers/public-login-route.js +6 -8
  213. package/server-helpers/runtime.js +1 -1
  214. package/server-helpers/search-index.js +34 -14
  215. package/styles/controls.css +11 -0
  216. package/styles/shell.css +11 -1
  217. package/types/length.js +8 -3
  218. package/types/site-config.d.ts +6 -4
  219. package/types/widget-runtime.d.ts +2 -3
  220. package/types.d.ts +5 -3
  221. package/types.js +3 -0
@@ -4,6 +4,7 @@ import { canPhiViewerAccess } from "../../types/access";
4
4
  import { resolvePhiCmsDescriptorCatalog } from "../../plugins/runtime-modules/descriptor-compiler";
5
5
  import { resolvePhiPublicLoginHref } from "../../server-helpers/public-login-route";
6
6
  import { localizeAreaPath } from "../../helpers/locale";
7
+ import { PHI_ALL_RUNTIME_AREA_DEFINITIONS } from "../../plugins/runtime-modules/area-definitions";
7
8
  /**
8
9
  * Refuses an Area root the viewer may not enter, and returns only when they may.
9
10
  *
@@ -37,7 +38,14 @@ export async function guardPhiCmsAreaAccess({ cmsBridge, resolvedRoute, viewer,
37
38
  * until they disagree: a claim this side cannot read, an Area switched off. Then the home Area is
38
39
  * as closed as this one, and forwarding there is a loop rather than a way out.
39
40
  */
40
- const homeDefinition = areaDefinitions.get(viewer.resolvedArea);
41
+ /*
42
+ * The catalog in hand is this Area's own and declares no other Area, so the home Area's policy is
43
+ * read from the Core's list of Areas. Looked up in the catalog alone, every home but this Area was
44
+ * missing, and every viewer without the roles for it was refused rather than sent home -- a member
45
+ * signing in from an Admin address landed on 403 instead of the App.
46
+ */
47
+ const homeDefinition = areaDefinitions.get(viewer.resolvedArea)
48
+ ?? PHI_ALL_RUNTIME_AREA_DEFINITIONS.find((definition) => definition.area === viewer.resolvedArea);
41
49
  if (viewer.resolvedArea === resolvedRoute.area ||
42
50
  !homeDefinition ||
43
51
  !canPhiViewerAccess(viewer, homeDefinition.accessPolicy)) {
@@ -1,10 +1,15 @@
1
1
  import "server-only";
2
2
  import type { PhiCmsSiteBridge } from "../../types/cms-plugins";
3
- export declare function loadPhiCmsAreaRenderScope({ root, path, cmsBridge, }: {
3
+ type PhiCmsAreaRenderScopeInput = {
4
4
  root: string;
5
5
  path?: string[];
6
6
  cmsBridge: PhiCmsSiteBridge;
7
- }): Promise<{
7
+ };
8
+ export declare function loadPhiCmsAreaRenderControllers({ root, path, cmsBridge }: PhiCmsAreaRenderScopeInput): Promise<{
9
+ registeredControllerSettings: import("../../types").PhiRuntimeControllerSetting[] | null;
10
+ controllerDefinitionsByType: Map<any, any>;
11
+ }>;
12
+ export declare function loadPhiCmsAreaRenderScope({ root, path, cmsBridge }: PhiCmsAreaRenderScopeInput): Promise<{
8
13
  rootScope: {
9
14
  resolvedRoute: import("../../server-helpers/cms-route").PhiResolvedRootRoute;
10
15
  request: {
@@ -58,6 +63,5 @@ export declare function loadPhiCmsAreaRenderScope({ root, path, cmsBridge, }: {
58
63
  };
59
64
  filteredLayoutTree: import("../../types").PhiResolvedCmsAreaPresetTree | null;
60
65
  runtimeRegistry: import("../../types/cms-plugins").PhiCmsRuntimeRenderRegistry;
61
- registeredControllerSettings: import("../../types").PhiRuntimeControllerSetting[] | null;
62
- controllerDefinitionsByType: Map<any, any>;
63
66
  }>;
67
+ export {};
@@ -44,6 +44,23 @@ const loadPhiCmsAreaRenderScopeCached = cache(async function loadPhiCmsAreaRende
44
44
  moduleScope: runtimeModuleScope,
45
45
  trees: filteredLayoutTree ? [filteredLayoutTree] : [],
46
46
  });
47
+ return {
48
+ rootScope,
49
+ runtime,
50
+ runtimeModuleScope,
51
+ filteredLayoutTree,
52
+ runtimeRegistry,
53
+ };
54
+ });
55
+ /**
56
+ * The Controllers the Area's own render mounts, and the code that runs them.
57
+ *
58
+ * Kept apart from the scope above because only the Layout that draws the Area needs them. An Overlay
59
+ * opened later asks for the same scope from a request of its own and mounts its own Controllers; it
60
+ * would otherwise load every Area Controller's module to throw the result away.
61
+ */
62
+ const loadPhiCmsAreaRenderControllersCached = cache(async function loadPhiCmsAreaRenderControllersCached(root, pathKey, cmsBridge) {
63
+ const { filteredLayoutTree, runtimeModuleScope } = await loadPhiCmsAreaRenderScopeCached(root, pathKey, cmsBridge);
47
64
  const registeredControllerSettings = filteredLayoutTree
48
65
  ? materializePhiRuntimeControllerSettings({
49
66
  tree: filteredLayoutTree,
@@ -64,16 +81,14 @@ const loadPhiCmsAreaRenderScopeCached = cache(async function loadPhiCmsAreaRende
64
81
  settings: registeredControllerSettings,
65
82
  })
66
83
  : new Map();
67
- return {
68
- rootScope,
69
- runtime,
70
- runtimeModuleScope,
71
- filteredLayoutTree,
72
- runtimeRegistry,
73
- registeredControllerSettings,
74
- controllerDefinitionsByType,
75
- };
84
+ return { registeredControllerSettings, controllerDefinitionsByType };
76
85
  });
77
- export async function loadPhiCmsAreaRenderScope({ root, path, cmsBridge, }) {
78
- return loadPhiCmsAreaRenderScopeCached(root, path?.length ? path.join(PATH_KEY_SEPARATOR) : "", cmsBridge);
86
+ function areaRenderScopePathKey(path) {
87
+ return path?.length ? path.join(PATH_KEY_SEPARATOR) : "";
88
+ }
89
+ export async function loadPhiCmsAreaRenderControllers({ root, path, cmsBridge }) {
90
+ return loadPhiCmsAreaRenderControllersCached(root, areaRenderScopePathKey(path), cmsBridge);
91
+ }
92
+ export async function loadPhiCmsAreaRenderScope({ root, path, cmsBridge }) {
93
+ return loadPhiCmsAreaRenderScopeCached(root, areaRenderScopePathKey(path), cmsBridge);
79
94
  }
@@ -8,7 +8,7 @@ import { PHI_SHELL_HEADER_TOP_EXTENT_PROPERTY, PHI_SHELL_HEADER_TOP_STACK_PROPER
8
8
  import { PhiCmsLayoutRenderer, PhiCmsOverlayRenderer } from "./phi-cms-layout-renderer";
9
9
  import { phiCmsRegionPageScopeIncludes, readPhiCmsRegionPageScope, readPhiCmsRegionReveal, resolvePhiCmsRegionPageScope, } from "../../helpers/region-page-scope";
10
10
  import { hasRenderableRegionRoot } from "./phi-cms-region-helpers";
11
- import { loadPhiCmsAreaRenderScope } from "./phi-cms-area-render-scope";
11
+ import { loadPhiCmsAreaRenderControllers, loadPhiCmsAreaRenderScope } from "./phi-cms-area-render-scope";
12
12
  import { hasPhiCmsRevisionPreview } from "../../server-helpers/cms-root";
13
13
  import { performPhiCmsPageRedirect, resolvePhiCmsPageRedirect } from "./phi-cms-page-redirect";
14
14
  import { rememberPhiAreaRootDoor } from "../../gateway/area-root-door";
@@ -159,13 +159,15 @@ export async function PhiCmsAreaBoundary({ root, cmsBridge, children, path, page
159
159
  activeModuleIds: runtimeModuleScope.moduleSet.activeModuleIds,
160
160
  });
161
161
  }
162
+ // After the guards and the forward: a request that is refused or sent elsewhere loads no Controller.
163
+ const areaControllers = await loadPhiCmsAreaRenderControllers({ root, path: path ?? pagePath, cmsBridge });
162
164
  return (_jsx(PhiSignalRuntimePartitionProvider, { id: `area:${runtime.site.key}:${runtime.area}`, kind: "area", context: { siteKey: runtime.site.key, area: runtime.area }, children: _jsx(PhiRuntimeModuleProvider, { moduleIds: [...runtimeModuleScope.moduleSet.activeModuleIds], widgetTypes: [...runtimeModuleScope.moduleSet.widgetDefinitionsByType.keys()], layoutTypes: [...runtimeModuleScope.moduleSet.layoutDefinitionsByType.keys()], dataProviderDescriptors: runtime.area === "builder"
163
165
  ? [...runtimeModuleScope.moduleSet.dataProviderDescriptorsByKey.values()]
164
166
  : [], calendarAdapterDescriptors: [
165
167
  ...runtimeModuleScope.moduleSet.calendarAdapterDescriptorsByKey.values(),
166
168
  ], videoProviderDescriptors: [
167
169
  ...runtimeModuleScope.moduleSet.videoProviderDescriptorsByKey.values(),
168
- ], children: _jsxs(PhiRuntimeModuleDataProviderHost, { providerKeys: [...scope.runtimeRegistry.dataProviderDescriptorsByKey.keys()], children: [scope.registeredControllerSettings && scope.registeredControllerSettings.length > 0 ? (_jsx(PhiRuntimeControllerServerHost, { controllers: scope.registeredControllerSettings, runtime: runtime, registry: scope.controllerDefinitionsByType, controllerModuleIdsByType: runtimeModuleScope.moduleSet.ownerModuleIdByControllerType, runtimeModuleCatalog: scope.runtimeRegistry.runtimeModuleCatalog, serverCapabilities: scope.runtimeRegistry.serverCapabilities })) : null, children, filteredLayoutTree ? (_jsx(PhiCmsOverlayRenderer, { tree: filteredLayoutTree, runtime: runtime, registry: scope.runtimeRegistry, signalScope: "area", deferredOrigin: { area: runtime.area, root, path: path ?? pagePath ?? null } })) : null] }) }) }));
170
+ ], children: _jsxs(PhiRuntimeModuleDataProviderHost, { providerKeys: [...scope.runtimeRegistry.dataProviderDescriptorsByKey.keys()], children: [areaControllers.registeredControllerSettings && areaControllers.registeredControllerSettings.length > 0 ? (_jsx(PhiRuntimeControllerServerHost, { controllers: areaControllers.registeredControllerSettings, runtime: runtime, registry: areaControllers.controllerDefinitionsByType, controllerModuleIdsByType: runtimeModuleScope.moduleSet.ownerModuleIdByControllerType, runtimeModuleCatalog: scope.runtimeRegistry.runtimeModuleCatalog, serverCapabilities: scope.runtimeRegistry.serverCapabilities })) : null, children, filteredLayoutTree ? (_jsx(PhiCmsOverlayRenderer, { tree: filteredLayoutTree, runtime: runtime, registry: scope.runtimeRegistry, signalScope: "area", deferredOrigin: { area: runtime.area, root, path: path ?? pagePath ?? null } })) : null] }) }) }));
169
171
  }
170
172
  /**
171
173
  * The Area-owned Regions around a Page, or nothing but the grid they share.
@@ -4,7 +4,7 @@ import type { PhiCmsSiteBridge, PhiRuntimeModuleCatalog, PhiRuntimeModuleId } fr
4
4
  import type { PhiCmsAreaKey } from "../../constants/cms-areas";
5
5
  import type { PhiCapabilitySnapshot } from "../../types/server-capabilities";
6
6
  import { readPhiAreaPresetRuntimeModuleIds } from "../../helpers/cms-area-config";
7
- export declare function resolvePhiCmsRuntimeModuleScope({ cmsBridge, moduleIds, area, serverCapabilities, }: {
7
+ declare function resolvePhiCmsRuntimeModuleScope({ cmsBridge, moduleIds, area, serverCapabilities, }: {
8
8
  cmsBridge: PhiCmsSiteBridge;
9
9
  moduleIds?: readonly PhiRuntimeModuleId[] | null;
10
10
  area: PhiCmsAreaKey;
@@ -36,3 +36,4 @@ export declare function resolvePhiCmsTreeRuntimeRegistry({ moduleScope, trees, }
36
36
  moduleScope: Awaited<ReturnType<typeof resolvePhiCmsRuntimeModuleScope>>;
37
37
  trees: readonly PhiResolvedCmsRenderableTree[];
38
38
  }): Promise<import("../../types/cms-plugins").PhiCmsRuntimeRenderRegistry>;
39
+ export {};
@@ -20,7 +20,7 @@ const resolvePhiCmsRuntimeModuleScopeForRequest = cache(async (catalog, area, mo
20
20
  widgetDefinitionsByType,
21
21
  };
22
22
  });
23
- export function resolvePhiCmsRuntimeModuleScope({ cmsBridge, moduleIds, area, serverCapabilities, }) {
23
+ function resolvePhiCmsRuntimeModuleScope({ cmsBridge, moduleIds, area, serverCapabilities, }) {
24
24
  return resolvePhiCmsRuntimeModuleScopeForRequest(cmsBridge.runtimeModuleCatalog, area, JSON.stringify(moduleIds ?? []), JSON.stringify(serverCapabilities));
25
25
  }
26
26
  /**
@@ -6,6 +6,7 @@ import { PhiLabeledControl } from "./phi-labeled-control";
6
6
  import { PhiSelectControl } from "./phi-select-control";
7
7
  import { usePhiImmediatePicker } from "./use-phi-immediate-picker";
8
8
  import { readPhiCssLinearGradient } from "../../helpers/css-linear-gradient";
9
+ import { joinPhiClassNames } from "../../helpers/class-names";
9
10
  const PHI_COLOR_PICKER_CONTENT_WIDTH = 234;
10
11
  /*
11
12
  * A gradient the picker may edit is one a Background can hold: read by the Background's own reader, so
@@ -69,7 +70,7 @@ export function PhiColorControl({ value = null, defaultValue = "#f0f0f0", disabl
69
70
  colors: [...preset.colors],
70
71
  defaultOpen: preset.defaultOpen,
71
72
  }));
72
- return (_jsx(ColorPicker, { mode: resolveAntdMode(mode), value: resolveAntdColorValue(picker.value, defaultValue), open: picker.open, disabled: disabled, allowClear: allowClear, trigger: trigger, placement: placement === "auto" ? undefined : placement, size: size, showText: resolvedShowText, presets: antdPresets, getPopupContainer: getPopupContainer, classNames: { popup: { root: ["phi-color-widget-popup", popupClassName].filter(Boolean).join(" ") } }, styles: {
73
+ return (_jsx(ColorPicker, { mode: resolveAntdMode(mode), value: resolveAntdColorValue(picker.value, defaultValue), open: picker.open, disabled: disabled, allowClear: allowClear, trigger: trigger, placement: placement === "auto" ? undefined : placement, size: size, showText: resolvedShowText, presets: antdPresets, getPopupContainer: getPopupContainer, classNames: { popup: { root: joinPhiClassNames("phi-color-widget-popup", popupClassName) } }, styles: {
73
74
  root: {
74
75
  display: "inline-flex",
75
76
  alignItems: "center",
@@ -4,16 +4,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  * The Drawer itself, behind `PhiDrawerControl`, which loads this file the first time an Overlay opens --
5
5
  * the same split as the Modal, for the same reason.
6
6
  */
7
- import { useSyncExternalStore } from "react";
8
7
  import { Drawer } from "antd";
9
8
  import { PHI_FONT_SIZE, PHI_SPACE } from "../../theme/antd-css-var-contract";
10
9
  import { PHI_OVERLAY_DEFAULT_MASK, resolvePhiOverlayDismissSource, resolvePhiOverlayMaskPresentation, } from "./phi-overlay-control-contract";
11
- const subscribeHydration = () => () => undefined;
10
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
12
11
  const PHI_DRAWER_HEADER_MIN_BLOCK_SIZE = `calc(var(--ant-control-height) + ${PHI_SPACE.xs} + ${PHI_SPACE.xs})`;
13
12
  /** Where a title starts when the close button stands before it: past the button, not beneath it. */
14
13
  const PHI_DRAWER_TITLE_AFTER_CLOSE = `calc(${PHI_SPACE.sm} + var(--ant-control-height) + ${PHI_SPACE.xs})`;
15
14
  export function PhiDrawerControlAdapter({ open, title, header, body, footer, closable = true, keyboard = true, mask = PHI_OVERLAY_DEFAULT_MASK, mountPolicy = "remount", placement = "right", size, maxSize, resizable = false, push = false, zIndex, containerStyle, onDismiss, afterOpenChange, panelRef, }) {
16
- const hydrated = useSyncExternalStore(subscribeHydration, () => true, () => false);
15
+ const hydrated = usePhiHydrated();
17
16
  const resolvedMask = resolvePhiOverlayMaskPresentation(mask);
18
17
  const closeAtInlineStart = placement === "right";
19
18
  // A drawer with nothing to say in its header draws none: no title, no header content, no close button.
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import dynamic from "next/dynamic";
4
- import { useState, useSyncExternalStore } from "react";
4
+ import { useState } from "react";
5
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
5
6
  const PhiDrawerControlAdapter = dynamic(() => import("./phi-drawer-control-adapter").then((module) => module.PhiDrawerControlAdapter));
6
- const subscribeHydration = () => () => undefined;
7
7
  /**
8
8
  * The Drawer shell, loaded the first time it has something to show.
9
9
  *
@@ -12,7 +12,7 @@ const subscribeHydration = () => () => undefined;
12
12
  * its content hidden after hydration. Once loaded it stays, so closing plays the shell's own exit.
13
13
  */
14
14
  export function PhiDrawerControl(props) {
15
- const hydrated = useSyncExternalStore(subscribeHydration, () => true, () => false);
15
+ const hydrated = usePhiHydrated();
16
16
  const wanted = props.open || (hydrated && props.mountPolicy === "eager");
17
17
  const [loaded, setLoaded] = useState(wanted);
18
18
  if (wanted && !loaded) {
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { cloneElement, isValidElement, useCallback, useRef, useState, } from "react";
4
4
  import { Dropdown } from "antd";
5
5
  import { toPhiAntdMenuItems } from "./phi-menu-control";
6
+ import { joinPhiClassNames } from "../../helpers/class-names";
6
7
  /**
7
8
  * Ant Design reopens a hover-and-click dropdown when the click that should close it lands on the
8
9
  * trigger: the click reopens what the outside-click already closed. Suppressing the close for this
@@ -68,7 +69,7 @@ export function PhiPillDropdownControl({ items, selectedKeys, open, onOpenChange
68
69
  const canOpen = items.length > 0;
69
70
  const chevron = showChevron && canOpen ? _jsx("span", { className: "phi-dropdown-control__chevron", "aria-hidden": true }) : null;
70
71
  const hasLabel = label != null && label !== false && label !== "";
71
- return (_jsx(PhiDropdownControl, { items: items, selectedKeys: selectedKeys, open: open, onOpenChange: onOpenChange, children: _jsxs("button", { ref: triggerRef, type: "button", className: ["phi-dropdown-control", className].filter(Boolean).join(" "), style: {
72
+ return (_jsx(PhiDropdownControl, { items: items, selectedKeys: selectedKeys, open: open, onOpenChange: onOpenChange, children: _jsxs("button", { ref: triggerRef, type: "button", className: joinPhiClassNames("phi-dropdown-control", className), style: {
72
73
  display: "inline-flex",
73
74
  alignItems: "center",
74
75
  gap: "var(--ant-padding-xs)",
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useSyncExternalStore } from "react";
3
+ import {} from "react";
4
4
  import { createPortal } from "react-dom";
5
5
  import { FloatButton } from "antd";
6
6
  import { PhiIcon } from "../shell/phi-icon";
7
- const subscribeNever = () => () => { };
7
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
8
8
  /**
9
9
  * Where a fixed button is drawn: on `document.body`, outside every box of the page.
10
10
  *
@@ -16,7 +16,7 @@ const subscribeNever = () => () => { };
16
16
  * to portal into, and a fixed button needs none of the page's flow.
17
17
  */
18
18
  function PhiFloatButtonPortal({ children }) {
19
- const mounted = useSyncExternalStore(subscribeNever, () => true, () => false);
19
+ const mounted = usePhiHydrated();
20
20
  return mounted ? createPortal(children, document.body) : null;
21
21
  }
22
22
  /* Ant Design's own corner distance (`floatButtonInsetInlineEnd`, `floatButtonInsetBlockEnd`). */
@@ -11,7 +11,7 @@ import { PHI_CONTROL, PHI_SPACE } from "../../theme/antd-css-var-contract";
11
11
  import { resolvePhiMotionDurationMs } from "../../helpers/motion";
12
12
  import { usePhiConfig } from "../root/phi-config-provider";
13
13
  import { PHI_MODAL_RESPONSIVE_MIN_WIDTH, PHI_OVERLAY_DEFAULT_MASK, resolvePhiModalResponsiveMode, resolvePhiModalWidth, resolvePhiOverlayDismissSource, resolvePhiOverlayMaskPresentation, } from "./phi-overlay-control-contract";
14
- const subscribeHydration = () => () => undefined;
14
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
15
15
  const PHI_MODAL_MODE_QUERIES = [
16
16
  `(min-width: ${PHI_MODAL_RESPONSIVE_MIN_WIDTH.medium}px)`,
17
17
  `(min-width: ${PHI_MODAL_RESPONSIVE_MIN_WIDTH.wide}px)`,
@@ -58,7 +58,7 @@ const PHI_MODAL_FIRST_FIELD_MAX_FRAMES = 60;
58
58
  const PHI_MODAL_HEADER_MIN_BLOCK_SIZE = `calc(${PHI_CONTROL.md} + ${PHI_SPACE.xs} + ${PHI_SPACE.xs})`;
59
59
  export function PhiModalControlAdapter({ open, title, header, body, footer, closable = true, keyboard = true, mask = PHI_OVERLAY_DEFAULT_MASK, mountPolicy = "remount", centered = false, controlSize, size, width, rootClassName, containerStyle, onDismiss, afterOpenChange, panelRef, }) {
60
60
  const { token } = usePhiConfig();
61
- const hydrated = useSyncExternalStore(subscribeHydration, () => true, () => false);
61
+ const hydrated = usePhiHydrated();
62
62
  const mode = useSyncExternalStore(subscribeModalMode, readModalMode, readServerModalMode);
63
63
  const bodyMeasureRef = useRef(null);
64
64
  const bodyContentRef = useRef(null);
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import dynamic from "next/dynamic";
4
- import { useState, useSyncExternalStore } from "react";
4
+ import { useState } from "react";
5
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
5
6
  const PhiModalControlAdapter = dynamic(() => import("./phi-modal-control-adapter").then((module) => module.PhiModalControlAdapter));
6
- const subscribeHydration = () => () => undefined;
7
7
  /**
8
8
  * The Modal shell, loaded the first time it has something to show.
9
9
  *
@@ -16,7 +16,7 @@ const subscribeHydration = () => () => undefined;
16
16
  * Opened during the server render, the shell renders there too, and Next ships its code with the page.
17
17
  */
18
18
  export function PhiModalControl(props) {
19
- const hydrated = useSyncExternalStore(subscribeHydration, () => true, () => false);
19
+ const hydrated = usePhiHydrated();
20
20
  const wanted = props.open || (hydrated && props.mountPolicy === "eager");
21
21
  const [loaded, setLoaded] = useState(wanted);
22
22
  if (wanted && !loaded) {
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import Ribbon from "antd/es/badge/Ribbon";
4
4
  import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
5
+ import { joinPhiClassNames } from "../../helpers/class-names";
5
6
  /**
6
7
  * A ribbon that hangs over a box's end edge, with a fold behind it: Ant Design's `Badge.Ribbon`.
7
8
  *
@@ -27,5 +28,5 @@ export function PhiRibbonWrapControl({ children, text, color, gradient, interact
27
28
  * empty, both were nothing, and only the fold showed. Room for a word, as the inner band keeps it.
28
29
  */
29
30
  const content = interactive ? { display: "inline-block", minWidth: "6em" } : undefined;
30
- return (_jsx(Ribbon, { text: text, ...(color ? { color } : {}), rootClassName: ["phi-ribbon-wrap-control", className].filter(Boolean).join(" "), styles: { indicator, ...(content ? { content } : {}) }, children: children }));
31
+ return (_jsx(Ribbon, { text: text, ...(color ? { color } : {}), rootClassName: joinPhiClassNames("phi-ribbon-wrap-control", className), styles: { indicator, ...(content ? { content } : {}) }, children: children }));
31
32
  }
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useEffect, useRef, useSyncExternalStore } from "react";
3
+ import { useEffect, useEffectEvent, useRef } from "react";
4
4
  import { createPortal } from "react-dom";
5
5
  import { usePhiConfig } from "../root/phi-config-provider";
6
- const subscribeNever = () => () => { };
6
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
7
7
  /** Ant Design's `zIndexPopupBase`, the layer its Modal stands on; the Phi token set does not carry it. */
8
8
  const PHI_ZOOM_OVERLAY_Z_INDEX = 1000;
9
9
  /**
@@ -17,8 +17,14 @@ const PHI_ZOOM_OVERLAY_Z_INDEX = 1000;
17
17
  */
18
18
  export function PhiZoomImageOverlay({ open, src, alt, title, onClose }) {
19
19
  const { token } = usePhiConfig();
20
- const mounted = useSyncExternalStore(subscribeNever, () => true, () => false);
20
+ const mounted = usePhiHydrated();
21
21
  const overlayRef = useRef(null);
22
+ /*
23
+ * `onClose` is an event, not a dependency: a caller hands over a new closure each render, and keyed on
24
+ * it the effect ran again on every render of the open overlay, took the overlay itself as the element
25
+ * to return focus to, and so never gave focus back to the picture that was clicked.
26
+ */
27
+ const close = useEffectEvent(() => onClose());
22
28
  useEffect(() => {
23
29
  if (!open)
24
30
  return undefined;
@@ -26,14 +32,14 @@ export function PhiZoomImageOverlay({ open, src, alt, title, onClose }) {
26
32
  overlayRef.current?.focus();
27
33
  const closeOnEscape = (event) => {
28
34
  if (event.key === "Escape")
29
- onClose();
35
+ close();
30
36
  };
31
37
  document.addEventListener("keydown", closeOnEscape);
32
38
  return () => {
33
39
  document.removeEventListener("keydown", closeOnEscape);
34
40
  previousFocus?.focus();
35
41
  };
36
- }, [onClose, open]);
42
+ }, [open]);
37
43
  if (!mounted || !open)
38
44
  return null;
39
45
  return createPortal(_jsx("div", { ref: overlayRef, role: "dialog", "aria-modal": "true", "aria-label": alt || title, tabIndex: -1,
@@ -59,6 +59,41 @@ export declare function getPhiAuthAdminSettingsLabels(options: PhiGlobalTranslat
59
59
  installations: {
60
60
  tableLabel: string;
61
61
  empty: string;
62
+ footer: string;
63
+ columns: {
64
+ key: {
65
+ title: string;
66
+ hint: string;
67
+ };
68
+ enabled: {
69
+ title: string;
70
+ hint: string;
71
+ };
72
+ login: {
73
+ title: string;
74
+ hint: string;
75
+ };
76
+ order: {
77
+ title: string;
78
+ hint: string;
79
+ };
80
+ secret: {
81
+ title: string;
82
+ hint: string;
83
+ };
84
+ validation: {
85
+ title: string;
86
+ hint: string;
87
+ };
88
+ linked: {
89
+ title: string;
90
+ hint: string;
91
+ };
92
+ callback: {
93
+ title: string;
94
+ hint: string;
95
+ };
96
+ };
62
97
  installationKey: string;
63
98
  installationKeyHint: string;
64
99
  installationKeyInvalid: string;
@@ -67,6 +67,22 @@ const PHI_AUTH_ADMIN_SETTINGS_LABEL_SET = definePhiLabelSet({
67
67
  provider_success_title: definePhiMessageLabel("Authentication settings saved."),
68
68
  installations_table_label: "Provider installations",
69
69
  installations_empty: definePhiMessageLabel("No provider installations yet."),
70
+ installations_footer: "%1 installations, %2 offered on login",
71
+ installation_column_key: "Key",
72
+ installation_column_key_hint: definePhiMessageLabel("The installation key: a slug that stays the same, unique on this site."),
73
+ installation_column_enabled: "Active",
74
+ installation_column_enabled_hint: definePhiMessageLabel("Whether the installation may be used at all. Off keeps it configured but refuses every login through it."),
75
+ installation_column_login: "Login",
76
+ installation_column_login_hint: definePhiMessageLabel("Whether the sign-in page offers this provider as a button."),
77
+ installation_column_order: "Order",
78
+ installation_column_order_hint: definePhiMessageLabel("The position of the button among the sign-in methods, lowest first."),
79
+ installation_column_secret_hint: definePhiMessageLabel("Whether a client secret is stored. It is never shown again."),
80
+ installation_column_validation: "Check",
81
+ installation_column_validation_hint: definePhiMessageLabel("The result of the last Test. GitHub offers nothing to test against."),
82
+ installation_column_linked: "Linked",
83
+ installation_column_linked_hint: definePhiMessageLabel("Site members who have signed in through this provider."),
84
+ installation_column_callback: "Callback",
85
+ installation_column_callback_hint: definePhiMessageLabel("The address to register with the provider as its callback URL."),
70
86
  installation_key_label: "Installation key",
71
87
  installation_key_hint: definePhiMessageLabel("Stable lowercase slug, unique per site (for example google-workspace)."),
72
88
  installation_key_invalid: definePhiMessageLabel("Use a lowercase slug of letters, digits, and dashes."),
@@ -142,6 +158,17 @@ export async function getPhiAuthAdminSettingsLabels(options) {
142
158
  installations: {
143
159
  tableLabel: labels.installations_table_label,
144
160
  empty: labels.installations_empty,
161
+ footer: labels.installations_footer,
162
+ columns: {
163
+ key: { title: labels.installation_column_key, hint: labels.installation_column_key_hint },
164
+ enabled: { title: labels.installation_column_enabled, hint: labels.installation_column_enabled_hint },
165
+ login: { title: labels.installation_column_login, hint: labels.installation_column_login_hint },
166
+ order: { title: labels.installation_column_order, hint: labels.installation_column_order_hint },
167
+ secret: { title: labels.installation_secret_label, hint: labels.installation_column_secret_hint },
168
+ validation: { title: labels.installation_column_validation, hint: labels.installation_column_validation_hint },
169
+ linked: { title: labels.installation_column_linked, hint: labels.installation_column_linked_hint },
170
+ callback: { title: labels.installation_column_callback, hint: labels.installation_column_callback_hint },
171
+ },
145
172
  installationKey: labels.installation_key_label,
146
173
  installationKeyHint: labels.installation_key_hint,
147
174
  installationKeyInvalid: labels.installation_key_invalid,
@@ -4,13 +4,9 @@ import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_LINK_TARGET_LABEL_KEYS, PHI_FORM
4
4
  import { readPhiServerApiCredentials } from "../../helpers/phis-server-credentials";
5
5
  import { resolvePhiContentEntryEditorApiPaths, } from "../../constants/content-entry-kinds";
6
6
  import { PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS } from "../../constants/core-data-provider-keys";
7
+ import { phiFormLabel as label, phiFormRequired as required } from "./form-descriptor-text";
7
8
  /** Where the page that places the entry Form names the Site's source language, for the empty "Written in". */
8
9
  export const PHI_CONTENT_ENTRY_SOURCE_LOCALE_PLACEHOLDER_CONFIG_KEY = "sourceLocalePlaceholder";
9
- const label = (key, fallback) => ({ kind: "label", key, fallback });
10
- const required = (key, fallback) => [{
11
- providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.required,
12
- message: label(key, fallback),
13
- }];
14
10
  function entryFields(kind) {
15
11
  return [
16
12
  /*
@@ -111,9 +111,10 @@ export function PhiFormDescriptorRuntimeClient({ descriptor, labels, loadedIniti
111
111
  .flatMap((condition) => condition.source === "controller" && condition.controllerAddress
112
112
  ? [condition.controllerAddress]
113
113
  : [])), [descriptor.fields]);
114
+ const fieldKeys = useMemo(() => descriptor.fields.map((field) => field.key), [descriptor.fields]);
114
115
  const runtimeBinding = usePhiRuntimeFormBinding({
115
116
  formRef,
116
- fieldKeys: descriptor.fields.map((field) => field.key),
117
+ fieldKeys,
117
118
  controllerAddress: formControllerAddress,
118
119
  scope: identity.scope ?? "page",
119
120
  });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The two words every Module's Form descriptor writes a hundred times: a translated label, and the
3
+ * `required` rule carrying one. Fourteen Modules each declared these two lines for themselves.
4
+ */
5
+ export declare function phiFormLabel(key: string, fallback: string): {
6
+ readonly kind: "label";
7
+ readonly key: string;
8
+ readonly fallback: string;
9
+ };
10
+ export declare function phiFormRequired(key: string, fallback: string): readonly [{
11
+ readonly providerKey: `${string}/${string}`;
12
+ readonly message: {
13
+ readonly kind: "label";
14
+ readonly key: string;
15
+ readonly fallback: string;
16
+ };
17
+ }];
@@ -0,0 +1,14 @@
1
+ import { PHI_FORM_VALIDATION_PROVIDER_KEYS } from "./form-provider-contract";
2
+ /**
3
+ * The two words every Module's Form descriptor writes a hundred times: a translated label, and the
4
+ * `required` rule carrying one. Fourteen Modules each declared these two lines for themselves.
5
+ */
6
+ export function phiFormLabel(key, fallback) {
7
+ return { kind: "label", key, fallback };
8
+ }
9
+ export function phiFormRequired(key, fallback) {
10
+ return [{
11
+ providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.required,
12
+ message: phiFormLabel(key, fallback),
13
+ }];
14
+ }
@@ -1,116 +1 @@
1
- import { type PhiRuntimeFormControllerConfig } from "./runtime-form-controller-definition";
2
- export declare const PHI_RUNTIME_FORM_CONTROLLER_PLUGIN: {
3
- renderController: ({ address, instanceKey }: import("../../types").PhiRuntimeControllerRenderArgs<PhiRuntimeFormControllerConfig, unknown>) => import("react").FunctionComponentElement<import("./runtime-form-controller-mount").PhiRuntimeFormControllerMountProps>;
4
- kind: "controller";
5
- pluginKey: string;
6
- key: string;
7
- title: string;
8
- description: string;
9
- iconFamily: string;
10
- flags: "multiInstance"[];
11
- allowedMountScopes: ("area" | "page" | "site")[];
12
- runtimeSignals: {
13
- emits: ({
14
- readonly id: "values";
15
- readonly action: "change";
16
- readonly valueType: "json";
17
- readonly valueSchema: `${string}/signals/${string}`;
18
- } | {
19
- readonly id: "field";
20
- readonly action: "change";
21
- readonly valueType: "json";
22
- readonly valueSchema: `${string}/signals/${string}`;
23
- } | {
24
- readonly id: "validity";
25
- readonly action: "change";
26
- readonly valueType: "json";
27
- readonly valueSchema: `${string}/signals/${string}`;
28
- } | {
29
- readonly id: "touched";
30
- readonly action: "change";
31
- readonly valueType: "json";
32
- readonly valueSchema: `${string}/signals/${string}`;
33
- } | {
34
- readonly id: "dirty";
35
- readonly action: "change";
36
- readonly valueType: "boolean";
37
- } | {
38
- readonly id: "submitting";
39
- readonly action: "change";
40
- readonly valueType: "boolean";
41
- } | {
42
- readonly id: "result";
43
- readonly action: "change";
44
- readonly valueType: "json";
45
- readonly valueSchema: `${string}/signals/${string}`;
46
- } | {
47
- readonly id: "error";
48
- readonly action: "change";
49
- readonly valueType: "json";
50
- readonly valueSchema: `${string}/signals/${string}`;
51
- } | {
52
- readonly id: "reset";
53
- readonly action: "activate";
54
- readonly valueType: "none";
55
- } | {
56
- readonly id: "clear";
57
- readonly action: "clear";
58
- readonly valueType: "none";
59
- })[];
60
- listens: ({
61
- readonly id: "values";
62
- readonly channel: "values";
63
- readonly action: "change";
64
- readonly valueType: "json";
65
- readonly valueSchema: `${string}/signals/${string}`;
66
- } | {
67
- readonly id: "field";
68
- readonly channel: "field";
69
- readonly action: "change";
70
- readonly valueType: "json";
71
- readonly valueSchema: `${string}/signals/${string}`;
72
- } | {
73
- readonly id: "validity";
74
- readonly channel: "validity";
75
- readonly action: "change";
76
- readonly valueType: "json";
77
- readonly valueSchema: `${string}/signals/${string}`;
78
- } | {
79
- readonly id: "touched";
80
- readonly channel: "touched";
81
- readonly action: "change";
82
- readonly valueType: "json";
83
- readonly valueSchema: `${string}/signals/${string}`;
84
- } | {
85
- readonly id: "dirty";
86
- readonly channel: "dirty";
87
- readonly action: "change";
88
- readonly valueType: "boolean";
89
- } | {
90
- readonly id: "submit";
91
- readonly channel: "submit";
92
- readonly action: "activate";
93
- readonly valueType: "json";
94
- readonly valueSchema: `${string}/signals/${string}`;
95
- } | {
96
- readonly id: "confirm";
97
- readonly channel: "confirm";
98
- readonly action: "activate";
99
- readonly valueType: "json";
100
- readonly valueSchema: `${string}/signals/${string}`;
101
- } | {
102
- readonly id: "reset";
103
- readonly channel: "reset";
104
- readonly action: "activate";
105
- readonly valueType: "none";
106
- } | {
107
- readonly id: "clear";
108
- readonly channel: "clear";
109
- readonly action: "clear";
110
- readonly valueType: "none";
111
- })[];
112
- };
113
- defaultConfig: {};
114
- parseConfig: typeof import("./runtime-form-controller-definition").parsePhiRuntimeFormControllerConfig;
115
- };
116
1
  export declare const PhiRuntimeFormControllerClient: (props: import("../../types").PhiRuntimeModuleControllerClientProps) => import("react").JSX.Element;
@@ -3,7 +3,7 @@ import { createElement } from "react";
3
3
  import { createPhiRuntimeControllerClient } from "../runtime/runtime-controller-client-factory";
4
4
  import { PHI_RUNTIME_FORM_CONTROLLER_DEFINITION, } from "./runtime-form-controller-definition";
5
5
  import { PhiRuntimeFormControllerMount } from "./runtime-form-controller-mount";
6
- export const PHI_RUNTIME_FORM_CONTROLLER_PLUGIN = {
6
+ const PHI_RUNTIME_FORM_CONTROLLER_PLUGIN = {
7
7
  ...PHI_RUNTIME_FORM_CONTROLLER_DEFINITION,
8
8
  renderController: ({ address, instanceKey }) => createElement(PhiRuntimeFormControllerMount, {
9
9
  address,