@phis/ui 0.4.23 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/controls/phi-background-control.js +1 -1
- package/components/controls/phi-breadcrumb-control.d.ts +2 -0
- package/components/controls/phi-button-control.d.ts +7 -1
- 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-asset-folder-control.js +1 -1
- 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/content-entry-editor-page-tree.js +1 -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/regions/presets/phi-settings-page-shell-tree.js +1 -1
- package/components/shell/phi-antd-icon.d.ts +4 -0
- package/components/shell/phi-antd-icon.js +8 -0
- package/components/shell/phi-icon.d.ts +18 -0
- package/components/shell/phi-icon.js +50 -3
- package/components/widgets/client/shared/phi-button-icons.d.ts +7 -0
- package/components/widgets/client/shared/phi-button-icons.js +15 -67
- 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/label-types/common-controls.js +12 -12
- 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/accounting/presets.d.ts +10 -1
- package/plugins/runtime-modules/accounting/presets.js +25 -8
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-area-preset-tree.d.ts +6 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-area-preset-tree.js +53 -0
- package/plugins/runtime-modules/area-definitions.d.ts +123 -12
- package/plugins/runtime-modules/area-definitions.js +28 -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/asset/trees/phi-default-builder-media-page-tree.js +1 -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-builder-inspector-area-overlay-tree.server.js +2 -2
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +16 -4
- 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/image/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/image/editor.js +1 -1
- 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/groups/trees/phi-default-admin-groups-page-tree.js +1 -1
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +1 -1
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +1 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +1 -1
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +2 -2
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.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/styles/controls.css +11 -0
- 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
|
@@ -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
|
});
|
|
@@ -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",
|
|
@@ -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
|
: {}),
|
|
@@ -84,7 +84,7 @@ export async function buildPhiDefaultAdminGroupsPageTree({ page, runtime, }) {
|
|
|
84
84
|
config: {
|
|
85
85
|
key: `admin-groups-${workflow}-commands`,
|
|
86
86
|
buttons: [
|
|
87
|
-
{ key: "cancel", emits: [{ capabilityId: "close", value: null }], label: labels.actions.cancel, icon: "
|
|
87
|
+
{ key: "cancel", emits: [{ capabilityId: "close", value: null }], label: labels.actions.cancel, icon: "close" },
|
|
88
88
|
{ key: "save", emits: [{ capabilityId: "submit", value: null }], label: text.submit, variant: "primary", icon: "save" },
|
|
89
89
|
],
|
|
90
90
|
signalRoutes: {
|
package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js
CHANGED
|
@@ -303,7 +303,7 @@ export async function buildPhiDefaultEditorTranslationsPageTree({ page, runtime,
|
|
|
303
303
|
key: "editor-translation-commands",
|
|
304
304
|
...PHI_DIALOG_COMMANDS_CONFIG,
|
|
305
305
|
buttons: [
|
|
306
|
-
{ key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.actions.cancel, icon: "
|
|
306
|
+
{ key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.actions.cancel, icon: "close" },
|
|
307
307
|
{ key: "save", emits: [{ capabilityId: "command", value: "save" }], label: widgetLabels.actions.save, variant: "primary", icon: "save" },
|
|
308
308
|
],
|
|
309
309
|
signalRoutes: {
|
|
@@ -356,7 +356,7 @@ export async function buildPhiDefaultBuilderRevisionsPageTree({ page, runtime, }
|
|
|
356
356
|
key: "cancel",
|
|
357
357
|
emits: [{ capabilityId: "close", value: null }],
|
|
358
358
|
label: revisionsLabels.deleteArea.cancel,
|
|
359
|
-
icon: "
|
|
359
|
+
icon: "close",
|
|
360
360
|
},
|
|
361
361
|
{
|
|
362
362
|
key: "confirm",
|
|
@@ -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",
|
|
@@ -104,7 +104,7 @@ export async function buildPhiDefaultThreadsPageTree({ page, runtime, area, }) {
|
|
|
104
104
|
config: {
|
|
105
105
|
key: "app-threads-reply-commands",
|
|
106
106
|
buttons: [
|
|
107
|
-
{ key: "cancel", emits: [{ capabilityId: "close", value: null }], action: "cancel", icon: "
|
|
107
|
+
{ key: "cancel", emits: [{ capabilityId: "close", value: null }], action: "cancel", icon: "close" },
|
|
108
108
|
{
|
|
109
109
|
key: "submit",
|
|
110
110
|
emits: [{ capabilityId: "submit", value: null }],
|
|
@@ -643,7 +643,7 @@ export async function buildPhiDefaultThreadsPageTree({ page, runtime, area, }) {
|
|
|
643
643
|
key: "app-threads-new-commands",
|
|
644
644
|
...PHI_DIALOG_COMMANDS_CONFIG,
|
|
645
645
|
buttons: [
|
|
646
|
-
{ key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: labels.cancelLabel, icon: "
|
|
646
|
+
{ key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: labels.cancelLabel, icon: "close" },
|
|
647
647
|
{ key: "save", emits: [{ capabilityId: "command", value: "save" }], label: labels.openConversationLabel, variant: "primary", icon: "save" },
|
|
648
648
|
],
|
|
649
649
|
signalRoutes: {
|
|
@@ -545,7 +545,7 @@ export async function buildPhiDefaultAdminUsersPageTree({ page, runtime, }) {
|
|
|
545
545
|
key: `admin-users-${mode}-commands`,
|
|
546
546
|
...PHI_DIALOG_COMMANDS_CONFIG,
|
|
547
547
|
buttons: [
|
|
548
|
-
{ key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.confirm.cancel, icon: "
|
|
548
|
+
{ key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.confirm.cancel, icon: "close" },
|
|
549
549
|
{ key: "save", emits: [{ capabilityId: "command", value: "save" }], label: saveLabel, variant: "primary", icon: "save" },
|
|
550
550
|
],
|
|
551
551
|
signalRoutes: {
|
|
@@ -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;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isPhiCmsReviewKind } from "../helpers/cms-scope-search-params";
|
|
2
|
+
function normalizeReviewKind(value) {
|
|
3
|
+
const normalized = value?.trim().toLowerCase();
|
|
4
|
+
return isPhiCmsReviewKind(normalized) ? normalized : null;
|
|
5
|
+
}
|
|
6
|
+
function normalizeOptionalString(value) {
|
|
7
|
+
const normalized = value?.trim();
|
|
8
|
+
return normalized ? normalized : null;
|
|
9
|
+
}
|
|
10
|
+
export function resolvePhiCmsReviewParams(searchParams) {
|
|
11
|
+
const kind = normalizeReviewKind(searchParams?.reviewKind);
|
|
12
|
+
const rawRevision = searchParams?.reviewRevision?.trim();
|
|
13
|
+
const revisionId = rawRevision ? Number(rawRevision) : null;
|
|
14
|
+
if (!kind || !Number.isInteger(revisionId) || revisionId <= 0) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
kind,
|
|
19
|
+
revisionId: revisionId,
|
|
20
|
+
area: normalizeOptionalString(searchParams?.reviewArea),
|
|
21
|
+
page: normalizeOptionalString(searchParams?.reviewPage),
|
|
22
|
+
navKey: normalizeOptionalString(searchParams?.reviewNavKey),
|
|
23
|
+
themeKey: normalizeOptionalString(searchParams?.reviewThemeKey),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export function getPhiCmsReviewRevision(review, kind) {
|
|
27
|
+
return review?.kind === kind ? review.revisionId : null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Whether this request reads the Area or the Page as a revision Core had to authorize.
|
|
31
|
+
*
|
|
32
|
+
* `revision` and a review of kind `area` or `page` are passed on to Core's Area and Page reads, and
|
|
33
|
+
* Core answers them only to a viewer it allows to preview (`requireSiteCmsPreviewApiContext`); a
|
|
34
|
+
* refusal comes back as 401/403 before anything renders. That is what lets the Area access guard step
|
|
35
|
+
* aside for such a request: somebody else has already decided. A review of kind `navigation` or
|
|
36
|
+
* `theme` changes neither read -- the Area and the Page come back live, unauthorized -- so it is no
|
|
37
|
+
* reason to step aside. Deciding on "any valid review" did exactly that, and
|
|
38
|
+
* `?reviewKind=navigation&reviewRevision=1` showed an anonymous visitor a staff Area's shell.
|
|
39
|
+
*/
|
|
40
|
+
export function hasPhiCmsAuthorizedPreviewRead(searchParams) {
|
|
41
|
+
if (resolvePhiCmsRevisionFromSearchParams(searchParams) != null) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
const review = resolvePhiCmsReviewParams(searchParams);
|
|
45
|
+
return review?.kind === "area" || review?.kind === "page";
|
|
46
|
+
}
|
|
47
|
+
export function resolvePhiCmsRevisionFromSearchParams(searchParams) {
|
|
48
|
+
const rawValue = searchParams?.revision;
|
|
49
|
+
if (!rawValue?.trim()) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
const parsed = Number(rawValue);
|
|
53
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
|
|
54
|
+
}
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import type { PhiSiteRequestContext } from "../types/site-request-context";
|
|
3
|
-
|
|
4
|
-
export type { PhiCmsReviewKind };
|
|
5
|
-
export type PhiCmsReviewParams = {
|
|
6
|
-
kind: PhiCmsReviewKind;
|
|
7
|
-
revisionId: number;
|
|
8
|
-
area?: string | null;
|
|
9
|
-
page?: string | null;
|
|
10
|
-
navKey?: string | null;
|
|
11
|
-
themeKey?: string | null;
|
|
12
|
-
};
|
|
13
|
-
export declare function resolvePhiCmsReviewParams(searchParams?: Record<string, string | undefined>): PhiCmsReviewParams | null;
|
|
14
|
-
export declare function getPhiCmsReviewRevision(review: PhiCmsReviewParams | null | undefined, kind: PhiCmsReviewKind): number | null;
|
|
15
|
-
/**
|
|
16
|
-
* Whether this request reads the Area or the Page as a revision Core had to authorize.
|
|
17
|
-
*
|
|
18
|
-
* `revision` and a review of kind `area` or `page` are passed on to Core's Area and Page reads, and
|
|
19
|
-
* Core answers them only to a viewer it allows to preview (`requireSiteCmsPreviewApiContext`); a
|
|
20
|
-
* refusal comes back as 401/403 before anything renders. That is what lets the Area access guard step
|
|
21
|
-
* aside for such a request: somebody else has already decided. A review of kind `navigation` or
|
|
22
|
-
* `theme` changes neither read -- the Area and the Page come back live, unauthorized -- so it is no
|
|
23
|
-
* reason to step aside. Deciding on "any valid review" did exactly that, and
|
|
24
|
-
* `?reviewKind=navigation&reviewRevision=1` showed an anonymous visitor a staff Area's shell.
|
|
25
|
-
*/
|
|
26
|
-
export declare function hasPhiCmsAuthorizedPreviewRead(searchParams?: Record<string, string | undefined>): boolean;
|
|
27
|
-
export declare function resolvePhiCmsRevisionFromSearchParams(searchParams?: Record<string, string | undefined>): number | null;
|
|
3
|
+
export { getPhiCmsReviewRevision, hasPhiCmsAuthorizedPreviewRead, resolvePhiCmsReviewParams, resolvePhiCmsRevisionFromSearchParams, type PhiCmsReviewKind, type PhiCmsReviewParams, } from "./cms-review-params";
|
|
28
4
|
export declare function resolvePhiCmsThemeReviewRequestContext({ requestContext, searchParams, cookieHeader, }: {
|
|
29
5
|
requestContext: PhiSiteRequestContext;
|
|
30
6
|
searchParams?: Record<string, string | undefined>;
|
|
@@ -1,60 +1,8 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import { getSiteThemeRevision } from "../gateway/site-theme";
|
|
3
3
|
import { readPhiServerApiCredentials } from "../helpers/phis-server-credentials";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const normalized = value?.trim().toLowerCase();
|
|
7
|
-
return isPhiCmsReviewKind(normalized) ? normalized : null;
|
|
8
|
-
}
|
|
9
|
-
function normalizeOptionalString(value) {
|
|
10
|
-
const normalized = value?.trim();
|
|
11
|
-
return normalized ? normalized : null;
|
|
12
|
-
}
|
|
13
|
-
export function resolvePhiCmsReviewParams(searchParams) {
|
|
14
|
-
const kind = normalizeReviewKind(searchParams?.reviewKind);
|
|
15
|
-
const rawRevision = searchParams?.reviewRevision?.trim();
|
|
16
|
-
const revisionId = rawRevision ? Number(rawRevision) : null;
|
|
17
|
-
if (!kind || !Number.isInteger(revisionId) || revisionId <= 0) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
kind,
|
|
22
|
-
revisionId: revisionId,
|
|
23
|
-
area: normalizeOptionalString(searchParams?.reviewArea),
|
|
24
|
-
page: normalizeOptionalString(searchParams?.reviewPage),
|
|
25
|
-
navKey: normalizeOptionalString(searchParams?.reviewNavKey),
|
|
26
|
-
themeKey: normalizeOptionalString(searchParams?.reviewThemeKey),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export function getPhiCmsReviewRevision(review, kind) {
|
|
30
|
-
return review?.kind === kind ? review.revisionId : null;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Whether this request reads the Area or the Page as a revision Core had to authorize.
|
|
34
|
-
*
|
|
35
|
-
* `revision` and a review of kind `area` or `page` are passed on to Core's Area and Page reads, and
|
|
36
|
-
* Core answers them only to a viewer it allows to preview (`requireSiteCmsPreviewApiContext`); a
|
|
37
|
-
* refusal comes back as 401/403 before anything renders. That is what lets the Area access guard step
|
|
38
|
-
* aside for such a request: somebody else has already decided. A review of kind `navigation` or
|
|
39
|
-
* `theme` changes neither read -- the Area and the Page come back live, unauthorized -- so it is no
|
|
40
|
-
* reason to step aside. Deciding on "any valid review" did exactly that, and
|
|
41
|
-
* `?reviewKind=navigation&reviewRevision=1` showed an anonymous visitor a staff Area's shell.
|
|
42
|
-
*/
|
|
43
|
-
export function hasPhiCmsAuthorizedPreviewRead(searchParams) {
|
|
44
|
-
if (resolvePhiCmsRevisionFromSearchParams(searchParams) != null) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
const review = resolvePhiCmsReviewParams(searchParams);
|
|
48
|
-
return review?.kind === "area" || review?.kind === "page";
|
|
49
|
-
}
|
|
50
|
-
export function resolvePhiCmsRevisionFromSearchParams(searchParams) {
|
|
51
|
-
const rawValue = searchParams?.revision;
|
|
52
|
-
if (!rawValue?.trim()) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
const parsed = Number(rawValue);
|
|
56
|
-
return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
|
|
57
|
-
}
|
|
4
|
+
import { getPhiCmsReviewRevision, resolvePhiCmsReviewParams } from "./cms-review-params";
|
|
5
|
+
export { getPhiCmsReviewRevision, hasPhiCmsAuthorizedPreviewRead, resolvePhiCmsReviewParams, resolvePhiCmsRevisionFromSearchParams, } from "./cms-review-params";
|
|
58
6
|
export async function resolvePhiCmsThemeReviewRequestContext({ requestContext, searchParams, cookieHeader, }) {
|
|
59
7
|
const review = resolvePhiCmsReviewParams(searchParams);
|
|
60
8
|
const themeRevision = getPhiCmsReviewRevision(review, "theme");
|
package/styles/controls.css
CHANGED
|
@@ -369,6 +369,8 @@ h5.phi-typography, .phi-typography h5 {
|
|
|
369
369
|
--phi-card-control-radius: var(--phi-surface-radius);
|
|
370
370
|
--phi-card-control-line: var(--ant-line-width) var(--ant-line-type) var(--ant-color-border-secondary);
|
|
371
371
|
position: relative;
|
|
372
|
+
display: flex;
|
|
373
|
+
flex-direction: column;
|
|
372
374
|
box-sizing: border-box;
|
|
373
375
|
min-width: 0;
|
|
374
376
|
border: var(--phi-card-control-line);
|
|
@@ -428,7 +430,16 @@ h5.phi-typography, .phi-typography h5 {
|
|
|
428
430
|
border-radius: var(--phi-card-control-radius) var(--phi-card-control-radius) 0 0;
|
|
429
431
|
}
|
|
430
432
|
|
|
433
|
+
/*
|
|
434
|
+
* The body takes whatever height the box is given beyond its head and cover. A Card stretched to its row
|
|
435
|
+
* in a grid of Cards is taller than its own content, and the body is where that height belongs: a caller
|
|
436
|
+
* whose content is a column of its own (`height: 100%`) can then push its last part -- a price and a
|
|
437
|
+
* button -- to the bottom edge, so a row of Cards lines up there. A box that is only as tall as its
|
|
438
|
+
* content gains nothing and loses nothing. The basis is 0 rather than `auto` so the height is definite
|
|
439
|
+
* where the box's is, which is what lets that `100%` resolve at all.
|
|
440
|
+
*/
|
|
431
441
|
.phi-card-control__body {
|
|
442
|
+
flex: 1 0 0;
|
|
432
443
|
border-radius: 0 0 var(--phi-card-control-radius) var(--phi-card-control-radius);
|
|
433
444
|
}
|
|
434
445
|
|