@phis/ui 0.5.2 → 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 (182) 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.js +6 -2
  28. package/components/root/phi-config-provider.js +1 -1
  29. package/components/root/phi-root-background.js +1 -1
  30. package/components/root/phi-root-theme-resolver.js +1 -1
  31. package/components/shell/phi-module-icons.js +1 -1
  32. package/components/widgets/built-in/builder-workspace-preview.js +8 -8
  33. package/components/widgets/client/bullet-list-entries-editor.js +2 -2
  34. package/components/widgets/client/external-document-editor.js +1 -1
  35. package/components/widgets/client/html-editor.js +3 -3
  36. package/components/widgets/config/background.d.ts +1 -1
  37. package/components/widgets/config/background.js +1 -1
  38. package/components/widgets/inspector-field-row.js +1 -1
  39. package/components/widgets/label-sets/inspector.js +2 -0
  40. package/components/widgets/label-types/inspector.d.ts +1 -0
  41. package/components/widgets/label-types/inspector.js +1 -0
  42. package/components/widgets/shared/card-body-client.js +1 -1
  43. package/components/widgets/shared/result-body-client.js +1 -1
  44. package/constants/media-library-provider-keys.d.ts +8 -1
  45. package/constants/media-library-provider-keys.js +8 -1
  46. package/constants/record-field-kinds.d.ts +6 -0
  47. package/constants/record-field-kinds.js +7 -0
  48. package/constants/runtime-module-ownership.js +1 -1
  49. package/helpers/border-widget-style.d.ts +2 -2
  50. package/helpers/border-widget-style.js +2 -2
  51. package/helpers/cms-dialog.d.ts +4 -4
  52. package/helpers/cms-layout-defaults.d.ts +2 -2
  53. package/helpers/cms-page-catalog.d.ts +5 -0
  54. package/helpers/cms-preset-page-tree.d.ts +4 -0
  55. package/helpers/cms-preset-page-tree.js +2 -0
  56. package/helpers/layout-style.d.ts +2 -2
  57. package/helpers/page-layout-check.d.ts +4 -1
  58. package/helpers/page-layout-check.js +26 -0
  59. package/helpers/record-fields.d.ts +9 -0
  60. package/helpers/record-fields.js +84 -0
  61. package/helpers/surface-presets.d.ts +6 -6
  62. package/helpers/surface-style.d.ts +1 -1
  63. package/helpers.d.ts +0 -1
  64. package/helpers.js +0 -2
  65. package/module-page-check.d.ts +12 -0
  66. package/module-page-check.js +12 -0
  67. package/module-records.d.ts +4 -2
  68. package/module-records.js +3 -1
  69. package/next/antd-form-context-loader.mjs +31 -0
  70. package/next/config.d.mts +2 -0
  71. package/next/config.mjs +36 -3
  72. package/package.json +10 -1
  73. package/plugins/runtime-modules/asset/data-providers.d.ts +0 -65
  74. package/plugins/runtime-modules/asset/data-providers.js +0 -40
  75. package/plugins/runtime-modules/asset/definition.d.ts +0 -60
  76. package/plugins/runtime-modules/asset/ids.d.ts +0 -1
  77. package/plugins/runtime-modules/asset/ids.js +1 -2
  78. package/plugins/runtime-modules/asset/presets.d.ts +1 -0
  79. package/plugins/runtime-modules/asset/server.js +0 -5
  80. package/plugins/runtime-modules/blog/presets.d.ts +1 -0
  81. package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +4 -1
  82. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +13 -4
  83. package/plugins/runtime-modules/builder/clients/inspector-link-target-field.js +1 -1
  84. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +14 -1
  85. package/plugins/runtime-modules/builder/clients/inspector-signal-section.js +2 -2
  86. package/plugins/runtime-modules/builder/clients/layout-inspector.js +1 -1
  87. package/plugins/runtime-modules/builder/clients/layout-scaffold-buttons.js +4 -4
  88. package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +1 -1
  89. package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
  90. package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
  91. package/plugins/runtime-modules/builder/clients/shells-workspace.js +1 -1
  92. package/plugins/runtime-modules/builder/clients/structure-canvas.js +2 -2
  93. package/plugins/runtime-modules/builder/clients/widget-effects-editor.js +1 -1
  94. package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +4 -1
  95. package/plugins/runtime-modules/builder/clients/widget-inspector.js +3 -2
  96. package/plugins/runtime-modules/builder/page-presets.server.d.ts +6 -0
  97. package/plugins/runtime-modules/builder/page-presets.server.js +8 -0
  98. package/plugins/runtime-modules/builder/pages-workspace.js +12 -1
  99. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +5 -5
  100. package/plugins/runtime-modules/builder/structure-dnd.js +2 -2
  101. package/plugins/runtime-modules/builder/widgets/test-block/client.js +1 -1
  102. package/plugins/runtime-modules/content-entry-routes.d.ts +1 -0
  103. package/plugins/runtime-modules/contracts.d.ts +1 -1
  104. package/plugins/runtime-modules/contracts.js +41 -1
  105. package/plugins/runtime-modules/core/data-providers.d.ts +60 -0
  106. package/plugins/runtime-modules/core/data-providers.js +41 -0
  107. package/plugins/runtime-modules/core/definition.d.ts +55 -0
  108. package/plugins/runtime-modules/core/server.js +5 -0
  109. package/plugins/runtime-modules/core/widgets/button/config.d.ts +34 -0
  110. package/plugins/runtime-modules/core/widgets/button/config.js +16 -0
  111. package/plugins/runtime-modules/core/widgets/button/plugin.js +37 -6
  112. package/plugins/runtime-modules/core/widgets/card/config.d.ts +13 -2
  113. package/plugins/runtime-modules/core/widgets/description/config.d.ts +13 -2
  114. package/plugins/runtime-modules/core/widgets/description/editor.js +13 -13
  115. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +11 -0
  116. package/plugins/runtime-modules/core/widgets/gallery/client.d.ts +4 -1
  117. package/plugins/runtime-modules/core/widgets/gallery/client.js +29 -21
  118. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +16 -0
  119. package/plugins/runtime-modules/core/widgets/gallery/config.js +16 -0
  120. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
  121. package/plugins/runtime-modules/core/widgets/gallery/server.js +11 -0
  122. package/plugins/runtime-modules/core/widgets/image/config.d.ts +35 -0
  123. package/plugins/runtime-modules/core/widgets/image/config.js +8 -0
  124. package/plugins/runtime-modules/core/widgets/image/plugin.js +19 -1
  125. package/plugins/runtime-modules/core/widgets/image/server.d.ts +3 -1
  126. package/plugins/runtime-modules/core/widgets/image/server.js +2 -2
  127. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +13 -0
  128. package/plugins/runtime-modules/core/widgets/markdown/config.js +8 -0
  129. package/plugins/runtime-modules/core/widgets/markdown/editor.js +7 -7
  130. package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
  131. package/plugins/runtime-modules/core/widgets/record/authoring.js +1 -1
  132. package/plugins/runtime-modules/core/widgets/result/config.d.ts +11 -0
  133. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +13 -0
  134. package/plugins/runtime-modules/core/widgets/simple-text/config.js +9 -0
  135. package/plugins/runtime-modules/core/widgets/simple-text/editor.js +1 -1
  136. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +14 -1
  137. package/plugins/runtime-modules/core/widgets/spacer/client.js +1 -1
  138. package/plugins/runtime-modules/core/widgets/table/config.d.ts +37 -0
  139. package/plugins/runtime-modules/descriptor-compiler.js +8 -0
  140. package/plugins/runtime-modules/editor/presets.d.ts +1 -0
  141. package/plugins/runtime-modules/groups/definition.d.ts +1 -1
  142. package/plugins/runtime-modules/localization/presets.d.ts +1 -0
  143. package/plugins/runtime-modules/news/presets.d.ts +1 -0
  144. package/plugins/runtime-modules/resolver.js +2 -0
  145. package/plugins/runtime-modules/revisions/presets.d.ts +1 -0
  146. package/plugins/runtime-modules/theme/presets.d.ts +1 -0
  147. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +25 -2
  148. package/server-helpers/cms-page-record.d.ts +26 -0
  149. package/server-helpers/cms-page-record.js +42 -0
  150. package/server-helpers/cms-request.js +48 -4
  151. package/server-helpers/record-fields.d.ts +62 -0
  152. package/server-helpers/record-fields.js +87 -0
  153. package/server-helpers/record-samples.d.ts +21 -0
  154. package/server-helpers/record-samples.js +41 -0
  155. package/styles/builder-scaffold.css +19 -19
  156. package/styles/controls.css +109 -109
  157. package/styles/gradients.css +23 -23
  158. package/styles/layout-affordances.css +15 -15
  159. package/styles/layout-authoring-scaffold.css +20 -20
  160. package/styles/layout.css +9 -9
  161. package/styles/root.css +4 -4
  162. package/styles/shell.css +48 -17
  163. package/theme/antd-css-var-contract.d.ts +86 -80
  164. package/theme/antd-css-var-contract.js +92 -81
  165. package/theme/phi-control-shape.d.ts +1 -1
  166. package/theme/phi-theme-gradients.d.ts +2 -2
  167. package/theme/phi-theme-gradients.js +14 -14
  168. package/theme/phi-theme-palette.d.ts +1 -1
  169. package/theme/phi-theme-palette.js +2 -2
  170. package/theme/phi-theme-tokens.d.ts +8 -5
  171. package/theme/phi-theme-tokens.js +59 -28
  172. package/theme/phi-theme.d.ts +14 -2
  173. package/theme/phi-theme.js +14 -1
  174. package/theme/phi-tokens.d.ts +5 -0
  175. package/theme/phi-tokens.js +9 -0
  176. package/types/cms-module-descriptors.d.ts +6 -0
  177. package/types/cms-plugins.d.ts +19 -1
  178. package/types/core-widget-placements.d.ts +10 -0
  179. package/types/record-provider.d.ts +92 -0
  180. package/types/widget-runtime.d.ts +5 -0
  181. /package/plugins/runtime-modules/{asset/services/folder-images.server.d.ts → core/services/media-folder-images.server.d.ts} +0 -0
  182. /package/plugins/runtime-modules/{asset/services/folder-images.server.js → core/services/media-folder-images.server.js} +0 -0
@@ -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" };
@@ -20,6 +20,8 @@ export type PhiCmsImageWidgetConfig = PhiCmsWidgetConfigBase & PhiMediaImageSour
20
20
  borderBottomLeftRadius?: number | string;
21
21
  borderBottomRightRadius?: number | string;
22
22
  mask?: PhiMaskConfig;
23
+ /** A picture field of the page record to show instead of the Widget's own picture. */
24
+ recordField?: string;
23
25
  };
24
26
  export declare function normalizePhiImageWidgetConfig(config: unknown): PhiCmsImageWidgetConfig;
25
27
  declare function parsePhiCmsImageWidgetConfig(config: Record<string, unknown>): PhiCmsImageWidgetConfig;
@@ -34,6 +36,23 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
34
36
  icon: string;
35
37
  iconFamily: string;
36
38
  fields: ({
39
+ key: string;
40
+ type: "record-field";
41
+ label: string;
42
+ description: string;
43
+ kinds: "picture"[];
44
+ options?: undefined;
45
+ visibleWhen?: undefined;
46
+ valueType?: undefined;
47
+ emptyOption?: undefined;
48
+ emptyValue?: undefined;
49
+ widthPlaceholder?: undefined;
50
+ heightPlaceholder?: undefined;
51
+ topLeftKey?: undefined;
52
+ topRightKey?: undefined;
53
+ bottomLeftKey?: undefined;
54
+ bottomRightKey?: undefined;
55
+ } | {
37
56
  key: string;
38
57
  type: "choice";
39
58
  label: string;
@@ -41,6 +60,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
41
60
  value: string;
42
61
  label: string;
43
62
  }[];
63
+ description?: undefined;
64
+ kinds?: undefined;
44
65
  visibleWhen?: undefined;
45
66
  valueType?: undefined;
46
67
  emptyOption?: undefined;
@@ -59,6 +80,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
59
80
  field: string;
60
81
  equals: string;
61
82
  };
83
+ description?: undefined;
84
+ kinds?: undefined;
62
85
  options?: undefined;
63
86
  valueType?: undefined;
64
87
  emptyOption?: undefined;
@@ -84,6 +107,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
84
107
  field: string;
85
108
  equals: string;
86
109
  };
110
+ description?: undefined;
111
+ kinds?: undefined;
87
112
  widthPlaceholder?: undefined;
88
113
  heightPlaceholder?: undefined;
89
114
  topLeftKey?: undefined;
@@ -98,6 +123,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
98
123
  field: string;
99
124
  equals: string;
100
125
  };
126
+ description?: undefined;
127
+ kinds?: undefined;
101
128
  options?: undefined;
102
129
  valueType?: undefined;
103
130
  emptyOption?: undefined;
@@ -120,6 +147,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
120
147
  value: string;
121
148
  label: string;
122
149
  }[];
150
+ description?: undefined;
151
+ kinds?: undefined;
123
152
  valueType?: undefined;
124
153
  emptyOption?: undefined;
125
154
  emptyValue?: undefined;
@@ -133,6 +162,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
133
162
  key: string;
134
163
  type: "boolean";
135
164
  label: string;
165
+ description?: undefined;
166
+ kinds?: undefined;
136
167
  options?: undefined;
137
168
  visibleWhen?: undefined;
138
169
  valueType?: undefined;
@@ -150,6 +181,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
150
181
  label: string;
151
182
  widthPlaceholder: string;
152
183
  heightPlaceholder: string;
184
+ description?: undefined;
185
+ kinds?: undefined;
153
186
  options?: undefined;
154
187
  visibleWhen?: undefined;
155
188
  valueType?: undefined;
@@ -167,6 +200,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
167
200
  topRightKey: string;
168
201
  bottomLeftKey: string;
169
202
  bottomRightKey: string;
203
+ description?: undefined;
204
+ kinds?: undefined;
170
205
  options?: undefined;
171
206
  visibleWhen?: undefined;
172
207
  valueType?: undefined;
@@ -65,6 +65,7 @@ export function normalizePhiImageWidgetConfig(config) {
65
65
  borderBottomLeftRadius: readCssSize(raw.borderBottomLeftRadius),
66
66
  borderBottomRightRadius: readCssSize(raw.borderBottomRightRadius),
67
67
  mask: readPhiMaskConfig(raw.mask),
68
+ recordField: readString(raw.recordField),
68
69
  };
69
70
  /*
70
71
  * An Asset without a word about its variant gets the Card variant; `null` is a word -- the Inspector's
@@ -99,6 +100,13 @@ export const PHI_IMAGE_WIDGET_DEFINITION = {
99
100
  icon: "antd:picture-outlined",
100
101
  iconFamily: "content",
101
102
  fields: [
103
+ {
104
+ key: "recordField",
105
+ type: "record-field",
106
+ label: "Record field",
107
+ description: "Shows a picture of the record this page is about instead of the picture chosen here, which stands in where the page has no record.",
108
+ kinds: ["picture"],
109
+ },
102
110
  {
103
111
  key: "sourceKind",
104
112
  type: "choice",
@@ -1,9 +1,27 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { definePhiPassiveWidgetRenderers } from "../../../../../plugins/factories/widget-renderers";
3
+ import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
3
4
  import { PhiImageWidgetServer } from "./server";
4
5
  import { PHI_IMAGE_WIDGET_DEFINITION, PHI_IMAGE_WIDGET_PLUGIN_TYPE } from "./config";
6
+ /**
7
+ * A picture field of the page record takes the Widget's own picture's place: by its address, with the
8
+ * record's own words for it, which are in the page's language already. A record without the picture
9
+ * leaves nothing to show; a Page about no record shows the picture chosen in the Widget.
10
+ */
11
+ async function PhiImageWidgetSource({ widget, runtime, registry, config }) {
12
+ const recordField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.recordField, kinds: ["picture"] });
13
+ if (!recordField.bound) {
14
+ return _jsx(PhiImageWidgetServer, { runtime: runtime, widget: widget, config: config });
15
+ }
16
+ if (!recordField.field) {
17
+ return null;
18
+ }
19
+ const { src, alt } = recordField.field.value;
20
+ const { assetId: _assetId, variantKey: _variantKey, variantVersion: _variantVersion, ...presentation } = config;
21
+ return (_jsx(PhiImageWidgetServer, { runtime: runtime, translate: false, config: { ...presentation, sourceKind: "url", sourceUrl: src, alt: alt ?? "", title: undefined } }));
22
+ }
5
23
  export const PHI_IMAGE_WIDGET_PLUGIN = {
6
24
  ...PHI_IMAGE_WIDGET_DEFINITION,
7
- ...definePhiPassiveWidgetRenderers(({ widget, runtime, config }) => (_jsx(PhiImageWidgetServer, { runtime: runtime, widget: widget, config: config }, `widget-${widget.id}`))),
25
+ ...definePhiPassiveWidgetRenderers((args) => _jsx(PhiImageWidgetSource, { ...args }, `widget-${args.widget.id}`)),
8
26
  };
9
27
  export { PHI_IMAGE_WIDGET_PLUGIN_TYPE };
@@ -4,5 +4,7 @@ export type PhiImageWidgetServerProps = {
4
4
  runtime: Pick<PhiBlockRuntime, "locale" | "site">;
5
5
  widget?: PhiCmsContentWidgetNode | null;
6
6
  config?: PhiCmsImageWidgetConfig | null;
7
+ /** False for words that are in the page's language already -- a record's own. Absent, the Widget's flag decides. */
8
+ translate?: boolean;
7
9
  };
8
- export declare function PhiImageWidgetServer({ runtime, widget, config, }: PhiImageWidgetServerProps): Promise<import("react").JSX.Element>;
10
+ export declare function PhiImageWidgetServer({ runtime, widget, config, translate: translateWords, }: PhiImageWidgetServerProps): Promise<import("react").JSX.Element>;
@@ -10,7 +10,7 @@ import { trBulk, trBulkForLocale } from "../../../../../server-helpers/translate
10
10
  async function resolveImageWidgetLabels(runtime) {
11
11
  return getPhiImageWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
12
12
  }
13
- export async function PhiImageWidgetServer({ runtime, widget, config, }) {
13
+ export async function PhiImageWidgetServer({ runtime, widget, config, translate: translateWords, }) {
14
14
  const labels = await resolveImageWidgetLabels(runtime);
15
15
  const assetId = widget?.resolvedContent?.assetId ?? config?.assetId ?? null;
16
16
  const resolvedAsset = config?.sourceKind === "asset" && typeof assetId === "number"
@@ -25,7 +25,7 @@ export async function PhiImageWidgetServer({ runtime, widget, config, }) {
25
25
  * description from the Media library, or what the Widget's config states for an address -- is the Site's
26
26
  * text and goes through the Site's translation, unless the Widget says not to translate.
27
27
  */
28
- const translate = !hasPhiFlag(widget?.flags ?? 0, PhiCmsFlags.NoTranslate);
28
+ const translate = translateWords ?? !hasPhiFlag(widget?.flags ?? 0, PhiCmsFlags.NoTranslate);
29
29
  const sourceTexts = [
30
30
  recordAlt ? "" : (resolvedAsset?.altText ?? "").trim(),
31
31
  recordTitle ? "" : (resolvedAsset?.title ?? "").trim(),
@@ -14,6 +14,8 @@ export type PhiCmsMarkdownWidgetConfig = PhiCmsWidgetConfigBase & {
14
14
  eyebrow?: string;
15
15
  sourceMode?: "inline" | "url";
16
16
  markdown?: string;
17
+ /** A Markdown or text field of the page record to show instead of the Widget's own text. */
18
+ recordField?: string;
17
19
  widgetId?: string | number | null;
18
20
  sourceUrl?: string;
19
21
  sourceLocale?: string;
@@ -159,6 +161,17 @@ export declare const PHI_MARKDOWN_WIDGET_DEFINITION: {
159
161
  editorPlacement?: "inspector" | "geometry" | "toolbar";
160
162
  visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
161
163
  heading?: string;
164
+ } & {
165
+ type: "record-field";
166
+ kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
167
+ }) | ({
168
+ key: string;
169
+ label: string;
170
+ description?: string;
171
+ required?: boolean;
172
+ editorPlacement?: "inspector" | "geometry" | "toolbar";
173
+ visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
174
+ heading?: string;
162
175
  } & {
163
176
  type: "dimension";
164
177
  widthKey?: string;