@phis/ui 0.4.8 → 0.4.10

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 (183) hide show
  1. package/components/cms/phi-cms-runtime-registry.d.ts +2 -1
  2. package/components/cms/phi-cms-runtime-registry.js +1 -1
  3. package/components/controls/phi-color-control.js +2 -1
  4. package/components/controls/phi-drawer-control-adapter.js +2 -3
  5. package/components/controls/phi-drawer-control.js +3 -3
  6. package/components/controls/phi-dropdown-control.js +2 -1
  7. package/components/controls/phi-float-button-control.js +3 -3
  8. package/components/controls/phi-modal-control-adapter.js +2 -2
  9. package/components/controls/phi-modal-control.js +3 -3
  10. package/components/controls/phi-ribbon-wrap-control.js +2 -1
  11. package/components/controls/phi-zoom-image-overlay.js +11 -5
  12. package/components/forms/content-entry-forms.js +1 -5
  13. package/components/forms/form-descriptor-runtime-client.js +2 -1
  14. package/components/forms/form-descriptor-text.d.ts +17 -0
  15. package/components/forms/form-descriptor-text.js +14 -0
  16. package/components/forms/runtime-form-controller-plugin.d.ts +0 -115
  17. package/components/forms/runtime-form-controller-plugin.js +1 -1
  18. package/components/forms/upload-form-control.d.ts +0 -7
  19. package/components/forms/upload-form-control.js +1 -1
  20. package/components/layouts/clients/phi-collapsible-layout-client.js +2 -1
  21. package/components/layouts/clients/phi-sequence-slot-editor.js +2 -1
  22. package/components/layouts/clients/phi-split-card-half.js +2 -1
  23. package/components/layouts/phi-base-layout.js +2 -1
  24. package/components/layouts/phi-layout-surface-box.js +2 -1
  25. package/components/media/phi-media-picker-server.js +3 -11
  26. package/components/navigation/use-phi-protected-mail.js +1 -9
  27. package/components/regions/presets/clients/sider-context.js +4 -2
  28. package/components/root/phi-config-provider.js +2 -1
  29. package/components/root/phi-dayjs-locale.d.ts +4 -1
  30. package/components/root/phi-dayjs-locale.js +2 -2
  31. package/components/root/phi-intl-locale.d.ts +7 -1
  32. package/components/root/phi-intl-locale.js +20 -15
  33. package/components/root/phi-root-layout.js +2 -1
  34. package/components/runtime/core-runtime-controller-plugin.d.ts +0 -84
  35. package/components/runtime/core-runtime-controller-plugin.js +1 -1
  36. package/components/runtime/runtime-signal-bus.js +39 -4
  37. package/components/state/use-phi-hydrated.d.ts +6 -0
  38. package/components/state/use-phi-hydrated.js +11 -0
  39. package/components/widgets/client/shared/phi-rendered-value.js +4 -3
  40. package/components/widgets/config/parser-primitives.d.ts +5 -0
  41. package/components/widgets/config/parser-primitives.js +11 -0
  42. package/components/widgets/label-sets/runtime-options.d.ts +1 -1
  43. package/components/widgets/server/builder-chrome.js +2 -6
  44. package/components/widgets/server/search.js +2 -6
  45. package/gateway/dashboard-cards-route.js +5 -7
  46. package/gateway/navigation-target-route.js +7 -9
  47. package/gateway/page-references-route.js +6 -8
  48. package/gateway/site-config.js +3 -0
  49. package/gateway/site-proxy.js +13 -2
  50. package/helpers/class-names.d.ts +7 -0
  51. package/helpers/class-names.js +10 -0
  52. package/helpers/cms-navigation-catalog.js +4 -2
  53. package/helpers/cms-page-catalog.js +35 -6
  54. package/helpers/cms-region-keys.d.ts +0 -1
  55. package/helpers/cms-region-keys.js +1 -1
  56. package/helpers/format-date-time.d.ts +14 -3
  57. package/helpers/format-date-time.js +27 -11
  58. package/helpers/region-page-scope.d.ts +1 -3
  59. package/helpers/region-page-scope.js +0 -4
  60. package/helpers/translation-format.d.ts +6 -0
  61. package/helpers/translation-format.js +15 -8
  62. package/package.json +2 -2
  63. package/plugins/runtime/phi-slot-child-frame-view.js +2 -1
  64. package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +1 -1
  65. package/plugins/runtime-modules/admin/forms.js +1 -1
  66. package/plugins/runtime-modules/admin/trees/phi-default-admin-settings-page-tree.js +2 -5
  67. package/plugins/runtime-modules/app/forms.js +1 -1
  68. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +2 -6
  69. package/plugins/runtime-modules/asset/metadata-form.js +2 -6
  70. package/plugins/runtime-modules/asset/settings-forms.js +1 -1
  71. package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +2 -5
  72. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -6
  73. package/plugins/runtime-modules/asset/widgets/area-upload/server.js +2 -6
  74. package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +1 -3
  75. package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -6
  76. package/plugins/runtime-modules/asset/widgets.js +5 -7
  77. package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
  78. package/plugins/runtime-modules/auth/ids.d.ts +7 -7
  79. package/plugins/runtime-modules/auth/ids.js +7 -7
  80. package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +2 -6
  81. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -5
  82. package/plugins/runtime-modules/auth/widgets.d.ts +1 -2
  83. package/plugins/runtime-modules/auth/widgets.js +5 -7
  84. package/plugins/runtime-modules/avatar/overlay-tree.server.js +2 -6
  85. package/plugins/runtime-modules/avatar/widgets/account-avatar/server.js +2 -6
  86. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/server.js +2 -6
  87. package/plugins/runtime-modules/avatar/widgets.js +3 -5
  88. package/plugins/runtime-modules/builder/clients/pages-workspace.d.ts +2 -3
  89. package/plugins/runtime-modules/builder/clients/pages-workspace.js +5 -18
  90. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +1 -0
  91. package/plugins/runtime-modules/builder/controller/page-controller.js +1 -1
  92. package/plugins/runtime-modules/builder/controller/server-definition.js +3 -11
  93. package/plugins/runtime-modules/builder/controller/workspace-controller.js +2 -6
  94. package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +2 -8
  95. package/plugins/runtime-modules/builder/developer-workspace-store.js +24 -44
  96. package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +0 -5
  97. package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +2 -1
  98. package/plugins/runtime-modules/builder/inspector-section-widget.js +6 -31
  99. package/plugins/runtime-modules/builder/navigation-persistence.js +12 -3
  100. package/plugins/runtime-modules/builder/page-meta-form.js +4 -12
  101. package/plugins/runtime-modules/builder/page-presets.server.d.ts +0 -1
  102. package/plugins/runtime-modules/builder/page-presets.server.js +0 -24
  103. package/plugins/runtime-modules/builder/pages-workspace.js +6 -16
  104. package/plugins/runtime-modules/builder/persistence.d.ts +6 -4
  105. package/plugins/runtime-modules/builder/persistence.js +6 -7
  106. package/plugins/runtime-modules/builder/shells-workspace.js +3 -11
  107. package/plugins/runtime-modules/builder/signal-wiring-form.js +3 -7
  108. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +2 -6
  109. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -26
  110. package/plugins/runtime-modules/builder/trees/phi-default-builder-settings-page-tree.js +2 -6
  111. package/plugins/runtime-modules/builder/widgets/developer-builder-pages-header/plugin.js +2 -6
  112. package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.js +2 -6
  113. package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +3 -2
  114. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +1 -6
  115. package/plugins/runtime-modules/builder/widgets.js +10 -12
  116. package/plugins/runtime-modules/contracts.d.ts +15 -1
  117. package/plugins/runtime-modules/contracts.js +10 -0
  118. package/plugins/runtime-modules/core/messaging/forms.js +1 -1
  119. package/plugins/runtime-modules/core/widgets/description/server.js +12 -9
  120. package/plugins/runtime-modules/core/widgets/dimension/plugin.js +2 -6
  121. package/plugins/runtime-modules/core/widgets/draft-status/plugin.js +2 -6
  122. package/plugins/runtime-modules/core/widgets/entry-list/config.js +2 -9
  123. package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +1 -1
  124. package/plugins/runtime-modules/core/widgets/form-preview/client.js +2 -15
  125. package/plugins/runtime-modules/core/widgets/gallery/server.js +2 -6
  126. package/plugins/runtime-modules/core/widgets/image/server.js +2 -6
  127. package/plugins/runtime-modules/core/widgets/length/plugin.js +2 -6
  128. package/plugins/runtime-modules/core/widgets/markdown-toc/plugin.js +2 -6
  129. package/plugins/runtime-modules/core/widgets/page-title/server.js +2 -6
  130. package/plugins/runtime-modules/core/widgets/pagination/config.js +4 -8
  131. package/plugins/runtime-modules/core/widgets/search-results/config.js +2 -8
  132. package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.d.ts +2 -2
  133. package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.js +8 -13
  134. package/plugins/runtime-modules/core/widgets/theme-mode-switch/server.js +2 -6
  135. package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +16 -31
  136. package/plugins/runtime-modules/core/widgets/timeline/client.js +9 -4
  137. package/plugins/runtime-modules/core/widgets/tour-button/server.js +2 -6
  138. package/plugins/runtime-modules/core/widgets.js +59 -61
  139. package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +7 -5
  140. package/plugins/runtime-modules/dashboard/trees/phi-default-admin-dashboard-page-tree.js +2 -6
  141. package/plugins/runtime-modules/dashboard/trees/phi-default-area-dashboard-page-tree.js +2 -6
  142. package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +2 -6
  143. package/plugins/runtime-modules/descriptor-compiler.js +6 -6
  144. package/plugins/runtime-modules/groups/controller/client.d.ts +0 -56
  145. package/plugins/runtime-modules/groups/controller/client.js +1 -1
  146. package/plugins/runtime-modules/groups/forms.js +1 -5
  147. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +2 -6
  148. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -6
  149. package/plugins/runtime-modules/localization/forms.js +2 -6
  150. package/plugins/runtime-modules/localization/services/options.js +19 -9
  151. package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -11
  152. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -11
  153. package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +3 -11
  154. package/plugins/runtime-modules/revisions/forms.js +1 -1
  155. package/plugins/runtime-modules/revisions/services/table.js +6 -2
  156. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
  157. package/plugins/runtime-modules/theme/controller/server-definition.js +2 -6
  158. package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +2 -6
  159. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -21
  160. package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +0 -2
  161. package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +0 -8
  162. package/plugins/runtime-modules/theme/widgets.js +6 -8
  163. package/plugins/runtime-modules/threads/controller/client.d.ts +0 -78
  164. package/plugins/runtime-modules/threads/controller/client.js +1 -1
  165. package/plugins/runtime-modules/threads/forms.js +1 -1
  166. package/plugins/runtime-modules/threads/ids.d.ts +0 -1
  167. package/plugins/runtime-modules/threads/ids.js +0 -2
  168. package/plugins/runtime-modules/user-management/controller/client.d.ts +0 -73
  169. package/plugins/runtime-modules/user-management/controller/client.js +1 -1
  170. package/plugins/runtime-modules/user-management/forms.js +1 -5
  171. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +2 -6
  172. package/plugins/runtime-modules/video/widgets.js +2 -4
  173. package/server-helpers/cms-request.d.ts +19 -0
  174. package/server-helpers/cms-request.js +26 -8
  175. package/server-helpers/cms-root.js +6 -8
  176. package/server-helpers/public-login-route.js +6 -8
  177. package/server-helpers/runtime.js +1 -0
  178. package/server-helpers/search-index.js +34 -14
  179. package/types/length.js +8 -3
  180. package/types/site-config.d.ts +6 -0
  181. package/types/widget-runtime.d.ts +2 -0
  182. package/types.d.ts +5 -3
  183. package/types.js +3 -0
@@ -338,27 +338,3 @@ function readPageIndexFlag(flags) {
338
338
  export const buildPhiBuilderPageMetaForScope = cache(async function buildPhiBuilderPageMetaForScope(runtime, area, pageKey, runtimeModuleCatalog) {
339
339
  return buildPageMetaForScope(runtime, area, pageKey, runtimeModuleCatalog);
340
340
  });
341
- export const buildPhiBuilderPagePresetDrafts = cache(async function buildPhiBuilderPagePresetDrafts(runtime, area, pageKey, runtimeModuleCatalog) {
342
- const presetResolution = await resolvePhiRegistryPresetPageBinding({
343
- runtime,
344
- runtimeModuleCatalog,
345
- area,
346
- pageKey,
347
- });
348
- const presetTree = presetResolution
349
- ? await buildPhiRegistryPresetPageTree({
350
- runtime,
351
- runtimeModuleCatalog,
352
- binding: presetResolution.binding,
353
- activeModuleKeys: presetResolution.activeModuleKeys,
354
- path: resolvePresetFetchPath(area, presetResolution.binding.descriptor.path),
355
- })
356
- : null;
357
- return {
358
- area,
359
- pageKey,
360
- drafts: presetTree
361
- ? await buildPhiProjectedBuilderRegionDrafts(runtime, presetTree, area, pageKey, PHI_BUILDER_PAGE_REGION_KEYS)
362
- : {},
363
- };
364
- });
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PHI_BUILDER_PREVIEW_SEARCH_PARAM } from "./preview-transport";
3
3
  import { loadPhiBuilderPreviewSnapshot } from "./preview-store";
4
- import { buildPhiBuilderPagesDraftsByScope, buildPhiBuilderPagePresetDrafts, buildPhiBuilderPageMetaForScope, resolvePhiBuilderCurrentPageScope, } from "./page-presets.server";
4
+ import { buildPhiBuilderPagesDraftsByScope, buildPhiBuilderPageMetaForScope, resolvePhiBuilderCurrentPageScope, } from "./page-presets.server";
5
5
  import { buildPhiBuilderPreviewRenderableTrees, buildPhiBuilderServerPreviewRegions, } from "./render-root-node-preview.server";
6
6
  import { PhiDeveloperBuilderPagesWorkspaceWidgetClient } from "./clients/pages-workspace";
7
7
  import { buildPhiBuilderRuntimeModuleIdsForArea } from "./area-shell-presets.server";
@@ -14,7 +14,7 @@ import { PhiBuilderRuntimeModuleAuthoringBoundary } from "./clients/runtime-modu
14
14
  import { PHI_BUILDER_RUNTIME_MODULES_SEARCH_PARAM, normalizePhiBuilderRuntimeModuleIdsSearchParam, } from "../../../helpers/cms-scope-search-params";
15
15
  import { getPhiBuilderChromeWidgetLabels } from "../../../components/widgets/label-sets/builder-chrome";
16
16
  import { getPhiRegionWidgetLabels } from "../../../components/widgets/label-sets/region";
17
- import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
17
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../components/widgets/label-sets/runtime-options";
18
18
  export async function PhiDeveloperBuilderPagesWorkspaceWidget({ runtime, registry, }) {
19
19
  const snapshot = loadPhiBuilderPreviewSnapshot(runtime.request?.searchParams?.[PHI_BUILDER_PREVIEW_SEARCH_PARAM]);
20
20
  const pageDraftsByScopePromise = buildPhiBuilderPagesDraftsByScope(runtime, registry.runtimeModuleCatalog);
@@ -22,22 +22,12 @@ export async function PhiDeveloperBuilderPagesWorkspaceWidget({ runtime, registr
22
22
  const previewArea = (snapshot?.area ?? currentScope.area);
23
23
  const previewPageKey = snapshot?.pageKey ?? currentScope.pageKey;
24
24
  const pageMetaPromise = buildPhiBuilderPageMetaForScope(runtime, previewArea, previewPageKey, registry.runtimeModuleCatalog);
25
- const pagePresetDraftsPromise = buildPhiBuilderPagePresetDrafts(runtime, previewArea, previewPageKey, registry.runtimeModuleCatalog);
26
25
  const moduleIdsPromise = buildPhiBuilderRuntimeModuleIdsForArea(runtime, previewArea, registry.runtimeModuleCatalog);
27
- const labelsPromise = getPhiBuilderChromeWidgetLabels({
28
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
29
- internalToken: readPhiServerApiCredentials().internalToken,
30
- locale: runtime.locale.current,
31
- });
32
- const regionLabelsPromise = getPhiRegionWidgetLabels({
33
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
34
- internalToken: readPhiServerApiCredentials().internalToken,
35
- locale: runtime.locale.current,
36
- });
37
- const [pageDraftsByScope, pageMeta, pagePresetDrafts, moduleIds, chromeLabels, regionLabels] = await Promise.all([
26
+ const labelsPromise = getPhiBuilderChromeWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
27
+ const regionLabelsPromise = getPhiRegionWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
28
+ const [pageDraftsByScope, pageMeta, moduleIds, chromeLabels, regionLabels] = await Promise.all([
38
29
  pageDraftsByScopePromise,
39
30
  pageMetaPromise,
40
- pagePresetDraftsPromise,
41
31
  moduleIdsPromise,
42
32
  labelsPromise,
43
33
  regionLabelsPromise,
@@ -69,7 +59,7 @@ export async function PhiDeveloperBuilderPagesWorkspaceWidget({ runtime, registr
69
59
  description: pageMeta.description ?? runtime.page?.description ?? null,
70
60
  },
71
61
  };
72
- return (_jsx(PhiBuilderRuntimeModuleAuthoringBoundary, { targetArea: previewArea, catalog: authoringCatalog, pickerDataProviderKeys: resolvePhiBuilderAuthoringPickerDataProviderKeysFromCatalog(registry.runtimeModuleCatalog), children: _jsx(PhiBuilderWorkspaceScopeBoundary, { kind: "pages", targetArea: previewArea, targetPageKey: previewPageKey, children: _jsx(PhiDeveloperBuilderPagesWorkspaceWidgetClient, { pageDraftsByScope: pageDraftsByScope, pagePresetDrafts: pagePresetDrafts.drafts, pageMeta: pageMeta, pageMetaArea: previewArea, pageMetaPageKey: previewPageKey, serverPreviewRegions: buildPhiBuilderServerPreviewRegions({
62
+ return (_jsx(PhiBuilderRuntimeModuleAuthoringBoundary, { targetArea: previewArea, catalog: authoringCatalog, pickerDataProviderKeys: resolvePhiBuilderAuthoringPickerDataProviderKeysFromCatalog(registry.runtimeModuleCatalog), children: _jsx(PhiBuilderWorkspaceScopeBoundary, { kind: "pages", targetArea: previewArea, targetPageKey: previewPageKey, children: _jsx(PhiDeveloperBuilderPagesWorkspaceWidgetClient, { pageDraftsByScope: pageDraftsByScope, pageMeta: pageMeta, pageMetaArea: previewArea, pageMetaPageKey: previewPageKey, serverPreviewRegions: buildPhiBuilderServerPreviewRegions({
73
63
  snapshot,
74
64
  runtime: previewRuntime,
75
65
  registry: sandbox.registry,
@@ -34,7 +34,7 @@ export declare class PhiBuilderPageExistsError extends Error {
34
34
  */
35
35
  export type PhiBuilderContentBindingSource = "derive" | "carry";
36
36
  export declare function serializePhiBuilderRootDraft(draft: PhiDeveloperBuilderRegionDraft, widgetMetasByType: ReadonlyMap<string, PhiBuilderWidgetMeta>, bindings?: PhiBuilderContentBindingSource): SerializedRoot;
37
- export declare function buildPhiBuilderLiveHref(area: PhiDeveloperBuilderArea, pageKey: string, pages: readonly PhiPresetPageNode[], workspaceKind: PhiDeveloperBuilderWorkspaceKind): string;
37
+ export declare function buildPhiBuilderLiveHref(area: PhiDeveloperBuilderArea, pageKey: string, pages: readonly PhiPresetPageNode[], workspaceKind: PhiDeveloperBuilderWorkspaceKind, revisionId?: number): string;
38
38
  export declare function clearPhiDeveloperBuilderDraftAllocation(input: {
39
39
  area: PhiDeveloperBuilderArea;
40
40
  pageKey: string;
@@ -97,12 +97,14 @@ export declare function publishPhiDeveloperBuilderModulesDraft(state: Pick<PhiDe
97
97
  scope: {
98
98
  area: PhiDeveloperBuilderArea;
99
99
  };
100
+ /** As on save: without it an Area with no stored revision met the 409 fallback with nothing to write. */
101
+ shellPresetDrafts?: Record<string, PhiDeveloperBuilderRegionDraft> | null;
100
102
  }): Promise<{
101
103
  revisionId: number;
102
104
  version: number;
103
105
  nextNodeSequence: number;
104
106
  }>;
105
- export declare function savePhiDeveloperBuilderDraft(state: Pick<PhiDeveloperBuilderWorkspaceState, "area" | "pageKey" | "sidebarKey" | "pageMetaDrafts" | "deletedPageDrafts" | "draftAllocations" | "modulePresetPagesByArea" | "customPages" | "persistedPageCatalogByArea" | "areaPresetSourcesByArea" | "areaRootRouteDrafts" | "areaRootRoutes" | "areaMetaDrafts" | "areaMeta" | "areaControllerSettings" | "pageControllerSettings">, regionDrafts: Record<string, PhiDeveloperBuilderRegionDraft>, workspaceKind: PhiDeveloperBuilderWorkspaceKind, options: {
107
+ export declare function savePhiDeveloperBuilderDraft(state: Pick<PhiDeveloperBuilderWorkspaceState, "area" | "pageKey" | "pageMetaDrafts" | "deletedPageDrafts" | "draftAllocations" | "modulePresetPagesByArea" | "customPages" | "persistedPageCatalogByArea" | "areaPresetSourcesByArea" | "areaRootRouteDrafts" | "areaRootRoutes" | "areaMetaDrafts" | "areaMeta" | "areaControllerSettings" | "pageControllerSettings">, regionDrafts: Record<string, PhiDeveloperBuilderRegionDraft>, workspaceKind: PhiDeveloperBuilderWorkspaceKind, options: {
106
108
  builderPlugins: readonly PhiBuilderPluginMeta[];
107
109
  pathname?: string | null;
108
110
  scope?: {
@@ -135,7 +137,7 @@ export declare function createPhiDeveloperBuilderPageDraft(input: {
135
137
  nextNodeSequence: number;
136
138
  previewHref: string | null;
137
139
  }>;
138
- export declare function previewPhiDeveloperBuilderDraft(state: Pick<PhiDeveloperBuilderWorkspaceState, "area" | "pageKey" | "sidebarKey" | "modulePresetPagesByArea" | "customPages" | "persistedPageCatalogByArea" | "areaPresetSourcesByArea">, workspaceKind: PhiDeveloperBuilderWorkspaceKind, options?: {
140
+ export declare function previewPhiDeveloperBuilderDraft(state: Pick<PhiDeveloperBuilderWorkspaceState, "area" | "pageKey" | "modulePresetPagesByArea" | "customPages" | "persistedPageCatalogByArea" | "areaPresetSourcesByArea">, workspaceKind: PhiDeveloperBuilderWorkspaceKind, options?: {
139
141
  pathname?: string | null;
140
142
  scope?: {
141
143
  area: PhiDeveloperBuilderArea;
@@ -148,7 +150,7 @@ export declare function previewPhiDeveloperBuilderDraft(state: Pick<PhiDeveloper
148
150
  revisionId: number;
149
151
  previewHref: string;
150
152
  }>;
151
- export declare function publishPhiDeveloperBuilderDraft(state: Pick<PhiDeveloperBuilderWorkspaceState, "area" | "pageKey" | "sidebarKey" | "pageMetaDrafts" | "deletedPageDrafts" | "draftAllocations" | "runtimeModuleDefinitions" | "runtimeModuleIdsByArea" | "modulePresetPagesByArea" | "customPages" | "persistedPageCatalogByArea" | "areaPresetSourcesByArea" | "areaRootRouteDrafts" | "areaRootRoutes" | "areaMetaDrafts" | "areaMeta" | "areaControllerSettings" | "pageControllerSettings">, regionDrafts: Record<string, PhiDeveloperBuilderRegionDraft>, workspaceKind: PhiDeveloperBuilderWorkspaceKind, options: {
153
+ export declare function publishPhiDeveloperBuilderDraft(state: Pick<PhiDeveloperBuilderWorkspaceState, "area" | "pageKey" | "pageMetaDrafts" | "deletedPageDrafts" | "draftAllocations" | "runtimeModuleDefinitions" | "runtimeModuleIdsByArea" | "modulePresetPagesByArea" | "customPages" | "persistedPageCatalogByArea" | "areaPresetSourcesByArea" | "areaRootRouteDrafts" | "areaRootRoutes" | "areaMetaDrafts" | "areaMeta" | "areaControllerSettings" | "pageControllerSettings">, regionDrafts: Record<string, PhiDeveloperBuilderRegionDraft>, workspaceKind: PhiDeveloperBuilderWorkspaceKind, options: {
152
154
  builderPlugins: readonly PhiBuilderPluginMeta[];
153
155
  pathname?: string | null;
154
156
  scope?: {
@@ -275,19 +275,18 @@ async function getCmsDraft(path, payload) {
275
275
  function buildPhiBuilderPreviewPath(area, storagePath) {
276
276
  return area === "public" ? storagePath || "/" : phiAreaPath(area, storagePath);
277
277
  }
278
+ /** Where the live Page is, with the revision to preview when one is named. */
278
279
  function buildPhiBuilderLivePreviewHref(area, pageKey, pages, workspaceKind, revisionId) {
279
- void workspaceKind;
280
- const storagePath = resolvePhiBuilderCmsStoragePath(area, pageKey, pages);
281
- const href = buildPhiBuilderPreviewPath(area, storagePath);
282
- const url = new URL(href, typeof window !== "undefined" ? window.location.origin : "http://localhost");
283
- url.searchParams.set("revision", String(revisionId));
284
- return `${url.pathname}${url.search}${url.hash}`;
280
+ return buildPhiBuilderLiveHref(area, pageKey, pages, workspaceKind, revisionId);
285
281
  }
286
- export function buildPhiBuilderLiveHref(area, pageKey, pages, workspaceKind) {
282
+ export function buildPhiBuilderLiveHref(area, pageKey, pages, workspaceKind, revisionId) {
287
283
  void workspaceKind;
288
284
  const storagePath = resolvePhiBuilderCmsStoragePath(area, pageKey, pages);
289
285
  const href = buildPhiBuilderPreviewPath(area, storagePath);
290
286
  const url = new URL(href, typeof window !== "undefined" ? window.location.origin : "http://localhost");
287
+ if (revisionId != null) {
288
+ url.searchParams.set("revision", String(revisionId));
289
+ }
291
290
  return `${url.pathname}${url.search}${url.hash}`;
292
291
  }
293
292
  function storePhiDeveloperBuilderDraftAllocation(allocationKey, saved) {
@@ -14,7 +14,7 @@ import { PhiBuilderRuntimeModuleAuthoringBoundary } from "./clients/runtime-modu
14
14
  import { PHI_BUILDER_RUNTIME_MODULES_SEARCH_PARAM, normalizePhiBuilderRuntimeModuleIdsSearchParam, } from "../../../helpers/cms-scope-search-params";
15
15
  import { getPhiBuilderChromeWidgetLabels } from "../../../components/widgets/label-sets/builder-chrome";
16
16
  import { getPhiRegionWidgetLabels } from "../../../components/widgets/label-sets/region";
17
- import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
17
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../components/widgets/label-sets/runtime-options";
18
18
  export async function PhiDeveloperBuilderShellsWorkspaceWidget({ runtime, registry, disabled = false, }) {
19
19
  const snapshot = loadPhiBuilderPreviewSnapshot(runtime.request?.searchParams?.[PHI_BUILDER_PREVIEW_SEARCH_PARAM]);
20
20
  const snapshotArea = snapshot?.area ?? null;
@@ -27,16 +27,8 @@ export async function PhiDeveloperBuilderShellsWorkspaceWidget({ runtime, regist
27
27
  const [structureShellDrafts, moduleIds, chromeLabels, regionLabels] = await Promise.all([
28
28
  buildPhiBuilderStructureShellDraftsForArea(runtime, targetArea, registry.runtimeModuleCatalog),
29
29
  buildPhiBuilderRuntimeModuleIdsForArea(runtime, targetArea, registry.runtimeModuleCatalog),
30
- getPhiBuilderChromeWidgetLabels({
31
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
32
- internalToken: readPhiServerApiCredentials().internalToken,
33
- locale: runtime.locale.current,
34
- }),
35
- getPhiRegionWidgetLabels({
36
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
37
- internalToken: readPhiServerApiCredentials().internalToken,
38
- locale: runtime.locale.current,
39
- }),
30
+ getPhiBuilderChromeWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
31
+ getPhiRegionWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
40
32
  ]);
41
33
  const requestedModuleIds = normalizePhiBuilderRuntimeModuleIdsSearchParam(runtime.request?.searchParams?.[PHI_BUILDER_RUNTIME_MODULES_SEARCH_PARAM]);
42
34
  const sandbox = await resolvePhiBuilderCanvasRuntimeModuleSandbox({
@@ -5,10 +5,10 @@ import { PHI_BUILDER_RUNTIME_MODULE_ID } from "../../../plugins/runtime-modules/
5
5
  import { PHI_BUILDER_RUNTIME_DATA_PROVIDER_KEYS } from "./ids";
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
- import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
8
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../components/widgets/label-sets/runtime-options";
9
+ import { phiFormLabel as label } from "../../../components/forms/form-descriptor-text";
9
10
  export const PHI_BUILDER_SIGNAL_WIRING_FORM_ID = createPhiFormId(PHI_SHARED_PACKAGE_NAME, "builder/signal-wiring");
10
11
  const PHI_BUILDER_SIGNAL_WIRING_FORM_LABEL_SET_KEY = "@phis/ui/modules/builder/labels/signal-wiring";
11
- const label = (key, fallback) => ({ kind: "label", key, fallback });
12
12
  /**
13
13
  * The Signal wiring Form.
14
14
  *
@@ -82,11 +82,7 @@ const descriptor = {
82
82
  */
83
83
  const loadPhiBuilderSignalWiringFormLabels = async ({ runtime }) => {
84
84
  const { getPhiSignalsWidgetLabels } = await import("../../../components/widgets/label-sets/signals");
85
- const labels = await getPhiSignalsWidgetLabels({
86
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
87
- internalToken: readPhiServerApiCredentials().internalToken,
88
- locale: runtime.locale.current,
89
- });
85
+ const labels = await getPhiSignalsWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
90
86
  return {
91
87
  "fields.senderAddress.label": labels.routes.senderEndpoint,
92
88
  "fields.senderCapabilityId.label": labels.routes.senderOutput,
@@ -14,8 +14,8 @@ import { PHI_BUILDER_SIGNAL_WIRING_FORM_ID } from "../signal-wiring-form";
14
14
  import { getPhiEffectsWidgetLabels } from "../../../../components/widgets/label-sets/effects";
15
15
  import { getPhiInspectorWidgetLabels } from "../../../../components/widgets/label-sets/inspector";
16
16
  import { getPhiSignalsWidgetLabels } from "../../../../components/widgets/label-sets/signals";
17
- import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
18
17
  import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../../helpers/cms-dialog";
18
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
19
19
  const PHI_BUILDER_INSPECTOR_SECTIONS = {
20
20
  region: [
21
21
  [PHI_BUILDER_INSPECTOR_SECTION_WIDGET_IDS.regionGeometry, "builder-region-geometry-inspector", "geometry"],
@@ -58,11 +58,7 @@ function resolveBuilderInspectorSectionTitle(labels, sectionKey) {
58
58
  * snapshot alike -- for as long as the Builder Module is active in the Builder Area.
59
59
  */
60
60
  export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }) {
61
- const labelOptions = {
62
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
63
- internalToken: readPhiServerApiCredentials().internalToken,
64
- locale: runtime.locale.current,
65
- };
61
+ const labelOptions = buildPhiWidgetLabelTranslatorOptions(runtime);
66
62
  const [inspectorLabels, signalsLabels, effectsLabels] = await Promise.all([
67
63
  getPhiInspectorWidgetLabels(labelOptions),
68
64
  getPhiSignalsWidgetLabels(labelOptions),
@@ -27,8 +27,8 @@ import { PHI_BUILDER_AREA_SETTINGS_LAYOUT_IDS, PHI_BUILDER_AREA_SETTINGS_OVERLAY
27
27
  import { PHI_BUILDER_PAGE_META_FORM_ID } from "../page-meta-form";
28
28
  import { PHI_BUILDER_AREA_SETTINGS_FORM_ID } from "../area-settings-form";
29
29
  import { getPhiBuilderNavigationPageLabels } from "./builder-navigation-label-set";
30
- import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
31
30
  import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../../helpers/cms-dialog";
31
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
32
32
  const SYNTHETIC_DEV_REGION_IDS = {
33
33
  regionHeaderTop: -509,
34
34
  regionHeaderMain: -510,
@@ -326,11 +326,7 @@ function remapBuilderPresetTreeInstanceIds(tree, ownerModuleId, presetKey) {
326
326
  }
327
327
  export async function buildPhiDefaultBuilderAreaPresetTree({ page, runtime, }) {
328
328
  const nodes = createPhiCmsPresetNodes(page);
329
- const labelOptions = {
330
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
331
- internalToken: readPhiServerApiCredentials().internalToken,
332
- locale: runtime.locale.current,
333
- };
329
+ const labelOptions = buildPhiWidgetLabelTranslatorOptions(runtime);
334
330
  const labels = await getPhiBuilderChromeWidgetLabels(labelOptions);
335
331
  const builderPageTitleSource = resolveBuilderPageTitleSource("dashboard");
336
332
  const builderPageTitle = resolveBuilderPageTitle(labels, "dashboard", builderPageTitleSource);
@@ -637,11 +633,7 @@ export async function buildPhiDefaultBuilderAreaPresetTree({ page, runtime, }) {
637
633
  }
638
634
  async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, presetKey, }) {
639
635
  const nodes = createPhiCmsPresetNodes(page);
640
- const labels = await getPhiBuilderChromeWidgetLabels({
641
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
642
- internalToken: readPhiServerApiCredentials().internalToken,
643
- locale: runtime.locale.current,
644
- });
636
+ const labels = await getPhiBuilderChromeWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
645
637
  /*
646
638
  * Which workspace this is, asked of the preset rather than of the path.
647
639
  *
@@ -660,18 +652,10 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
660
652
  * the Region titles above it were translated. `structure.surface.siderFullHeight` is that caption, and
661
653
  * a second key holding the same words would have been the same sentence translated twice.
662
654
  */
663
- const structureLabels = isStructurePage ? await getPhiRegionWidgetLabels({
664
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
665
- internalToken: readPhiServerApiCredentials().internalToken,
666
- locale: runtime.locale.current,
667
- }) : null;
655
+ const structureLabels = isStructurePage ? await getPhiRegionWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)) : null;
668
656
  const siderFullHeightLabel = structureLabels?.structure.surface.siderFullHeight
669
657
  ?? PHI_REGION_WIDGET_DEFAULT_LABELS.structure.surface.siderFullHeight;
670
- const modulesLabels = isModulesPage ? await getPhiBuilderModulesPageLabels({
671
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
672
- internalToken: readPhiServerApiCredentials().internalToken,
673
- locale: runtime.locale.current,
674
- }) : null;
658
+ const modulesLabels = isModulesPage ? await getPhiBuilderModulesPageLabels(buildPhiWidgetLabelTranslatorOptions(runtime)) : null;
675
659
  const modulesDetailLabels = modulesLabels ? {
676
660
  moduleId: modulesLabels.detail.moduleId,
677
661
  title: modulesLabels.columns.title,
@@ -683,11 +667,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
683
667
  yes: modulesLabels.detail.yes,
684
668
  no: modulesLabels.detail.no,
685
669
  } : null;
686
- const navigationLabels = isNavigationPage ? await getPhiBuilderNavigationPageLabels({
687
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
688
- internalToken: readPhiServerApiCredentials().internalToken,
689
- locale: runtime.locale.current,
690
- }) : null;
670
+ const navigationLabels = isNavigationPage ? await getPhiBuilderNavigationPageLabels(buildPhiWidgetLabelTranslatorOptions(runtime)) : null;
691
671
  const builderCommandToolbarConfig = buildBuilderCommandToolbarConfig({
692
672
  /*
693
673
  * Held shut on the Modules page while what it means there is decided.
@@ -1,7 +1,7 @@
1
1
  import { PHI_BUILDER_RUNTIME_MODULE_ID } from "../ids";
2
2
  import { getPhiBuilderSettingsPageLabels } from "./builder-settings-label-set";
3
3
  import { buildPhiSettingsPageShellTree } from "../../../../components/regions/presets/phi-settings-page-shell-tree";
4
- import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
4
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
5
5
  const SYNTHETIC_BUILDER_SETTINGS_REGION_IDS = {
6
6
  regionContent: -583,
7
7
  };
@@ -13,11 +13,7 @@ const PHI_BUILDER_SETTINGS_AREA = "builder";
13
13
  * pages through the `settings` mount and are unaffected by this page's content.
14
14
  */
15
15
  export async function buildPhiDefaultBuilderSettingsPageTree({ page, runtime, }) {
16
- const labels = await getPhiBuilderSettingsPageLabels({
17
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
18
- internalToken: readPhiServerApiCredentials().internalToken,
19
- locale: runtime.locale.current,
20
- });
16
+ const labels = await getPhiBuilderSettingsPageLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
21
17
  const tree = buildPhiSettingsPageShellTree({
22
18
  page,
23
19
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
@@ -2,13 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PhiDeveloperBuilderPagesHeaderWidget } from "../../../../../plugins/runtime-modules/builder/pages-header";
3
3
  import { PHI_DEVELOPER_BUILDER_PAGES_HEADER_WIDGET_DEFINITION, } from "../workspace-headers/config";
4
4
  import { getPhiPageTitleWidgetLabels } from "../../../../../components/widgets/label-sets/page-title";
5
- import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
5
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
6
6
  async function PhiDeveloperBuilderPagesHeaderWidgetServer({ runtime, config, disabled, }) {
7
- const labels = await getPhiPageTitleWidgetLabels({
8
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
9
- internalToken: readPhiServerApiCredentials().internalToken,
10
- locale: runtime.locale.current,
11
- });
7
+ const labels = await getPhiPageTitleWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
12
8
  return (_jsx(PhiDeveloperBuilderPagesHeaderWidget, { mode: config.mode, pageTitle: runtime.page?.title ?? null, disabled: disabled, labels: labels }));
13
9
  }
14
10
  export const PHI_DEVELOPER_BUILDER_PAGES_HEADER_WIDGET_PLUGIN = {
@@ -3,15 +3,11 @@ import { PhiBuilderInspectorTitleWidgetClient } from "../../../../../plugins/run
3
3
  import { getPhiInspectorWidgetLabels } from "../../../../../components/widgets/label-sets/inspector";
4
4
  import { getPhiRegionWidgetLabels } from "../../../../../components/widgets/label-sets/region";
5
5
  import { PHI_BUILDER_INSPECTOR_HEADER_WIDGET_DEFINITION, } from "../chrome/config";
6
- import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
6
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
7
7
  export const PHI_BUILDER_INSPECTOR_HEADER_WIDGET_PLUGIN = {
8
8
  ...PHI_BUILDER_INSPECTOR_HEADER_WIDGET_DEFINITION,
9
9
  render: async ({ runtime }) => {
10
- const options = {
11
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
12
- internalToken: readPhiServerApiCredentials().internalToken,
13
- locale: runtime.locale.current,
14
- };
10
+ const options = buildPhiWidgetLabelTranslatorOptions(runtime);
15
11
  const [inspectorLabels, regionLabels] = await Promise.all([
16
12
  getPhiInspectorWidgetLabels(options),
17
13
  getPhiRegionWidgetLabels(options),
@@ -41,6 +41,7 @@ import { PhiIcon } from "../../../../../components/shell/phi-icon";
41
41
  import { PhiSurfaceTone } from "../../../../../components/surface/phi-surface-tone";
42
42
  import { resolvePhiSurfaceToneClassName } from "../../../../../types/surface";
43
43
  import { PHI_SURFACE_TONE_GROUND, phiSurfaceTakesToneGround } from "../../../../../helpers/surface-style";
44
+ import { joinPhiClassNames } from "../../../../../helpers/class-names";
44
45
  /** The Region's root Layout placed into another tree, at the slot it is moved to. */
45
46
  function buildStructureRootLayoutNode(draft, parentLayoutNodeId, slotIndex) {
46
47
  if (!draft.rootNode) {
@@ -1199,7 +1200,7 @@ export function PhiStructureRegionScaffold({ config, serverPreview, structureDra
1199
1200
  : shouldStretchAvailableHeight
1200
1201
  ? "100%"
1201
1202
  : undefined;
1202
- return (_jsx("div", { "data-phi-region-slot": config.regionKey, [PHI_VISUAL_ANCHOR_PART_ATTRIBUTE]: config.regionKey, className: ["phi-builder-structure-region__slot", regionToneClassName].filter(Boolean).join(" "), "data-phi-builder-region-mode": "preview", "data-phi-builder-region-has-root-node": hasRootNode ? "true" : "false", "data-phi-builder-region-selected": "false", "data-phi-builder-region-picking": "false", style: {
1203
+ return (_jsx("div", { "data-phi-region-slot": config.regionKey, [PHI_VISUAL_ANCHOR_PART_ATTRIBUTE]: config.regionKey, className: joinPhiClassNames("phi-builder-structure-region__slot", regionToneClassName), "data-phi-builder-region-mode": "preview", "data-phi-builder-region-has-root-node": hasRootNode ? "true" : "false", "data-phi-builder-region-selected": "false", "data-phi-builder-region-picking": "false", style: {
1203
1204
  width: slotWidth,
1204
1205
  minWidth: slotMinWidth,
1205
1206
  maxWidth: slotMaxWidth,
@@ -1263,7 +1264,7 @@ export function PhiStructureRegionScaffold({ config, serverPreview, structureDra
1263
1264
  event.preventDefault();
1264
1265
  selectRegion();
1265
1266
  }
1266
- }, children: [isPreviewMode ? null : (_jsxs(PhiFlexControl, { vertical: true, gap: 0, style: { minWidth: 0, width: "100%" }, children: [_jsxs(PhiFlexControl, { align: "center", gap: 6, wrap: false, style: { minWidth: 0, width: "100%", whiteSpace: "nowrap" }, children: [_jsx(PhiTypographyControl, { strong: true, style: { minWidth: 0, whiteSpace: "nowrap" }, children: config.title }), _jsxs(PhiTypographyControl, { type: "secondary", style: { minWidth: 0, whiteSpace: "nowrap" }, children: ["\u00B7 ", config.regionKey] })] }), config.subtitle ? (_jsx(PhiTypographyControl, { type: "secondary", style: { display: "block", whiteSpace: "normal", overflowWrap: "anywhere" }, children: config.subtitle })) : null] })), renderRegionPicker(_jsx("div", { ref: setRootDropNodeRef, "data-phi-region-slot": config.regionKey, className: ["phi-builder-structure-region__slot", regionToneClassName].filter(Boolean).join(" "), "data-phi-builder-region-mode": "editor", "data-phi-structure-drop-state": rootDropAccepted
1267
+ }, children: [isPreviewMode ? null : (_jsxs(PhiFlexControl, { vertical: true, gap: 0, style: { minWidth: 0, width: "100%" }, children: [_jsxs(PhiFlexControl, { align: "center", gap: 6, wrap: false, style: { minWidth: 0, width: "100%", whiteSpace: "nowrap" }, children: [_jsx(PhiTypographyControl, { strong: true, style: { minWidth: 0, whiteSpace: "nowrap" }, children: config.title }), _jsxs(PhiTypographyControl, { type: "secondary", style: { minWidth: 0, whiteSpace: "nowrap" }, children: ["\u00B7 ", config.regionKey] })] }), config.subtitle ? (_jsx(PhiTypographyControl, { type: "secondary", style: { display: "block", whiteSpace: "normal", overflowWrap: "anywhere" }, children: config.subtitle })) : null] })), renderRegionPicker(_jsx("div", { ref: setRootDropNodeRef, "data-phi-region-slot": config.regionKey, className: joinPhiClassNames("phi-builder-structure-region__slot", regionToneClassName), "data-phi-builder-region-mode": "editor", "data-phi-structure-drop-state": rootDropAccepted
1267
1268
  ? "accepted"
1268
1269
  : rootDropIsOver
1269
1270
  ? "rejected"
@@ -10,7 +10,6 @@ import { buildPhiBuilderCurrentStructureShellDrafts } from "../../area-shell-pre
10
10
  import { getPhiBuilderRegionDraftKey, isPhiBuilderPageScopedRegion, } from "../../../../../plugins/runtime-modules/builder/region-keys";
11
11
  import { PhiBuilderRegionServerPreview } from "../../render-root-node-preview.server";
12
12
  import { PHI_STRUCTURE_REGION_WIDGET_DEFINITION, } from "./config";
13
- import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
14
13
  export const PHI_STRUCTURE_REGION_WIDGET_PLUGIN = {
15
14
  ...PHI_STRUCTURE_REGION_WIDGET_DEFINITION,
16
15
  render: async ({ config, runtime, registry }) => {
@@ -27,11 +26,7 @@ export const PHI_STRUCTURE_REGION_WIDGET_PLUGIN = {
27
26
  ? await buildPhiBuilderCurrentPageDrafts(runtime, registry.runtimeModuleCatalog)
28
27
  : undefined;
29
28
  const [effectsLabels, authoringToolsLabels] = await Promise.all([
30
- getPhiEffectsWidgetLabels({
31
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
32
- internalToken: readPhiServerApiCredentials().internalToken,
33
- locale: runtime.locale.current,
34
- }),
29
+ getPhiEffectsWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
35
30
  getPhiAuthoringToolsLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
36
31
  ]);
37
32
  const fallbackStructureDraft = currentStructureDrafts.drafts[`${currentStructureDrafts.area}:${regionKey}`] ?? null;
@@ -5,67 +5,65 @@ import { PHI_BUILDER_PAGES_WORKSPACE_WIDGET_DEFINITION, PHI_BUILDER_SHELLS_WORKS
5
5
  import { PHI_HELLO_WORLD_WIDGET_DEFINITION, } from "./widgets/hello-world/config";
6
6
  import { PHI_STRUCTURE_REGION_WIDGET_DEFINITION, } from "./widgets/structure-region/config";
7
7
  import { PHI_TEST_BLOCK_WIDGET_DEFINITION, } from "./widgets/test-block/config";
8
- function defineFirstPartyWidget(options) {
9
- return options;
10
- }
8
+ import { definePhiFirstPartyWidget } from "../contracts";
11
9
  export const PHI_RUNTIME_MODULE_WIDGETS = [
12
- defineFirstPartyWidget({
10
+ definePhiFirstPartyWidget({
13
11
  definition: PHI_BUILDER_INSPECTOR_HEADER_WIDGET_DEFINITION,
14
12
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
15
13
  renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
16
14
  loadRuntime: () => import("./widgets/inspector-header/plugin").then((module) => module.PHI_BUILDER_INSPECTOR_HEADER_WIDGET_PLUGIN),
17
15
  loadPreview: () => import("./widgets/inspector-header/plugin").then((module) => module.PHI_BUILDER_INSPECTOR_HEADER_WIDGET_PLUGIN),
18
16
  }),
19
- ...PHI_BUILDER_INSPECTOR_SECTION_WIDGET_DEFINITIONS.map(({ definition, spec }) => defineFirstPartyWidget({
17
+ ...PHI_BUILDER_INSPECTOR_SECTION_WIDGET_DEFINITIONS.map(({ definition, spec }) => definePhiFirstPartyWidget({
20
18
  definition,
21
19
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
22
20
  renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
23
21
  loadRuntime: () => import("./widgets/inspector-section/plugin").then((module) => module.createPhiBuilderInspectorSectionWidgetPlugin(definition, spec)),
24
22
  loadPreview: () => import("./widgets/inspector-section/plugin").then((module) => module.createPhiBuilderInspectorSectionWidgetPlugin(definition, spec)),
25
23
  })),
26
- defineFirstPartyWidget({
24
+ definePhiFirstPartyWidget({
27
25
  definition: PHI_BUILDER_MODE_SWITCH_WIDGET_DEFINITION,
28
26
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
29
27
  renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
30
28
  loadRuntime: () => import("./widgets/mode-switch/plugin").then((module) => module.PHI_BUILDER_MODE_SWITCH_WIDGET_PLUGIN),
31
29
  loadPreview: () => import("./widgets/mode-switch/plugin").then((module) => module.PHI_BUILDER_MODE_SWITCH_WIDGET_PLUGIN),
32
30
  }),
33
- defineFirstPartyWidget({
31
+ definePhiFirstPartyWidget({
34
32
  definition: PHI_BUILDER_PAGES_WORKSPACE_WIDGET_DEFINITION,
35
33
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
36
34
  renderPolicies: { "runtime": "custom", "preview": "visualSkeleton", "authoring": "usePreview" },
37
35
  loadRuntime: () => import("./widgets/pages-workspace/plugin").then((module) => module.PHI_BUILDER_PAGES_WORKSPACE_WIDGET_PLUGIN),
38
36
  loadPreview: () => import("./widgets/pages-workspace/preview-plugin").then((module) => module.PHI_BUILDER_PAGES_WORKSPACE_WIDGET_PREVIEW_PLUGIN),
39
37
  }),
40
- defineFirstPartyWidget({
38
+ definePhiFirstPartyWidget({
41
39
  definition: PHI_BUILDER_SHELLS_WORKSPACE_WIDGET_DEFINITION,
42
40
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
43
41
  renderPolicies: { "runtime": "custom", "preview": "visualSkeleton", "authoring": "usePreview" },
44
42
  loadRuntime: () => import("./widgets/shells-workspace/plugin").then((module) => module.PHI_BUILDER_SHELLS_WORKSPACE_WIDGET_PLUGIN),
45
43
  loadPreview: () => import("./widgets/shells-workspace/preview-plugin").then((module) => module.PHI_BUILDER_SHELLS_WORKSPACE_WIDGET_PREVIEW_PLUGIN),
46
44
  }),
47
- defineFirstPartyWidget({
45
+ definePhiFirstPartyWidget({
48
46
  definition: PHI_DEVELOPER_BUILDER_PAGES_HEADER_WIDGET_DEFINITION,
49
47
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
50
48
  renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
51
49
  loadRuntime: () => import("./widgets/developer-builder-pages-header/plugin").then((module) => module.PHI_DEVELOPER_BUILDER_PAGES_HEADER_WIDGET_PLUGIN),
52
50
  loadPreview: () => import("./widgets/developer-builder-pages-header/plugin").then((module) => module.PHI_DEVELOPER_BUILDER_PAGES_HEADER_WIDGET_PLUGIN),
53
51
  }),
54
- defineFirstPartyWidget({
52
+ definePhiFirstPartyWidget({
55
53
  definition: PHI_HELLO_WORLD_WIDGET_DEFINITION,
56
54
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
57
55
  renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
58
56
  loadRuntime: () => import("./widgets/hello-world/plugin").then((module) => module.PHI_HELLO_WORLD_WIDGET_PLUGIN),
59
57
  loadPreview: () => import("./widgets/hello-world/plugin").then((module) => module.PHI_HELLO_WORLD_WIDGET_PLUGIN),
60
58
  }),
61
- defineFirstPartyWidget({
59
+ definePhiFirstPartyWidget({
62
60
  definition: PHI_STRUCTURE_REGION_WIDGET_DEFINITION,
63
61
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
64
62
  renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
65
63
  loadRuntime: () => import("./widgets/structure-region/plugin").then((module) => module.PHI_STRUCTURE_REGION_WIDGET_PLUGIN),
66
64
  loadPreview: () => import("./widgets/structure-region/plugin").then((module) => module.PHI_STRUCTURE_REGION_WIDGET_PLUGIN),
67
65
  }),
68
- defineFirstPartyWidget({
66
+ definePhiFirstPartyWidget({
69
67
  definition: PHI_TEST_BLOCK_WIDGET_DEFINITION,
70
68
  ownerModuleId: PHI_BUILDER_RUNTIME_MODULE_ID,
71
69
  renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
@@ -1,4 +1,4 @@
1
- import type { PhiRuntimeModule, PhiRuntimeModuleDefinition, PhiRuntimeModuleCatalog, PhiRuntimeModuleCatalogEntry, PhiRuntimeModuleLayoutDefinition, PhiRuntimeModuleWidgetDefinition, PhiRuntimeControllerDefinition, PhiRuntimeModuleControllerDescriptor, PhiRuntimeModuleDataProviderDescriptor } from "../../types/cms-plugins";
1
+ import type { PhiCmsPreviewWidgetPlugin, PhiCmsRuntimeWidgetPlugin, PhiCmsWidgetPluginDefinition, PhiRuntimeControllerDefinition, PhiRuntimeModule, PhiRuntimeModuleCatalog, PhiRuntimeModuleCatalogEntry, PhiRuntimeModuleControllerDescriptor, PhiRuntimeModuleDataProviderDescriptor, PhiRuntimeModuleDefinition, PhiRuntimeModuleLayoutDefinition, PhiRuntimeModuleRenderPolicies, PhiRuntimeModuleWidgetDefinition } from "../../types/cms-plugins";
2
2
  import type { PhiCmsAreaDefinition } from "../../types/cms-module-descriptors";
3
3
  export type { PhiCmsPreviewWidgetPlugin, PhiCmsRuntimeWidgetPlugin, PhiAuthoringRenderPolicy, PhiPreviewRenderPolicy, PhiResolvedRuntimeModuleSet, PhiResolvedRuntimeRenderRegistry, PhiRuntimeModule, PhiRuntimeModuleCatalog, PhiRuntimeModuleCatalogEntry, PhiRuntimeModuleControllerMountPolicy, PhiRuntimeModuleAuthoringClientProps, PhiRuntimeModuleControllerClientProps, PhiRuntimeModuleControllerDescriptor, PhiRuntimeModuleDefinition, PhiRuntimeModuleId, PhiRuntimeModuleLoader, PhiRuntimeModuleDataProviderClientDefinition, PhiRuntimeModuleDataProviderDescriptor, PhiRuntimeModuleDataProviderClientProps, PhiRuntimeModuleFormDefinition, PhiRuntimeModuleLayoutDefinition, PhiRuntimeModuleRenderPolicies, PhiRuntimeModuleWidgetDefinition, PhiRuntimeModuleUiProvider, PhiRuntimeRenderPolicy, } from "../../types/cms-plugins";
4
4
  export type { PhiCmsAreaShellPresetDescriptor, PhiCmsRoutePresetDescriptor, PhiCmsThemePresetDescriptor, } from "../../types/cms-module-descriptors";
@@ -22,3 +22,17 @@ export declare function createPhiRuntimeModuleCatalog(entries: readonly PhiRunti
22
22
  export declare function assertPhiRuntimeModuleCatalog(catalog: PhiRuntimeModuleCatalog): void;
23
23
  export declare function extendPhiRuntimeModuleCatalog(...catalogs: readonly PhiRuntimeModuleCatalog[]): PhiRuntimeModuleCatalog;
24
24
  export declare function assertPhiRuntimeModule(module: PhiRuntimeModule): void;
25
+ /**
26
+ * A Widget a first-party Module contributes, typed by its config.
27
+ *
28
+ * The options are the definition the Builder reads and the two loaders the render and the preview
29
+ * call; the cast is what `PhiRuntimeModuleWidgetDefinition` asks for, since it erases the config type.
30
+ * Seven Modules each wrote this ten-line function for themselves.
31
+ */
32
+ export declare function definePhiFirstPartyWidget<TConfig>(options: {
33
+ definition: PhiCmsWidgetPluginDefinition<TConfig>;
34
+ ownerModuleId: `${string}/${string}`;
35
+ renderPolicies: PhiRuntimeModuleRenderPolicies;
36
+ loadRuntime: () => Promise<PhiCmsRuntimeWidgetPlugin<TConfig>>;
37
+ loadPreview: () => Promise<PhiCmsPreviewWidgetPlugin<TConfig>>;
38
+ }): PhiRuntimeModuleWidgetDefinition;
@@ -857,3 +857,13 @@ export function assertPhiRuntimeModule(module) {
857
857
  }
858
858
  }
859
859
  }
860
+ /**
861
+ * A Widget a first-party Module contributes, typed by its config.
862
+ *
863
+ * The options are the definition the Builder reads and the two loaders the render and the preview
864
+ * call; the cast is what `PhiRuntimeModuleWidgetDefinition` asks for, since it erases the config type.
865
+ * Seven Modules each wrote this ten-line function for themselves.
866
+ */
867
+ export function definePhiFirstPartyWidget(options) {
868
+ return options;
869
+ }
@@ -6,6 +6,7 @@ import { PHI_SHARED_FORM_IDS } from "../../../../components/forms/shared-form-id
6
6
  import { PHI_CMS_AREA_KEYS } from "../../../../constants/cms-areas";
7
7
  import { PhisThreadMessageFlag } from "../../../../constants/threads";
8
8
  import { PHI_CORE_RUNTIME_MODULE_ID } from "../ids";
9
+ import { phiFormLabel as label } from "../../../../components/forms/form-descriptor-text";
9
10
  /*
10
11
  * Answering a conversation, as Core's Form, for every Module that runs conversations.
11
12
  *
@@ -21,7 +22,6 @@ import { PHI_CORE_RUNTIME_MODULE_ID } from "../ids";
21
22
  * question makes sense, not who may answer it.
22
23
  */
23
24
  const LABEL_SET_KEY = "@phis/ui/modules/core/labels/form:thread-reply";
24
- const label = (key, fallback) => ({ kind: "label", key, fallback });
25
25
  const FULL_ROW = { start: 1, end: PHI_FORM_GRID_LAST_LINE };
26
26
  const FULL_WIDTH = { compact: FULL_ROW, medium: FULL_ROW, wide: FULL_ROW };
27
27
  const PHI_THREAD_REPLY_FORM_HANDLER_KEY = "site.threads.reply";
@@ -37,15 +37,18 @@ function resolveDescriptionToneColor(tone) {
37
37
  }
38
38
  export async function PhiDescriptionWidget({ labels, config, runtime, translate, }) {
39
39
  const locale = runtime?.locale.current;
40
- const eyebrow = await translateLabel(locale, labels.eyebrow ?? config?.eyebrow, runtime, translate, config?.textSource);
41
- const title = await translateLabel(locale, labels.title ?? config?.title, runtime, translate, config?.textSource);
42
- const description = await translateLabel(locale, labels.description ?? config?.description, runtime, translate, config?.textSource);
43
- const asideTitle = await translateLabel(locale, labels.asideTitle ?? config?.asideTitle, runtime, translate, config?.textSource);
44
- const asideEntries = await Promise.all((labels.asideItems ?? config?.asideItems ?? []).map(async (entry) => ({
45
- ...entry,
46
- text: await translateLabel(locale, entry.text, runtime, translate, config?.textSource, entry.values),
47
- })));
48
- const footer = await translateLabel(locale, labels.footer ?? config?.footer, runtime, translate, config?.textSource);
40
+ // Six translations of one Widget, asked together rather than one after another.
41
+ const [eyebrow, title, description, asideTitle, footer, asideEntries] = await Promise.all([
42
+ translateLabel(locale, labels.eyebrow ?? config?.eyebrow, runtime, translate, config?.textSource),
43
+ translateLabel(locale, labels.title ?? config?.title, runtime, translate, config?.textSource),
44
+ translateLabel(locale, labels.description ?? config?.description, runtime, translate, config?.textSource),
45
+ translateLabel(locale, labels.asideTitle ?? config?.asideTitle, runtime, translate, config?.textSource),
46
+ translateLabel(locale, labels.footer ?? config?.footer, runtime, translate, config?.textSource),
47
+ Promise.all((labels.asideItems ?? config?.asideItems ?? []).map(async (entry) => ({
48
+ ...entry,
49
+ text: await translateLabel(locale, entry.text, runtime, translate, config?.textSource, entry.values),
50
+ }))),
51
+ ]);
49
52
  const resolvedAsideItems = buildPhiBulletListTree(asideEntries.filter((entry) => Boolean(entry.text)), (entry) => entry.text);
50
53
  const stackStyle = {
51
54
  display: "grid",
@@ -3,13 +3,9 @@ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
3
3
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
4
4
  import { PHI_DIMENSION_WIDGET_DEFINITION, PHI_DIMENSION_WIDGET_PLUGIN_TYPE, } from "./config";
5
5
  import { getPhiDimensionWidgetLabels } from "../../../../../components/widgets/label-sets/dimension";
6
- import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
6
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
7
7
  async function renderDimensionWidget(config, runtime, signalsEnabled) {
8
- const labels = await getPhiDimensionWidgetLabels({
9
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
10
- internalToken: readPhiServerApiCredentials().internalToken,
11
- locale: runtime.locale.current,
12
- });
8
+ const labels = await getPhiDimensionWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
13
9
  return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Dimension, componentProps: { config, labels, signalsEnabled } }));
14
10
  }
15
11
  export const PHI_DIMENSION_WIDGET_PLUGIN = {