@phis/ui 0.6.10 → 0.6.11

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 (34) hide show
  1. package/components/controls/phi-padding-control.js +18 -5
  2. package/components/layouts/layout-definitions.d.ts +8 -0
  3. package/components/regions/presets/phi-base-page-column.js +1 -2
  4. package/components/regions/presets/phi-header-top-actions-layout.d.ts +2 -2
  5. package/components/regions/presets/phi-header-top-actions-layout.js +2 -4
  6. package/components/regions/presets/phi-settings-page-shell-tree.js +0 -2
  7. package/components/widgets/label-sets/padding.js +2 -0
  8. package/components/widgets/label-types/padding.d.ts +2 -0
  9. package/components/widgets/label-types/padding.js +1 -0
  10. package/helpers/cms-dialog.d.ts +0 -1
  11. package/helpers/cms-dialog.js +0 -1
  12. package/helpers/cms-layout-defaults.d.ts +4 -0
  13. package/helpers/cms-layout-defaults.js +14 -17
  14. package/helpers/cms-region-keys.d.ts +1 -1
  15. package/helpers/page-layout-check.js +4 -1
  16. package/package.json +1 -1
  17. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +0 -2
  18. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +0 -1
  19. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +1 -8
  20. package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +0 -2
  21. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +0 -2
  22. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +0 -1
  23. package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +0 -6
  24. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -1
  25. package/theme/antd-css-var-contract.d.ts +6 -0
  26. package/theme/antd-css-var-contract.js +6 -0
  27. package/theme/phi-theme-tokens.d.ts +3 -2
  28. package/theme/phi-theme-tokens.js +11 -1
  29. package/theme/phi-theme.d.ts +2 -0
  30. package/theme/phi-theme.js +2 -0
  31. package/theme/phi-tokens.d.ts +1 -0
  32. package/theme/phi-tokens.js +7 -0
  33. package/theme.d.ts +1 -1
  34. package/theme.js +1 -1
@@ -5,14 +5,20 @@ import { useMemo, useState } from "react";
5
5
  import { normalizePhiPaddingWidgetConfig } from "../../types/cms-config";
6
6
  import { PHI_PADDING_WIDGET_DEFAULT_LABELS, } from "../widgets/label-types/padding";
7
7
  import { usePhiConfig } from "../root/phi-config-provider";
8
+ import { PHI_LAYOUT_GAP } from "../../theme/antd-css-var-contract";
8
9
  import { PhiLabeledControl } from "./phi-labeled-control";
9
10
  import { PHI_SPACING_SCALE_KEYS, resolvePhiSpacingScaleKey, resolvePhiSpacingScaleValue, } from "../widgets/config/spacing-options";
10
11
  function normalizePaddingScaleKey(value) {
11
12
  return resolvePhiSpacingScaleKey(value);
12
13
  }
14
+ /*
15
+ * The gap select's word for "none stated": the Layout takes the Theme's Layout gap (`PHI_LAYOUT_GAP`).
16
+ * Choosing it clears the gap rather than writing the reference, so the node states nothing again.
17
+ */
18
+ const THEME_GAP = "theme";
13
19
  function resolveNextPadding(currentValue, key, value) {
14
20
  // A padding and a gap are steps of the same scale (theme/phi-tokens.ts).
15
- const nextValue = resolvePhiSpacingScaleValue(value);
21
+ const nextValue = value === THEME_GAP ? undefined : resolvePhiSpacingScaleValue(value);
16
22
  const nextPadding = {
17
23
  ...(currentValue ?? {}),
18
24
  [key]: nextValue ?? undefined,
@@ -45,8 +51,8 @@ function renderPaddingGridCell(content, style) {
45
51
  ...style,
46
52
  }, children: content }));
47
53
  }
48
- function renderPaddingInput(label, value, disabled, options, onChange) {
49
- return (_jsx(PhiLabeledControl, { description: label, fill: true, children: _jsx(Select, { "aria-label": label, disabled: disabled, value: normalizePaddingScaleKey(value) ?? "none", onChange: onChange, options: [...options], style: { width: "100%", minWidth: 0 } }) }));
54
+ function renderPaddingInput(label, value, disabled, options, onChange, unset = "none") {
55
+ return (_jsx(PhiLabeledControl, { description: label, fill: true, children: _jsx(Select, { "aria-label": label, disabled: disabled, value: normalizePaddingScaleKey(value) ?? unset, onChange: onChange, options: [...options], style: { width: "100%", minWidth: 0 } }) }));
50
56
  }
51
57
  export function PhiPaddingControl({ value, config, disabled = false, mode = "control", labels = PHI_PADDING_WIDGET_DEFAULT_LABELS, showGap = true, onChange, }) {
52
58
  const { token } = usePhiConfig();
@@ -60,6 +66,13 @@ export function PhiPaddingControl({ value, config, disabled = false, mode = "con
60
66
  const displayValue = displayState.source === currentValue ? displayState.value : currentValue;
61
67
  const resolvedDisplayValue = displayValue ?? currentValue;
62
68
  const resolvedGapValue = resolvedDisplayValue?.gap ?? null;
69
+ /*
70
+ * A Layout whose default gap is the Theme's -- the defaults handed in as `config` say so -- shows an
71
+ * unstated gap as "Theme" and offers it back; anything else keeps "none" for nothing stated.
72
+ */
73
+ const gapFollowsTheme = normalizePhiPaddingWidgetConfig(config ?? null)?.gap === PHI_LAYOUT_GAP;
74
+ const gapOptions = useMemo(() => (gapFollowsTheme ? [{ value: THEME_GAP, label: labels.gapTheme }, ...scaleOptions] : scaleOptions), [gapFollowsTheme, labels, scaleOptions]);
75
+ const displayGapValue = gapFollowsTheme && resolvedGapValue === PHI_LAYOUT_GAP ? null : resolvedGapValue;
63
76
  const grid = (_jsxs("div", { style: {
64
77
  display: "grid",
65
78
  gridTemplateColumns: "minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr)",
@@ -75,11 +88,11 @@ export function PhiPaddingControl({ value, config, disabled = false, mode = "con
75
88
  setDisplayState({ source: currentValue, value: nextPadding });
76
89
  emit(nextPadding);
77
90
  }), showGap
78
- ? renderPaddingInput(labels.fields.gap, resolvedGapValue, isDisabled, scaleOptions, (next) => {
91
+ ? renderPaddingInput(labels.fields.gap, displayGapValue, isDisabled, gapOptions, (next) => {
79
92
  const nextPadding = resolveNextPadding(resolvedDisplayValue, "gap", next);
80
93
  setDisplayState({ source: currentValue, value: nextPadding });
81
94
  emit(nextPadding);
82
- })
95
+ }, gapFollowsTheme ? THEME_GAP : "none")
83
96
  : renderPaddingGridCell(null), renderPaddingInput(labels.fields.right, resolvedDisplayValue?.paddingRight ?? resolvedDisplayValue?.padding, isDisabled, scaleOptions, (next) => {
84
97
  const nextPadding = resolveNextPadding(resolvedDisplayValue, "paddingRight", next);
85
98
  setDisplayState({ source: currentValue, value: nextPadding });
@@ -552,6 +552,10 @@ export declare const PHI_SPLIT_CARD_LAYOUT_DEFINITION: {
552
552
  [x: string]: unknown;
553
553
  };
554
554
  creationConfig: {
555
+ anchor: {
556
+ readonly horizontal: "center";
557
+ readonly vertical: "middle";
558
+ };
555
559
  surface: {
556
560
  readonly background: {
557
561
  readonly base: {
@@ -1291,6 +1295,10 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
1291
1295
  [x: string]: unknown;
1292
1296
  };
1293
1297
  creationConfig: {
1298
+ anchor: {
1299
+ readonly horizontal: "center";
1300
+ readonly vertical: "middle";
1301
+ };
1294
1302
  surface: {
1295
1303
  readonly background: {
1296
1304
  readonly base: {
@@ -37,8 +37,7 @@ export function buildPhiBasePageColumnFrame({ page, regionId, columnId, label, m
37
37
  * Region's (`buildPhiBasePageContentScaffold`), not the column's.
38
38
  */
39
39
  padding: PHI_SPACE.base,
40
- // The house step between a preset's children; the Widgets keep their own air inside.
41
- gap: PHI_SPACE.sm,
40
+ // No gap of its own: its children stand the Theme's Layout gap apart (`PHI_LAYOUT_GAP`).
42
41
  },
43
42
  }),
44
43
  ],
@@ -6,8 +6,8 @@ import type { PhiCmsInstanceId } from "../../../types/cms-instance-id";
6
6
  *
7
7
  * The three Areas carried the same node three times, and only its identity differs between them.
8
8
  *
9
- * The gap is the `sm` step of the spacing scale, so it follows a Theme that changes the scale. It was a
10
- * literal 12 in all three copies, a value the scale does not have.
9
+ * It states no gap: its actions stand the Theme's Layout gap apart (`PHI_LAYOUT_GAP`). It was a literal
10
+ * 12 in all three copies once, a value the scale does not have.
11
11
  */
12
12
  export declare function buildPhiHeaderTopActionsLayoutNode(nodes: PhiCmsPresetNodes, { id, parentLayoutNodeId, label, }: {
13
13
  id: PhiCmsInstanceId;
@@ -1,12 +1,11 @@
1
1
  import { PHI_CMS_THREE_COLUMN_LAYOUT_SLOT_INDEX } from "../../../constants/cms-layout-types";
2
- import { PHI_SPACE } from "../../../theme/antd-css-var-contract";
3
2
  /**
4
3
  * The row of account actions at the right of a workspace Area's top Header (Admin, Editor, Builder).
5
4
  *
6
5
  * The three Areas carried the same node three times, and only its identity differs between them.
7
6
  *
8
- * The gap is the `sm` step of the spacing scale, so it follows a Theme that changes the scale. It was a
9
- * literal 12 in all three copies, a value the scale does not have.
7
+ * It states no gap: its actions stand the Theme's Layout gap apart (`PHI_LAYOUT_GAP`). It was a literal
8
+ * 12 in all three copies once, a value the scale does not have.
10
9
  */
11
10
  export function buildPhiHeaderTopActionsLayoutNode(nodes, { id, parentLayoutNodeId, label, }) {
12
11
  return nodes.layout({
@@ -18,7 +17,6 @@ export function buildPhiHeaderTopActionsLayoutNode(nodes, { id, parentLayoutNode
18
17
  label,
19
18
  config: {
20
19
  anchor: { horizontal: "right", vertical: "middle" },
21
- gap: PHI_SPACE.sm,
22
20
  verticalSeparators: false,
23
21
  separatorBeforeFirst: true,
24
22
  separatorSpan: "50%",
@@ -1,7 +1,6 @@
1
1
  import { PHI_CMS_COLLAPSIBLE_LAYOUT_MAX_SLOTS, PHI_CMS_DEFAULT_SLOT_INDEX, } from "../../../constants/cms-layout-types";
2
2
  import { PhiCmsFlags, PhiCmsPageType } from "../../../constants/phi-cms";
3
3
  import { createPhiCmsPresetNodes } from "../../../helpers/cms-preset-nodes";
4
- import { PHI_SPACE } from "../../../theme/antd-css-var-contract";
5
4
  import { PHI_LAYOUT } from "../../../theme/phi-tokens";
6
5
  import { createPhiPresetCmsInstanceIdMap } from "../../../types/cms-instance-id";
7
6
  import { PHI_SIGNAL_VALUE_SCHEMAS, createPhiSignalAddress, createPhiSignalSubcontrolAddress, } from "../../../types/signals";
@@ -82,7 +81,6 @@ export function buildPhiSettingsPageShellTree({ page, ownerModuleId, presetKey,
82
81
  slotIndex: panelIndex,
83
82
  label: panel.title,
84
83
  config: {
85
- gap: PHI_SPACE.sm,
86
84
  padding: 0,
87
85
  /*
88
86
  * A panel reads from its left edge, as its title does. A vertical flex centres by default, and
@@ -14,6 +14,7 @@ const PHI_PADDING_WIDGET_LABEL_SET = definePhiLabelSet({
14
14
  field_right: PHI_PADDING_WIDGET_DEFAULT_LABELS.fields.right,
15
15
  field_bottom: PHI_PADDING_WIDGET_DEFAULT_LABELS.fields.bottom,
16
16
  placeholder_value: PHI_PADDING_WIDGET_DEFAULT_LABELS.placeholders.value,
17
+ gap_theme: PHI_PADDING_WIDGET_DEFAULT_LABELS.gapTheme,
17
18
  scale_size_none: PHI_PADDING_WIDGET_DEFAULT_LABELS.scaleSizes.none,
18
19
  scale_size_xxs: PHI_PADDING_WIDGET_DEFAULT_LABELS.scaleSizes.xxs,
19
20
  scale_size_xs: PHI_PADDING_WIDGET_DEFAULT_LABELS.scaleSizes.xs,
@@ -40,6 +41,7 @@ export async function getPhiPaddingWidgetLabels(options) {
40
41
  placeholders: {
41
42
  value: labels.placeholder_value,
42
43
  },
44
+ gapTheme: labels.gap_theme,
43
45
  scaleSizes: {
44
46
  none: labels.scale_size_none,
45
47
  xxs: labels.scale_size_xxs,
@@ -12,6 +12,8 @@ export type PhiPaddingWidgetLabels = {
12
12
  placeholders: {
13
13
  value: string;
14
14
  };
15
+ /** The gap select's choice for a Layout that takes the Theme's Layout gap. */
16
+ gapTheme: string;
15
17
  /** The steps of the spacing scale, as the select box in each cell of the grid names them. */
16
18
  scaleSizes: PhiSpacingScaleLabels;
17
19
  };
@@ -12,5 +12,6 @@ export const PHI_PADDING_WIDGET_DEFAULT_LABELS = {
12
12
  placeholders: {
13
13
  value: "none",
14
14
  },
15
+ gapTheme: "Theme",
15
16
  scaleSizes: { ...PHI_SPACING_SCALE_DEFAULT_LABELS },
16
17
  };
@@ -1,7 +1,6 @@
1
1
  import { type PhiFormDescriptor } from "@phis/contracts/forms";
2
2
  /** The body Layout's config: a vertical Flex with the `panel` creation preset under it. */
3
3
  export declare const PHI_DIALOG_BODY_CONFIG: {
4
- readonly gap: "var(--phi-padding-sm)";
5
4
  readonly margin: 0;
6
5
  readonly padding: "var(--phi-padding)";
7
6
  readonly surface: {
@@ -25,7 +25,6 @@ import { PHI_LAYOUT } from "../theme/phi-tokens";
25
25
  */
26
26
  /** The body Layout's config: a vertical Flex with the `panel` creation preset under it. */
27
27
  export const PHI_DIALOG_BODY_CONFIG = {
28
- gap: PHI_SPACE.sm,
29
28
  margin: 0,
30
29
  padding: PHI_SPACE.base,
31
30
  surface: PHI_SURFACE_WASH,
@@ -4,6 +4,10 @@ export type PhiLayoutDefaults = JsonRecord;
4
4
  export type PhiLayoutCreationPreset = "panel" | "overlay-actions" | "page-base";
5
5
  export declare const PHI_SPLIT_CARD_LAYOUT_DEFAULTS: PhiLayoutDefaults;
6
6
  export declare const PHI_SPLIT_CARD_LAYOUT_CREATION_CONFIG: {
7
+ readonly anchor: {
8
+ readonly horizontal: "center";
9
+ readonly vertical: "middle";
10
+ };
7
11
  readonly surface: {
8
12
  readonly background: {
9
13
  readonly base: {
@@ -1,4 +1,4 @@
1
- import { PHI_SPACE } from "../theme/antd-css-var-contract";
1
+ import { PHI_LAYOUT_GAP, PHI_SPACE } from "../theme/antd-css-var-contract";
2
2
  import { PHI_RENDERABLE_BLOCK_DEFAULT_ANCHOR } from "./renderable-block-defaults";
3
3
  import { isPhiRecord } from "./is-record";
4
4
  import { PHI_SEQUENCE_DEFAULT_DURATION_MS, PHI_SEQUENCE_DEFAULT_EASING } from "./motion";
@@ -8,7 +8,10 @@ import { PHI_MASONRY_LAYOUT_DEFAULT_COLUMNS } from "../components/layouts/phi-ma
8
8
  /*
9
9
  * What a Layout states when its node states nothing.
10
10
  *
11
- * Every gap is the small step (`sm`): one rhythm between children, whatever arranges them. The padding
11
+ * Every gap is the Theme's Layout gap (`PHI_LAYOUT_GAP`, `sm` unless the Theme says otherwise): one rhythm
12
+ * between children, whatever arranges them, and one the Site changes in its Theme. A creation preset
13
+ * therefore states no gap -- what it wrote would be the day's number, not the Theme's -- and a node that
14
+ * states one keeps it; only an Overlay's action row is closer on purpose (`xs`). The padding
12
15
  * follows what the Layout is for. A Layout that only arranges its children -- Content, Flex, the
13
16
  * vertical Flex, Stack, Carousel, Collapsible, Split Card -- has none, so nesting one in another adds
14
17
  * nothing. A Layout that shows a field of tiles -- Grid, Masonry -- keeps them off its edge by the base
@@ -28,9 +31,9 @@ const PHI_CONTENT_LAYOUT_PANEL_PRESET = {
28
31
  };
29
32
  const PHI_FLEX_LAYOUT_DEFAULTS = {
30
33
  distribution: "anchor",
31
- // A fresh row starts left-aligned and vertically centred, its children one small step apart.
34
+ // A fresh row starts left-aligned and vertically centred, its children the Theme's gap apart.
32
35
  anchor: { horizontal: "left", vertical: "middle" },
33
- gap: PHI_SPACE.sm,
36
+ gap: PHI_LAYOUT_GAP,
34
37
  verticalSeparators: false,
35
38
  separatorBeforeFirst: false,
36
39
  separatorSpan: "75%",
@@ -38,7 +41,6 @@ const PHI_FLEX_LAYOUT_DEFAULTS = {
38
41
  };
39
42
  const PHI_FLEX_LAYOUT_PANEL_PRESET = {
40
43
  distribution: "anchor",
41
- gap: PHI_SPACE.sm,
42
44
  verticalSeparators: false,
43
45
  separatorBeforeFirst: false,
44
46
  separatorSpan: "75%",
@@ -63,10 +65,9 @@ const PHI_FLEX_LAYOUT_OVERLAY_ACTIONS_PRESET = {
63
65
  width: "100%",
64
66
  };
65
67
  const PHI_FLEX_VERTICAL_LAYOUT_DEFAULTS = {
66
- gap: PHI_SPACE.sm,
68
+ gap: PHI_LAYOUT_GAP,
67
69
  };
68
70
  const PHI_FLEX_VERTICAL_LAYOUT_PANEL_PRESET = {
69
- gap: PHI_SPACE.sm,
70
71
  padding: PHI_SPACE.base,
71
72
  };
72
73
  /**
@@ -75,7 +76,6 @@ const PHI_FLEX_VERTICAL_LAYOUT_PANEL_PRESET = {
75
76
  * touching this config -- the preset tree contract rejects a deviating copy.
76
77
  */
77
78
  const PHI_FLEX_VERTICAL_LAYOUT_PAGE_BASE_PRESET = {
78
- gap: PHI_SPACE.sm,
79
79
  /*
80
80
  * None: the distance from the screen's edge is the content Region's, the Theme's Page padding in Public
81
81
  * and App (`buildPhiBasePageContentScaffold`). The scaffold only holds its slots together.
@@ -89,22 +89,20 @@ const PHI_FLEX_VERTICAL_LAYOUT_PAGE_BASE_PRESET = {
89
89
  width: "100%",
90
90
  };
91
91
  const PHI_GRID_LAYOUT_DEFAULTS = {
92
- gap: PHI_SPACE.sm,
92
+ gap: PHI_LAYOUT_GAP,
93
93
  padding: PHI_SPACE.base,
94
94
  columns: { ...PHI_GRID_LAYOUT_DEFAULT_COLUMNS },
95
95
  };
96
96
  const PHI_GRID_LAYOUT_PANEL_PRESET = {
97
- gap: PHI_SPACE.sm,
98
97
  padding: PHI_SPACE.base,
99
98
  };
100
99
  const PHI_MASONRY_LAYOUT_DEFAULTS = {
101
100
  columns: { ...PHI_MASONRY_LAYOUT_DEFAULT_COLUMNS },
102
- gap: PHI_SPACE.sm,
101
+ gap: PHI_LAYOUT_GAP,
103
102
  padding: PHI_SPACE.base,
104
103
  };
105
104
  const PHI_MASONRY_LAYOUT_PANEL_PRESET = {
106
105
  columns: { ...PHI_MASONRY_LAYOUT_DEFAULT_COLUMNS },
107
- gap: PHI_SPACE.sm,
108
106
  padding: PHI_SPACE.base,
109
107
  };
110
108
  const PHI_STACK_LAYOUT_DEFAULTS = {
@@ -181,13 +179,13 @@ const PHI_COLLAPSIBLE_LAYOUT_PANEL_PRESET = {
181
179
  /** A split card centres what stands in its cards, on both axes, unless it says otherwise. */
182
180
  const PHI_SPLIT_CARD_LAYOUT_DEFAULT_ANCHOR = { horizontal: "center", vertical: "middle" };
183
181
  /*
184
- * The two cards stand the small step apart. Their padding -- the distance from a card's edge to what
182
+ * The two cards stand the Theme's Layout gap apart. Their padding -- the distance from a card's edge to what
185
183
  * stands in it, as every Layout's padding is the distance from its own edge to its slots -- is none
186
184
  * until somebody states one.
187
185
  */
188
186
  export const PHI_SPLIT_CARD_LAYOUT_DEFAULTS = {
189
187
  anchor: PHI_SPLIT_CARD_LAYOUT_DEFAULT_ANCHOR,
190
- gap: PHI_SPACE.sm,
188
+ gap: PHI_LAYOUT_GAP,
191
189
  };
192
190
  /*
193
191
  * What a Split Card is created with: spaced, and its two halves drawn as cards. The Surface is the
@@ -195,20 +193,19 @@ export const PHI_SPLIT_CARD_LAYOUT_DEFAULTS = {
195
193
  * Card whose author took the cards away would have them back on the next render.
196
194
  */
197
195
  export const PHI_SPLIT_CARD_LAYOUT_CREATION_CONFIG = {
198
- ...PHI_SPLIT_CARD_LAYOUT_DEFAULTS,
196
+ anchor: PHI_SPLIT_CARD_LAYOUT_DEFAULT_ANCHOR,
199
197
  surface: PHI_SURFACE_CARD,
200
198
  };
201
199
  const PHI_SPLIT_CARD_LAYOUT_PANEL_PRESET = PHI_SPLIT_CARD_LAYOUT_CREATION_CONFIG;
202
200
  const PHI_THREE_COLUMN_LAYOUT_DEFAULTS = {
203
201
  balancedSides: true,
204
- gap: PHI_SPACE.sm,
202
+ gap: PHI_LAYOUT_GAP,
205
203
  wrap: false,
206
204
  paddingLeft: PHI_SPACE.base,
207
205
  paddingRight: PHI_SPACE.base,
208
206
  };
209
207
  const PHI_THREE_COLUMN_LAYOUT_PANEL_PRESET = {
210
208
  balancedSides: true,
211
- gap: PHI_SPACE.sm,
212
209
  wrap: false,
213
210
  paddingTop: 0,
214
211
  paddingBottom: 0,
@@ -32,5 +32,5 @@ export type PhiCmsRegionOwnership = "shell" | "page";
32
32
  * know is not a placement anybody chose -- refusing it would hide Widgets over a typo.
33
33
  */
34
34
  export declare function phiCmsRegionAcceptsWidget(regionKey: string | null | undefined, required: PhiCmsRegionOwnership | null | undefined): boolean;
35
- export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined): 11 | 10 | 12 | 40 | 50 | 20 | 21 | 25 | 30 | 39 | 41;
35
+ export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined): 11 | 10 | 12 | 50 | 40 | 20 | 21 | 25 | 30 | 39 | 41;
36
36
  export declare function resolvePhiCmsRegionKey(regionType: number | null | undefined): "content" | "header_top" | "header_main" | "header_bottom" | "sider_left" | "sider_right" | "hero" | "footer_top" | "footer_main" | "footer_bottom" | "drawer_right" | undefined;
@@ -1,5 +1,5 @@
1
1
  import { PhiCmsRegionType } from "../constants/phi-cms";
2
- import { PHI_PAGE, PHI_SPACE } from "../theme/antd-css-var-contract";
2
+ import { PHI_LAYOUT_GAP, PHI_PAGE, PHI_SPACE } from "../theme/antd-css-var-contract";
3
3
  import { resolvePhiPageInset } from "./page-inset";
4
4
  import { parsePhiCmsCarouselLayoutConfig, parsePhiCmsCollapsibleLayoutConfig, parsePhiCmsContentLayoutConfig, parsePhiCmsFlexLayoutConfig, parsePhiCmsFlexVerticalLayoutConfig, parsePhiCmsGridLayoutConfig, parsePhiCmsMasonryLayoutConfig, parsePhiCmsSplitCardLayoutConfig, parsePhiCmsStackLayoutConfig, parsePhiCmsThreeColumnLayoutConfig, } from "../types/cms-config";
5
5
  import { readPhiSurface } from "../types/surface";
@@ -34,6 +34,9 @@ function stepOf(value) {
34
34
  return "none";
35
35
  if (PAGE_INSET_REFERENCES.has(value))
36
36
  return "page";
37
+ // The Theme's Layout gap, what a Layout without a gap of its own takes (`PHI_LAYOUT_GAP`).
38
+ if (value === PHI_LAYOUT_GAP)
39
+ return "layout-gap";
37
40
  for (const [step, reference] of Object.entries(PHI_SPACE)) {
38
41
  if (value === reference)
39
42
  return step;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.6.10",
3
+ "version": "0.6.11",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -278,7 +278,6 @@ export async function buildPhiDefaultBuilderMediaPageTree({ page, runtime, }) {
278
278
  label: "dev header bottom three column",
279
279
  config: {
280
280
  balancedSides: false,
281
- gap: PHI_SPACE.sm,
282
281
  leftWidth: 130,
283
282
  rightWidth: 130,
284
283
  },
@@ -299,7 +298,6 @@ export async function buildPhiDefaultBuilderMediaPageTree({ page, runtime, }) {
299
298
  horizontal: "center",
300
299
  vertical: "top",
301
300
  },
302
- gap: PHI_SPACE.sm,
303
301
  margin: 0,
304
302
  },
305
303
  }),
@@ -226,7 +226,6 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
226
226
  label: "Builder inspector header",
227
227
  config: {
228
228
  anchor: { horizontal: "left", vertical: "middle" },
229
- gap: PHI_SPACE.sm,
230
229
  padding: 0,
231
230
  paddingLeft: PHI_SPACE.lg,
232
231
  },
@@ -493,7 +493,6 @@ export async function buildPhiDefaultBuilderAreaPresetTree({ page, runtime, }) {
493
493
  sortOrder: 0,
494
494
  label: "dev header main right actions",
495
495
  config: {
496
- gap: PHI_SPACE.sm,
497
496
  anchor: { horizontal: "right", vertical: "middle" },
498
497
  wrap: false,
499
498
  padding: 0,
@@ -904,7 +903,6 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
904
903
  horizontal: "center",
905
904
  vertical: "top",
906
905
  },
907
- gap: PHI_SPACE.sm,
908
906
  margin: 0,
909
907
  padding: PHI_SPACE.base,
910
908
  },
@@ -927,7 +925,6 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
927
925
  horizontal: "left",
928
926
  vertical: "top",
929
927
  },
930
- gap: PHI_SPACE.sm,
931
928
  wrap: true,
932
929
  margin: 0,
933
930
  padding: PHI_SPACE.base,
@@ -953,7 +950,6 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
953
950
  horizontal: "center",
954
951
  vertical: "top",
955
952
  },
956
- gap: PHI_SPACE.sm,
957
953
  margin: 0,
958
954
  padding: PHI_SPACE.base,
959
955
  },
@@ -987,7 +983,6 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
987
983
  config: {
988
984
  balancedSides: true,
989
985
  contentAlign: "center",
990
- gap: PHI_SPACE.sm,
991
986
  padding: PHI_SPACE.xs,
992
987
  paddingLeft: 0,
993
988
  paddingRight: 0,
@@ -1082,9 +1077,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1082
1077
  slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
1083
1078
  sortOrder: 0,
1084
1079
  label: "Builder area settings fields",
1085
- config: {
1086
- gap: PHI_SPACE.sm,
1087
- },
1080
+ config: {},
1088
1081
  }),
1089
1082
  nodes.layout({
1090
1083
  creationPreset: { layoutKind: "flex", preset: "overlay-actions" },
@@ -7,7 +7,6 @@ import { createPhiSignalAddress, PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../ty
7
7
  import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID } from "../../../../components/regions/presets/phi-base-page-layout";
8
8
  import { getPhiAdminLocalesPageLabels } from "./admin-locales-label-set";
9
9
  import { getPhiAdminLocalesWidgetLabels } from "../../../../components/widgets/label-sets/admin-locales";
10
- import { PHI_SPACE } from "../../../../theme/antd-css-var-contract";
11
10
  import { PHI_LOCALIZATION_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
12
11
  import { PHI_LOCALIZATION_FORM_IDS } from "../forms";
13
12
  import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
@@ -66,7 +65,6 @@ export async function buildPhiDefaultAdminLocalesPageTree({ page, runtime, }) {
66
65
  sortOrder: 0,
67
66
  label: labels.contentLabel,
68
67
  config: {
69
- gap: PHI_SPACE.sm,
70
68
  // One slot a row at every width: the form and the list stand under one another.
71
69
  columns: { compact: 1, medium: 1, wide: 1 },
72
70
  padding: 0,
@@ -211,7 +211,6 @@ export async function buildPhiDefaultSiteAreaPresetTree({ page, runtime, presetK
211
211
  horizontal: "right",
212
212
  vertical: "middle",
213
213
  },
214
- gap: PHI_SPACE.sm,
215
214
  paddingTop: PHI_SPACE.sm,
216
215
  paddingRight: PHI_SPACE.lg,
217
216
  paddingBottom: PHI_SPACE.sm,
@@ -264,7 +263,6 @@ export async function buildPhiDefaultSiteAreaPresetTree({ page, runtime, presetK
264
263
  horizontal: "center",
265
264
  vertical: "middle",
266
265
  },
267
- gap: PHI_SPACE.sm,
268
266
  paddingTop: PHI_SPACE.sm,
269
267
  paddingRight: PHI_SPACE.base,
270
268
  paddingBottom: PHI_SPACE.sm,
@@ -183,7 +183,6 @@ export async function buildPhiDefaultBuilderRevisionsPageTree({ page, runtime, }
183
183
  horizontal: "center",
184
184
  vertical: "top",
185
185
  },
186
- gap: PHI_SPACE.sm,
187
186
  margin: 0,
188
187
  padding: PHI_SPACE.base,
189
188
  },
@@ -212,7 +212,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
212
212
  horizontal: "left",
213
213
  vertical: "top",
214
214
  },
215
- gap: PHI_SPACE.sm,
216
215
  margin: 0,
217
216
  padding: PHI_SPACE.base,
218
217
  },
@@ -227,7 +226,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
227
226
  config: {
228
227
  balancedSides: true,
229
228
  contentAlign: "center",
230
- gap: PHI_SPACE.sm,
231
229
  padding: 0,
232
230
  paddingLeft: 0,
233
231
  paddingRight: 0,
@@ -259,7 +257,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
259
257
  sortOrder: 0,
260
258
  label: "Color",
261
259
  config: {
262
- gap: PHI_SPACE.sm,
263
260
  anchor: {
264
261
  horizontal: "left",
265
262
  vertical: "top",
@@ -279,7 +276,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
279
276
  sortOrder: 1,
280
277
  label: "Style",
281
278
  config: {
282
- gap: PHI_SPACE.sm,
283
279
  anchor: {
284
280
  horizontal: "left",
285
281
  vertical: "top",
@@ -303,7 +299,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
303
299
  sortOrder: 2,
304
300
  label: "Background",
305
301
  config: {
306
- gap: PHI_SPACE.sm,
307
302
  anchor: {
308
303
  horizontal: "left",
309
304
  vertical: "top",
@@ -323,7 +318,6 @@ export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, regis
323
318
  sortOrder: 3,
324
319
  label: "Brand",
325
320
  config: {
326
- gap: PHI_SPACE.sm,
327
321
  anchor: {
328
322
  horizontal: "left",
329
323
  vertical: "top",
@@ -29,7 +29,8 @@ import { PHI_CONTAINER_BREAKPOINT_REGION } from "../../../../../theme/phi-contai
29
29
  import { PHI_SPACE } from "../../../../../theme/antd-css-var-contract";
30
30
  import { PHI_THEME_PAGE_PADDING_BANDS, PHI_THEME_PAGE_PADDING_SCOPES, PHI_THEME_PAGE_PADDING_SIDES, } from "../../../../../theme/phi-theme-tokens";
31
31
  import { PHI_COLOR_PICKER_NEUTRAL_PRESETS, PHI_COLOR_PICKER_PRESETS } from "../../../../../components/widgets/config/color-picker-presets";
32
- import { PHI_SPACING_TOKEN_KEYS } from "../../../../../components/widgets/config/spacing-options";
32
+ import { PHI_SPACING_SCALE_KEYS, PHI_SPACING_TOKEN_KEYS, resolvePhiSpacingScaleKey, resolvePhiSpacingScaleValue, } from "../../../../../components/widgets/config/spacing-options";
33
+ import { PHI_SPACING_SCALE_DEFAULT_LABELS } from "../../../../../components/widgets/label-types/spacing-scale";
33
34
  import { PhiColorFieldControl } from "../../../../../components/controls/phi-color-field-control";
34
35
  import { usePhiColorControlPresets } from "../../../../../components/controls/use-phi-color-control-presets";
35
36
  import { PhiBrandControl, resolvePhiBrandLogoUrl } from "../../../../../components/controls/phi-brand-control";
@@ -91,6 +92,7 @@ const BRAND_THEME_STYLE_SECTION_KEYS = [
91
92
  "wireframe",
92
93
  "pageWidth",
93
94
  "pagePadding",
95
+ "layoutGap",
94
96
  ];
95
97
  /*
96
98
  * The shadow under each kind of Button (theme/phi-button-shadow.ts). "Theme" is no step at all -- the
@@ -1258,6 +1260,8 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
1258
1260
  `padding${side}`,
1259
1261
  readEffectiveTokenString(styleTokenInput, `${pagePaddingScope}${side}${pagePaddingBand}`, pagePaddingDefault),
1260
1262
  ]));
1263
+ // The gap of a Layout that states none (`PHI_LAYOUT_GAP`), as a step of the spacing scale.
1264
+ const layoutGap = resolvePhiSpacingScaleKey(readEffectiveTokenString(styleTokenInput, "layoutGap", PHI_SPACE[PHI_LAYOUT.layoutGap])) ?? PHI_LAYOUT.layoutGap;
1261
1265
  const baseFontSize = readEffectiveTokenNumber(styleTokenInput, "fontSize", 12);
1262
1266
  function updateToken(tokenPatch) {
1263
1267
  publishDraft(mergeThemeToken(state.draft, tokenPatch));
@@ -1404,6 +1408,18 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
1404
1408
  return [`${pagePaddingScope}${side}${pagePaddingBand}`, value == null ? undefined : value];
1405
1409
  }))) }), _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." })] })),
1406
1410
  },
1411
+ {
1412
+ /*
1413
+ * The distance between a Layout's children, rows and columns alike, where the Layout states
1414
+ * none (`PHI_LAYOUT_GAP`): a Flex, a vertical Flex, a Grid, a Masonry, a Three-column row, a
1415
+ * Split Card. A Layout that states its own gap keeps it.
1416
+ */
1417
+ key: "layoutGap",
1418
+ label: _jsx(PhiTypographyControl, { strong: true, children: "Layout Gap" }),
1419
+ children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: [_jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: "Gap" }), _jsx(PhiSelectControl, { ariaLabel: "Layout gap", size: "medium", value: layoutGap, options: PHI_SPACING_SCALE_KEYS.map((key) => ({ value: key, label: PHI_SPACING_SCALE_DEFAULT_LABELS[key] })), style: { minWidth: 0, flex: "1 1 auto" }, onChange: (key) => updateToken({
1420
+ layoutGap: key === PHI_LAYOUT.layoutGap ? undefined : resolvePhiSpacingScaleValue(key),
1421
+ }) })] }), _jsx(PhiTypographyControl, { type: "secondary", children: "Between the rows and columns of a Layout that does not set its own gap." })] })),
1422
+ },
1407
1423
  ] }) })] }));
1408
1424
  }
1409
1425
  /**
@@ -90,6 +90,12 @@ export declare const PHI_PAGE: {
90
90
  readonly left: "var(--phi-signed-in-page-inset-left, var(--phi-signed-in-page-padding-left-desktop))";
91
91
  };
92
92
  };
93
+ /**
94
+ * The gap of a Layout that states none: the Theme's `layoutGap` (theme/phi-tokens.ts, `PHI_LAYOUT.layoutGap`,
95
+ * `sm` unless the Theme says otherwise). A Layout's defaults read it, so a Layout without a gap of its own
96
+ * follows the Theme; a preset leaves the gap out rather than stating this.
97
+ */
98
+ export declare const PHI_LAYOUT_GAP = "var(--phi-layout-gap)";
93
99
  export declare const PHI_RADIUS: {
94
100
  readonly xxs: "var(--phi-border-radius-xs)";
95
101
  readonly xs: "var(--phi-border-radius-sm)";
@@ -108,6 +108,12 @@ export const PHI_PAGE = {
108
108
  left: "var(--phi-signed-in-page-inset-left, var(--phi-signed-in-page-padding-left-desktop))",
109
109
  },
110
110
  };
111
+ /**
112
+ * The gap of a Layout that states none: the Theme's `layoutGap` (theme/phi-tokens.ts, `PHI_LAYOUT.layoutGap`,
113
+ * `sm` unless the Theme says otherwise). A Layout's defaults read it, so a Layout without a gap of its own
114
+ * follows the Theme; a preset leaves the gap out rather than stating this.
115
+ */
116
+ export const PHI_LAYOUT_GAP = "var(--phi-layout-gap)";
111
117
  export const PHI_RADIUS = {
112
118
  xxs: "var(--phi-border-radius-xs)",
113
119
  xs: "var(--phi-border-radius-sm)",
@@ -36,7 +36,8 @@ export declare const PHI_THEME_TOKEN_KEYS: readonly ["colorBgContainer", "colorB
36
36
  * needs one of these reads it as a CSS variable, the way a Server Component does.
37
37
  *
38
38
  * `pageMax` is how wide a Page may get (theme/phi-tokens.ts, `PHI_LAYOUT.pageMax`); a Page reads it
39
- * as `PHI_PAGE.max`.
39
+ * as `PHI_PAGE.max`. `layoutGap` is the gap of a Layout that states none (`PHI_LAYOUT.layoutGap`), read
40
+ * as `PHI_LAYOUT_GAP`.
40
41
  *
41
42
  * The `gradient*` names are the Theme's gradient slots and the primary Buttons' run
42
43
  * (theme/phi-theme-gradients.ts): tokens of this package's own, laid over the resolved ones so Ant
@@ -45,7 +46,7 @@ export declare const PHI_THEME_TOKEN_KEYS: readonly ["colorBgContainer", "colorB
45
46
  * the `display` of the mark behind a link that leaves the Site (theme/phi-link-mark.ts). The
46
47
  * `surfaceShadow*` names are what a Surface's `soft` and `strong` steps draw (theme/phi-surface-shadow.ts).
47
48
  */
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"];
49
+ 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", "layoutGap", "gradient1", "gradient1Text", "gradient2", "gradient2Text", "gradient3", "gradient3Text", "primaryButtonGradient", "primaryButtonGradientHover", "primaryButtonGradientActive", "primaryButtonGradientText", "linkExternalMark", "surfaceShadowSoft", "surfaceShadowStrong", "custom1", "custom2", "custom3", "custom4", "custom5", "custom6", "custom7", "custom8", "custom9", "custom10"];
49
50
  /** The Page inset's names, per band and side (`PHI_LAYOUT.pagePadding`, `PHI_PAGE.padding`). */
50
51
  export declare const PHI_THEME_PAGE_PADDING_BANDS: readonly ["Phone", "Tablet", "Desktop"];
51
52
  export declare const PHI_THEME_PAGE_PADDING_SIDES: readonly ["Top", "Right", "Bottom", "Left"];
@@ -168,7 +168,8 @@ export const PHI_THEME_TOKEN_KEYS = [
168
168
  * needs one of these reads it as a CSS variable, the way a Server Component does.
169
169
  *
170
170
  * `pageMax` is how wide a Page may get (theme/phi-tokens.ts, `PHI_LAYOUT.pageMax`); a Page reads it
171
- * as `PHI_PAGE.max`.
171
+ * as `PHI_PAGE.max`. `layoutGap` is the gap of a Layout that states none (`PHI_LAYOUT.layoutGap`), read
172
+ * as `PHI_LAYOUT_GAP`.
172
173
  *
173
174
  * The `gradient*` names are the Theme's gradient slots and the primary Buttons' run
174
175
  * (theme/phi-theme-gradients.ts): tokens of this package's own, laid over the resolved ones so Ant
@@ -204,6 +205,7 @@ export const PHI_THEME_OWN_TOKEN_KEYS = [
204
205
  "signedInPagePaddingRightDesktop",
205
206
  "signedInPagePaddingBottomDesktop",
206
207
  "signedInPagePaddingLeftDesktop",
208
+ "layoutGap",
207
209
  "gradient1",
208
210
  "gradient1Text",
209
211
  "gradient2",
@@ -295,6 +297,7 @@ export function assertPhiThemeVocabulary({ palette, styleToken, modeSeedKeys, so
295
297
  }
296
298
  violations.push(...readPhiThemePageMaxViolations(styleToken, source));
297
299
  violations.push(...readPhiThemePagePaddingViolations(styleToken, source));
300
+ violations.push(...readPhiThemeLayoutGapViolations(styleToken, source));
298
301
  if (violations.length > 0) {
299
302
  throw new Error(violations.join(" "));
300
303
  }
@@ -318,6 +321,13 @@ function readPhiThemePagePaddingViolations(styleToken, source) {
318
321
  return [`${source}: the style token states ${key} as ${JSON.stringify(value)}, which is not a step of the spacing scale.`];
319
322
  });
320
323
  }
324
+ /** A Layout's gap is a step of the spacing scale, or none, for the same reason as a Page's inset. */
325
+ function readPhiThemeLayoutGapViolations(styleToken, source) {
326
+ const value = styleToken?.layoutGap;
327
+ if (value == null || new Set([...Object.values(PHI_SPACE), 0, "0"]).has(value))
328
+ return [];
329
+ return [`${source}: the style token states layoutGap as ${JSON.stringify(value)}, which is not a step of the spacing scale.`];
330
+ }
321
331
  function readPhiThemePageMaxViolations(styleToken, source) {
322
332
  const value = styleToken?.pageMax;
323
333
  if (value == null)
@@ -58,6 +58,8 @@ export type PhiThemeTokens = {
58
58
  signedInPagePaddingRightDesktop: string;
59
59
  signedInPagePaddingBottomDesktop: string;
60
60
  signedInPagePaddingLeftDesktop: string;
61
+ /** The gap of a Layout that states none (`PHI_LAYOUT.layoutGap`), published as `--phi-layout-gap`. */
62
+ layoutGap: string;
61
63
  marginXXS: number;
62
64
  marginXS: number;
63
65
  marginSM: number;
@@ -44,6 +44,8 @@ function buildPhiThemeTokens(options = {}) {
44
44
  signedInPagePaddingRightDesktop: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.desktop],
45
45
  signedInPagePaddingBottomDesktop: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.desktop],
46
46
  signedInPagePaddingLeftDesktop: PHI_SPACE[PHI_LAYOUT.signedInPagePadding.desktop],
47
+ // The gap of a Layout that states none, a step of the spacing scale (`PHI_LAYOUT.layoutGap`).
48
+ layoutGap: PHI_SPACE[PHI_LAYOUT.layoutGap],
47
49
  // Ant Design's second family, on the same scale: its own components read it (phi-tokens.ts).
48
50
  marginXXS: PHI_PADDING_VALUES.xxs,
49
51
  marginXS: PHI_PADDING_VALUES.xs,
@@ -99,6 +99,7 @@ export declare const PHI_LAYOUT: {
99
99
  readonly tablet: "base";
100
100
  readonly desktop: "base";
101
101
  };
102
+ readonly layoutGap: "sm";
102
103
  readonly readingMax: 754;
103
104
  readonly heroHeight: 377;
104
105
  };
@@ -155,6 +155,13 @@ export const PHI_LAYOUT = {
155
155
  * The Theme's as well, read as `PHI_PAGE.signedInPadding`.
156
156
  */
157
157
  signedInPagePadding: { phone: "sm", tablet: "base", desktop: "base" },
158
+ /*
159
+ * The distance between a Layout's children, its rows and its columns alike, where the Layout states
160
+ * none: a Flex, a vertical Flex, a Grid, a Masonry, a Three-column row and a Split Card. A step of the
161
+ * spacing scale, `sm` by default; the Theme's to change for the whole Site, read as `PHI_LAYOUT_GAP`.
162
+ * A Layout that states its own gap keeps it.
163
+ */
164
+ layoutGap: "sm",
158
165
  /*
159
166
  * How wide a column of prose is allowed to get: an article, an entry and what stands around it.
160
167
  *
package/theme.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { isPhiThemePaletteModeSeedKey, mergePhiThemePalettes, PHI_THEME_CUSTOM_COLOR_KEYS, PHI_THEME_PALETTE_MODE_SEED_KEYS, type PhiThemeCustomColorKey, type PhiThemeCustomColorPalette, type PhiThemeMode, type PhiThemePalette, type PhiThemePaletteMode, type PhiThemePresetPlugin, } from "./theme/phi-theme-presets";
2
2
  export * from "./theme/phi-tokens";
3
- export { PHI_COLOR, PHI_PAGE, PHI_RADIUS, PHI_SPACE } from "./theme/antd-css-var-contract";
3
+ export { PHI_COLOR, PHI_LAYOUT_GAP, PHI_PAGE, PHI_RADIUS, PHI_SPACE } from "./theme/antd-css-var-contract";
4
4
  export { type PhiThemeBlockIdentity, type PhiThemeFontsBlock, type PhiThemeGroundBlock, type PhiThemePaletteBlock, type PhiThemeSetBlock, type PhiThemeStyleBlock, } from "./theme/phi-theme-blocks";
package/theme.js CHANGED
@@ -5,5 +5,5 @@ export * from "./theme/phi-tokens";
5
5
  * Each is a reference the Theme resolves per Site and per mode, never a value of its own, so a preset
6
6
  * that names one follows whatever Theme it lands in (THEME.md, "Phi scale").
7
7
  */
8
- export { PHI_COLOR, PHI_PAGE, PHI_RADIUS, PHI_SPACE } from "./theme/antd-css-var-contract";
8
+ export { PHI_COLOR, PHI_LAYOUT_GAP, PHI_PAGE, PHI_RADIUS, PHI_SPACE } from "./theme/antd-css-var-contract";
9
9
  export {} from "./theme/phi-theme-blocks";