@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
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
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>;
|
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { fetchSiteNavigationFolderTarget } from "../../../../../gateway/site-nav";
|
|
5
|
+
import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
|
|
6
|
+
/** The folders a Page path lies in, outermost first: `/docs/guides/a` gives `/docs` and `/docs/guides`. */
|
|
7
|
+
export function listPhiBreadcrumbFolderPaths(pagePath) {
|
|
8
|
+
const segments = pagePath.split("/").filter(Boolean);
|
|
9
|
+
return segments.slice(0, -1).map((_segment, index) => `/${segments.slice(0, index + 1).join("/")}`);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Which folders of the Page's path lead somewhere, so the client links exactly those.
|
|
13
|
+
*
|
|
14
|
+
* A folder segment is a link when its folder address resolves to a Page (REFERENCES.md, "Folder
|
|
15
|
+
* addresses"); one that resolves to nothing would be a link into a 404. Asked once per folder of the
|
|
16
|
+
* path, which is the depth of the path and not the size of the Site, and only when the trail shows the
|
|
17
|
+
* path at all. A failed lookup leaves that segment unlinked rather than failing the trail.
|
|
18
|
+
*/
|
|
19
|
+
async function resolveLinkedFolderPaths(props) {
|
|
20
|
+
const { config, runtime } = props;
|
|
21
|
+
const pagePath = runtime?.page?.path;
|
|
22
|
+
if (!pagePath || !runtime?.site?.key || config?.showPath === false || config?.pathLabel?.trim()) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
const folders = listPhiBreadcrumbFolderPaths(pagePath);
|
|
26
|
+
if (folders.length === 0)
|
|
27
|
+
return [];
|
|
28
|
+
const { apiBaseUrl, internalToken } = readPhiServerApiCredentials();
|
|
29
|
+
const answers = await Promise.all(folders.map((path) => fetchSiteNavigationFolderTarget({
|
|
30
|
+
apiBaseUrl,
|
|
31
|
+
internalToken,
|
|
32
|
+
siteKey: runtime.site.key,
|
|
33
|
+
area: String(runtime.area),
|
|
34
|
+
path,
|
|
35
|
+
}).catch(() => null)));
|
|
36
|
+
return folders.filter((_path, index) => answers[index] != null);
|
|
37
|
+
}
|
|
38
|
+
export async function PhiBreadcrumbWidget(props) {
|
|
39
|
+
const linkedFolderPaths = await resolveLinkedFolderPaths(props);
|
|
40
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Breadcrumb, componentProps: { ...props, pagePath: props.runtime?.page?.path ?? null, linkedFolderPaths } }));
|
|
6
41
|
}
|
|
@@ -124,7 +124,7 @@ export function PhiCardWidgetEditor({ config, onChange }) {
|
|
|
124
124
|
deliveryRevision: asset?.deliveryRevision,
|
|
125
125
|
originalUrl: assetId == null ? null : buildPhiMediaAssetContentDeliveryUrl(assetId),
|
|
126
126
|
sourceUrl: config.sourceKind === "url" ? config.sourceUrl : undefined,
|
|
127
|
-
focalRect: asset?.
|
|
127
|
+
focalRect: asset?.focalRect,
|
|
128
128
|
sourceWidth: asset?.width,
|
|
129
129
|
sourceHeight: asset?.height,
|
|
130
130
|
});
|
|
@@ -20,6 +20,10 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
20
20
|
const defaultLabels = actionEnabled ? await getPhiCardWidgetLabelsForRuntime(runtime) : null;
|
|
21
21
|
const ownActionLabel = labels.actionLabel ?? config?.actionLabel;
|
|
22
22
|
const plan = config?.body === "plan";
|
|
23
|
+
// Resolved before the words, because the picture's description is one of them.
|
|
24
|
+
const resolvedAsset = config?.sourceKind === "asset" && typeof config.assetId === "number"
|
|
25
|
+
? await resolvePhiPublicAssetReference({ runtime, assetId: config.assetId }).catch(() => null)
|
|
26
|
+
: null;
|
|
23
27
|
const textEntries = [
|
|
24
28
|
["eyebrow", labels.eyebrow ?? config?.eyebrow],
|
|
25
29
|
["title", labels.title ?? config?.title],
|
|
@@ -29,6 +33,8 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
29
33
|
["badge", labels.badge ?? config?.badge],
|
|
30
34
|
["pricePeriod", plan ? labels.pricePeriod ?? config?.pricePeriod : undefined],
|
|
31
35
|
["pricePeriodYearly", plan ? labels.pricePeriodYearly ?? config?.pricePeriodYearly : undefined],
|
|
36
|
+
// What a screen reader says for the picture, in the page's language like every other word here.
|
|
37
|
+
["alt", (config?.alt ?? resolvedAsset?.altText ?? "").trim() || undefined],
|
|
32
38
|
];
|
|
33
39
|
/*
|
|
34
40
|
* A plan's features, masked as every list entry is: their values stand as `%1` onwards and never reach
|
|
@@ -55,9 +61,6 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
55
61
|
* lose its title's translation with it.
|
|
56
62
|
*/
|
|
57
63
|
const value = config?.value;
|
|
58
|
-
const resolvedAsset = config?.sourceKind === "asset" && typeof config.assetId === "number"
|
|
59
|
-
? await resolvePhiPublicAssetReference({ runtime, assetId: config.assetId }).catch(() => null)
|
|
60
|
-
: null;
|
|
61
64
|
const presentation = resolvePhiImagePresentation({
|
|
62
65
|
sourceKind: config?.sourceKind,
|
|
63
66
|
assetId: resolvedAsset?.id,
|
|
@@ -88,7 +91,7 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
88
91
|
...(config?.imageOpacity == null ? {} : { opacity: config.imageOpacity / 100 }),
|
|
89
92
|
...(config?.imageOverlay ? { overlay: config.imageOverlay } : {}),
|
|
90
93
|
source: config?.sourceKind === "asset" ? "asset" : "url",
|
|
91
|
-
alt: (
|
|
94
|
+
alt: translatedByKey.get("alt") ?? "",
|
|
92
95
|
blurDataUrl: resolvedAsset?.blurDataUrl ?? null,
|
|
93
96
|
/*
|
|
94
97
|
* Only a public Asset resolves here, so the optimiser takes every variant, and every original
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { definePhiPassiveWidgetRenderers } from "../../../../../plugins/factories/widget-renderers";
|
|
3
|
+
import { PhiCmsFlags } from "../../../../../constants/phi-cms";
|
|
4
|
+
import { hasPhiFlag } from "../../../../../helpers/flags";
|
|
3
5
|
import { PHI_GALLERY_WIDGET_DEFINITION, } from "./config";
|
|
4
6
|
import { PhiGalleryWidgetServer } from "./server";
|
|
5
7
|
export const PHI_GALLERY_WIDGET_PLUGIN = {
|
|
6
8
|
...PHI_GALLERY_WIDGET_DEFINITION,
|
|
7
|
-
...definePhiPassiveWidgetRenderers(({ widget, runtime, registry, config }) => (_jsx(PhiGalleryWidgetServer, { runtime: runtime, registry: registry, config: config, widgetId: widget.id }, `widget-${widget.id}`))),
|
|
9
|
+
...definePhiPassiveWidgetRenderers(({ widget, runtime, registry, config }) => (_jsx(PhiGalleryWidgetServer, { runtime: runtime, registry: registry, config: config, widgetId: widget.id, translate: !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate) }, `widget-${widget.id}`))),
|
|
8
10
|
};
|
|
@@ -9,6 +9,8 @@ export type PhiGalleryWidgetServerProps = {
|
|
|
9
9
|
registry?: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey">;
|
|
10
10
|
config: PhiCmsGalleryWidgetConfig;
|
|
11
11
|
widgetId?: PhiCmsInstanceId | null;
|
|
12
|
+
/** Whether the pictures' descriptions go through the Site's translation; off where the Widget says so. */
|
|
13
|
+
translate?: boolean;
|
|
12
14
|
};
|
|
13
15
|
/**
|
|
14
16
|
* The pictures come from the record the binding names -- a Folder, read while the page is drawn -- so
|
|
@@ -16,4 +18,4 @@ export type PhiGalleryWidgetServerProps = {
|
|
|
16
18
|
* another shape is somebody else's Provider bound here by mistake. Either failure is the author's to
|
|
17
19
|
* read and is nothing on a live page, rather than an empty gallery anywhere.
|
|
18
20
|
*/
|
|
19
|
-
export declare function PhiGalleryWidgetServer({ runtime, registry, config, widgetId }: PhiGalleryWidgetServerProps): Promise<import("react").JSX.Element | null>;
|
|
21
|
+
export declare function PhiGalleryWidgetServer({ runtime, registry, config, widgetId, translate }: PhiGalleryWidgetServerProps): Promise<import("react").JSX.Element | null>;
|
|
@@ -5,6 +5,7 @@ import { getPhiGalleryWidgetLabels } from "../../../../../components/widgets/lab
|
|
|
5
5
|
import { PhiWidgetFailureServer } from "../../../../../components/widgets/shared/widget-failure.server";
|
|
6
6
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
7
7
|
import { resolvePhiRecordSource } from "../../../../../server-helpers/record-source";
|
|
8
|
+
import { trBulk, trBulkForLocale } from "../../../../../server-helpers/translate";
|
|
8
9
|
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
9
10
|
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
10
11
|
function isPublicAssetReference(value) {
|
|
@@ -18,7 +19,7 @@ function isPublicAssetReference(value) {
|
|
|
18
19
|
* another shape is somebody else's Provider bound here by mistake. Either failure is the author's to
|
|
19
20
|
* read and is nothing on a live page, rather than an empty gallery anywhere.
|
|
20
21
|
*/
|
|
21
|
-
export async function PhiGalleryWidgetServer({ runtime, registry, config, widgetId }) {
|
|
22
|
+
export async function PhiGalleryWidgetServer({ runtime, registry, config, widgetId, translate = true }) {
|
|
22
23
|
const labels = await getPhiGalleryWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
23
24
|
const renderMode = readPhiRuntimeTreeRenderMode(config);
|
|
24
25
|
const result = registry && config.source
|
|
@@ -36,5 +37,14 @@ export async function PhiGalleryWidgetServer({ runtime, registry, config, widget
|
|
|
36
37
|
if (!images || images.length === 0) {
|
|
37
38
|
return null;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
/*
|
|
41
|
+
* Each picture's description from the Media library, in the page's language: the Library's text is
|
|
42
|
+
* the Site's and is translated in the Site's store, in one round trip for the whole gallery.
|
|
43
|
+
*/
|
|
44
|
+
const altTexts = images.map((image) => (image.altText ?? "").trim());
|
|
45
|
+
const translatedAlts = translate && altTexts.some(Boolean)
|
|
46
|
+
? await (runtime.locale.current ? trBulkForLocale(runtime.locale.current, altTexts) : trBulk(altTexts))
|
|
47
|
+
: altTexts;
|
|
48
|
+
const translatedImages = images.map((image, index) => (translatedAlts[index] ? { ...image, altText: translatedAlts[index] } : image));
|
|
49
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Gallery, componentProps: { config, images: translatedImages, labels } }));
|
|
40
50
|
}
|
|
@@ -41,7 +41,7 @@ export function PhiImageWidget({ labels, config, resolvedAsset, focalRect, autho
|
|
|
41
41
|
deliveryRevision: resolvedAsset?.deliveryRevision,
|
|
42
42
|
originalUrl: resolvedAsset?.deliveryUrl,
|
|
43
43
|
sourceUrl: configSourceUrl,
|
|
44
|
-
focalRect: focalRect ?? resolvedAsset?.
|
|
44
|
+
focalRect: focalRect ?? resolvedAsset?.focalRect,
|
|
45
45
|
fit: config?.fit,
|
|
46
46
|
objectPosition: config?.objectPosition,
|
|
47
47
|
sourceWidth: resolvedAsset?.width,
|
|
@@ -55,7 +55,7 @@ export function PhiImageWidgetEditor({ config, onChange }) {
|
|
|
55
55
|
onChange,
|
|
56
56
|
]);
|
|
57
57
|
const overlaySize = formatImageEditorOverlaySize(config, resolvedAssetDetails, config?.imageSize?.width ?? resolvedAssetDetails?.width, config?.imageSize?.height ?? resolvedAssetDetails?.height);
|
|
58
|
-
return (_jsxs("div", { style: { position: "relative", display: "inline-block", maxWidth: "100%" }, children: [_jsx(PhiImageWidget, { labels: PHI_IMAGE_WIDGET_DEFAULT_LABELS, config: config ?? undefined, resolvedAsset: resolvedAssetDetails, focalRect: resolvedAssetDetails?.
|
|
58
|
+
return (_jsxs("div", { style: { position: "relative", display: "inline-block", maxWidth: "100%" }, children: [_jsx(PhiImageWidget, { labels: PHI_IMAGE_WIDGET_DEFAULT_LABELS, config: config ?? undefined, resolvedAsset: resolvedAssetDetails, focalRect: resolvedAssetDetails?.focalRect ?? null }), assetId != null ? (_jsxs(PhiTypographyControl, { style: {
|
|
59
59
|
position: "absolute",
|
|
60
60
|
top: "0.375rem",
|
|
61
61
|
right: "0.375rem",
|
|
@@ -4,6 +4,9 @@ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
|
4
4
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
5
5
|
import { getPhiImageWidgetLabels } from "../../../../../components/widgets/label-sets/image";
|
|
6
6
|
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
7
|
+
import { PhiCmsFlags } from "../../../../../constants/phi-cms";
|
|
8
|
+
import { hasPhiFlag } from "../../../../../helpers/flags";
|
|
9
|
+
import { trBulk, trBulkForLocale } from "../../../../../server-helpers/translate";
|
|
7
10
|
async function resolveImageWidgetLabels(runtime) {
|
|
8
11
|
return getPhiImageWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
9
12
|
}
|
|
@@ -13,18 +16,38 @@ export async function PhiImageWidgetServer({ runtime, widget, config, }) {
|
|
|
13
16
|
const resolvedAsset = config?.sourceKind === "asset" && typeof assetId === "number"
|
|
14
17
|
? await resolvePhiPublicAssetReference({ runtime, assetId }).catch(() => null)
|
|
15
18
|
: null;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
19
|
+
const recordTitle = widget?.resolvedContent?.textFields.title?.value?.trim();
|
|
20
|
+
const recordAlt = widget?.resolvedContent?.textFields.alt?.value?.trim();
|
|
21
|
+
/*
|
|
22
|
+
* The picture's description and title in the page's language, as every other Widget's words.
|
|
23
|
+
*
|
|
24
|
+
* A Content record's text arrives translated already and is taken as it is. The rest -- the Asset's own
|
|
25
|
+
* description from the Media library, or what the Widget's config states for an address -- is the Site's
|
|
26
|
+
* text and goes through the Site's translation, unless the Widget says not to translate.
|
|
27
|
+
*/
|
|
28
|
+
const translate = !hasPhiFlag(widget?.flags ?? 0, PhiCmsFlags.NoTranslate);
|
|
29
|
+
const sourceTexts = [
|
|
30
|
+
recordAlt ? "" : (resolvedAsset?.altText ?? "").trim(),
|
|
31
|
+
recordTitle ? "" : (resolvedAsset?.title ?? "").trim(),
|
|
32
|
+
config?.sourceKind === "asset" ? "" : (config?.alt ?? "").trim(),
|
|
33
|
+
config?.sourceKind === "asset" ? "" : (config?.title ?? "").trim(),
|
|
34
|
+
];
|
|
35
|
+
const [assetAlt, assetTitle, configAlt, configTitle] = translate && sourceTexts.some(Boolean)
|
|
36
|
+
? await (runtime.locale.current ? trBulkForLocale(runtime.locale.current, sourceTexts) : trBulk(sourceTexts))
|
|
37
|
+
: sourceTexts;
|
|
18
38
|
const contentResolvedAsset = resolvedAsset
|
|
19
39
|
? {
|
|
20
40
|
...resolvedAsset,
|
|
21
|
-
title:
|
|
22
|
-
altText:
|
|
41
|
+
title: recordTitle || assetTitle || resolvedAsset.title,
|
|
42
|
+
altText: recordAlt || assetAlt || resolvedAsset.altText,
|
|
23
43
|
}
|
|
24
44
|
: null;
|
|
45
|
+
const translatedConfig = config && config.sourceKind !== "asset"
|
|
46
|
+
? { ...config, ...(configAlt ? { alt: configAlt } : {}), ...(configTitle ? { title: configTitle } : {}) }
|
|
47
|
+
: config;
|
|
25
48
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Image, componentProps: {
|
|
26
49
|
labels,
|
|
27
|
-
config:
|
|
50
|
+
config: translatedConfig ?? undefined,
|
|
28
51
|
resolvedAsset: contentResolvedAsset,
|
|
29
52
|
focalRect: contentResolvedAsset?.focalRect ?? null,
|
|
30
53
|
} }));
|
|
@@ -5,5 +5,7 @@ import { PHI_PAGE_TITLE_WIDGET_DEFAULT_LABELS } from "../../../../../components/
|
|
|
5
5
|
import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
|
|
6
6
|
export const PHI_PAGE_TITLE_WIDGET_BUILDER_PLUGIN = {
|
|
7
7
|
...PHI_PAGE_TITLE_WIDGET_DEFINITION,
|
|
8
|
-
renderEditor: () => (
|
|
8
|
+
renderEditor: ({ config }) => (config.display === "heading"
|
|
9
|
+
? (_jsx(PhiTypographyControl, { presentation: "title", level: 1, style: { margin: 0, textAlign: "center" }, children: PHI_PAGE_TITLE_WIDGET_DEFAULT_LABELS.editorPlaceholder }))
|
|
10
|
+
: (_jsx(PhiTypographyControl, { presentation: "title", level: 5, style: { margin: 0, whiteSpace: "nowrap" }, children: PHI_PAGE_TITLE_WIDGET_DEFAULT_LABELS.editorPlaceholder }))),
|
|
9
11
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { PhiPageTitleWidgetDisplay } from "./config";
|
|
1
2
|
export type PhiPageTitleWidgetClientProps = {
|
|
2
3
|
initialTitle: string;
|
|
3
4
|
area?: string | null;
|
|
5
|
+
display: PhiPageTitleWidgetDisplay;
|
|
4
6
|
};
|
|
5
|
-
export declare function PhiPageTitleWidgetClient({ initialTitle, area, }: PhiPageTitleWidgetClientProps): import("react").JSX.Element;
|
|
7
|
+
export declare function PhiPageTitleWidgetClient({ initialTitle, area, display, }: PhiPageTitleWidgetClientProps): import("react").JSX.Element;
|
|
@@ -4,7 +4,8 @@ import { useState } from "react";
|
|
|
4
4
|
import { usePhiSignalListener } from "../../../../../components/runtime/runtime-signal-bus";
|
|
5
5
|
import { resolvePhiPageTitleSignalValue } from "../../../../../components/widgets/signals/page-title-signals";
|
|
6
6
|
import { createPhiCoreRuntimeControllerAddress } from "../../../../../components/runtime/core-runtime-controller-address";
|
|
7
|
-
|
|
7
|
+
import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
|
|
8
|
+
export function PhiPageTitleWidgetClient({ initialTitle, area, display, }) {
|
|
8
9
|
const [state, setState] = useState(() => ({
|
|
9
10
|
source: initialTitle,
|
|
10
11
|
value: initialTitle,
|
|
@@ -39,6 +40,9 @@ export function PhiPageTitleWidgetClient({ initialTitle, area, }) {
|
|
|
39
40
|
channels: ["pageMeta", "pageTitle"],
|
|
40
41
|
receiver: "broadcast",
|
|
41
42
|
});
|
|
43
|
+
if (display === "heading") {
|
|
44
|
+
return (_jsx(PhiTypographyControl, { presentation: "title", level: 1, style: { margin: 0, textAlign: "center" }, children: title }));
|
|
45
|
+
}
|
|
42
46
|
return (_jsx("div", { style: {
|
|
43
47
|
fontSize: "1.25rem",
|
|
44
48
|
fontWeight: 600,
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* How the title stands.
|
|
3
|
+
*
|
|
4
|
+
* `heading` is the Page's own heading: its one `h1`, on the type scale, wrapping, centred. `label` is the
|
|
5
|
+
* title as a caption in a bar -- the Shell's header -- where a heading would give the page a second `h1`
|
|
6
|
+
* and the bar a line break.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PHI_PAGE_TITLE_WIDGET_DISPLAYS: readonly ["heading", "label"];
|
|
9
|
+
export type PhiPageTitleWidgetDisplay = (typeof PHI_PAGE_TITLE_WIDGET_DISPLAYS)[number];
|
|
10
|
+
export type PhiPageTitleWidgetConfig = {
|
|
11
|
+
display: PhiPageTitleWidgetDisplay;
|
|
12
|
+
};
|
|
13
|
+
declare function parsePhiPageTitleWidgetConfig(config: Record<string, unknown>): PhiPageTitleWidgetConfig;
|
|
3
14
|
export declare const PHI_PAGE_TITLE_WIDGET_DEFINITION: {
|
|
4
15
|
kind: "widget";
|
|
5
16
|
pluginKey: string;
|
|
@@ -9,7 +20,18 @@ export declare const PHI_PAGE_TITLE_WIDGET_DEFINITION: {
|
|
|
9
20
|
category: "content";
|
|
10
21
|
description: string;
|
|
11
22
|
iconFamily: string;
|
|
12
|
-
fields:
|
|
23
|
+
fields: {
|
|
24
|
+
key: string;
|
|
25
|
+
type: "choice";
|
|
26
|
+
label: string;
|
|
27
|
+
options: {
|
|
28
|
+
value: string;
|
|
29
|
+
label: string;
|
|
30
|
+
}[];
|
|
31
|
+
}[];
|
|
32
|
+
defaultConfig: {
|
|
33
|
+
display: "heading";
|
|
34
|
+
};
|
|
13
35
|
parseConfig: typeof parsePhiPageTitleWidgetConfig;
|
|
14
36
|
};
|
|
15
37
|
export {};
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { createPhiConfigReader } from "../../../../../components/widgets/config/strict-config-reader";
|
|
3
|
+
/**
|
|
4
|
+
* How the title stands.
|
|
5
|
+
*
|
|
6
|
+
* `heading` is the Page's own heading: its one `h1`, on the type scale, wrapping, centred. `label` is the
|
|
7
|
+
* title as a caption in a bar -- the Shell's header -- where a heading would give the page a second `h1`
|
|
8
|
+
* and the bar a line break.
|
|
9
|
+
*/
|
|
10
|
+
export const PHI_PAGE_TITLE_WIDGET_DISPLAYS = ["heading", "label"];
|
|
11
|
+
function parsePhiPageTitleWidgetConfig(config) {
|
|
12
|
+
const reader = createPhiConfigReader(config);
|
|
13
|
+
return { display: reader.oneOf("display", PHI_PAGE_TITLE_WIDGET_DISPLAYS) ?? "heading" };
|
|
4
14
|
}
|
|
5
15
|
export const PHI_PAGE_TITLE_WIDGET_DEFINITION = {
|
|
6
16
|
kind: "widget",
|
|
@@ -11,6 +21,17 @@ export const PHI_PAGE_TITLE_WIDGET_DEFINITION = {
|
|
|
11
21
|
category: "content",
|
|
12
22
|
description: "Displays the current localized CMS page title from runtime metadata.",
|
|
13
23
|
iconFamily: "basic",
|
|
14
|
-
fields: [
|
|
24
|
+
fields: [
|
|
25
|
+
{
|
|
26
|
+
key: "display",
|
|
27
|
+
type: "choice",
|
|
28
|
+
label: "Shows as",
|
|
29
|
+
options: [
|
|
30
|
+
{ value: "heading", label: "Page heading" },
|
|
31
|
+
{ value: "label", label: "Caption" },
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
defaultConfig: { display: "heading" },
|
|
15
36
|
parseConfig: parsePhiPageTitleWidgetConfig,
|
|
16
37
|
};
|
|
@@ -4,5 +4,5 @@ import { PHI_PAGE_TITLE_WIDGET_DEFINITION } from "./config";
|
|
|
4
4
|
import { PhiPageTitleWidgetServer } from "./server";
|
|
5
5
|
export const PHI_PAGE_TITLE_WIDGET_PLUGIN = {
|
|
6
6
|
...PHI_PAGE_TITLE_WIDGET_DEFINITION,
|
|
7
|
-
...definePhiPassiveWidgetRenderers(({ runtime }) => _jsx(PhiPageTitleWidgetServer, { runtime: runtime })),
|
|
7
|
+
...definePhiPassiveWidgetRenderers(({ runtime, config }) => _jsx(PhiPageTitleWidgetServer, { runtime: runtime, config: config })),
|
|
8
8
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { PhiServerBlockBaseProps } from "../../../../../types";
|
|
2
2
|
import type { PhiPageTitleWidgetConfig } from "./config";
|
|
3
3
|
import type { PhiPageTitleWidgetLabels } from "../../../../../components/widgets/label-types/page-title";
|
|
4
|
-
export declare function PhiPageTitleWidgetServer({ runtime, }: Pick<PhiServerBlockBaseProps<PhiPageTitleWidgetLabels, PhiPageTitleWidgetConfig>, "runtime">
|
|
4
|
+
export declare function PhiPageTitleWidgetServer({ runtime, config, }: Pick<PhiServerBlockBaseProps<PhiPageTitleWidgetLabels, PhiPageTitleWidgetConfig>, "runtime"> & {
|
|
5
|
+
config: PhiPageTitleWidgetConfig;
|
|
6
|
+
}): Promise<import("react").JSX.Element>;
|
|
@@ -3,14 +3,15 @@ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
4
|
import { getPhiPageTitleWidgetLabels } from "../../../../../components/widgets/label-sets/page-title";
|
|
5
5
|
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
6
|
-
function PhiPageTitleWidget({ labels, runtime, }) {
|
|
6
|
+
function PhiPageTitleWidget({ labels, runtime, config, }) {
|
|
7
7
|
const title = runtime.page?.title?.trim() || labels.emptyTitle;
|
|
8
8
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.PageTitle, componentProps: {
|
|
9
9
|
initialTitle: title,
|
|
10
10
|
area: runtime.area ?? null,
|
|
11
|
+
display: config.display,
|
|
11
12
|
} }));
|
|
12
13
|
}
|
|
13
|
-
export async function PhiPageTitleWidgetServer({ runtime, }) {
|
|
14
|
+
export async function PhiPageTitleWidgetServer({ runtime, config, }) {
|
|
14
15
|
const labels = await getPhiPageTitleWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
15
|
-
return _jsx(PhiPageTitleWidget, { labels: labels, runtime: runtime, config:
|
|
16
|
+
return _jsx(PhiPageTitleWidget, { labels: labels, runtime: runtime, config: config });
|
|
16
17
|
}
|
|
@@ -601,7 +601,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
601
601
|
required: field.required,
|
|
602
602
|
disabled: loading,
|
|
603
603
|
constraints: field.constraints,
|
|
604
|
-
options: field.options,
|
|
604
|
+
options: column.editor?.options ?? field.options,
|
|
605
605
|
prefix: column.editor?.prefix,
|
|
606
606
|
}
|
|
607
607
|
: undefined;
|
|
@@ -242,6 +242,15 @@ function readColumn(reader) {
|
|
|
242
242
|
control: editorReader.oneOf("control", PHI_TABLE_COLUMN_EDITOR_CONTROLS),
|
|
243
243
|
disabledWhen: readCondition(editorReader, "disabledWhen"),
|
|
244
244
|
...(editorReader.string("prefix") ? { prefix: editorReader.string("prefix") } : {}),
|
|
245
|
+
// The Site's own choices for a select cell, set by the placement (`editor.options`).
|
|
246
|
+
...(editorReader.has("options")
|
|
247
|
+
? {
|
|
248
|
+
options: editorReader.list("options", (option) => ({
|
|
249
|
+
value: requireString(option, "value"),
|
|
250
|
+
label: requireString(option, "label"),
|
|
251
|
+
})) ?? [],
|
|
252
|
+
}
|
|
253
|
+
: {}),
|
|
245
254
|
});
|
|
246
255
|
return {
|
|
247
256
|
key: requireString(reader, "key"),
|
|
@@ -424,14 +424,18 @@ export function compilePhiCmsDescriptorCatalog({ catalog, areaDefinitions, }) {
|
|
|
424
424
|
if (item.routePresetKey && item.overlayPresetKey) {
|
|
425
425
|
throw new Error(`${label}/${item.itemKey}: an item goes to a route or opens an Overlay, never both.`);
|
|
426
426
|
}
|
|
427
|
-
//
|
|
428
|
-
const
|
|
429
|
-
if (
|
|
427
|
+
// An external address is a Module's injected entry only; another Area's root either may name.
|
|
428
|
+
const target = item.target;
|
|
429
|
+
if (target !== undefined) {
|
|
430
430
|
if (item.routePresetKey || item.overlayPresetKey || item.overlayNodeKey) {
|
|
431
|
-
throw new Error(`${label}/${item.itemKey}: an item leads to
|
|
432
|
-
|
|
431
|
+
throw new Error(`${label}/${item.itemKey}: an item leads to a target, a route or an Overlay, never more than one.`);
|
|
432
|
+
}
|
|
433
|
+
if (target.kind === "area") {
|
|
434
|
+
assertNavigationAreaTarget(target, area, `${label}/${item.itemKey}`);
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
assertNavigationExternalTarget(target, `${label}/${item.itemKey}`);
|
|
433
438
|
}
|
|
434
|
-
assertNavigationExternalTarget(externalTarget, `${label}/${item.itemKey}`);
|
|
435
439
|
}
|
|
436
440
|
if (item.overlayPresetKey && !item.overlayNodeKey) {
|
|
437
441
|
throw new Error(`${label}/${item.itemKey}: an Overlay reference needs both a preset key and a node key.`);
|
|
@@ -786,6 +790,18 @@ function assertNavigationExternalTarget(target, label) {
|
|
|
786
790
|
throw new Error(`${label}: an external navigation target's newTab must be a boolean.`);
|
|
787
791
|
}
|
|
788
792
|
}
|
|
793
|
+
/**
|
|
794
|
+
* Another Area's root: an Area this Site has, and not the surface's own -- a link to one's own root is
|
|
795
|
+
* a route of the Area's base Module, and is named as one.
|
|
796
|
+
*/
|
|
797
|
+
function assertNavigationAreaTarget(target, ownArea, label) {
|
|
798
|
+
if (!isPhiCmsAreaKey(target.area)) {
|
|
799
|
+
throw new Error(`${label}: an Area navigation target names an unknown Area "${String(target.area)}".`);
|
|
800
|
+
}
|
|
801
|
+
if (target.area === ownArea) {
|
|
802
|
+
throw new Error(`${label}: an Area navigation target must lead to another Area than "${ownArea}".`);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
789
805
|
/**
|
|
790
806
|
* What an item points at, if anything currently answers there.
|
|
791
807
|
*
|
|
@@ -801,6 +817,10 @@ function assertNavigationExternalTarget(target, label) {
|
|
|
801
817
|
* turned down in the sidebar, linking `/`.
|
|
802
818
|
*/
|
|
803
819
|
function resolveNavigationTarget(routeTable, ownerModuleId, routePresetKey, overlay, external) {
|
|
820
|
+
if (external?.kind === "area") {
|
|
821
|
+
// The Area segment, which every renderer reads as that Area's root; the root forwards from there.
|
|
822
|
+
return { kind: "area", area: external.area, path: `/${external.area}` };
|
|
823
|
+
}
|
|
804
824
|
if (external) {
|
|
805
825
|
// The shape a Site's stored external link resolves to, so every surface renders both alike. The
|
|
806
826
|
// entry stays the Module's: `ownerModuleId` on the item, not the target, says whose it is.
|
|
@@ -838,7 +858,12 @@ function resolveNavigationTarget(routeTable, ownerModuleId, routePresetKey, over
|
|
|
838
858
|
function buildResolvedNavigationNode(catalog, routeTable, navKey, ownerModuleId, descriptor, injection) {
|
|
839
859
|
const target = resolveNavigationTarget(routeTable, ownerModuleId, descriptor.routePresetKey, descriptor.overlayPresetKey && descriptor.overlayNodeKey
|
|
840
860
|
? { presetKey: descriptor.overlayPresetKey, nodeKey: descriptor.overlayNodeKey }
|
|
841
|
-
: null,
|
|
861
|
+
: null, descriptor.target);
|
|
862
|
+
/*
|
|
863
|
+
* An Area entry that states no policy of its own is shown to whoever the target Area lets in: an entry
|
|
864
|
+
* leading to a door that turns the viewer away is a link nobody should have been offered.
|
|
865
|
+
*/
|
|
866
|
+
const accessPolicy = descriptor.accessPolicy ?? (descriptor.target?.kind === "area" ? catalog.areaDefinitions.get(descriptor.target.area)?.accessPolicy : undefined);
|
|
842
867
|
const intrinsicChildren = (descriptor.children ?? []).map((child) => buildResolvedNavigationNode(catalog, routeTable, navKey, ownerModuleId, child, null));
|
|
843
868
|
const sourceLocale = catalog.sourceLocaleByModuleId.get(ownerModuleId);
|
|
844
869
|
if (!sourceLocale) {
|
|
@@ -858,7 +883,7 @@ function buildResolvedNavigationNode(catalog, routeTable, navKey, ownerModuleId,
|
|
|
858
883
|
kind: target || descriptor.signalRoutes?.emits?.length ? "link" : "container",
|
|
859
884
|
label: { ...descriptor.label, sourceLocale },
|
|
860
885
|
...(descriptor.icon ? { icon: descriptor.icon } : {}),
|
|
861
|
-
...(
|
|
886
|
+
...(accessPolicy ? { accessPolicy } : {}),
|
|
862
887
|
...(descriptor.signalRoutes?.emits?.length
|
|
863
888
|
? { emits: descriptor.signalRoutes.emits }
|
|
864
889
|
: {}),
|
|
@@ -1397,7 +1397,7 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1397
1397
|
label: _jsx(PhiTypographyControl, { strong: true, children: "Font Family" }),
|
|
1398
1398
|
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: [fontSlots.map((item) => (_jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: item.label }), _jsx(PhiSelectControl, { ariaLabel: `${item.label} font`, value: item.authored ?? undefined, placeholder: item.inherited || "Not installed", options: fontOptions, allowClear: true, size: "medium", style: { minWidth: 0, flex: "1 1 auto" }, onChange: (value) => publishDraft(
|
|
1399
1399
|
// A cleared select reports nothing, which hands the slot back to the Set.
|
|
1400
|
-
mergeThemeFontSlot(state.draft, item.key, value ?? null)) })] }, item.key))), _jsx(PhiDividerControl, { style: { marginBlock: clientToken.paddingXXS } }), _jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: "Headings" }), _jsx(PhiSegmentedControl, { value: readPhiThemeHeadingFont(state.draft.typography), options: PHI_THEME_HEADING_FONT_OPTIONS, size: "small", onChange: (heading) => publishDraft(mergeThemeHeadingFont(state.draft, heading)) })] })] })),
|
|
1400
|
+
mergeThemeFontSlot(state.draft, item.key, value ?? null)) })] }, item.key))), siteFontAssets.options.length > 0 ? (_jsx(PhiTypographyControl, { type: "secondary", style: { fontSize: clientToken.fontSizeSM }, children: "Typefaces from the media library are delivered as subsets, which modifies the font file. Check that the font's licence permits subsetting before using it." })) : null, _jsx(PhiDividerControl, { style: { marginBlock: clientToken.paddingXXS } }), _jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: "Headings" }), _jsx(PhiSegmentedControl, { value: readPhiThemeHeadingFont(state.draft.typography), options: PHI_THEME_HEADING_FONT_OPTIONS, size: "small", onChange: (heading) => publishDraft(mergeThemeHeadingFont(state.draft, heading)) })] })] })),
|
|
1401
1401
|
},
|
|
1402
1402
|
{
|
|
1403
1403
|
key: "fontSize",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type PhiCmsReviewKind } from "../helpers/cms-scope-search-params";
|
|
2
|
+
export type { PhiCmsReviewKind };
|
|
3
|
+
export type PhiCmsReviewParams = {
|
|
4
|
+
kind: PhiCmsReviewKind;
|
|
5
|
+
revisionId: number;
|
|
6
|
+
area?: string | null;
|
|
7
|
+
page?: string | null;
|
|
8
|
+
navKey?: string | null;
|
|
9
|
+
themeKey?: string | null;
|
|
10
|
+
};
|
|
11
|
+
export declare function resolvePhiCmsReviewParams(searchParams?: Record<string, string | undefined>): PhiCmsReviewParams | null;
|
|
12
|
+
export declare function getPhiCmsReviewRevision(review: PhiCmsReviewParams | null | undefined, kind: PhiCmsReviewKind): number | null;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this request reads the Area or the Page as a revision Core had to authorize.
|
|
15
|
+
*
|
|
16
|
+
* `revision` and a review of kind `area` or `page` are passed on to Core's Area and Page reads, and
|
|
17
|
+
* Core answers them only to a viewer it allows to preview (`requireSiteCmsPreviewApiContext`); a
|
|
18
|
+
* refusal comes back as 401/403 before anything renders. That is what lets the Area access guard step
|
|
19
|
+
* aside for such a request: somebody else has already decided. A review of kind `navigation` or
|
|
20
|
+
* `theme` changes neither read -- the Area and the Page come back live, unauthorized -- so it is no
|
|
21
|
+
* reason to step aside. Deciding on "any valid review" did exactly that, and
|
|
22
|
+
* `?reviewKind=navigation&reviewRevision=1` showed an anonymous visitor a staff Area's shell.
|
|
23
|
+
*/
|
|
24
|
+
export declare function hasPhiCmsAuthorizedPreviewRead(searchParams?: Record<string, string | undefined>): boolean;
|
|
25
|
+
export declare function resolvePhiCmsRevisionFromSearchParams(searchParams?: Record<string, string | undefined>): number | null;
|