@phis/ui 0.6.6 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/components/media/picture-surface.d.ts +15 -0
  2. package/components/media/picture-surface.js +26 -0
  3. package/components/motion/phi-sequence-run.d.ts +6 -1
  4. package/components/motion/phi-sequence-run.js +2 -2
  5. package/components/regions/presets/phi-base-page-column.d.ts +2 -2
  6. package/components/regions/presets/phi-base-page-column.js +8 -8
  7. package/components/regions/presets/phi-base-page-layout.d.ts +2 -1
  8. package/components/regions/presets/phi-base-page-layout.js +27 -2
  9. package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
  10. package/components/root/phi-root-theme-resolver.js +2 -0
  11. package/helpers/cms-layout-defaults.js +5 -1
  12. package/helpers/layout-style.d.ts +2 -2
  13. package/helpers/layout-style.js +5 -3
  14. package/package.json +1 -1
  15. package/plugins/runtime-modules/auth/trees/phi-default-pub-confirm-page-tree.js +1 -1
  16. package/plugins/runtime-modules/auth/trees/phi-default-pub-login-page-tree.js +1 -1
  17. package/plugins/runtime-modules/auth/trees/phi-default-pub-registration-page-tree.js +1 -1
  18. package/plugins/runtime-modules/auth/trees/phi-default-pub-reset-password-page-tree.js +1 -1
  19. package/plugins/runtime-modules/core/widgets/gallery/client.js +9 -1
  20. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -0
  21. package/plugins/runtime-modules/core/widgets/gallery/config.js +5 -0
  22. package/plugins/runtime-modules/core/widgets/image/client.js +6 -10
  23. package/plugins/runtime-modules/core/widgets/image/config.d.ts +1 -53
  24. package/plugins/runtime-modules/core/widgets/image/config.js +6 -17
  25. package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +1 -1
  26. package/plugins/runtime-modules/public/trees/phi-default-pub-contact-page-tree.js +1 -1
  27. package/plugins/runtime-modules/theme/brand-theme-model.d.ts +2 -2
  28. package/plugins/runtime-modules/theme/brand-theme-model.js +4 -3
  29. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +23 -0
  30. package/theme/antd-css-var-contract.d.ts +0 -5
  31. package/theme/antd-css-var-contract.js +0 -5
  32. package/theme/phi-surface-shadow.d.ts +30 -0
  33. package/theme/phi-surface-shadow.js +63 -0
  34. package/theme/phi-theme-tokens.d.ts +3 -2
  35. package/theme/phi-theme-tokens.js +4 -1
  36. package/types/core-widget-placements.d.ts +0 -4
  37. package/types/site-config.d.ts +3 -0
@@ -0,0 +1,15 @@
1
+ import type { CSSProperties } from "react";
2
+ import type { PhiSurface } from "../../types/surface";
3
+ /**
4
+ * The Surface of a picture, as the Image and the Gallery Widget draw it on their own box.
5
+ *
6
+ * A picture is a surface on the page: where its Surface states no corner -- or it has none -- it takes
7
+ * the Site's surface step, as a Layout's and a Markdown picture's do (THEME.md "Control shape"). Its
8
+ * ground stays on the box rather than on a layer of its own, because a picture fills the box and covers
9
+ * it; a ground shows only behind a transparent picture or around one that is contained. A tone has
10
+ * nothing to turn on a picture and is not drawn.
11
+ */
12
+ export declare function resolvePhiPictureSurface(surface: PhiSurface | null | undefined): {
13
+ style: CSSProperties;
14
+ corners: CSSProperties;
15
+ };
@@ -0,0 +1,26 @@
1
+ import { PHI_LAYOUT_SURFACE_RADIUS } from "../layouts/phi-layout-contract";
2
+ import { resolvePhiSurfaceStyle } from "../../helpers/surface-style";
3
+ /**
4
+ * The Surface of a picture, as the Image and the Gallery Widget draw it on their own box.
5
+ *
6
+ * A picture is a surface on the page: where its Surface states no corner -- or it has none -- it takes
7
+ * the Site's surface step, as a Layout's and a Markdown picture's do (THEME.md "Control shape"). Its
8
+ * ground stays on the box rather than on a layer of its own, because a picture fills the box and covers
9
+ * it; a ground shows only behind a transparent picture or around one that is contained. A tone has
10
+ * nothing to turn on a picture and is not drawn.
11
+ */
12
+ export function resolvePhiPictureSurface(surface) {
13
+ const { style } = resolvePhiSurfaceStyle(surface ?? {}, {
14
+ cornerFallback: PHI_LAYOUT_SURFACE_RADIUS,
15
+ groundLayer: false,
16
+ });
17
+ return {
18
+ style,
19
+ corners: {
20
+ borderTopLeftRadius: style.borderTopLeftRadius,
21
+ borderTopRightRadius: style.borderTopRightRadius,
22
+ borderBottomRightRadius: style.borderBottomRightRadius,
23
+ borderBottomLeftRadius: style.borderBottomLeftRadius,
24
+ },
25
+ };
26
+ }
@@ -24,12 +24,17 @@ export type PhiSequenceThumbnail = {
24
24
  *
25
25
  * What the items are is the caller's: the Gallery's pictures, the Entries list's cards.
26
26
  */
27
- export declare function PhiSequenceRun({ items, settings, labels, itemStyle, thumbnails, thumbnailWidth, }: {
27
+ export declare function PhiSequenceRun({ items, settings, labels, itemStyle, windowStyle, thumbnails, thumbnailWidth, }: {
28
28
  /** Keyed by the caller; the run neither wraps nor rekeys them. */
29
29
  items: readonly ReactNode[];
30
30
  settings: PhiSequenceSettings | undefined;
31
31
  labels: PhiSequenceControlLabels;
32
32
  itemStyle?: CSSProperties;
33
+ /**
34
+ * The window the items run in, with the arrows on it: where a caller's Surface goes (the Gallery's),
35
+ * so its depth stands around what is seen rather than being cut off with the items outside it.
36
+ */
37
+ windowStyle?: CSSProperties;
33
38
  /**
34
39
  * A row of buttons under the window, one per item, in place of the dots. Acts only while one item is
35
40
  * shown at a time; the active item's is marked and a press makes its item the active one.
@@ -37,7 +37,7 @@ function resolvePhiSequenceShowsThumbnails(thumbnails, span, itemCount) {
37
37
  *
38
38
  * What the items are is the caller's: the Gallery's pictures, the Entries list's cards.
39
39
  */
40
- export function PhiSequenceRun({ items, settings, labels, itemStyle, thumbnails, thumbnailWidth, }) {
40
+ export function PhiSequenceRun({ items, settings, labels, itemStyle, windowStyle, thumbnails, thumbnailWidth, }) {
41
41
  const { token } = usePhiConfig();
42
42
  const defaults = PHI_SEQUENCE_SETTINGS_DEFAULTS;
43
43
  const loop = settings?.loop ?? defaults.loop;
@@ -76,7 +76,7 @@ export function PhiSequenceRun({ items, settings, labels, itemStyle, thumbnails,
76
76
  const showArrows = (controls === "arrows" || controls === "both") && itemCount > span;
77
77
  const showThumbnails = resolvePhiSequenceShowsThumbnails(thumbnails, span, itemCount);
78
78
  const showDots = !showThumbnails && (controls === "dots" || controls === "both") && pageCount > 1;
79
- return (_jsxs("div", { role: "region", "aria-roledescription": "carousel", "aria-label": labels.region, style: { display: "flex", flexDirection: "column", gap: token.marginXS, width: "100%", minWidth: 0, ...gestures.style }, ...autoplay.holdHandlers, ...gestures.handlers, children: [_jsxs("div", { style: { position: "relative", minWidth: 0 }, "aria-live": autoplay.running ? "off" : "polite", children: [_jsx(PhiSequenceViewport, { items: [...items], activeIndex: activeIndex, visibleCount: span, anchor: "start", transition: settings?.transition ?? defaults.transition, ...(settings?.durationMs === undefined ? {} : { durationMs: settings.durationMs }), ...(settings?.easing === undefined ? {} : { easing: settings.easing }), lookahead: settings?.lookahead ?? defaults.lookahead, mountPolicy: settings?.mountPolicy ?? defaults.mountPolicy, gap: resolvePhiSpacingScaleValue(settings?.gap ?? defaults.gap), itemStyle: itemStyle }), showArrows ? (_jsxs(_Fragment, { children: [_jsx("div", { style: { position: "absolute", insetBlockStart: "50%", insetInlineStart: token.marginXS, transform: "translateY(-50%)" }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "left", size: "inherit" }), ariaLabel: labels.previous, shape: "circle", disabled: atStart && !loop, onClick: () => stepByHand(-1) }) }), _jsx("div", { style: { position: "absolute", insetBlockStart: "50%", insetInlineEnd: token.marginXS, transform: "translateY(-50%)" }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "right", size: "inherit" }), ariaLabel: labels.next, shape: "circle", disabled: atEnd && !loop, onClick: () => stepByHand(1) }) })] })) : null, autoplay.offered ? (_jsx("div", { style: { position: "absolute", insetBlockEnd: token.marginXS, insetInlineEnd: token.marginXS }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: autoplay.stopped ? "play-circle" : "pause-circle", size: "inherit" }), ariaLabel: autoplay.stopped ? labels.play : labels.pause, ariaPressed: autoplay.stopped, shape: "circle", onClick: autoplay.toggleStopped }) })) : null] }), showThumbnails ? (_jsx("div", { role: "group", "aria-label": labels.pages, style: { display: "flex", flexWrap: "wrap", justifyContent: "center", gap: resolvePhiSpacingScaleValue("xs"), minWidth: 0 }, children: thumbnails?.map((thumbnail, index) => (_jsx("button", { type: "button", "aria-label": thumbnail.label || formatPageLabel(labels.page, index + 1, index + 1), "aria-current": index === activeIndex || undefined, "aria-pressed": index === activeIndex, onClick: () => {
79
+ return (_jsxs("div", { role: "region", "aria-roledescription": "carousel", "aria-label": labels.region, style: { display: "flex", flexDirection: "column", gap: token.marginXS, width: "100%", minWidth: 0, ...gestures.style }, ...autoplay.holdHandlers, ...gestures.handlers, children: [_jsxs("div", { style: { position: "relative", minWidth: 0, ...windowStyle }, "aria-live": autoplay.running ? "off" : "polite", children: [_jsx(PhiSequenceViewport, { items: [...items], activeIndex: activeIndex, visibleCount: span, anchor: "start", transition: settings?.transition ?? defaults.transition, ...(settings?.durationMs === undefined ? {} : { durationMs: settings.durationMs }), ...(settings?.easing === undefined ? {} : { easing: settings.easing }), lookahead: settings?.lookahead ?? defaults.lookahead, mountPolicy: settings?.mountPolicy ?? defaults.mountPolicy, gap: resolvePhiSpacingScaleValue(settings?.gap ?? defaults.gap), itemStyle: itemStyle }), showArrows ? (_jsxs(_Fragment, { children: [_jsx("div", { style: { position: "absolute", insetBlockStart: "50%", insetInlineStart: token.marginXS, transform: "translateY(-50%)" }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "left", size: "inherit" }), ariaLabel: labels.previous, shape: "circle", disabled: atStart && !loop, onClick: () => stepByHand(-1) }) }), _jsx("div", { style: { position: "absolute", insetBlockStart: "50%", insetInlineEnd: token.marginXS, transform: "translateY(-50%)" }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "right", size: "inherit" }), ariaLabel: labels.next, shape: "circle", disabled: atEnd && !loop, onClick: () => stepByHand(1) }) })] })) : null, autoplay.offered ? (_jsx("div", { style: { position: "absolute", insetBlockEnd: token.marginXS, insetInlineEnd: token.marginXS }, children: _jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: autoplay.stopped ? "play-circle" : "pause-circle", size: "inherit" }), ariaLabel: autoplay.stopped ? labels.play : labels.pause, ariaPressed: autoplay.stopped, shape: "circle", onClick: autoplay.toggleStopped }) })) : null] }), showThumbnails ? (_jsx("div", { role: "group", "aria-label": labels.pages, style: { display: "flex", flexWrap: "wrap", justifyContent: "center", gap: resolvePhiSpacingScaleValue("xs"), minWidth: 0 }, children: thumbnails?.map((thumbnail, index) => (_jsx("button", { type: "button", "aria-label": thumbnail.label || formatPageLabel(labels.page, index + 1, index + 1), "aria-current": index === activeIndex || undefined, "aria-pressed": index === activeIndex, onClick: () => {
80
80
  setActiveIndex(index);
81
81
  autoplay.restart();
82
82
  }, style: {
@@ -4,8 +4,8 @@ import type { PhiCmsPageNode } from "../../../types/cms";
4
4
  * A module Page's content as one column on the base scaffold: the Region, the scaffold, and a vertical
5
5
  * Flex in it that stops at `maxWidth` and wears the wash (LAYOUTING.md; `CONTENT_ENTRIES.md`, The frame).
6
6
  *
7
- * The scaffold spans the content Region, carries the page's padding and anchors what stands in it to the
8
- * centre, so the column only says where it stops. The width is a maximum: on a phone the column fills the
7
+ * The content Region carries the Page's padding, the scaffold spans it and anchors what stands in it to
8
+ * the centre, so the column only says where it stops. The width is a maximum: on a phone the column fills the
9
9
  * screen. Its corners are the Theme's -- the wash states no line, and a Surface without its own line takes
10
10
  * the Site's surface step.
11
11
  *
@@ -1,14 +1,14 @@
1
1
  import { PHI_CMS_DEFAULT_SLOT_INDEX } from "../../../constants/cms-layout-types";
2
2
  import { createPhiCmsPresetNodes } from "../../../helpers/cms-preset-nodes";
3
3
  import { PHI_SURFACE_WASH } from "../../../helpers/surface-presets";
4
- import { PHI_PAGE, PHI_SPACE } from "../../../theme/antd-css-var-contract";
4
+ import { PHI_SPACE } from "../../../theme/antd-css-var-contract";
5
5
  import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID, } from "./phi-base-page-layout";
6
6
  /**
7
7
  * A module Page's content as one column on the base scaffold: the Region, the scaffold, and a vertical
8
8
  * Flex in it that stops at `maxWidth` and wears the wash (LAYOUTING.md; `CONTENT_ENTRIES.md`, The frame).
9
9
  *
10
- * The scaffold spans the content Region, carries the page's padding and anchors what stands in it to the
11
- * centre, so the column only says where it stops. The width is a maximum: on a phone the column fills the
10
+ * The content Region carries the Page's padding, the scaffold spans it and anchors what stands in it to
11
+ * the centre, so the column only says where it stops. The width is a maximum: on a phone the column fills the
12
12
  * screen. Its corners are the Theme's -- the wash states no line, and a Surface without its own line takes
13
13
  * the Site's surface step.
14
14
  *
@@ -32,11 +32,11 @@ export function buildPhiBasePageColumnFrame({ page, regionId, columnId, label, m
32
32
  config: {
33
33
  maxSize: { width: maxWidth },
34
34
  surface: PHI_SURFACE_WASH,
35
- // The Theme's Page inset for the screen it is drawn on (`PHI_PAGE.padding`); a Layout's own wins.
36
- paddingTop: PHI_PAGE.padding.top,
37
- paddingRight: PHI_PAGE.padding.right,
38
- paddingBottom: PHI_PAGE.padding.bottom,
39
- paddingLeft: PHI_PAGE.padding.left,
35
+ /*
36
+ * The wash's own inset, the house step: the Page's distance from the screen's edge is the content
37
+ * Region's (`buildPhiBasePageContentScaffold`), not the column's.
38
+ */
39
+ padding: PHI_SPACE.base,
40
40
  // The house step between a preset's children; the Widgets keep their own air inside.
41
41
  gap: PHI_SPACE.sm,
42
42
  },
@@ -25,7 +25,8 @@ export declare const PHI_BASE_PAGE_LAYOUT_NODE_ID: import("@phis/contracts/cms")
25
25
  export declare function buildPhiBasePageLayoutNode(page: PhiCmsPageNode): PhiCmsLayoutNode;
26
26
  /**
27
27
  * Content region rooted on the scaffold. The region keeps its per-page identity -- `regionId` stays the
28
- * preset's synthetic id -- and spans the full page width; the built-in pages set no reading width.
28
+ * preset's synthetic id -- and spans the full page width; the built-in pages set no reading width. It
29
+ * carries the Page's inset (`resolvePhiBasePageRegionInset`); a `regionConfig` the caller states wins.
29
30
  * Only the tree below the root is standardised.
30
31
  */
31
32
  export declare function buildPhiBasePageContentScaffold({ page, regionId, regionConfig, }: {
@@ -3,6 +3,8 @@ import { PhiCmsRegionType } from "../../../constants/phi-cms";
3
3
  import { createPhiCmsPresetNodes } from "../../../helpers/cms-preset-nodes";
4
4
  import { PHI_SHARED_PACKAGE_NAME } from "../../../constants/package";
5
5
  import { createPhiPresetCmsInstanceId } from "../../../types/cms-instance-id";
6
+ import { resolvePhiCmsAreaMask } from "../../../constants/cms-areas";
7
+ import { PHI_PAGE, PHI_SPACE } from "../../../theme/antd-css-var-contract";
6
8
  /**
7
9
  * The shared content-region scaffold of the built-in page presets.
8
10
  *
@@ -47,9 +49,32 @@ export function buildPhiBasePageLayoutNode(page) {
47
49
  label: PHI_BASE_PAGE_LAYOUT_LABEL,
48
50
  });
49
51
  }
52
+ /** The Areas a visitor reads in: their content Region stands in by the Theme's Page padding. */
53
+ const PHI_VISITOR_AREA_MASK = resolvePhiCmsAreaMask("public") | resolvePhiCmsAreaMask("app");
54
+ /**
55
+ * The distance from the screen's edge to a Page's content, on its content Region and nowhere else.
56
+ *
57
+ * In Public and App it is the Theme's Page padding (THEME.md "Page padding", `PHI_PAGE.padding`): 21 on a
58
+ * phone and 34 from a tablet on, as the Theme states. The Hero and the Footer top are Regions of their
59
+ * own and keep the full width. The staff Areas keep the house step `base`. The scaffold inside has no
60
+ * padding; what stands in it with a ground of its own -- the wash column, a Split Card's cards -- insets
61
+ * its content by `base`.
62
+ */
63
+ function resolvePhiBasePageRegionInset(page) {
64
+ const visitorPage = page.areaMask !== 0 && (page.areaMask & ~PHI_VISITOR_AREA_MASK) === 0;
65
+ return visitorPage
66
+ ? {
67
+ paddingTop: PHI_PAGE.padding.top,
68
+ paddingRight: PHI_PAGE.padding.right,
69
+ paddingBottom: PHI_PAGE.padding.bottom,
70
+ paddingLeft: PHI_PAGE.padding.left,
71
+ }
72
+ : { padding: PHI_SPACE.base };
73
+ }
50
74
  /**
51
75
  * Content region rooted on the scaffold. The region keeps its per-page identity -- `regionId` stays the
52
- * preset's synthetic id -- and spans the full page width; the built-in pages set no reading width.
76
+ * preset's synthetic id -- and spans the full page width; the built-in pages set no reading width. It
77
+ * carries the Page's inset (`resolvePhiBasePageRegionInset`); a `regionConfig` the caller states wins.
53
78
  * Only the tree below the root is standardised.
54
79
  */
55
80
  export function buildPhiBasePageContentScaffold({ page, regionId, regionConfig, }) {
@@ -59,7 +84,7 @@ export function buildPhiBasePageContentScaffold({ page, regionId, regionConfig,
59
84
  regionType: PhiCmsRegionType.Content,
60
85
  rootLayoutNodeId: PHI_BASE_PAGE_LAYOUT_NODE_ID,
61
86
  sortOrder: 30,
62
- config: regionConfig,
87
+ config: { ...resolvePhiBasePageRegionInset(page), ...regionConfig },
63
88
  }),
64
89
  layoutNode: buildPhiBasePageLayoutNode(page),
65
90
  };
@@ -41,7 +41,7 @@ export function buildPhiSettingsPageShellTree({ page, ownerModuleId, presetKey,
41
41
  });
42
42
  const layoutNodes = [
43
43
  scaffold.layoutNode,
44
- // The base scaffold owns padding and background; the Collapsible only stacks the panels.
44
+ // The Region carries the padding, the base scaffold the background; the Collapsible only stacks the panels.
45
45
  nodes.layout({
46
46
  id: layouts.settingsPanels,
47
47
  parentLayoutNodeId: PHI_BASE_PAGE_LAYOUT_NODE_ID,
@@ -7,6 +7,7 @@ import { assertPhiThemeVocabulary } from "../../theme/phi-theme-tokens";
7
7
  import { applyPhiButtonShadowComponentTokens } from "../../theme/phi-button-shadow";
8
8
  import { buildPhiThemeGradientTokens, readPhiThemeGradientKey } from "../../theme/phi-theme-gradients";
9
9
  import { buildPhiThemeLinkTokens } from "../../theme/phi-link-mark";
10
+ import { buildPhiSurfaceShadowTokens } from "../../theme/phi-surface-shadow";
10
11
  import { buildPhiThemeCustomColorTokens } from "../../theme/phi-theme-palette";
11
12
  import { applyPhiControlShapeComponentTokens, applyPhiSurfaceShapeComponentTokens, resolvePhiControlShape, } from "../../theme/phi-control-shape";
12
13
  const PHI_DEFAULT_DARK_NAV_BACKGROUND = "#001529";
@@ -98,6 +99,7 @@ export function resolvePhiRootTheme({ siteTheme, mode, fonts, presets, }) {
98
99
  primaryButtonGradient: readPhiThemeGradientKey(siteTheme?.buttons?.primaryGradient),
99
100
  }),
100
101
  ...buildPhiThemeLinkTokens(siteTheme?.links),
102
+ ...buildPhiSurfaceShadowTokens(siteTheme?.shadows, mode),
101
103
  };
102
104
  return {
103
105
  mode,
@@ -76,7 +76,11 @@ const PHI_FLEX_VERTICAL_LAYOUT_PANEL_PRESET = {
76
76
  */
77
77
  const PHI_FLEX_VERTICAL_LAYOUT_PAGE_BASE_PRESET = {
78
78
  gap: PHI_SPACE.sm,
79
- padding: PHI_SPACE.base,
79
+ /*
80
+ * None: the distance from the screen's edge is the content Region's, the Theme's Page padding in Public
81
+ * and App (`buildPhiBasePageContentScaffold`). The scaffold only holds its slots together.
82
+ */
83
+ padding: 0,
80
84
  /*
81
85
  * No Surface, so whatever the theme paints behind the page -- a colour, an image, the frosted
82
86
  * Chrome pane -- reaches the content region instead of stopping at a grey plate. A page that
@@ -23,8 +23,8 @@ export declare const PHI_GLASS_LAYOUT_EFFECT_DEFINITIONS: {
23
23
  };
24
24
  export declare const PHI_SHADOW_DEFINITIONS: {
25
25
  readonly none: "none";
26
- readonly soft: "var(--phi-box-shadow-tertiary)";
27
- readonly strong: "var(--phi-box-shadow)";
26
+ readonly soft: string;
27
+ readonly strong: string;
28
28
  };
29
29
  export declare function resolvePhiShadow(value: PhiShadow | null | undefined): CSSProperties["boxShadow"] | undefined;
30
30
  export declare function resolvePhiLayoutEffectStyle({ effect, background, }: {
@@ -1,4 +1,5 @@
1
- import { PHI_COLOR, PHI_SHADOW } from "../theme/antd-css-var-contract";
1
+ import { PHI_COLOR } from "../theme/antd-css-var-contract";
2
+ import { PHI_SURFACE_SHADOW_VARIABLES } from "../theme/phi-surface-shadow";
2
3
  import {} from "../types/layout-style";
3
4
  /**
4
5
  * What each glass strength is made of.
@@ -20,8 +21,9 @@ function resolvePhiGlassBackground(background, strengthPercent) {
20
21
  }
21
22
  export const PHI_SHADOW_DEFINITIONS = {
22
23
  none: "none",
23
- soft: PHI_SHADOW.tertiary,
24
- strong: PHI_SHADOW.primary,
24
+ // The house's own depths, not Ant Design's menu and popover shadows (theme/phi-surface-shadow.ts).
25
+ soft: PHI_SURFACE_SHADOW_VARIABLES.soft,
26
+ strong: PHI_SURFACE_SHADOW_VARIABLES.strong,
25
27
  };
26
28
  export function resolvePhiShadow(value) {
27
29
  if (value == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -59,7 +59,7 @@ export async function buildPhiDefaultPubConfirmPageTree({ page, presetKey, }) {
59
59
  overlays: [],
60
60
  regions: [scaffold.region],
61
61
  layoutNodes: [
62
- // The base scaffold every module Page stands on; it carries the page's padding, the card its own.
62
+ // The base scaffold every module Page stands on; the Region carries the page's padding, the card its own.
63
63
  scaffold.layoutNode,
64
64
  nodes.layout({
65
65
  creationPreset: { layoutKind: "split", preset: "panel" },
@@ -45,7 +45,7 @@ export async function buildPhiDefaultPubLoginPageTree({ page, presetKey, runtime
45
45
  overlays: [],
46
46
  regions: [scaffold.region],
47
47
  layoutNodes: [
48
- // The base scaffold every module Page stands on; it carries the page's padding, the card its own.
48
+ // The base scaffold every module Page stands on; the Region carries the page's padding, the card its own.
49
49
  scaffold.layoutNode,
50
50
  nodes.layout({
51
51
  creationPreset: { layoutKind: "split", preset: "panel" },
@@ -30,7 +30,7 @@ export async function buildPhiDefaultPubRegistrationPageTree({ page, presetKey,
30
30
  overlays: [],
31
31
  regions: [scaffold.region],
32
32
  layoutNodes: [
33
- // The base scaffold every module Page stands on; it carries the page's padding, the card its own.
33
+ // The base scaffold every module Page stands on; the Region carries the page's padding, the card its own.
34
34
  scaffold.layoutNode,
35
35
  nodes.layout({
36
36
  creationPreset: { layoutKind: "split", preset: "panel" },
@@ -51,7 +51,7 @@ export async function buildPhiDefaultPubResetPasswordPageTree({ page, presetKey,
51
51
  overlays: [],
52
52
  regions: [scaffold.region],
53
53
  layoutNodes: [
54
- // The base scaffold every module Page stands on; it carries the page's padding, the card its own.
54
+ // The base scaffold every module Page stands on; the Region carries the page's padding, the card its own.
55
55
  scaffold.layoutNode,
56
56
  nodes.layout({
57
57
  creationPreset: { layoutKind: "split", preset: "panel" },
@@ -9,6 +9,7 @@ import { readPhiAspectRatio, resolvePhiImagePresentation } from "../../../../../
9
9
  import { PHI_GALLERY_WIDGET_DEFAULT_LABELS, } from "../../../../../components/widgets/label-types/gallery";
10
10
  import { isPhiMediaSvgContentType } from "../../../../../constants/media";
11
11
  import { resolvePhiGalleryFrame } from "./defaults";
12
+ import { resolvePhiPictureSurface } from "../../../../../components/media/picture-surface";
12
13
  /** A thumbnail's width in pixels: also what the optimiser is told to size it for. */
13
14
  const PHI_GALLERY_THUMBNAIL_WIDTH = 80;
14
15
  function GalleryPicture({ item, variantKey, fit, preview, sizes, aspectRatio, }) {
@@ -69,8 +70,15 @@ export function PhiGalleryWidget({ config, images: imagesInput, pictures, labels
69
70
  borderRadius: token.borderRadius,
70
71
  overflow: "hidden",
71
72
  };
73
+ /*
74
+ * The Gallery's own Surface goes on the window the pictures run in, with the arrows on it: its depth
75
+ * stands around what is seen, and its corners clip the run. Without one the window is bare, as before.
76
+ */
77
+ const windowStyle = config?.surface
78
+ ? { ...resolvePhiPictureSurface(config.surface).style, overflow: "hidden" }
79
+ : undefined;
72
80
  if (items.length === 0) {
73
81
  return _jsx(PhiEmptyControl, { description: labels.empty });
74
82
  }
75
- return (_jsx(PhiSequenceRun, { items: items.map((item) => (_jsx(GalleryPicture, { item: item, variantKey: config?.variantKey, fit: fit, preview: config?.preview === true, sizes: sizes, aspectRatio: aspectRatio }, item.key))), settings: config, labels: labels, itemStyle: frameStyle, thumbnails: thumbnails, thumbnailWidth: PHI_GALLERY_THUMBNAIL_WIDTH }));
83
+ return (_jsx(PhiSequenceRun, { items: items.map((item) => (_jsx(GalleryPicture, { item: item, variantKey: config?.variantKey, fit: fit, preview: config?.preview === true, sizes: sizes, aspectRatio: aspectRatio }, item.key))), settings: config, labels: labels, itemStyle: frameStyle, windowStyle: windowStyle, thumbnails: thumbnails, thumbnailWidth: PHI_GALLERY_THUMBNAIL_WIDTH }));
76
84
  }
@@ -36,6 +36,7 @@ export declare const PHI_GALLERY_WIDGET_DEFINITION: {
36
36
  pluginKey: string;
37
37
  typeKey: string;
38
38
  slotSizePolicy: "fill-inline";
39
+ surface: "own";
39
40
  title: string;
40
41
  description: string;
41
42
  category: "media";
@@ -81,6 +81,11 @@ export const PHI_GALLERY_WIDGET_DEFINITION = {
81
81
  typeKey: "gallery",
82
82
  // A slideshow is as wide as the place it is put; its height follows from the aspect ratio.
83
83
  slotSizePolicy: "fill-inline",
84
+ /*
85
+ * The Gallery draws its Surface itself, on the window its pictures run in: around the slot frame it
86
+ * would stand around the dots below as well, and on each picture the window would cut its depth off.
87
+ */
88
+ surface: "own",
84
89
  title: "Gallery",
85
90
  description: "A run of pictures shown a few at a time, with arrows, dots and optional autoplay.",
86
91
  category: "media",
@@ -8,7 +8,7 @@ import { PhiEmptyControl } from "../../../../../components/controls/phi-empty-co
8
8
  import { PhiImageControl } from "../../../../../components/controls/phi-image-control";
9
9
  import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
10
10
  import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
11
- import { PHI_LAYOUT_SURFACE_RADIUS } from "../../../../../components/layouts/phi-layout-contract";
11
+ import { resolvePhiPictureSurface } from "../../../../../components/media/picture-surface";
12
12
  function formatImageSize(value) {
13
13
  if (typeof value === "number" && Number.isFinite(value)) {
14
14
  return `${value}px`;
@@ -70,15 +70,11 @@ export function PhiImageWidget({ labels, config, resolvedAsset, focalRect, autho
70
70
  const renderedHeight = formatImageSize(height);
71
71
  const maskStyle = resolvePhiMaskStyle(config?.mask);
72
72
  /*
73
- * A picture is a surface: a corner the author left unstated is the Theme's surface step, as a Layout's
74
- * and a Markdown picture's are (THEME.md "Control shape"); a corner the author stated keeps its value.
73
+ * The picture's own Surface (`components/media/picture-surface.ts`): its corners, the Theme's surface
74
+ * step where it states none, and its edge, depth and ground on the picture's box.
75
75
  */
76
- const radiusStyle = {
77
- borderTopLeftRadius: config?.borderTopLeftRadius ?? PHI_LAYOUT_SURFACE_RADIUS,
78
- borderTopRightRadius: config?.borderTopRightRadius ?? PHI_LAYOUT_SURFACE_RADIUS,
79
- borderBottomLeftRadius: config?.borderBottomLeftRadius ?? PHI_LAYOUT_SURFACE_RADIUS,
80
- borderBottomRightRadius: config?.borderBottomRightRadius ?? PHI_LAYOUT_SURFACE_RADIUS,
81
- };
76
+ const pictureSurface = resolvePhiPictureSurface(config?.surface);
77
+ const radiusStyle = pictureSurface.corners;
82
78
  if (!renderUrl) {
83
79
  return (_jsxs(PhiFlexControl, { align: "center", justify: "center", vertical: true, gap: 6, style: {
84
80
  minHeight: 160,
@@ -93,7 +89,7 @@ export function PhiImageWidget({ labels, config, resolvedAsset, focalRect, autho
93
89
  }, children: [_jsx(PhiEmptyControl, {}), _jsx(PhiTypographyControl, { type: "secondary", strong: false, children: labels.emptyTitle }), _jsx(PhiTypographyControl, { type: "secondary", children: labels.emptyDescription })] }));
94
90
  }
95
91
  return (_jsx(PhiImageControl, { presentation: presentation, source: sourceKind === "asset" ? "asset" : config?.trusted === true ? "trusted-url" : "url", alt: alt, title: title || undefined, width: width, height: height, blurDataUrl: resolvedAsset?.blurDataUrl, optimizable: optimizable, sizes: config?.sizes, preload: config?.preload === true && isPublicAsset, preview: (config?.previewMode ?? "none") === "lightbox", zoom: config?.previewMode === "native", style: {
96
- ...radiusStyle,
92
+ ...pictureSurface.style,
97
93
  ...maskStyle,
98
94
  // Every corner has a radius now, the Theme's at least, so the box always clips its picture.
99
95
  overflow: "hidden",
@@ -15,10 +15,6 @@ export type PhiCmsImageWidgetConfig = PhiCmsWidgetConfigBase & PhiMediaImageSour
15
15
  * Absent, the image takes the variant's own size.
16
16
  */
17
17
  imageSize?: PhiImageWidgetSize;
18
- borderTopLeftRadius?: number | string;
19
- borderTopRightRadius?: number | string;
20
- borderBottomLeftRadius?: number | string;
21
- borderBottomRightRadius?: number | string;
22
18
  mask?: PhiMaskConfig;
23
19
  /** A picture field of the page record to show instead of the Widget's own picture. */
24
20
  recordField?: string;
@@ -30,6 +26,7 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
30
26
  pluginKey: string;
31
27
  typeKey: string;
32
28
  slotSizePolicy: "intrinsic";
29
+ surface: "own";
33
30
  title: string;
34
31
  description: string;
35
32
  category: "content";
@@ -48,10 +45,6 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
48
45
  emptyValue?: undefined;
49
46
  widthPlaceholder?: undefined;
50
47
  heightPlaceholder?: undefined;
51
- topLeftKey?: undefined;
52
- topRightKey?: undefined;
53
- bottomLeftKey?: undefined;
54
- bottomRightKey?: undefined;
55
48
  } | {
56
49
  key: string;
57
50
  type: "choice";
@@ -68,10 +61,6 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
68
61
  emptyValue?: undefined;
69
62
  widthPlaceholder?: undefined;
70
63
  heightPlaceholder?: undefined;
71
- topLeftKey?: undefined;
72
- topRightKey?: undefined;
73
- bottomLeftKey?: undefined;
74
- bottomRightKey?: undefined;
75
64
  } | {
76
65
  key: string;
77
66
  type: "url";
@@ -88,10 +77,6 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
88
77
  emptyValue?: undefined;
89
78
  widthPlaceholder?: undefined;
90
79
  heightPlaceholder?: undefined;
91
- topLeftKey?: undefined;
92
- topRightKey?: undefined;
93
- bottomLeftKey?: undefined;
94
- bottomRightKey?: undefined;
95
80
  } | {
96
81
  key: string;
97
82
  type: "choice";
@@ -111,10 +96,6 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
111
96
  kinds?: undefined;
112
97
  widthPlaceholder?: undefined;
113
98
  heightPlaceholder?: undefined;
114
- topLeftKey?: undefined;
115
- topRightKey?: undefined;
116
- bottomLeftKey?: undefined;
117
- bottomRightKey?: undefined;
118
99
  } | {
119
100
  key: string;
120
101
  type: "string";
@@ -131,10 +112,6 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
131
112
  emptyValue?: undefined;
132
113
  widthPlaceholder?: undefined;
133
114
  heightPlaceholder?: undefined;
134
- topLeftKey?: undefined;
135
- topRightKey?: undefined;
136
- bottomLeftKey?: undefined;
137
- bottomRightKey?: undefined;
138
115
  } | {
139
116
  key: string;
140
117
  type: "choice";
@@ -154,10 +131,6 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
154
131
  emptyValue?: undefined;
155
132
  widthPlaceholder?: undefined;
156
133
  heightPlaceholder?: undefined;
157
- topLeftKey?: undefined;
158
- topRightKey?: undefined;
159
- bottomLeftKey?: undefined;
160
- bottomRightKey?: undefined;
161
134
  } | {
162
135
  key: string;
163
136
  type: "boolean";
@@ -171,10 +144,6 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
171
144
  emptyValue?: undefined;
172
145
  widthPlaceholder?: undefined;
173
146
  heightPlaceholder?: undefined;
174
- topLeftKey?: undefined;
175
- topRightKey?: undefined;
176
- bottomLeftKey?: undefined;
177
- bottomRightKey?: undefined;
178
147
  } | {
179
148
  key: string;
180
149
  type: "dimension";
@@ -188,27 +157,6 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
188
157
  valueType?: undefined;
189
158
  emptyOption?: undefined;
190
159
  emptyValue?: undefined;
191
- topLeftKey?: undefined;
192
- topRightKey?: undefined;
193
- bottomLeftKey?: undefined;
194
- bottomRightKey?: undefined;
195
- } | {
196
- key: string;
197
- type: "radius";
198
- label: string;
199
- topLeftKey: string;
200
- topRightKey: string;
201
- bottomLeftKey: string;
202
- bottomRightKey: string;
203
- description?: undefined;
204
- kinds?: undefined;
205
- options?: undefined;
206
- visibleWhen?: undefined;
207
- valueType?: undefined;
208
- emptyOption?: undefined;
209
- emptyValue?: undefined;
210
- widthPlaceholder?: undefined;
211
- heightPlaceholder?: undefined;
212
160
  })[];
213
161
  contentBinding: {
214
162
  storage: "asset";
@@ -40,10 +40,6 @@ export function normalizePhiImageWidgetConfig(config) {
40
40
  preload: false,
41
41
  previewMode: "none",
42
42
  imageSize: undefined,
43
- borderTopLeftRadius: undefined,
44
- borderTopRightRadius: undefined,
45
- borderBottomLeftRadius: undefined,
46
- borderBottomRightRadius: undefined,
47
43
  mask: undefined,
48
44
  };
49
45
  }
@@ -60,10 +56,6 @@ export function normalizePhiImageWidgetConfig(config) {
60
56
  preload: readBoolean(raw.preload) ?? false,
61
57
  previewMode: readImagePreviewMode(raw.previewMode),
62
58
  imageSize: readImageSize(raw.imageSize),
63
- borderTopLeftRadius: readCssSize(raw.borderTopLeftRadius),
64
- borderTopRightRadius: readCssSize(raw.borderTopRightRadius),
65
- borderBottomLeftRadius: readCssSize(raw.borderBottomLeftRadius),
66
- borderBottomRightRadius: readCssSize(raw.borderBottomRightRadius),
67
59
  mask: readPhiMaskConfig(raw.mask),
68
60
  recordField: readString(raw.recordField),
69
61
  };
@@ -94,6 +86,12 @@ export const PHI_IMAGE_WIDGET_DEFINITION = {
94
86
  pluginKey: resolvePhiCmsWidgetPluginKey("image"),
95
87
  typeKey: "image",
96
88
  slotSizePolicy: "intrinsic",
89
+ /*
90
+ * The picture draws its Surface itself -- edge, corners, depth and a ground behind a transparent or
91
+ * contained picture -- on its own box, which clips the picture to the corners. The corners were a field
92
+ * of the Image's own until 2026-11-18; they are the Surface's edge now, as on every other box.
93
+ */
94
+ surface: "own",
97
95
  title: "Image",
98
96
  description: "Flexible image renderer for local media, trusted URLs, and on-demand renditions.",
99
97
  category: "content",
@@ -170,15 +168,6 @@ export const PHI_IMAGE_WIDGET_DEFINITION = {
170
168
  widthPlaceholder: "Width",
171
169
  heightPlaceholder: "Height",
172
170
  },
173
- {
174
- key: "radius",
175
- type: "radius",
176
- label: "Corner radius",
177
- topLeftKey: "borderTopLeftRadius",
178
- topRightKey: "borderTopRightRadius",
179
- bottomLeftKey: "borderBottomLeftRadius",
180
- bottomRightKey: "borderBottomRightRadius",
181
- },
182
171
  ],
183
172
  contentBinding: {
184
173
  storage: "asset",
@@ -56,7 +56,7 @@ export async function buildPhiDefaultAdminLocalesPageTree({ page, runtime, }) {
56
56
  regions: [scaffold.region],
57
57
  layoutNodes: [
58
58
  scaffold.layoutNode,
59
- // The base scaffold owns padding and background; this grid only arranges the slots inside it.
59
+ // The Region carries the padding, the base scaffold the background; this grid only arranges the slots inside it.
60
60
  nodes.layout({
61
61
  id: SYNTHETIC_ADMIN_LOCALES_LAYOUT_IDS.layoutGrid,
62
62
  parentLayoutNodeId: PHI_BASE_PAGE_LAYOUT_NODE_ID,
@@ -36,7 +36,7 @@ export async function buildPhiDefaultPubContactPageTree({ page, }) {
36
36
  overlays: [],
37
37
  regions: [scaffold.region],
38
38
  layoutNodes: [
39
- // The base scaffold every module Page stands on; it carries the page's padding, the card its own.
39
+ // The base scaffold every module Page stands on; the Region carries the page's padding, the card its own.
40
40
  scaffold.layoutNode,
41
41
  nodes.layout({
42
42
  creationPreset: { layoutKind: "split", preset: "panel" },
@@ -130,8 +130,8 @@ export declare function resolveThemePayloadPreset(theme: ThemePayload, presets:
130
130
  */
131
131
  export declare function applyThemePreset(theme: ThemePayload, preset: PhiThemePresetPlugin): ThemePayload;
132
132
  /**
133
- * Back to the blocks alone: the palette, the proportions, the Button shadows, the link marks and the
134
- * component overrides all go.
133
+ * Back to the blocks alone: the palette, the proportions, the Button shadows, the link marks, the
134
+ * Surface shadow depths and the component overrides all go.
135
135
  */
136
136
  export declare function resetThemeToPreset(theme: ThemePayload, presets: readonly PhiThemePresetPlugin[], preset?: PhiThemePresetPlugin): ThemePayload;
137
137
  export declare function buildThemeReviewHref({ area, revisionId, themeKey, }: {
@@ -22,6 +22,7 @@ const PHI_THEME_HISTORY_PART_BY_FIELD = {
22
22
  style: "style",
23
23
  buttons: "style",
24
24
  links: "style",
25
+ shadows: "style",
25
26
  fonts: "fonts",
26
27
  typography: "fonts",
27
28
  brand: "brand",
@@ -91,12 +92,12 @@ export function applyThemePreset(theme, preset) {
91
92
  };
92
93
  }
93
94
  /**
94
- * Back to the blocks alone: the palette, the proportions, the Button shadows, the link marks and the
95
- * component overrides all go.
95
+ * Back to the blocks alone: the palette, the proportions, the Button shadows, the link marks, the
96
+ * Surface shadow depths and the component overrides all go.
96
97
  */
97
98
  export function resetThemeToPreset(theme, presets, preset = resolveThemePayloadPreset(theme, presets)) {
98
99
  return {
99
- ...omitThemeFields(theme, "palette", "style", "buttons", "links", "components"),
100
+ ...omitThemeFields(theme, "palette", "style", "buttons", "links", "shadows", "components"),
100
101
  preset: preset.key,
101
102
  presetVersion: preset.version,
102
103
  };
@@ -14,6 +14,7 @@ import { PHI_THEME_COLOR_DERIVED_TOKEN_KEYS, PHI_THEME_COLOR_SEED_DERIVATIONS, }
14
14
  import { buildPhiThemeCustomColorPalette, buildPhiThemeCustomColorTokens, resolvePhiThemePaletteCustomColors, } from "../../../../../theme/phi-theme-palette";
15
15
  import { buildPhiThemeGradientTokens, PHI_THEME_GRADIENT_KEYS, readPhiThemeGradient, readPhiThemeGradientTextTone, readPhiThemeGradientKey, resolvePhiThemeGradients, resolvePhiThemeGradientText, resolvePhiThemeGradientContrast, resolvePhiThemeGradientAutoTextTone, resolvePhiThemeGradientInks, PHI_GRADIENT_HOVER_FILTER, } from "../../../../../theme/phi-theme-gradients";
16
16
  import { buildPhiThemeLinkTokens, readPhiThemeExternalLinkMark } from "../../../../../theme/phi-link-mark";
17
+ import { PHI_SURFACE_SHADOW_STEPS, buildPhiSurfaceShadowTokens, readPhiSurfaceShadowDepth, } from "../../../../../theme/phi-surface-shadow";
17
18
  import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
18
19
  import { usePhiThemeBlockCatalog } from "../../../../../components/root/phi-theme-block-catalog-provider";
19
20
  import { resolvePhiThemeComposition, resolvePhiThemeEffectiveLogo, resolvePhiThemeEffectiveFonts, resolvePhiThemeEffectiveRoot, } from "../../../../../theme/phi-theme-composition";
@@ -107,6 +108,12 @@ const PHI_THEME_BUTTON_SHADOW_OPTIONS = [
107
108
  { value: "soft", label: "Soft" },
108
109
  { value: "strong", label: "Strong" },
109
110
  ];
111
+ const PHI_THEME_SURFACE_SHADOW_LABELS = { soft: "Soft", strong: "Strong" };
112
+ const PHI_THEME_SURFACE_SHADOW_OPTIONS = [
113
+ { value: "flat", label: "Flat" },
114
+ { value: "normal", label: "Normal" },
115
+ { value: "pronounced", label: "Pronounced" },
116
+ ];
110
117
  const PHI_STYLE_SIZE_PRESET_KEYS = PHI_SPACING_TOKEN_KEYS;
111
118
  const PHI_STYLE_RADIUS_PRESETS = {
112
119
  xxs: PHI_RADII.xxs,
@@ -271,6 +278,16 @@ function withThemeButtons(theme, buttons) {
271
278
  const withoutButtons = omitThemeFields(theme, "buttons");
272
279
  return Object.keys(buttons).length > 0 ? { ...withoutButtons, buttons } : withoutButtons;
273
280
  }
281
+ /**
282
+ * The depth of one Surface shadow step. `normal` is what a Theme that says nothing gets, so choosing it
283
+ * removes the entry rather than storing it.
284
+ */
285
+ function mergeThemeSurfaceShadowDepth(theme, step, depth) {
286
+ const { [step]: _previous, ...otherSteps } = theme.shadows ?? {};
287
+ const shadows = depth === "normal" ? otherSteps : { ...otherSteps, [step]: depth };
288
+ const withoutShadows = omitThemeFields(theme, "shadows");
289
+ return Object.keys(shadows).length > 0 ? { ...withoutShadows, shadows } : withoutShadows;
290
+ }
274
291
  /**
275
292
  * Links to other sites with or without their mark. On is the default, so turning it back on removes the
276
293
  * entry rather than storing `true`.
@@ -467,6 +484,7 @@ function resolveBrandDraftAliasTokens(resolvedTheme, preset, mode, fonts = {}) {
467
484
  primaryButtonGradient: readPhiThemeGradientKey(resolvedTheme.buttons?.primaryGradient),
468
485
  }),
469
486
  ...buildPhiThemeLinkTokens(resolvedTheme.links),
487
+ ...buildPhiSurfaceShadowTokens(resolvedTheme.shadows, mode),
470
488
  };
471
489
  }
472
490
  function readEffectiveTokenNumber(token, key, fallback) {
@@ -1312,6 +1330,11 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
1312
1330
  ...PHI_THEME_GRADIENT_KEYS.map((key, index) => ({ value: key, label: `Gradient ${index + 1}` })),
1313
1331
  ], onChange: (choice) => publishDraft(mergeThemePrimaryButtonGradient(state.draft, choice === "none" ? null : choice)) })] })),
1314
1332
  },
1333
+ {
1334
+ key: "surfaceShadow",
1335
+ label: _jsx(PhiTypographyControl, { strong: true, children: "Surface Shadow" }),
1336
+ children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingSM, children: [_jsx(PhiTypographyControl, { type: "secondary", children: "How deep the Soft and Strong shadow of cards, layouts and pictures are; each mode has its own." }), PHI_SURFACE_SHADOW_STEPS.map((step) => (_jsx(PhiSegmentedControl, { label: PHI_THEME_SURFACE_SHADOW_LABELS[step], value: readPhiSurfaceShadowDepth(state.draft.shadows, step), options: PHI_THEME_SURFACE_SHADOW_OPTIONS, block: true, onChange: (depth) => publishDraft(mergeThemeSurfaceShadowDepth(state.draft, step, depth)) }, step)))] })),
1337
+ },
1315
1338
  {
1316
1339
  key: "externalLinks",
1317
1340
  label: _jsx(PhiTypographyControl, { strong: true, children: "External Links" }),
@@ -99,11 +99,6 @@ export declare const PHI_CONTROL: {
99
99
  readonly md: "var(--phi-control-height)";
100
100
  readonly lg: "var(--phi-control-height-lg)";
101
101
  };
102
- export declare const PHI_SHADOW: {
103
- readonly primary: "var(--phi-box-shadow)";
104
- readonly secondary: "var(--phi-box-shadow-secondary)";
105
- readonly tertiary: "var(--phi-box-shadow-tertiary)";
106
- };
107
102
  export declare const PHI_FONT_SIZE: {
108
103
  readonly base: "var(--phi-font-size)";
109
104
  readonly sm: "var(--phi-font-size-sm)";
@@ -113,11 +113,6 @@ export const PHI_CONTROL = {
113
113
  md: "var(--phi-control-height)",
114
114
  lg: "var(--phi-control-height-lg)",
115
115
  };
116
- export const PHI_SHADOW = {
117
- primary: "var(--phi-box-shadow)",
118
- secondary: "var(--phi-box-shadow-secondary)",
119
- tertiary: "var(--phi-box-shadow-tertiary)",
120
- };
121
116
  export const PHI_FONT_SIZE = {
122
117
  base: "var(--phi-font-size)",
123
118
  sm: "var(--phi-font-size-sm)",
@@ -0,0 +1,30 @@
1
+ import type { PhiThemeMode } from "./phi-theme-presets";
2
+ /**
3
+ * The depth behind a Surface's shadow steps.
4
+ *
5
+ * A Surface states its shadow as a step -- `soft` or `strong` (`types/layout-style.ts`) -- and the step is
6
+ * this package's own, not Ant Design's: it used to be `boxShadowTertiary` and `boxShadow`, the tokens
7
+ * Ant Design's dropdowns, popovers and cards draw with, so a deeper card would have deepened every menu
8
+ * with it, and the house's cards stood barely lifted off a light page. Each step is a token of its own
9
+ * (`surfaceShadowSoft`, `surfaceShadowStrong`), written as `--phi-surface-shadow-soft` and
10
+ * `--phi-surface-shadow-strong` per mode and per Surface tone like every other token.
11
+ *
12
+ * A shadow does not read the same in both modes: the dark that lifts a card off a light ground
13
+ * disappears into a dark one. So a Theme does not store CSS but a depth per step -- `flat`, `normal`,
14
+ * `pronounced` -- and the depth becomes the mode's CSS here. `normal` is what a Theme that says nothing
15
+ * gets.
16
+ */
17
+ export declare const PHI_SURFACE_SHADOW_STEPS: readonly ["soft", "strong"];
18
+ export type PhiSurfaceShadowStep = (typeof PHI_SURFACE_SHADOW_STEPS)[number];
19
+ export declare const PHI_SURFACE_SHADOW_DEPTHS: readonly ["flat", "normal", "pronounced"];
20
+ export type PhiSurfaceShadowDepth = (typeof PHI_SURFACE_SHADOW_DEPTHS)[number];
21
+ export type PhiThemeShadows = Partial<Record<PhiSurfaceShadowStep, PhiSurfaceShadowDepth | null>>;
22
+ /** What a Surface's step draws, as the variable the stylesheet and every resolver read. */
23
+ export declare const PHI_SURFACE_SHADOW_VARIABLES: Record<PhiSurfaceShadowStep, string>;
24
+ /** The depth a Theme gives a step: its stated one, else `normal`. */
25
+ export declare function readPhiSurfaceShadowDepth(shadows: PhiThemeShadows | null | undefined, step: PhiSurfaceShadowStep): PhiSurfaceShadowDepth;
26
+ /** The two tokens one mode writes, from the Theme's depths. */
27
+ export declare function buildPhiSurfaceShadowTokens(shadows: PhiThemeShadows | null | undefined, mode: PhiThemeMode): {
28
+ surfaceShadowSoft: string;
29
+ surfaceShadowStrong: string;
30
+ };
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The depth behind a Surface's shadow steps.
3
+ *
4
+ * A Surface states its shadow as a step -- `soft` or `strong` (`types/layout-style.ts`) -- and the step is
5
+ * this package's own, not Ant Design's: it used to be `boxShadowTertiary` and `boxShadow`, the tokens
6
+ * Ant Design's dropdowns, popovers and cards draw with, so a deeper card would have deepened every menu
7
+ * with it, and the house's cards stood barely lifted off a light page. Each step is a token of its own
8
+ * (`surfaceShadowSoft`, `surfaceShadowStrong`), written as `--phi-surface-shadow-soft` and
9
+ * `--phi-surface-shadow-strong` per mode and per Surface tone like every other token.
10
+ *
11
+ * A shadow does not read the same in both modes: the dark that lifts a card off a light ground
12
+ * disappears into a dark one. So a Theme does not store CSS but a depth per step -- `flat`, `normal`,
13
+ * `pronounced` -- and the depth becomes the mode's CSS here. `normal` is what a Theme that says nothing
14
+ * gets.
15
+ */
16
+ export const PHI_SURFACE_SHADOW_STEPS = ["soft", "strong"];
17
+ export const PHI_SURFACE_SHADOW_DEPTHS = ["flat", "normal", "pronounced"];
18
+ /** What a Surface's step draws, as the variable the stylesheet and every resolver read. */
19
+ export const PHI_SURFACE_SHADOW_VARIABLES = {
20
+ soft: "var(--phi-surface-shadow-soft)",
21
+ strong: "var(--phi-surface-shadow-strong)",
22
+ };
23
+ const PHI_SURFACE_SHADOW_CSS = {
24
+ light: {
25
+ soft: {
26
+ flat: "0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 6px -1px rgba(0, 0, 0, 0.03)",
27
+ normal: "0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",
28
+ pronounced: "0 2px 4px rgba(0, 0, 0, 0.08), 0 6px 18px rgba(0, 0, 0, 0.12)",
29
+ },
30
+ strong: {
31
+ flat: "0 2px 4px rgba(0, 0, 0, 0.06), 0 8px 20px rgba(0, 0, 0, 0.10)",
32
+ normal: "0 2px 4px rgba(0, 0, 0, 0.08), 0 12px 32px rgba(0, 0, 0, 0.16)",
33
+ pronounced: "0 4px 8px rgba(0, 0, 0, 0.10), 0 18px 44px rgba(0, 0, 0, 0.22)",
34
+ },
35
+ },
36
+ dark: {
37
+ soft: {
38
+ flat: "0 1px 2px rgba(0, 0, 0, 0.30), 0 2px 8px rgba(0, 0, 0, 0.25)",
39
+ normal: "0 1px 2px rgba(0, 0, 0, 0.40), 0 4px 12px rgba(0, 0, 0, 0.35)",
40
+ pronounced: "0 2px 4px rgba(0, 0, 0, 0.50), 0 6px 18px rgba(0, 0, 0, 0.45)",
41
+ },
42
+ strong: {
43
+ flat: "0 2px 4px rgba(0, 0, 0, 0.40), 0 8px 20px rgba(0, 0, 0, 0.40)",
44
+ normal: "0 2px 4px rgba(0, 0, 0, 0.50), 0 12px 32px rgba(0, 0, 0, 0.55)",
45
+ pronounced: "0 4px 8px rgba(0, 0, 0, 0.60), 0 18px 44px rgba(0, 0, 0, 0.65)",
46
+ },
47
+ },
48
+ };
49
+ function isPhiSurfaceShadowDepth(value) {
50
+ return typeof value === "string" && PHI_SURFACE_SHADOW_DEPTHS.includes(value);
51
+ }
52
+ /** The depth a Theme gives a step: its stated one, else `normal`. */
53
+ export function readPhiSurfaceShadowDepth(shadows, step) {
54
+ const depth = shadows?.[step];
55
+ return isPhiSurfaceShadowDepth(depth) ? depth : "normal";
56
+ }
57
+ /** The two tokens one mode writes, from the Theme's depths. */
58
+ export function buildPhiSurfaceShadowTokens(shadows, mode) {
59
+ return {
60
+ surfaceShadowSoft: PHI_SURFACE_SHADOW_CSS[mode].soft[readPhiSurfaceShadowDepth(shadows, "soft")],
61
+ surfaceShadowStrong: PHI_SURFACE_SHADOW_CSS[mode].strong[readPhiSurfaceShadowDepth(shadows, "strong")],
62
+ };
63
+ }
@@ -42,9 +42,10 @@ export declare const PHI_THEME_TOKEN_KEYS: readonly ["colorBgContainer", "colorB
42
42
  * (theme/phi-theme-gradients.ts): tokens of this package's own, laid over the resolved ones so Ant
43
43
  * Design writes them per mode and per Surface tone like every other. The `custom*` names are the
44
44
  * palette's custom colours, laid over the same way (theme/phi-theme-palette.ts). `linkExternalMark` is
45
- * the `display` of the mark behind a link that leaves the Site (theme/phi-link-mark.ts).
45
+ * the `display` of the mark behind a link that leaves the Site (theme/phi-link-mark.ts). The
46
+ * `surfaceShadow*` names are what a Surface's `soft` and `strong` steps draw (theme/phi-surface-shadow.ts).
46
47
  */
47
- export declare const PHI_THEME_OWN_TOKEN_KEYS: readonly ["paddingXXL", "pageMax", "pagePaddingTopPhone", "pagePaddingRightPhone", "pagePaddingBottomPhone", "pagePaddingLeftPhone", "pagePaddingTopTablet", "pagePaddingRightTablet", "pagePaddingBottomTablet", "pagePaddingLeftTablet", "pagePaddingTopDesktop", "pagePaddingRightDesktop", "pagePaddingBottomDesktop", "pagePaddingLeftDesktop", "gradient1", "gradient1Text", "gradient2", "gradient2Text", "gradient3", "gradient3Text", "primaryButtonGradient", "primaryButtonGradientHover", "primaryButtonGradientActive", "primaryButtonGradientText", "linkExternalMark", "custom1", "custom2", "custom3", "custom4", "custom5", "custom6", "custom7", "custom8", "custom9", "custom10"];
48
+ export declare const PHI_THEME_OWN_TOKEN_KEYS: readonly ["paddingXXL", "pageMax", "pagePaddingTopPhone", "pagePaddingRightPhone", "pagePaddingBottomPhone", "pagePaddingLeftPhone", "pagePaddingTopTablet", "pagePaddingRightTablet", "pagePaddingBottomTablet", "pagePaddingLeftTablet", "pagePaddingTopDesktop", "pagePaddingRightDesktop", "pagePaddingBottomDesktop", "pagePaddingLeftDesktop", "gradient1", "gradient1Text", "gradient2", "gradient2Text", "gradient3", "gradient3Text", "primaryButtonGradient", "primaryButtonGradientHover", "primaryButtonGradientActive", "primaryButtonGradientText", "linkExternalMark", "surfaceShadowSoft", "surfaceShadowStrong", "custom1", "custom2", "custom3", "custom4", "custom5", "custom6", "custom7", "custom8", "custom9", "custom10"];
48
49
  /** The Page inset's names, per band and side (`PHI_LAYOUT.pagePadding`, `PHI_PAGE.padding`). */
49
50
  export declare const PHI_THEME_PAGE_PADDING_BANDS: readonly ["Phone", "Tablet", "Desktop"];
50
51
  export declare const PHI_THEME_PAGE_PADDING_SIDES: readonly ["Top", "Right", "Bottom", "Left"];
@@ -174,7 +174,8 @@ export const PHI_THEME_TOKEN_KEYS = [
174
174
  * (theme/phi-theme-gradients.ts): tokens of this package's own, laid over the resolved ones so Ant
175
175
  * Design writes them per mode and per Surface tone like every other. The `custom*` names are the
176
176
  * palette's custom colours, laid over the same way (theme/phi-theme-palette.ts). `linkExternalMark` is
177
- * the `display` of the mark behind a link that leaves the Site (theme/phi-link-mark.ts).
177
+ * the `display` of the mark behind a link that leaves the Site (theme/phi-link-mark.ts). The
178
+ * `surfaceShadow*` names are what a Surface's `soft` and `strong` steps draw (theme/phi-surface-shadow.ts).
178
179
  */
179
180
  export const PHI_THEME_OWN_TOKEN_KEYS = [
180
181
  "paddingXXL",
@@ -202,6 +203,8 @@ export const PHI_THEME_OWN_TOKEN_KEYS = [
202
203
  "primaryButtonGradientActive",
203
204
  "primaryButtonGradientText",
204
205
  "linkExternalMark",
206
+ "surfaceShadowSoft",
207
+ "surfaceShadowStrong",
205
208
  "custom1",
206
209
  "custom2",
207
210
  "custom3",
@@ -143,10 +143,6 @@ export type PhiImageWidgetPlacement = PhiWidgetPlacementBase & PhiMediaImageSour
143
143
  objectPosition?: string;
144
144
  title?: string;
145
145
  imageSize?: PhiImageWidgetSize;
146
- borderTopLeftRadius?: number | string;
147
- borderTopRightRadius?: number | string;
148
- borderBottomLeftRadius?: number | string;
149
- borderBottomRightRadius?: number | string;
150
146
  mask?: PhiMaskConfig;
151
147
  /** A picture field of the page record shown instead of the Widget's own picture. */
152
148
  recordField?: string;
@@ -7,6 +7,7 @@ import type { PhiThemeDerivation } from "../theme/phi-theme-selection";
7
7
  import type { PhiControlShapeCorners } from "../theme/phi-control-shape";
8
8
  import type { PhiThemeButtons } from "../theme/phi-button-shadow";
9
9
  import type { PhiThemeLinks } from "../theme/phi-link-mark";
10
+ import type { PhiThemeShadows } from "../theme/phi-surface-shadow";
10
11
  import type { PhiThemeTypography } from "../theme/phi-theme-typography";
11
12
  export type PhiSiteTheme = {
12
13
  mode?: "light" | "dark" | null;
@@ -53,6 +54,8 @@ export type PhiSiteTheme = {
53
54
  buttons?: PhiThemeButtons | null;
54
55
  /** Whether a link to another site wears its mark (theme/phi-link-mark.ts); absent is on. */
55
56
  links?: PhiThemeLinks | null;
57
+ /** The depth of a Surface's `soft` and `strong` shadow (theme/phi-surface-shadow.ts); absent is `normal`. */
58
+ shadows?: PhiThemeShadows | null;
56
59
  /** Which font slot the page's headings take; body unless stated (theme/phi-theme-typography.ts). */
57
60
  typography?: PhiThemeTypography | null;
58
61
  /** Site-level component overrides, merged per component over the shared component defaults. */