@phis/ui 0.6.7 → 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 (26) hide show
  1. package/components/regions/presets/phi-base-page-column.d.ts +2 -2
  2. package/components/regions/presets/phi-base-page-column.js +8 -8
  3. package/components/regions/presets/phi-base-page-layout.d.ts +2 -1
  4. package/components/regions/presets/phi-base-page-layout.js +27 -2
  5. package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
  6. package/components/root/phi-root-theme-resolver.js +2 -0
  7. package/helpers/cms-layout-defaults.js +5 -1
  8. package/helpers/layout-style.d.ts +2 -2
  9. package/helpers/layout-style.js +5 -3
  10. package/package.json +1 -1
  11. package/plugins/runtime-modules/auth/trees/phi-default-pub-confirm-page-tree.js +1 -1
  12. package/plugins/runtime-modules/auth/trees/phi-default-pub-login-page-tree.js +1 -1
  13. package/plugins/runtime-modules/auth/trees/phi-default-pub-registration-page-tree.js +1 -1
  14. package/plugins/runtime-modules/auth/trees/phi-default-pub-reset-password-page-tree.js +1 -1
  15. package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +1 -1
  16. package/plugins/runtime-modules/public/trees/phi-default-pub-contact-page-tree.js +1 -1
  17. package/plugins/runtime-modules/theme/brand-theme-model.d.ts +2 -2
  18. package/plugins/runtime-modules/theme/brand-theme-model.js +4 -3
  19. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +23 -0
  20. package/theme/antd-css-var-contract.d.ts +0 -5
  21. package/theme/antd-css-var-contract.js +0 -5
  22. package/theme/phi-surface-shadow.d.ts +30 -0
  23. package/theme/phi-surface-shadow.js +63 -0
  24. package/theme/phi-theme-tokens.d.ts +3 -2
  25. package/theme/phi-theme-tokens.js +4 -1
  26. package/types/site-config.d.ts +3 -0
@@ -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.7",
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" },
@@ -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",
@@ -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. */