@phis/ui 0.4.23 → 0.5.1

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 (125) hide show
  1. package/components/controls/phi-background-control.js +1 -1
  2. package/components/controls/phi-breadcrumb-control.d.ts +2 -0
  3. package/components/controls/phi-button-control.d.ts +7 -1
  4. package/components/media/media-asset-typed-fields.d.ts +10 -0
  5. package/components/media/media-asset-typed-fields.js +19 -0
  6. package/components/media/media-settings-labels.d.ts +33 -0
  7. package/components/media/media-settings-labels.js +62 -0
  8. package/components/media/media-upload-flow.d.ts +19 -0
  9. package/components/media/media-upload-flow.js +38 -0
  10. package/components/media/phi-asset-focal-rect-widget.js +2 -2
  11. package/components/media/phi-asset-folder-control.js +1 -1
  12. package/components/media/phi-image-inspector-widget.js +1 -1
  13. package/components/media/phi-image-preview-data.js +5 -4
  14. package/components/media/phi-site-font-assets.js +2 -5
  15. package/components/media/use-authoring-asset-details.js +0 -1
  16. package/components/regions/presets/content-entry-editor-page-tree.js +1 -1
  17. package/components/regions/presets/navigation-redirect.d.ts +2 -2
  18. package/components/regions/presets/navigation-redirect.js +3 -3
  19. package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -1
  20. package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
  21. package/components/shell/phi-antd-icon.d.ts +4 -0
  22. package/components/shell/phi-antd-icon.js +8 -0
  23. package/components/shell/phi-icon.d.ts +18 -0
  24. package/components/shell/phi-icon.js +50 -3
  25. package/components/widgets/client/shared/phi-button-icons.d.ts +7 -0
  26. package/components/widgets/client/shared/phi-button-icons.js +15 -67
  27. package/components/widgets/helpers/internal-reference-resolver.server.d.ts +1 -1
  28. package/components/widgets/helpers/internal-reference-resolver.server.js +4 -0
  29. package/components/widgets/label-sets/builder-modules.js +6 -0
  30. package/components/widgets/label-types/builder-modules.d.ts +4 -0
  31. package/components/widgets/label-types/builder-modules.js +3 -0
  32. package/components/widgets/label-types/common-controls.js +12 -12
  33. package/constants/runtime-module-ownership.js +4 -0
  34. package/gateway/internal-references.d.ts +5 -0
  35. package/gateway/internal-references.js +12 -12
  36. package/gateway/site-media-settings.d.ts +2 -0
  37. package/gateway/site-media-settings.js +6 -1
  38. package/gateway/site-media-storage-reader.d.ts +19 -0
  39. package/gateway/site-media-storage-reader.js +24 -0
  40. package/helpers/cms-navigation-catalog.d.ts +2 -0
  41. package/helpers/cms-navigation-catalog.js +1 -0
  42. package/helpers/cms-page-catalog.d.ts +12 -0
  43. package/helpers/cms-page-catalog.js +5 -0
  44. package/helpers/phi-seo.d.ts +16 -2
  45. package/helpers/phi-seo.js +54 -11
  46. package/helpers/public-route-claims.d.ts +4 -0
  47. package/helpers/public-route-claims.js +1 -1
  48. package/next/seo-routes.d.ts +1 -1
  49. package/next/seo-routes.js +23 -5
  50. package/package.json +1 -1
  51. package/plugins/runtime-modules/accounting/presets.d.ts +10 -1
  52. package/plugins/runtime-modules/accounting/presets.js +25 -8
  53. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-area-preset-tree.d.ts +6 -0
  54. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-area-preset-tree.js +53 -0
  55. package/plugins/runtime-modules/area-definitions.d.ts +123 -12
  56. package/plugins/runtime-modules/area-definitions.js +28 -0
  57. package/plugins/runtime-modules/asset/client-data-providers.js +12 -0
  58. package/plugins/runtime-modules/asset/controller/runtime.js +1 -1
  59. package/plugins/runtime-modules/asset/data-providers.d.ts +27 -2
  60. package/plugins/runtime-modules/asset/data-providers.js +56 -0
  61. package/plugins/runtime-modules/asset/definition.d.ts +38 -2
  62. package/plugins/runtime-modules/asset/definition.js +2 -1
  63. package/plugins/runtime-modules/asset/ids.d.ts +4 -0
  64. package/plugins/runtime-modules/asset/ids.js +4 -0
  65. package/plugins/runtime-modules/asset/server.js +2 -1
  66. package/plugins/runtime-modules/asset/services/options.d.ts +7 -0
  67. package/plugins/runtime-modules/asset/services/options.js +38 -0
  68. package/plugins/runtime-modules/asset/services/storage-spaces-table.d.ts +3 -0
  69. package/plugins/runtime-modules/asset/services/storage-spaces-table.js +89 -0
  70. package/plugins/runtime-modules/asset/settings-forms.d.ts +17 -0
  71. package/plugins/runtime-modules/asset/settings-forms.js +117 -1
  72. package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +94 -1
  73. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +1 -1
  74. package/plugins/runtime-modules/builder/area-shell-presets.server.d.ts +8 -0
  75. package/plugins/runtime-modules/builder/area-shell-presets.server.js +13 -0
  76. package/plugins/runtime-modules/builder/controller/page-controller-helpers.js +1 -1
  77. package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -1
  78. package/plugins/runtime-modules/builder/controller/page-controller.js +30 -3
  79. package/plugins/runtime-modules/builder/controller/server-definition.d.ts +7 -1
  80. package/plugins/runtime-modules/builder/controller/server-definition.js +8 -3
  81. package/plugins/runtime-modules/builder/data-providers.js +1 -0
  82. package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +2 -0
  83. package/plugins/runtime-modules/builder/navigation-path-context.js +7 -3
  84. package/plugins/runtime-modules/builder/options-providers.js +2 -2
  85. package/plugins/runtime-modules/builder/page-address-rule.d.ts +39 -0
  86. package/plugins/runtime-modules/builder/page-address-rule.js +62 -0
  87. package/plugins/runtime-modules/builder/page-meta-form.js +10 -0
  88. package/plugins/runtime-modules/builder/public-route-collisions.js +7 -2
  89. package/plugins/runtime-modules/builder/services/page-source-tree.js +2 -1
  90. package/plugins/runtime-modules/builder/services/runtime-modules-table.js +49 -1
  91. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +2 -2
  92. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +16 -4
  93. package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +14 -2
  94. package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +35 -4
  95. package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +3 -1
  96. package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +37 -2
  97. package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
  98. package/plugins/runtime-modules/core/widgets/image/client.js +1 -1
  99. package/plugins/runtime-modules/core/widgets/image/editor.js +1 -1
  100. package/plugins/runtime-modules/core/widgets/page-title/authoring.js +3 -1
  101. package/plugins/runtime-modules/core/widgets/page-title/client.d.ts +3 -1
  102. package/plugins/runtime-modules/core/widgets/page-title/client.js +5 -1
  103. package/plugins/runtime-modules/core/widgets/page-title/config.d.ts +25 -3
  104. package/plugins/runtime-modules/core/widgets/page-title/config.js +24 -3
  105. package/plugins/runtime-modules/core/widgets/page-title/plugin.js +1 -1
  106. package/plugins/runtime-modules/core/widgets/page-title/server.d.ts +3 -1
  107. package/plugins/runtime-modules/core/widgets/page-title/server.js +4 -3
  108. package/plugins/runtime-modules/core/widgets/table/client.js +1 -1
  109. package/plugins/runtime-modules/core/widgets/table/config.js +9 -0
  110. package/plugins/runtime-modules/descriptor-compiler.js +33 -8
  111. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +1 -1
  112. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +1 -1
  113. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +1 -1
  114. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +1 -1
  115. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +2 -2
  116. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +1 -1
  117. package/server-helpers/cms-review-params.d.ts +25 -0
  118. package/server-helpers/cms-review-params.js +54 -0
  119. package/server-helpers/cms-review.d.ts +1 -25
  120. package/server-helpers/cms-review.js +2 -54
  121. package/styles/controls.css +11 -0
  122. package/types/cms-module-descriptors.d.ts +33 -3
  123. package/types/media.d.ts +6 -2
  124. package/types/table-widget.d.ts +11 -0
  125. package/types.d.ts +1 -1
@@ -9,9 +9,11 @@ import { usePhiApplicationFeedback } from "../../../../components/runtime/use-ph
9
9
  import { normalizePhiBuilderCmsCatalogPath, resolvePhiBuilderActivePageCatalog, resolvePhiBuilderPageKeyFromCatalogPath, } from "../../../../helpers/cms-page-catalog";
10
10
  import { changePhiBuilderPagePath, loadPhiBuilderPersistedPageCatalog } from "../page-catalog-client";
11
11
  import { resolvePhiBuilderCmsStoragePath } from "../../../../helpers/cms-paths";
12
+ import { resolvePhiBuilderAreaAsCmsArea } from "../../../../constants/cms-areas";
13
+ import { resolvePhiRuntimeAreaDefinition } from "../../area-definitions";
12
14
  import { collectPhiDeveloperBuilderPageKeys, collectPhiDeveloperBuilderPageStoragePaths, findPhiDeveloperBuilderPageNode, resolveUniquePhiDeveloperBuilderPagePath, } from "./page-controller-helpers";
13
15
  import { createPhiDeveloperBuilderInitialPageDrafts, createPhiDeveloperBuilderPageDraft, PhiBuilderPageExistsError, } from "../persistence";
14
- import { describePhiBuilderPageAddressConflict, findPhiBuilderSitePageAddressConflict, } from "../page-address-rule";
16
+ import { describePhiBuilderModuleAddressConflict, describePhiBuilderPageAddressConflict, findPhiBuilderModuleAddressConflict, findPhiBuilderSitePageAddressConflict, } from "../page-address-rule";
15
17
  import { PHI_BUILDER_AREA_SEARCH_PARAM, PHI_BUILDER_PAGE_SEARCH_PARAM, } from "../../../../helpers/cms-scope-search-params";
16
18
  import { PHI_BUILDER_PREVIEW_SEARCH_PARAM } from "../preview-transport";
17
19
  import { mergePhiDeveloperRegionDrafts, openPhiBuilderPage, setPhiBuilderPageMetaDraft, startPhiBuilderNewPageDrafts, getPhiDeveloperBuilderStateSnapshot, } from "../developer-workspace-store";
@@ -102,7 +104,9 @@ export function usePhiBuilderPageController({ emitCapability, effectiveArea, eff
102
104
  }
103
105
  : {
104
106
  title: pageTitle,
105
- path: currentPath,
107
+ // A pending rename is the address being edited; the one the Page still answers on is shown beside it.
108
+ path: currentNode?.pendingPath ?? currentPath,
109
+ livePath: currentNode?.pendingPath ? currentPath : "",
106
110
  pathLocked: currentNode?.pathLocked === true ? "true" : "false",
107
111
  description: currentMetaDraft.description ?? "",
108
112
  /*
@@ -143,7 +147,8 @@ export function usePhiBuilderPageController({ emitCapability, effectiveArea, eff
143
147
  if (pageMetaDialogMode === "update") {
144
148
  const currentNode = findPhiDeveloperBuilderPageNode(currentPageTree, effectivePageKey);
145
149
  const currentPath = normalizePhiBuilderCmsCatalogPath(resolvePhiBuilderCmsStoragePath(effectiveArea, effectivePageKey, currentPageTree));
146
- const pathChanged = requestedPath !== currentPath;
150
+ // Against the pending rename where there is one: saving the dialog unchanged must not ask again.
151
+ const pathChanged = requestedPath !== (currentNode?.pendingPath ?? currentPath);
147
152
  if (pathChanged && currentNode?.pathLocked) {
148
153
  showMessage({
149
154
  level: "error",
@@ -162,6 +167,18 @@ export function usePhiBuilderPageController({ emitCapability, effectiveArea, eff
162
167
  showMessage({ level: "error", content: describePhiBuilderPageAddressConflict(moveConflict) });
163
168
  return;
164
169
  }
170
+ const moveModuleConflict = pathChanged
171
+ ? findPhiBuilderModuleAddressConflict(requestedPath, {
172
+ area: effectiveArea,
173
+ activeModuleIds: state.runtimeModuleIdsByArea[effectiveArea] ?? [],
174
+ catalog: currentPageTree,
175
+ baseModuleId: resolvePhiRuntimeAreaDefinition(resolvePhiBuilderAreaAsCmsArea(effectiveArea)).baseModuleId,
176
+ })
177
+ : null;
178
+ if (moveModuleConflict) {
179
+ showMessage({ level: "error", content: describePhiBuilderModuleAddressConflict(moveModuleConflict) });
180
+ return;
181
+ }
165
182
  setPageMetaDialogSaving(true);
166
183
  try {
167
184
  const pathResult = pathChanged
@@ -237,6 +254,16 @@ export function usePhiBuilderPageController({ emitCapability, effectiveArea, eff
237
254
  showMessage({ level: "error", content: describePhiBuilderPageAddressConflict(createConflict) });
238
255
  return;
239
256
  }
257
+ const createModuleConflict = findPhiBuilderModuleAddressConflict(requestedStoragePath, {
258
+ area: effectiveArea,
259
+ activeModuleIds: state.runtimeModuleIdsByArea[effectiveArea] ?? [],
260
+ catalog: currentPageTree,
261
+ baseModuleId: resolvePhiRuntimeAreaDefinition(resolvePhiBuilderAreaAsCmsArea(effectiveArea)).baseModuleId,
262
+ });
263
+ if (createModuleConflict) {
264
+ showMessage({ level: "error", content: describePhiBuilderModuleAddressConflict(createModuleConflict) });
265
+ return;
266
+ }
240
267
  setPageMetaDialogSaving(true);
241
268
  const nextDrafts = createPhiDeveloperBuilderInitialPageDrafts({
242
269
  area: effectiveArea,
@@ -7,7 +7,13 @@ export declare const PHI_BUILDER_RUNTIME_CONTROLLER_SERVER_DEFINITION: {
7
7
  serverUnavailableModules: Partial<Record<`${string}/${string}`, import("../../../../components/workspace/catalog-state").PhiWorkspaceServerUnavailableModule>>;
8
8
  runtimeModuleIdsByArea: Record<"public" | "app" | "admin" | "builder" | "editor" | "accounting", `${string}/${string}`[]>;
9
9
  unresolvedModuleIdsByArea: Record<"public" | "app" | "admin" | "builder" | "editor" | "accounting", `${string}/${string}`[]>;
10
- publicRouteClaims: import("../../../../helpers/public-route-claims").PhiPublicRouteClaim[];
10
+ publicRouteClaims: {
11
+ live: boolean;
12
+ ownerModuleId: import("../../contracts").PhiRuntimeModuleId;
13
+ presetKey: string;
14
+ title: string;
15
+ declaredPath: string;
16
+ }[];
11
17
  publicRoutePaths: import("../../../../helpers/cms-area-config").PhiPublicRoutePathAssignment[];
12
18
  areaRootRoutesByArea: Record<string, import("../../../../helpers/cms-area-config").PhiAreaRootRoute | null>;
13
19
  areaMetaByArea: Record<string, import("../../../../helpers/cms-area-config").PhiAreaMeta | null>;
@@ -1,6 +1,6 @@
1
1
  import "server-only";
2
2
  import { PHI_BUILDER_RUNTIME_CONTROLLER_DEFINITION, } from "./definition";
3
- import { buildPhiBuilderAreaRootRoutesByArea, buildPhiBuilderAreaMetaByArea, buildPhiBuilderAreaControllerSettingsByArea, buildPhiBuilderPublicRoutePaths, buildPhiBuilderStructureRuntimeModuleIdsByArea, buildPhiBuilderUnresolvedRuntimeModuleIdsByArea, buildPhiBuilderStructureShellPresetDraftsByArea, } from "../area-shell-presets.server";
3
+ import { buildPhiBuilderAreaRootRoutesByArea, buildPhiBuilderAreaMetaByArea, buildPhiBuilderAreaControllerSettingsByArea, buildPhiBuilderPublicRoutePaths, buildPhiBuilderPublishedRuntimeModuleIdsForArea, buildPhiBuilderStructureRuntimeModuleIdsByArea, buildPhiBuilderUnresolvedRuntimeModuleIdsByArea, buildPhiBuilderStructureShellPresetDraftsByArea, } from "../area-shell-presets.server";
4
4
  import { buildPhiBuilderAreaPresetSourcesByArea, buildPhiBuilderModulePresetPagesByArea, buildPhiBuilderPublicRouteClaims, } from "../page-preset-catalog.server";
5
5
  import { buildPhiBuilderNavigationSurfacesByArea } from "../navigation-catalog.server";
6
6
  import { PHI_BUILDER_AREA_SEARCH_PARAM, PHI_BUILDER_RUNTIME_MODULES_SEARCH_PARAM, normalizePhiBuilderAreaSearchParam, normalizePhiBuilderRuntimeModuleIdsSearchParam, } from "../../../../helpers/cms-scope-search-params";
@@ -13,7 +13,7 @@ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/wid
13
13
  export const PHI_BUILDER_RUNTIME_CONTROLLER_SERVER_DEFINITION = {
14
14
  ...PHI_BUILDER_RUNTIME_CONTROLLER_DEFINITION,
15
15
  serverPreload: async ({ runtime, runtimeModuleCatalog, serverCapabilities }) => {
16
- const [shellPresetDraftsByArea, runtimeModuleIdsByArea, unresolvedModuleIdsByArea, publicRoutePaths, areaRootRoutesByArea, areaMetaByArea, areaControllerSettingsByArea, builderLabels, historyLabels,] = await Promise.all([
16
+ const [shellPresetDraftsByArea, runtimeModuleIdsByArea, unresolvedModuleIdsByArea, publicRoutePaths, areaRootRoutesByArea, areaMetaByArea, areaControllerSettingsByArea, builderLabels, historyLabels, livePublicModuleIds,] = await Promise.all([
17
17
  buildPhiBuilderStructureShellPresetDraftsByArea(runtime, runtimeModuleCatalog),
18
18
  buildPhiBuilderStructureRuntimeModuleIdsByArea(runtime, runtimeModuleCatalog),
19
19
  buildPhiBuilderUnresolvedRuntimeModuleIdsByArea(runtime, runtimeModuleCatalog),
@@ -23,6 +23,7 @@ export const PHI_BUILDER_RUNTIME_CONTROLLER_SERVER_DEFINITION = {
23
23
  buildPhiBuilderAreaControllerSettingsByArea(runtime, runtimeModuleCatalog),
24
24
  getPhiBuilderChromeWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
25
25
  getPhiHistoryLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
26
+ buildPhiBuilderPublishedRuntimeModuleIdsForArea(runtime, "public", runtimeModuleCatalog),
26
27
  ]);
27
28
  const requestedArea = normalizePhiBuilderAreaSearchParam(runtime.request?.searchParams?.[PHI_BUILDER_AREA_SEARCH_PARAM]);
28
29
  const requestedModuleIds = normalizePhiBuilderRuntimeModuleIdsSearchParam(runtime.request?.searchParams?.[PHI_BUILDER_RUNTIME_MODULES_SEARCH_PARAM]);
@@ -55,7 +56,11 @@ export const PHI_BUILDER_RUNTIME_CONTROLLER_SERVER_DEFINITION = {
55
56
  serverUnavailableModules,
56
57
  runtimeModuleIdsByArea: effectiveRuntimeModuleIdsByArea,
57
58
  unresolvedModuleIdsByArea,
58
- publicRouteClaims: buildPhiBuilderPublicRouteClaims(runtimeModuleCatalog),
59
+ // Marked live where the published Public Area runs the Module, so the collision dialog can say so.
60
+ publicRouteClaims: buildPhiBuilderPublicRouteClaims(runtimeModuleCatalog).map((claim) => ({
61
+ ...claim,
62
+ live: livePublicModuleIds.includes(claim.ownerModuleId),
63
+ })),
59
64
  publicRoutePaths,
60
65
  areaRootRoutesByArea,
61
66
  areaMetaByArea,
@@ -248,6 +248,7 @@ export const PHI_BUILDER_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
248
248
  { key: "title", title: "Page", type: "string", required: true },
249
249
  { key: "declaredPath", title: "Wanted", type: "string", required: true },
250
250
  { key: "heldBy", title: "Taken by", type: "string", required: true },
251
+ { key: "status", title: "Status", type: "string", required: true },
251
252
  { key: "path", title: "Address", type: "string", required: true, mutable: true },
252
253
  ],
253
254
  query: { sorting: "none", pagination: "none" },
@@ -87,6 +87,8 @@ export type PhiBuilderPublicRouteCollisionAnswer = {
87
87
  declaredPath: string;
88
88
  /** What holds the address today, said the way the dialog shows it. */
89
89
  heldBy: string;
90
+ /** Whether that holder answers on it in the published Site, or only in this draft. */
91
+ published: boolean;
90
92
  /** The address being proposed instead. Starts at a suggestion, and the Builder may overwrite it. */
91
93
  path: string;
92
94
  };
@@ -1,6 +1,6 @@
1
1
  import { flattenPhiPresetPages } from "./page-tree-walk";
2
2
  import { resolvePhiCmsAreaAsBuilderArea } from "../../../constants/cms-areas";
3
- import { normalizePhiBuilderCmsCatalogPath, resolvePhiBuilderActivePageCatalog, } from "../../../helpers/cms-page-catalog";
3
+ import { normalizePhiBuilderCmsCatalogPath, resolvePhiBuilderActivePageCatalog, formatPhiBuilderPagePathWithPending, } from "../../../helpers/cms-page-catalog";
4
4
  import { resolvePhiBuilderCmsStoragePath, resolvePhiBuilderNavigationTargetPath } from "../../../helpers/cms-paths";
5
5
  /**
6
6
  * The page catalog as the Navigation table needs it: each Page's shown path and address, the choices a
@@ -31,9 +31,13 @@ export function createPhiBuilderNavigationPathContext(state) {
31
31
  const { pages, pagePaths } = readArea(state.area);
32
32
  const pageOptions = flattenPhiPresetPages(pages)
33
33
  .filter((page) => page.reference && page.tombstoned !== true)
34
- .map((page) => ({ value: page.reference, label: pagePaths.get(page.reference).path }));
34
+ .map((page) => ({
35
+ value: page.reference,
36
+ label: formatPhiBuilderPagePathWithPending(pagePaths.get(page.reference).path, page.pendingPath),
37
+ }));
35
38
  const resolveLinkPath = (item) => {
36
- if (item.kind !== "link" || item.external === true)
39
+ // Neither an external address nor another Area's root is a path in this Area.
40
+ if (item.kind !== "link" || item.external === true || item.targetAreaRoot)
37
41
  return null;
38
42
  if (item.targetReference) {
39
43
  const area = item.targetArea ? resolvePhiCmsAreaAsBuilderArea(item.targetArea) : state.area;
@@ -6,7 +6,7 @@ import { isPhiCmsErrorPagePath } from "../../../constants/cms-error-pages";
6
6
  import { PHI_BUILDER_AREA_LANDING_PAGE_EMPTY, PHI_BUILDER_AREA_ROOT_ROUTE_AUTOMATIC, PHI_BUILDER_AREA_ROOT_ROUTE_LANDING, } from "./area-settings-values";
7
7
  import { readPhiControlOptionsProviderParam, createPhiControlOptionsProviderClient, } from "../../../components/controls/phi-options-provider";
8
8
  import { PHI_BUILDER_RUNTIME_DATA_PROVIDER_KEYS } from "./ids";
9
- import { findPhiBuilderCatalogPathForCatalog, normalizePhiBuilderCmsCatalogPath, resolvePhiBuilderCatalogPathForCatalog, resolvePhiBuilderCmsStoragePathForCatalog, resolvePhiBuilderActivePageCatalog, } from "../../../helpers/cms-page-catalog";
9
+ import { findPhiBuilderCatalogPathForCatalog, normalizePhiBuilderCmsCatalogPath, resolvePhiBuilderCatalogPathForCatalog, resolvePhiBuilderCmsStoragePathForCatalog, resolvePhiBuilderActivePageCatalog, formatPhiBuilderPagePathWithPending, } from "../../../helpers/cms-page-catalog";
10
10
  import { resolvePhiBuilderAreaRootApplicants, resolvePhiBuilderOfferedPageCatalog, resolvePhiBuilderOfferedPageKey, } from "./offered-page-catalog";
11
11
  import { builderWorkspaceStore, getPhiDeveloperBuilderStateSnapshot, } from "./developer-workspace-store";
12
12
  import { getPhiBuilderModuleMetasSnapshot } from "./plugin-meta-store";
@@ -172,7 +172,7 @@ function collectPageReferenceOptions(area, nodes, allNodes) {
172
172
  ? [{
173
173
  value: node.reference,
174
174
  label: node.title,
175
- description: storagePath,
175
+ description: formatPhiBuilderPagePathWithPending(storagePath, node.pendingPath),
176
176
  }]
177
177
  : []),
178
178
  ...collect(node.children ?? []),
@@ -1,4 +1,5 @@
1
1
  import { type PhiPresetPageNode } from "../../../helpers/cms-page-catalog";
2
+ import type { PhiRuntimeModuleId } from "../../../types";
2
3
  export type PhiBuilderPageAddressConflict = {
3
4
  kind: "collision" | "nested";
4
5
  /** The address of the Site Page the requested one conflicts with. */
@@ -13,3 +14,41 @@ export declare function findPhiBuilderSitePageAddressConflict(requestedPath: str
13
14
  exceptPath?: string | null;
14
15
  }): PhiBuilderPageAddressConflict | null;
15
16
  export declare function describePhiBuilderPageAddressConflict(conflict: PhiBuilderPageAddressConflict): string;
17
+ export type PhiBuilderModuleAddressConflict = {
18
+ moduleId: PhiRuntimeModuleId;
19
+ /**
20
+ * That the address is one of the Area's base Pages -- `/contact` in Public. Those are edited where they
21
+ * are, in the Builder, so a Site Page beside them is never the way to change one.
22
+ */
23
+ base: boolean;
24
+ /** The Module's address the Page would take or lie beneath: a route in Public, the package path elsewhere. */
25
+ path: string;
26
+ };
27
+ /**
28
+ * Whether a Site Page at this address would sit on a Module that is active in the Area.
29
+ *
30
+ * A Page is never put onto an address a Module answers on (PUBLIC_ADDRESSES.md section 1): in Public that
31
+ * is each active Module's route, wherever this Site addressed it; in every other Area it is the Module's
32
+ * whole package path, `/<scope>/<package>`, because there the path is the Module's identity and it has no
33
+ * other address to yield to. Nested counts like equal, for the reason a Page is never a folder. The Area
34
+ * root is nobody's: it is the landing slot, not a route.
35
+ */
36
+ export declare function findPhiBuilderModuleAddressConflict(requestedPath: string, input: {
37
+ area: string;
38
+ activeModuleIds: readonly PhiRuntimeModuleId[];
39
+ catalog: readonly PhiPresetPageNode[];
40
+ /** The Area's base Module, whose Pages are edited in place rather than replaced by a Site Page. */
41
+ baseModuleId?: PhiRuntimeModuleId | null;
42
+ }): PhiBuilderModuleAddressConflict | null;
43
+ export declare function describePhiBuilderModuleAddressConflict(conflict: PhiBuilderModuleAddressConflict): string;
44
+ /**
45
+ * The first Site Page that stands on a Module's package path, per Area, or null.
46
+ *
47
+ * Outside Public a Module answers under its package path and nowhere else, so a Site Page authored there
48
+ * before the package was installed makes activation refuse until the Site moves the Page -- the newcomer
49
+ * bears the cost, as it does in Public, and here it has no address to yield to.
50
+ */
51
+ export declare function findPhiBuilderSitePageOnModulePackagePath(moduleId: PhiRuntimeModuleId, sitePagePaths: readonly string[]): {
52
+ prefix: `/${string}`;
53
+ path: string;
54
+ } | null;
@@ -1,4 +1,5 @@
1
1
  import { normalizePhiBuilderCmsCatalogPath } from "../../../helpers/cms-page-catalog";
2
+ import { buildPhiRuntimeModulePackageRoutePrefix } from "../../../helpers/runtime-module-route-path";
2
3
  function collectSitePagePaths(nodes, paths = []) {
3
4
  for (const node of nodes) {
4
5
  // Site Pages only: a Module Page has no Site path, and folders are not Pages.
@@ -33,3 +34,64 @@ export function describePhiBuilderPageAddressConflict(conflict) {
33
34
  ? "Page path already exists."
34
35
  : `A Page is never a folder: this path and the Page at ${conflict.path} would lie one beneath the other.`;
35
36
  }
37
+ function overlaps(left, right) {
38
+ return left === right || liesBeneath(left, right) || liesBeneath(right, left);
39
+ }
40
+ /**
41
+ * Whether a Site Page at this address would sit on a Module that is active in the Area.
42
+ *
43
+ * A Page is never put onto an address a Module answers on (PUBLIC_ADDRESSES.md section 1): in Public that
44
+ * is each active Module's route, wherever this Site addressed it; in every other Area it is the Module's
45
+ * whole package path, `/<scope>/<package>`, because there the path is the Module's identity and it has no
46
+ * other address to yield to. Nested counts like equal, for the reason a Page is never a folder. The Area
47
+ * root is nobody's: it is the landing slot, not a route.
48
+ */
49
+ export function findPhiBuilderModuleAddressConflict(requestedPath, input) {
50
+ const path = normalizePhiBuilderCmsCatalogPath(requestedPath);
51
+ if (path === "/")
52
+ return null;
53
+ const active = new Set(input.activeModuleIds);
54
+ if (input.area !== "public") {
55
+ for (const moduleId of input.activeModuleIds) {
56
+ const prefix = buildPhiRuntimeModulePackageRoutePrefix(moduleId);
57
+ if (overlaps(path, prefix))
58
+ return { moduleId, path: prefix, base: moduleId === input.baseModuleId };
59
+ }
60
+ return null;
61
+ }
62
+ const visit = (nodes) => {
63
+ for (const node of nodes) {
64
+ const owner = node.sourcePreset?.ownerModuleId;
65
+ if (owner && active.has(owner) && node.storagePath) {
66
+ const routePath = normalizePhiBuilderCmsCatalogPath(node.storagePath);
67
+ if (routePath !== "/" && overlaps(path, routePath)) {
68
+ return { moduleId: owner, path: routePath, base: owner === input.baseModuleId };
69
+ }
70
+ }
71
+ const nested = visit(node.children ?? []);
72
+ if (nested)
73
+ return nested;
74
+ }
75
+ return null;
76
+ };
77
+ return visit(input.catalog);
78
+ }
79
+ export function describePhiBuilderModuleAddressConflict(conflict) {
80
+ return conflict.base
81
+ ? `${conflict.path} is one of this Area's built-in Pages. Open it in the Builder and edit it there; a second Page cannot take its address.`
82
+ : `The Module ${conflict.moduleId} answers on ${conflict.path}; a Page cannot take that address or one beneath it.`;
83
+ }
84
+ /**
85
+ * The first Site Page that stands on a Module's package path, per Area, or null.
86
+ *
87
+ * Outside Public a Module answers under its package path and nowhere else, so a Site Page authored there
88
+ * before the package was installed makes activation refuse until the Site moves the Page -- the newcomer
89
+ * bears the cost, as it does in Public, and here it has no address to yield to.
90
+ */
91
+ export function findPhiBuilderSitePageOnModulePackagePath(moduleId, sitePagePaths) {
92
+ const prefix = buildPhiRuntimeModulePackageRoutePrefix(moduleId);
93
+ const path = sitePagePaths
94
+ .map((candidate) => normalizePhiBuilderCmsCatalogPath(candidate))
95
+ .find((candidate) => candidate !== "/" && overlaps(candidate, prefix));
96
+ return path ? { prefix, path } : null;
97
+ }
@@ -479,6 +479,16 @@ const descriptor = {
479
479
  disabledWhen: { source: "form", valuePath: "pathLocked", operator: "equals", value: "true" },
480
480
  config: { maxLength: 512 },
481
481
  },
482
+ {
483
+ key: "livePath",
484
+ fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.text,
485
+ label: label("fields.livePath.label", "Live path"),
486
+ description: label("fields.livePath.description", "The Page answers here until you publish; then it moves to the path above."),
487
+ // Only while a rename is pending, and never edited: it is a fact about the published Page.
488
+ visibleWhen: { source: "form", valuePath: "livePath", operator: "truthy" },
489
+ disabledWhen: { source: "form", valuePath: "livePath", operator: "truthy" },
490
+ initialValue: "",
491
+ },
482
492
  {
483
493
  key: "pathLocked",
484
494
  fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.hidden,
@@ -16,7 +16,11 @@ function resolvePhiBuilderPersistedPublicPages(state) {
16
16
  .filter((entry) => !entry.tombstoned && typeof entry.path === "string" && entry.path.length > 0)
17
17
  // A Page that came from a Module preset is that Module's route, counted with the Modules below.
18
18
  .filter((entry) => !entry.ownerModuleId)
19
- .map((entry) => ({ path: entry.path, title: entry.path }));
19
+ .map((entry) => ({
20
+ path: entry.path,
21
+ title: entry.path,
22
+ published: entry.publishedRevisionId != null,
23
+ }));
20
24
  }
21
25
  /**
22
26
  * What answers on each Public address in the draft the Builder is editing.
@@ -79,12 +83,13 @@ export function resolvePhiBuilderPublicRouteCollisionAnswers(state, moduleId) {
79
83
  return collisions.map((collision) => {
80
84
  const path = suggestPhiPublicRoutePath(moduleId, collision.claim.declaredPath, proposed);
81
85
  // Two contested routes of one Module must not be offered the same free address.
82
- proposed.set(path, { kind: "page", title: collision.claim.title });
86
+ proposed.set(path, { kind: "page", title: collision.claim.title, published: false });
83
87
  return {
84
88
  presetKey: collision.claim.presetKey,
85
89
  title: collision.claim.title,
86
90
  declaredPath: collision.path,
87
91
  heldBy: describePhiPublicRouteAddressHolder(collision.heldBy, moduleTitles),
92
+ published: collision.heldBy.kind === "page" ? collision.heldBy.published : collision.heldBy.claim.live === true,
88
93
  path,
89
94
  };
90
95
  });
@@ -6,6 +6,7 @@ import { PHI_BUILDER_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
6
6
  import { PHI_BUILDER_RUNTIME_DATA_PROVIDER_DESCRIPTORS } from "../../../../plugins/runtime-modules/builder/data-providers";
7
7
  import { PhiTreeProviderClient } from "../../../../components/widgets/client/shared/phi-tree-provider";
8
8
  import { resolvePhiBuilderCmsFetchPath } from "../../../../helpers/cms-paths";
9
+ import { formatPhiBuilderPagePathWithPending } from "../../../../helpers/cms-page-catalog";
9
10
  import { resolvePhiBuilderOfferedPageCatalog } from "../offered-page-catalog";
10
11
  import { buildPhiBuilderNavigationFolderDragSourceKey, buildPhiBuilderNavigationPageDragSourceKey, } from "../navigation-widget-runtime";
11
12
  import { hasPhiBuilderNavigableContent, isPhiBuilderNavigablePage } from "../navigation-folder-drop";
@@ -22,7 +23,7 @@ function flattenPages(area, pages, allPages, parentId = null) {
22
23
  id: page.key,
23
24
  parentId,
24
25
  title: page.title,
25
- path: resolvePhiBuilderCmsFetchPath(area, page.key, allPages),
26
+ path: formatPhiBuilderPagePathWithPending(resolvePhiBuilderCmsFetchPath(area, page.key, allPages), page.pendingPath),
26
27
  dragIdentity: buildPhiBuilderNavigationPageDragSourceKey(area, page.reference),
27
28
  }, ...flattenPages(area, children, allPages, page.key)];
28
29
  }
@@ -10,6 +10,8 @@ import { applyPhiBuilderRuntimeModuleSelectionChanges } from "../runtime-module-
10
10
  import { answerPhiBuilderPublicRouteCollision, openPhiBuilderModuleDeactivationRequest, openPhiBuilderPublicRouteCollisionRequest, getPhiDeveloperBuilderStateSnapshot, usePhiDeveloperBuilderStateValue, } from "../developer-workspace-store";
11
11
  import { loadPhiBuilderModuleBlockUsage } from "../module-usage-client";
12
12
  import { resolvePhiBuilderPublicRouteCollisionAnswers } from "../public-route-collisions";
13
+ import { findPhiBuilderSitePageOnModulePackagePath } from "../page-address-rule";
14
+ import { loadPhiBuilderPersistedPageCatalog } from "../page-catalog-client";
13
15
  import { PhiTableProviderClient, } from "../../../../components/widgets/client/shared/phi-table-provider";
14
16
  import { queryPhiStaticTableResource, } from "../../../../components/widgets/client/shared/phi-static-table-provider";
15
17
  const RESOURCE_KEY = "modules";
@@ -339,7 +341,16 @@ export function PhiBuilderRuntimeModulesTableProviderClient({ children }) {
339
341
  if (request.resourceKey === PUBLIC_ROUTES_RESOURCE_KEY) {
340
342
  return queryPhiStaticTableResource({
341
343
  descriptor: publicRoutesResourceDescriptor,
342
- rows: (builderState.publicRouteCollisionRequest?.answers ?? []).map((answer) => ({ ...answer })),
344
+ rows: (builderState.publicRouteCollisionRequest?.answers ?? []).map((answer) => {
345
+ // Moving an address nobody has been served differs from moving one that stands in an index.
346
+ const statusLabels = readLabelMap(request.params, "statusLabels");
347
+ return {
348
+ ...answer,
349
+ status: answer.published
350
+ ? statusLabels?.live ?? "Live"
351
+ : statusLabels?.notLive ?? "Not published yet",
352
+ };
353
+ }),
343
354
  }, request);
344
355
  }
345
356
  if (request.resourceKey !== RESOURCE_KEY) {
@@ -417,6 +428,37 @@ export function PhiBuilderRuntimeModulesTableProviderClient({ children }) {
417
428
  });
418
429
  return true;
419
430
  };
431
+ /*
432
+ * A Site Page on the package path, outside Public, which the Module has no other address to yield to.
433
+ *
434
+ * Read from the Area's stored catalog, loaded where this session never opened the Area: the Pages are
435
+ * the Site's, and an Area the Builder did not visit has them all the same. The newcomer bears the
436
+ * cost, so the switch springs back with the Page named until the Site moves it.
437
+ */
438
+ const findSitePageOnPackagePath = async (cmsAreas) => {
439
+ if (!proposedActive)
440
+ return null;
441
+ for (const areaKey of cmsAreas) {
442
+ if (areaKey === "public" || !isPhiBuilderAreaKey(areaKey))
443
+ continue;
444
+ const pages = builderState.persistedPageCatalogByArea?.[areaKey]
445
+ ?? await loadPhiBuilderPersistedPageCatalog(areaKey);
446
+ const sitePagePaths = pages
447
+ .filter((entry) => !entry.tombstoned && !entry.ownerModuleId && typeof entry.path === "string")
448
+ .map((entry) => entry.path);
449
+ const held = findPhiBuilderSitePageOnModulePackagePath(definition.moduleId, sitePagePaths);
450
+ if (held)
451
+ return { areaKey, ...held };
452
+ }
453
+ return null;
454
+ };
455
+ const refusePackagePathTaken = (held) => ({
456
+ status: "rejected",
457
+ invalidation: "none",
458
+ errorCode: "package-path-taken",
459
+ message: `"${definition.title}" answers under ${held.prefix} in Area ${areaLabelFor(held.areaKey, request.params)}, `
460
+ + `where the Site Page ${held.path} stands. Move the Page first.`,
461
+ });
420
462
  /*
421
463
  * What switching this Module off would stop drawing.
422
464
  *
@@ -488,6 +530,9 @@ export function PhiBuilderRuntimeModulesTableProviderClient({ children }) {
488
530
  message: `"${definition.title}" is Area "${baseAreaKey}"'s Base module and always runs there.`,
489
531
  };
490
532
  }
533
+ const heldPackagePath = await findSitePageOnPackagePath(definition.eligibleAreas);
534
+ if (heldPackagePath)
535
+ return refusePackagePathTaken(heldPackagePath);
491
536
  if (askAboutPublicAddresses(definition.eligibleAreas)) {
492
537
  return { status: "rejected", invalidation: "none", errorCode: "public-address-taken" };
493
538
  }
@@ -533,6 +578,9 @@ export function PhiBuilderRuntimeModulesTableProviderClient({ children }) {
533
578
  message: `"${definition.title}" is not eligible for Area "${areaKey}".`,
534
579
  };
535
580
  }
581
+ const heldAreaPackagePath = await findSitePageOnPackagePath([areaKey]);
582
+ if (heldAreaPackagePath)
583
+ return refusePackagePathTaken(heldAreaPackagePath);
536
584
  if (askAboutPublicAddresses([areaKey])) {
537
585
  return { status: "rejected", invalidation: "none", errorCode: "public-address-taken" };
538
586
  }
@@ -475,7 +475,7 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
475
475
  * follows from that and is not stated -- a compact group does not wrap.
476
476
  */
477
477
  buttons: [
478
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: effectsLabels.cancel, variant: "normal", icon: "cancel" },
478
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: effectsLabels.cancel, variant: "normal", icon: "close" },
479
479
  { key: "save", emits: [{ capabilityId: "command", value: "save" }], label: effectsLabels.save, variant: "primary", icon: "save" },
480
480
  ],
481
481
  signalRoutes: {
@@ -604,7 +604,7 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
604
604
  * follows from that and is not stated -- a compact group does not wrap.
605
605
  */
606
606
  buttons: [
607
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: signalsLabels.routes.cancel, variant: "normal", icon: "cancel" },
607
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: signalsLabels.routes.cancel, variant: "normal", icon: "close" },
608
608
  /*
609
609
  * The primary action reads "Apply", not "Save": it commits one route into the draft, and the
610
610
  * Page is saved separately. It sets `icon: "save"` itself so the button keeps that mark, and the
@@ -543,7 +543,7 @@ export async function buildPhiDefaultBuilderAreaPresetTree({ page, runtime, }) {
543
543
  slotIndex: PHI_CMS_THREE_COLUMN_LAYOUT_SLOT_INDEX.Middle,
544
544
  sortOrder: 0,
545
545
  label: "Page title",
546
- config: {},
546
+ config: { display: "label" },
547
547
  }),
548
548
  nodes.widget({
549
549
  typeKey: "account",
@@ -1714,7 +1714,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1714
1714
  key: "module-usage-commands",
1715
1715
  ...PHI_DIALOG_COMMANDS_CONFIG,
1716
1716
  buttons: [
1717
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.usage.cancel ?? "Keep it on", icon: "cancel" },
1717
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.usage.cancel ?? "Keep it on", icon: "close" },
1718
1718
  { key: "confirm", emits: [{ capabilityId: "command", value: "confirm" }], variant: "primary", label: modulesLabels?.usage.confirm ?? "Switch off anyway", icon: "save" },
1719
1719
  ],
1720
1720
  signalRoutes: {
@@ -1755,7 +1755,12 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1755
1755
  source: {
1756
1756
  providerKey: PHI_BUILDER_RUNTIME_DATA_PROVIDER_KEYS.runtimeModulesTable,
1757
1757
  resourceKey: "publicRouteCollisions",
1758
- params: {},
1758
+ params: {
1759
+ statusLabels: {
1760
+ live: modulesLabels?.publicRoutes.live ?? "Live",
1761
+ notLive: modulesLabels?.publicRoutes.notLive ?? "Not published yet",
1762
+ },
1763
+ },
1759
1764
  },
1760
1765
  presentation: {
1761
1766
  borders: true,
@@ -1764,6 +1769,13 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1764
1769
  { key: "title", fieldKey: "title", title: modulesLabels?.publicRoutes.page ?? "Page" },
1765
1770
  { key: "declaredPath", fieldKey: "declaredPath", title: modulesLabels?.publicRoutes.wanted ?? "Wanted", renderer: "code", sizing: { mode: "content" } },
1766
1771
  { key: "heldBy", fieldKey: "heldBy", title: modulesLabels?.publicRoutes.heldBy ?? "Taken by" },
1772
+ {
1773
+ key: "status",
1774
+ fieldKey: "status",
1775
+ title: modulesLabels?.publicRoutes.status ?? "Status",
1776
+ renderer: "badge",
1777
+ sizing: { mode: "content" },
1778
+ },
1767
1779
  {
1768
1780
  key: "path",
1769
1781
  fieldKey: "path",
@@ -1798,7 +1810,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1798
1810
  key: "public-routes-commands",
1799
1811
  ...PHI_DIALOG_COMMANDS_CONFIG,
1800
1812
  buttons: [
1801
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.publicRoutes.cancel ?? "Cancel", icon: "cancel" },
1813
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.publicRoutes.cancel ?? "Cancel", icon: "close" },
1802
1814
  { key: "assign", emits: [{ capabilityId: "command", value: "assign" }], variant: "primary", label: modulesLabels?.publicRoutes.assign ?? "Enable", icon: "save" },
1803
1815
  ],
1804
1816
  signalRoutes: {
@@ -1,6 +1,18 @@
1
1
  import type { PhiClientBlockBaseProps, PhiBlockRuntime, PhiNoLabels } from "../../../../../types";
2
2
  import type { PhiCmsBreadcrumbWidgetConfig } from "./config";
3
+ import { type PhiBreadcrumbControlItem } from "../../../../../components/controls/phi-breadcrumb-control";
3
4
  export type { PhiCmsBreadcrumbWidgetConfig as PhiBreadcrumbWidgetConfig } from "./config";
4
5
  export type PhiBreadcrumbWidgetLabels = PhiNoLabels;
5
- export type PhiBreadcrumbWidgetProps = PhiClientBlockBaseProps<PhiBreadcrumbWidgetLabels, PhiCmsBreadcrumbWidgetConfig, Pick<PhiBlockRuntime, "site" | "area" | "locale">>;
6
- export declare function PhiBreadcrumbWidget({ config, runtime }: PhiBreadcrumbWidgetProps): import("react").JSX.Element;
6
+ export type PhiBreadcrumbWidgetProps = PhiClientBlockBaseProps<PhiBreadcrumbWidgetLabels, PhiCmsBreadcrumbWidgetConfig, Pick<PhiBlockRuntime, "site" | "area" | "locale" | "page">> & {
7
+ /** The Page's own path in its Area, which the visitor's address ends with. */
8
+ pagePath?: string | null;
9
+ /** The folders of `pagePath` whose address leads to a Page, as the server found them. */
10
+ linkedFolderPaths?: readonly string[];
11
+ };
12
+ export declare function PhiBreadcrumbWidget({ config, runtime, pagePath, linkedFolderPaths }: PhiBreadcrumbWidgetProps): import("react").JSX.Element;
13
+ /**
14
+ * One item per segment of the Page's path. A folder segment links to the visitor's own address up to that
15
+ * folder -- the locale and Area prefix kept as the visitor has them -- when the server found that its
16
+ * folder address leads to a Page; every other segment, and the Page itself, is text.
17
+ */
18
+ export declare function buildPhiBreadcrumbPathItems(visitorPathname: string, pagePath: string, linkedFolderPaths: readonly string[]): PhiBreadcrumbControlItem[];
@@ -3,12 +3,43 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { PhiBreadcrumbControl } from "../../../../../components/controls/phi-breadcrumb-control";
4
4
  import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
5
5
  import { usePhiPathname } from "../../../../../components/runtime/use-phi-pathname";
6
- export function PhiBreadcrumbWidget({ config, runtime }) {
6
+ export function PhiBreadcrumbWidget({ config, runtime, pagePath, linkedFolderPaths }) {
7
7
  const pathname = usePhiPathname();
8
- const breadcrumbItems = [
8
+ const head = [
9
9
  { title: config?.rootLabel?.trim() || runtime?.site.name?.trim() || runtime?.site.key || "Site" },
10
10
  config?.showArea === false ? null : { title: runtime?.area ?? "area" },
11
- config?.showPath === false ? null : { title: config?.pathLabel?.trim() || pathname || "/" },
12
11
  ].filter(Boolean);
13
- return (_jsx(PhiFlexControl, { align: config?.align ?? "center", justify: config?.justify ?? "flex-start", gap: 12, wrap: "wrap", children: _jsx(PhiBreadcrumbControl, { items: breadcrumbItems, separator: config?.separator }) }));
12
+ let tail = [];
13
+ if (config?.showPath !== false) {
14
+ tail = config?.pathLabel?.trim() || !pagePath || pagePath === "/"
15
+ ? [{ title: config?.pathLabel?.trim() || pathname || "/" }]
16
+ : buildPhiBreadcrumbPathItems(pathname, pagePath, linkedFolderPaths ?? []);
17
+ }
18
+ return (_jsx(PhiFlexControl, { align: config?.align ?? "center", justify: config?.justify ?? "flex-start", gap: 12, wrap: "wrap", children: _jsx(PhiBreadcrumbControl, { items: [...head, ...tail], separator: config?.separator }) }));
19
+ }
20
+ /**
21
+ * One item per segment of the Page's path. A folder segment links to the visitor's own address up to that
22
+ * folder -- the locale and Area prefix kept as the visitor has them -- when the server found that its
23
+ * folder address leads to a Page; every other segment, and the Page itself, is text.
24
+ */
25
+ export function buildPhiBreadcrumbPathItems(visitorPathname, pagePath, linkedFolderPaths) {
26
+ const segments = pagePath.split("/").filter(Boolean);
27
+ const base = visitorPathname.endsWith(pagePath) ? visitorPathname.slice(0, -pagePath.length) : null;
28
+ const linked = new Set(linkedFolderPaths);
29
+ return segments.map((segment, index) => {
30
+ const folder = `/${segments.slice(0, index + 1).join("/")}`;
31
+ const isFolder = index < segments.length - 1;
32
+ const title = decodeSegment(segment);
33
+ return isFolder && base !== null && linked.has(folder)
34
+ ? { key: folder, title, href: `${base}${folder}` }
35
+ : { key: folder, title };
36
+ });
37
+ }
38
+ function decodeSegment(segment) {
39
+ try {
40
+ return decodeURIComponent(segment);
41
+ }
42
+ catch {
43
+ return segment;
44
+ }
14
45
  }
@@ -1,3 +1,5 @@
1
1
  import type { PhiBreadcrumbWidgetProps } from "./client";
2
2
  export type { PhiBreadcrumbWidgetConfig, PhiBreadcrumbWidgetLabels, PhiBreadcrumbWidgetProps, } from "./client";
3
- export declare function PhiBreadcrumbWidget(props: PhiBreadcrumbWidgetProps): import("react").JSX.Element;
3
+ /** The folders a Page path lies in, outermost first: `/docs/guides/a` gives `/docs` and `/docs/guides`. */
4
+ export declare function listPhiBreadcrumbFolderPaths(pagePath: string): string[];
5
+ export declare function PhiBreadcrumbWidget(props: PhiBreadcrumbWidgetProps): Promise<import("react").JSX.Element>;