@phis/ui 0.5.2 → 0.5.4

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 (284) 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-cascader-control.d.ts +9 -1
  6. package/components/controls/phi-cascader-control.js +25 -3
  7. package/components/controls/phi-drawer-control-adapter.js +4 -4
  8. package/components/controls/phi-dropdown-control.js +2 -2
  9. package/components/controls/phi-form-control.js +1 -1
  10. package/components/controls/phi-image-control.js +1 -1
  11. package/components/controls/phi-mask-picker-control.js +6 -6
  12. package/components/controls/phi-money-control.d.ts +39 -0
  13. package/components/controls/phi-money-control.js +34 -0
  14. package/components/controls/phi-number-control.d.ts +6 -1
  15. package/components/controls/phi-number-control.js +3 -3
  16. package/components/controls/phi-options-provider.d.ts +7 -0
  17. package/components/controls/phi-options-provider.js +11 -0
  18. package/components/controls/phi-select-control.js +1 -1
  19. package/components/controls/phi-theme-scope-control.js +1 -1
  20. package/components/controls/use-phi-color-control-presets.js +2 -2
  21. package/components/forms/compound-form-controls.js +2 -2
  22. package/components/forms/extended-form-field-controls.d.ts +1 -0
  23. package/components/forms/extended-form-field-controls.js +24 -2
  24. package/components/forms/form-descriptor-runtime-client.js +13 -0
  25. package/components/forms/form-provider-contract.d.ts +43 -0
  26. package/components/forms/form-provider-contract.js +40 -0
  27. package/components/forms/money-field.d.ts +27 -0
  28. package/components/forms/money-field.js +78 -0
  29. package/components/forms/shared-form-provider-registry.js +6 -2
  30. package/components/layouts/clients/phi-flex-layout-client.js +4 -4
  31. package/components/layouts/clients/phi-grid-layout-client.js +3 -3
  32. package/components/layouts/clients/phi-sequence-slot-editor.js +1 -1
  33. package/components/layouts/layout-definitions.d.ts +4 -4
  34. package/components/layouts/phi-page-region-layout.js +1 -1
  35. package/components/layouts/phi-structure-region-layout.js +3 -3
  36. package/components/media/phi-asset-focal-rect-widget.js +4 -4
  37. package/components/media/phi-asset-inspector-section.js +1 -1
  38. package/components/media/phi-media-kind-icon.js +2 -2
  39. package/components/media/phi-media-picker-binding.js +6 -1
  40. package/components/media/phi-media-restricted-icon.js +1 -1
  41. package/components/media/phi-site-font-assets.js +6 -1
  42. package/components/motion/phi-sequence-run.d.ts +14 -1
  43. package/components/motion/phi-sequence-run.js +22 -3
  44. package/components/motion/phi-sequence-viewport.js +3 -1
  45. package/components/overlays/phi-overlay-container-client.js +1 -1
  46. package/components/regions/presets/content-entry-editor-page-tree.js +3 -1
  47. package/components/regions/presets/phi-base-page-column.js +6 -2
  48. package/components/root/phi-config-provider.js +1 -1
  49. package/components/root/phi-root-background.js +1 -1
  50. package/components/root/phi-root-theme-resolver.js +1 -1
  51. package/components/shell/phi-module-icons.js +1 -1
  52. package/components/tables/client/phi-table-binding.js +16 -3
  53. package/components/trees/client/phi-tree-binding.js +6 -2
  54. package/components/widgets/built-in/builder-workspace-preview.js +8 -8
  55. package/components/widgets/client/bullet-list-entries-editor.js +2 -2
  56. package/components/widgets/client/external-document-editor.js +1 -1
  57. package/components/widgets/client/html-editor.js +3 -3
  58. package/components/widgets/client/shared/phi-collection-view-binding.js +10 -2
  59. package/components/widgets/client/shared/phi-rendered-value.d.ts +9 -1
  60. package/components/widgets/client/shared/phi-rendered-value.js +20 -1
  61. package/components/widgets/config/background.d.ts +1 -1
  62. package/components/widgets/config/background.js +1 -1
  63. package/components/widgets/config/choice-shared.d.ts +2 -2
  64. package/components/widgets/inspector-field-row.js +1 -1
  65. package/components/widgets/label-sets/gallery.js +6 -0
  66. package/components/widgets/label-sets/inspector.js +2 -0
  67. package/components/widgets/label-sets/interval.d.ts +4 -0
  68. package/components/widgets/label-sets/interval.js +31 -0
  69. package/components/widgets/label-sets/record.js +6 -1
  70. package/components/widgets/label-sets/slot-upload.d.ts +4 -0
  71. package/components/widgets/label-sets/slot-upload.js +36 -0
  72. package/components/widgets/label-sets/table.js +6 -1
  73. package/components/widgets/label-types/gallery.d.ts +7 -0
  74. package/components/widgets/label-types/gallery.js +6 -0
  75. package/components/widgets/label-types/inspector.d.ts +1 -0
  76. package/components/widgets/label-types/inspector.js +1 -0
  77. package/components/widgets/label-types/interval.d.ts +16 -0
  78. package/components/widgets/label-types/interval.js +21 -0
  79. package/components/widgets/label-types/record.d.ts +3 -0
  80. package/components/widgets/label-types/record.js +2 -0
  81. package/components/widgets/label-types/slot-upload.d.ts +24 -0
  82. package/components/widgets/label-types/slot-upload.js +16 -0
  83. package/components/widgets/label-types/table.d.ts +3 -0
  84. package/components/widgets/label-types/table.js +2 -0
  85. package/components/widgets/shared/card-body-client.js +1 -1
  86. package/components/widgets/shared/result-body-client.js +1 -1
  87. package/constants/media-library-provider-keys.d.ts +8 -1
  88. package/constants/media-library-provider-keys.js +8 -1
  89. package/constants/record-field-kinds.d.ts +6 -0
  90. package/constants/record-field-kinds.js +7 -0
  91. package/constants/runtime-module-ownership.js +2 -1
  92. package/controls.d.ts +7 -0
  93. package/controls.js +4 -0
  94. package/helpers/border-widget-style.d.ts +2 -2
  95. package/helpers/border-widget-style.js +2 -2
  96. package/helpers/cms-dialog.d.ts +43 -7
  97. package/helpers/cms-dialog.js +46 -4
  98. package/helpers/cms-layout-defaults.d.ts +2 -2
  99. package/helpers/cms-page-catalog.d.ts +13 -0
  100. package/helpers/cms-page-catalog.js +18 -2
  101. package/helpers/cms-preset-nodes.d.ts +13 -3
  102. package/helpers/cms-preset-nodes.js +3 -2
  103. package/helpers/cms-preset-page-tree.d.ts +4 -0
  104. package/helpers/cms-preset-page-tree.js +2 -0
  105. package/helpers/layout-style.d.ts +2 -2
  106. package/helpers/money-amount.d.ts +48 -0
  107. package/helpers/money-amount.js +131 -0
  108. package/helpers/page-layout-check.d.ts +4 -1
  109. package/helpers/page-layout-check.js +41 -2
  110. package/helpers/record-fields.d.ts +22 -0
  111. package/helpers/record-fields.js +109 -0
  112. package/helpers/surface-presets.d.ts +6 -6
  113. package/helpers/surface-style.d.ts +1 -1
  114. package/helpers.d.ts +0 -1
  115. package/helpers.js +0 -2
  116. package/module-page-check.d.ts +12 -0
  117. package/module-page-check.js +12 -0
  118. package/module-records.d.ts +7 -2
  119. package/module-records.js +5 -1
  120. package/next/antd-form-context-loader.mjs +31 -0
  121. package/next/config.d.mts +2 -0
  122. package/next/config.mjs +36 -3
  123. package/package.json +11 -2
  124. package/plugins/runtime-modules/accounting/module.d.ts +1 -1
  125. package/plugins/runtime-modules/app/module.d.ts +1 -1
  126. package/plugins/runtime-modules/asset/data-providers.d.ts +0 -65
  127. package/plugins/runtime-modules/asset/data-providers.js +0 -40
  128. package/plugins/runtime-modules/asset/definition.d.ts +0 -60
  129. package/plugins/runtime-modules/asset/ids.d.ts +0 -1
  130. package/plugins/runtime-modules/asset/ids.js +1 -2
  131. package/plugins/runtime-modules/asset/presets.d.ts +1 -0
  132. package/plugins/runtime-modules/asset/server.js +0 -5
  133. package/plugins/runtime-modules/asset/services/collection.js +1 -0
  134. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -2
  135. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +3 -0
  136. package/plugins/runtime-modules/blog/presets.d.ts +1 -0
  137. package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +4 -1
  138. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +13 -4
  139. package/plugins/runtime-modules/builder/clients/inspector-link-target-field.js +1 -1
  140. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +14 -1
  141. package/plugins/runtime-modules/builder/clients/inspector-signal-section.js +2 -2
  142. package/plugins/runtime-modules/builder/clients/layout-inspector.js +1 -1
  143. package/plugins/runtime-modules/builder/clients/layout-scaffold-buttons.js +4 -4
  144. package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +1 -1
  145. package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
  146. package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
  147. package/plugins/runtime-modules/builder/clients/shells-workspace.js +1 -1
  148. package/plugins/runtime-modules/builder/clients/structure-canvas.js +2 -2
  149. package/plugins/runtime-modules/builder/clients/widget-effects-editor.js +1 -1
  150. package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +4 -1
  151. package/plugins/runtime-modules/builder/clients/widget-inspector.js +3 -2
  152. package/plugins/runtime-modules/builder/offered-page-catalog.js +3 -3
  153. package/plugins/runtime-modules/builder/options-providers.js +7 -0
  154. package/plugins/runtime-modules/builder/page-presets.server.d.ts +6 -0
  155. package/plugins/runtime-modules/builder/page-presets.server.js +8 -0
  156. package/plugins/runtime-modules/builder/pages-workspace.js +12 -1
  157. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +5 -5
  158. package/plugins/runtime-modules/builder/structure-dnd.js +2 -2
  159. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -3
  160. package/plugins/runtime-modules/builder/widgets/test-block/client.js +1 -1
  161. package/plugins/runtime-modules/content-entry-routes.d.ts +1 -0
  162. package/plugins/runtime-modules/contracts.js +41 -1
  163. package/plugins/runtime-modules/core/data-providers.d.ts +60 -0
  164. package/plugins/runtime-modules/core/data-providers.js +41 -0
  165. package/plugins/runtime-modules/core/definition.d.ts +98 -0
  166. package/plugins/runtime-modules/core/form-providers.d.ts +43 -0
  167. package/plugins/runtime-modules/core/server.js +5 -0
  168. package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +6 -3
  169. package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +6 -5
  170. package/plugins/runtime-modules/core/widgets/breadcrumb/plugin.js +1 -1
  171. package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +9 -1
  172. package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +29 -3
  173. package/plugins/runtime-modules/core/widgets/button/config.d.ts +34 -0
  174. package/plugins/runtime-modules/core/widgets/button/config.js +16 -0
  175. package/plugins/runtime-modules/core/widgets/button/plugin.js +37 -6
  176. package/plugins/runtime-modules/core/widgets/card/config.d.ts +13 -2
  177. package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +3 -3
  178. package/plugins/runtime-modules/core/widgets/cascader/client.js +1 -1
  179. package/plugins/runtime-modules/core/widgets/cascader/config.d.ts +8 -2
  180. package/plugins/runtime-modules/core/widgets/cascader/config.js +22 -0
  181. package/plugins/runtime-modules/core/widgets/checkbox-group/config.d.ts +1 -1
  182. package/plugins/runtime-modules/core/widgets/description/config.d.ts +13 -2
  183. package/plugins/runtime-modules/core/widgets/description/editor.js +13 -13
  184. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +11 -0
  185. package/plugins/runtime-modules/core/widgets/gallery/authoring.js +12 -3
  186. package/plugins/runtime-modules/core/widgets/gallery/client.d.ts +4 -1
  187. package/plugins/runtime-modules/core/widgets/gallery/client.js +38 -21
  188. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +18 -0
  189. package/plugins/runtime-modules/core/widgets/gallery/config.js +24 -0
  190. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
  191. package/plugins/runtime-modules/core/widgets/gallery/server.js +11 -0
  192. package/plugins/runtime-modules/core/widgets/image/config.d.ts +35 -0
  193. package/plugins/runtime-modules/core/widgets/image/config.js +8 -0
  194. package/plugins/runtime-modules/core/widgets/image/plugin.js +19 -1
  195. package/plugins/runtime-modules/core/widgets/image/server.d.ts +3 -1
  196. package/plugins/runtime-modules/core/widgets/image/server.js +2 -2
  197. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +13 -0
  198. package/plugins/runtime-modules/core/widgets/markdown/config.js +8 -0
  199. package/plugins/runtime-modules/core/widgets/markdown/editor.js +7 -7
  200. package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
  201. package/plugins/runtime-modules/core/widgets/multi-select/config.d.ts +1 -1
  202. package/plugins/runtime-modules/core/widgets/record/authoring.js +1 -1
  203. package/plugins/runtime-modules/core/widgets/record/client.js +8 -2
  204. package/plugins/runtime-modules/core/widgets/record/config.js +4 -0
  205. package/plugins/runtime-modules/core/widgets/result/config.d.ts +11 -0
  206. package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +1 -1
  207. package/plugins/runtime-modules/core/widgets/select-box/config.d.ts +1 -1
  208. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +13 -0
  209. package/plugins/runtime-modules/core/widgets/simple-text/config.js +9 -0
  210. package/plugins/runtime-modules/core/widgets/simple-text/editor.js +1 -1
  211. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +14 -1
  212. package/plugins/runtime-modules/core/widgets/slot-upload/authoring.js +2 -1
  213. package/plugins/runtime-modules/core/widgets/slot-upload/client.d.ts +3 -1
  214. package/plugins/runtime-modules/core/widgets/slot-upload/client.js +45 -24
  215. package/plugins/runtime-modules/core/widgets/slot-upload/config.d.ts +12 -4
  216. package/plugins/runtime-modules/core/widgets/slot-upload/config.js +18 -1
  217. package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +4 -2
  218. package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +9 -3
  219. package/plugins/runtime-modules/core/widgets/slot-upload/server.js +17 -3
  220. package/plugins/runtime-modules/core/widgets/spacer/client.js +1 -1
  221. package/plugins/runtime-modules/core/widgets/steps/config.d.ts +1 -1
  222. package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
  223. package/plugins/runtime-modules/core/widgets/table/config.d.ts +37 -0
  224. package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
  225. package/plugins/runtime-modules/descriptor-compiler.d.ts +11 -1
  226. package/plugins/runtime-modules/descriptor-compiler.js +57 -8
  227. package/plugins/runtime-modules/editor/presets.d.ts +1 -0
  228. package/plugins/runtime-modules/groups/definition.d.ts +1 -1
  229. package/plugins/runtime-modules/groups/forms.d.ts +18 -0
  230. package/plugins/runtime-modules/groups/forms.js +2 -2
  231. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +6 -4
  232. package/plugins/runtime-modules/localization/presets.d.ts +1 -0
  233. package/plugins/runtime-modules/news/presets.d.ts +1 -0
  234. package/plugins/runtime-modules/public/module.d.ts +1 -1
  235. package/plugins/runtime-modules/resolver.js +7 -0
  236. package/plugins/runtime-modules/revisions/presets.d.ts +1 -0
  237. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
  238. package/plugins/runtime-modules/theme/presets.d.ts +1 -0
  239. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +25 -2
  240. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +4 -2
  241. package/plugins/runtime-modules/user-management/controller/client.js +6 -1
  242. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +3 -3
  243. package/runtime-render-client.d.ts +1 -1
  244. package/runtime-render-client.js +2 -1
  245. package/server-helpers/cms-page-record.d.ts +26 -0
  246. package/server-helpers/cms-page-record.js +52 -0
  247. package/server-helpers/cms-request.js +48 -4
  248. package/server-helpers/record-fields.d.ts +62 -0
  249. package/server-helpers/record-fields.js +86 -0
  250. package/server-helpers/record-samples.d.ts +21 -0
  251. package/server-helpers/record-samples.js +49 -0
  252. package/styles/builder-scaffold.css +19 -19
  253. package/styles/controls.css +109 -109
  254. package/styles/gradients.css +23 -23
  255. package/styles/layout-affordances.css +15 -15
  256. package/styles/layout-authoring-scaffold.css +20 -20
  257. package/styles/layout.css +9 -9
  258. package/styles/root.css +4 -4
  259. package/styles/shell.css +48 -17
  260. package/theme/antd-css-var-contract.d.ts +86 -80
  261. package/theme/antd-css-var-contract.js +92 -81
  262. package/theme/phi-control-shape.d.ts +1 -1
  263. package/theme/phi-theme-gradients.d.ts +2 -2
  264. package/theme/phi-theme-gradients.js +14 -14
  265. package/theme/phi-theme-palette.d.ts +1 -1
  266. package/theme/phi-theme-palette.js +2 -2
  267. package/theme/phi-theme-tokens.d.ts +8 -5
  268. package/theme/phi-theme-tokens.js +59 -28
  269. package/theme/phi-theme.d.ts +14 -2
  270. package/theme/phi-theme.js +14 -1
  271. package/theme/phi-tokens.d.ts +5 -0
  272. package/theme/phi-tokens.js +9 -0
  273. package/types/cms-module-descriptors.d.ts +9 -0
  274. package/types/cms-plugins.d.ts +27 -1
  275. package/types/collection-provider.d.ts +7 -0
  276. package/types/core-widget-placements.d.ts +42 -0
  277. package/types/record-provider.d.ts +109 -1
  278. package/types/table-widget.d.ts +33 -1
  279. package/types/table-widget.js +1 -0
  280. package/types/tree-widget.d.ts +7 -0
  281. package/types/widget-runtime.d.ts +5 -0
  282. package/types.d.ts +1 -0
  283. /package/plugins/runtime-modules/{asset/services/folder-images.server.d.ts → core/services/media-folder-images.server.d.ts} +0 -0
  284. /package/plugins/runtime-modules/{asset/services/folder-images.server.js → core/services/media-folder-images.server.js} +0 -0
@@ -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("../../../../../module-records").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("../../../../../module-records").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;
@@ -8,6 +8,7 @@ import { PHI_GALLERY_WIDGET_DEFINITION, } from "./config";
8
8
  import { resolvePhiSpacingScaleValue } from "../../../../../components/widgets/config/spacing-options";
9
9
  import { PHI_SEQUENCE_SETTINGS_DEFAULTS } from "../../../../../components/widgets/config/sequence-settings";
10
10
  import { resolvePhiGalleryFrame } from "./defaults";
11
+ import { formatPhiGalleryWidgetLabel, PHI_GALLERY_WIDGET_DEFAULT_LABELS, } from "../../../../../components/widgets/label-types/gallery";
11
12
  /** How many dots stand for "more than one page" on the canvas, which does not know how many pictures there are. */
12
13
  const EDITOR_DOT_COUNT = 3;
13
14
  /**
@@ -27,6 +28,16 @@ function PhiGalleryWidgetEditor({ config }) {
27
28
  const showDots = controls === "dots" || controls === "both";
28
29
  const folderId = config?.source?.params?.folderId;
29
30
  const hasFolder = folderId != null && folderId !== "";
31
+ const recordField = config?.recordField;
32
+ /*
33
+ * Where a field of the page record is named, the pictures are that field's and the Folder only stands
34
+ * in on a Page about no record; saying "no folder chosen" there sent the author looking for a setting
35
+ * that decides nothing.
36
+ */
37
+ const labels = PHI_GALLERY_WIDGET_DEFAULT_LABELS;
38
+ const hint = recordField
39
+ ? formatPhiGalleryWidgetLabel(labels.canvasRecordField, recordField)
40
+ : hasFolder ? labels.canvasFolder : labels.canvasNoFolder;
30
41
  const { aspectRatio } = resolvePhiGalleryFrame(config);
31
42
  const arrowStyle = {
32
43
  position: "absolute",
@@ -63,8 +74,6 @@ function PhiGalleryWidgetEditor({ config }) {
63
74
  height: token.marginXS,
64
75
  borderRadius: token.borderRadiusSM,
65
76
  background: page === 0 ? token.colorPrimary : token.colorFill,
66
- } }, page))) })) : null, _jsx(PhiTypographyControl, { type: "secondary", style: { fontSize: token.fontSizeSM }, children: hasFolder
67
- ? "The public pictures of the chosen media folder, read when the page is drawn."
68
- : "No folder chosen yet. Pick one in the inspector; its public pictures are read when the page is drawn." })] }));
77
+ } }, page))) })) : null, _jsx(PhiTypographyControl, { type: "secondary", style: { fontSize: token.fontSizeSM }, children: hint })] }));
69
78
  }
70
79
  export const PHI_GALLERY_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(PHI_GALLERY_WIDGET_DEFINITION, ({ config }) => _jsx(PhiGalleryWidgetEditor, { config: config ?? undefined }));
@@ -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,31 @@ 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
+ /** A thumbnail's width in pixels: also what the optimiser is told to size it for. */
12
+ const PHI_GALLERY_THUMBNAIL_WIDTH = 80;
13
+ function GalleryPicture({ item, variantKey, fit, preview, sizes, aspectRatio, }) {
14
+ // The frame's proportion is known, so the crop can keep the whole focal rectangle in view.
15
+ const frameAspectRatio = readPhiAspectRatio(aspectRatio);
16
+ const presentation = item.kind === "asset"
17
+ ? resolvePhiImagePresentation({
18
+ sourceKind: "asset",
19
+ assetId: item.image.id,
20
+ variantKey,
21
+ variantVersion: item.image.variantVersion,
22
+ deliveryRevision: item.image.deliveryRevision,
23
+ originalUrl: item.image.deliveryUrl,
24
+ focalRect: item.image.focalRect,
25
+ fit,
26
+ sourceWidth: item.image.width,
27
+ sourceHeight: item.image.height,
28
+ frameAspectRatio,
29
+ })
30
+ // A picture of a record has no rendition and no focal rectangle: its address, in the frame.
31
+ : resolvePhiImagePresentation({ sourceKind: "url", sourceUrl: item.picture.src, fit, frameAspectRatio });
26
32
  // 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);
33
+ const optimizable = item.kind === "asset"
34
+ ? presentation.kind === "generated-variant" || !isPhiMediaSvgContentType(item.image.contentType)
35
+ : false;
28
36
  /*
29
37
  * The frame is a block of its own inside the track item, not the item itself. A flex item that is
30
38
  * stretched (`alignItems: stretch` on the track) has no height of its own for an aspect ratio to
@@ -33,23 +41,32 @@ function GalleryPicture({ image, variantKey, fit, preview, sizes, aspectRatio, }
33
41
  * definite box everywhere, and the picture fills it from the corners rather than through a chain
34
42
  * of percentage heights.
35
43
  */
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,
44
+ 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
45
  // Unconditionally eager, and that is the whole mechanism: nothing outside the window and its
38
46
  // lookahead is mounted, so reaching this line already means the picture is wanted.
39
47
  loading: "eager", preview: preview, style: { position: "absolute", inset: 0, width: "100%", height: "100%" }, imageStyle: { width: "100%", height: "100%" } }) }));
40
48
  }
41
- export function PhiGalleryWidget({ config, images: imagesInput, labels: labelsInput }) {
49
+ export function PhiGalleryWidget({ config, images: imagesInput, pictures, labels: labelsInput }) {
42
50
  const { token } = usePhiConfig();
43
51
  const labels = labelsInput ?? PHI_GALLERY_WIDGET_DEFAULT_LABELS;
44
- const images = useMemo(() => imagesInput ?? [], [imagesInput]);
45
- const span = resolvePhiSequenceRunSpan(config?.visibleCount, images.length);
52
+ const items = useMemo(() => pictures
53
+ ? pictures.map((picture, index) => ({ kind: "url", key: `${index}:${picture.src}`, picture }))
54
+ : (imagesInput ?? []).map((image) => ({ kind: "asset", key: String(image.id), image })), [imagesInput, pictures]);
55
+ const span = resolvePhiSequenceRunSpan(config?.visibleCount, items.length);
46
56
  // What a picture of this window is worth of the viewport, for the optimiser's choice of rendition.
47
57
  const sizes = span === 1 ? "100vw" : `(max-width: 768px) 100vw, ${Math.ceil(100 / span)}vw`;
48
58
  const { aspectRatio, fit } = resolvePhiGalleryFrame(config);
59
+ const thumbnails = config?.thumbnails === true
60
+ ? items.map((item) => ({
61
+ key: item.key,
62
+ label: (item.kind === "asset" ? item.image.altText : item.picture.alt) ?? "",
63
+ content: (_jsx(GalleryPicture, { item: item, variantKey: config?.variantKey, fit: fit, preview: false, sizes: `${PHI_GALLERY_THUMBNAIL_WIDTH}px`, aspectRatio: aspectRatio })),
64
+ }))
65
+ : undefined;
49
66
  const frameStyle = {
50
67
  minWidth: 0,
51
68
  borderRadius: token.borderRadius,
52
69
  overflow: "hidden",
53
70
  };
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 }));
71
+ 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, thumbnails: thumbnails, thumbnailWidth: PHI_GALLERY_THUMBNAIL_WIDTH }));
55
72
  }
@@ -15,10 +15,17 @@ 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. */
21
26
  preview?: boolean;
27
+ /** A row of small pictures under the main one; acts only while one picture is visible. Absent is off. */
28
+ thumbnails?: boolean;
22
29
  /** The frame's proportion for originals; a variant brings its own. */
23
30
  aspectRatio?: PhiMediaAspectRatio;
24
31
  fit?: "cover" | "contain";
@@ -107,6 +114,17 @@ export declare const PHI_GALLERY_WIDGET_DEFINITION: {
107
114
  editorPlacement?: "inspector" | "geometry" | "toolbar";
108
115
  visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
109
116
  heading?: string;
117
+ } & {
118
+ type: "record-field";
119
+ kinds: readonly import("../../../../../module-records").PhiRecordFieldKind[];
120
+ }) | ({
121
+ key: string;
122
+ label: string;
123
+ description?: string;
124
+ required?: boolean;
125
+ editorPlacement?: "inspector" | "geometry" | "toolbar";
126
+ visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
127
+ heading?: string;
110
128
  } & {
111
129
  type: "dimension";
112
130
  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,12 +60,16 @@ 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 thumbnails = readFlag(raw.thumbnails, "thumbnails");
64
+ const recordField = readRecordField(raw.recordField);
56
65
  return {
57
66
  ...readRenderableBlockConfig(raw),
58
67
  ...readPhiSequenceSettings(raw, fail),
59
68
  source: readFolderSource(raw.source),
69
+ ...(recordField === undefined ? {} : { recordField }),
60
70
  ...(variantKey === undefined ? {} : { variantKey }),
61
71
  ...(preview === undefined ? {} : { preview }),
72
+ ...(thumbnails === undefined ? {} : { thumbnails }),
62
73
  ...(aspectRatio === undefined ? {} : { aspectRatio }),
63
74
  ...(fit === undefined ? {} : { fit }),
64
75
  };
@@ -84,6 +95,13 @@ export const PHI_GALLERY_WIDGET_DEFINITION = {
84
95
  providerKey: PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.folderImages,
85
96
  label: "Source",
86
97
  },
98
+ {
99
+ key: "recordField",
100
+ type: "record-field",
101
+ label: "Pictures from record",
102
+ description: "Shows the pictures of a field of the record this page is about, instead of the Folder's.",
103
+ kinds: ["pictures"],
104
+ },
87
105
  {
88
106
  key: "variantKey",
89
107
  type: "choice",
@@ -121,6 +139,12 @@ export const PHI_GALLERY_WIDGET_DEFINITION = {
121
139
  ...PHI_GALLERY_SEQUENCE_FIELDS.window,
122
140
  ...PHI_GALLERY_SEQUENCE_FIELDS.movement,
123
141
  ...PHI_GALLERY_SEQUENCE_FIELDS.controls,
142
+ {
143
+ key: "thumbnails",
144
+ type: "boolean",
145
+ label: "Thumbnails",
146
+ description: "A row of small pictures under the main one, in place of the dots. Acts only while one picture is shown at a time.",
147
+ },
124
148
  ],
125
149
  /*
126
150
  * Bound to the Folder Provider from the start, so the inspector asks for a folder and nothing else.
@@ -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" | "recordDeclarationsByKey">;
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("../../../../../module-records").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;
@@ -47,6 +47,7 @@ export function parsePhiCmsMarkdownWidgetConfig(config) {
47
47
  sourceMode: readMarkdownSourceMode(config.sourceMode) ?? (sourceUrl ? "url" : "inline"),
48
48
  widgetId: typeof config.widgetId === "number" || typeof config.widgetId === "string" ? config.widgetId : undefined,
49
49
  markdown: readString(config.markdown),
50
+ recordField: readString(config.recordField),
50
51
  sourceUrl,
51
52
  sourceLocale: readString(config.sourceLocale),
52
53
  revalidateSeconds: readNumber(config.revalidateSeconds),
@@ -117,6 +118,13 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
117
118
  ],
118
119
  },
119
120
  { key: "sourceUrl", type: "url", label: "Source URL", visibleWhen: { field: "sourceMode", equals: "url" } },
121
+ {
122
+ key: "recordField",
123
+ type: "record-field",
124
+ label: "Record field",
125
+ description: "Shows a field of the record this page is about instead of the text. The text stands in where the page has no record.",
126
+ kinds: ["markdown", "text"],
127
+ },
120
128
  {
121
129
  key: "sourceLocale",
122
130
  type: "string",