@phis/ui 0.4.22 → 0.5.0
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.
- package/components/controls/phi-background-control.js +1 -1
- package/components/controls/phi-brand-control.d.ts +6 -1
- package/components/controls/phi-brand-control.js +2 -2
- package/components/controls/phi-breadcrumb-control.d.ts +2 -0
- package/components/media/media-asset-typed-fields.d.ts +10 -0
- package/components/media/media-asset-typed-fields.js +19 -0
- package/components/media/media-settings-labels.d.ts +33 -0
- package/components/media/media-settings-labels.js +62 -0
- package/components/media/media-upload-flow.d.ts +19 -0
- package/components/media/media-upload-flow.js +38 -0
- package/components/media/phi-asset-focal-rect-widget.js +2 -2
- package/components/media/phi-image-inspector-widget.js +1 -1
- package/components/media/phi-image-preview-data.js +5 -4
- package/components/media/phi-site-font-assets.js +2 -5
- package/components/media/use-authoring-asset-details.js +0 -1
- package/components/regions/presets/navigation-redirect.d.ts +2 -2
- package/components/regions/presets/navigation-redirect.js +3 -3
- package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -1
- package/components/widgets/helpers/internal-reference-resolver.server.d.ts +1 -1
- package/components/widgets/helpers/internal-reference-resolver.server.js +4 -0
- package/components/widgets/label-sets/builder-modules.js +6 -0
- package/components/widgets/label-types/builder-modules.d.ts +4 -0
- package/components/widgets/label-types/builder-modules.js +3 -0
- package/components/widgets/shared/markdown-render.js +30 -135
- package/components/widgets/shared/markdown-translation-unit.d.ts +62 -0
- package/components/widgets/shared/markdown-translation-unit.js +211 -0
- package/constants/runtime-module-ownership.js +4 -0
- package/gateway/internal-references.d.ts +5 -0
- package/gateway/internal-references.js +12 -12
- package/gateway/site-media-settings.d.ts +2 -0
- package/gateway/site-media-settings.js +6 -1
- package/gateway/site-media-storage-reader.d.ts +19 -0
- package/gateway/site-media-storage-reader.js +24 -0
- package/helpers/cms-navigation-catalog.d.ts +2 -0
- package/helpers/cms-navigation-catalog.js +1 -0
- package/helpers/cms-page-catalog.d.ts +12 -0
- package/helpers/cms-page-catalog.js +5 -0
- package/helpers/phi-seo.d.ts +16 -2
- package/helpers/phi-seo.js +54 -11
- package/helpers/public-route-claims.d.ts +4 -0
- package/helpers/public-route-claims.js +1 -1
- package/next/seo-routes.d.ts +1 -1
- package/next/seo-routes.js +23 -5
- package/package.json +1 -1
- package/plugins/runtime-modules/area-definitions.d.ts +75 -6
- package/plugins/runtime-modules/area-definitions.js +20 -0
- package/plugins/runtime-modules/asset/client-data-providers.js +12 -0
- package/plugins/runtime-modules/asset/controller/runtime.js +1 -1
- package/plugins/runtime-modules/asset/data-providers.d.ts +27 -2
- package/plugins/runtime-modules/asset/data-providers.js +56 -0
- package/plugins/runtime-modules/asset/definition.d.ts +38 -2
- package/plugins/runtime-modules/asset/definition.js +2 -1
- package/plugins/runtime-modules/asset/ids.d.ts +4 -0
- package/plugins/runtime-modules/asset/ids.js +4 -0
- package/plugins/runtime-modules/asset/server.js +2 -1
- package/plugins/runtime-modules/asset/services/options.d.ts +7 -0
- package/plugins/runtime-modules/asset/services/options.js +38 -0
- package/plugins/runtime-modules/asset/services/storage-spaces-table.d.ts +3 -0
- package/plugins/runtime-modules/asset/services/storage-spaces-table.js +89 -0
- package/plugins/runtime-modules/asset/settings-forms.d.ts +17 -0
- package/plugins/runtime-modules/asset/settings-forms.js +117 -1
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +94 -1
- package/plugins/runtime-modules/builder/area-shell-presets.server.d.ts +8 -0
- package/plugins/runtime-modules/builder/area-shell-presets.server.js +13 -0
- package/plugins/runtime-modules/builder/controller/page-controller-helpers.js +1 -1
- package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -1
- package/plugins/runtime-modules/builder/controller/page-controller.js +30 -3
- package/plugins/runtime-modules/builder/controller/server-definition.d.ts +7 -1
- package/plugins/runtime-modules/builder/controller/server-definition.js +8 -3
- package/plugins/runtime-modules/builder/data-providers.js +1 -0
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +2 -0
- package/plugins/runtime-modules/builder/navigation-path-context.js +7 -3
- package/plugins/runtime-modules/builder/options-providers.js +2 -2
- package/plugins/runtime-modules/builder/page-address-rule.d.ts +39 -0
- package/plugins/runtime-modules/builder/page-address-rule.js +62 -0
- package/plugins/runtime-modules/builder/page-meta-form.js +10 -0
- package/plugins/runtime-modules/builder/public-route-collisions.js +7 -2
- package/plugins/runtime-modules/builder/services/page-source-tree.js +2 -1
- package/plugins/runtime-modules/builder/services/runtime-modules-table.js +49 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -2
- package/plugins/runtime-modules/core/widgets/brand/client.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/brand/client.js +2 -1
- package/plugins/runtime-modules/core/widgets/brand/plugin.js +23 -2
- package/plugins/runtime-modules/core/widgets/brand/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/brand/server.js +2 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +14 -2
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +35 -4
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +37 -2
- package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/card/server.js +7 -4
- package/plugins/runtime-modules/core/widgets/gallery/plugin.js +3 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.js +12 -2
- package/plugins/runtime-modules/core/widgets/image/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/image/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/image/server.js +28 -5
- package/plugins/runtime-modules/core/widgets/page-title/authoring.js +3 -1
- package/plugins/runtime-modules/core/widgets/page-title/client.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/page-title/client.js +5 -1
- package/plugins/runtime-modules/core/widgets/page-title/config.d.ts +25 -3
- package/plugins/runtime-modules/core/widgets/page-title/config.js +24 -3
- package/plugins/runtime-modules/core/widgets/page-title/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/page-title/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/page-title/server.js +4 -3
- package/plugins/runtime-modules/core/widgets/table/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/config.js +9 -0
- package/plugins/runtime-modules/descriptor-compiler.js +33 -8
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +1 -1
- package/server-helpers/cms-review-params.d.ts +25 -0
- package/server-helpers/cms-review-params.js +54 -0
- package/server-helpers/cms-review.d.ts +1 -25
- package/server-helpers/cms-review.js +2 -54
- package/types/cms-module-descriptors.d.ts +33 -3
- package/types/media.d.ts +6 -2
- package/types/table-widget.d.ts +11 -0
- 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
|
-
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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) => ({
|
|
34
|
+
.map((page) => ({
|
|
35
|
+
value: page.reference,
|
|
36
|
+
label: formatPhiBuilderPagePathWithPending(pagePaths.get(page.reference).path, page.pendingPath),
|
|
37
|
+
}));
|
|
35
38
|
const resolveLinkPath = (item) => {
|
|
36
|
-
|
|
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) => ({
|
|
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) =>
|
|
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
|
}
|
|
@@ -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",
|
|
@@ -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",
|
|
@@ -17,6 +17,8 @@ export type PhiBrandWidgetClientProps = PhiClientBlockBaseProps<PhiNoLabels, Phi
|
|
|
17
17
|
*/
|
|
18
18
|
home?: PhiBrandWidgetHome;
|
|
19
19
|
interactive?: boolean;
|
|
20
|
+
/** The Logo's description in the page's language, translated on the Server. */
|
|
21
|
+
logoAlt?: string;
|
|
20
22
|
};
|
|
21
23
|
/** A ready address, and whether it leaves the Site -- the shape `resolvePhiLinkHref` answers. */
|
|
22
24
|
export type PhiBrandWidgetHome = {
|
|
@@ -31,4 +33,4 @@ export type PhiBrandWidgetHome = {
|
|
|
31
33
|
* because the Theme workspace preview shows the same Brand without being in a frame and without
|
|
32
34
|
* leading anywhere.
|
|
33
35
|
*/
|
|
34
|
-
export declare function PhiBrandWidgetClient({ config, home, fallbackTitle, interactive, }: PhiBrandWidgetClientProps): import("react").JSX.Element | null;
|
|
36
|
+
export declare function PhiBrandWidgetClient({ config, home, fallbackTitle, interactive, logoAlt, }: PhiBrandWidgetClientProps): import("react").JSX.Element | null;
|
|
@@ -19,7 +19,7 @@ export const PHI_BRAND_LINE_FALLBACK_ICONS = {
|
|
|
19
19
|
* because the Theme workspace preview shows the same Brand without being in a frame and without
|
|
20
20
|
* leading anywhere.
|
|
21
21
|
*/
|
|
22
|
-
export function PhiBrandWidgetClient({ config, home, fallbackTitle, interactive = true, }) {
|
|
22
|
+
export function PhiBrandWidgetClient({ config, home, fallbackTitle, interactive = true, logoAlt, }) {
|
|
23
23
|
const brand = usePhiSiteBrand();
|
|
24
24
|
// The Theme's mode, not the Widget's: one picks the Logo's picture, the other what is drawn at all.
|
|
25
25
|
const { fonts, token, mode: themeMode } = usePhiConfig();
|
|
@@ -49,6 +49,7 @@ export function PhiBrandWidgetClient({ config, home, fallbackTitle, interactive
|
|
|
49
49
|
mode: themeMode,
|
|
50
50
|
fallbackTitle,
|
|
51
51
|
shows: config?.mode ?? "lockup",
|
|
52
|
+
logoAlt,
|
|
52
53
|
};
|
|
53
54
|
if (phiBrandControlIsEmpty(presentation)) {
|
|
54
55
|
return null;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PhiCmsFlags } from "../../../../../constants/phi-cms";
|
|
3
|
+
import { hasPhiFlag } from "../../../../../helpers/flags";
|
|
4
|
+
import { tr, trForLocale, trGlobal, trGlobalForLocale } from "../../../../../server-helpers/translate";
|
|
2
5
|
import { resolvePhiBrandWordmarkText } from "../../../../../helpers/brand-wordmark";
|
|
3
6
|
import { resolvePhiBrandWidgetHome } from "./home";
|
|
4
7
|
import { PhiBrandWidget } from "./server";
|
|
@@ -12,9 +15,27 @@ import { PHI_BRAND_WIDGET_DEFINITION, PHI_BRAND_WIDGET_PLUGIN_TYPE, } from "./co
|
|
|
12
15
|
* while the Site's own changed underneath it. `resolvePhiBrandWordmarkText` is the same order the rest
|
|
13
16
|
* of the frame reads it in: the Theme's Wordmark, then the Site's name, then its key.
|
|
14
17
|
*/
|
|
18
|
+
/** The Logo's default description: the platform's words, from the global store. */
|
|
19
|
+
const PHI_BRAND_LOGO_ALT_DEFAULT = "Brand logo";
|
|
20
|
+
/*
|
|
21
|
+
* What a screen reader says for the Logo, in the page's language like every other word on it. The
|
|
22
|
+
* Theme's own text is the Site's and is translated in the Site's store; where the Theme says nothing,
|
|
23
|
+
* the default is the platform's. A Widget marked not to translate keeps the Theme's text as written.
|
|
24
|
+
*/
|
|
25
|
+
async function translatePhiBrandLogoAlt(runtime, widget) {
|
|
26
|
+
const own = runtime.site.theme?.brand?.logoAlt?.trim();
|
|
27
|
+
if (hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate)) {
|
|
28
|
+
return own || undefined;
|
|
29
|
+
}
|
|
30
|
+
const locale = runtime.locale.current;
|
|
31
|
+
if (own) {
|
|
32
|
+
return locale ? trForLocale(locale, own) : tr(own);
|
|
33
|
+
}
|
|
34
|
+
return locale ? trGlobalForLocale(locale, PHI_BRAND_LOGO_ALT_DEFAULT) : trGlobal(PHI_BRAND_LOGO_ALT_DEFAULT);
|
|
35
|
+
}
|
|
15
36
|
export const PHI_BRAND_WIDGET_PLUGIN = {
|
|
16
37
|
...PHI_BRAND_WIDGET_DEFINITION,
|
|
17
|
-
render: ({ widget, config, runtime, links }) => (_jsx(PhiBrandWidget, { fallbackTitle: resolvePhiBrandWordmarkText(runtime), home: resolvePhiBrandWidgetHome(runtime, links), mode: config.mode, fontFamily: config.fontFamily, fontSize: config.fontSize }, `widget-${widget.id}`)),
|
|
18
|
-
renderPreview: ({ widget, config, runtime, links }) => (_jsx(PhiBrandWidget, { fallbackTitle: resolvePhiBrandWordmarkText(runtime), home: resolvePhiBrandWidgetHome(runtime, links), mode: config.mode, fontFamily: config.fontFamily, fontSize: config.fontSize, interactive: false }, `widget-${widget.id}`)),
|
|
38
|
+
render: async ({ widget, config, runtime, links }) => (_jsx(PhiBrandWidget, { fallbackTitle: resolvePhiBrandWordmarkText(runtime), home: resolvePhiBrandWidgetHome(runtime, links), logoAlt: await translatePhiBrandLogoAlt(runtime, widget), mode: config.mode, fontFamily: config.fontFamily, fontSize: config.fontSize }, `widget-${widget.id}`)),
|
|
39
|
+
renderPreview: async ({ widget, config, runtime, links }) => (_jsx(PhiBrandWidget, { fallbackTitle: resolvePhiBrandWordmarkText(runtime), home: resolvePhiBrandWidgetHome(runtime, links), logoAlt: await translatePhiBrandLogoAlt(runtime, widget), mode: config.mode, fontFamily: config.fontFamily, fontSize: config.fontSize, interactive: false }, `widget-${widget.id}`)),
|
|
19
40
|
};
|
|
20
41
|
export { PHI_BRAND_WIDGET_PLUGIN_TYPE };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { PhiBrandWidgetClientProps, PhiBrandWidgetConfig } from "./client";
|
|
2
|
-
export type PhiBrandWidgetProps = Pick<PhiBrandWidgetClientProps, "fallbackTitle" | "interactive" | "home"> & PhiBrandWidgetConfig;
|
|
3
|
-
export declare function PhiBrandWidget({ fallbackTitle, interactive, home, mode, fontFamily, fontSize, }: PhiBrandWidgetProps): import("react").JSX.Element;
|
|
2
|
+
export type PhiBrandWidgetProps = Pick<PhiBrandWidgetClientProps, "fallbackTitle" | "interactive" | "home" | "logoAlt"> & PhiBrandWidgetConfig;
|
|
3
|
+
export declare function PhiBrandWidget({ fallbackTitle, interactive, home, logoAlt, mode, fontFamily, fontSize, }: PhiBrandWidgetProps): import("react").JSX.Element;
|
|
@@ -5,12 +5,13 @@ import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runt
|
|
|
5
5
|
* The Brand itself is not read here. It comes from the root on the Client (`usePhiSiteBrand`), which
|
|
6
6
|
* holds it with the Theme Set's Logo folded in and follows a live Theme draft.
|
|
7
7
|
*/
|
|
8
|
-
export function PhiBrandWidget({ fallbackTitle, interactive, home, mode, fontFamily, fontSize, }) {
|
|
8
|
+
export function PhiBrandWidget({ fallbackTitle, interactive, home, logoAlt, mode, fontFamily, fontSize, }) {
|
|
9
9
|
const config = { mode, fontFamily, fontSize };
|
|
10
10
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Brand, componentProps: {
|
|
11
11
|
config,
|
|
12
12
|
fallbackTitle,
|
|
13
13
|
home,
|
|
14
14
|
interactive,
|
|
15
|
+
...(logoAlt ? { logoAlt } : {}),
|
|
15
16
|
} }));
|
|
16
17
|
}
|
|
@@ -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
|
-
|
|
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[];
|