@phis/ui 0.5.0 → 0.5.2

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 (49) hide show
  1. package/components/controls/phi-button-control.d.ts +7 -1
  2. package/components/media/phi-asset-folder-control.js +1 -1
  3. package/components/regions/presets/content-entry-editor-page-tree.js +1 -1
  4. package/components/regions/presets/phi-base-page-column.d.ts +5 -2
  5. package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
  6. package/components/shell/phi-antd-icon.d.ts +4 -0
  7. package/components/shell/phi-antd-icon.js +8 -0
  8. package/components/shell/phi-icon.d.ts +18 -0
  9. package/components/shell/phi-icon.js +50 -3
  10. package/components/widgets/client/shared/phi-button-icons.d.ts +7 -0
  11. package/components/widgets/client/shared/phi-button-icons.js +15 -67
  12. package/components/widgets/label-types/common-controls.js +12 -12
  13. package/helpers/cms-region-keys.d.ts +1 -1
  14. package/package.json +1 -1
  15. package/plugins/runtime-modules/accounting/presets.d.ts +10 -1
  16. package/plugins/runtime-modules/accounting/presets.js +25 -8
  17. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-area-preset-tree.d.ts +6 -0
  18. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-area-preset-tree.js +53 -0
  19. package/plugins/runtime-modules/area-definitions.d.ts +48 -6
  20. package/plugins/runtime-modules/area-definitions.js +8 -0
  21. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +1 -1
  22. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +2 -2
  23. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +2 -2
  24. package/plugins/runtime-modules/core/widgets/header-navigation/authoring.js +2 -3
  25. package/plugins/runtime-modules/core/widgets/header-navigation/client.d.ts +1 -3
  26. package/plugins/runtime-modules/core/widgets/header-navigation/client.js +9 -5
  27. package/plugins/runtime-modules/core/widgets/header-navigation/config.d.ts +1 -4
  28. package/plugins/runtime-modules/core/widgets/header-navigation/plugin.js +2 -3
  29. package/plugins/runtime-modules/core/widgets/header-navigation/server.d.ts +2 -2
  30. package/plugins/runtime-modules/core/widgets/header-navigation/server.js +1 -2
  31. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +1 -1
  32. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +1 -1
  33. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +1 -1
  34. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +14 -1
  35. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +2 -2
  36. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +1 -1
  37. package/styles/controls.css +24 -0
  38. package/theme/antd-css-var-contract.d.ts +9 -0
  39. package/theme/antd-css-var-contract.js +9 -0
  40. package/theme/phi-container-breakpoints.d.ts +4 -1
  41. package/theme/phi-container-breakpoints.js +4 -1
  42. package/theme/phi-theme-tokens.d.ts +4 -1
  43. package/theme/phi-theme-tokens.js +24 -0
  44. package/theme/phi-theme.d.ts +2 -0
  45. package/theme/phi-theme.js +1 -0
  46. package/theme/phi-tokens.d.ts +1 -1
  47. package/theme/phi-tokens.js +13 -2
  48. package/theme.d.ts +1 -1
  49. package/theme.js +1 -1
@@ -44,7 +44,13 @@ export type PhiButtonControlProps = {
44
44
  */
45
45
  external?: boolean;
46
46
  tooltip?: ReactNode;
47
- icon?: ReactNode;
47
+ /**
48
+ * The icon, as an element. A name is resolved before it gets here -- `resolvePhiButtonIcon` for a
49
+ * Widget's configured name, `PhiIcon` otherwise -- because a control draws and resolves nothing: resolving
50
+ * here put the icon resolver and the whole name list into every page with a Button, the error pages among
51
+ * them. A string is refused by the type, so a name can never be drawn as text.
52
+ */
53
+ icon?: Exclude<ReactNode, string>;
48
54
  type?: PhiButtonType;
49
55
  /** A round button is what an icon on its own wants, over a picture or in a toolbar. */
50
56
  shape?: ButtonProps["shape"];
@@ -5,7 +5,7 @@ import { PhiCascaderControl } from "../controls/phi-cascader-control";
5
5
  import { PhiToolbarControl } from "../controls/phi-toolbar-control";
6
6
  import { resolvePhiButtonIcon } from "../widgets/client/shared/phi-button-icons";
7
7
  export function PhiAssetFolderControl({ value, options, placeholder, createLabel, showCreate = false, createDisabled = false, lock = null, allowClear = true, size, style, onChange, onCreate, }) {
8
- const create = showCreate && onCreate ? (_jsx(PhiButtonControl, { ariaLabel: createLabel, tooltip: createLabel, icon: resolvePhiButtonIcon("add"), type: "primary", size: size, disabled: createDisabled, onClick: onCreate })) : null;
8
+ const create = showCreate && onCreate ? (_jsx(PhiButtonControl, { ariaLabel: createLabel, tooltip: createLabel, icon: resolvePhiButtonIcon("plus"), type: "primary", size: size, disabled: createDisabled, onClick: onCreate })) : null;
9
9
  /*
10
10
  * Drawn as the state it is in: a closed lock on a locked Folder, an open one on an unlocked one, and
11
11
  * the tooltip names what pressing it does.
@@ -187,7 +187,7 @@ function buildEntryDialogNodes(nodes, input) {
187
187
  * follows from that and is not stated -- a compact group does not wrap.
188
188
  */
189
189
  buttons: [
190
- { key: "cancel", emits: [{ capabilityId: "close", value: null }], label: input.cancelLabel, icon: "cancel" },
190
+ { key: "cancel", emits: [{ capabilityId: "close", value: null }], label: input.cancelLabel, icon: "close" },
191
191
  { key: "save", emits: [{ capabilityId: "submit", value: null }], label: input.saveLabel, variant: "primary", icon: "save" },
192
192
  ],
193
193
  signalRoutes: {
@@ -18,8 +18,11 @@ export declare function buildPhiBasePageColumnFrame({ page, regionId, columnId,
18
18
  regionId: number;
19
19
  columnId: PhiCmsInstanceId;
20
20
  label: string;
21
- /** Where the column stops, a `PHI_LAYOUT` measure: `readingMax` for prose, `contentMaxWide` for a page. */
22
- maxWidth: number;
21
+ /**
22
+ * Where the column stops: a `PHI_LAYOUT` measure such as `readingMax` for prose, or `PHI_PAGE.max` for a
23
+ * Page as wide as the Theme lets one get.
24
+ */
25
+ maxWidth: number | string;
23
26
  }): {
24
27
  regions: import("../../../types").PhiCmsRegionNode[];
25
28
  layoutNodes: import("../../../types").PhiCmsLayoutNode[];
@@ -308,7 +308,7 @@ export function buildPhiSettingsPageShellTree({ page, ownerModuleId, presetKey,
308
308
  key: "cancel",
309
309
  emits: [{ capabilityId: "close", value: null }],
310
310
  ...(overlay.cancelLabel ? { label: overlay.cancelLabel } : { action: "cancel" }),
311
- icon: "cancel",
311
+ icon: "close",
312
312
  },
313
313
  {
314
314
  key: "submit",
@@ -9,6 +9,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
9
9
  readonly AppstoreOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/AppstoreOutlined")>;
10
10
  readonly ArrowDownOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ArrowDownOutlined")>;
11
11
  readonly ArrowUpOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ArrowUpOutlined")>;
12
+ readonly AuditOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/AuditOutlined")>;
12
13
  readonly AudioTwoTone: () => Promise<typeof import("@ant-design/icons/es/icons/AudioTwoTone")>;
13
14
  readonly BgColorsOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/BgColorsOutlined")>;
14
15
  readonly BlockOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/BlockOutlined")>;
@@ -60,6 +61,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
60
61
  readonly LayoutOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LayoutOutlined")>;
61
62
  readonly LeftOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LeftOutlined")>;
62
63
  readonly LinkOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LinkOutlined")>;
64
+ readonly LoginOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LoginOutlined")>;
63
65
  readonly LockOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LockOutlined")>;
64
66
  readonly LogoutOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LogoutOutlined")>;
65
67
  readonly MailOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/MailOutlined")>;
@@ -76,6 +78,8 @@ declare const PHI_ANTD_ICON_LOADERS: {
76
78
  readonly PauseCircleOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/PauseCircleOutlined")>;
77
79
  readonly PlayCircleFilled: () => Promise<typeof import("@ant-design/icons-svg/es/asn/PlayCircleFilled")>;
78
80
  readonly PlayCircleOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/PlayCircleOutlined")>;
81
+ readonly PlusCircleOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/PlusCircleOutlined")>;
82
+ readonly OrderedListOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/OrderedListOutlined")>;
79
83
  readonly PlusOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/PlusOutlined")>;
80
84
  readonly ProfileOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ProfileOutlined")>;
81
85
  readonly QuestionCircleOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/QuestionCircleOutlined")>;
@@ -30,6 +30,7 @@ const PHI_ANTD_ICON_LOADERS = {
30
30
  AppstoreOutlined: () => import("@ant-design/icons-svg/es/asn/AppstoreOutlined"),
31
31
  ArrowDownOutlined: () => import("@ant-design/icons-svg/es/asn/ArrowDownOutlined"),
32
32
  ArrowUpOutlined: () => import("@ant-design/icons-svg/es/asn/ArrowUpOutlined"),
33
+ AuditOutlined: () => import("@ant-design/icons-svg/es/asn/AuditOutlined"),
33
34
  AudioTwoTone: () => import("@ant-design/icons/es/icons/AudioTwoTone"),
34
35
  BgColorsOutlined: () => import("@ant-design/icons-svg/es/asn/BgColorsOutlined"),
35
36
  BlockOutlined: () => import("@ant-design/icons-svg/es/asn/BlockOutlined"),
@@ -81,6 +82,7 @@ const PHI_ANTD_ICON_LOADERS = {
81
82
  LayoutOutlined: () => import("@ant-design/icons-svg/es/asn/LayoutOutlined"),
82
83
  LeftOutlined: () => import("@ant-design/icons-svg/es/asn/LeftOutlined"),
83
84
  LinkOutlined: () => import("@ant-design/icons-svg/es/asn/LinkOutlined"),
85
+ LoginOutlined: () => import("@ant-design/icons-svg/es/asn/LoginOutlined"),
84
86
  LockOutlined: () => import("@ant-design/icons-svg/es/asn/LockOutlined"),
85
87
  LogoutOutlined: () => import("@ant-design/icons-svg/es/asn/LogoutOutlined"),
86
88
  MailOutlined: () => import("@ant-design/icons-svg/es/asn/MailOutlined"),
@@ -97,6 +99,8 @@ const PHI_ANTD_ICON_LOADERS = {
97
99
  PauseCircleOutlined: () => import("@ant-design/icons-svg/es/asn/PauseCircleOutlined"),
98
100
  PlayCircleFilled: () => import("@ant-design/icons-svg/es/asn/PlayCircleFilled"),
99
101
  PlayCircleOutlined: () => import("@ant-design/icons-svg/es/asn/PlayCircleOutlined"),
102
+ PlusCircleOutlined: () => import("@ant-design/icons-svg/es/asn/PlusCircleOutlined"),
103
+ OrderedListOutlined: () => import("@ant-design/icons-svg/es/asn/OrderedListOutlined"),
100
104
  PlusOutlined: () => import("@ant-design/icons-svg/es/asn/PlusOutlined"),
101
105
  ProfileOutlined: () => import("@ant-design/icons-svg/es/asn/ProfileOutlined"),
102
106
  QuestionCircleOutlined: () => import("@ant-design/icons-svg/es/asn/QuestionCircleOutlined"),
@@ -275,6 +279,7 @@ export const PHI_ANTD_ICON_NAMES = {
275
279
  "arrow-down-outlined": "ArrowDownOutlined",
276
280
  "arrow-up": "ArrowUpOutlined",
277
281
  "arrow-up-outlined": "ArrowUpOutlined",
282
+ "audit": "AuditOutlined",
278
283
  "audio-two-tone": "AudioTwoTone",
279
284
  "bg-colors": "BgColorsOutlined",
280
285
  "bg-colors-outlined": "BgColorsOutlined",
@@ -326,6 +331,9 @@ export const PHI_ANTD_ICON_NAMES = {
326
331
  "share-alt-outlined": "ShareAltOutlined",
327
332
  sun: "SunOutlined",
328
333
  "sun-outlined": "SunOutlined",
334
+ "ordered-list-outlined": "OrderedListOutlined",
335
+ "login": "LoginOutlined",
336
+ "plus-circle-outlined": "PlusCircleOutlined",
329
337
  "unordered-list": "UnorderedListOutlined",
330
338
  "unordered-list-outlined": "UnorderedListOutlined",
331
339
  up: "UpOutlined",
@@ -8,5 +8,23 @@ type PhiIconProps = {
8
8
  name?: string;
9
9
  size?: number | string;
10
10
  } & PhiAntdIconPresentation;
11
+ /**
12
+ * Whether `PhiIcon` draws something for `name`: the one rule every icon name in this house follows.
13
+ *
14
+ * A name without a prefix is an Ant Design icon from `PHI_ANTD_ICON_NAMES` and means the same as
15
+ * `antd:<name>`. One name per icon, and the same name in a Button, a Table action, a Command Toolbar and a
16
+ * preset: there are no aliases (`add`, `cancel`, `trash`) beside it, and case counts. `module:`,
17
+ * `iconify:`, `asset:` and the Builder's motif namespaces are drawn by their own owners, which say for
18
+ * themselves whether the name exists, so here they count as known.
19
+ */
20
+ export declare function isPhiIconNameKnown(name: string): boolean;
21
+ /**
22
+ * Says once per name that it names no icon, where somebody reads it.
23
+ *
24
+ * An unknown name draws nothing -- no word, no placeholder -- so without this a typo is a blank nobody
25
+ * notices. Rendered on the server the warning lands in the Site service's journal, in the browser in its
26
+ * console. `validate-preset-icon-vocabulary` catches the same mistake in a preset before it ships.
27
+ */
28
+ export declare function reportPhiUnknownIconName(name: string): void;
11
29
  export declare function PhiIcon({ name, size, ...presentation }: PhiIconProps): import("react").JSX.Element | null;
12
30
  export {};
@@ -28,14 +28,57 @@ function renderIconFallback(size) {
28
28
  height: size,
29
29
  } }));
30
30
  }
31
+ function isPhiBuilderIconNamespace(namespace) {
32
+ return namespace.endsWith("/layouts") || namespace.endsWith("/widgets");
33
+ }
34
+ /**
35
+ * Whether `PhiIcon` draws something for `name`: the one rule every icon name in this house follows.
36
+ *
37
+ * A name without a prefix is an Ant Design icon from `PHI_ANTD_ICON_NAMES` and means the same as
38
+ * `antd:<name>`. One name per icon, and the same name in a Button, a Table action, a Command Toolbar and a
39
+ * preset: there are no aliases (`add`, `cancel`, `trash`) beside it, and case counts. `module:`,
40
+ * `iconify:`, `asset:` and the Builder's motif namespaces are drawn by their own owners, which say for
41
+ * themselves whether the name exists, so here they count as known.
42
+ */
43
+ export function isPhiIconNameKnown(name) {
44
+ const [namespace, ...rest] = name.split(":");
45
+ const value = rest.join(":");
46
+ if (!value)
47
+ return Object.hasOwn(PHI_ANTD_ICON_NAMES, name);
48
+ if (isPhiBuilderIconNamespace(namespace))
49
+ return true;
50
+ switch (namespace) {
51
+ case PHI_MODULE_ICON_NAMESPACE:
52
+ case "iconify":
53
+ case "asset":
54
+ return true;
55
+ case "antd":
56
+ return Object.hasOwn(PHI_ANTD_ICON_NAMES, value);
57
+ default:
58
+ return false;
59
+ }
60
+ }
61
+ const reportedUnknownIconNames = new Set();
62
+ /**
63
+ * Says once per name that it names no icon, where somebody reads it.
64
+ *
65
+ * An unknown name draws nothing -- no word, no placeholder -- so without this a typo is a blank nobody
66
+ * notices. Rendered on the server the warning lands in the Site service's journal, in the browser in its
67
+ * console. `validate-preset-icon-vocabulary` catches the same mistake in a preset before it ships.
68
+ */
69
+ export function reportPhiUnknownIconName(name) {
70
+ if (reportedUnknownIconNames.has(name))
71
+ return;
72
+ reportedUnknownIconNames.add(name);
73
+ console.warn(`[phi-icon] "${name}" names no icon and draws nothing. Use a name from PHI_ANTD_ICON_NAMES `
74
+ + "(components/shell/phi-antd-icon.tsx), with or without `antd:`, or a `module:`, `iconify:` or `asset:` name.");
75
+ }
31
76
  function renderAntdIcon(key, size, presentation) {
32
77
  const icon = PHI_ANTD_ICON_NAMES[key];
33
78
  return icon ? _jsx(PhiAntdIcon, { icon: icon, size: size, ...presentation }) : null;
34
79
  }
35
80
  function renderBuilderIcon(namespace, motif, size) {
36
- const isLayoutNamespace = namespace.endsWith("/layouts");
37
- const isWidgetNamespace = namespace.endsWith("/widgets");
38
- if (!isLayoutNamespace && !isWidgetNamespace) {
81
+ if (!isPhiBuilderIconNamespace(namespace)) {
39
82
  return null;
40
83
  }
41
84
  return (_jsx(Suspense, { fallback: renderIconFallback(size), children: _jsx(LazyPhiBuilderMotifIcon, { namespace: namespace, motif: motif, size: size }) }));
@@ -74,6 +117,10 @@ export function PhiIcon({ name, size = 16, ...presentation }) {
74
117
  if (!name) {
75
118
  return null;
76
119
  }
120
+ if (!isPhiIconNameKnown(name)) {
121
+ reportPhiUnknownIconName(name);
122
+ return null;
123
+ }
77
124
  const resolvedSize = size === "inherit" ? "1em" : size;
78
125
  const [namespace, ...rest] = name.split(":");
79
126
  const value = rest.join(":");
@@ -1,2 +1,9 @@
1
1
  import type { ReactNode } from "react";
2
+ /**
3
+ * The icon a Button, a Table action or a Command Toolbar names, or null where the name draws nothing.
4
+ *
5
+ * The same rule as `PhiIcon` (`isPhiIconNameKnown`): a short name is the Ant Design icon of that name,
6
+ * one name per icon. Null rather than an empty element, because a Table falls back to the action's label
7
+ * where its icon does not resolve and asks this to find out.
8
+ */
2
9
  export declare function resolvePhiButtonIcon(icon: string | null | undefined): ReactNode;
@@ -1,72 +1,20 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { PhiAntdIcon } from "../../../shell/phi-antd-icon";
4
- import { PhiIcon } from "../../../shell/phi-icon";
3
+ import { isPhiIconNameKnown, PhiIcon, reportPhiUnknownIconName } from "../../../shell/phi-icon";
4
+ /**
5
+ * The icon a Button, a Table action or a Command Toolbar names, or null where the name draws nothing.
6
+ *
7
+ * The same rule as `PhiIcon` (`isPhiIconNameKnown`): a short name is the Ant Design icon of that name,
8
+ * one name per icon. Null rather than an empty element, because a Table falls back to the action's label
9
+ * where its icon does not resolve and asks this to find out.
10
+ */
5
11
  export function resolvePhiButtonIcon(icon) {
6
- const normalizedIcon = icon?.trim();
7
- const alias = normalizedIcon?.toLowerCase().startsWith("antd:")
8
- ? normalizedIcon.slice("antd:".length).toLowerCase()
9
- : normalizedIcon?.toLowerCase();
10
- switch (alias) {
11
- case "apply":
12
- case "check":
13
- return _jsx(PhiAntdIcon, { icon: "CheckOutlined" });
14
- case "cancel":
15
- case "clear":
16
- case "close":
17
- return _jsx(PhiAntdIcon, { icon: "CloseOutlined" });
18
- case "upload":
19
- case "cloud-upload":
20
- case "publish":
21
- return _jsx(PhiAntdIcon, { icon: "CloudUploadOutlined" });
22
- case "delete":
23
- case "trash":
24
- return _jsx(PhiAntdIcon, { icon: "DeleteOutlined" });
25
- case "edit":
26
- case "meta":
27
- case "settings":
28
- return _jsx(PhiAntdIcon, { icon: "EditOutlined" });
29
- case "eye":
30
- case "preview":
31
- case "view":
32
- return _jsx(PhiAntdIcon, { icon: "EyeOutlined" });
33
- case "eye-invisible":
34
- case "eye-invisible-outlined":
35
- return _jsx(PhiAntdIcon, { icon: "EyeInvisibleOutlined" });
36
- case "folder-add":
37
- case "folder-add-outlined":
38
- return _jsx(PhiAntdIcon, { icon: "FolderAddOutlined" });
39
- case "history":
40
- return _jsx(PhiAntdIcon, { icon: "HistoryOutlined" });
41
- case "link":
42
- case "link-outlined":
43
- return _jsx(PhiAntdIcon, { icon: "LinkOutlined" });
44
- case "minus":
45
- case "minus-outlined":
46
- return _jsx(PhiAntdIcon, { icon: "MinusOutlined" });
47
- case "add":
48
- case "new":
49
- case "plus":
50
- return _jsx(PhiAntdIcon, { icon: "PlusOutlined" });
51
- case "redo":
52
- return _jsx(PhiAntdIcon, { icon: "RedoOutlined" });
53
- case "reload":
54
- case "refresh":
55
- case "reset":
56
- case "restore":
57
- return _jsx(PhiAntdIcon, { icon: "ReloadOutlined" });
58
- case "save":
59
- return _jsx(PhiAntdIcon, { icon: "SaveOutlined" });
60
- case "search":
61
- return _jsx(PhiAntdIcon, { icon: "SearchOutlined" });
62
- case "stop":
63
- case "retire":
64
- return _jsx(PhiAntdIcon, { icon: "StopOutlined" });
65
- case "undo":
66
- return _jsx(PhiAntdIcon, { icon: "UndoOutlined" });
67
- default:
68
- return normalizedIcon?.includes(":")
69
- ? _jsx(PhiIcon, { name: normalizedIcon, size: "1em" })
70
- : null;
12
+ const name = icon?.trim();
13
+ if (!name)
14
+ return null;
15
+ if (!isPhiIconNameKnown(name)) {
16
+ reportPhiUnknownIconName(name);
17
+ return null;
71
18
  }
19
+ return _jsx(PhiIcon, { name: name, size: "1em" });
72
20
  }
@@ -1,21 +1,21 @@
1
1
  export const PHI_COMMON_CONTROL_DEFAULT_LABELS = {
2
2
  actions: {
3
- add: { label: "Add", tooltip: "Add", icon: "add" },
4
- apply: { label: "Apply", tooltip: "Apply", icon: "apply", variant: "primary" },
5
- cancel: { label: "Cancel", tooltip: "Cancel", icon: "cancel" },
6
- clear: { label: "Clear", tooltip: "Clear", icon: "clear" },
3
+ add: { label: "Add", tooltip: "Add", icon: "plus" },
4
+ apply: { label: "Apply", tooltip: "Apply", icon: "check", variant: "primary" },
5
+ cancel: { label: "Cancel", tooltip: "Cancel", icon: "close" },
6
+ clear: { label: "Clear", tooltip: "Clear", icon: "close" },
7
7
  delete: { label: "Delete", tooltip: "Delete", icon: "delete", danger: true },
8
8
  deleteSelected: { label: "Delete selected", tooltip: "Delete selected", icon: "delete", danger: true },
9
9
  edit: { label: "Edit", tooltip: "Edit", icon: "edit" },
10
- livePreview: { label: "Live preview", tooltip: "Live preview", icon: "preview" },
11
- meta: { label: "Meta", tooltip: "Meta", icon: "meta" },
12
- new: { label: "New", tooltip: "New", icon: "new" },
13
- pageMeta: { label: "Meta", tooltip: "Page meta", icon: "meta" },
14
- publish: { label: "Publish", tooltip: "Publish", icon: "publish" },
10
+ livePreview: { label: "Live preview", tooltip: "Live preview", icon: "eye" },
11
+ meta: { label: "Meta", tooltip: "Meta", icon: "edit" },
12
+ new: { label: "New", tooltip: "New", icon: "plus" },
13
+ pageMeta: { label: "Meta", tooltip: "Page meta", icon: "edit" },
14
+ publish: { label: "Publish", tooltip: "Publish", icon: "cloud-upload" },
15
15
  reload: { label: "Reload", tooltip: "Reload", icon: "reload" },
16
- reset: { label: "Reset", tooltip: "Reset", icon: "reset", danger: true },
17
- restore: { label: "Restore", tooltip: "Restore", icon: "restore" },
18
- review: { label: "Review", tooltip: "Review", icon: "preview" },
16
+ reset: { label: "Reset", tooltip: "Reset", icon: "reload", danger: true },
17
+ restore: { label: "Restore", tooltip: "Restore", icon: "reload" },
18
+ review: { label: "Review", tooltip: "Review", icon: "eye" },
19
19
  save: { label: "Save", tooltip: "Save", icon: "save" },
20
20
  search: { label: "Search", tooltip: "Search", icon: "search" },
21
21
  undo: { label: "Undo", tooltip: "Undo", icon: "undo" },
@@ -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): 21 | 10 | 40 | 12 | 50 | 11 | 20 | 25 | 30 | 39 | 41;
35
+ export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined): 10 | 40 | 12 | 50 | 11 | 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -4,6 +4,15 @@ export declare const PHI_ACCOUNTING_RUNTIME_MODULE_AREA_SHELLS: {
4
4
  presetKey: string;
5
5
  shellPresetVersion: number;
6
6
  area: "accounting";
7
- loadTree: ({ page, runtime }: PhiCmsDescriptorBuildContext) => Promise<import("../../../types").PhiResolvedCmsPageTree>;
7
+ loadTree: ({ page, runtime }: PhiCmsDescriptorBuildContext) => Promise<{
8
+ pageMeta: import("../../../types").PhiCmsResolvedPageMeta | null | undefined;
9
+ runtimeModuleIds: `${string}/${string}`[] | null | undefined;
10
+ regions: import("../../../types").PhiCmsRegionNode[];
11
+ overlays: import("../../../types").PhiCmsOverlayNode[];
12
+ layoutNodes: import("../../../types").PhiCmsLayoutNode[];
13
+ contentWidgets: import("../../../types").PhiCmsContentWidgetNode[];
14
+ controllerSettings: import("../../../types/cms").PhiCmsTreeControllerSettings;
15
+ page: import("../../../types").PhiCmsPageNode;
16
+ }>;
8
17
  }[];
9
18
  export declare const PHI_ACCOUNTING_RUNTIME_MODULE_ROUTES: PhiCmsRoutePresetDescriptor[];
@@ -1,5 +1,7 @@
1
1
  import { PHI_BASE_PAGE_LAYOUT_VERSION } from "../../../components/regions/presets/phi-base-page-layout";
2
2
  import { buildPhiAreaRootRoutePresetDescriptor } from "../area-root-route";
3
+ import { PhiCmsRegionType } from "../../../constants/phi-cms";
4
+ import { PHI_DEFAULT_PUB_AREA_COMPOSITION_NODE_KEYS } from "../preset-contracts/pub-area";
3
5
  import { PHI_ACCOUNTING_RUNTIME_MODULE_ID } from "./ids";
4
6
  /* What the Accounting base Module brings: the Site shell for its Area, the Area root and the overview. */
5
7
  export const PHI_ACCOUNTING_RUNTIME_MODULE_AREA_SHELLS = [
@@ -8,14 +10,29 @@ export const PHI_ACCOUNTING_RUNTIME_MODULE_AREA_SHELLS = [
8
10
  presetKey: "accounting-area-preset",
9
11
  shellPresetVersion: 1,
10
12
  area: "accounting",
11
- loadTree: ({ page, runtime }) => import("../phi-default-site-area-preset-tree")
12
- .then((module) => module.buildPhiDefaultSiteAreaPresetTree({
13
- page,
14
- runtime,
15
- presetKey: "accounting-area-preset",
16
- ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
17
- runtimeModuleArea: "accounting",
18
- })),
13
+ /*
14
+ * A staff Area's shell, composed as the Admin's is: the Site's shell without its header and footer,
15
+ * and the header bar and sidebar over it. It used to be the Site's shell alone, which left
16
+ * `accounting:sidebar` drawn nowhere.
17
+ */
18
+ loadTree: async ({ page, runtime }) => {
19
+ const [{ buildPhiDefaultSiteAreaPresetTree }, { buildPhiDefaultAccountingAreaPresetTree }, { mergePhiCmsShellTrees, omitPhiCmsShellCompositionNodes },] = await Promise.all([
20
+ import("../phi-default-site-area-preset-tree"),
21
+ import("./trees/phi-default-accounting-area-preset-tree"),
22
+ import("../shell-tree-composition"),
23
+ ]);
24
+ const [base, overlay] = await Promise.all([
25
+ buildPhiDefaultSiteAreaPresetTree({
26
+ page,
27
+ runtime,
28
+ presetKey: "accounting-area-preset",
29
+ ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
30
+ runtimeModuleArea: "accounting",
31
+ }),
32
+ buildPhiDefaultAccountingAreaPresetTree({ page, runtime }),
33
+ ]);
34
+ return mergePhiCmsShellTrees(omitPhiCmsShellCompositionNodes(base, { ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID, presetKey: "accounting-area-preset" }, [PhiCmsRegionType.HeaderTop, PhiCmsRegionType.HeaderMain, PhiCmsRegionType.Footer], PHI_DEFAULT_PUB_AREA_COMPOSITION_NODE_KEYS), overlay);
35
+ },
19
36
  },
20
37
  ];
21
38
  export const PHI_ACCOUNTING_RUNTIME_MODULE_ROUTES = [
@@ -0,0 +1,6 @@
1
+ import type { PhiResolvedCmsPageTree, PhiCmsPageNode } from "../../../../types/cms";
2
+ import type { PhiBlockRuntime } from "../../../../types";
3
+ export declare function buildPhiDefaultAccountingAreaPresetTree({ page, runtime, }: {
4
+ page: PhiCmsPageNode;
5
+ runtime: PhiBlockRuntime;
6
+ }): Promise<PhiResolvedCmsPageTree>;
@@ -0,0 +1,53 @@
1
+ import { createPhiPresetCmsInstanceIdMap } from "../../../../types/cms-instance-id";
2
+ import { PHI_ACCOUNTING_RUNTIME_MODULE_ID } from "../ids";
3
+ import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
4
+ import { buildPhiAreaShellHeaderNodes, buildPhiAreaShellSiderLeftNodes, concatPhiAreaShellPresetNodes, } from "../../../../components/regions/presets/phi-area-shell-preset-nodes";
5
+ import { createPhiDefaultAreaRuntimeModuleIds } from "../../area-module-defaults";
6
+ /*
7
+ * The staff shell, as Admin's: the header bar with the Page title as a caption, the Tour button and the
8
+ * Account, and the sidebar on `accounting:sidebar`, composed over the Site's shell in `../presets.ts`.
9
+ * Ids of its own, so an Accounting shell never shares a node with another Area's.
10
+ */
11
+ const SYNTHETIC_ACCOUNTING_REGION_IDS = {
12
+ regionHeaderTop: -170,
13
+ regionSiderLeft: -180,
14
+ };
15
+ const SYNTHETIC_ACCOUNTING_LAYOUT_IDS = createPhiPresetCmsInstanceIdMap({
16
+ domain: "area",
17
+ ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
18
+ presetKey: "accounting-area-preset",
19
+ }, [
20
+ "layoutHeaderTop",
21
+ "layoutHeaderTopActions",
22
+ "layoutSiderLeft",
23
+ ]);
24
+ const SYNTHETIC_ACCOUNTING_WIDGET_IDS = createPhiPresetCmsInstanceIdMap({
25
+ domain: "area",
26
+ ownerModuleId: PHI_ACCOUNTING_RUNTIME_MODULE_ID,
27
+ presetKey: "accounting-area-preset",
28
+ }, [
29
+ "widgetSiderLeftNav",
30
+ "widgetHeaderTopAccount",
31
+ "widgetHeaderTopPageTitle",
32
+ "widgetHeaderTopTourButton",
33
+ ]);
34
+ export async function buildPhiDefaultAccountingAreaPresetTree({ page, runtime, }) {
35
+ const nodes = createPhiCmsPresetNodes(page);
36
+ return {
37
+ page: nodes.page(),
38
+ runtimeModuleIds: createPhiDefaultAreaRuntimeModuleIds("accounting"),
39
+ overlays: [],
40
+ ...concatPhiAreaShellPresetNodes(buildPhiAreaShellHeaderNodes({
41
+ nodes,
42
+ runtime,
43
+ labelPrefix: "accounting",
44
+ ids: { ...SYNTHETIC_ACCOUNTING_REGION_IDS, ...SYNTHETIC_ACCOUNTING_LAYOUT_IDS, ...SYNTHETIC_ACCOUNTING_WIDGET_IDS },
45
+ }), buildPhiAreaShellSiderLeftNodes({
46
+ nodes,
47
+ runtime,
48
+ labelPrefix: "accounting",
49
+ navKey: "accounting:sidebar",
50
+ ids: { ...SYNTHETIC_ACCOUNTING_REGION_IDS, ...SYNTHETIC_ACCOUNTING_LAYOUT_IDS, ...SYNTHETIC_ACCOUNTING_WIDGET_IDS },
51
+ })),
52
+ };
53
+ }
@@ -107,14 +107,28 @@ export declare const PHI_ACCOUNTING_RUNTIME_AREA_DEFINITIONS: {
107
107
  label: {
108
108
  defaultMessage: string;
109
109
  };
110
- items: {
110
+ items: ({
111
111
  itemKey: string;
112
112
  label: {
113
113
  defaultMessage: string;
114
114
  };
115
115
  icon: string;
116
116
  routePresetKey: string;
117
- }[];
117
+ standing?: undefined;
118
+ target?: undefined;
119
+ } | {
120
+ itemKey: string;
121
+ label: {
122
+ defaultMessage: string;
123
+ };
124
+ icon: string;
125
+ standing: "last";
126
+ target: {
127
+ kind: "area";
128
+ area: "admin";
129
+ };
130
+ routePresetKey?: undefined;
131
+ })[];
118
132
  exportedItemKeys: string[];
119
133
  anchors: Partial<Record<PhiCmsNavigationAnchor, PhiCmsNavigationAnchorPlacement>>;
120
134
  })[];
@@ -295,14 +309,28 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
295
309
  label: {
296
310
  defaultMessage: string;
297
311
  };
298
- items: {
312
+ items: ({
299
313
  itemKey: string;
300
314
  label: {
301
315
  defaultMessage: string;
302
316
  };
303
317
  icon: string;
304
318
  routePresetKey: string;
305
- }[];
319
+ standing?: undefined;
320
+ target?: undefined;
321
+ } | {
322
+ itemKey: string;
323
+ label: {
324
+ defaultMessage: string;
325
+ };
326
+ icon: string;
327
+ standing: "last";
328
+ target: {
329
+ kind: "area";
330
+ area: "admin";
331
+ };
332
+ routePresetKey?: undefined;
333
+ })[];
306
334
  exportedItemKeys: string[];
307
335
  anchors: Partial<Record<PhiCmsNavigationAnchor, PhiCmsNavigationAnchorPlacement>>;
308
336
  })[];
@@ -540,14 +568,28 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
540
568
  label: {
541
569
  defaultMessage: string;
542
570
  };
543
- items: {
571
+ items: ({
544
572
  itemKey: string;
545
573
  label: {
546
574
  defaultMessage: string;
547
575
  };
548
576
  icon: string;
549
577
  routePresetKey: string;
550
- }[];
578
+ standing?: undefined;
579
+ target?: undefined;
580
+ } | {
581
+ itemKey: string;
582
+ label: {
583
+ defaultMessage: string;
584
+ };
585
+ icon: string;
586
+ standing: "last";
587
+ target: {
588
+ kind: "area";
589
+ area: "admin";
590
+ };
591
+ routePresetKey?: undefined;
592
+ })[];
551
593
  exportedItemKeys: string[];
552
594
  anchors: Partial<Record<PhiCmsNavigationAnchor, PhiCmsNavigationAnchorPlacement>>;
553
595
  })[];
@@ -238,6 +238,14 @@ export const PHI_ACCOUNTING_RUNTIME_AREA_DEFINITIONS = [
238
238
  label: label("Overview"),
239
239
  icon: "antd:audit",
240
240
  routePresetKey: "accounting-overview-page",
241
+ },
242
+ // The way into the Admin, as the Builder has one; shown to whoever the Admin lets in.
243
+ {
244
+ itemKey: "@phis/ui/modules/accounting/nav/admin",
245
+ label: label("Admin"),
246
+ icon: "antd:cluster",
247
+ standing: "last",
248
+ target: { kind: "area", area: "admin" },
241
249
  }],
242
250
  exportedItemKeys: ["@phis/ui/modules/accounting/nav/home"],
243
251
  anchors: sidebarAnchors(),
@@ -428,7 +428,7 @@ export async function buildPhiDefaultBuilderMediaPageTree({ page, runtime, }) {
428
428
  key: "createFolder",
429
429
  label: mediaLabels?.tool.createFolderLabel ?? "Create folder",
430
430
  description: mediaLabels?.tool.createFolderLabel ?? "Create folder",
431
- icon: "add",
431
+ icon: "plus",
432
432
  display: "icon",
433
433
  mode: "primary",
434
434
  }],
@@ -475,7 +475,7 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
475
475
  * follows from that and is not stated -- a compact group does not wrap.
476
476
  */
477
477
  buttons: [
478
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: effectsLabels.cancel, variant: "normal", icon: "cancel" },
478
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: effectsLabels.cancel, variant: "normal", icon: "close" },
479
479
  { key: "save", emits: [{ capabilityId: "command", value: "save" }], label: effectsLabels.save, variant: "primary", icon: "save" },
480
480
  ],
481
481
  signalRoutes: {
@@ -604,7 +604,7 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
604
604
  * follows from that and is not stated -- a compact group does not wrap.
605
605
  */
606
606
  buttons: [
607
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: signalsLabels.routes.cancel, variant: "normal", icon: "cancel" },
607
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: signalsLabels.routes.cancel, variant: "normal", icon: "close" },
608
608
  /*
609
609
  * The primary action reads "Apply", not "Save": it commits one route into the draft, and the
610
610
  * Page is saved separately. It sets `icon: "save"` itself so the button keeps that mark, and the
@@ -1714,7 +1714,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1714
1714
  key: "module-usage-commands",
1715
1715
  ...PHI_DIALOG_COMMANDS_CONFIG,
1716
1716
  buttons: [
1717
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.usage.cancel ?? "Keep it on", icon: "cancel" },
1717
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.usage.cancel ?? "Keep it on", icon: "close" },
1718
1718
  { key: "confirm", emits: [{ capabilityId: "command", value: "confirm" }], variant: "primary", label: modulesLabels?.usage.confirm ?? "Switch off anyway", icon: "save" },
1719
1719
  ],
1720
1720
  signalRoutes: {
@@ -1810,7 +1810,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1810
1810
  key: "public-routes-commands",
1811
1811
  ...PHI_DIALOG_COMMANDS_CONFIG,
1812
1812
  buttons: [
1813
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.publicRoutes.cancel ?? "Cancel", icon: "cancel" },
1813
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.publicRoutes.cancel ?? "Cancel", icon: "close" },
1814
1814
  { key: "assign", emits: [{ capabilityId: "command", value: "assign" }], variant: "primary", label: modulesLabels?.publicRoutes.assign ?? "Enable", icon: "save" },
1815
1815
  ],
1816
1816
  signalRoutes: {
@@ -5,7 +5,6 @@ import { getPhiBuilderNavigationDefaultScopeKey, createPhiBuilderNavigationPageL
5
5
  import { PhiHeaderNavigationWidgetClient } from "./client";
6
6
  import { PHI_HEADER_NAVIGATION_WIDGET_DEFINITION, } from "./config";
7
7
  import { mapPhiBuilderNavigationItemsToNavItems } from "../../../../../components/widgets/builder/navigation-items";
8
- import { resolvePhiRenderableBlockGeometry } from "../../../../../types/renderable-block-geometry";
9
8
  function PhiHeaderNavigationWidgetEditor({ runtime, config, canvas, }) {
10
9
  if (!canvas.catalogHydrated) {
11
10
  return null;
@@ -16,9 +15,9 @@ function PhiHeaderNavigationWidgetEditor({ runtime, config, canvas, }) {
16
15
  if (!navigation) {
17
16
  return null;
18
17
  }
19
- return (_jsx(PhiHeaderNavigationWidgetClient, { runtime: { site: runtime.site, locale: runtime.locale, area: currentCmsArea }, items: mapPhiBuilderNavigationItemsToNavItems(resolvePhiBuilderNavigationPageTargets(currentCmsArea, navigation.items, createPhiBuilderNavigationPageLookup(canvas.pageCatalogForArea))), menuTheme: runtime.site.theme?.mode === "dark" ? "dark" : "light", height: config.height, align: config.align, interactive: false }));
18
+ return (_jsx(PhiHeaderNavigationWidgetClient, { runtime: { site: runtime.site, locale: runtime.locale, area: currentCmsArea }, items: mapPhiBuilderNavigationItemsToNavItems(resolvePhiBuilderNavigationPageTargets(currentCmsArea, navigation.items, createPhiBuilderNavigationPageLookup(canvas.pageCatalogForArea))), menuTheme: runtime.site.theme?.mode === "dark" ? "dark" : "light", align: config.align, interactive: false }));
20
19
  }
21
20
  export const PHI_HEADER_NAVIGATION_WIDGET_BUILDER_PLUGIN = {
22
21
  ...PHI_HEADER_NAVIGATION_WIDGET_DEFINITION,
23
- renderEditor: ({ runtime, regionConfig, config, authoring }) => authoring ? (_jsx(PhiHeaderNavigationWidgetEditor, { runtime: runtime, config: { ...config, height: resolvePhiRenderableBlockGeometry(regionConfig).block.size?.css }, canvas: authoring.canvas })) : null,
22
+ renderEditor: ({ runtime, config, authoring }) => authoring ? (_jsx(PhiHeaderNavigationWidgetEditor, { runtime: runtime, config: config, canvas: authoring.canvas })) : null,
24
23
  };
@@ -1,4 +1,3 @@
1
- import type { CSSProperties } from "react";
2
1
  import type { PhiMenuSelectionStyle } from "../../../../../components/controls/phi-menu-control-vocabulary";
3
2
  import type { PhiClientBlockBaseProps, PhiBlockRuntime, PhiNoLabels } from "../../../../../types";
4
3
  import { type PhiMenuTheme, type PhiNavItem } from "../../../../../components/shell/shell-types";
@@ -7,11 +6,10 @@ export type PhiHeaderNavigationWidgetClientProps = PhiClientBlockBaseProps<PhiNo
7
6
  runtime: Pick<PhiBlockRuntime, "site" | "locale" | "area">;
8
7
  items: PhiNavItem[];
9
8
  menuTheme?: PhiMenuTheme;
10
- height?: CSSProperties["height"];
11
9
  align?: "left" | "center";
12
10
  selectionStyle?: PhiMenuSelectionStyle;
13
11
  /** Below 768px: the entries behind a menu button (the default), or the row as on a wider screen. */
14
12
  phoneMenu?: PhiHeaderNavigationPhoneMenu;
15
13
  interactive?: boolean;
16
14
  };
17
- export declare function PhiHeaderNavigationWidgetClient({ runtime, items, menuTheme, height, align, selectionStyle, phoneMenu, interactive, }: PhiHeaderNavigationWidgetClientProps): import("react").JSX.Element | null;
15
+ export declare function PhiHeaderNavigationWidgetClient({ runtime, items, menuTheme, align, selectionStyle, phoneMenu, interactive, }: PhiHeaderNavigationWidgetClientProps): import("react").JSX.Element | null;
@@ -10,13 +10,12 @@ import { usePhiPathname } from "../../../../../components/runtime/use-phi-pathna
10
10
  import { PhiButtonControl } from "../../../../../components/controls/phi-button-control";
11
11
  import { PhiDialogControl } from "../../../../../components/controls/phi-dialog-control";
12
12
  import { PhiIcon } from "../../../../../components/shell/phi-icon";
13
- export function PhiHeaderNavigationWidgetClient({ runtime, items, menuTheme, height, align = "left", selectionStyle = "auto", phoneMenu = "button", interactive = true, }) {
13
+ export function PhiHeaderNavigationWidgetClient({ runtime, items, menuTheme, align = "left", selectionStyle = "auto", phoneMenu = "button", interactive = true, }) {
14
14
  const { token } = usePhiConfig();
15
15
  const pathname = usePhiPathname();
16
16
  const availableLocales = runtime.site.availableLocales.map((option) => option.code);
17
17
  const selectedKeys = collectPhiSelectedNavKeys(pathname, items, availableLocales);
18
18
  const menuItems = mapPhiNavItems(runtime.locale.current, runtime.area, pathname, items, availableLocales, { interactive });
19
- const resolvedHeight = typeof height === "number" ? `${height}px` : (height ?? "100%");
20
19
  /*
21
20
  * The Page the Drawer was opened on: following an entry to another Page closes it without an effect
22
21
  * having to notice the navigation (the Shell's Sider drawer does the same).
@@ -75,12 +74,17 @@ export function PhiHeaderNavigationWidgetClient({ runtime, items, menuTheme, hei
75
74
  justifyContent: align === "center" ? "center" : "flex-start",
76
75
  }, children: _jsx(PhiMenuControl, { mode: "horizontal", menuTheme: menuTheme, selectionStyle: selectionStyle, selectedKeys: selectedKeys, items: menuItems, fontSize: token.fontSize, style: {
77
76
  display: "flex",
78
- alignItems: "center",
77
+ /*
78
+ * The row is as tall as the room its Layout gives it, not as tall as the Region: a Region's
79
+ * padding -- the gap a floating Header keeps above its bar -- is not the menu's. Each entry
80
+ * stretches to the row and centres its words (`styles/controls.css`, "Header Navigation"); the
81
+ * pill stands at the control height in the middle of it.
82
+ */
83
+ alignItems: "stretch",
79
84
  justifyContent: align === "center" ? "center" : "flex-start",
80
85
  minHeight: 0,
81
86
  flex: "1 1 auto",
82
87
  paddingInline: 0,
83
- height: resolvedHeight,
84
- lineHeight: resolvedHeight,
88
+ height: "100%",
85
89
  } }) })] }));
86
90
  }
@@ -1,4 +1,3 @@
1
- import type { CSSProperties } from "react";
2
1
  import { type PhiMenuSelectionStyle } from "../../../../../components/controls/phi-menu-control-vocabulary";
3
2
  import { type PhiCmsWidgetConfigBase } from "../../../../../components/widgets/config/parser-primitives";
4
3
  export type PhiCmsHeaderNavigationWidgetConfig = PhiCmsWidgetConfigBase & {
@@ -14,9 +13,7 @@ export type PhiCmsHeaderNavigationWidgetConfig = PhiCmsWidgetConfigBase & {
14
13
  };
15
14
  export type PhiHeaderNavigationPhoneMenu = "button" | "row";
16
15
  declare function parsePhiCmsHeaderNavigationWidgetConfig(config: Record<string, unknown>): PhiCmsHeaderNavigationWidgetConfig;
17
- export type PhiHeaderNavigationWidgetRenderableConfig = Pick<PhiCmsHeaderNavigationWidgetConfig, "align" | "selectionStyle" | "phoneMenu"> & {
18
- height?: CSSProperties["height"];
19
- };
16
+ export type PhiHeaderNavigationWidgetRenderableConfig = Pick<PhiCmsHeaderNavigationWidgetConfig, "align" | "selectionStyle" | "phoneMenu">;
20
17
  export declare const PHI_HEADER_NAVIGATION_WIDGET_DEFINITION: {
21
18
  kind: "widget";
22
19
  pluginKey: string;
@@ -1,10 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PHI_HEADER_NAVIGATION_WIDGET_DEFINITION, PHI_HEADER_NAVIGATION_WIDGET_PLUGIN_TYPE, } from "./config";
3
3
  import { PhiHeaderNavigationWidget } from "./server";
4
- import { resolvePhiRenderableBlockGeometry } from "../../../../../types/renderable-block-geometry";
5
4
  export const PHI_HEADER_NAVIGATION_WIDGET_PLUGIN = {
6
5
  ...PHI_HEADER_NAVIGATION_WIDGET_DEFINITION,
7
- render: ({ widget, runtime, regionConfig, config }) => (_jsx(PhiHeaderNavigationWidget, { runtime: runtime, navKey: config.navKey ?? `${runtime.area}:header`, height: resolvePhiRenderableBlockGeometry(regionConfig).block.size?.css, align: config.align, selectionStyle: config.selectionStyle, phoneMenu: config.phoneMenu, interactive: true }, `widget-${widget.id}`)),
8
- renderPreview: ({ widget, runtime, regionConfig, config }) => (_jsx(PhiHeaderNavigationWidget, { runtime: runtime, navKey: config.navKey ?? `${runtime.area}:header`, height: resolvePhiRenderableBlockGeometry(regionConfig).block.size?.css, align: config.align, interactive: false }, `widget-${widget.id}`)),
6
+ render: ({ widget, runtime, config }) => (_jsx(PhiHeaderNavigationWidget, { runtime: runtime, navKey: config.navKey ?? `${runtime.area}:header`, align: config.align, selectionStyle: config.selectionStyle, phoneMenu: config.phoneMenu, interactive: true }, `widget-${widget.id}`)),
7
+ renderPreview: ({ widget, runtime, config }) => (_jsx(PhiHeaderNavigationWidget, { runtime: runtime, navKey: config.navKey ?? `${runtime.area}:header`, align: config.align, interactive: false }, `widget-${widget.id}`)),
9
8
  };
10
9
  export { PHI_HEADER_NAVIGATION_WIDGET_PLUGIN_TYPE };
@@ -1,7 +1,7 @@
1
1
  import type { PhiBlockRuntime } from "../../../../../types";
2
2
  import type { PhiHeaderNavigationWidgetClientProps } from "./client";
3
- export type PhiHeaderNavigationWidgetProps = Pick<PhiHeaderNavigationWidgetClientProps, "menuTheme" | "height" | "align" | "selectionStyle" | "phoneMenu" | "interactive"> & {
3
+ export type PhiHeaderNavigationWidgetProps = Pick<PhiHeaderNavigationWidgetClientProps, "menuTheme" | "align" | "selectionStyle" | "phoneMenu" | "interactive"> & {
4
4
  runtime: Pick<PhiBlockRuntime, "site" | "locale" | "area" | "viewer" | "request">;
5
5
  navKey?: string;
6
6
  };
7
- export declare function PhiHeaderNavigationWidget({ runtime, navKey, menuTheme, height, align, selectionStyle, phoneMenu, interactive, }: PhiHeaderNavigationWidgetProps): Promise<import("react").JSX.Element | null>;
7
+ export declare function PhiHeaderNavigationWidget({ runtime, navKey, menuTheme, align, selectionStyle, phoneMenu, interactive, }: PhiHeaderNavigationWidgetProps): Promise<import("react").JSX.Element | null>;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
3
3
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
4
4
  import { resolvePhiNavigationItems } from "../../../../../components/widgets/server/navigation-request";
5
- export async function PhiHeaderNavigationWidget({ runtime, navKey, menuTheme, height, align, selectionStyle, phoneMenu, interactive = true, }) {
5
+ export async function PhiHeaderNavigationWidget({ runtime, navKey, menuTheme, align, selectionStyle, phoneMenu, interactive = true, }) {
6
6
  const items = await resolvePhiNavigationItems(runtime, navKey?.trim() || `${runtime.area}:header`);
7
7
  if (items == null) {
8
8
  return null;
@@ -11,7 +11,6 @@ export async function PhiHeaderNavigationWidget({ runtime, navKey, menuTheme, he
11
11
  runtime: { site: runtime.site, locale: runtime.locale, area: runtime.area },
12
12
  items,
13
13
  menuTheme,
14
- height,
15
14
  align,
16
15
  selectionStyle,
17
16
  phoneMenu,
@@ -84,7 +84,7 @@ export async function buildPhiDefaultAdminGroupsPageTree({ page, runtime, }) {
84
84
  config: {
85
85
  key: `admin-groups-${workflow}-commands`,
86
86
  buttons: [
87
- { key: "cancel", emits: [{ capabilityId: "close", value: null }], label: labels.actions.cancel, icon: "cancel" },
87
+ { key: "cancel", emits: [{ capabilityId: "close", value: null }], label: labels.actions.cancel, icon: "close" },
88
88
  { key: "save", emits: [{ capabilityId: "submit", value: null }], label: text.submit, variant: "primary", icon: "save" },
89
89
  ],
90
90
  signalRoutes: {
@@ -303,7 +303,7 @@ export async function buildPhiDefaultEditorTranslationsPageTree({ page, runtime,
303
303
  key: "editor-translation-commands",
304
304
  ...PHI_DIALOG_COMMANDS_CONFIG,
305
305
  buttons: [
306
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.actions.cancel, icon: "cancel" },
306
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.actions.cancel, icon: "close" },
307
307
  { key: "save", emits: [{ capabilityId: "command", value: "save" }], label: widgetLabels.actions.save, variant: "primary", icon: "save" },
308
308
  ],
309
309
  signalRoutes: {
@@ -356,7 +356,7 @@ export async function buildPhiDefaultBuilderRevisionsPageTree({ page, runtime, }
356
356
  key: "cancel",
357
357
  emits: [{ capabilityId: "close", value: null }],
358
358
  label: revisionsLabels.deleteArea.cancel,
359
- icon: "cancel",
359
+ icon: "close",
360
360
  },
361
361
  {
362
362
  key: "confirm",
@@ -21,7 +21,8 @@ import { PHI_THEME_HEADING_FONT_VARIABLE, readPhiThemeHeadingFont, resolvePhiThe
21
21
  import { resolvePhiThemeRuntimePayload } from "../../../../../theme/phi-theme-runtime";
22
22
  import { resolvePhiAntdAliasTokens } from "../../../../../theme/phi-antd-token-resolver";
23
23
  import { buildPhiThemeStructuralTokens } from "../../../../../theme/phi-theme";
24
- import { PHI_CONTROL_HEIGHTS, PHI_PADDING, PHI_RADII, } from "../../../../../theme/phi-tokens";
24
+ import { PHI_CONTROL_HEIGHTS, PHI_LAYOUT, PHI_PADDING, PHI_RADII, } from "../../../../../theme/phi-tokens";
25
+ import { PHI_CONTAINER_BREAKPOINT_REGION } from "../../../../../theme/phi-container-breakpoints";
25
26
  import { PHI_COLOR_PICKER_NEUTRAL_PRESETS, PHI_COLOR_PICKER_PRESETS } from "../../../../../components/widgets/config/color-picker-presets";
26
27
  import { PHI_SPACING_TOKEN_KEYS } from "../../../../../components/widgets/config/spacing-options";
27
28
  import { PhiColorFieldControl } from "../../../../../components/controls/phi-color-field-control";
@@ -83,6 +84,7 @@ const BRAND_THEME_STYLE_SECTION_KEYS = [
83
84
  "fontFamily",
84
85
  "fontSize",
85
86
  "wireframe",
87
+ "pageWidth",
86
88
  ];
87
89
  /*
88
90
  * The shadow under each kind of Button (theme/phi-button-shadow.ts). "Theme" is no step at all -- the
@@ -1300,6 +1302,7 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
1300
1302
  /** One row per size step: a label and the preset picker; Border Radius and Control Height share it. */
1301
1303
  const renderPresetSizeRows = (items, options) => (_jsx(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: items.map((item) => (_jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: item.label }), _jsx(PhiPresetSizeControl, { value: item.value, fallbackKey: item.fallbackPreset, options: options, onChange: (value) => updateToken({ [item.key]: value }) })] }, item.key))) }));
1302
1304
  const wireframe = readEffectiveTokenBoolean(styleTokenInput, "wireframe", true);
1305
+ const pageMax = readEffectiveTokenNumber(styleTokenInput, "phiPageMax", PHI_LAYOUT.pageMax);
1303
1306
  const baseFontSize = readEffectiveTokenNumber(styleTokenInput, "fontSize", 12);
1304
1307
  function updateToken(tokenPatch) {
1305
1308
  publishDraft(mergeThemeToken(state.draft, tokenPatch));
@@ -1409,6 +1412,16 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
1409
1412
  label: _jsx(PhiTypographyControl, { strong: true, children: "Wireframe" }),
1410
1413
  children: (_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: clientToken.paddingSM, wrap: "wrap", children: [_jsx(PhiTypographyControl, { type: "secondary", children: "Dividing lines in dialogs and popovers, outlined steps and radios" }), _jsx(PhiSwitchControl, { checked: wireframe, checkedLabel: "On", uncheckedLabel: "Off", onChange: (checked) => updateToken({ wireframe: checked }) })] })),
1411
1414
  },
1415
+ {
1416
+ /*
1417
+ * How wide a Page may get (`PHI_PAGE.max`). Never below the width from which a Region counts
1418
+ * as wide: a narrower Page could never be wide, and the Theme refuses one when it is saved.
1419
+ * Emptied, the Theme says nothing and the house default stands.
1420
+ */
1421
+ key: "pageWidth",
1422
+ label: _jsx(PhiTypographyControl, { strong: true, children: "Page Width" }),
1423
+ 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: "Maximum" }), _jsx(PhiNumberControl, { prefix: "px", value: pageMax, step: 1, min: PHI_CONTAINER_BREAKPOINT_REGION, onChange: (next) => updateToken({ phiPageMax: next == null ? undefined : next }) })] }), _jsxs(PhiTypographyControl, { type: "secondary", children: ["How wide a Page gets on a wide screen. At least ", PHI_CONTAINER_BREAKPOINT_REGION, "px, the width from which a Region counts as wide."] })] })),
1424
+ },
1412
1425
  ] }) })] }));
1413
1426
  }
1414
1427
  /**
@@ -104,7 +104,7 @@ export async function buildPhiDefaultThreadsPageTree({ page, runtime, area, }) {
104
104
  config: {
105
105
  key: "app-threads-reply-commands",
106
106
  buttons: [
107
- { key: "cancel", emits: [{ capabilityId: "close", value: null }], action: "cancel", icon: "cancel" },
107
+ { key: "cancel", emits: [{ capabilityId: "close", value: null }], action: "cancel", icon: "close" },
108
108
  {
109
109
  key: "submit",
110
110
  emits: [{ capabilityId: "submit", value: null }],
@@ -643,7 +643,7 @@ export async function buildPhiDefaultThreadsPageTree({ page, runtime, area, }) {
643
643
  key: "app-threads-new-commands",
644
644
  ...PHI_DIALOG_COMMANDS_CONFIG,
645
645
  buttons: [
646
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: labels.cancelLabel, icon: "cancel" },
646
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: labels.cancelLabel, icon: "close" },
647
647
  { key: "save", emits: [{ capabilityId: "command", value: "save" }], label: labels.openConversationLabel, variant: "primary", icon: "save" },
648
648
  ],
649
649
  signalRoutes: {
@@ -545,7 +545,7 @@ export async function buildPhiDefaultAdminUsersPageTree({ page, runtime, }) {
545
545
  key: `admin-users-${mode}-commands`,
546
546
  ...PHI_DIALOG_COMMANDS_CONFIG,
547
547
  buttons: [
548
- { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.confirm.cancel, icon: "cancel" },
548
+ { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.confirm.cancel, icon: "close" },
549
549
  { key: "save", emits: [{ capabilityId: "command", value: "save" }], label: saveLabel, variant: "primary", icon: "save" },
550
550
  ],
551
551
  signalRoutes: {
@@ -293,6 +293,19 @@ h5.phi-typography, .phi-typography h5 {
293
293
  --ant-menu-icon-margin-inline-end: calc(var(--ant-control-height-sm) - var(--phi-menu-font-size));
294
294
  }
295
295
 
296
+ /*
297
+ * Header Navigation: the row is as tall as the room its Layout gives it (the Widget's `height: 100%`), and
298
+ * each entry stretches to the row and centres its words in it. Ant Design centres them with a line height
299
+ * as tall as the bar, which is a length, and the length the Widget used to hand it was the Region's height
300
+ * -- padding included, so the entries of a Header that keeps its floating gap as padding stood below the
301
+ * brand and the buttons beside them. The pill below still stands at the control height in the middle.
302
+ */
303
+ .phi-header-nav .ant-menu-horizontal > :is(.ant-menu-item, .ant-menu-submenu) {
304
+ display: flex;
305
+ align-items: center;
306
+ line-height: var(--ant-control-height);
307
+ }
308
+
296
309
  /*
297
310
  * A horizontal menu's mark for the current entry (`PhiMenuControl` `selectionStyle`).
298
311
  *
@@ -369,6 +382,8 @@ h5.phi-typography, .phi-typography h5 {
369
382
  --phi-card-control-radius: var(--phi-surface-radius);
370
383
  --phi-card-control-line: var(--ant-line-width) var(--ant-line-type) var(--ant-color-border-secondary);
371
384
  position: relative;
385
+ display: flex;
386
+ flex-direction: column;
372
387
  box-sizing: border-box;
373
388
  min-width: 0;
374
389
  border: var(--phi-card-control-line);
@@ -428,7 +443,16 @@ h5.phi-typography, .phi-typography h5 {
428
443
  border-radius: var(--phi-card-control-radius) var(--phi-card-control-radius) 0 0;
429
444
  }
430
445
 
446
+ /*
447
+ * The body takes whatever height the box is given beyond its head and cover. A Card stretched to its row
448
+ * in a grid of Cards is taller than its own content, and the body is where that height belongs: a caller
449
+ * whose content is a column of its own (`height: 100%`) can then push its last part -- a price and a
450
+ * button -- to the bottom edge, so a row of Cards lines up there. A box that is only as tall as its
451
+ * content gains nothing and loses nothing. The basis is 0 rather than `auto` so the height is definite
452
+ * where the box's is, which is what lets that `100%` resolve at all.
453
+ */
431
454
  .phi-card-control__body {
455
+ flex: 1 0 0;
432
456
  border-radius: 0 0 var(--phi-card-control-radius) var(--phi-card-control-radius);
433
457
  }
434
458
 
@@ -69,6 +69,15 @@ export declare const PHI_SPACE: {
69
69
  readonly xl: "var(--ant-padding-xl)";
70
70
  readonly xxl: "var(--ant-padding-xxl)";
71
71
  };
72
+ /**
73
+ * How wide a Page may get: the Theme's `phiPageMax` (theme/phi-tokens.ts, `PHI_LAYOUT.pageMax`).
74
+ *
75
+ * A Page states this reference and not the number, so the Theme's answer reaches every Page, an edited
76
+ * copy included -- a number written into a preset tree stays what it was the day the copy was made.
77
+ */
78
+ export declare const PHI_PAGE: {
79
+ readonly max: "var(--ant-phi-page-max)";
80
+ };
72
81
  export declare const PHI_RADIUS: {
73
82
  readonly xxs: "var(--ant-border-radius-xs)";
74
83
  readonly xs: "var(--ant-border-radius-sm)";
@@ -78,6 +78,15 @@ export const PHI_SPACE = {
78
78
  xl: "var(--ant-padding-xl)",
79
79
  xxl: "var(--ant-padding-xxl)",
80
80
  };
81
+ /**
82
+ * How wide a Page may get: the Theme's `phiPageMax` (theme/phi-tokens.ts, `PHI_LAYOUT.pageMax`).
83
+ *
84
+ * A Page states this reference and not the number, so the Theme's answer reaches every Page, an edited
85
+ * copy included -- a number written into a preset tree stays what it was the day the copy was made.
86
+ */
87
+ export const PHI_PAGE = {
88
+ max: "var(--ant-phi-page-max)",
89
+ };
81
90
  export const PHI_RADIUS = {
82
91
  xxs: "var(--ant-border-radius-xs)",
83
92
  xs: "var(--ant-border-radius-sm)",
@@ -31,5 +31,8 @@ export declare const PHI_CONTAINER_BREAKPOINT_COL3: PhiContainerBreakpoint;
31
31
  * a full-width Region rather than in a content column.
32
32
  */
33
33
  export declare const PHI_CONTAINER_BREAKPOINT_CONTENT: PhiContainerBreakpoint;
34
- /** The wide content maximum (`PHI_LAYOUT.contentMaxWide`): a Region running the width of the page. */
34
+ /**
35
+ * From here a Region counts as wide: one running the width of a Page. Not a Page's width -- that is the
36
+ * Theme's (`PHI_PAGE.max`), and a Theme may not state one below this.
37
+ */
35
38
  export declare const PHI_CONTAINER_BREAKPOINT_REGION: PhiContainerBreakpoint;
@@ -30,5 +30,8 @@ export const PHI_CONTAINER_BREAKPOINT_COL3 = 377;
30
30
  * a full-width Region rather than in a content column.
31
31
  */
32
32
  export const PHI_CONTAINER_BREAKPOINT_CONTENT = 610;
33
- /** The wide content maximum (`PHI_LAYOUT.contentMaxWide`): a Region running the width of the page. */
33
+ /**
34
+ * From here a Region counts as wide: one running the width of a Page. Not a Page's width -- that is the
35
+ * Theme's (`PHI_PAGE.max`), and a Theme may not state one below this.
36
+ */
34
37
  export const PHI_CONTAINER_BREAKPOINT_REGION = 987;
@@ -35,12 +35,15 @@ export declare const PHI_THEME_TOKEN_KEYS: readonly ["colorBgContainer", "colorB
35
35
  * Design's type and a name Ant Design does not know cannot be cut from it. A Client Component that
36
36
  * needs one of these reads it as a CSS variable, the way a Server Component does.
37
37
  *
38
+ * `phiPageMax` is how wide a Page may get (theme/phi-tokens.ts, `PHI_LAYOUT.pageMax`); a Page reads it
39
+ * as `PHI_PAGE.max`.
40
+ *
38
41
  * The `phiGradient*` names are the Theme's gradient slots and the primary Buttons' run
39
42
  * (theme/phi-theme-gradients.ts): tokens of this package's own, laid over the resolved ones so Ant
40
43
  * Design writes them per mode and per Surface tone like every other. The `phiCustom*` names are the
41
44
  * palette's custom colours, laid over the same way (theme/phi-theme-palette.ts).
42
45
  */
43
- export declare const PHI_THEME_OWN_TOKEN_KEYS: readonly ["paddingXXL", "phiGradient1", "phiGradient1Text", "phiGradient2", "phiGradient2Text", "phiGradient3", "phiGradient3Text", "phiPrimaryButtonGradient", "phiPrimaryButtonGradientHover", "phiPrimaryButtonGradientActive", "phiPrimaryButtonGradientText", "phiCustom1", "phiCustom2", "phiCustom3", "phiCustom4", "phiCustom5", "phiCustom6", "phiCustom7", "phiCustom8", "phiCustom9", "phiCustom10"];
46
+ export declare const PHI_THEME_OWN_TOKEN_KEYS: readonly ["paddingXXL", "phiPageMax", "phiGradient1", "phiGradient1Text", "phiGradient2", "phiGradient2Text", "phiGradient3", "phiGradient3Text", "phiPrimaryButtonGradient", "phiPrimaryButtonGradientHover", "phiPrimaryButtonGradientActive", "phiPrimaryButtonGradientText", "phiCustom1", "phiCustom2", "phiCustom3", "phiCustom4", "phiCustom5", "phiCustom6", "phiCustom7", "phiCustom8", "phiCustom9", "phiCustom10"];
44
47
  export type PhiThemeTokenKey = (typeof PHI_THEME_TOKEN_KEYS)[number];
45
48
  /**
46
49
  * The resolved Theme, in the names above and their Ant Design value types.
@@ -1,3 +1,4 @@
1
+ import { PHI_CONTAINER_BREAKPOINT_REGION } from "./phi-container-breakpoints";
1
2
  /**
2
3
  * The token vocabulary of this house, stated once.
3
4
  *
@@ -165,6 +166,9 @@ export const PHI_THEME_TOKEN_KEYS = [
165
166
  * Design's type and a name Ant Design does not know cannot be cut from it. A Client Component that
166
167
  * needs one of these reads it as a CSS variable, the way a Server Component does.
167
168
  *
169
+ * `phiPageMax` is how wide a Page may get (theme/phi-tokens.ts, `PHI_LAYOUT.pageMax`); a Page reads it
170
+ * as `PHI_PAGE.max`.
171
+ *
168
172
  * The `phiGradient*` names are the Theme's gradient slots and the primary Buttons' run
169
173
  * (theme/phi-theme-gradients.ts): tokens of this package's own, laid over the resolved ones so Ant
170
174
  * Design writes them per mode and per Surface tone like every other. The `phiCustom*` names are the
@@ -172,6 +176,7 @@ export const PHI_THEME_TOKEN_KEYS = [
172
176
  */
173
177
  export const PHI_THEME_OWN_TOKEN_KEYS = [
174
178
  "paddingXXL",
179
+ "phiPageMax",
175
180
  "phiGradient1",
176
181
  "phiGradient1Text",
177
182
  "phiGradient2",
@@ -252,7 +257,26 @@ export function assertPhiThemeVocabulary({ palette, styleToken, modeSeedKeys, so
252
257
  for (const [mode, modeConfig] of Object.entries(palette?.modes ?? {})) {
253
258
  violations.push(...readPhiThemeVocabularyViolations(modeConfig?.seed, modeSeedNames, source, `the ${mode} seed`), ...readPhiThemeVocabularyViolations(modeConfig?.overrides, PHI_THEME_TOKEN_NAMES, source, `the ${mode} override`));
254
259
  }
260
+ violations.push(...readPhiThemePageMaxViolations(styleToken, source));
255
261
  if (violations.length > 0) {
256
262
  throw new Error(violations.join(" "));
257
263
  }
258
264
  }
265
+ /**
266
+ * A Page's maximum is a number of pixels and at least the width from which a Region counts as wide.
267
+ *
268
+ * Narrower, no Page could ever be wide: a Grid of four columns or anything else that answers to the
269
+ * Region threshold would never draw its wide form, and nothing would say why.
270
+ */
271
+ function readPhiThemePageMaxViolations(styleToken, source) {
272
+ const value = styleToken?.phiPageMax;
273
+ if (value == null)
274
+ return [];
275
+ if (typeof value !== "number" || !Number.isFinite(value)) {
276
+ return [`${source}: the style token states phiPageMax as ${JSON.stringify(value)}, which is not a number of pixels.`];
277
+ }
278
+ if (value < PHI_CONTAINER_BREAKPOINT_REGION) {
279
+ return [`${source}: the style token states phiPageMax ${value}, narrower than ${PHI_CONTAINER_BREAKPOINT_REGION}, from which a Region counts as wide.`];
280
+ }
281
+ return [];
282
+ }
@@ -32,6 +32,8 @@ export type PhiThemeTokens = {
32
32
  paddingLG: number;
33
33
  paddingXL: number;
34
34
  paddingXXL: number;
35
+ /** How wide a Page may get (`PHI_LAYOUT.pageMax`), published as `--ant-phi-page-max`. */
36
+ phiPageMax: number;
35
37
  marginXXS: number;
36
38
  marginXS: number;
37
39
  marginSM: number;
@@ -17,6 +17,7 @@ function buildPhiThemeTokens(options = {}) {
17
17
  paddingLG: PHI_PADDING_VALUES.lg,
18
18
  paddingXL: PHI_PADDING_VALUES.xl,
19
19
  paddingXXL: PHI_PADDING_VALUES.xxl,
20
+ phiPageMax: PHI_LAYOUT.pageMax,
20
21
  // Ant Design's second family, on the same scale: its own components read it (phi-tokens.ts).
21
22
  marginXXS: PHI_PADDING_VALUES.xxs,
22
23
  marginXS: PHI_PADDING_VALUES.xs,
@@ -88,7 +88,7 @@ export declare const PHI_LAYOUT: {
88
88
  readonly numberControlMax: 144;
89
89
  readonly contentMaxNarrow: 377;
90
90
  readonly contentMax: 610;
91
- readonly contentMaxWide: 987;
91
+ readonly pageMax: 1220;
92
92
  readonly readingMax: 754;
93
93
  readonly heroHeight: 377;
94
94
  };
@@ -118,13 +118,24 @@ export const PHI_LAYOUT = {
118
118
  * `narrow` is a single column of Controls without a label beside them -- a sign-in, a confirmation.
119
119
  * `contentMax` is the one a labelled form wants: the 24-track grid puts labels left of their
120
120
  * Controls, and at 377 a label column of 8 tracks leaves the Control too little to show what is in
121
- * it. `wide` is for what is read across rather than filled in, such as a table.
121
+ * it.
122
122
  *
123
123
  * They are maxima and not widths. A block still fills its slot; these only say where it stops.
124
124
  */
125
125
  contentMaxNarrow: 377,
126
126
  contentMax: 610,
127
- contentMaxWide: 987,
127
+ /*
128
+ * How wide a Page is allowed to get: the column a catalogue, a landing or a Module's wide Page stands in.
129
+ *
130
+ * The Theme's to decide and not a constant: this is only the answer where a Theme says nothing, and a
131
+ * Page reads it as `PHI_PAGE.max`, the Theme's own variable, never as this number -- a Theme that
132
+ * widens its Pages then widens every one of them, an edited copy included.
133
+ *
134
+ * 987 + 233, off the sequence the way `readingMax` is. 987 itself is not a Page's width but the
135
+ * threshold from which a Region counts as wide (`PHI_CONTAINER_BREAKPOINT_REGION`), and a Page has to
136
+ * be able to get past it, which is why a Theme may not state less (`assertPhiThemeVocabulary`).
137
+ */
138
+ pageMax: 1220,
128
139
  /*
129
140
  * How wide a column of prose is allowed to get: an article, an entry and what stands around it.
130
141
  *
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_RADIUS, PHI_SPACE } from "./theme/antd-css-var-contract";
3
+ export { PHI_COLOR, 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_RADIUS, PHI_SPACE } from "./theme/antd-css-var-contract";
8
+ export { PHI_COLOR, PHI_PAGE, PHI_RADIUS, PHI_SPACE } from "./theme/antd-css-var-contract";
9
9
  export {} from "./theme/phi-theme-blocks";