@phis/ui 0.6.7 → 0.6.9
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/regions/presets/phi-base-page-column.d.ts +2 -2
- package/components/regions/presets/phi-base-page-column.js +8 -8
- package/components/regions/presets/phi-base-page-layout.d.ts +2 -1
- package/components/regions/presets/phi-base-page-layout.js +26 -2
- package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
- package/components/root/phi-root-theme-resolver.js +2 -0
- package/helpers/cms-layout-defaults.js +5 -1
- package/helpers/layout-style.d.ts +2 -2
- package/helpers/layout-style.js +5 -3
- package/package.json +1 -1
- package/plugins/runtime-modules/auth/trees/phi-default-pub-confirm-page-tree.js +1 -1
- package/plugins/runtime-modules/auth/trees/phi-default-pub-login-page-tree.js +1 -1
- package/plugins/runtime-modules/auth/trees/phi-default-pub-registration-page-tree.js +1 -1
- package/plugins/runtime-modules/auth/trees/phi-default-pub-reset-password-page-tree.js +1 -1
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +1 -1
- package/plugins/runtime-modules/public/trees/phi-default-pub-contact-page-tree.js +1 -1
- package/plugins/runtime-modules/theme/brand-theme-model.d.ts +2 -2
- package/plugins/runtime-modules/theme/brand-theme-model.js +4 -3
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +38 -9
- package/styles/shell.css +15 -2
- package/theme/antd-css-var-contract.d.ts +6 -5
- package/theme/antd-css-var-contract.js +10 -5
- package/theme/phi-surface-shadow.d.ts +30 -0
- package/theme/phi-surface-shadow.js +63 -0
- package/theme/phi-theme-tokens.d.ts +5 -2
- package/theme/phi-theme-tokens.js +19 -2
- package/theme/phi-theme.d.ts +12 -0
- package/theme/phi-theme.js +13 -0
- package/theme/phi-tokens.d.ts +5 -0
- package/theme/phi-tokens.js +6 -0
- 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
|
|
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 {
|
|
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
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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 } 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,31 @@ export function buildPhiBasePageLayoutNode(page) {
|
|
|
47
49
|
label: PHI_BASE_PAGE_LAYOUT_LABEL,
|
|
48
50
|
});
|
|
49
51
|
}
|
|
52
|
+
/** Public: its content Region stands in by the Theme's Page padding; the signed-in Areas by their own. */
|
|
53
|
+
const PHI_PUBLIC_AREA_MASK = resolvePhiCmsAreaMask("public");
|
|
54
|
+
/**
|
|
55
|
+
* The distance from the screen's edge to a Page's content, on its content Region and nowhere else.
|
|
56
|
+
*
|
|
57
|
+
* Both are the Theme's (THEME.md "Page padding"): in Public `PHI_PAGE.padding` (21 on a phone and 34
|
|
58
|
+
* from a tablet on unless the Theme says otherwise), in App and the staff Areas `PHI_PAGE.signedInPadding`
|
|
59
|
+
* (13 on a phone, 21 from a tablet on). The Hero and the Footer top are Regions of their own and keep the
|
|
60
|
+
* full width. The scaffold inside has no padding; what stands in it with a ground of its own -- the wash
|
|
61
|
+
* column, a Split Card's cards -- insets its content by `base`.
|
|
62
|
+
*/
|
|
63
|
+
function resolvePhiBasePageRegionInset(page) {
|
|
64
|
+
const publicPage = page.areaMask !== 0 && (page.areaMask & ~PHI_PUBLIC_AREA_MASK) === 0;
|
|
65
|
+
const inset = publicPage ? PHI_PAGE.padding : PHI_PAGE.signedInPadding;
|
|
66
|
+
return {
|
|
67
|
+
paddingTop: inset.top,
|
|
68
|
+
paddingRight: inset.right,
|
|
69
|
+
paddingBottom: inset.bottom,
|
|
70
|
+
paddingLeft: inset.left,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
50
73
|
/**
|
|
51
74
|
* 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.
|
|
75
|
+
* preset's synthetic id -- and spans the full page width; the built-in pages set no reading width. It
|
|
76
|
+
* carries the Page's inset (`resolvePhiBasePageRegionInset`); a `regionConfig` the caller states wins.
|
|
53
77
|
* Only the tree below the root is standardised.
|
|
54
78
|
*/
|
|
55
79
|
export function buildPhiBasePageContentScaffold({ page, regionId, regionConfig, }) {
|
|
@@ -59,7 +83,7 @@ export function buildPhiBasePageContentScaffold({ page, regionId, regionConfig,
|
|
|
59
83
|
regionType: PhiCmsRegionType.Content,
|
|
60
84
|
rootLayoutNodeId: PHI_BASE_PAGE_LAYOUT_NODE_ID,
|
|
61
85
|
sortOrder: 30,
|
|
62
|
-
config: regionConfig,
|
|
86
|
+
config: { ...resolvePhiBasePageRegionInset(page), ...regionConfig },
|
|
63
87
|
}),
|
|
64
88
|
layoutNode: buildPhiBasePageLayoutNode(page),
|
|
65
89
|
};
|
|
@@ -41,7 +41,7 @@ export function buildPhiSettingsPageShellTree({ page, ownerModuleId, presetKey,
|
|
|
41
41
|
});
|
|
42
42
|
const layoutNodes = [
|
|
43
43
|
scaffold.layoutNode,
|
|
44
|
-
// The
|
|
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
|
-
|
|
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:
|
|
27
|
-
readonly strong:
|
|
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, }: {
|
package/helpers/layout-style.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { PHI_COLOR
|
|
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
|
-
|
|
24
|
-
|
|
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
|
@@ -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;
|
|
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;
|
|
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;
|
|
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;
|
|
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
|
|
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;
|
|
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
|
|
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
|
|
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";
|
|
@@ -26,7 +27,7 @@ import { buildPhiThemeStructuralTokens } from "../../../../../theme/phi-theme";
|
|
|
26
27
|
import { PHI_CONTROL_HEIGHTS, PHI_LAYOUT, PHI_PADDING, PHI_RADII, } from "../../../../../theme/phi-tokens";
|
|
27
28
|
import { PHI_CONTAINER_BREAKPOINT_REGION } from "../../../../../theme/phi-container-breakpoints";
|
|
28
29
|
import { PHI_SPACE } from "../../../../../theme/antd-css-var-contract";
|
|
29
|
-
import { PHI_THEME_PAGE_PADDING_BANDS, PHI_THEME_PAGE_PADDING_SIDES } from "../../../../../theme/phi-theme-tokens";
|
|
30
|
+
import { PHI_THEME_PAGE_PADDING_BANDS, PHI_THEME_PAGE_PADDING_SCOPES, PHI_THEME_PAGE_PADDING_SIDES, } from "../../../../../theme/phi-theme-tokens";
|
|
30
31
|
import { PHI_COLOR_PICKER_NEUTRAL_PRESETS, PHI_COLOR_PICKER_PRESETS } from "../../../../../components/widgets/config/color-picker-presets";
|
|
31
32
|
import { PHI_SPACING_TOKEN_KEYS } from "../../../../../components/widgets/config/spacing-options";
|
|
32
33
|
import { PhiColorFieldControl } from "../../../../../components/controls/phi-color-field-control";
|
|
@@ -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) {
|
|
@@ -1233,10 +1251,12 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1233
1251
|
const wireframe = readEffectiveTokenBoolean(styleTokenInput, "wireframe", true);
|
|
1234
1252
|
const pageMax = readEffectiveTokenNumber(styleTokenInput, "pageMax", PHI_LAYOUT.pageMax);
|
|
1235
1253
|
const [pagePaddingBand, setPagePaddingBand] = useState("Phone");
|
|
1236
|
-
|
|
1254
|
+
// Whose inset is edited: Public's (`pagePadding…`) or the signed-in Areas' (`signedInPagePadding…`).
|
|
1255
|
+
const [pagePaddingScope, setPagePaddingScope] = useState("pagePadding");
|
|
1256
|
+
const pagePaddingDefault = PHI_SPACE[PHI_LAYOUT[pagePaddingScope][pagePaddingBand.toLowerCase()]];
|
|
1237
1257
|
const pagePadding = Object.fromEntries(PHI_THEME_PAGE_PADDING_SIDES.map((side) => [
|
|
1238
1258
|
`padding${side}`,
|
|
1239
|
-
readEffectiveTokenString(styleTokenInput,
|
|
1259
|
+
readEffectiveTokenString(styleTokenInput, `${pagePaddingScope}${side}${pagePaddingBand}`, pagePaddingDefault),
|
|
1240
1260
|
]));
|
|
1241
1261
|
const baseFontSize = readEffectiveTokenNumber(styleTokenInput, "fontSize", 12);
|
|
1242
1262
|
function updateToken(tokenPatch) {
|
|
@@ -1312,6 +1332,11 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1312
1332
|
...PHI_THEME_GRADIENT_KEYS.map((key, index) => ({ value: key, label: `Gradient ${index + 1}` })),
|
|
1313
1333
|
], onChange: (choice) => publishDraft(mergeThemePrimaryButtonGradient(state.draft, choice === "none" ? null : choice)) })] })),
|
|
1314
1334
|
},
|
|
1335
|
+
{
|
|
1336
|
+
key: "surfaceShadow",
|
|
1337
|
+
label: _jsx(PhiTypographyControl, { strong: true, children: "Surface Shadow" }),
|
|
1338
|
+
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)))] })),
|
|
1339
|
+
},
|
|
1315
1340
|
{
|
|
1316
1341
|
key: "externalLinks",
|
|
1317
1342
|
label: _jsx(PhiTypographyControl, { strong: true, children: "External Links" }),
|
|
@@ -1364,16 +1389,20 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1364
1389
|
},
|
|
1365
1390
|
{
|
|
1366
1391
|
/*
|
|
1367
|
-
* How far a Page's content stands in
|
|
1368
|
-
* below
|
|
1369
|
-
*
|
|
1392
|
+
* How far a Page's content stands in, per side and per screen -- a phone below 768, a tablet
|
|
1393
|
+
* below 1200, a desktop from there -- in Public (`PHI_PAGE.padding`) and in the signed-in
|
|
1394
|
+
* Areas (`PHI_PAGE.signedInPadding`). The default of a Page's content Region; a Region that
|
|
1395
|
+
* states its own padding keeps it.
|
|
1370
1396
|
*/
|
|
1371
1397
|
key: "pagePadding",
|
|
1372
1398
|
label: _jsx(PhiTypographyControl, { strong: true, children: "Page Padding" }),
|
|
1373
|
-
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: [_jsx(PhiSegmentedControl, { value:
|
|
1399
|
+
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: [_jsx(PhiSegmentedControl, { value: pagePaddingScope, options: [
|
|
1400
|
+
{ value: "pagePadding", label: "Public" },
|
|
1401
|
+
{ value: "signedInPagePadding", label: "Signed in" },
|
|
1402
|
+
], onChange: setPagePaddingScope }), _jsx(PhiSegmentedControl, { value: pagePaddingBand, options: PHI_THEME_PAGE_PADDING_BANDS.map((band) => ({ value: band, label: band })), onChange: setPagePaddingBand }), _jsx(PhiPaddingControl, { value: pagePadding, showGap: false, onChange: (next) => updateToken(Object.fromEntries(PHI_THEME_PAGE_PADDING_SIDES.map((side) => {
|
|
1374
1403
|
const value = next?.[`padding${side}`] ?? next?.padding;
|
|
1375
|
-
return [
|
|
1376
|
-
}))) }), _jsx(PhiTypographyControl, { type: "secondary", children: "The default of a Page that does not set its own: a phone below 768px, a tablet below 1200px." })] })),
|
|
1404
|
+
return [`${pagePaddingScope}${side}${pagePaddingBand}`, value == null ? undefined : value];
|
|
1405
|
+
}))) }), _jsx(PhiTypographyControl, { type: "secondary", children: "The default of a Page that does not set its own, in Public or in App and the staff Areas: a phone below 768px, a tablet below 1200px." })] })),
|
|
1377
1406
|
},
|
|
1378
1407
|
] }) })] }));
|
|
1379
1408
|
}
|
package/styles/shell.css
CHANGED
|
@@ -53,8 +53,9 @@
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
/*
|
|
56
|
-
* Page inset: how far a Page's content stands in (`PHI_PAGE.padding`
|
|
57
|
-
*
|
|
56
|
+
* Page inset: how far a Page's content stands in (`PHI_PAGE.padding` in Public, `PHI_PAGE.signedInPadding`
|
|
57
|
+
* in the signed-in Areas), by the same device bands. The Theme states four sides per band
|
|
58
|
+
* (`pagePadding<Side><Band>`, `signedInPagePadding<Side><Band>`, theme/phi-tokens.ts); these rules hand the
|
|
58
59
|
* band the screen is in to everything inside the Shell, and a Page column reads only the chosen one. A
|
|
59
60
|
* Layout that states its own padding is not reading it.
|
|
60
61
|
*/
|
|
@@ -63,6 +64,10 @@
|
|
|
63
64
|
--phi-page-inset-right: var(--phi-page-padding-right-desktop);
|
|
64
65
|
--phi-page-inset-bottom: var(--phi-page-padding-bottom-desktop);
|
|
65
66
|
--phi-page-inset-left: var(--phi-page-padding-left-desktop);
|
|
67
|
+
--phi-signed-in-page-inset-top: var(--phi-signed-in-page-padding-top-desktop);
|
|
68
|
+
--phi-signed-in-page-inset-right: var(--phi-signed-in-page-padding-right-desktop);
|
|
69
|
+
--phi-signed-in-page-inset-bottom: var(--phi-signed-in-page-padding-bottom-desktop);
|
|
70
|
+
--phi-signed-in-page-inset-left: var(--phi-signed-in-page-padding-left-desktop);
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
@container phi-render-viewport (width < 1200px) {
|
|
@@ -71,6 +76,10 @@
|
|
|
71
76
|
--phi-page-inset-right: var(--phi-page-padding-right-tablet);
|
|
72
77
|
--phi-page-inset-bottom: var(--phi-page-padding-bottom-tablet);
|
|
73
78
|
--phi-page-inset-left: var(--phi-page-padding-left-tablet);
|
|
79
|
+
--phi-signed-in-page-inset-top: var(--phi-signed-in-page-padding-top-tablet);
|
|
80
|
+
--phi-signed-in-page-inset-right: var(--phi-signed-in-page-padding-right-tablet);
|
|
81
|
+
--phi-signed-in-page-inset-bottom: var(--phi-signed-in-page-padding-bottom-tablet);
|
|
82
|
+
--phi-signed-in-page-inset-left: var(--phi-signed-in-page-padding-left-tablet);
|
|
74
83
|
}
|
|
75
84
|
}
|
|
76
85
|
|
|
@@ -80,6 +89,10 @@
|
|
|
80
89
|
--phi-page-inset-right: var(--phi-page-padding-right-phone);
|
|
81
90
|
--phi-page-inset-bottom: var(--phi-page-padding-bottom-phone);
|
|
82
91
|
--phi-page-inset-left: var(--phi-page-padding-left-phone);
|
|
92
|
+
--phi-signed-in-page-inset-top: var(--phi-signed-in-page-padding-top-phone);
|
|
93
|
+
--phi-signed-in-page-inset-right: var(--phi-signed-in-page-padding-right-phone);
|
|
94
|
+
--phi-signed-in-page-inset-bottom: var(--phi-signed-in-page-padding-bottom-phone);
|
|
95
|
+
--phi-signed-in-page-inset-left: var(--phi-signed-in-page-padding-left-phone);
|
|
83
96
|
}
|
|
84
97
|
}
|
|
85
98
|
|
|
@@ -83,6 +83,12 @@ export declare const PHI_PAGE: {
|
|
|
83
83
|
readonly bottom: "var(--phi-page-inset-bottom, var(--phi-page-padding-bottom-desktop))";
|
|
84
84
|
readonly left: "var(--phi-page-inset-left, var(--phi-page-padding-left-desktop))";
|
|
85
85
|
};
|
|
86
|
+
readonly signedInPadding: {
|
|
87
|
+
readonly top: "var(--phi-signed-in-page-inset-top, var(--phi-signed-in-page-padding-top-desktop))";
|
|
88
|
+
readonly right: "var(--phi-signed-in-page-inset-right, var(--phi-signed-in-page-padding-right-desktop))";
|
|
89
|
+
readonly bottom: "var(--phi-signed-in-page-inset-bottom, var(--phi-signed-in-page-padding-bottom-desktop))";
|
|
90
|
+
readonly left: "var(--phi-signed-in-page-inset-left, var(--phi-signed-in-page-padding-left-desktop))";
|
|
91
|
+
};
|
|
86
92
|
};
|
|
87
93
|
export declare const PHI_RADIUS: {
|
|
88
94
|
readonly xxs: "var(--phi-border-radius-xs)";
|
|
@@ -99,11 +105,6 @@ export declare const PHI_CONTROL: {
|
|
|
99
105
|
readonly md: "var(--phi-control-height)";
|
|
100
106
|
readonly lg: "var(--phi-control-height-lg)";
|
|
101
107
|
};
|
|
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
108
|
export declare const PHI_FONT_SIZE: {
|
|
108
109
|
readonly base: "var(--phi-font-size)";
|
|
109
110
|
readonly sm: "var(--phi-font-size-sm)";
|
|
@@ -97,6 +97,16 @@ export const PHI_PAGE = {
|
|
|
97
97
|
bottom: "var(--phi-page-inset-bottom, var(--phi-page-padding-bottom-desktop))",
|
|
98
98
|
left: "var(--phi-page-inset-left, var(--phi-page-padding-left-desktop))",
|
|
99
99
|
},
|
|
100
|
+
/*
|
|
101
|
+
* The same in the signed-in Areas -- App and the staff Areas: the Theme's `signedInPagePadding<Side><Band>`
|
|
102
|
+
* for the band the screen is in.
|
|
103
|
+
*/
|
|
104
|
+
signedInPadding: {
|
|
105
|
+
top: "var(--phi-signed-in-page-inset-top, var(--phi-signed-in-page-padding-top-desktop))",
|
|
106
|
+
right: "var(--phi-signed-in-page-inset-right, var(--phi-signed-in-page-padding-right-desktop))",
|
|
107
|
+
bottom: "var(--phi-signed-in-page-inset-bottom, var(--phi-signed-in-page-padding-bottom-desktop))",
|
|
108
|
+
left: "var(--phi-signed-in-page-inset-left, var(--phi-signed-in-page-padding-left-desktop))",
|
|
109
|
+
},
|
|
100
110
|
};
|
|
101
111
|
export const PHI_RADIUS = {
|
|
102
112
|
xxs: "var(--phi-border-radius-xs)",
|
|
@@ -113,11 +123,6 @@ export const PHI_CONTROL = {
|
|
|
113
123
|
md: "var(--phi-control-height)",
|
|
114
124
|
lg: "var(--phi-control-height-lg)",
|
|
115
125
|
};
|
|
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
126
|
export const PHI_FONT_SIZE = {
|
|
122
127
|
base: "var(--phi-font-size)",
|
|
123
128
|
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,12 +42,15 @@ 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", "signedInPagePaddingTopPhone", "signedInPagePaddingRightPhone", "signedInPagePaddingBottomPhone", "signedInPagePaddingLeftPhone", "signedInPagePaddingTopTablet", "signedInPagePaddingRightTablet", "signedInPagePaddingBottomTablet", "signedInPagePaddingLeftTablet", "signedInPagePaddingTopDesktop", "signedInPagePaddingRightDesktop", "signedInPagePaddingBottomDesktop", "signedInPagePaddingLeftDesktop", "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"];
|
|
52
|
+
/** Whose inset a token is: Public's (`pagePadding…`) or the signed-in Areas' (`signedInPagePadding…`). */
|
|
53
|
+
export declare const PHI_THEME_PAGE_PADDING_SCOPES: readonly ["pagePadding", "signedInPagePadding"];
|
|
51
54
|
export type PhiThemeTokenKey = (typeof PHI_THEME_TOKEN_KEYS)[number];
|
|
52
55
|
/**
|
|
53
56
|
* The resolved Theme, in the names above and their Ant Design value types.
|
|
@@ -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",
|
|
@@ -191,6 +192,18 @@ export const PHI_THEME_OWN_TOKEN_KEYS = [
|
|
|
191
192
|
"pagePaddingRightDesktop",
|
|
192
193
|
"pagePaddingBottomDesktop",
|
|
193
194
|
"pagePaddingLeftDesktop",
|
|
195
|
+
"signedInPagePaddingTopPhone",
|
|
196
|
+
"signedInPagePaddingRightPhone",
|
|
197
|
+
"signedInPagePaddingBottomPhone",
|
|
198
|
+
"signedInPagePaddingLeftPhone",
|
|
199
|
+
"signedInPagePaddingTopTablet",
|
|
200
|
+
"signedInPagePaddingRightTablet",
|
|
201
|
+
"signedInPagePaddingBottomTablet",
|
|
202
|
+
"signedInPagePaddingLeftTablet",
|
|
203
|
+
"signedInPagePaddingTopDesktop",
|
|
204
|
+
"signedInPagePaddingRightDesktop",
|
|
205
|
+
"signedInPagePaddingBottomDesktop",
|
|
206
|
+
"signedInPagePaddingLeftDesktop",
|
|
194
207
|
"gradient1",
|
|
195
208
|
"gradient1Text",
|
|
196
209
|
"gradient2",
|
|
@@ -202,6 +215,8 @@ export const PHI_THEME_OWN_TOKEN_KEYS = [
|
|
|
202
215
|
"primaryButtonGradientActive",
|
|
203
216
|
"primaryButtonGradientText",
|
|
204
217
|
"linkExternalMark",
|
|
218
|
+
"surfaceShadowSoft",
|
|
219
|
+
"surfaceShadowStrong",
|
|
205
220
|
"custom1",
|
|
206
221
|
"custom2",
|
|
207
222
|
"custom3",
|
|
@@ -216,7 +231,9 @@ export const PHI_THEME_OWN_TOKEN_KEYS = [
|
|
|
216
231
|
/** The Page inset's names, per band and side (`PHI_LAYOUT.pagePadding`, `PHI_PAGE.padding`). */
|
|
217
232
|
export const PHI_THEME_PAGE_PADDING_BANDS = ["Phone", "Tablet", "Desktop"];
|
|
218
233
|
export const PHI_THEME_PAGE_PADDING_SIDES = ["Top", "Right", "Bottom", "Left"];
|
|
219
|
-
|
|
234
|
+
/** Whose inset a token is: Public's (`pagePadding…`) or the signed-in Areas' (`signedInPagePadding…`). */
|
|
235
|
+
export const PHI_THEME_PAGE_PADDING_SCOPES = ["pagePadding", "signedInPagePadding"];
|
|
236
|
+
const PHI_THEME_PAGE_PADDING_TOKEN_KEYS = PHI_THEME_PAGE_PADDING_SCOPES.flatMap((scope) => PHI_THEME_PAGE_PADDING_BANDS.flatMap((band) => PHI_THEME_PAGE_PADDING_SIDES.map((side) => `${scope}${side}${band}`)));
|
|
220
237
|
/**
|
|
221
238
|
* The colours a palette seeds, shared by both modes.
|
|
222
239
|
*
|
package/theme/phi-theme.d.ts
CHANGED
|
@@ -46,6 +46,18 @@ export type PhiThemeTokens = {
|
|
|
46
46
|
pagePaddingRightDesktop: string;
|
|
47
47
|
pagePaddingBottomDesktop: string;
|
|
48
48
|
pagePaddingLeftDesktop: string;
|
|
49
|
+
signedInPagePaddingTopPhone: string;
|
|
50
|
+
signedInPagePaddingRightPhone: string;
|
|
51
|
+
signedInPagePaddingBottomPhone: string;
|
|
52
|
+
signedInPagePaddingLeftPhone: string;
|
|
53
|
+
signedInPagePaddingTopTablet: string;
|
|
54
|
+
signedInPagePaddingRightTablet: string;
|
|
55
|
+
signedInPagePaddingBottomTablet: string;
|
|
56
|
+
signedInPagePaddingLeftTablet: string;
|
|
57
|
+
signedInPagePaddingTopDesktop: string;
|
|
58
|
+
signedInPagePaddingRightDesktop: string;
|
|
59
|
+
signedInPagePaddingBottomDesktop: string;
|
|
60
|
+
signedInPagePaddingLeftDesktop: string;
|
|
49
61
|
marginXXS: number;
|
|
50
62
|
marginXS: number;
|
|
51
63
|
marginSM: number;
|
package/theme/phi-theme.js
CHANGED
|
@@ -31,6 +31,19 @@ function buildPhiThemeTokens(options = {}) {
|
|
|
31
31
|
pagePaddingRightDesktop: PHI_SPACE[PHI_LAYOUT.pagePadding.desktop],
|
|
32
32
|
pagePaddingBottomDesktop: PHI_SPACE[PHI_LAYOUT.pagePadding.desktop],
|
|
33
33
|
pagePaddingLeftDesktop: PHI_SPACE[PHI_LAYOUT.pagePadding.desktop],
|
|
34
|
+
// The signed-in Areas' inset, the same way (`PHI_LAYOUT.signedInPagePadding`).
|
|
35
|
+
signedInPagePaddingTopPhone: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.phone],
|
|
36
|
+
signedInPagePaddingRightPhone: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.phone],
|
|
37
|
+
signedInPagePaddingBottomPhone: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.phone],
|
|
38
|
+
signedInPagePaddingLeftPhone: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.phone],
|
|
39
|
+
signedInPagePaddingTopTablet: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.tablet],
|
|
40
|
+
signedInPagePaddingRightTablet: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.tablet],
|
|
41
|
+
signedInPagePaddingBottomTablet: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.tablet],
|
|
42
|
+
signedInPagePaddingLeftTablet: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.tablet],
|
|
43
|
+
signedInPagePaddingTopDesktop: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.desktop],
|
|
44
|
+
signedInPagePaddingRightDesktop: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.desktop],
|
|
45
|
+
signedInPagePaddingBottomDesktop: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.desktop],
|
|
46
|
+
signedInPagePaddingLeftDesktop: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.desktop],
|
|
34
47
|
// Ant Design's second family, on the same scale: its own components read it (phi-tokens.ts).
|
|
35
48
|
marginXXS: PHI_PADDING_VALUES.xxs,
|
|
36
49
|
marginXS: PHI_PADDING_VALUES.xs,
|
package/theme/phi-tokens.d.ts
CHANGED
|
@@ -94,6 +94,11 @@ export declare const PHI_LAYOUT: {
|
|
|
94
94
|
readonly tablet: "md";
|
|
95
95
|
readonly desktop: "md";
|
|
96
96
|
};
|
|
97
|
+
readonly signedInPagePadding: {
|
|
98
|
+
readonly phone: "sm";
|
|
99
|
+
readonly tablet: "base";
|
|
100
|
+
readonly desktop: "base";
|
|
101
|
+
};
|
|
97
102
|
readonly readingMax: 754;
|
|
98
103
|
readonly heroHeight: 377;
|
|
99
104
|
};
|
package/theme/phi-tokens.js
CHANGED
|
@@ -149,6 +149,12 @@ export const PHI_LAYOUT = {
|
|
|
149
149
|
* `PHI_PAGE.padding`, and a Layout that states its own padding keeps it.
|
|
150
150
|
*/
|
|
151
151
|
pagePadding: { phone: "base", tablet: "md", desktop: "md" },
|
|
152
|
+
/*
|
|
153
|
+
* The same inset in the signed-in Areas -- App and the staff Areas -- where a Page is a tool among the
|
|
154
|
+
* Shell's navigation rather than a page to read: one step below Public, a phone again one below the
|
|
155
|
+
* rest. The Theme's as well, read as `PHI_PAGE.signedInPadding`.
|
|
156
|
+
*/
|
|
157
|
+
signedInPagePadding: { phone: "sm", tablet: "base", desktop: "base" },
|
|
152
158
|
/*
|
|
153
159
|
* How wide a column of prose is allowed to get: an article, an entry and what stands around it.
|
|
154
160
|
*
|
package/types/site-config.d.ts
CHANGED
|
@@ -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. */
|