@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
@@ -81,6 +81,13 @@ export type PhiCollectionProviderQueryRequest = {
81
81
  resourceKey: string;
82
82
  query: PhiCollectionProviderQuery;
83
83
  params?: Record<string, unknown>;
84
+ /**
85
+ * The reader's language and the Site's time zone (`usePhiIntlLocale`, `usePhiIntlTimeZone`), filled by
86
+ * the binding, for a Provider that writes words, amounts or dates into what it answers. Part of the
87
+ * binding's load key: a live language switch asks again.
88
+ */
89
+ locale: string;
90
+ timeZone: string;
84
91
  signal: AbortSignal;
85
92
  };
86
93
  export type PhiCollectionProviderActionRequest = {
@@ -16,6 +16,9 @@ import type { PhiMediaImageSourceConfig } from "./media";
16
16
  import type { PhiViewerAccessPolicy } from "./access";
17
17
  import type { PhiWidgetFontFamilyKey, PhiWidgetFontSizeKey } from "./site-theme";
18
18
  import type { PhiTableQuery, PhiTableWidgetConfig, PhiTableWidgetFeatures, PhiTableWidgetPresentation } from "./table-widget";
19
+ import type { PhiRecordWidgetConfig, PhiRecordWidgetPresentation } from "./record-widget";
20
+ import type { PhiChoiceOptionsConfig, PhiChoiceValueMode } from "../components/widgets/config/choice-shared";
21
+ import type { PhiCmsTabBarWidgetConfig } from "../components/widgets/config/stack-tabs";
19
22
  import type { PhiButtonVariant } from "../components/widgets/config/button-variant";
20
23
  import type { PhiThemeGradientKey } from "../theme/phi-theme-gradients";
21
24
  import type { PhiTextTone } from "../components/widgets/config/text-tone";
@@ -53,6 +56,8 @@ export type PhiMarkdownWidgetPlacement = PhiWidgetPlacementBase & {
53
56
  eyebrow?: string;
54
57
  sourceMode?: "inline" | "url";
55
58
  markdown?: string;
59
+ /** A Markdown or text field of the page record shown instead of the Widget's own text. */
60
+ recordField?: string;
56
61
  sourceUrl?: string;
57
62
  sourceLocale?: string;
58
63
  revalidateSeconds?: number;
@@ -90,6 +95,8 @@ export type PhiSimpleTextWidgetPlacement = PhiWidgetPlacementBase & {
90
95
  disabled?: boolean;
91
96
  /** `"preset"` while the words are a Preset's (`helpers/text-source.ts`). */
92
97
  textSource?: PhiTextSource;
98
+ /** A text, number or date field of the page record shown instead of the Widget's own text. */
99
+ recordField?: string;
93
100
  };
94
101
  export type PhiDescriptionWidgetPlacement = PhiWidgetPlacementBase & {
95
102
  eyebrow?: string;
@@ -114,6 +121,10 @@ export type PhiButtonWidgetPlacement = PhiWidgetPlacementBase & PhiControlPlacem
114
121
  gradient?: PhiThemeGradientKey;
115
122
  linkTarget?: PhiLinkTarget;
116
123
  danger?: boolean;
124
+ /** A text field of the page record sent as the signal value instead of `value`. */
125
+ valueRecordField?: string;
126
+ /** A link field of the page record the Button leads to instead of `linkTarget`. */
127
+ linkRecordField?: string;
117
128
  };
118
129
  export type PhiImageWidgetPreviewMode = "none" | "native" | "lightbox";
119
130
  export type PhiImageWidgetFit = "cover" | "contain" | "fill";
@@ -131,6 +142,8 @@ export type PhiImageWidgetPlacement = PhiWidgetPlacementBase & PhiMediaImageSour
131
142
  borderBottomLeftRadius?: number | string;
132
143
  borderBottomRightRadius?: number | string;
133
144
  mask?: PhiMaskConfig;
145
+ /** A picture field of the page record shown instead of the Widget's own picture. */
146
+ recordField?: string;
134
147
  };
135
148
  export type PhiIconWidgetPlacement = PhiWidgetPlacementBase & {
136
149
  icon?: string;
@@ -154,6 +167,32 @@ export type PhiTableWidgetPlacement = PhiWidgetPlacementBase & {
154
167
  fixedFilters?: PhiTableWidgetConfig["fixedFilters"];
155
168
  source?: PhiProviderResourceSource | null;
156
169
  };
170
+ /** Which row it shows arrives as a signal from a row action; the placement says how to read it. */
171
+ export type PhiRecordWidgetPlacement = PhiWidgetPlacementBase & {
172
+ source?: PhiRecordWidgetConfig["source"];
173
+ openActionKey?: PhiRecordWidgetConfig["openActionKey"];
174
+ presentation?: Partial<PhiRecordWidgetPresentation>;
175
+ };
176
+ /**
177
+ * Where a file goes: the Add-on, its table and the slot. What the slot takes is the Add-on's schema
178
+ * descriptor's answer and is not placed. Written out here rather than read off the Widget's config,
179
+ * because the Foundation does not import a Module, not even for a type.
180
+ */
181
+ export type PhiSlotUploadWidgetPlacement = PhiWidgetPlacementBase & {
182
+ /** What the field is called where it stands; translated like every text written into a config. */
183
+ label?: string;
184
+ /** The Add-on that owns the table, by package name -- `@scope/name`. */
185
+ addon?: string;
186
+ table?: string;
187
+ slot?: string;
188
+ /** Which binding parameter carries the row; `id` where none is named. */
189
+ ownerParam?: string;
190
+ };
191
+ export type PhiTabBarWidgetPlacement = PhiWidgetPlacementBase & PhiControlPlacement & Partial<PhiChoiceOptionsConfig> & {
192
+ value?: string;
193
+ valueMode?: PhiChoiceValueMode;
194
+ placement?: PhiCmsTabBarWidgetConfig["placement"];
195
+ };
157
196
  /**
158
197
  * Whether this placement draws the form's own submit.
159
198
  *
@@ -426,6 +465,9 @@ export type PhiCoreWidgetPlacements = {
426
465
  spacer: PhiSpacerWidgetPlacement;
427
466
  html: PhiHtmlWidgetPlacement;
428
467
  table: PhiTableWidgetPlacement;
468
+ record: PhiRecordWidgetPlacement;
469
+ "slot-upload": PhiSlotUploadWidgetPlacement;
470
+ "tab-bar": PhiTabBarWidgetPlacement;
429
471
  form: PhiFormWidgetPlacement;
430
472
  "collection-view": PhiCollectionViewWidgetPlacement;
431
473
  "command-toolbar": PhiCommandToolbarWidgetPlacement;
@@ -1,4 +1,6 @@
1
- import type { PhiRuntimeDataProviderKey } from "./runtime-data-provider";
1
+ import type { PhisPaymentMoney } from "@phis/contracts/payments";
2
+ import type { PhiRecordFieldKind } from "../constants/record-field-kinds";
3
+ import type { PhiRuntimeDataProviderBinding, PhiRuntimeDataProviderKey } from "./runtime-data-provider";
2
4
  import type { PhiBlockRuntime } from "./widget-runtime";
3
5
  /** What a record Provider is asked with, besides its parameters: whose Site, in which language. */
4
6
  export type PhiRuntimeRecordProviderContext = {
@@ -20,4 +22,110 @@ export type PhiRuntimeRecordProviderResolver = (params: Readonly<Record<string,
20
22
  export type PhiRuntimeModuleRecordProviderServerDefinition = {
21
23
  key: PhiRuntimeDataProviderKey;
22
24
  load: () => Promise<PhiRuntimeRecordProviderResolver>;
25
+ /** The reader of the fields the descriptor declares; present exactly where it declares any. */
26
+ loadFields?: () => Promise<PhiRuntimeRecordFieldsReader>;
27
+ /**
28
+ * A few records to show a template with while it is edited; the Builder's Preview takes the first.
29
+ * Optional: without one a template previews with its Widgets' own content. Only where the descriptor
30
+ * declares `record` (fields): a sample stands in for the record a Page is about.
31
+ */
32
+ loadSamples?: () => Promise<PhiRuntimeRecordSamplesReader>;
23
33
  };
34
+ /**
35
+ * One record to show a template with: what the Builder calls it, and the parameters of the Provider that
36
+ * name it (`{ slug: "chair" }`) -- the Provider's own, not a route's.
37
+ */
38
+ export type PhiRecordSample = {
39
+ label: string;
40
+ params: Readonly<Record<string, string>>;
41
+ };
42
+ /** The samples a Provider offers, best first; the Builder's Preview takes the first. */
43
+ export type PhiRuntimeRecordSamplesReader = (context: PhiRuntimeRecordProviderContext) => Promise<readonly PhiRecordSample[]>;
44
+ /** A picture as a record names it: where it is served from -- Site-relative or absolute -- and what it shows. */
45
+ export type PhiRecordPicture = {
46
+ src: string;
47
+ alt?: string;
48
+ };
49
+ /** A short state said in a word, with the tone it is said in. */
50
+ export type PhiRecordTag = {
51
+ label: string;
52
+ tone?: "default" | "success" | "warning" | "error";
53
+ };
54
+ /** Somewhere a record leads: an address, Site-relative or absolute, and the words for it. */
55
+ export type PhiRecordLink = {
56
+ href: string;
57
+ label?: string;
58
+ };
59
+ /**
60
+ * What a field of each kind holds. A `date` is an ISO instant, a `number` a number and a `money` the
61
+ * payment contract's amount (`{ currency, minor }`, `minor` an integer string of minor units): Core writes
62
+ * all three in the page's language -- a date in the Site's time zone, money with its currency's own
63
+ * places (`formatPhisMoney`). What a domain formats itself is a `text`.
64
+ */
65
+ export type PhiRecordFieldValueByKind = {
66
+ text: string;
67
+ markdown: string;
68
+ picture: PhiRecordPicture;
69
+ pictures: readonly PhiRecordPicture[];
70
+ list: readonly string[];
71
+ tag: PhiRecordTag;
72
+ date: string;
73
+ number: number;
74
+ money: PhisPaymentMoney;
75
+ link: PhiRecordLink;
76
+ };
77
+ export type PhiRecordFieldDescriptor = {
78
+ /** The field's name in a Widget's config; unique within its Provider. */
79
+ key: string;
80
+ /** What the Builder calls it. */
81
+ label: string;
82
+ kind: PhiRecordFieldKind;
83
+ description?: string;
84
+ };
85
+ /**
86
+ * Whose a record is: `public` is the same for everybody, so a page about it may be rendered once;
87
+ * `viewer` is the signed-in account's own and is read for each request.
88
+ */
89
+ export type PhiRecordAudience = "public" | "viewer";
90
+ /** What a `record` descriptor declares about its record. */
91
+ export type PhiRecordDeclaration = {
92
+ audience: PhiRecordAudience;
93
+ fields: readonly PhiRecordFieldDescriptor[];
94
+ };
95
+ /**
96
+ * From the record a resolver answered to its declared fields' values, by field key. A field the record
97
+ * does not have is left out; a value that is not of its declared kind is dropped by Core and logged.
98
+ */
99
+ export type PhiRuntimeRecordFieldsReader = (record: unknown, context: PhiRuntimeRecordProviderContext) => Readonly<Record<string, unknown>> | Promise<Readonly<Record<string, unknown>>>;
100
+ /** One field of a record as Core hands it to a Widget: its declared kind and a value of that kind. */
101
+ export type PhiRecordField = {
102
+ [K in PhiRecordFieldKind]: {
103
+ kind: K;
104
+ value: PhiRecordFieldValueByKind[K];
105
+ };
106
+ }[PhiRecordFieldKind];
107
+ /**
108
+ * The record a Page is about, named by a route that has a parameter.
109
+ *
110
+ * `params` maps each parameter the Provider takes to the route parameter that fills it. `titleField` and
111
+ * `descriptionField` name `text` fields that become the Page's title and description.
112
+ */
113
+ export type PhiCmsPageRecordDescriptor = {
114
+ providerKey: PhiRuntimeDataProviderKey;
115
+ params: Readonly<Record<string, string>>;
116
+ titleField?: string;
117
+ descriptionField?: string;
118
+ };
119
+ /**
120
+ * The record a Page is about, as `runtime.page.record` carries it: the Provider and the parameters the
121
+ * address filled in, plus the names of the fields the route's `pageRecord` makes the Page's title and
122
+ * description. Absent where the route names none, never empty.
123
+ *
124
+ * The two names say what the Page takes from the record, not what is asked of the Provider, so they are no
125
+ * part of what a read is keyed by. A Table or Form binding stays the general `PhiRuntimeDataProviderBinding`.
126
+ */
127
+ export type PhiPageRecordBinding = PhiRuntimeDataProviderBinding & {
128
+ titleField?: string;
129
+ descriptionField?: string;
130
+ };
131
+ export type { PhiRecordFieldKind } from "../constants/record-field-kinds";
@@ -49,7 +49,25 @@ export type PhiTableQuery = {
49
49
  * How a Provider value is drawn. Named rather than written into the column, because a record of the
50
50
  * same rows draws the same values and must mean the same thing by `datetime` as the table does.
51
51
  */
52
- export type PhiTableValueRenderer = "text" | "email" | "date" | "datetime" | "badge" | "tags" | "link" | "code" | "json" | "switch" | "checkbox" | "icon";
52
+ export type PhiTableValueRenderer = "text" | "email" | "date" | "datetime" | "badge" | "tags" | "link" | "code" | "json" | "switch" | "checkbox" | "icon"
53
+ /**
54
+ * An amount of money, `{ currency, minor }` -- the payment contract's `PhisPaymentMoney`, with `minor`
55
+ * an integer string or a safe integer of minor units -- written in the reader's language with the
56
+ * currency's own number of places (`formatPhisMoney`). Bound to a `json` field.
57
+ */
58
+ | "money"
59
+ /**
60
+ * How long a period is, `PhiIntervalValue` (`{ unit: "month", count: 3 }`), in Core's words: "per
61
+ * month", "every 3 months". Bound to a `json` field.
62
+ */
63
+ | "interval";
64
+ /** The unit of a `PhiIntervalValue`. */
65
+ export type PhiIntervalUnit = "day" | "week" | "month" | "year";
66
+ /** A period of `count` (a whole number, one or more) `unit`s, as the `interval` renderer draws it. */
67
+ export type PhiIntervalValue = {
68
+ unit: PhiIntervalUnit;
69
+ count: number;
70
+ };
53
71
  export type PhiTableColumnDefinition = {
54
72
  key: string;
55
73
  title: string;
@@ -532,12 +550,26 @@ export type PhiTableProviderQueryRequest = {
532
550
  resourceKey: string;
533
551
  query: PhiTableQuery;
534
552
  params?: Record<string, unknown>;
553
+ /**
554
+ * The reader's language and the Site's time zone (`usePhiIntlLocale`, `usePhiIntlTimeZone`), filled by
555
+ * the binding, for a Provider that writes words, amounts or dates into what it answers. Part of the
556
+ * binding's load key: a live language switch asks again.
557
+ */
558
+ locale: string;
559
+ timeZone: string;
535
560
  signal: AbortSignal;
536
561
  };
537
562
  export type PhiTableProviderRecordRequest = {
538
563
  resourceKey: string;
539
564
  rowIdentity: PhiTableRowIdentity | null;
540
565
  params?: Record<string, unknown>;
566
+ /**
567
+ * The reader's language and the Site's time zone (`usePhiIntlLocale`, `usePhiIntlTimeZone`), filled by
568
+ * the binding, for a Provider that writes words, amounts or dates into what it answers. Part of the
569
+ * binding's load key: a live language switch asks again.
570
+ */
571
+ locale: string;
572
+ timeZone: string;
541
573
  signal: AbortSignal;
542
574
  };
543
575
  export type PhiTableProviderMutationInvalidation = "none" | "view" | "resource";
@@ -334,6 +334,7 @@ export function validatePhiTableWidgetBinding(config, resource) {
334
334
  ((column.renderer === "date" || column.renderer === "datetime") && field?.type === column.renderer) ||
335
335
  (column.renderer === "json" && field?.type === "json") ||
336
336
  (column.renderer === "tags" && (field?.type === "json" || field?.type === "enum[]")) ||
337
+ ((column.renderer === "money" || column.renderer === "interval") && field?.type === "json") ||
337
338
  ((column.renderer === "email" || column.renderer === "link" || column.renderer === "code" ||
338
339
  column.renderer === "badge") && (field?.type === "string" || field?.type === "enum"));
339
340
  if (!rendererCompatible) {
@@ -56,6 +56,13 @@ export type PhiTreeProviderQueryRequest = {
56
56
  resourceKey: string;
57
57
  query: PhiTreeQuery;
58
58
  params?: Record<string, unknown>;
59
+ /**
60
+ * The reader's language and the Site's time zone (`usePhiIntlLocale`, `usePhiIntlTimeZone`), filled by
61
+ * the binding, for a Provider that writes words, amounts or dates into what it answers. Part of the
62
+ * binding's load key: a live language switch asks again.
63
+ */
64
+ locale: string;
65
+ timeZone: string;
59
66
  signal: AbortSignal;
60
67
  };
61
68
  export type PhiTreeProviderQueryResult = {
@@ -114,6 +114,11 @@ export type PhiBlockRuntimePage = {
114
114
  * a Page says, and this can only add to that, never take it back.
115
115
  */
116
116
  noindex?: boolean;
117
+ /**
118
+ * The record this Page is about, as a binding: the Provider and the parameters the address filled in.
119
+ * Present on a route that names a `pageRecord`; a Widget reads the record's fields through it.
120
+ */
121
+ record?: import("./record-provider").PhiPageRecordBinding;
117
122
  };
118
123
  /**
119
124
  * What a Widget knows about the request it renders in. It holds nothing only the server may know: a
package/types.d.ts CHANGED
@@ -26,6 +26,7 @@ export type * from "./types/slot-size-policy";
26
26
  export type * from "./types/runtime-data-provider";
27
27
  export { isPhiRuntimeDataProviderKey, readPhiRuntimeDataProviderBinding } from "./types/runtime-data-provider";
28
28
  export type * from "./types/table-widget";
29
+ export type * from "./types/record-widget";
29
30
  export type * from "./types/tree-widget";
30
31
  export type * from "./types/collection-provider";
31
32
  export type * from "./types/form-descriptor";