@phis/ui 0.4.20 → 0.4.22
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/cms/phi-cms-layout-renderer.js +1 -1
- package/components/controls/phi-brand-control.d.ts +4 -1
- package/components/controls/phi-brand-control.js +10 -6
- package/components/controls/phi-cascader-control.js +6 -1
- package/components/controls/phi-geometry-control.d.ts +33 -1
- package/components/controls/phi-geometry-control.js +87 -29
- package/components/controls/phi-series-chart-control.js +4 -2
- package/components/forms/form-provider-contract.d.ts +1 -0
- package/components/forms/form-provider-contract.js +1 -0
- package/components/forms/upload-form-control.js +1 -0
- package/components/layouts/clients/phi-flex-layout-client.js +23 -5
- package/components/layouts/clients/phi-grid-layout-client.js +20 -10
- package/components/layouts/clients/phi-layout-anchored-overlay.d.ts +2 -0
- package/components/layouts/clients/phi-layout-anchored-overlay.js +9 -2
- package/components/layouts/clients/phi-three-column-layout-client.js +7 -4
- package/components/layouts/layout-definitions.d.ts +16 -16
- package/components/layouts/layout-definitions.js +8 -8
- package/components/layouts/phi-base-layout.js +13 -9
- package/components/layouts/phi-layout-contract.d.ts +12 -2
- package/components/layouts/phi-layout-contract.js +30 -7
- package/components/layouts/phi-masonry-layout.d.ts +6 -0
- package/components/layouts/phi-masonry-layout.js +13 -3
- package/components/layouts/plugins/masonry-layout-plugin.js +2 -1
- package/components/media/asset-collection-runtime.d.ts +1 -6
- package/components/media/asset-collection-runtime.js +2 -93
- package/components/media/label-sets/media.js +12 -0
- package/components/media/media-folder-lock.d.ts +19 -0
- package/components/media/media-folder-lock.js +40 -0
- package/components/media/media-folder-options.d.ts +14 -2
- package/components/media/media-folder-options.js +17 -5
- package/components/media/media-widget-labels.d.ts +9 -0
- package/components/media/media-widget-labels.js +6 -0
- package/components/media/phi-area-upload-widget.js +1 -0
- package/components/media/phi-asset-folder-control.d.ts +14 -1
- package/components/media/phi-asset-folder-control.js +11 -4
- package/components/media/phi-image-preview-store.d.ts +0 -4
- package/components/media/phi-image-preview-store.js +0 -10
- package/components/media/phi-media-picker-binding.d.ts +7 -2
- package/components/media/phi-media-upload.d.ts +2 -0
- package/components/media/phi-media-upload.js +3 -0
- package/components/regions/clients/cms-region-container-client.d.ts +3 -1
- package/components/regions/clients/cms-region-container-client.js +4 -3
- package/components/regions/phi-cms-region-container.d.ts +3 -1
- package/components/regions/phi-cms-region-container.js +3 -2
- package/components/regions/phi-cms-region-shell.d.ts +9 -1
- package/components/regions/phi-cms-region-shell.js +3 -1
- package/components/regions/phi-cms-region-static.d.ts +3 -1
- package/components/regions/phi-cms-region-static.js +3 -2
- package/components/regions/presets/navigation-redirect.d.ts +2 -2
- package/components/regions/presets/navigation-redirect.js +5 -3
- package/components/shell/phi-antd-icon.d.ts +2 -0
- package/components/shell/phi-antd-icon.js +6 -0
- package/components/widgets/label-sets/geometry.js +10 -0
- package/components/widgets/label-types/geometry.d.ts +7 -0
- package/components/widgets/label-types/geometry.js +6 -0
- package/helpers/block-geometry-profiles.d.ts +67 -0
- package/helpers/block-geometry-profiles.js +105 -0
- package/helpers/cms-navigation-catalog.js +4 -2
- package/helpers/renderable-block-effects.js +16 -0
- package/package.json +1 -1
- package/plugins/runtime/phi-slot-child-frame-view.js +14 -4
- package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +42 -2
- package/plugins/runtime/slot-size-policy.d.ts +15 -0
- package/plugins/runtime/slot-size-policy.js +29 -0
- package/plugins/runtime-modules/asset/data-providers.js +3 -0
- package/plugins/runtime-modules/asset/services/collection.js +34 -0
- package/plugins/runtime-modules/asset/services/options.js +19 -2
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +9 -0
- package/plugins/runtime-modules/auth/trees/phi-auth-runtime-page-tree.js +21 -17
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/client.js +2 -0
- package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
- package/plugins/runtime-modules/builder/render-root-node-preview.server.js +2 -1
- package/plugins/runtime-modules/builder/services/navigation-table.js +3 -2
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +7 -1
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +8 -2
- package/plugins/runtime-modules/core/messaging/data-providers.js +23 -0
- package/plugins/runtime-modules/core/messaging/labels.d.ts +2 -0
- package/plugins/runtime-modules/core/messaging/labels.js +8 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +32 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +31 -16
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +52 -6
- package/plugins/runtime-modules/core/widgets/quick-links/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +8 -2
- package/plugins/runtime-modules/descriptor-compiler.js +45 -2
- package/plugins/runtime-modules/public/presets.d.ts +1 -1
- package/plugins/runtime-modules/public/presets.js +1 -0
- package/plugins/runtime-modules/public/trees/phi-default-pub-welcome-page-tree.js +8 -14
- package/plugins/runtime-modules/search/widgets/search-box/client.d.ts +2 -1
- package/plugins/runtime-modules/search/widgets/search-box/client.js +28 -6
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +19 -2
- package/plugins/runtime-modules/threads/labels.d.ts +6 -0
- package/plugins/runtime-modules/threads/labels.js +16 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +24 -1
- package/styles/layout.css +101 -0
- package/styles/root.css +2 -1
- package/types/cms-config.d.ts +5 -1
- package/types/cms-config.js +1 -0
- package/types/cms-module-descriptors.d.ts +17 -0
- package/types/renderable-block.d.ts +5 -0
- package/types/site-theme.d.ts +9 -1
- package/types.d.ts +1 -1
|
@@ -793,7 +793,7 @@ export async function PhiCmsLayoutRenderer({ tree, runtime, regionClassName, reg
|
|
|
793
793
|
layoutPluginsByType.get(resolveLayoutRegistryType(root.widgetType))?.runtimeSignals != null,
|
|
794
794
|
})
|
|
795
795
|
: null;
|
|
796
|
-
return (_jsx(PhiCmsRegionContainer, { className: regionClassName, regionKey: regionKey, regionType: region.regionType, config: region.config, pageScope: resolvePhiCmsRegionPageScope(readPhiCmsRegionPageScope(regionKey, region.config), links, runtime.site.availableLocales.map((option) => option.code)), shellTheme: runtime.site.theme?.shell, previewMode: root?.config.renderMode === "preview", rootPaintsGround: phiCmsRegionRootLayoutPaintsGround(root?.config), runtime: runtime, signalParticipant: signalParticipants.has(createPhiSignalAddress("region", regionKey)), children: renderedRoot }, `region-${region.id}`));
|
|
796
|
+
return (_jsx(PhiCmsRegionContainer, { className: regionClassName, regionKey: regionKey, regionType: region.regionType, config: region.config, pageScope: resolvePhiCmsRegionPageScope(readPhiCmsRegionPageScope(regionKey, region.config), links, runtime.site.availableLocales.map((option) => option.code)), shellTheme: runtime.site.theme?.shell, previewMode: root?.config.renderMode === "preview", rootPaintsGround: phiCmsRegionRootLayoutPaintsGround(root?.config), rootQueriesRoom: root != null && resolvePhiSlotChildSizingForConfig("layout", undefined, root.config).queriesRoom, runtime: runtime, signalParticipant: signalParticipants.has(createPhiSignalAddress("region", regionKey)), children: renderedRoot }, `region-${region.id}`));
|
|
797
797
|
});
|
|
798
798
|
if (renderedRegions.length === 1) {
|
|
799
799
|
return renderedRegions[0];
|
|
@@ -14,7 +14,10 @@ export type PhiBrandControlProps = {
|
|
|
14
14
|
/** The Site's own name, for a Brand that has no Wordmark parts of its own. */
|
|
15
15
|
fallbackTitle?: ReactNode;
|
|
16
16
|
shows?: PhiBrandControlShows;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The mode being drawn: a Logo is artwork in fixed colours, one picture per mode, and a Wordmark part
|
|
19
|
+
* has one colour per mode for the same reason.
|
|
20
|
+
*/
|
|
18
21
|
mode: PhiThemeMode;
|
|
19
22
|
};
|
|
20
23
|
/**
|
|
@@ -37,7 +37,7 @@ function hasWordmarkParts(parts) {
|
|
|
37
37
|
function wordmarkIsSwitchedOff(wordmark) {
|
|
38
38
|
return wordmark?.shows === "none";
|
|
39
39
|
}
|
|
40
|
-
function renderWordmark(wordmark, fallbackTitle, fallbackStyle) {
|
|
40
|
+
function renderWordmark(wordmark, mode, fallbackTitle, fallbackStyle) {
|
|
41
41
|
if (wordmarkIsSwitchedOff(wordmark)) {
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
@@ -57,10 +57,14 @@ function renderWordmark(wordmark, fallbackTitle, fallbackStyle) {
|
|
|
57
57
|
if (!hasWordmarkParts(wordmark?.parts)) {
|
|
58
58
|
return fallbackTitle ? _jsx("strong", { style: wordmarkStyle, children: fallbackTitle }) : null;
|
|
59
59
|
}
|
|
60
|
-
return (_jsx("span", { style: wordmarkStyle, children: wordmark.parts.map((part, index) =>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
return (_jsx("span", { style: wordmarkStyle, children: wordmark.parts.map((part, index) => {
|
|
61
|
+
// The mode's own colour; a mode that names none takes the colour around it.
|
|
62
|
+
const color = part.color?.[mode];
|
|
63
|
+
return (_jsx("span", { style: {
|
|
64
|
+
...(color ? { color } : {}),
|
|
65
|
+
...(part.fontWeight ? { fontWeight: part.fontWeight } : {}),
|
|
66
|
+
}, children: part.text }, `${part.text}-${index}`));
|
|
67
|
+
}) }));
|
|
64
68
|
}
|
|
65
69
|
/**
|
|
66
70
|
* One of the two lines a Brand carries: what it says, with its icon in front of it.
|
|
@@ -120,7 +124,7 @@ export function PhiBrandControl({ brand, fallbackTitle, shows = "lockup", mode,
|
|
|
120
124
|
: brand?.eyebrow ?? null;
|
|
121
125
|
const wordmarkNode = shows === "logo"
|
|
122
126
|
? null
|
|
123
|
-
: renderWordmark(brand?.wordmark, fallbackTitle, {
|
|
127
|
+
: renderWordmark(brand?.wordmark, mode, fallbackTitle, {
|
|
124
128
|
fontSize: PHI_FONT_SIZE_XL,
|
|
125
129
|
lineHeight: PHI_LINE_HEIGHT_LG,
|
|
126
130
|
});
|
|
@@ -5,6 +5,7 @@ import { Cascader } from "antd";
|
|
|
5
5
|
import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
|
|
6
6
|
import { PhiDescriptionHint } from "./phi-description-tooltip-icon";
|
|
7
7
|
import { usePhiConfig } from "../root/phi-config-provider";
|
|
8
|
+
import { PhiIcon } from "../shell/phi-icon";
|
|
8
9
|
export function normalizePhiCascaderValue(value, options) {
|
|
9
10
|
const separator = options?.separator?.trim() || "/";
|
|
10
11
|
const rootValue = options?.rootValue?.trim() || "/";
|
|
@@ -112,6 +113,10 @@ function insertCascaderOption(options, option, allowRoot, separator, rootValue,
|
|
|
112
113
|
if (index === segments.length - 1 && option.description && current.description == null) {
|
|
113
114
|
current.description = option.description;
|
|
114
115
|
}
|
|
116
|
+
// The option's icon, like its description, belongs to its own entry and travels to the row drawn for it.
|
|
117
|
+
if (index === segments.length - 1 && option.icon && current.icon == null) {
|
|
118
|
+
current.icon = option.icon;
|
|
119
|
+
}
|
|
115
120
|
if (index < segments.length - 1) {
|
|
116
121
|
current.children = current.children ?? [];
|
|
117
122
|
currentOptions = current.children;
|
|
@@ -168,7 +173,7 @@ export function PhiCascaderControl({ value, options, allowRoot = true, allowClea
|
|
|
168
173
|
* its own target before the label, so passing over the rows does not fire it. The label stays a
|
|
169
174
|
* string on the option, because the search matches and highlights it.
|
|
170
175
|
*/
|
|
171
|
-
optionRender: (option) => option.description ? (_jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: token.paddingXS, minWidth: 0 }, children: [_jsx(PhiDescriptionHint, { description: option.description }), option.label] })) : option.label, placeholder: placeholder, size: size, searchValue: searchValue, showSearch: true, value: cascaderValue, classNames: classNames, getPopupContainer: getPopupContainer, onFocus: onFocus, onBlur: () => {
|
|
176
|
+
optionRender: (option) => option.description || typeof option.icon === "string" ? (_jsxs("span", { style: { display: "inline-flex", alignItems: "center", gap: token.paddingXS, minWidth: 0 }, children: [option.description ? _jsx(PhiDescriptionHint, { description: option.description }) : null, typeof option.icon === "string" ? _jsx(PhiIcon, { name: option.icon, size: 14 }) : null, option.label] })) : option.label, placeholder: placeholder, size: size, searchValue: searchValue, showSearch: true, value: cascaderValue, classNames: classNames, getPopupContainer: getPopupContainer, onFocus: onFocus, onBlur: () => {
|
|
172
177
|
if (searchValue.trim()) {
|
|
173
178
|
commit(searchValue);
|
|
174
179
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PhiResponsiveLength } from "../../types/renderable-block";
|
|
1
2
|
import { type PhiCmsGeometryWidgetConfig } from "../widgets/config/geometry";
|
|
2
3
|
import { type PhiGeometryWidgetLabels } from "../widgets/label-types/geometry";
|
|
3
4
|
import type { PhiWidgetControlMode } from "../../types/widget-ui";
|
|
@@ -9,7 +10,38 @@ export type PhiGeometryControlProps = {
|
|
|
9
10
|
showSticky?: boolean;
|
|
10
11
|
showOffsetTop?: boolean;
|
|
11
12
|
showViewport?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Offer a value per profile for size, minimum and maximum (design/RESPONSIVE_BLOCK_GEOMETRY.md). Off
|
|
15
|
+
* for a Region, whose own geometry is not a slot child's and answers at one value.
|
|
16
|
+
*/
|
|
17
|
+
showProfiles?: boolean;
|
|
12
18
|
labels?: PhiGeometryWidgetLabels;
|
|
13
19
|
onChange?: (value: PhiCmsGeometryWidgetConfig) => void;
|
|
14
20
|
};
|
|
15
|
-
|
|
21
|
+
/** The three rooms a length may answer differently, narrow first -- the order the Control asks in. */
|
|
22
|
+
export declare const PHI_GEOMETRY_PROFILES: readonly ["compact", "medium", "wide"];
|
|
23
|
+
export type PhiGeometryProfile = (typeof PHI_GEOMETRY_PROFILES)[number];
|
|
24
|
+
type PhiStoredLength = number | string;
|
|
25
|
+
/**
|
|
26
|
+
* The value a stored length states at one profile, and what it falls back to there.
|
|
27
|
+
*
|
|
28
|
+
* `stated` is the entry the author wrote for that profile -- for a plain length, the length at
|
|
29
|
+
* `compact` and nothing at the other two. `inherited` is what applies when the entry is empty: the
|
|
30
|
+
* cascade runs upward from `compact` (`medium` falls back to it, `wide` to `medium`), the reading
|
|
31
|
+
* `resolvePhiRenderableBlockGeometry` makes, so the Control shows the value that stands there as the
|
|
32
|
+
* placeholder rather than an empty field that looks like "auto".
|
|
33
|
+
*/
|
|
34
|
+
export declare function readPhiGeometryProfileLength(value: PhiResponsiveLength | undefined, profile: PhiGeometryProfile): {
|
|
35
|
+
stated: PhiStoredLength | null;
|
|
36
|
+
inherited: PhiStoredLength | null;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* One profile's entry written into a stored length, the other two left where the author put them.
|
|
40
|
+
*
|
|
41
|
+
* The stored form stays the smallest one that means the same: a length that names only `compact` is
|
|
42
|
+
* the plain length -- the same at every profile, byte for byte what a config without profiles holds --
|
|
43
|
+
* and one that names nothing is nothing.
|
|
44
|
+
*/
|
|
45
|
+
export declare function writePhiGeometryProfileLength(stored: PhiResponsiveLength | undefined, profile: PhiGeometryProfile, next: PhiStoredLength | null | undefined): PhiResponsiveLength;
|
|
46
|
+
export declare function PhiGeometryControl({ value, config, disabled, mode, showSticky, showOffsetTop, showViewport, showProfiles, labels, onChange, }: PhiGeometryControlProps): import("react").JSX.Element;
|
|
47
|
+
export {};
|
|
@@ -3,41 +3,86 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Divider, Flex, Typography } from "antd";
|
|
4
4
|
import { normalizePhiGeometryWidgetConfig, } from "../widgets/config/geometry";
|
|
5
5
|
import { PHI_GEOMETRY_WIDGET_DEFAULT_LABELS, } from "../widgets/label-types/geometry";
|
|
6
|
+
import { useState } from "react";
|
|
6
7
|
import { PhiDimensionControl } from "./phi-dimension-control";
|
|
8
|
+
import { PhiSegmentedControl } from "./phi-segmented-control";
|
|
7
9
|
import { PhiFlexControl } from "./phi-flex-control";
|
|
8
10
|
import { PhiLengthControl } from "./phi-length-control";
|
|
9
11
|
import { PhiNumberControl } from "./phi-number-control";
|
|
10
12
|
import { PhiViewportVisibilityControl } from "./phi-viewport-visibility-control";
|
|
11
13
|
import { PhiSwitchControl } from "./phi-switch-control";
|
|
14
|
+
/** The three rooms a length may answer differently, narrow first -- the order the Control asks in. */
|
|
15
|
+
export const PHI_GEOMETRY_PROFILES = ["compact", "medium", "wide"];
|
|
16
|
+
function isProfileLength(value) {
|
|
17
|
+
return typeof value === "object" && value !== null;
|
|
18
|
+
}
|
|
12
19
|
/**
|
|
13
|
-
* The
|
|
20
|
+
* The value a stored length states at one profile, and what it falls back to there.
|
|
14
21
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
22
|
+
* `stated` is the entry the author wrote for that profile -- for a plain length, the length at
|
|
23
|
+
* `compact` and nothing at the other two. `inherited` is what applies when the entry is empty: the
|
|
24
|
+
* cascade runs upward from `compact` (`medium` falls back to it, `wide` to `medium`), the reading
|
|
25
|
+
* `resolvePhiRenderableBlockGeometry` makes, so the Control shows the value that stands there as the
|
|
26
|
+
* placeholder rather than an empty field that looks like "auto".
|
|
20
27
|
*/
|
|
21
|
-
function
|
|
22
|
-
|
|
28
|
+
export function readPhiGeometryProfileLength(value, profile) {
|
|
29
|
+
if (!isProfileLength(value)) {
|
|
30
|
+
const plain = value ?? null;
|
|
31
|
+
return profile === "compact" ? { stated: plain, inherited: null } : { stated: null, inherited: plain };
|
|
32
|
+
}
|
|
33
|
+
const stated = value[profile] ?? null;
|
|
34
|
+
const inherited = profile === "compact"
|
|
35
|
+
? null
|
|
36
|
+
: profile === "medium"
|
|
37
|
+
? value.compact ?? null
|
|
38
|
+
: value.medium ?? value.compact ?? null;
|
|
39
|
+
return { stated, inherited };
|
|
23
40
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
41
|
+
/**
|
|
42
|
+
* One profile's entry written into a stored length, the other two left where the author put them.
|
|
43
|
+
*
|
|
44
|
+
* The stored form stays the smallest one that means the same: a length that names only `compact` is
|
|
45
|
+
* the plain length -- the same at every profile, byte for byte what a config without profiles holds --
|
|
46
|
+
* and one that names nothing is nothing.
|
|
47
|
+
*/
|
|
48
|
+
export function writePhiGeometryProfileLength(stored, profile, next) {
|
|
49
|
+
const entries = isProfileLength(stored)
|
|
50
|
+
? { ...stored }
|
|
51
|
+
: stored == null
|
|
52
|
+
? {}
|
|
53
|
+
: { compact: stored };
|
|
54
|
+
if (next == null) {
|
|
55
|
+
delete entries[profile];
|
|
27
56
|
}
|
|
28
|
-
|
|
57
|
+
else {
|
|
58
|
+
entries[profile] = next;
|
|
59
|
+
}
|
|
60
|
+
const named = PHI_GEOMETRY_PROFILES.filter((key) => entries[key] != null);
|
|
61
|
+
if (named.length === 0) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
if (named.length === 1 && named[0] === "compact") {
|
|
65
|
+
return entries.compact ?? null;
|
|
66
|
+
}
|
|
67
|
+
return Object.fromEntries(named.map((key) => [key, entries[key]]));
|
|
29
68
|
}
|
|
30
|
-
function
|
|
69
|
+
function readProfilePair(pair, profile) {
|
|
70
|
+
const width = readPhiGeometryProfileLength(pair?.width, profile);
|
|
71
|
+
const height = readPhiGeometryProfileLength(pair?.height, profile);
|
|
31
72
|
return {
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
73
|
+
value: { width: width.stated, height: height.stated },
|
|
74
|
+
inherited: { width: width.inherited, height: height.inherited },
|
|
34
75
|
};
|
|
35
76
|
}
|
|
36
|
-
function
|
|
37
|
-
const width =
|
|
38
|
-
const height =
|
|
77
|
+
function writeProfilePair(stored, profile, next) {
|
|
78
|
+
const width = writePhiGeometryProfileLength(stored?.width, profile, next?.width);
|
|
79
|
+
const height = writePhiGeometryProfileLength(stored?.height, profile, next?.height);
|
|
39
80
|
return width == null && height == null ? undefined : { width, height };
|
|
40
81
|
}
|
|
82
|
+
/** Whether any of the three fields names a value at a profile other than `compact`. */
|
|
83
|
+
function statesProfiles(value) {
|
|
84
|
+
return [value.size, value.minSize, value.maxSize].some((pair) => isProfileLength(pair?.width) || isProfileLength(pair?.height));
|
|
85
|
+
}
|
|
41
86
|
function formatSizeValue(size) {
|
|
42
87
|
const width = size?.width;
|
|
43
88
|
const height = size?.height;
|
|
@@ -51,12 +96,20 @@ function formatSizeValue(size) {
|
|
|
51
96
|
function renderGeometryRow(label, content) {
|
|
52
97
|
return (_jsxs(Flex, { align: "center", gap: 12, wrap: false, style: { width: "100%" }, children: [_jsx(Typography.Text, { style: { flex: "0 0 128px", minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: label }), _jsx("div", { style: { flex: "1 1 auto", minWidth: 0 }, children: content })] }));
|
|
53
98
|
}
|
|
54
|
-
export function PhiGeometryControl({ value, config, disabled = false, mode = "control", showSticky = true, showOffsetTop = true, showViewport = true, labels = PHI_GEOMETRY_WIDGET_DEFAULT_LABELS, onChange, }) {
|
|
99
|
+
export function PhiGeometryControl({ value, config, disabled = false, mode = "control", showSticky = true, showOffsetTop = true, showViewport = true, showProfiles = true, labels = PHI_GEOMETRY_WIDGET_DEFAULT_LABELS, onChange, }) {
|
|
55
100
|
const currentValue = normalizePhiGeometryWidgetConfig(value ?? config ?? null);
|
|
56
101
|
const isDisabled = disabled || !onChange;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
102
|
+
/*
|
|
103
|
+
* Narrow first: the cascade runs upward from `compact`, so a block that names only `wide` has no
|
|
104
|
+
* stated size below 610 and is `auto` there -- the answer a narrow room gets is the one to set first.
|
|
105
|
+
*/
|
|
106
|
+
const [selectedProfile, setSelectedProfile] = useState("compact");
|
|
107
|
+
const profile = showProfiles ? selectedProfile : "compact";
|
|
108
|
+
const currentSize = readProfilePair(currentValue.size, profile);
|
|
109
|
+
const currentMinSize = readProfilePair(currentValue.minSize, profile);
|
|
110
|
+
const currentMaxSize = readProfilePair(currentValue.maxSize, profile);
|
|
111
|
+
/* An empty entry above `compact` shows what stands there through the cascade, not a bare "Width". */
|
|
112
|
+
const placeholder = (inherited) => inherited == null ? undefined : String(inherited);
|
|
60
113
|
function emit(nextValue) {
|
|
61
114
|
onChange?.(nextValue);
|
|
62
115
|
}
|
|
@@ -65,7 +118,7 @@ export function PhiGeometryControl({ value, config, disabled = false, mode = "co
|
|
|
65
118
|
? renderGeometryRow(labels.fields.offsetTop, _jsx(Typography.Text, { type: "secondary", children: currentValue.offsetTop != null
|
|
66
119
|
? String(currentValue.offsetTop)
|
|
67
120
|
: labels.placeholders.auto }))
|
|
68
|
-
: null, renderGeometryRow(labels.fields.size,
|
|
121
|
+
: null, renderGeometryRow(labels.fields.size, _jsxs(Typography.Text, { type: "secondary", children: [formatSizeValue(readProfilePair(currentValue.size, "compact").value), statesProfiles(currentValue) ? " …" : ""] })), renderGeometryRow(labels.fields.minSize, _jsx(Typography.Text, { type: "secondary", children: formatSizeValue(readProfilePair(currentValue.minSize, "compact").value) })), renderGeometryRow(labels.fields.maxSize, _jsx(Typography.Text, { type: "secondary", children: formatSizeValue(readProfilePair(currentValue.maxSize, "compact").value) })), renderGeometryRow(labels.fields.zIndex, _jsx(Typography.Text, { type: "secondary", children: String(currentValue.zIndex ?? 0) })), showViewport
|
|
69
122
|
? renderGeometryRow(labels.fields.viewport, _jsx(PhiViewportVisibilityControl, { value: currentValue.viewportFlags, labels: labels.viewport }))
|
|
70
123
|
: null] }));
|
|
71
124
|
}
|
|
@@ -79,15 +132,20 @@ export function PhiGeometryControl({ value, config, disabled = false, mode = "co
|
|
|
79
132
|
...currentValue,
|
|
80
133
|
offsetTop: nextValue ?? 0,
|
|
81
134
|
}), style: { width: "100%", maxWidth: 120, minWidth: 0 } }))
|
|
82
|
-
: null, showSticky || showOffsetTop ? _jsx(Divider, { dashed: true, size: "small" }) : null,
|
|
135
|
+
: null, showSticky || showOffsetTop ? _jsx(Divider, { dashed: true, size: "small" }) : null, showProfiles
|
|
136
|
+
? renderGeometryRow(labels.fields.profile, _jsx(PhiSegmentedControl, { value: selectedProfile, size: "small", block: true, options: PHI_GEOMETRY_PROFILES.map((option) => ({
|
|
137
|
+
value: option,
|
|
138
|
+
label: labels.profiles[option],
|
|
139
|
+
})), onChange: (next) => setSelectedProfile(next) }))
|
|
140
|
+
: null, renderGeometryRow(labels.fields.size, _jsx(PhiDimensionControl, { value: currentSize.value, widthPlaceholder: placeholder(currentSize.inherited.width), heightPlaceholder: placeholder(currentSize.inherited.height), disabled: isDisabled, onChange: (nextSize) => emit({
|
|
83
141
|
...currentValue,
|
|
84
|
-
size:
|
|
85
|
-
}) })), renderGeometryRow(labels.fields.minSize, _jsx(PhiDimensionControl, { value: currentMinSize, disabled: isDisabled, onChange: (nextSize) => emit({
|
|
142
|
+
size: writeProfilePair(currentValue.size, profile, nextSize),
|
|
143
|
+
}) })), renderGeometryRow(labels.fields.minSize, _jsx(PhiDimensionControl, { value: currentMinSize.value, widthPlaceholder: placeholder(currentMinSize.inherited.width), heightPlaceholder: placeholder(currentMinSize.inherited.height), disabled: isDisabled, onChange: (nextSize) => emit({
|
|
86
144
|
...currentValue,
|
|
87
|
-
minSize:
|
|
88
|
-
}) })), renderGeometryRow(labels.fields.maxSize, _jsx(PhiDimensionControl, { value: currentMaxSize, disabled: isDisabled, onChange: (nextSize) => emit({
|
|
145
|
+
minSize: writeProfilePair(currentValue.minSize, profile, nextSize),
|
|
146
|
+
}) })), renderGeometryRow(labels.fields.maxSize, _jsx(PhiDimensionControl, { value: currentMaxSize.value, widthPlaceholder: placeholder(currentMaxSize.inherited.width), heightPlaceholder: placeholder(currentMaxSize.inherited.height), disabled: isDisabled, onChange: (nextSize) => emit({
|
|
89
147
|
...currentValue,
|
|
90
|
-
maxSize:
|
|
148
|
+
maxSize: writeProfilePair(currentValue.maxSize, profile, nextSize),
|
|
91
149
|
}) })), renderGeometryRow(labels.fields.zIndex, _jsx(PhiNumberControl, { value: currentValue.zIndex ?? 0, step: 1, precision: 0, disabled: isDisabled, onChange: (nextValue) => emit({
|
|
92
150
|
...currentValue,
|
|
93
151
|
zIndex: nextValue ?? 0,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { PHI_COLOR, PHI_FONT_SIZE, PHI_SPACE } from "../../theme/antd-css-var-contract";
|
|
3
|
+
import { PhiHoverText } from "./phi-hover-text";
|
|
3
4
|
const VIEW_WIDTH = 100;
|
|
4
5
|
const VIEW_HEIGHT = 100;
|
|
5
6
|
/* Room above the highest point and below the baseline, so the emphasized dot is not clipped. */
|
|
@@ -54,7 +55,8 @@ export function PhiSeriesChartControl({ keys, series, unit, locale, title, heigh
|
|
|
54
55
|
const area = first.length > 1
|
|
55
56
|
? `${linePath(first)} L${round(first[first.length - 1].x)} ${round(geometry.baseline)} L${round(first[0].x)} ${round(geometry.baseline)} Z`
|
|
56
57
|
: null;
|
|
57
|
-
|
|
58
|
+
const withHoverText = (drawing) => spoken ? _jsx(PhiHoverText, { title: spoken, children: drawing }) : drawing;
|
|
59
|
+
return (_jsxs("figure", { style: { margin: 0, display: "grid", gap: PHI_SPACE.xxs, minWidth: 0 }, "data-phi-series-chart": "", children: [withHoverText(_jsxs("div", { style: { position: "relative", height, minWidth: 0 }, children: [_jsxs("svg", { role: "img", "aria-label": spoken || undefined, viewBox: `0 0 ${VIEW_WIDTH} ${VIEW_HEIGHT}`, preserveAspectRatio: "none", width: "100%", height: height, style: { display: "block", overflow: "visible" }, children: [_jsx("line", { x1: 0, x2: VIEW_WIDTH, y1: round(geometry.top), y2: round(geometry.top), vectorEffect: "non-scaling-stroke", strokeWidth: 1, strokeDasharray: "2 3", style: { stroke: PHI_COLOR.split } }), _jsx("line", { x1: 0, x2: VIEW_WIDTH, y1: round(geometry.baseline), y2: round(geometry.baseline), vectorEffect: "non-scaling-stroke", strokeWidth: 1, style: { stroke: PHI_COLOR.border } }), area ? (_jsx("path", { d: area, style: { fill: `color-mix(in srgb, ${PHI_COLOR.primary} 14%, transparent)`, stroke: "none" } })) : null, geometry.series.map((points, index) => points.length > 1 ? (_jsx("path", { d: linePath(points), fill: "none", vectorEffect: "non-scaling-stroke", strokeWidth: index === 0 ? 2 : 1.5, strokeLinejoin: "round", strokeLinecap: "round", ...(strokeOf(index).dash ? { strokeDasharray: strokeOf(index).dash } : {}), style: { stroke: strokeOf(index).color } }, index)) : null)] }), geometry.series.map((points, index) => {
|
|
58
60
|
/* The latest day's point, where the series has a figure for that day. */
|
|
59
61
|
const last = points[points.length - 1];
|
|
60
62
|
return last && Number.isFinite(series[index].values[pointCount - 1]) ? (_jsx("span", { "aria-hidden": "true", "data-phi-series-chart-last": "", style: {
|
|
@@ -68,7 +70,7 @@ export function PhiSeriesChartControl({ keys, series, unit, locale, title, heigh
|
|
|
68
70
|
background: strokeOf(index).color,
|
|
69
71
|
boxShadow: `0 0 0 2px ${PHI_COLOR.bgContainer}`,
|
|
70
72
|
} }, index)) : null;
|
|
71
|
-
})] }), series.length > 1 || pointCount > 1 ? (_jsxs("figcaption", { "aria-hidden": "true", style: {
|
|
73
|
+
})] })), series.length > 1 || pointCount > 1 ? (_jsxs("figcaption", { "aria-hidden": "true", style: {
|
|
72
74
|
display: "grid",
|
|
73
75
|
gap: PHI_SPACE.xxs,
|
|
74
76
|
fontSize: PHI_FONT_SIZE.sm,
|
|
@@ -97,6 +97,7 @@ export declare const PHI_FORM_UPLOAD_LABEL_KEYS: {
|
|
|
97
97
|
readonly errorQuotaExceeded: "uploadErrorQuotaExceeded";
|
|
98
98
|
readonly errorSpaceUnavailable: "uploadErrorSpaceUnavailable";
|
|
99
99
|
readonly errorStorageUnreachable: "uploadErrorStorageUnreachable";
|
|
100
|
+
readonly errorFolderLocked: "uploadErrorFolderLocked";
|
|
100
101
|
};
|
|
101
102
|
export type PhiSharedFormFieldTypeDescriptor = Omit<PhiFormFieldTypeProviderDescriptor, "ownerModuleId">;
|
|
102
103
|
export type PhiSharedFormValidationDescriptor = Omit<PhiFormValidationProviderDescriptor, "ownerModuleId">;
|
|
@@ -104,6 +104,7 @@ export const PHI_FORM_UPLOAD_LABEL_KEYS = {
|
|
|
104
104
|
errorQuotaExceeded: "uploadErrorQuotaExceeded",
|
|
105
105
|
errorSpaceUnavailable: "uploadErrorSpaceUnavailable",
|
|
106
106
|
errorStorageUnreachable: "uploadErrorStorageUnreachable",
|
|
107
|
+
errorFolderLocked: "uploadErrorFolderLocked",
|
|
107
108
|
};
|
|
108
109
|
export const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS = [
|
|
109
110
|
{ key: PHI_FORM_FIELD_PROVIDER_KEYS.text, title: "Text", valueType: "string", presentation: "control", settingsFields: [{ key: "minLength", type: "number", label: "Minimum characters", min: 0 }, { key: "maxLength", type: "number", label: "Maximum characters", min: 0 }] },
|
|
@@ -65,6 +65,7 @@ function resolveUploadLabels(labels) {
|
|
|
65
65
|
errorQuotaExceeded: read(PHI_FORM_UPLOAD_LABEL_KEYS.errorQuotaExceeded, PHI_MEDIA_UPLOAD_DEFAULT_LABELS.errorQuotaExceeded),
|
|
66
66
|
errorSpaceUnavailable: read(PHI_FORM_UPLOAD_LABEL_KEYS.errorSpaceUnavailable, PHI_MEDIA_UPLOAD_DEFAULT_LABELS.errorSpaceUnavailable),
|
|
67
67
|
errorStorageUnreachable: read(PHI_FORM_UPLOAD_LABEL_KEYS.errorStorageUnreachable, PHI_MEDIA_UPLOAD_DEFAULT_LABELS.errorStorageUnreachable),
|
|
68
|
+
errorFolderLocked: read(PHI_FORM_UPLOAD_LABEL_KEYS.errorFolderLocked, PHI_MEDIA_UPLOAD_DEFAULT_LABELS.errorFolderLocked),
|
|
68
69
|
};
|
|
69
70
|
}
|
|
70
71
|
/**
|
|
@@ -7,6 +7,7 @@ import { resolvePhiBaseLayoutChrome, resolvePhiBaseLayoutSlotStates, } from "../
|
|
|
7
7
|
import { isPhiLayoutAuthoringRender, phiLayoutDebugLayerMarker, phiLayoutSlotClassName, phiLayoutSlotContentMarker, } from "../../../helpers/layout-authoring-markers";
|
|
8
8
|
import { PhiLayoutSurfaceBox } from "../phi-layout-surface-box";
|
|
9
9
|
import { PHI_CMS_MAX_LAYOUT_SLOTS } from "../../../constants/cms-layout-types";
|
|
10
|
+
import { phiSlotContainerAttributes } from "../../../helpers/block-geometry-profiles";
|
|
10
11
|
export function PhiFlexLayout({ slots, ...layoutProps }) {
|
|
11
12
|
// Named fields rather than the rest object: handing the compiler a whole rest object makes every
|
|
12
13
|
// value later destructured out of it look like it may change, which costs the component its memoization.
|
|
@@ -154,9 +155,14 @@ export function PhiFlexLayout({ slots, ...layoutProps }) {
|
|
|
154
155
|
* instead. Stretching and placing are two jobs, and `align-items` can only do one of them.
|
|
155
156
|
*/
|
|
156
157
|
alignItems: shouldFillCrossAxis ? "stretch" : resolvedFlowAlignment.alignItems,
|
|
158
|
+
/*
|
|
159
|
+
* And the block axis the same way: a slot that grows into a column of definite height holds
|
|
160
|
+
* a child that may cap its height below it, and the slot is a flex column, so the child's
|
|
161
|
+
* block margins place it where the column's own `justify-content` would have put a slot.
|
|
162
|
+
*/
|
|
157
163
|
...resolvePhiSlotPlacementMargins({
|
|
158
164
|
inline: shouldFillCrossAxis ? phiPlacementFromWord(resolvedFlowAlignment.alignItems) : null,
|
|
159
|
-
block: null,
|
|
165
|
+
block: shouldFillMainAxis ? phiPlacementFromWord(resolvedJustifyContent) : null,
|
|
160
166
|
}),
|
|
161
167
|
}, children: child }, `content-${index}`));
|
|
162
168
|
}
|
|
@@ -165,7 +171,6 @@ export function PhiFlexLayout({ slots, ...layoutProps }) {
|
|
|
165
171
|
const minMainSize = slotSizing.minInlineSize;
|
|
166
172
|
const maxMainSize = slotSizing.maxInlineSize;
|
|
167
173
|
const minCrossSize = slotSizing.minBlockSize;
|
|
168
|
-
const maxCrossSize = slotSizing.maxBlockSize;
|
|
169
174
|
const shouldWrap = resolvedWrap != null && resolvedWrap !== "nowrap";
|
|
170
175
|
const usesMinMainBasis = shouldWrap && minMainSize != null;
|
|
171
176
|
const canShrinkWithinMax = shouldWrap && maxMainSize != null;
|
|
@@ -174,9 +179,13 @@ export function PhiFlexLayout({ slots, ...layoutProps }) {
|
|
|
174
179
|
: shouldFillMainAxis
|
|
175
180
|
? 0
|
|
176
181
|
: "auto";
|
|
182
|
+
/*
|
|
183
|
+
* The block axis is the row's cross axis: a slot stretched to the row's height holds a child that may
|
|
184
|
+
* cap its height below it, and the slot is a flex column, so the child's block margins place it.
|
|
185
|
+
*/
|
|
177
186
|
const slotPlacementMargins = resolvePhiSlotPlacementMargins({
|
|
178
187
|
inline: shouldFillMainAxis ? phiPlacementFromWord(resolvedJustifyContent) : null,
|
|
179
|
-
block: null,
|
|
188
|
+
block: shouldFillCrossAxis ? phiPlacementFromWord(resolvedFlowAlignment.alignItems) : null,
|
|
180
189
|
});
|
|
181
190
|
return (_jsx("div", { className: phiLayoutSlotClassName(isAuthoringRender), "data-phi-layout-has-content": phiLayoutSlotContentMarker(isAuthoringRender, true), style: {
|
|
182
191
|
flexGrow: shouldFillMainAxis ? 1 : 0,
|
|
@@ -187,7 +196,11 @@ export function PhiFlexLayout({ slots, ...layoutProps }) {
|
|
|
187
196
|
minWidth: minMainSize ?? 0,
|
|
188
197
|
minHeight: minCrossSize ?? 0,
|
|
189
198
|
maxWidth: maxMainSize,
|
|
190
|
-
|
|
199
|
+
/*
|
|
200
|
+
* No cap on the cross axis: the child caps itself, and a slot stretched to the row's height
|
|
201
|
+
* holds the room its block margins place it in. A slot capped at the child's maximum and
|
|
202
|
+
* stretched stood at the top of the row whatever the anchor said.
|
|
203
|
+
*/
|
|
191
204
|
alignSelf: shouldFillCrossAxis ? "stretch" : undefined,
|
|
192
205
|
display: "flex",
|
|
193
206
|
flexDirection: "column",
|
|
@@ -237,6 +250,11 @@ export function PhiFlexLayout({ slots, ...layoutProps }) {
|
|
|
237
250
|
slotIndex: targetSlotIndex,
|
|
238
251
|
}),
|
|
239
252
|
}) }, "insert")) : null;
|
|
253
|
+
/*
|
|
254
|
+
* The room a profiled child is offered is the row or the column: a slot that does not grow is as wide
|
|
255
|
+
* as its content, and a box whose width comes from its content cannot be a size container.
|
|
256
|
+
*/
|
|
257
|
+
const queriesRoom = renderableSlots.some(({ child }) => !isFlexSeparatorChild(child) && resolvePhiLayoutSlotChildSizing(child).queriesRoom);
|
|
240
258
|
const resolvedStyle = {
|
|
241
259
|
position: "relative",
|
|
242
260
|
...resolvedLayoutStyle,
|
|
@@ -244,7 +262,7 @@ export function PhiFlexLayout({ slots, ...layoutProps }) {
|
|
|
244
262
|
minHeight: 0,
|
|
245
263
|
...style,
|
|
246
264
|
};
|
|
247
|
-
return (_jsxs(PhiLayoutSurfaceBox, { blockId: layoutProps.blockId, surface: surface, ground: ground, "data-layout-kind": layoutKind, "data-layout-axis": resolvedVertical ? "vertical" : "horizontal", className: "phi-layout", "data-phi-block-render-mode": resolvedRenderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", style: {
|
|
265
|
+
return (_jsxs(PhiLayoutSurfaceBox, { blockId: layoutProps.blockId, surface: surface, ground: ground, "data-layout-kind": layoutKind, "data-layout-axis": resolvedVertical ? "vertical" : "horizontal", ...phiSlotContainerAttributes(queriesRoom), className: "phi-layout", "data-phi-block-render-mode": resolvedRenderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", style: {
|
|
248
266
|
display: "flex",
|
|
249
267
|
flexDirection: resolvedVertical ? "column" : "row",
|
|
250
268
|
alignItems: resolvedFlowAlignment.alignItems,
|
|
@@ -7,15 +7,19 @@ import { resolvePhiLayoutSlotChildSizing } from "./phi-layout-anchored-overlay";
|
|
|
7
7
|
import { PHI_GRID_LAYOUT_PROFILES, resolvePhiGridColumns, resolvePhiGridSlotColumnProperties, resolvePhiGridSlotGapShares, resolvePhiGridSlotProfileColumns, } from "../phi-grid-contract";
|
|
8
8
|
import { isPhiLayoutAuthoringRender, phiLayoutSlotClassName, phiLayoutSlotContentMarker, } from "../../../helpers/layout-authoring-markers";
|
|
9
9
|
import { PHI_CMS_MAX_LAYOUT_SLOTS } from "../../../constants/cms-layout-types";
|
|
10
|
+
import { phiSlotContainerAttributes } from "../../../helpers/block-geometry-profiles";
|
|
10
11
|
const PHI_GRID_LAYOUT_DEFAULTS = resolvePhiLayoutDefaults("grid");
|
|
11
|
-
function resolveGridSlotPlacementStyle(
|
|
12
|
-
/*
|
|
13
|
-
* The same slot-sizing helper the other layouts use. Going through it rather than reaching into
|
|
14
|
-
* plugins/runtime directly keeps this client out of the Render Manifest's chunk -- that shared edge
|
|
15
|
-
* was pulling the whole Grid implementation into every Area's first load, Public included.
|
|
16
|
-
*/
|
|
17
|
-
const sizing = resolvePhiLayoutSlotChildSizing(slot);
|
|
12
|
+
function resolveGridSlotPlacementStyle(sizing) {
|
|
18
13
|
return {
|
|
14
|
+
/*
|
|
15
|
+
* A flex column, so the child's block margins place it. An auto margin places a box only where its
|
|
16
|
+
* parent is a flex or grid container; in block flow `margin-block: auto` computes to `0`, and a child
|
|
17
|
+
* stretched to a cell of definite height and capped below it stood at the top whatever the anchor
|
|
18
|
+
* said. The inline margins worked here already -- `margin-inline: auto` centres a block box of a
|
|
19
|
+
* definite width -- and work the same in the column.
|
|
20
|
+
*/
|
|
21
|
+
display: "flex",
|
|
22
|
+
flexDirection: "column",
|
|
19
23
|
minWidth: 0,
|
|
20
24
|
minHeight: 0,
|
|
21
25
|
maxWidth: "100%",
|
|
@@ -71,7 +75,7 @@ export function PhiGridLayout({ slots, ...layoutProps }) {
|
|
|
71
75
|
const resolvedJustifyContent = phiGridPlacementWord(placement.inline);
|
|
72
76
|
const slotPlacementMargins = resolvePhiSlotPlacementMargins({
|
|
73
77
|
inline: phiPlacementFromWord(resolvedJustifyContent),
|
|
74
|
-
block:
|
|
78
|
+
block: phiPlacementFromWord(resolvedAlignItems),
|
|
75
79
|
});
|
|
76
80
|
const isEditMode = renderMode === "editor";
|
|
77
81
|
const occupiedSlotIndices = slots.reduce((next, slot, slotIndex) => {
|
|
@@ -96,7 +100,13 @@ export function PhiGridLayout({ slots, ...layoutProps }) {
|
|
|
96
100
|
if (slot === null || slot === undefined || slot === false) {
|
|
97
101
|
return null;
|
|
98
102
|
}
|
|
99
|
-
|
|
103
|
+
/*
|
|
104
|
+
* The same slot-sizing helper the other layouts use. Going through it rather than reaching into
|
|
105
|
+
* plugins/runtime directly keeps this client out of the Render Manifest's chunk -- that shared edge
|
|
106
|
+
* was pulling the whole Grid implementation into every Area's first load, Public included.
|
|
107
|
+
*/
|
|
108
|
+
const sizing = resolvePhiLayoutSlotChildSizing(slot);
|
|
109
|
+
return (_jsx("div", { ...phiSlotContainerAttributes(sizing.queriesRoom), className: phiLayoutSlotClassName(isAuthoringRender, "phi-grid-layout__slot"), "data-phi-layout-has-content": phiLayoutSlotContentMarker(isAuthoringRender, true), style: {
|
|
100
110
|
...resolvePhiGridSlotColumnProperties(slotColumns.get(slotIndex)),
|
|
101
111
|
boxSizing: "border-box",
|
|
102
112
|
minWidth: 0,
|
|
@@ -108,7 +118,7 @@ export function PhiGridLayout({ slots, ...layoutProps }) {
|
|
|
108
118
|
justifyContent: resolvedJustifyContent,
|
|
109
119
|
// The same placement as margins, for a child stretched to the cell and capped; see the Layout contract.
|
|
110
120
|
...slotPlacementMargins,
|
|
111
|
-
}, children: _jsx("div", { style: resolveGridSlotPlacementStyle(
|
|
121
|
+
}, children: _jsx("div", { style: resolveGridSlotPlacementStyle(sizing), children: slot }) }, slotIndex));
|
|
112
122
|
});
|
|
113
123
|
if (isEditMode && editSlotAction && editRenderInsertControl && nextInsertSlotIndex < PHI_CMS_MAX_LAYOUT_SLOTS) {
|
|
114
124
|
renderedSlots.push(_jsx("div", { className: phiLayoutSlotClassName(isAuthoringRender, "phi-grid-layout__slot"), "data-phi-layout-has-content": phiLayoutSlotContentMarker(isAuthoringRender, false), style: {
|
|
@@ -21,6 +21,8 @@ export type PhiLayoutSlotChildSizing = {
|
|
|
21
21
|
minBlockSize: CSSProperties["minHeight"];
|
|
22
22
|
maxInlineSize: CSSProperties["maxWidth"];
|
|
23
23
|
maxBlockSize: CSSProperties["maxHeight"];
|
|
24
|
+
/** The child names a value per profile; the box that offers it room declares the `phi-slot` container. */
|
|
25
|
+
queriesRoom: boolean;
|
|
24
26
|
};
|
|
25
27
|
export declare function resolvePhiLayoutSlotChildSizing(child: ReactNode): PhiLayoutSlotChildSizing;
|
|
26
28
|
export type PhiLayoutAnchoredOverlayProps = {
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Children, isValidElement } from "react";
|
|
3
3
|
import { buildPhiSlotChildDataAttributes, resolvePhiSlotChildSizing } from "../../../plugins/runtime/slot-size-policy";
|
|
4
4
|
import { phiFlexPlacementWord, resolvePhiPlacement, resolvePhiSlotPlacementMargins, } from "../phi-layout-contract";
|
|
5
|
+
import { phiSlotContainerAttributes } from "../../../helpers/block-geometry-profiles";
|
|
5
6
|
function isPhiLayoutNodeChild(child) {
|
|
6
7
|
return isValidElement(child) && child.props["data-layout-kind"] != null;
|
|
7
8
|
}
|
|
@@ -25,6 +26,7 @@ export function resolvePhiLayoutSlotChildSizing(child) {
|
|
|
25
26
|
minBlockSize: slotSizing.minBlockSize,
|
|
26
27
|
maxInlineSize: slotSizing.maxInlineSize,
|
|
27
28
|
maxBlockSize: slotSizing.maxBlockSize,
|
|
29
|
+
queriesRoom: slotSizing.queriesRoom,
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
@@ -48,8 +50,13 @@ export function PhiLayoutAnchoredOverlay({ anchor, slotRole, positionMode = "abs
|
|
|
48
50
|
const horizontal = phiFlexPlacementWord(placement.inline);
|
|
49
51
|
const vertical = phiFlexPlacementWord(placement.block);
|
|
50
52
|
const slotSizing = resolvePhiLayoutSlotChildSizing(children);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
/*
|
|
54
|
+
* Both axes. The content box below is a flex row, so an auto margin places its child on the block
|
|
55
|
+
* axis as well as the inline one -- a child stretched to a definite height and capped below it is
|
|
56
|
+
* moved by the block margins the way a capped width is moved by the inline ones.
|
|
57
|
+
*/
|
|
58
|
+
const placementMargins = resolvePhiSlotPlacementMargins(placement);
|
|
59
|
+
return (_jsx("div", { ...phiSlotContainerAttributes(slotSizing.queriesRoom), className: [
|
|
53
60
|
"phi-layout-scaffold-anchor",
|
|
54
61
|
positionMode === "flow" ? "phi-layout-scaffold-anchor--flow" : null,
|
|
55
62
|
].filter(Boolean).join(" "), style: {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { normalizePhiCssSize,
|
|
2
|
+
import { normalizePhiCssSize, resolvePhiLayoutBox, phiFlexPlacementWord, resolvePhiPlacement, resolvePhiSlotPlacementMargins, } from "../phi-layout-contract";
|
|
3
3
|
import { resolvePhiBaseLayoutChrome } from "../phi-layout-view-model";
|
|
4
4
|
import { resolvePhiLayoutDefaults } from "../../../helpers/cms-layout-defaults";
|
|
5
5
|
import { PHI_CMS_THREE_COLUMN_LAYOUT_SLOTS } from "../../../constants/cms-layout-types";
|
|
6
6
|
import { isPhiLayoutAuthoringRender, phiLayoutDebugLayerMarker, phiLayoutSlotClassName, phiLayoutSlotContentMarker, } from "../../../helpers/layout-authoring-markers";
|
|
7
7
|
import { PhiLayoutSurfaceBox } from "../phi-layout-surface-box";
|
|
8
|
+
import { resolvePhiLayoutSlotChildSizing } from "./phi-layout-anchored-overlay";
|
|
9
|
+
import { omitPhiBlockProfiledDeclarations, phiSlotContainerAttributes, } from "../../../helpers/block-geometry-profiles";
|
|
8
10
|
const PHI_THREE_COLUMN_LAYOUT_DEFAULTS = resolvePhiLayoutDefaults("threecol");
|
|
9
11
|
function renderColumn(isAuthoringRender, key, child, width, flex, anchor, slotRole, editSlotAction, editRenderInsertControl, slotIndex, label, showInsertButton) {
|
|
10
12
|
const resolvedWidth = normalizePhiCssSize(width);
|
|
@@ -101,6 +103,7 @@ export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap
|
|
|
101
103
|
: `var(--phi-three-column-middle-flex, ${PHI_THREE_COLUMN_MIDDLE_GROW} 1 0)`;
|
|
102
104
|
const rightFlex = resolvedRightWidth ? `0 0 ${resolvedRightWidth}` : balancedSides ? balancedSideFlex : "0 1 auto";
|
|
103
105
|
const showInsertButton = resolvedRenderMode === "editor";
|
|
106
|
+
const layoutBox = resolvePhiLayoutBox({ size, minSize, maxSize, collapsedSizeHint });
|
|
104
107
|
const { style: resolvedLayoutStyle, ground, hasExplicitLayoutBackground, } = resolvePhiBaseLayoutChrome({
|
|
105
108
|
labelEnd,
|
|
106
109
|
padding,
|
|
@@ -110,7 +113,7 @@ export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap
|
|
|
110
113
|
paddingLeft,
|
|
111
114
|
surface,
|
|
112
115
|
});
|
|
113
|
-
return (_jsxs(PhiLayoutSurfaceBox, { blockId: blockId, surface: surface, ground: ground, "data-layout-kind": layoutKind, "data-phi-block-id": blockId ?? undefined, className: "phi-layout", "data-phi-block-render-mode": resolvedRenderMode, "data-phi-debug-scaffold": undefined, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", style: {
|
|
116
|
+
return (_jsxs(PhiLayoutSurfaceBox, { blockId: blockId, surface: surface, ground: ground, "data-layout-kind": layoutKind, "data-phi-block-id": blockId ?? undefined, className: "phi-layout", "data-phi-block-render-mode": resolvedRenderMode, "data-phi-debug-scaffold": undefined, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", ...layoutBox.attributes, ...phiSlotContainerAttributes(slots.slice(0, 3).some((slot) => resolvePhiLayoutSlotChildSizing(slot).queriesRoom)), style: omitPhiBlockProfiledDeclarations({
|
|
114
117
|
position: "relative",
|
|
115
118
|
minWidth: 0,
|
|
116
119
|
minHeight: 0,
|
|
@@ -123,7 +126,7 @@ export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap
|
|
|
123
126
|
* same call `PhiBaseLayout` makes; this client draws its row itself instead of going through
|
|
124
127
|
* it, which is how it came to miss the one thing the base box does first.
|
|
125
128
|
*/
|
|
126
|
-
...
|
|
129
|
+
...layoutBox.style,
|
|
127
130
|
...resolvedLayoutStyle,
|
|
128
131
|
display: "flex",
|
|
129
132
|
flexDirection: "row",
|
|
@@ -132,5 +135,5 @@ export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap
|
|
|
132
135
|
justifyContent: justify,
|
|
133
136
|
gap: normalizePhiCssSize(gap) ?? resolvePhiLayoutDefaults("threecol").gap,
|
|
134
137
|
...style,
|
|
135
|
-
}, children: [renderColumn(isAuthoringRender, "slot-1", slots[0] ?? null, leftWidth, leftFlex, editSlotAnchor, "left", editSlotAction, editRenderInsertControl, 0, PHI_CMS_THREE_COLUMN_LAYOUT_SLOTS[0]?.label, showInsertButton), renderColumn(isAuthoringRender, "slot-2", slots[1] ?? null, middleWidth, middleFlex, editSlotAnchor, "middle", editSlotAction, editRenderInsertControl, 1, PHI_CMS_THREE_COLUMN_LAYOUT_SLOTS[1]?.label, showInsertButton), renderColumn(isAuthoringRender, "slot-3", slots[2] ?? null, rightWidth, rightFlex, editSlotAnchor, "right", editSlotAction, editRenderInsertControl, 2, PHI_CMS_THREE_COLUMN_LAYOUT_SLOTS[2]?.label, showInsertButton)] }));
|
|
138
|
+
}, layoutBox.declarations), children: [renderColumn(isAuthoringRender, "slot-1", slots[0] ?? null, leftWidth, leftFlex, editSlotAnchor, "left", editSlotAction, editRenderInsertControl, 0, PHI_CMS_THREE_COLUMN_LAYOUT_SLOTS[0]?.label, showInsertButton), renderColumn(isAuthoringRender, "slot-2", slots[1] ?? null, middleWidth, middleFlex, editSlotAnchor, "middle", editSlotAction, editRenderInsertControl, 1, PHI_CMS_THREE_COLUMN_LAYOUT_SLOTS[1]?.label, showInsertButton), renderColumn(isAuthoringRender, "slot-3", slots[2] ?? null, rightWidth, rightFlex, editSlotAnchor, "right", editSlotAction, editRenderInsertControl, 2, PHI_CMS_THREE_COLUMN_LAYOUT_SLOTS[2]?.label, showInsertButton)] }));
|
|
136
139
|
}
|