@phis/ui 0.5.1 → 0.5.3

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 (195) hide show
  1. package/README.md +1 -1
  2. package/components/controls/phi-border-control.js +1 -1
  3. package/components/controls/phi-bound-radius-control.js +9 -9
  4. package/components/controls/phi-brand-control.js +1 -1
  5. package/components/controls/phi-drawer-control-adapter.js +4 -4
  6. package/components/controls/phi-dropdown-control.js +2 -2
  7. package/components/controls/phi-form-control.js +1 -1
  8. package/components/controls/phi-image-control.js +1 -1
  9. package/components/controls/phi-mask-picker-control.js +6 -6
  10. package/components/controls/phi-select-control.js +1 -1
  11. package/components/controls/phi-theme-scope-control.js +1 -1
  12. package/components/controls/use-phi-color-control-presets.js +2 -2
  13. package/components/forms/compound-form-controls.js +2 -2
  14. package/components/forms/extended-form-field-controls.js +1 -1
  15. package/components/forms/shared-form-provider-registry.js +2 -2
  16. package/components/layouts/clients/phi-flex-layout-client.js +4 -4
  17. package/components/layouts/clients/phi-grid-layout-client.js +3 -3
  18. package/components/layouts/clients/phi-sequence-slot-editor.js +1 -1
  19. package/components/layouts/layout-definitions.d.ts +4 -4
  20. package/components/layouts/phi-page-region-layout.js +1 -1
  21. package/components/layouts/phi-structure-region-layout.js +3 -3
  22. package/components/media/phi-asset-focal-rect-widget.js +4 -4
  23. package/components/media/phi-asset-inspector-section.js +1 -1
  24. package/components/media/phi-media-kind-icon.js +2 -2
  25. package/components/media/phi-media-restricted-icon.js +1 -1
  26. package/components/overlays/phi-overlay-container-client.js +1 -1
  27. package/components/regions/presets/phi-base-page-column.d.ts +5 -2
  28. package/components/regions/presets/phi-base-page-column.js +6 -2
  29. package/components/root/phi-config-provider.js +1 -1
  30. package/components/root/phi-root-background.js +1 -1
  31. package/components/root/phi-root-theme-resolver.js +1 -1
  32. package/components/shell/phi-module-icons.js +1 -1
  33. package/components/widgets/built-in/builder-workspace-preview.js +8 -8
  34. package/components/widgets/client/bullet-list-entries-editor.js +2 -2
  35. package/components/widgets/client/external-document-editor.js +1 -1
  36. package/components/widgets/client/html-editor.js +3 -3
  37. package/components/widgets/config/background.d.ts +1 -1
  38. package/components/widgets/config/background.js +1 -1
  39. package/components/widgets/inspector-field-row.js +1 -1
  40. package/components/widgets/label-sets/inspector.js +2 -0
  41. package/components/widgets/label-types/inspector.d.ts +1 -0
  42. package/components/widgets/label-types/inspector.js +1 -0
  43. package/components/widgets/shared/card-body-client.js +1 -1
  44. package/components/widgets/shared/result-body-client.js +1 -1
  45. package/constants/media-library-provider-keys.d.ts +8 -1
  46. package/constants/media-library-provider-keys.js +8 -1
  47. package/constants/record-field-kinds.d.ts +6 -0
  48. package/constants/record-field-kinds.js +7 -0
  49. package/constants/runtime-module-ownership.js +1 -1
  50. package/helpers/border-widget-style.d.ts +2 -2
  51. package/helpers/border-widget-style.js +2 -2
  52. package/helpers/cms-dialog.d.ts +4 -4
  53. package/helpers/cms-layout-defaults.d.ts +2 -2
  54. package/helpers/cms-page-catalog.d.ts +5 -0
  55. package/helpers/cms-preset-page-tree.d.ts +4 -0
  56. package/helpers/cms-preset-page-tree.js +2 -0
  57. package/helpers/cms-region-keys.d.ts +1 -1
  58. package/helpers/layout-style.d.ts +2 -2
  59. package/helpers/page-layout-check.d.ts +4 -1
  60. package/helpers/page-layout-check.js +26 -0
  61. package/helpers/record-fields.d.ts +9 -0
  62. package/helpers/record-fields.js +84 -0
  63. package/helpers/surface-presets.d.ts +6 -6
  64. package/helpers/surface-style.d.ts +1 -1
  65. package/helpers.d.ts +0 -1
  66. package/helpers.js +0 -2
  67. package/module-page-check.d.ts +12 -0
  68. package/module-page-check.js +12 -0
  69. package/module-records.d.ts +4 -2
  70. package/module-records.js +3 -1
  71. package/next/antd-form-context-loader.mjs +31 -0
  72. package/next/config.d.mts +2 -0
  73. package/next/config.mjs +36 -3
  74. package/package.json +10 -1
  75. package/plugins/runtime-modules/asset/data-providers.d.ts +0 -65
  76. package/plugins/runtime-modules/asset/data-providers.js +0 -40
  77. package/plugins/runtime-modules/asset/definition.d.ts +0 -60
  78. package/plugins/runtime-modules/asset/ids.d.ts +0 -1
  79. package/plugins/runtime-modules/asset/ids.js +1 -2
  80. package/plugins/runtime-modules/asset/presets.d.ts +1 -0
  81. package/plugins/runtime-modules/asset/server.js +0 -5
  82. package/plugins/runtime-modules/blog/presets.d.ts +1 -0
  83. package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +4 -1
  84. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +13 -4
  85. package/plugins/runtime-modules/builder/clients/inspector-link-target-field.js +1 -1
  86. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +14 -1
  87. package/plugins/runtime-modules/builder/clients/inspector-signal-section.js +2 -2
  88. package/plugins/runtime-modules/builder/clients/layout-inspector.js +1 -1
  89. package/plugins/runtime-modules/builder/clients/layout-scaffold-buttons.js +4 -4
  90. package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +1 -1
  91. package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
  92. package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
  93. package/plugins/runtime-modules/builder/clients/shells-workspace.js +1 -1
  94. package/plugins/runtime-modules/builder/clients/structure-canvas.js +2 -2
  95. package/plugins/runtime-modules/builder/clients/widget-effects-editor.js +1 -1
  96. package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +4 -1
  97. package/plugins/runtime-modules/builder/clients/widget-inspector.js +3 -2
  98. package/plugins/runtime-modules/builder/page-presets.server.d.ts +6 -0
  99. package/plugins/runtime-modules/builder/page-presets.server.js +8 -0
  100. package/plugins/runtime-modules/builder/pages-workspace.js +12 -1
  101. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +5 -5
  102. package/plugins/runtime-modules/builder/structure-dnd.js +2 -2
  103. package/plugins/runtime-modules/builder/widgets/test-block/client.js +1 -1
  104. package/plugins/runtime-modules/content-entry-routes.d.ts +1 -0
  105. package/plugins/runtime-modules/contracts.d.ts +1 -1
  106. package/plugins/runtime-modules/contracts.js +41 -1
  107. package/plugins/runtime-modules/core/data-providers.d.ts +60 -0
  108. package/plugins/runtime-modules/core/data-providers.js +41 -0
  109. package/plugins/runtime-modules/core/definition.d.ts +55 -0
  110. package/plugins/runtime-modules/core/server.js +5 -0
  111. package/plugins/runtime-modules/core/widgets/button/config.d.ts +34 -0
  112. package/plugins/runtime-modules/core/widgets/button/config.js +16 -0
  113. package/plugins/runtime-modules/core/widgets/button/plugin.js +37 -6
  114. package/plugins/runtime-modules/core/widgets/card/config.d.ts +13 -2
  115. package/plugins/runtime-modules/core/widgets/description/config.d.ts +13 -2
  116. package/plugins/runtime-modules/core/widgets/description/editor.js +13 -13
  117. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +11 -0
  118. package/plugins/runtime-modules/core/widgets/gallery/client.d.ts +4 -1
  119. package/plugins/runtime-modules/core/widgets/gallery/client.js +29 -21
  120. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +16 -0
  121. package/plugins/runtime-modules/core/widgets/gallery/config.js +16 -0
  122. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
  123. package/plugins/runtime-modules/core/widgets/gallery/server.js +11 -0
  124. package/plugins/runtime-modules/core/widgets/header-navigation/authoring.js +2 -3
  125. package/plugins/runtime-modules/core/widgets/header-navigation/client.d.ts +1 -3
  126. package/plugins/runtime-modules/core/widgets/header-navigation/client.js +9 -5
  127. package/plugins/runtime-modules/core/widgets/header-navigation/config.d.ts +1 -4
  128. package/plugins/runtime-modules/core/widgets/header-navigation/plugin.js +2 -3
  129. package/plugins/runtime-modules/core/widgets/header-navigation/server.d.ts +2 -2
  130. package/plugins/runtime-modules/core/widgets/header-navigation/server.js +1 -2
  131. package/plugins/runtime-modules/core/widgets/image/config.d.ts +35 -0
  132. package/plugins/runtime-modules/core/widgets/image/config.js +8 -0
  133. package/plugins/runtime-modules/core/widgets/image/plugin.js +19 -1
  134. package/plugins/runtime-modules/core/widgets/image/server.d.ts +3 -1
  135. package/plugins/runtime-modules/core/widgets/image/server.js +2 -2
  136. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +13 -0
  137. package/plugins/runtime-modules/core/widgets/markdown/config.js +8 -0
  138. package/plugins/runtime-modules/core/widgets/markdown/editor.js +7 -7
  139. package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
  140. package/plugins/runtime-modules/core/widgets/record/authoring.js +1 -1
  141. package/plugins/runtime-modules/core/widgets/result/config.d.ts +11 -0
  142. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +13 -0
  143. package/plugins/runtime-modules/core/widgets/simple-text/config.js +9 -0
  144. package/plugins/runtime-modules/core/widgets/simple-text/editor.js +1 -1
  145. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +14 -1
  146. package/plugins/runtime-modules/core/widgets/spacer/client.js +1 -1
  147. package/plugins/runtime-modules/core/widgets/table/config.d.ts +37 -0
  148. package/plugins/runtime-modules/descriptor-compiler.js +8 -0
  149. package/plugins/runtime-modules/editor/presets.d.ts +1 -0
  150. package/plugins/runtime-modules/groups/definition.d.ts +1 -1
  151. package/plugins/runtime-modules/localization/presets.d.ts +1 -0
  152. package/plugins/runtime-modules/news/presets.d.ts +1 -0
  153. package/plugins/runtime-modules/resolver.js +2 -0
  154. package/plugins/runtime-modules/revisions/presets.d.ts +1 -0
  155. package/plugins/runtime-modules/theme/presets.d.ts +1 -0
  156. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +37 -1
  157. package/server-helpers/cms-page-record.d.ts +26 -0
  158. package/server-helpers/cms-page-record.js +42 -0
  159. package/server-helpers/cms-request.js +48 -4
  160. package/server-helpers/record-fields.d.ts +62 -0
  161. package/server-helpers/record-fields.js +87 -0
  162. package/server-helpers/record-samples.d.ts +21 -0
  163. package/server-helpers/record-samples.js +41 -0
  164. package/styles/builder-scaffold.css +19 -19
  165. package/styles/controls.css +121 -108
  166. package/styles/gradients.css +23 -23
  167. package/styles/layout-affordances.css +15 -15
  168. package/styles/layout-authoring-scaffold.css +20 -20
  169. package/styles/layout.css +9 -9
  170. package/styles/root.css +4 -4
  171. package/styles/shell.css +48 -17
  172. package/theme/antd-css-var-contract.d.ts +93 -78
  173. package/theme/antd-css-var-contract.js +99 -79
  174. package/theme/phi-container-breakpoints.d.ts +4 -1
  175. package/theme/phi-container-breakpoints.js +4 -1
  176. package/theme/phi-control-shape.d.ts +1 -1
  177. package/theme/phi-theme-gradients.d.ts +2 -2
  178. package/theme/phi-theme-gradients.js +14 -14
  179. package/theme/phi-theme-palette.d.ts +1 -1
  180. package/theme/phi-theme-palette.js +2 -2
  181. package/theme/phi-theme-tokens.d.ts +10 -4
  182. package/theme/phi-theme-tokens.js +78 -23
  183. package/theme/phi-theme.d.ts +14 -0
  184. package/theme/phi-theme.js +14 -0
  185. package/theme/phi-tokens.d.ts +6 -1
  186. package/theme/phi-tokens.js +22 -2
  187. package/theme.d.ts +1 -1
  188. package/theme.js +1 -1
  189. package/types/cms-module-descriptors.d.ts +6 -0
  190. package/types/cms-plugins.d.ts +19 -1
  191. package/types/core-widget-placements.d.ts +10 -0
  192. package/types/record-provider.d.ts +92 -0
  193. package/types/widget-runtime.d.ts +5 -0
  194. /package/plugins/runtime-modules/{asset/services/folder-images.server.d.ts → core/services/media-folder-images.server.d.ts} +0 -0
  195. /package/plugins/runtime-modules/{asset/services/folder-images.server.js → core/services/media-folder-images.server.js} +0 -0
@@ -26,6 +26,8 @@ function parsePhiButtonWidgetConfig(config) {
26
26
  gradient: readPhiThemeGradientKey(config.gradient),
27
27
  linkTarget: readPhiLinkTarget(config.linkTarget) ?? undefined,
28
28
  danger: readBoolean(config.danger),
29
+ valueRecordField: readString(config.valueRecordField),
30
+ linkRecordField: readString(config.linkRecordField),
29
31
  };
30
32
  }
31
33
  const PHI_BUTTON_DEFAULT_CONFIG = {
@@ -87,6 +89,13 @@ export const PHI_BUTTON_WIDGET_DEFINITION = {
87
89
  { key: "tooltip", type: "string", label: "Tooltip" },
88
90
  { key: "icon", type: "icon", label: "Icon", editorPlacement: "toolbar" },
89
91
  { key: "value", type: "string", label: "Signal Value" },
92
+ {
93
+ key: "valueRecordField",
94
+ type: "record-field",
95
+ label: "Signal Value from record",
96
+ description: "Sends a field of the record this page is about as the signal value, instead of the value above.",
97
+ kinds: ["text"],
98
+ },
90
99
  /* Above Danger, so Danger stands with the state switches below it. */
91
100
  ...PHI_CONTROL_PRESENTATION_FIELDS,
92
101
  { key: "danger", type: "boolean", label: "Danger" },
@@ -102,6 +111,13 @@ export const PHI_BUTTON_WIDGET_DEFINITION = {
102
111
  label: "Link target",
103
112
  visibleWhen: { field: "signalRoutes.emits", equals: null },
104
113
  },
114
+ {
115
+ key: "linkRecordField",
116
+ type: "record-field",
117
+ label: "Link from record",
118
+ description: "Leads where a field of the record this page is about leads, instead of the target above.",
119
+ kinds: ["link"],
120
+ },
105
121
  ...PHI_CONTROL_BADGE_FIELDS,
106
122
  ],
107
123
  defaultConfig: PHI_BUTTON_DEFAULT_CONFIG,
@@ -5,8 +5,10 @@ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
5
5
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
6
6
  import { PHI_BUTTON_WIDGET_DEFINITION } from "./config";
7
7
  import { getPhiCommonControlLabelsForRuntime } from "../../../../../components/widgets/label-sets/common-controls";
8
+ import { isPhiExternalHref } from "../../../../../helpers/external-href";
8
9
  import { resolvePhiLinkHref } from "../../../../../helpers/link-target";
9
10
  import { trBulkForLocale } from "../../../../../server-helpers/translate";
11
+ import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
10
12
  /**
11
13
  * The Button's own words in the reader's language.
12
14
  *
@@ -26,6 +28,24 @@ async function translatePhiButtonConfig(config, runtime, translate) {
26
28
  ...Object.fromEntries(entries.map(([key, text], index) => [key, translated[index]?.trim() || text])),
27
29
  };
28
30
  }
31
+ /**
32
+ * What the page record says of the Button, where it names a field for its value or its link: a Button on
33
+ * a template sends what the record it stands beside is called and leads where that record leads, not a
34
+ * value or a target frozen into the Page. A record without a field the Button names leaves it without
35
+ * that part of its own, so it is not drawn.
36
+ */
37
+ async function resolvePhiButtonRecordConfig(config, runtime, registry) {
38
+ const valueField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.valueRecordField, kinds: ["text"] });
39
+ const linkField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.linkRecordField, kinds: ["link"] });
40
+ if (valueField.bound && !valueField.field?.value)
41
+ return null;
42
+ if (linkField.bound && !linkField.field)
43
+ return null;
44
+ return {
45
+ config: valueField.bound && valueField.field ? { ...config, value: valueField.field.value } : config,
46
+ link: linkField.bound && linkField.field ? linkField.field.value : null,
47
+ };
48
+ }
29
49
  export const PHI_BUTTON_WIDGET_PLUGIN = {
30
50
  ...PHI_BUTTON_WIDGET_DEFINITION,
31
51
  /*
@@ -33,12 +53,23 @@ export const PHI_BUTTON_WIDGET_PLUGIN = {
33
53
  * nothing in a browser -- which address it answers on is the server's to know, and it resolved every
34
54
  * target on this page in one pass before anything drew.
35
55
  */
36
- render: async ({ widget, config, runtime, links }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Button, componentProps: {
37
- blockId: widget.id,
38
- config: await translatePhiButtonConfig(config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate)),
39
- labels: await getPhiCommonControlLabelsForRuntime(runtime),
40
- link: resolvePhiLinkHref(config.linkTarget, links),
41
- } })),
56
+ render: async ({ widget, config: stored, runtime, links, registry }) => {
57
+ const bound = await resolvePhiButtonRecordConfig(stored, runtime, registry);
58
+ if (!bound)
59
+ return null;
60
+ const { link: recordLink } = bound;
61
+ const translated = await translatePhiButtonConfig(bound.config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate));
62
+ /* The record's words stand in for an empty label only, and are the record's own: not translated. */
63
+ const config = recordLink?.label && !translated.label?.trim() ? { ...translated, label: recordLink.label } : translated;
64
+ return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Button, componentProps: {
65
+ blockId: widget.id,
66
+ config,
67
+ labels: await getPhiCommonControlLabelsForRuntime(runtime),
68
+ link: recordLink
69
+ ? { href: recordLink.href, newTab: false, external: isPhiExternalHref(recordLink.href) }
70
+ : resolvePhiLinkHref(bound.config.linkTarget, links),
71
+ } }));
72
+ },
42
73
  renderPreview: async ({ widget, config, runtime, links }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Button, componentProps: {
43
74
  blockId: widget.id,
44
75
  config: await translatePhiButtonConfig(config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate)),
@@ -136,7 +136,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
136
136
  readonly background: {
137
137
  readonly base: {
138
138
  readonly kind: "color";
139
- readonly color: "var(--ant-color-bg-container)";
139
+ readonly color: "var(--phi-color-bg-container)";
140
140
  };
141
141
  readonly overlay: null;
142
142
  readonly filter: null;
@@ -145,7 +145,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
145
145
  readonly border: {
146
146
  readonly borderWidth: 1;
147
147
  readonly borderStyle: "solid";
148
- readonly borderColor: "var(--ant-color-border-secondary)";
148
+ readonly borderColor: "var(--phi-color-border-secondary)";
149
149
  };
150
150
  readonly shadow: "soft";
151
151
  };
@@ -230,6 +230,17 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
230
230
  editorPlacement?: "inspector" | "geometry" | "toolbar";
231
231
  visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
232
232
  heading?: string;
233
+ } & {
234
+ type: "record-field";
235
+ kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
236
+ }) | ({
237
+ key: string;
238
+ label: string;
239
+ description?: string;
240
+ required?: boolean;
241
+ editorPlacement?: "inspector" | "geometry" | "toolbar";
242
+ visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
243
+ heading?: string;
233
244
  } & {
234
245
  type: "dimension";
235
246
  widthKey?: string;
@@ -101,6 +101,17 @@ export declare const PHI_DESCRIPTION_WIDGET_DEFINITION: {
101
101
  editorPlacement?: "inspector" | "geometry" | "toolbar";
102
102
  visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
103
103
  heading?: string;
104
+ } & {
105
+ type: "record-field";
106
+ kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
107
+ }) | ({
108
+ key: string;
109
+ label: string;
110
+ description?: string;
111
+ required?: boolean;
112
+ editorPlacement?: "inspector" | "geometry" | "toolbar";
113
+ visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
114
+ heading?: string;
104
115
  } & {
105
116
  type: "dimension";
106
117
  widthKey?: string;
@@ -351,7 +362,7 @@ export declare const PHI_DESCRIPTION_WIDGET_DEFINITION: {
351
362
  readonly background: {
352
363
  readonly base: {
353
364
  readonly kind: "color";
354
- readonly color: "var(--ant-color-bg-container)";
365
+ readonly color: "var(--phi-color-bg-container)";
355
366
  };
356
367
  readonly overlay: null;
357
368
  readonly filter: null;
@@ -360,7 +371,7 @@ export declare const PHI_DESCRIPTION_WIDGET_DEFINITION: {
360
371
  readonly border: {
361
372
  readonly borderWidth: 1;
362
373
  readonly borderStyle: "solid";
363
- readonly borderColor: "var(--ant-color-border-secondary)";
374
+ readonly borderColor: "var(--phi-color-border-secondary)";
364
375
  };
365
376
  readonly shadow: "soft";
366
377
  };
@@ -22,7 +22,7 @@ const EDITOR_TEXTAREA_STYLE = {
22
22
  paddingBlock: 6,
23
23
  borderRadius: 0,
24
24
  borderWidth: 0,
25
- borderBottom: "1px solid var(--ant-color-border, rgba(0, 0, 0, 0.15))",
25
+ borderBottom: "1px solid var(--phi-color-border, rgba(0, 0, 0, 0.15))",
26
26
  backgroundColor: "transparent",
27
27
  resize: "none",
28
28
  };
@@ -58,31 +58,31 @@ export function PhiDescriptionWidgetEditor({ config, onChange, }) {
58
58
  return (_jsx(PhiFlexControl, { vertical: true, gap: 16, style: { width: "100%", minWidth: 0 }, children: _jsxs(PhiFlexControl, { vertical: true, gap: 10, style: { width: "100%", minWidth: 0 }, children: [sections.eyebrowTag ? (_jsx(PhiTagControl, { color: "default", style: {
59
59
  width: "fit-content",
60
60
  borderRadius: 999,
61
- paddingInline: "var(--ant-padding-sm)",
62
- paddingBlock: "var(--ant-padding-xxs)",
63
- fontSize: "var(--ant-font-size-sm)",
61
+ paddingInline: "var(--phi-padding-sm)",
62
+ paddingBlock: "var(--phi-padding-xxs)",
63
+ fontSize: "var(--phi-font-size-sm)",
64
64
  fontWeight: 600,
65
65
  letterSpacing: "0.04em",
66
- color: "var(--ant-color-text-tertiary)",
67
- borderColor: "var(--ant-color-border-secondary)",
68
- background: "var(--ant-color-fill-quaternary)",
66
+ color: "var(--phi-color-text-tertiary)",
67
+ borderColor: "var(--phi-color-border-secondary)",
68
+ background: "var(--phi-color-fill-quaternary)",
69
69
  }, children: _jsx(PhiTextControl, { presentation: "textarea", value: draft.eyebrow, readOnly: !onChange, variant: "borderless", placeholder: "Eyebrow", autoSize: { minRows: 1, maxRows: 2 }, onChange: (value) => updateField("eyebrow", value ?? ""), onBlur: () => commitField("eyebrow"), style: { ...EDITOR_TEXTAREA_STYLE, borderBottom: "none", paddingBlock: 0 } }) })) : (_jsx(PhiTextControl, { presentation: "textarea", value: draft.eyebrow, readOnly: !onChange, variant: "borderless", placeholder: "Eyebrow", autoSize: { minRows: 1, maxRows: 2 }, onChange: (value) => updateField("eyebrow", value ?? ""), onBlur: () => commitField("eyebrow"), style: EDITOR_TEXTAREA_STYLE })), sections.heading ? (_jsxs("div", { children: [_jsx(PhiTextControl, { presentation: "textarea", value: draft.title, readOnly: !onChange, variant: "borderless", placeholder: "Title", autoSize: { minRows: 1, maxRows: 4 }, onChange: (value) => updateField("title", value ?? ""), onBlur: () => commitField("title"), style: {
70
70
  ...EDITOR_TEXTAREA_STYLE,
71
- fontSize: "var(--ant-font-size-heading-2, 2rem)",
71
+ fontSize: "var(--phi-font-size-heading-2, 2rem)",
72
72
  lineHeight: 1.2,
73
73
  fontWeight: 600,
74
- marginBottom: draft.description ? "var(--ant-padding-xs)" : 0,
74
+ marginBottom: draft.description ? "var(--phi-padding-xs)" : 0,
75
75
  } }), _jsx(PhiTextControl, { presentation: "textarea", value: draft.description, readOnly: !onChange, variant: "borderless", placeholder: "Description", autoSize: { minRows: 2, maxRows: 8 }, onChange: (value) => updateField("description", value ?? ""), onBlur: () => commitField("description"), style: {
76
76
  ...EDITOR_TEXTAREA_STYLE,
77
- color: "var(--ant-color-text-secondary)",
78
- fontSize: "var(--ant-font-size)",
77
+ color: "var(--phi-color-text-secondary)",
78
+ fontSize: "var(--phi-font-size)",
79
79
  lineHeight: 1.5,
80
80
  } })] })) : null, sections.aside ? (_jsxs(PhiFlexControl, { vertical: true, gap: 12, style: { width: "100%" }, children: [_jsx(PhiTextControl, { presentation: "textarea", value: draft.asideTitle, readOnly: !onChange, variant: "borderless", placeholder: "Aside title", autoSize: { minRows: 1, maxRows: 3 }, onChange: (value) => updateField("asideTitle", value ?? ""), onBlur: () => commitField("asideTitle"), style: {
81
81
  ...EDITOR_TEXTAREA_STYLE,
82
- color: "var(--ant-color-text-heading)",
82
+ color: "var(--phi-color-text-heading)",
83
83
  fontWeight: 600,
84
84
  } }), _jsx(PhiBulletListEntriesEditor, { entries: resolvedConfig.asideItems, listStyle: resolvePhiBulletListStyle(config?.asideList), ...(onChange ? { onCommit: (asideItems) => onChange({ asideItems }) } : {}) })] })) : null, _jsx(PhiTextControl, { presentation: "textarea", value: draft.footer, readOnly: !onChange, variant: "borderless", placeholder: "Footer", autoSize: { minRows: 1, maxRows: 5 }, onChange: (value) => updateField("footer", value ?? ""), onBlur: () => commitField("footer"), style: {
85
85
  ...EDITOR_TEXTAREA_STYLE,
86
- color: "var(--ant-color-text-tertiary)",
86
+ color: "var(--phi-color-text-tertiary)",
87
87
  } })] }) }));
88
88
  }
@@ -145,6 +145,17 @@ export declare const PHI_ENTRY_LIST_WIDGET_DEFINITION: {
145
145
  editorPlacement?: "inspector" | "geometry" | "toolbar";
146
146
  visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
147
147
  heading?: string;
148
+ } & {
149
+ type: "record-field";
150
+ kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
151
+ }) | ({
152
+ key: string;
153
+ label: string;
154
+ description?: string;
155
+ required?: boolean;
156
+ editorPlacement?: "inspector" | "geometry" | "toolbar";
157
+ visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
158
+ heading?: string;
148
159
  } & {
149
160
  type: "dimension";
150
161
  widthKey?: string;
@@ -1,5 +1,6 @@
1
1
  import { type PhiGalleryWidgetLabels } from "../../../../../components/widgets/label-types/gallery";
2
2
  import type { PhiPublicMediaAssetReference } from "../../../../../types/media";
3
+ import type { PhiRecordPicture } from "../../../../../types/record-provider";
3
4
  import type { PhiCmsGalleryWidgetConfig } from "./config";
4
5
  /**
5
6
  * A run of pictures. How it moves and stops is `PhiSequenceRun`'s; what is here is the picture: its
@@ -10,6 +11,8 @@ export type PhiGalleryWidgetProps = {
10
11
  config?: PhiCmsGalleryWidgetConfig;
11
12
  /** The server's answer to the binding: public Assets, in the order the Folder was asked for. */
12
13
  images?: PhiPublicMediaAssetReference[];
14
+ /** The page record's pictures, in place of `images`: each by its address, drawn as an Image Widget draws a URL. */
15
+ pictures?: readonly PhiRecordPicture[];
13
16
  labels?: PhiGalleryWidgetLabels;
14
17
  };
15
- export declare function PhiGalleryWidget({ config, images: imagesInput, labels: labelsInput }: PhiGalleryWidgetProps): import("react").JSX.Element;
18
+ export declare function PhiGalleryWidget({ config, images: imagesInput, pictures, labels: labelsInput }: PhiGalleryWidgetProps): import("react").JSX.Element;
@@ -8,23 +8,29 @@ import { readPhiAspectRatio, resolvePhiImagePresentation } from "../../../../../
8
8
  import { PHI_GALLERY_WIDGET_DEFAULT_LABELS, } from "../../../../../components/widgets/label-types/gallery";
9
9
  import { isPhiMediaSvgContentType } from "../../../../../constants/media";
10
10
  import { resolvePhiGalleryFrame } from "./defaults";
11
- function GalleryPicture({ image, variantKey, fit, preview, sizes, aspectRatio, }) {
12
- const presentation = resolvePhiImagePresentation({
13
- sourceKind: "asset",
14
- assetId: image.id,
15
- variantKey,
16
- variantVersion: image.variantVersion,
17
- deliveryRevision: image.deliveryRevision,
18
- originalUrl: image.deliveryUrl,
19
- focalRect: image.focalRect,
20
- fit,
21
- sourceWidth: image.width,
22
- sourceHeight: image.height,
23
- // The frame's proportion is known, so the crop can keep the whole focal rectangle in view.
24
- frameAspectRatio: readPhiAspectRatio(aspectRatio),
25
- });
11
+ function GalleryPicture({ item, variantKey, fit, preview, sizes, aspectRatio, }) {
12
+ // The frame's proportion is known, so the crop can keep the whole focal rectangle in view.
13
+ const frameAspectRatio = readPhiAspectRatio(aspectRatio);
14
+ const presentation = item.kind === "asset"
15
+ ? resolvePhiImagePresentation({
16
+ sourceKind: "asset",
17
+ assetId: item.image.id,
18
+ variantKey,
19
+ variantVersion: item.image.variantVersion,
20
+ deliveryRevision: item.image.deliveryRevision,
21
+ originalUrl: item.image.deliveryUrl,
22
+ focalRect: item.image.focalRect,
23
+ fit,
24
+ sourceWidth: item.image.width,
25
+ sourceHeight: item.image.height,
26
+ frameAspectRatio,
27
+ })
28
+ // A picture of a record has no rendition and no focal rectangle: its address, in the frame.
29
+ : resolvePhiImagePresentation({ sourceKind: "url", sourceUrl: item.picture.src, fit, frameAspectRatio });
26
30
  // The Folder route hands out public Assets only, so a raster original may go through the optimiser.
27
- const optimizable = presentation.kind === "generated-variant" || !isPhiMediaSvgContentType(image.contentType);
31
+ const optimizable = item.kind === "asset"
32
+ ? presentation.kind === "generated-variant" || !isPhiMediaSvgContentType(item.image.contentType)
33
+ : false;
28
34
  /*
29
35
  * The frame is a block of its own inside the track item, not the item itself. A flex item that is
30
36
  * stretched (`alignItems: stretch` on the track) has no height of its own for an aspect ratio to
@@ -33,16 +39,18 @@ function GalleryPicture({ image, variantKey, fit, preview, sizes, aspectRatio, }
33
39
  * definite box everywhere, and the picture fills it from the corners rather than through a chain
34
40
  * of percentage heights.
35
41
  */
36
- return (_jsx("div", { style: { position: "relative", width: "100%", aspectRatio }, children: _jsx(PhiImageControl, { presentation: presentation, source: "asset", alt: image.altText ?? "", title: image.title ?? undefined, blurDataUrl: image.blurDataUrl, optimizable: optimizable, sizes: sizes,
42
+ return (_jsx("div", { style: { position: "relative", width: "100%", aspectRatio }, children: _jsx(PhiImageControl, { presentation: presentation, source: item.kind === "asset" ? "asset" : "url", alt: (item.kind === "asset" ? item.image.altText : item.picture.alt) ?? "", title: item.kind === "asset" ? item.image.title ?? undefined : undefined, blurDataUrl: item.kind === "asset" ? item.image.blurDataUrl : undefined, optimizable: optimizable, sizes: sizes,
37
43
  // Unconditionally eager, and that is the whole mechanism: nothing outside the window and its
38
44
  // lookahead is mounted, so reaching this line already means the picture is wanted.
39
45
  loading: "eager", preview: preview, style: { position: "absolute", inset: 0, width: "100%", height: "100%" }, imageStyle: { width: "100%", height: "100%" } }) }));
40
46
  }
41
- export function PhiGalleryWidget({ config, images: imagesInput, labels: labelsInput }) {
47
+ export function PhiGalleryWidget({ config, images: imagesInput, pictures, labels: labelsInput }) {
42
48
  const { token } = usePhiConfig();
43
49
  const labels = labelsInput ?? PHI_GALLERY_WIDGET_DEFAULT_LABELS;
44
- const images = useMemo(() => imagesInput ?? [], [imagesInput]);
45
- const span = resolvePhiSequenceRunSpan(config?.visibleCount, images.length);
50
+ const items = useMemo(() => pictures
51
+ ? pictures.map((picture, index) => ({ kind: "url", key: `${index}:${picture.src}`, picture }))
52
+ : (imagesInput ?? []).map((image) => ({ kind: "asset", key: String(image.id), image })), [imagesInput, pictures]);
53
+ const span = resolvePhiSequenceRunSpan(config?.visibleCount, items.length);
46
54
  // What a picture of this window is worth of the viewport, for the optimiser's choice of rendition.
47
55
  const sizes = span === 1 ? "100vw" : `(max-width: 768px) 100vw, ${Math.ceil(100 / span)}vw`;
48
56
  const { aspectRatio, fit } = resolvePhiGalleryFrame(config);
@@ -51,5 +59,5 @@ export function PhiGalleryWidget({ config, images: imagesInput, labels: labelsIn
51
59
  borderRadius: token.borderRadius,
52
60
  overflow: "hidden",
53
61
  };
54
- return (_jsx(PhiSequenceRun, { items: images.map((image) => (_jsx(GalleryPicture, { image: image, variantKey: config?.variantKey, fit: fit, preview: config?.preview === true, sizes: sizes, aspectRatio: aspectRatio }, image.id))), settings: config, labels: labels, itemStyle: frameStyle }));
62
+ return (_jsx(PhiSequenceRun, { items: items.map((item) => (_jsx(GalleryPicture, { item: item, variantKey: config?.variantKey, fit: fit, preview: config?.preview === true, sizes: sizes, aspectRatio: aspectRatio }, item.key))), settings: config, labels: labels, itemStyle: frameStyle }));
55
63
  }
@@ -15,6 +15,11 @@ import { type PhiCmsWidgetConfigBase } from "../../../../../components/widgets/c
15
15
  export type PhiCmsGalleryWidgetConfig = PhiCmsWidgetConfigBase & PhiSequenceSettings & {
16
16
  /** The Folder the pictures come from: always the Media Folder Provider, with its parameters. */
17
17
  source: PhiRuntimeDataProviderBinding | null;
18
+ /**
19
+ * A pictures field of the page record that is shown instead of the Folder's pictures. `source` stays:
20
+ * it is what a Page about no record -- a template open in the Builder -- draws in the field's place.
21
+ */
22
+ recordField?: string;
18
23
  /** The rendition each picture is drawn in; absent is the original. */
19
24
  variantKey?: PhiImageAssetVariantKeyValue;
20
25
  /** Opens a picture larger over the page when clicked. */
@@ -107,6 +112,17 @@ export declare const PHI_GALLERY_WIDGET_DEFINITION: {
107
112
  editorPlacement?: "inspector" | "geometry" | "toolbar";
108
113
  visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
109
114
  heading?: string;
115
+ } & {
116
+ type: "record-field";
117
+ kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
118
+ }) | ({
119
+ key: string;
120
+ label: string;
121
+ description?: string;
122
+ required?: boolean;
123
+ editorPlacement?: "inspector" | "geometry" | "toolbar";
124
+ visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
125
+ heading?: string;
110
126
  } & {
111
127
  type: "dimension";
112
128
  widthKey?: string;
@@ -40,6 +40,13 @@ function readFolderSource(value) {
40
40
  }
41
41
  return binding;
42
42
  }
43
+ function readRecordField(value) {
44
+ if (value === undefined || value === null)
45
+ return undefined;
46
+ if (typeof value !== "string")
47
+ fail("recordField", value, "the key of a field of the page record");
48
+ return value.trim() || undefined;
49
+ }
43
50
  function readVariantKey(value) {
44
51
  if (value === undefined || value === null)
45
52
  return undefined;
@@ -53,10 +60,12 @@ export function parsePhiCmsGalleryWidgetConfig(raw) {
53
60
  const fit = readMember(raw.fit, ["cover", "contain"], "fit");
54
61
  const variantKey = readVariantKey(raw.variantKey);
55
62
  const preview = readFlag(raw.preview, "preview");
63
+ const recordField = readRecordField(raw.recordField);
56
64
  return {
57
65
  ...readRenderableBlockConfig(raw),
58
66
  ...readPhiSequenceSettings(raw, fail),
59
67
  source: readFolderSource(raw.source),
68
+ ...(recordField === undefined ? {} : { recordField }),
60
69
  ...(variantKey === undefined ? {} : { variantKey }),
61
70
  ...(preview === undefined ? {} : { preview }),
62
71
  ...(aspectRatio === undefined ? {} : { aspectRatio }),
@@ -84,6 +93,13 @@ export const PHI_GALLERY_WIDGET_DEFINITION = {
84
93
  providerKey: PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.folderImages,
85
94
  label: "Source",
86
95
  },
96
+ {
97
+ key: "recordField",
98
+ type: "record-field",
99
+ label: "Pictures from record",
100
+ description: "Shows the pictures of a field of the record this page is about, instead of the Folder's.",
101
+ kinds: ["pictures"],
102
+ },
87
103
  {
88
104
  key: "variantKey",
89
105
  type: "choice",
@@ -6,7 +6,7 @@ import type { PhiCmsGalleryWidgetConfig } from "./config";
6
6
  export type PhiGalleryWidgetServerProps = {
7
7
  runtime: PhiBlockRuntime;
8
8
  /** Where the record binding is answered; absent outside a page render, where nothing is bound. */
9
- registry?: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey">;
9
+ registry?: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey" | "recordFieldsLoadersByKey" | "dataProviderDescriptorsByKey">;
10
10
  config: PhiCmsGalleryWidgetConfig;
11
11
  widgetId?: PhiCmsInstanceId | null;
12
12
  /** Whether the pictures' descriptions go through the Site's translation; off where the Widget says so. */
@@ -4,6 +4,7 @@ import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runt
4
4
  import { getPhiGalleryWidgetLabels } from "../../../../../components/widgets/label-sets/gallery";
5
5
  import { PhiWidgetFailureServer } from "../../../../../components/widgets/shared/widget-failure.server";
6
6
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
7
+ import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
7
8
  import { resolvePhiRecordSource } from "../../../../../server-helpers/record-source";
8
9
  import { trBulk, trBulkForLocale } from "../../../../../server-helpers/translate";
9
10
  import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
@@ -22,6 +23,16 @@ function isPublicAssetReference(value) {
22
23
  export async function PhiGalleryWidgetServer({ runtime, registry, config, widgetId, translate = true }) {
23
24
  const labels = await getPhiGalleryWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
24
25
  const renderMode = readPhiRuntimeTreeRenderMode(config);
26
+ /*
27
+ * Where the Page has a record and the Widget names a field of it, the record's pictures take the place
28
+ * of the Folder's -- by their address, in the page's language already -- and a record without any leaves
29
+ * nothing to draw. A Page about no record draws the Folder, which stands in for the field.
30
+ */
31
+ const recordField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.recordField, kinds: ["pictures"] });
32
+ if (recordField.bound) {
33
+ const pictures = recordField.field?.value ?? [];
34
+ return pictures.length === 0 ? null : (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Gallery, componentProps: { config, pictures, labels } }));
35
+ }
25
36
  const result = registry && config.source
26
37
  ? await resolvePhiRecordSource({ registry, runtime, binding: config.source })
27
38
  : { status: "missing" };
@@ -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,