@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
@@ -3,11 +3,9 @@ import { PHI_AUTH_LOGOUT_WIDGET_DEFINITION } from "./widgets/logout/config";
3
3
  import { PHI_AUTH_SECURITY_WIDGET_DEFINITION } from "./widgets/security/config";
4
4
  import { PHI_AUTH_WORKFLOW_WIDGET_DEFINITION } from "./widgets/auth-workflow/config";
5
5
  import { PHI_AUTH_METHODS_WIDGET_DEFINITION } from "./widgets/auth-methods/config";
6
- function defineFirstPartyWidget(options) {
7
- return options;
8
- }
6
+ import { definePhiFirstPartyWidget } from "../contracts";
9
7
  export const PHI_AUTH_RUNTIME_MODULE_WIDGETS = [
10
- defineFirstPartyWidget({
8
+ definePhiFirstPartyWidget({
11
9
  definition: PHI_AUTH_LOGOUT_WIDGET_DEFINITION,
12
10
  ownerModuleId: PHI_AUTH_RUNTIME_MODULE_ID,
13
11
  renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
@@ -16,7 +14,7 @@ export const PHI_AUTH_RUNTIME_MODULE_WIDGETS = [
16
14
  loadPreview: () => import("./widgets/logout/plugin")
17
15
  .then((module) => module.PHI_AUTH_LOGOUT_WIDGET_PLUGIN),
18
16
  }),
19
- defineFirstPartyWidget({
17
+ definePhiFirstPartyWidget({
20
18
  definition: PHI_AUTH_SECURITY_WIDGET_DEFINITION,
21
19
  ownerModuleId: PHI_AUTH_RUNTIME_MODULE_ID,
22
20
  renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
@@ -25,7 +23,7 @@ export const PHI_AUTH_RUNTIME_MODULE_WIDGETS = [
25
23
  loadPreview: () => import("./widgets/security/plugin")
26
24
  .then((module) => module.PHI_AUTH_SECURITY_WIDGET_PLUGIN),
27
25
  }),
28
- defineFirstPartyWidget({
26
+ definePhiFirstPartyWidget({
29
27
  definition: PHI_AUTH_WORKFLOW_WIDGET_DEFINITION,
30
28
  ownerModuleId: PHI_AUTH_RUNTIME_MODULE_ID,
31
29
  renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
@@ -34,7 +32,7 @@ export const PHI_AUTH_RUNTIME_MODULE_WIDGETS = [
34
32
  loadPreview: () => import("./widgets/auth-workflow/plugin")
35
33
  .then((module) => module.PHI_AUTH_WORKFLOW_WIDGET_PLUGIN),
36
34
  }),
37
- defineFirstPartyWidget({
35
+ definePhiFirstPartyWidget({
38
36
  definition: PHI_AUTH_METHODS_WIDGET_DEFINITION,
39
37
  ownerModuleId: PHI_AUTH_RUNTIME_MODULE_ID,
40
38
  renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
@@ -3,8 +3,8 @@ import { createPhiCmsPresetNodes } from "../../../helpers/cms-preset-nodes";
3
3
  import { createPhiSignalAddress } from "../../../types/signals";
4
4
  import { getPhiAvatarWidgetLabels } from "./labels";
5
5
  import { PHI_AVATAR_OVERLAY_IDS } from "./addresses";
6
- import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
7
6
  import { PHI_DIALOG_BODY_CONFIG } from "../../../helpers/cms-dialog";
7
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../components/widgets/label-sets/runtime-options";
8
8
  /**
9
9
  * The Avatar Module's Overlay: one modal holding the picker.
10
10
  *
@@ -15,11 +15,7 @@ import { PHI_DIALOG_BODY_CONFIG } from "../../../helpers/cms-dialog";
15
15
  */
16
16
  export async function buildPhiAvatarAreaPickerOverlayTree({ page, runtime, }) {
17
17
  const ids = PHI_AVATAR_OVERLAY_IDS;
18
- const labels = await getPhiAvatarWidgetLabels({
19
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
20
- internalToken: readPhiServerApiCredentials().internalToken,
21
- locale: runtime.locale.current,
22
- });
18
+ const labels = await getPhiAvatarWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
23
19
  const nodes = createPhiCmsPresetNodes(page);
24
20
  return {
25
21
  page,
@@ -2,16 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getPhiAvatarWidgetLabels } from "../../labels";
3
3
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
4
4
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
5
- import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
5
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
6
6
  export async function PhiAccountAvatarWidget({ runtime, config }) {
7
7
  // Nobody who is not signed in has an avatar to show or change.
8
8
  if (runtime.viewer.access !== "authenticated") {
9
9
  return null;
10
10
  }
11
- const labels = await getPhiAvatarWidgetLabels({
12
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
13
- internalToken: readPhiServerApiCredentials().internalToken,
14
- locale: runtime.locale.current,
15
- });
11
+ const labels = await getPhiAvatarWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
16
12
  return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.AccountAvatar, componentProps: { runtime, labels, config } }));
17
13
  }
@@ -2,16 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getPhiAvatarWidgetLabels } from "../../labels";
3
3
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
4
4
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
5
- import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
5
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
6
6
  export async function PhiAccountAvatarPickerWidget({ runtime, config }) {
7
7
  // Nobody who is not signed in has an avatar to show or change.
8
8
  if (runtime.viewer.access !== "authenticated") {
9
9
  return null;
10
10
  }
11
- const labels = await getPhiAvatarWidgetLabels({
12
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
13
- internalToken: readPhiServerApiCredentials().internalToken,
14
- locale: runtime.locale.current,
15
- });
11
+ const labels = await getPhiAvatarWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
16
12
  return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.AccountAvatarPicker, componentProps: { runtime, labels, config } }));
17
13
  }
@@ -1,18 +1,16 @@
1
1
  import { PHI_AVATAR_RUNTIME_MODULE_ID } from "./ids";
2
2
  import { PHI_ACCOUNT_AVATAR_WIDGET_DEFINITION } from "./widgets/account-avatar/config";
3
3
  import { PHI_ACCOUNT_AVATAR_PICKER_WIDGET_DEFINITION } from "./widgets/account-avatar-picker/config";
4
- function defineFirstPartyWidget(options) {
5
- return options;
6
- }
4
+ import { definePhiFirstPartyWidget } from "../contracts";
7
5
  export const PHI_AVATAR_RUNTIME_MODULE_WIDGETS = [
8
- defineFirstPartyWidget({
6
+ definePhiFirstPartyWidget({
9
7
  definition: PHI_ACCOUNT_AVATAR_WIDGET_DEFINITION,
10
8
  ownerModuleId: PHI_AVATAR_RUNTIME_MODULE_ID,
11
9
  renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
12
10
  loadRuntime: () => import("./widgets/account-avatar/plugin").then((module) => module.PHI_ACCOUNT_AVATAR_WIDGET_PLUGIN),
13
11
  loadPreview: () => import("./widgets/account-avatar/plugin").then((module) => module.PHI_ACCOUNT_AVATAR_WIDGET_PLUGIN),
14
12
  }),
15
- defineFirstPartyWidget({
13
+ definePhiFirstPartyWidget({
16
14
  definition: PHI_ACCOUNT_AVATAR_PICKER_WIDGET_DEFINITION,
17
15
  ownerModuleId: PHI_AVATAR_RUNTIME_MODULE_ID,
18
16
  renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
@@ -1,12 +1,11 @@
1
1
  import type { PhiDeveloperBuilderStructureCanvasProps } from "./structure-canvas";
2
2
  import type { PhiBuilderPageDraftsMapByScope, PhiBuilderPageMeta } from "../page-presets.server";
3
3
  import type { PhiBuilderPreviewRegionDraft } from "../preview-transport";
4
- import type { PhiDeveloperBuilderArea, PhiDeveloperBuilderRegionDraft } from "../developer-workspace-types";
4
+ import type { PhiDeveloperBuilderArea } from "../developer-workspace-types";
5
5
  import type { PhiBuilderChromeWidgetLabels } from "../../../../components/widgets/label-types/builder-chrome";
6
6
  import type { PhiRegionWidgetLabels } from "../../../../components/widgets/label-types/region";
7
- export declare function PhiDeveloperBuilderPagesWorkspaceWidgetClient({ pageDraftsByScope, pagePresetDrafts, pageMeta, pageMetaArea, pageMetaPageKey, serverPreviewRegions, previewRegionDrafts, regionLabels, pickerLabels, }: {
7
+ export declare function PhiDeveloperBuilderPagesWorkspaceWidgetClient({ pageDraftsByScope, pageMeta, pageMetaArea, pageMetaPageKey, serverPreviewRegions, previewRegionDrafts, regionLabels, pickerLabels, }: {
8
8
  pageDraftsByScope?: PhiBuilderPageDraftsMapByScope;
9
- pagePresetDrafts: Record<string, PhiDeveloperBuilderRegionDraft>;
10
9
  pageMeta?: PhiBuilderPageMeta;
11
10
  pageMetaArea: PhiDeveloperBuilderArea;
12
11
  pageMetaPageKey: string;
@@ -1,29 +1,16 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useEffect, useMemo } from "react";
3
+ import { useEffect } from "react";
4
4
  import { PhiDeveloperBuilderCanvasWidgetClient } from "./canvas-widget";
5
5
  import { getPhiBuilderRegionDraftKey } from "../region-keys";
6
- import { mergePhiDeveloperDeletedPageDrafts, mergePhiDeveloperPageMetaDrafts, mergePhiDeveloperPagePresetDrafts, setPhiDeveloperBuilderPageControllerSettings, usePhiDeveloperBuilderStateValue, } from "../developer-workspace-store";
6
+ import { mergePhiDeveloperDeletedPageDrafts, mergePhiDeveloperPageMetaDrafts, setPhiDeveloperBuilderPageControllerSettings, usePhiDeveloperBuilderStateValue, } from "../developer-workspace-store";
7
7
  import { isPhiBuilderConstructedRootPage } from "../offered-page-catalog";
8
- import { buildPhiDeveloperBuilderRegionDraftsFromTree } from "../region-hydration";
9
- import { PHI_BUILDER_PAGE_REGION_KEYS } from "../region-keys";
10
- export function PhiDeveloperBuilderPagesWorkspaceWidgetClient({ pageDraftsByScope, pagePresetDrafts, pageMeta, pageMetaArea, pageMetaPageKey, serverPreviewRegions, previewRegionDrafts = null, regionLabels, pickerLabels, }) {
8
+ export function PhiDeveloperBuilderPagesWorkspaceWidgetClient({ pageDraftsByScope, pageMeta, pageMetaArea, pageMetaPageKey, serverPreviewRegions, previewRegionDrafts = null, regionLabels, pickerLabels, }) {
11
9
  /*
12
- * A root the Builder constructs starts empty, the way a Page somebody just created does.
13
- *
14
- * The seed the server sends is the tree of whatever Preset currently answers `/` -- the Area's own
15
- * Page, when the landing is answered with nobody. Copying that into the drafts would mean "make your
16
- * own landing" opens on somebody else's, so this replaces it with the same projection run over an
17
- * empty tree: one draft per Page region, each with nothing in it.
18
- *
19
- * Empty drafts rather than no drafts, because the merge below is a merge: leaving the keys out would
20
- * let the Preset's regions stand from before the Builder answered.
10
+ * A root the Builder constructs starts empty, the way a Page somebody just created does: the seed the
11
+ * server sends is whatever Preset currently answers `/`, and its settings are that other Page's.
21
12
  */
22
13
  const constructedRoot = usePhiDeveloperBuilderStateValue((state) => isPhiBuilderConstructedRootPage(state, pageMetaArea, pageMetaPageKey));
23
- const emptyPresetDrafts = useMemo(() => buildPhiDeveloperBuilderRegionDraftsFromTree({ regions: [], layoutNodes: [], contentWidgets: [] }, pageMetaArea, pageMetaPageKey, PHI_BUILDER_PAGE_REGION_KEYS), [pageMetaArea, pageMetaPageKey]);
24
- useEffect(() => {
25
- mergePhiDeveloperPagePresetDrafts(constructedRoot ? emptyPresetDrafts : pagePresetDrafts);
26
- }, [constructedRoot, emptyPresetDrafts, pagePresetDrafts]);
27
14
  useEffect(() => {
28
15
  mergePhiDeveloperPageMetaDrafts(pageMetaArea, {
29
16
  [getPhiBuilderRegionDraftKey(pageMetaArea, "page_meta", pageMetaPageKey)]: {
@@ -209,6 +209,7 @@ export function usePhiBuilderDraftCommandController({ effectiveArea, effectiveNa
209
209
  await publishPhiDeveloperBuilderModulesDraft(state, getPhiDeveloperRegionDraftsSnapshot(), {
210
210
  builderPlugins: builderModuleMetas.plugins,
211
211
  scope: { area },
212
+ shellPresetDrafts: shellPresetDraftsByArea[area] ?? null,
212
213
  });
213
214
  }
214
215
  clearPhiBuilderModuleAreasDirty();
@@ -63,7 +63,7 @@ export function usePhiBuilderPageController({ emitCapability, effectiveArea, eff
63
63
  storePhiWorkspacePersistedPages(area, pages);
64
64
  }
65
65
  function navigateToBuilderPage(pageKey) {
66
- openPhiBuilderPage(effectiveArea, pageKey, { closePages: true });
66
+ openPhiBuilderPage(effectiveArea, pageKey);
67
67
  if (typeof pathname === "string") {
68
68
  const nextSearchParams = new URLSearchParams(searchParams.toString());
69
69
  nextSearchParams.set(PHI_BUILDER_AREA_SEARCH_PARAM, effectiveArea);
@@ -8,8 +8,8 @@ import { resolvePhiRuntimeModuleIdsForArea } from "../../../../plugins/runtime-m
8
8
  import { localizePhiRuntimeModuleDefinitions } from "../../module-labels.server";
9
9
  import { getPhiBuilderChromeWidgetLabels } from "../../../../components/widgets/label-sets/builder-chrome";
10
10
  import { getPhiHistoryLabels } from "../../../../components/widgets/label-sets/history";
11
- import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
12
11
  import { resolvePhiRuntimeModuleServerBinding } from "../../server-capabilities";
12
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
13
13
  export const PHI_BUILDER_RUNTIME_CONTROLLER_SERVER_DEFINITION = {
14
14
  ...PHI_BUILDER_RUNTIME_CONTROLLER_DEFINITION,
15
15
  serverPreload: async ({ runtime, runtimeModuleCatalog, serverCapabilities }) => {
@@ -21,16 +21,8 @@ export const PHI_BUILDER_RUNTIME_CONTROLLER_SERVER_DEFINITION = {
21
21
  buildPhiBuilderAreaRootRoutesByArea(runtime, runtimeModuleCatalog),
22
22
  buildPhiBuilderAreaMetaByArea(runtime, runtimeModuleCatalog),
23
23
  buildPhiBuilderAreaControllerSettingsByArea(runtime, runtimeModuleCatalog),
24
- getPhiBuilderChromeWidgetLabels({
25
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
26
- internalToken: readPhiServerApiCredentials().internalToken,
27
- locale: runtime.locale.current,
28
- }),
29
- getPhiHistoryLabels({
30
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
31
- internalToken: readPhiServerApiCredentials().internalToken,
32
- locale: runtime.locale.current,
33
- }),
24
+ getPhiBuilderChromeWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
25
+ getPhiHistoryLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
34
26
  ]);
35
27
  const requestedArea = normalizePhiBuilderAreaSearchParam(runtime.request?.searchParams?.[PHI_BUILDER_AREA_SEARCH_PARAM]);
36
28
  const requestedModuleIds = normalizePhiBuilderRuntimeModuleIdsSearchParam(runtime.request?.searchParams?.[PHI_BUILDER_RUNTIME_MODULES_SEARCH_PARAM]);
@@ -22,7 +22,7 @@ import { isPhiBuilderAreaKey, resolvePhiBuilderAreaAsCmsArea, } from "../../../.
22
22
  import { resolvePhiRuntimeAreaDefinition } from "../../../../plugins/runtime-modules/area-definitions";
23
23
  import { resolvePhiBuilderNavigationWidgetNavKey } from "../navigation-widget-runtime";
24
24
  import { parsePhiBuilderNavigationScopeKey } from "../../../../helpers/cms-navigation-catalog";
25
- import { patchPhiBuilderSignalWiringSession, resetPhiBuilderSignalWiringSession, openPhiBuilderPage, openPhiBuilderPageInOpenArea, openPhiBuilderPagesPanel, selectPhiBuilderPageNode, setPhiBuilderCommandWorkspace, setPhiBuilderDebugScaffold, setPhiBuilderInspectorOpen, setPhiBuilderMode, usePhiDeveloperBuilderWorkspaceState, completePhiDeveloperBuilderEffectsEditor, normalizePhiDeveloperBuilderArea as normalizeBuilderArea, previewPhiDeveloperBuilderEffects, selectPhiDeveloperBuilderNode, usePhiDeveloperRegionDraft, getPhiDeveloperBuilderStateSnapshot, getPhiDeveloperRegionDraftsSnapshot, readPhiBuilderEffectiveAreaRootRoute, setPhiDeveloperBuilderAreaRootRoutes, setPhiDeveloperBuilderAreaMetaBaseline, setPhiDeveloperBuilderAreaControllerSettings, readPhiBuilderEffectiveAreaMeta, closePhiBuilderModuleDeactivationRequest, closePhiBuilderPublicRouteCollisionRequest, } from "../developer-workspace-store";
25
+ import { patchPhiBuilderSignalWiringSession, resetPhiBuilderSignalWiringSession, openPhiBuilderPage, openPhiBuilderPageInOpenArea, selectPhiBuilderPageNode, setPhiBuilderCommandWorkspace, setPhiBuilderDebugScaffold, setPhiBuilderInspectorOpen, setPhiBuilderMode, usePhiDeveloperBuilderWorkspaceState, completePhiDeveloperBuilderEffectsEditor, normalizePhiDeveloperBuilderArea as normalizeBuilderArea, previewPhiDeveloperBuilderEffects, selectPhiDeveloperBuilderNode, usePhiDeveloperRegionDraft, getPhiDeveloperBuilderStateSnapshot, getPhiDeveloperRegionDraftsSnapshot, readPhiBuilderEffectiveAreaRootRoute, setPhiDeveloperBuilderAreaRootRoutes, setPhiDeveloperBuilderAreaMetaBaseline, setPhiDeveloperBuilderAreaControllerSettings, readPhiBuilderEffectiveAreaMeta, closePhiBuilderModuleDeactivationRequest, closePhiBuilderPublicRouteCollisionRequest, } from "../developer-workspace-store";
26
26
  import {} from "../options-providers";
27
27
  import { PHI_AREA_META_PUBLIC_DEFAULTS } from "../../../../helpers/cms-area-config";
28
28
  import { getPhiBuilderRegionDraftKey } from "../region-keys";
@@ -917,7 +917,7 @@ function usePhiDeveloperBuilderWorkspaceController(options) {
917
917
  return;
918
918
  }
919
919
  emitPageTitleInputValue(nextPageKey);
920
- openPhiBuilderPageInOpenArea(nextPageKey, { closePages: true });
920
+ openPhiBuilderPageInOpenArea(nextPageKey);
921
921
  return;
922
922
  }
923
923
  const builderControllerReceiver = createPhiBuilderControllerAddress();
@@ -1188,10 +1188,6 @@ function usePhiDeveloperBuilderWorkspaceController(options) {
1188
1188
  });
1189
1189
  return;
1190
1190
  }
1191
- if (addressedHere && signal.channel === "command" && signal.action === "activate" && signal.value === "pagesOpen") {
1192
- openPhiBuilderPagesPanel();
1193
- return;
1194
- }
1195
1191
  if (signal.receiver === createPhiBuilderControllerAddress() && signal.channel === "effects") {
1196
1192
  if (signal.action === "change" && signal.valueType === "none") {
1197
1193
  effectsWorkflowCorrelationRef.current = signal.correlationId;
@@ -146,7 +146,6 @@ export declare function readPhiBuilderEffectiveAreaMeta(state: Pick<PhiDeveloper
146
146
  */
147
147
  export declare function restorePhiDeveloperBuilderAreaMeta(area: PhiDeveloperBuilderArea, meta: PhiAreaMeta | null | undefined): void;
148
148
  export declare function mergePhiDeveloperRegionDrafts(drafts: Record<string, PhiDeveloperBuilderRegionDraft>): void;
149
- export declare function mergePhiDeveloperPagePresetDrafts(drafts: Record<string, PhiDeveloperBuilderRegionDraft>): void;
150
149
  export declare function mergePhiDeveloperPageMetaDrafts(area: PhiDeveloperBuilderArea, drafts: Record<string, PhiDeveloperBuilderPageMetaDraft>): void;
151
150
  export declare function mergePhiDeveloperDeletedPageDrafts(area: PhiDeveloperBuilderArea, drafts: Record<string, boolean>): void;
152
151
  export declare function usePhiDeveloperRegionDrafts(): Record<string, PhiDeveloperBuilderRegionDraft>;
@@ -163,19 +162,14 @@ export declare function usePhiDeveloperBuilderStateValue<TSelected>(selector: (s
163
162
  export declare function getPhiDeveloperRegionDraftsSnapshot(): Record<string, PhiDeveloperBuilderRegionDraft>;
164
163
  export declare function getPhiDeveloperBuilderStateSnapshot(): PhiDeveloperBuilderWorkspaceState;
165
164
  /** Opens a Page of an Area: the catalog says what is open, the selection starts at the Page itself. */
166
- export declare function openPhiBuilderPage(area: PhiDeveloperBuilderArea, pageKey: string, options?: {
167
- closePages?: boolean;
168
- }): void;
165
+ export declare function openPhiBuilderPage(area: PhiDeveloperBuilderArea, pageKey: string): void;
169
166
  /** Opens a Page of the Area that is open. */
170
- export declare function openPhiBuilderPageInOpenArea(pageKey: string, options?: {
171
- closePages?: boolean;
172
- }): void;
167
+ export declare function openPhiBuilderPageInOpenArea(pageKey: string): void;
173
168
  /** Points the selection at a Page the catalog opened by itself, leaving the rest of the tool as it is. */
174
169
  export declare function selectPhiBuilderPageNode(pageKey: string): void;
175
170
  export declare function setPhiBuilderCommandWorkspace(commandWorkspace: PhiDeveloperBuilderCommandWorkspace): void;
176
171
  export declare function setPhiBuilderMode(builderMode: PhiDeveloperBuilderMode): void;
177
172
  export declare function setPhiBuilderDebugScaffold(debugScaffold: boolean): void;
178
- export declare function openPhiBuilderPagesPanel(): void;
179
173
  export declare function setPhiBuilderInspectorOpen(inspectorOpen: boolean): void;
180
174
  export declare function setPhiBuilderSelectedLayoutAnchor(anchor: PhiAnchorWidgetPlacement): void;
181
175
  /** A Page's meta as edited, laid over what its draft held. */
@@ -17,14 +17,10 @@ function createDefaultBuilderState() {
17
17
  nodeKey: `page:${defaultPageKey}`,
18
18
  nodeId: null,
19
19
  nodeKind: "page",
20
- selectedRegionType: null,
21
20
  selectedRegionKey: null,
22
21
  selectedRootRegionKey: null,
23
22
  selectedLayoutAnchor: "center",
24
- pagePresetDrafts: {},
25
23
  pageMetaDrafts: {},
26
- sidebarKey: "pages",
27
- pagesOpen: false,
28
24
  inspectorOpen: false,
29
25
  signalWiringRequest: null,
30
26
  signalWiring: {
@@ -39,7 +35,6 @@ function createDefaultBuilderState() {
39
35
  moduleDeactivationRequest: null,
40
36
  builderMode: "editor",
41
37
  search: "",
42
- darkMode: false,
43
38
  debugScaffold: false,
44
39
  commandWorkspace: null,
45
40
  pickerWidgetCategoryFilters: [],
@@ -164,21 +159,17 @@ export function closePhiBuilderPublicRouteCollisionRequest() {
164
159
  /**
165
160
  * The selection a Page opens with: the Page itself, nothing inside it chosen, the Inspector closed and
166
161
  * the Pages sidebar showing. One answer for every way a Page is opened -- a click in the tree, a route
167
- * change, a new Page -- which used to be four copies that had drifted apart. `chrome` resets the
168
- * chrome controls as well, `closePages` folds the Pages panel.
162
+ * change, a new Page -- which used to be four copies that had drifted apart.
169
163
  */
170
- function resetPhiBuilderSelectionToPage(current, pageKey, options = {}) {
164
+ function resetPhiBuilderSelectionToPage(current, pageKey) {
171
165
  return {
172
166
  ...current,
173
167
  nodeKey: `page:${pageKey}`,
174
168
  nodeId: null,
175
169
  nodeKind: "page",
176
- selectedRegionType: null,
177
170
  selectedRegionKey: null,
178
171
  selectedRootRegionKey: null,
179
172
  inspectorOpen: false,
180
- sidebarKey: "pages",
181
- ...(options.closePages ? { pagesOpen: false } : {}),
182
173
  };
183
174
  }
184
175
  export function selectPhiDeveloperBuilderNode(selection) {
@@ -187,7 +178,6 @@ export function selectPhiDeveloperBuilderNode(selection) {
187
178
  nodeKey: selection.nodeKey,
188
179
  nodeId: selection.nodeId ?? null,
189
180
  nodeKind: selection.nodeKind,
190
- selectedRegionType: selection.nodeKind === "region" ? selection.regionType ?? null : null,
191
181
  selectedRegionKey: selection.nodeKind === "region" || selection.nodeKind === "slot"
192
182
  ? selection.regionKey ?? null
193
183
  : null,
@@ -211,12 +201,6 @@ export function selectPhiDeveloperBuilderNode(selection) {
211
201
  (selection.nodeKind === "region" ||
212
202
  selection.nodeKind === "layout" ||
213
203
  selection.nodeKind === "widget"),
214
- sidebarKey: selection.nodeKind === "region" || selection.nodeKind === "slot"
215
- ? "structure"
216
- : current.sidebarKey,
217
- pagesOpen: selection.nodeKind === "region" || selection.nodeKind === "slot"
218
- ? false
219
- : current.pagesOpen,
220
204
  }));
221
205
  }
222
206
  const builderRegionDraftStore = createPhiPluginStateStore("@phis/ui/developer-region-drafts", () => ({}));
@@ -539,15 +523,6 @@ export function mergePhiDeveloperRegionDrafts(drafts) {
539
523
  : current;
540
524
  });
541
525
  }
542
- export function mergePhiDeveloperPagePresetDrafts(drafts) {
543
- builderWorkspaceStore.patch(PHI_WORKSPACE_CATALOG_SCOPE, (current) => ({
544
- ...current,
545
- pagePresetDrafts: {
546
- ...current.pagePresetDrafts,
547
- ...drafts,
548
- },
549
- }));
550
- }
551
526
  export function mergePhiDeveloperPageMetaDrafts(area, drafts) {
552
527
  void area;
553
528
  builderWorkspaceStore.patch(PHI_WORKSPACE_CATALOG_SCOPE, (current) => {
@@ -640,7 +615,24 @@ function readMergedHydrationSnapshot() {
640
615
  return mergedHydrationSnapshot;
641
616
  }
642
617
  export function usePhiDeveloperBuilderStateValue(selector) {
618
+ /*
619
+ * Cached on the source and on the selector, as `components/state/scoped-state-store.ts` does. Keyed
620
+ * on the source alone, a selector that changed while the store did not -- a region key, a node id, a
621
+ * target Area carried in its closure -- kept answering with what the previous one selected. An
622
+ * inline selector is new each render, so it runs once per render; within one render every read
623
+ * agrees, which is what `useSyncExternalStore` needs.
624
+ */
643
625
  const selectedRef = useRef(null);
626
+ const selectedHydrationRef = useRef(null);
627
+ const select = (ref, source) => {
628
+ const cached = ref.current;
629
+ if (cached && Object.is(cached.source, source) && cached.selector === selector) {
630
+ return cached.selected;
631
+ }
632
+ const selected = selector(source);
633
+ ref.current = { source, selector, selected };
634
+ return selected;
635
+ };
644
636
  return useSyncExternalStore((listener) => {
645
637
  const unsubscribeTool = builderWorkspaceStore.subscribe(PHI_WORKSPACE_CATALOG_SCOPE, listener);
646
638
  const unsubscribeCatalog = phiWorkspaceCatalogStore.subscribe(PHI_WORKSPACE_CATALOG_SCOPE, listener);
@@ -648,16 +640,7 @@ export function usePhiDeveloperBuilderStateValue(selector) {
648
640
  unsubscribeTool();
649
641
  unsubscribeCatalog();
650
642
  };
651
- }, () => {
652
- const source = readMergedWorkspaceSnapshot();
653
- const cached = selectedRef.current;
654
- if (cached && Object.is(cached.source, source)) {
655
- return cached.selected;
656
- }
657
- const selected = selector(source);
658
- selectedRef.current = { source, selected };
659
- return selected;
660
- }, () => selector(readMergedHydrationSnapshot()));
643
+ }, () => select(selectedRef, readMergedWorkspaceSnapshot()), () => select(selectedHydrationRef, readMergedHydrationSnapshot()));
661
644
  }
662
645
  export function getPhiDeveloperRegionDraftsSnapshot() {
663
646
  return builderRegionDraftStore.getSnapshot("default");
@@ -675,14 +658,14 @@ export function getPhiDeveloperBuilderStateSnapshot() {
675
658
  * `scripts/validate-builder-store-ownership.mjs` keeps it in one place.
676
659
  */
677
660
  /** Opens a Page of an Area: the catalog says what is open, the selection starts at the Page itself. */
678
- export function openPhiBuilderPage(area, pageKey, options = {}) {
661
+ export function openPhiBuilderPage(area, pageKey) {
679
662
  openPhiWorkspacePage(area, pageKey);
680
- builderWorkspaceStore.patch(PHI_WORKSPACE_CATALOG_SCOPE, (current) => resetPhiBuilderSelectionToPage(current, pageKey, options));
663
+ builderWorkspaceStore.patch(PHI_WORKSPACE_CATALOG_SCOPE, (current) => resetPhiBuilderSelectionToPage(current, pageKey));
681
664
  }
682
665
  /** Opens a Page of the Area that is open. */
683
- export function openPhiBuilderPageInOpenArea(pageKey, options = {}) {
666
+ export function openPhiBuilderPageInOpenArea(pageKey) {
684
667
  setPhiWorkspacePageKey(pageKey);
685
- builderWorkspaceStore.patch(PHI_WORKSPACE_CATALOG_SCOPE, (current) => resetPhiBuilderSelectionToPage(current, pageKey, options));
668
+ builderWorkspaceStore.patch(PHI_WORKSPACE_CATALOG_SCOPE, (current) => resetPhiBuilderSelectionToPage(current, pageKey));
686
669
  }
687
670
  /** Points the selection at a Page the catalog opened by itself, leaving the rest of the tool as it is. */
688
671
  export function selectPhiBuilderPageNode(pageKey) {
@@ -700,9 +683,6 @@ export function setPhiBuilderMode(builderMode) {
700
683
  export function setPhiBuilderDebugScaffold(debugScaffold) {
701
684
  setToolField("debugScaffold", debugScaffold);
702
685
  }
703
- export function openPhiBuilderPagesPanel() {
704
- setToolField("pagesOpen", true);
705
- }
706
686
  export function setPhiBuilderInspectorOpen(inspectorOpen) {
707
687
  setToolField("inspectorOpen", inspectorOpen);
708
688
  }
@@ -118,16 +118,12 @@ export type PhiDeveloperBuilderState = {
118
118
  nodeKey: string;
119
119
  nodeId: PhiCmsInstanceId | null;
120
120
  nodeKind: PhiDeveloperBuilderNodeKind;
121
- selectedRegionType: number | null;
122
121
  selectedRegionKey: string | null;
123
122
  selectedRootRegionKey: string | null;
124
123
  selectedLayoutAnchor: PhiAnchorWidgetPlacement;
125
- pagePresetDrafts: Record<string, PhiDeveloperBuilderRegionDraft>;
126
124
  pageMetaDrafts: Record<string, PhiDeveloperBuilderPageMetaDraft>;
127
125
  deletedPageDrafts: Record<string, boolean>;
128
126
  draftAllocations: Record<string, PhiDeveloperBuilderDraftAllocation>;
129
- sidebarKey: string;
130
- pagesOpen: boolean;
131
127
  inspectorOpen: boolean;
132
128
  /**
133
129
  * The Signal wiring session behind the wiring overlay.
@@ -168,7 +164,6 @@ export type PhiDeveloperBuilderState = {
168
164
  moduleDeactivationRequest: PhiBuilderModuleDeactivationRequest | null;
169
165
  builderMode: PhiDeveloperBuilderMode;
170
166
  search: string;
171
- darkMode: boolean;
172
167
  debugScaffold: boolean;
173
168
  commandWorkspace: PhiDeveloperBuilderCommandWorkspace;
174
169
  pickerWidgetCategoryFilters: string[];
@@ -4,6 +4,7 @@ import { usePhiPageModeToken } from "../../../components/root/phi-config-provide
4
4
  import { PhiButtonControl } from "../../../components/controls/phi-button-control";
5
5
  import { usePhiDeveloperBuilderStateValue } from "./developer-workspace-store";
6
6
  import { PhiIcon } from "../../../components/shell/phi-icon";
7
+ import { joinPhiClassNames } from "../../../helpers/class-names";
7
8
  export function PhiEditScaffoldDrawer({ kind, nodeId, regionKey, scaffoldLabel, className, onOpenInsert, onClick, onKeyDown, children, chrome, style, }) {
8
9
  // The editor's colours, not a tone's: a scaffold inside a toned Surface marks it in the page's mode.
9
10
  const token = usePhiPageModeToken();
@@ -23,7 +24,7 @@ export function PhiEditScaffoldDrawer({ kind, nodeId, regionKey, scaffoldLabel,
23
24
  "--phi-edit-scaffold-label-border": token.colorSuccessBorder,
24
25
  "--phi-edit-scaffold-label-color": token.colorSuccessText,
25
26
  };
26
- return (_jsxs("div", { className: ["phi-edit-scaffold-drawer", className].filter(Boolean).join(" "), "data-phi-edit-scaffold-kind": kind, "data-phi-edit-scaffold-selected": selected ? "true" : undefined, "data-phi-edit-scaffold-empty": isEmpty ? "true" : undefined, "data-phi-builder-layout-title": scaffoldLabel?.trim() || undefined, role: "button", tabIndex: 0, style: {
27
+ return (_jsxs("div", { className: joinPhiClassNames("phi-edit-scaffold-drawer", className), "data-phi-edit-scaffold-kind": kind, "data-phi-edit-scaffold-selected": selected ? "true" : undefined, "data-phi-edit-scaffold-empty": isEmpty ? "true" : undefined, "data-phi-builder-layout-title": scaffoldLabel?.trim() || undefined, role: "button", tabIndex: 0, style: {
27
28
  ...scaffoldVars,
28
29
  cursor: onClick ? "pointer" : undefined,
29
30
  ...style,
@@ -17,7 +17,6 @@ import { resolvePhiRuntimeModuleAuthoringDataProviderDescriptors, resolvePhiRunt
17
17
  import { PhiRuntimeModuleAuthoringDataProviderHost } from "../../../components/runtime/runtime-module-authoring-host";
18
18
  import { PhiRuntimeModuleDataProviderClientHost } from "../../../components/runtime/runtime-module-data-provider-client-manifest";
19
19
  import { resolvePhiBuilderAuthoringPickerDataProviderKeysFromCatalog } from "./authoring-provider-keys";
20
- import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
21
20
  export async function PhiBuilderInspectorSectionWidget({ runtime, registry, view, section, signalRoutes, }) {
22
21
  const area = normalizePhiBuilderAreaSearchParam(runtime.request?.searchParams?.[PHI_BUILDER_AREA_SEARCH_PARAM]) ?? "public";
23
22
  const moduleIds = await buildPhiBuilderRuntimeModuleIdsForArea(runtime, area, registry.runtimeModuleCatalog);
@@ -41,38 +40,14 @@ export async function PhiBuilderInspectorSectionWidget({ runtime, registry, view
41
40
  ]),
42
41
  ];
43
42
  const [backgroundLabels, borderLabels, paddingLabels, geometryLabels, signalsLabels, colorPickerLabels, iconPickerLabels, inspectorLabels,] = await Promise.all([
44
- getPhiBackgroundWidgetLabels({
45
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
46
- internalToken: readPhiServerApiCredentials().internalToken,
47
- locale: runtime.locale.current,
48
- }),
49
- getPhiBorderWidgetLabels({
50
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
51
- internalToken: readPhiServerApiCredentials().internalToken,
52
- locale: runtime.locale.current,
53
- }),
54
- getPhiPaddingWidgetLabels({
55
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
56
- internalToken: readPhiServerApiCredentials().internalToken,
57
- locale: runtime.locale.current,
58
- }),
59
- getPhiGeometryWidgetLabels({
60
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
61
- internalToken: readPhiServerApiCredentials().internalToken,
62
- locale: runtime.locale.current,
63
- }),
64
- getPhiSignalsWidgetLabels({
65
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
66
- internalToken: readPhiServerApiCredentials().internalToken,
67
- locale: runtime.locale.current,
68
- }),
43
+ getPhiBackgroundWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
44
+ getPhiBorderWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
45
+ getPhiPaddingWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
46
+ getPhiGeometryWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
47
+ getPhiSignalsWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
69
48
  getPhiColorPickerLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
70
49
  getPhiIconPickerLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
71
- getPhiInspectorWidgetLabels({
72
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
73
- internalToken: readPhiServerApiCredentials().internalToken,
74
- locale: runtime.locale.current,
75
- }),
50
+ getPhiInspectorWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
76
51
  ]);
77
52
  const surfaceLabels = resolvePhiInspectorSurfaceLabels(inspectorLabels);
78
53
  return (_jsx(PhiRuntimeModuleAuthoringDataProviderHost, { providerKeys: authoringDataProviderKeys, children: _jsx(PhiRuntimeModuleDataProviderClientHost, { providerKeys: resolvePhiBuilderAuthoringPickerDataProviderKeysFromCatalog(registry.runtimeModuleCatalog), mode: "live", children: view === "region" ? (_jsx(PhiBuilderRegionInspectorSectionWidgetClient, { section: section, signalRoutes: signalRoutes, geometryLabels: geometryLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, paddingLabels: paddingLabels, surfaceLabels: surfaceLabels, visibilityLabels: inspectorLabels.regionVisibility, colorPickerLabels: colorPickerLabels })) : view === "layout" ? (_jsx(PhiBuilderLayoutInspectorSectionWidgetClient, { section: section, signalRoutes: signalRoutes, signalsLabels: signalsLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, paddingLabels: paddingLabels, surfaceLabels: surfaceLabels, gridLabels: inspectorLabels.grid, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, fieldLabels: inspectorLabels.fields })) : (_jsx(PhiBuilderWidgetInspectorSectionWidgetClient, { section: section, signalRoutes: signalRoutes, geometryLabels: geometryLabels, surfaceLabels: surfaceLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, signalsLabels: signalsLabels, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, fieldLabels: inspectorLabels.fields })) }) }));
@@ -164,9 +164,18 @@ export function buildPhiBuilderNavigationOverlay(navigation) {
164
164
  }
165
165
  export async function savePhiBuilderNavigationDraft(navigation) {
166
166
  const normalizedKey = requirePhiBuilderNavigationScopeKey(navigation.key);
167
- const persistedDraft = await loadPhiBuilderNavigationOverlay(normalizedKey, "draft");
168
- const source = persistedDraft ?? await loadPhiBuilderNavigationOverlay(normalizedKey, "published");
169
- const requestedNextNodeSequence = Math.max(navigation.draftAllocation?.nextNodeSequence ?? 1, source?.nextNodeSequence ?? 1);
167
+ /*
168
+ * The next node sequence has to be at least what is stored. The allocation the client holds came from
169
+ * the server's last answer and is already that; only a tree with no allocation -- never saved from
170
+ * this client -- asks what the draft or the published overlay stands at. Two reads before every save
171
+ * were the price of asking regardless.
172
+ */
173
+ let requestedNextNodeSequence = navigation.draftAllocation?.nextNodeSequence ?? null;
174
+ if (requestedNextNodeSequence == null) {
175
+ const persistedDraft = await loadPhiBuilderNavigationOverlay(normalizedKey, "draft");
176
+ const source = persistedDraft ?? await loadPhiBuilderNavigationOverlay(normalizedKey, "published");
177
+ requestedNextNodeSequence = Math.max(1, source?.nextNodeSequence ?? 1);
178
+ }
170
179
  const response = await fetch("/api/site/cms/navigation", {
171
180
  method: "POST",
172
181
  headers: { "Content-Type": "application/json" },
@@ -6,7 +6,8 @@ import { PHI_BUILDER_RUNTIME_MODULE_ID } from "../../../plugins/runtime-modules/
6
6
  import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS } from "../../../components/forms/form-provider-contract";
7
7
  import { definePhiRuntimeModuleForm } from "../../../components/forms/form-registry";
8
8
  import { PHI_BUILDER_EFFECTS_SECTIONS } from "./effects-form-values";
9
- import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
9
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../components/widgets/label-sets/runtime-options";
10
+ import { phiFormLabel as label } from "../../../components/forms/form-descriptor-text";
10
11
  export const PHI_BUILDER_PAGE_META_FORM_ID = createPhiFormId(PHI_SHARED_PACKAGE_NAME, "builder/page-meta");
11
12
  const PHI_BUILDER_PAGE_META_FORM_LABEL_SET_KEY = "@phis/ui/modules/builder/labels/page-meta";
12
13
  const PHI_BUILDER_EFFECTS_FORM_LABEL_SET_KEY = "@phis/ui/modules/builder/labels/effects";
@@ -16,7 +17,6 @@ export const PHI_BUILDER_EFFECTS_FORM_IDS = {
16
17
  viewport: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "builder/effects/viewport"),
17
18
  };
18
19
  const literal = (value) => ({ kind: "literal", value });
19
- const label = (key, fallback) => ({ kind: "label", key, fallback });
20
20
  const option = (value, label = value) => ({ value, label: literal(label) });
21
21
  /*
22
22
  * An option whose caption comes from the Effects label set, named by the path it has there.
@@ -502,11 +502,7 @@ const descriptor = {
502
502
  };
503
503
  const loadPhiBuilderPageMetaFormLabels = async ({ runtime }) => {
504
504
  const { getPhiBuilderChromeWidgetLabels } = await import("../../../components/widgets/label-sets/builder-chrome");
505
- const labels = await getPhiBuilderChromeWidgetLabels({
506
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
507
- internalToken: readPhiServerApiCredentials().internalToken,
508
- locale: runtime.locale.current,
509
- });
505
+ const labels = await getPhiBuilderChromeWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
510
506
  return {
511
507
  "fields.title.label": labels.pages.form.title,
512
508
  "fields.title.required": labels.pages.form.titleRequired,
@@ -545,11 +541,7 @@ const loadPhiBuilderEffectsFormLabels = async ({ runtime }) => {
545
541
  import("../../../components/forms/form-labels"),
546
542
  import("../../../components/widgets/label-sets/effects"),
547
543
  ]);
548
- return flattenPhiFormLabels(await getPhiEffectsWidgetLabels({
549
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
550
- internalToken: readPhiServerApiCredentials().internalToken,
551
- locale: runtime.locale.current,
552
- }));
544
+ return flattenPhiFormLabels(await getPhiEffectsWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)));
553
545
  };
554
546
  export const PHI_BUILDER_EFFECTS_FORMS = PHI_BUILDER_EFFECTS_SECTIONS.map((section) => definePhiRuntimeModuleForm({
555
547
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
@@ -36,5 +36,4 @@ export declare function resolvePhiBuilderCurrentPageScope(runtime: PhiBlockRunti
36
36
  }>;
37
37
  export declare const buildPhiBuilderCurrentPageDrafts: (runtime: PhiBlockRuntime, runtimeModuleCatalog: PhiRuntimeModuleCatalog) => Promise<PhiBuilderCurrentPageDrafts>;
38
38
  export declare const buildPhiBuilderPageMetaForScope: (runtime: PhiBlockRuntime, area: PhiDeveloperBuilderArea, pageKey: string, runtimeModuleCatalog: PhiRuntimeModuleCatalog) => Promise<PhiBuilderPageMeta>;
39
- export declare const buildPhiBuilderPagePresetDrafts: (runtime: PhiBlockRuntime, area: PhiDeveloperBuilderArea, pageKey: string, runtimeModuleCatalog: PhiRuntimeModuleCatalog) => Promise<PhiBuilderCurrentPageDrafts>;
40
39
  export {};