@phis/ui 0.7.7 → 0.8.0

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 (344) hide show
  1. package/components/controls/phi-address-control.d.ts +23 -0
  2. package/components/controls/phi-address-control.js +43 -0
  3. package/components/controls/phi-color-control.d.ts +3 -1
  4. package/components/controls/phi-color-control.js +2 -2
  5. package/components/controls/phi-country-select-control.d.ts +22 -0
  6. package/components/controls/phi-country-select-control.js +16 -0
  7. package/components/controls/phi-dialog-control.d.ts +1 -1
  8. package/components/controls/phi-drawer-control-adapter.d.ts +1 -1
  9. package/components/controls/phi-drawer-control-adapter.js +5 -3
  10. package/components/controls/phi-drawer-control.d.ts +7 -5
  11. package/components/controls/phi-float-button-control.d.ts +8 -1
  12. package/components/controls/phi-float-button-control.js +19 -3
  13. package/components/controls/phi-form-control.js +64 -9
  14. package/components/controls/phi-modal-control-adapter.d.ts +1 -1
  15. package/components/controls/phi-modal-control-adapter.js +14 -37
  16. package/components/controls/phi-modal-control.d.ts +5 -5
  17. package/components/controls/phi-options-provider.d.ts +1 -0
  18. package/components/controls/phi-options-provider.js +1 -0
  19. package/components/controls/phi-overlay-control-contract.d.ts +52 -17
  20. package/components/controls/phi-overlay-control-contract.js +55 -30
  21. package/components/controls/phi-reveal-once-dialog-control.d.ts +21 -0
  22. package/components/controls/phi-reveal-once-dialog-control.js +52 -0
  23. package/components/controls/phi-reveal-once-dialog-labels.d.ts +10 -0
  24. package/components/controls/phi-reveal-once-dialog-labels.js +5 -0
  25. package/components/forms/extended-form-field-controls.d.ts +1 -1
  26. package/components/forms/extended-form-field-controls.js +23 -7
  27. package/components/forms/flags-field.d.ts +22 -0
  28. package/components/forms/flags-field.js +58 -0
  29. package/components/forms/form-option-flags.d.ts +20 -0
  30. package/components/forms/form-option-flags.js +38 -0
  31. package/components/forms/form-provider-contract.d.ts +28 -0
  32. package/components/forms/form-provider-contract.js +45 -2
  33. package/components/forms/form-provider-registry.d.ts +11 -1
  34. package/components/forms/money-field-currency-key.d.ts +6 -0
  35. package/components/forms/money-field-currency-key.js +14 -0
  36. package/components/forms/money-field.d.ts +26 -3
  37. package/components/forms/money-field.js +54 -4
  38. package/components/forms/shared-form-provider-registry.js +13 -0
  39. package/components/forms/structured-field-labels.d.ts +24 -0
  40. package/components/forms/structured-field-labels.js +43 -0
  41. package/components/forms/structured-form-field-controls.d.ts +12 -0
  42. package/components/forms/structured-form-field-controls.js +65 -0
  43. package/components/overlays/phi-overlay-container-client.js +2 -2
  44. package/components/regions/phi-cms-region-shell.js +2 -2
  45. package/components/regions/presets/content-entry-editor-page-tree.js +12 -3
  46. package/components/regions/presets/navigation-redirect.d.ts +4 -1
  47. package/components/regions/presets/navigation-redirect.js +6 -3
  48. package/components/regions/presets/phi-settings-page-shell-tree.d.ts +6 -2
  49. package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
  50. package/components/root/phi-root-theme-resolver.js +3 -0
  51. package/components/shell/phi-antd-icon.d.ts +1 -8
  52. package/components/shell/phi-antd-icon.js +1 -227
  53. package/components/shell/phi-icon-names.d.ts +19 -0
  54. package/components/shell/phi-icon-names.js +264 -0
  55. package/components/shell/phi-icon.d.ts +2 -11
  56. package/components/shell/phi-icon.js +4 -32
  57. package/components/widgets/client/shared/phi-command-buttons.d.ts +13 -2
  58. package/components/widgets/client/shared/phi-command-buttons.js +10 -4
  59. package/components/widgets/client/shared/phi-rendered-value.js +32 -6
  60. package/components/widgets/client/shared/phi-table-provider-refusal.d.ts +13 -0
  61. package/components/widgets/client/shared/phi-table-provider-refusal.js +13 -0
  62. package/components/widgets/config/background.d.ts +3 -2
  63. package/components/widgets/config/choice-shared.d.ts +10 -1
  64. package/components/widgets/config/choice-shared.js +8 -2
  65. package/components/widgets/label-sets/admin-locales.js +1 -1
  66. package/components/widgets/label-sets/admin-users.d.ts +2 -5
  67. package/components/widgets/label-sets/admin-users.js +4 -10
  68. package/components/widgets/label-sets/effects.js +2 -4
  69. package/components/widgets/label-sets/profile.d.ts +13 -0
  70. package/components/widgets/label-sets/profile.js +28 -0
  71. package/components/widgets/label-sets/search-results.js +2 -4
  72. package/components/widgets/label-sets/table.js +9 -0
  73. package/components/widgets/label-types/effects.d.ts +3 -2
  74. package/components/widgets/label-types/effects.js +1 -2
  75. package/components/widgets/label-types/search-results.d.ts +2 -2
  76. package/components/widgets/label-types/search-results.js +1 -2
  77. package/components/widgets/label-types/table.d.ts +3 -0
  78. package/components/widgets/label-types/table.js +2 -0
  79. package/components/widgets/server/builder-chrome.d.ts +4 -1
  80. package/components/widgets/server/builder-chrome.js +2 -2
  81. package/components/widgets/shared/markdown-body-client.d.ts +26 -0
  82. package/components/widgets/shared/markdown-body-client.js +31 -1
  83. package/components/widgets/shared/markdown-render.d.ts +10 -2
  84. package/components/widgets/shared/markdown-render.js +35 -13
  85. package/constants/countries.d.ts +9 -0
  86. package/constants/countries.js +28 -0
  87. package/constants/customer-file.d.ts +25 -0
  88. package/constants/customer-file.js +26 -0
  89. package/constants/record-field-kinds.d.ts +15 -0
  90. package/constants/record-field-kinds.js +13 -0
  91. package/constants/runtime-module-ownership.js +12 -0
  92. package/constants/runtime-render-client-types.d.ts +5 -0
  93. package/constants/runtime-render-client-types.js +5 -0
  94. package/{plugins/runtime-modules/threads/controller/address.js → constants/threads-controller-address.js} +1 -1
  95. package/constants.d.ts +1 -0
  96. package/constants.js +2 -0
  97. package/gateway/form-handler-request.d.ts +22 -0
  98. package/gateway/form-handler-request.js +40 -0
  99. package/gateway/label-set.d.ts +15 -2
  100. package/gateway/label-set.js +60 -22
  101. package/gateway/site-form-route.js +11 -2
  102. package/helpers/address-field.d.ts +43 -0
  103. package/helpers/address-field.js +68 -0
  104. package/helpers/cms-dialog.d.ts +5 -20
  105. package/helpers/cms-dialog.js +8 -13
  106. package/helpers/cms-page-catalog.d.ts +10 -0
  107. package/helpers/cms-page-catalog.js +19 -0
  108. package/helpers/cms-preset-nodes.d.ts +4 -4
  109. package/helpers/cms-preset-nodes.js +1 -1
  110. package/helpers/cms-region-keys.d.ts +1 -1
  111. package/helpers/country-names.d.ts +12 -0
  112. package/helpers/country-names.js +14 -0
  113. package/helpers/money-amount.d.ts +7 -0
  114. package/helpers/money-amount.js +15 -0
  115. package/helpers/phi-metadata.d.ts +33 -1
  116. package/helpers/phi-metadata.js +62 -1
  117. package/helpers/preset-table-check.d.ts +34 -0
  118. package/helpers/preset-table-check.js +124 -0
  119. package/helpers/preset-text-source-check.d.ts +4 -1
  120. package/helpers/preset-text-source-check.js +6 -1
  121. package/helpers/preset-tree-contract-check.d.ts +3 -2
  122. package/helpers/preset-tree-contract-check.js +30 -5
  123. package/helpers/public-route-claims.d.ts +9 -1
  124. package/helpers/public-route-claims.js +23 -3
  125. package/helpers/record-fields.d.ts +1 -5
  126. package/helpers/record-fields.js +15 -6
  127. package/helpers/route-address-check.d.ts +22 -2
  128. package/helpers/route-address-check.js +29 -8
  129. package/helpers/site-address-row.d.ts +23 -0
  130. package/helpers/site-address-row.js +36 -0
  131. package/helpers/surface-style.d.ts +8 -1
  132. package/helpers/surface-style.js +12 -2
  133. package/helpers/thread-inbox-row.d.ts +20 -0
  134. package/helpers/thread-inbox-row.js +26 -0
  135. package/helpers/translation-format.d.ts +26 -0
  136. package/helpers/translation-format.js +31 -0
  137. package/module-labels.d.ts +1 -1
  138. package/module-labels.js +1 -1
  139. package/module-page-check.d.ts +1 -0
  140. package/module-page-check.js +1 -0
  141. package/module-records.d.ts +2 -2
  142. package/module-records.js +1 -0
  143. package/next/area-route.js +34 -1
  144. package/next/root-route.js +4 -5
  145. package/package.json +2 -2
  146. package/plugins/runtime-modules/accounting/customer-file-access.d.ts +11 -0
  147. package/plugins/runtime-modules/accounting/customer-file-access.js +12 -0
  148. package/plugins/runtime-modules/accounting/data-providers.js +1 -1
  149. package/plugins/runtime-modules/accounting/ids.d.ts +11 -0
  150. package/plugins/runtime-modules/accounting/ids.js +23 -0
  151. package/plugins/runtime-modules/accounting/presets.js +32 -5
  152. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +66 -0
  153. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +122 -0
  154. package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +2 -2
  155. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +26 -0
  156. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +381 -0
  157. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +4 -0
  158. package/plugins/runtime-modules/app/client-data-providers.d.ts +7 -0
  159. package/plugins/runtime-modules/app/client-data-providers.js +9 -0
  160. package/plugins/runtime-modules/app/data-providers.d.ts +98 -0
  161. package/plugins/runtime-modules/app/data-providers.js +80 -0
  162. package/plugins/runtime-modules/app/definition.d.ts +131 -0
  163. package/plugins/runtime-modules/app/definition.js +2 -0
  164. package/plugins/runtime-modules/app/forms.d.ts +46 -1
  165. package/plugins/runtime-modules/app/forms.js +195 -1
  166. package/plugins/runtime-modules/app/ids.d.ts +7 -0
  167. package/plugins/runtime-modules/app/ids.js +8 -0
  168. package/plugins/runtime-modules/app/module.d.ts +131 -0
  169. package/plugins/runtime-modules/app/presets.js +3 -6
  170. package/plugins/runtime-modules/app/services/addresses-table.d.ts +135 -0
  171. package/plugins/runtime-modules/app/services/addresses-table.js +101 -0
  172. package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +17 -0
  173. package/plugins/runtime-modules/app/trees/account-addresses-panel.js +179 -0
  174. package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +62 -0
  175. package/plugins/runtime-modules/app/trees/addresses-label-set.js +108 -0
  176. package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.d.ts +3 -6
  177. package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.js +4 -7
  178. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +27 -2
  179. package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +1 -0
  180. package/plugins/runtime-modules/app/trees/profile-label-set.js +3 -0
  181. package/plugins/runtime-modules/asset/presets.d.ts +4 -0
  182. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +4 -2
  183. package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +4 -2
  184. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -2
  185. package/plugins/runtime-modules/auth/widgets/logout/client.d.ts +1 -1
  186. package/plugins/runtime-modules/auth/widgets/logout/client.js +2 -2
  187. package/plugins/runtime-modules/auth/widgets/security/client.d.ts +5 -1
  188. package/plugins/runtime-modules/auth/widgets/security/client.js +12 -10
  189. package/plugins/runtime-modules/avatar/overlay-tree.server.js +1 -1
  190. package/plugins/runtime-modules/blog/presets.d.ts +4 -0
  191. package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +2 -1
  192. package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -2
  193. package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.d.ts +23 -0
  194. package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.js +38 -0
  195. package/plugins/runtime-modules/builder/clients/mode-switch.d.ts +4 -1
  196. package/plugins/runtime-modules/builder/clients/mode-switch.js +2 -15
  197. package/plugins/runtime-modules/builder/clients/pages-workspace.js +2 -0
  198. package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +2 -1
  199. package/plugins/runtime-modules/builder/controller/client.d.ts +5 -5
  200. package/plugins/runtime-modules/builder/controller/client.js +2 -1
  201. package/plugins/runtime-modules/builder/controller/definition.d.ts +4 -4
  202. package/plugins/runtime-modules/builder/controller/definition.js +7 -0
  203. package/plugins/runtime-modules/builder/controller/draft-command-controller.d.ts +3 -1
  204. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +2 -1
  205. package/plugins/runtime-modules/builder/controller/draft-status-controller.js +72 -18
  206. package/plugins/runtime-modules/builder/controller/server-definition.d.ts +4 -4
  207. package/plugins/runtime-modules/builder/controller/workspace-controller.d.ts +3 -1
  208. package/plugins/runtime-modules/builder/controller/workspace-controller.js +8 -10
  209. package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +10 -0
  210. package/plugins/runtime-modules/builder/developer-workspace-store.js +35 -1
  211. package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +5 -0
  212. package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +6 -0
  213. package/plugins/runtime-modules/builder/offered-page-catalog.js +35 -6
  214. package/plugins/runtime-modules/builder/page-presets.server.d.ts +7 -0
  215. package/plugins/runtime-modules/builder/page-presets.server.js +10 -1
  216. package/plugins/runtime-modules/builder/persistence.d.ts +4 -1
  217. package/plugins/runtime-modules/builder/persistence.js +14 -3
  218. package/plugins/runtime-modules/builder/public-route-collisions.js +8 -3
  219. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -1
  220. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +33 -6
  221. package/plugins/runtime-modules/builder/widgets/chrome/config.d.ts +6 -4
  222. package/plugins/runtime-modules/builder/widgets/chrome/config.js +11 -1
  223. package/plugins/runtime-modules/builder/widgets/inspector-header/authoring.d.ts +2 -2
  224. package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.d.ts +2 -2
  225. package/plugins/runtime-modules/builder/widgets/mode-switch/plugin.js +1 -1
  226. package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +2 -2
  227. package/plugins/runtime-modules/client-manifests/app.js +3 -0
  228. package/plugins/runtime-modules/client-manifests/builder.js +10 -0
  229. package/plugins/runtime-modules/content-entry-routes.d.ts +4 -0
  230. package/plugins/runtime-modules/contracts.js +31 -1
  231. package/plugins/runtime-modules/core/definition.d.ts +28 -0
  232. package/plugins/runtime-modules/core/form-providers.d.ts +28 -0
  233. package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +0 -17
  234. package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +2 -23
  235. package/plugins/runtime-modules/core/widgets/card/config.d.ts +0 -1
  236. package/plugins/runtime-modules/core/widgets/card/config.js +0 -1
  237. package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
  238. package/plugins/runtime-modules/core/widgets/command-toolbar/client.js +3 -0
  239. package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +316 -1
  240. package/plugins/runtime-modules/core/widgets/command-toolbar/config.js +4 -4
  241. package/plugins/runtime-modules/core/widgets/dimension/config.d.ts +1 -1
  242. package/plugins/runtime-modules/core/widgets/float-button/client.js +4 -1
  243. package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +326 -3
  244. package/plugins/runtime-modules/core/widgets/float-button/config.js +5 -2
  245. package/plugins/runtime-modules/core/widgets/header-navigation/client.js +1 -1
  246. package/plugins/runtime-modules/core/widgets/length/config.d.ts +1 -1
  247. package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
  248. package/plugins/runtime-modules/core/widgets/markdown/server.d.ts +6 -2
  249. package/plugins/runtime-modules/core/widgets/markdown/server.js +2 -2
  250. package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.d.ts +12 -0
  251. package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.js +68 -0
  252. package/plugins/runtime-modules/core/widgets/number-input/config.d.ts +1 -1
  253. package/plugins/runtime-modules/core/widgets/simple-text/config.js +1 -1
  254. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +2 -1
  255. package/plugins/runtime-modules/core/widgets/spacer/client.js +3 -3
  256. package/plugins/runtime-modules/core/widgets/table/client.js +20 -5
  257. package/plugins/runtime-modules/core/widgets/table/config.js +6 -0
  258. package/plugins/runtime-modules/core/widgets/table/reader-query.d.ts +17 -0
  259. package/plugins/runtime-modules/core/widgets/table/reader-query.js +33 -0
  260. package/plugins/runtime-modules/dashboard/trees/dashboard-cards-page-tree.js +3 -1
  261. package/plugins/runtime-modules/descriptor-compiler.d.ts +19 -3
  262. package/plugins/runtime-modules/descriptor-compiler.js +44 -16
  263. package/plugins/runtime-modules/editor/presets.d.ts +4 -0
  264. package/plugins/runtime-modules/editor/trees/phi-default-editor-releases-page-tree.js +3 -1
  265. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +5 -1
  266. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +5 -1
  267. package/plugins/runtime-modules/localization/presets.d.ts +4 -0
  268. package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -1
  269. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +4 -2
  270. package/plugins/runtime-modules/news/presets.d.ts +4 -0
  271. package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +6 -2
  272. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +46 -39
  273. package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
  274. package/plugins/runtime-modules/preset-contracts/pub-area.js +1 -0
  275. package/plugins/runtime-modules/resolver.js +17 -0
  276. package/plugins/runtime-modules/revisions/controller/client.js +50 -46
  277. package/plugins/runtime-modules/revisions/controller/draft-context-target.d.ts +25 -0
  278. package/plugins/runtime-modules/revisions/controller/draft-context-target.js +33 -0
  279. package/plugins/runtime-modules/revisions/presets.d.ts +4 -0
  280. package/plugins/runtime-modules/revisions/services/table.js +16 -5
  281. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +3 -1
  282. package/plugins/runtime-modules/search/widgets/search-results/client.js +4 -2
  283. package/plugins/runtime-modules/theme/presets.d.ts +4 -0
  284. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +76 -4
  285. package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +3 -2
  286. package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +2 -2
  287. package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +19 -7
  288. package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
  289. package/plugins/runtime-modules/threads/controller/definition.js +1 -1
  290. package/plugins/runtime-modules/threads/data-providers.d.ts +115 -2
  291. package/plugins/runtime-modules/threads/data-providers.js +85 -0
  292. package/plugins/runtime-modules/threads/definition.d.ts +115 -2
  293. package/plugins/runtime-modules/threads/definition.js +1 -1
  294. package/plugins/runtime-modules/threads/ids.d.ts +2 -0
  295. package/plugins/runtime-modules/threads/ids.js +3 -0
  296. package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +192 -0
  297. package/plugins/runtime-modules/threads/services/customer-file-table.js +164 -0
  298. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +5 -3
  299. package/plugins/runtime-modules/user-management/client-data-providers.js +5 -0
  300. package/plugins/runtime-modules/user-management/data-providers.d.ts +159 -0
  301. package/plugins/runtime-modules/user-management/data-providers.js +101 -3
  302. package/plugins/runtime-modules/user-management/definition.d.ts +159 -0
  303. package/plugins/runtime-modules/user-management/ids.d.ts +9 -0
  304. package/plugins/runtime-modules/user-management/ids.js +9 -0
  305. package/plugins/runtime-modules/user-management/presets.js +17 -1
  306. package/plugins/runtime-modules/user-management/services/users-access-table.d.ts +378 -0
  307. package/plugins/runtime-modules/user-management/services/users-access-table.js +132 -0
  308. package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +86 -0
  309. package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +118 -0
  310. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.d.ts +20 -0
  311. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +166 -0
  312. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +19 -18
  313. package/server-helpers/cms-page-record.d.ts +9 -1
  314. package/server-helpers/cms-page-record.js +11 -1
  315. package/server-helpers/cms-request.js +8 -5
  316. package/server-helpers/link-preview-image.d.ts +30 -0
  317. package/server-helpers/link-preview-image.js +57 -0
  318. package/server-helpers/search-text.js +3 -0
  319. package/server-helpers.d.ts +1 -1
  320. package/server-helpers.js +1 -1
  321. package/styles/builder-scaffold.css +7 -1
  322. package/styles/layout-authoring-scaffold.css +27 -0
  323. package/styles/shell.css +30 -6
  324. package/theme/phi-theme-composition.js +9 -0
  325. package/theme/phi-theme-inverse-ground.d.ts +39 -0
  326. package/theme/phi-theme-inverse-ground.js +103 -0
  327. package/theme/phi-theme-tokens.d.ts +2 -1
  328. package/theme/phi-theme-tokens.js +2 -0
  329. package/types/cms-module-descriptors.d.ts +14 -0
  330. package/types/cms-overlay.d.ts +13 -6
  331. package/types/cms-overlay.js +6 -22
  332. package/types/cms-plugins.d.ts +14 -2
  333. package/types/cms.d.ts +10 -0
  334. package/types/core-widget-placements.d.ts +3 -3
  335. package/types/link-preview.d.ts +19 -0
  336. package/types/link-preview.js +19 -0
  337. package/types/record-provider.d.ts +22 -1
  338. package/types/site-theme.d.ts +27 -0
  339. package/types/table-embed.d.ts +48 -0
  340. package/types/table-embed.js +1 -0
  341. package/types/table-widget.d.ts +14 -0
  342. package/types/widget-runtime.d.ts +3 -0
  343. package/types.d.ts +1 -0
  344. /package/{plugins/runtime-modules/threads/controller/address.d.ts → constants/threads-controller-address.d.ts} +0 -0
@@ -2,6 +2,7 @@ import { buildPhiFormSubmitRouteFromHandlerProvider, resolvePhiFormSubmitTarget,
2
2
  import { resolvePhiServerFormHandler } from "./form-handler-resolution";
3
3
  import { PHIS_FORM_RELAY_HEADER, PHIS_SITE_KEY_HEADER } from "../constants/http-headers";
4
4
  import { isPhiRecord } from "../helpers/is-record";
5
+ import { shapePhiFormHandlerRequest } from "./form-handler-request";
5
6
  const PHI_SITE_SESSION_COOKIE_NAME = "phis_session";
6
7
  const PHI_AUTH_LINK_COOKIE_NAME = "phis_auth_link";
7
8
  /** Core's double-submit pair: the cookie `/api/auth/csrf` sets and the header that repeats it. */
@@ -264,10 +265,18 @@ export function buildPhiSiteFormRouteHandlers({ upstreamBaseUrl, buildHeaders, t
264
265
  proxyHeaders.set(PHI_CSRF_HEADER_NAME, csrfToken);
265
266
  appendCookieHeader(proxyHeaders, `${PHI_CSRF_COOKIE_NAME}=${csrfToken}`);
266
267
  }
267
- const upstreamResponse = await fetch(`${upstreamBaseUrl}${target.upstreamPath}`, {
268
+ // The values as the handler's route takes them: its path's `{key}` segments filled.
269
+ const shaped = shapePhiFormHandlerRequest({
270
+ upstreamPath: target.upstreamPath ?? "",
271
+ values: body.values,
272
+ });
273
+ if ("error" in shaped) {
274
+ return toJsonResponse({ ok: false, error: shaped.error }, 400);
275
+ }
276
+ const upstreamResponse = await fetch(`${upstreamBaseUrl}${shaped.path}`, {
268
277
  method: descriptor.method,
269
278
  headers: headersToPlainObject(proxyHeaders),
270
- body: JSON.stringify(body.values ?? {}),
279
+ body: JSON.stringify(shaped.body),
271
280
  cache: "no-store",
272
281
  signal: AbortSignal.timeout(timeoutMs),
273
282
  });
@@ -0,0 +1,43 @@
1
+ import type { PhisSiteAddressInput } from "@phis/contracts/users";
2
+ /** The parts of an address a person writes (`PhisSiteAddressInput`), in the order the `address` field asks them. */
3
+ export declare const PHI_ADDRESS_PARTS: readonly ["name", "companyName", "line1", "line2", "postalCode", "city", "region", "country"];
4
+ export type PhiAddressPart = (typeof PHI_ADDRESS_PARTS)[number];
5
+ /** The parts Core refuses an address without (phis-server `readPhisSiteAddressInput`). */
6
+ export declare const PHI_ADDRESS_REQUIRED_PARTS: readonly ["name", "line1", "city", "country"];
7
+ /** The widths of `phis.site_addresses` Core holds each text part to; the country is a code. */
8
+ export declare const PHI_ADDRESS_PART_MAX_LENGTHS: {
9
+ readonly companyName: 256;
10
+ readonly name: 256;
11
+ readonly line1: 256;
12
+ readonly line2: 256;
13
+ readonly postalCode: 32;
14
+ readonly city: 128;
15
+ readonly region: 128;
16
+ };
17
+ type PhiAddressTextPart = keyof typeof PHI_ADDRESS_PART_MAX_LENGTHS;
18
+ /**
19
+ * The `address` field's value as a Form holds it: every part of `PhisSiteAddressInput`, an empty optional
20
+ * part `null`, an empty required part `""`. Read leniently -- it is what somebody is typing -- and never
21
+ * thrown on; whether it can be sent is `findPhiAddressProblems`'s answer.
22
+ */
23
+ export declare function readPhiAddressFieldValue(value: unknown): PhisSiteAddressInput;
24
+ /** The value a part change makes: the part written, an empty optional part `null` again. */
25
+ export declare function writePhiAddressFieldPart(value: PhisSiteAddressInput, part: PhiAddressPart, next: string | null): PhisSiteAddressInput;
26
+ export type PhiAddressProblem = {
27
+ part: PhiAddressPart;
28
+ kind: "required";
29
+ } | {
30
+ part: PhiAddressTextPart;
31
+ kind: "tooLong";
32
+ max: number;
33
+ } | {
34
+ part: "country";
35
+ kind: "country";
36
+ };
37
+ /**
38
+ * What keeps the address from being one Core takes, part by part in the field's order: a required part
39
+ * empty (after trimming, as Core trims), a part longer than its column, a country that is no ISO 3166-1
40
+ * alpha-2 code.
41
+ */
42
+ export declare function findPhiAddressProblems(value: PhisSiteAddressInput): PhiAddressProblem[];
43
+ export {};
@@ -0,0 +1,68 @@
1
+ import { readPhiCountryCode } from "../constants/countries";
2
+ import { isPhiRecord } from "./is-record";
3
+ /** The parts of an address a person writes (`PhisSiteAddressInput`), in the order the `address` field asks them. */
4
+ export const PHI_ADDRESS_PARTS = ["name", "companyName", "line1", "line2", "postalCode", "city", "region", "country"];
5
+ /** The parts Core refuses an address without (phis-server `readPhisSiteAddressInput`). */
6
+ export const PHI_ADDRESS_REQUIRED_PARTS = ["name", "line1", "city", "country"];
7
+ /** The widths of `phis.site_addresses` Core holds each text part to; the country is a code. */
8
+ export const PHI_ADDRESS_PART_MAX_LENGTHS = {
9
+ companyName: 256,
10
+ name: 256,
11
+ line1: 256,
12
+ line2: 256,
13
+ postalCode: 32,
14
+ city: 128,
15
+ region: 128,
16
+ };
17
+ const OPTIONAL_PARTS = new Set(["companyName", "line2", "postalCode", "region"]);
18
+ /**
19
+ * The `address` field's value as a Form holds it: every part of `PhisSiteAddressInput`, an empty optional
20
+ * part `null`, an empty required part `""`. Read leniently -- it is what somebody is typing -- and never
21
+ * thrown on; whether it can be sent is `findPhiAddressProblems`'s answer.
22
+ */
23
+ export function readPhiAddressFieldValue(value) {
24
+ const record = isPhiRecord(value) ? value : {};
25
+ const part = (key) => {
26
+ const raw = typeof record[key] === "string" ? record[key] : "";
27
+ return OPTIONAL_PARTS.has(key) && !raw ? null : raw;
28
+ };
29
+ return {
30
+ name: part("name") ?? "",
31
+ companyName: part("companyName"),
32
+ line1: part("line1") ?? "",
33
+ line2: part("line2"),
34
+ postalCode: part("postalCode"),
35
+ city: part("city") ?? "",
36
+ region: part("region"),
37
+ country: part("country") ?? "",
38
+ };
39
+ }
40
+ /** The value a part change makes: the part written, an empty optional part `null` again. */
41
+ export function writePhiAddressFieldPart(value, part, next) {
42
+ const text = next ?? "";
43
+ return { ...value, [part]: OPTIONAL_PARTS.has(part) && !text ? null : text };
44
+ }
45
+ /**
46
+ * What keeps the address from being one Core takes, part by part in the field's order: a required part
47
+ * empty (after trimming, as Core trims), a part longer than its column, a country that is no ISO 3166-1
48
+ * alpha-2 code.
49
+ */
50
+ export function findPhiAddressProblems(value) {
51
+ const problems = [];
52
+ for (const part of PHI_ADDRESS_PARTS) {
53
+ const text = (value[part] ?? "").trim();
54
+ if (PHI_ADDRESS_REQUIRED_PARTS.includes(part) && !text) {
55
+ problems.push({ part, kind: "required" });
56
+ continue;
57
+ }
58
+ if (part === "country") {
59
+ if (!readPhiCountryCode(text))
60
+ problems.push({ part, kind: "country" });
61
+ continue;
62
+ }
63
+ const max = PHI_ADDRESS_PART_MAX_LENGTHS[part];
64
+ if (text.length > max)
65
+ problems.push({ part, kind: "tooLong", max });
66
+ }
67
+ return problems;
68
+ }
@@ -42,13 +42,10 @@ export declare const PHI_DIALOG_COMMANDS_CONFIG: {
42
42
  /**
43
43
  * A dialog's width where it names none and its Form needs two columns: the reading measure, which is also
44
44
  * where a Form's own cap lies, so a Form fills the dialog it opens in. A wider one -- a table, a preview
45
- * -- says so, and takes its width from the same sequence (`PHI_LAYOUT`).
45
+ * -- says so, and takes its width from the same sequence (`PHI_LAYOUT`). A dialog states it as
46
+ * `size: { width: PHI_DIALOG_WIDTH }`.
46
47
  */
47
- export declare const PHI_DIALOG_WIDTH: {
48
- readonly compact: "calc(100vw - 32px)";
49
- readonly medium: 610;
50
- readonly wide: 610;
51
- };
48
+ export declare const PHI_DIALOG_WIDTH: 610;
52
49
  /**
53
50
  * A dialog's width where its Form stands in one column.
54
51
  *
@@ -58,11 +55,7 @@ export declare const PHI_DIALOG_WIDTH: {
58
55
  * (`PHI_FORM_RESPONSIVE_MIN_WIDTH.medium`, the same 377), and the Form stands inside the body's inset.
59
56
  * So it is that measure plus the inset on both sides -- the Theme's `base` step, whatever it is set to.
60
57
  */
61
- export declare const PHI_DIALOG_WIDTH_SINGLE_COLUMN: {
62
- readonly compact: "calc(100vw - 32px)";
63
- readonly medium: "calc(377px + 2 * var(--phi-padding))";
64
- readonly wide: "calc(377px + 2 * var(--phi-padding))";
65
- };
58
+ export declare const PHI_DIALOG_WIDTH_SINGLE_COLUMN: string;
66
59
  /**
67
60
  * Whether a Form stands in one column wherever it can stand in two.
68
61
  *
@@ -75,12 +68,4 @@ export declare const PHI_DIALOG_WIDTH_SINGLE_COLUMN: {
75
68
  */
76
69
  export declare function isPhiFormSingleColumn(descriptor: PhiFormDescriptor): boolean;
77
70
  /** The width a dialog takes for the Form in its body: `PHI_DIALOG_WIDTH_SINGLE_COLUMN` or `PHI_DIALOG_WIDTH`. */
78
- export declare function resolvePhiDialogFormWidth(descriptor: PhiFormDescriptor): {
79
- readonly compact: "calc(100vw - 32px)";
80
- readonly medium: 610;
81
- readonly wide: 610;
82
- } | {
83
- readonly compact: "calc(100vw - 32px)";
84
- readonly medium: "calc(377px + 2 * var(--phi-padding))";
85
- readonly wide: "calc(377px + 2 * var(--phi-padding))";
86
- };
71
+ export declare function resolvePhiDialogFormWidth(descriptor: PhiFormDescriptor): number | string;
@@ -20,8 +20,10 @@ import { PHI_LAYOUT } from "../theme/phi-tokens";
20
20
  * - The actions are one compact group, labelled, at the medium size: a dialog asks one question and its
21
21
  * answers belong together.
22
22
  * - The width is as wide as its Form needs: the reading measure for a Form of two columns, the narrowest
23
- * width that keeps a Form's labels beside its fields for one of one column, full width less the gutter
24
- * on a phone either way. A table or an editor states a wider one.
23
+ * width that keeps a Form's labels beside its fields for one of one column. A table or an editor states
24
+ * a wider one. It is the width of the Overlay's `size`, a block's length (OVERLAYS.md, "Presentation config"),
25
+ * and the Modal holds it inside the viewport itself, so a phone gets the full width less the gutter
26
+ * without a second value.
25
27
  */
26
28
  /** The body Layout's config: a vertical Flex with the `panel` creation preset under it. */
27
29
  export const PHI_DIALOG_BODY_CONFIG = {
@@ -44,13 +46,10 @@ export const PHI_DIALOG_COMMANDS_CONFIG = {
44
46
  /**
45
47
  * A dialog's width where it names none and its Form needs two columns: the reading measure, which is also
46
48
  * where a Form's own cap lies, so a Form fills the dialog it opens in. A wider one -- a table, a preview
47
- * -- says so, and takes its width from the same sequence (`PHI_LAYOUT`).
49
+ * -- says so, and takes its width from the same sequence (`PHI_LAYOUT`). A dialog states it as
50
+ * `size: { width: PHI_DIALOG_WIDTH }`.
48
51
  */
49
- export const PHI_DIALOG_WIDTH = {
50
- compact: "calc(100vw - 32px)",
51
- medium: PHI_LAYOUT.contentMax,
52
- wide: PHI_LAYOUT.contentMax,
53
- };
52
+ export const PHI_DIALOG_WIDTH = PHI_LAYOUT.contentMax;
54
53
  /**
55
54
  * A dialog's width where its Form stands in one column.
56
55
  *
@@ -60,11 +59,7 @@ export const PHI_DIALOG_WIDTH = {
60
59
  * (`PHI_FORM_RESPONSIVE_MIN_WIDTH.medium`, the same 377), and the Form stands inside the body's inset.
61
60
  * So it is that measure plus the inset on both sides -- the Theme's `base` step, whatever it is set to.
62
61
  */
63
- export const PHI_DIALOG_WIDTH_SINGLE_COLUMN = {
64
- compact: PHI_DIALOG_WIDTH.compact,
65
- medium: `calc(${PHI_LAYOUT.contentMaxNarrow}px + 2 * ${PHI_DIALOG_BODY_CONFIG.padding})`,
66
- wide: `calc(${PHI_LAYOUT.contentMaxNarrow}px + 2 * ${PHI_DIALOG_BODY_CONFIG.padding})`,
67
- };
62
+ export const PHI_DIALOG_WIDTH_SINGLE_COLUMN = `calc(${PHI_LAYOUT.contentMaxNarrow}px + 2 * ${PHI_DIALOG_BODY_CONFIG.padding})`;
68
63
  /** The widths at which a Form's labels stand beside its fields, and so the ones that have columns. */
69
64
  const PHI_DIALOG_FORM_COLUMN_MODES = ["medium", "wide"];
70
65
  /**
@@ -90,6 +90,16 @@ export declare function resolvePhiBuilderCatalogPathForCatalog(area: PhiBuilderP
90
90
  * matched against the storage path or nothing outside Public would ever be found.
91
91
  */
92
92
  export declare function findPhiBuilderPageKeyFromStoragePath(area: PhiBuilderPageCatalogArea, path: string, pages: readonly PhiPresetPageNode[]): string | null;
93
+ /**
94
+ * The key of the Module Page a preset identity names, wherever its path stands now.
95
+ *
96
+ * A Module Page is stored and addressed by `ownerModuleId` + `presetKey`, never by path: a revision scope
97
+ * of one carries no path at all, so looking it up by path finds nothing.
98
+ */
99
+ export declare function findPhiBuilderPageKeyFromPresetSource(source: {
100
+ ownerModuleId: string;
101
+ presetKey: string;
102
+ }, pages: readonly PhiPresetPageNode[]): string | null;
93
103
  export declare function resolvePhiBuilderPageKeyFromCatalogPath(area: PhiBuilderPageCatalogArea, path: string, pages: readonly PhiPresetPageNode[]): string;
94
104
  export type PhiBuilderPersistedPageCatalogEntry = {
95
105
  id: number;
@@ -218,6 +218,25 @@ export function findPhiBuilderPageKeyFromStoragePath(area, path, pages) {
218
218
  };
219
219
  return visit(pages);
220
220
  }
221
+ /**
222
+ * The key of the Module Page a preset identity names, wherever its path stands now.
223
+ *
224
+ * A Module Page is stored and addressed by `ownerModuleId` + `presetKey`, never by path: a revision scope
225
+ * of one carries no path at all, so looking it up by path finds nothing.
226
+ */
227
+ export function findPhiBuilderPageKeyFromPresetSource(source, pages) {
228
+ for (const node of pages) {
229
+ if (node.sourcePreset?.ownerModuleId === source.ownerModuleId &&
230
+ node.sourcePreset.presetKey === source.presetKey) {
231
+ return node.key;
232
+ }
233
+ const childKey = node.children ? findPhiBuilderPageKeyFromPresetSource(source, node.children) : null;
234
+ if (childKey) {
235
+ return childKey;
236
+ }
237
+ }
238
+ return null;
239
+ }
221
240
  export function resolvePhiBuilderPageKeyFromCatalogPath(area, path, pages) {
222
241
  const normalizedPath = normalizePhiBuilderCmsCatalogPath(path);
223
242
  const visit = (nodes) => {
@@ -67,16 +67,16 @@ export type PhiCmsPresetOverlayInput = {
67
67
  * What it decides is what differs between dialogs: its ids, its title and wiring, what extra the body
68
68
  * Layout carries (a form's label column, say), and its buttons. How the body and the actions look is the
69
69
  * one answer every dialog shares (`helpers/cms-dialog.ts`), so it is not an input. Nor is the width, as
70
- * long as the dialog can see the Form it holds: given `body.form`, it takes the width that Form needs
71
- * (`resolvePhiDialogFormWidth`); given none, `PHI_DIALOG_WIDTH`. A width in `config` is the caller's
72
- * own, for a table or an editor that needs more.
70
+ * long as the dialog can see the Form it holds: given `body.form`, its `size` takes the width that Form
71
+ * needs (`resolvePhiDialogFormWidth`); given none, `PHI_DIALOG_WIDTH`. A `size` in `config` is the
72
+ * caller's own, for a table or an editor that needs more, and replaces the pair whole.
73
73
  */
74
74
  export type PhiCmsPresetDialogInput = {
75
75
  id: PhiCmsInstanceId;
76
76
  bodyLayoutNodeId: PhiCmsInstanceId;
77
77
  sortOrder: number;
78
78
  label: string | null;
79
- /** The Overlay's config: title, mount and close policy, open action, routes. `width` follows `body.form`. */
79
+ /** The Overlay's config: title, mount and close policy, open action, routes. `size` follows `body.form`. */
80
80
  config: Record<string, unknown>;
81
81
  headerLayoutNodeId?: PhiCmsInstanceId | null;
82
82
  /**
@@ -82,7 +82,7 @@ function createPhiCmsPresetNodeSet(defaults) {
82
82
  config: { ...input.body?.config, ...PHI_DIALOG_BODY_CONFIG },
83
83
  });
84
84
  const form = input.body?.form;
85
- const config = { width: form ? resolvePhiDialogFormWidth(form.descriptor) : PHI_DIALOG_WIDTH, ...input.config };
85
+ const config = { size: { width: form ? resolvePhiDialogFormWidth(form.descriptor) : PHI_DIALOG_WIDTH }, ...input.config };
86
86
  const commands = input.commands;
87
87
  if (!commands) {
88
88
  return {
@@ -32,5 +32,5 @@ export type PhiCmsRegionOwnership = "shell" | "page";
32
32
  * know is not a placement anybody chose -- refusing it would hide Widgets over a typo.
33
33
  */
34
34
  export declare function phiCmsRegionAcceptsWidget(regionKey: string | null | undefined, required: PhiCmsRegionOwnership | null | undefined): boolean;
35
- export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined): 11 | 10 | 12 | 50 | 40 | 20 | 21 | 25 | 30 | 39 | 41;
35
+ export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined): 11 | 10 | 12 | 40 | 50 | 20 | 21 | 25 | 30 | 39 | 41;
36
36
  export declare function resolvePhiCmsRegionKey(regionType: number | null | undefined): "content" | "header_top" | "header_main" | "header_bottom" | "sider_left" | "sider_right" | "hero" | "footer_top" | "footer_main" | "footer_bottom" | "drawer_right" | undefined;
@@ -0,0 +1,12 @@
1
+ import { type PhiCountryCode } from "../constants/countries";
2
+ export type PhiCountryOption = {
3
+ value: PhiCountryCode;
4
+ label: string;
5
+ };
6
+ /**
7
+ * Every ISO 3166-1 country as an option named in the reader's language (`Intl.DisplayNames`, type
8
+ * `region`), sorted as that language sorts. A code the runtime has no name for is shown as the code.
9
+ * The locale is the page's (`usePhiIntlLocale`), never the browser's, so the server and the browser draw
10
+ * the same list.
11
+ */
12
+ export declare function listPhiCountryOptions(locale: string): PhiCountryOption[];
@@ -0,0 +1,14 @@
1
+ import { PHI_ISO_3166_ALPHA2_CODES } from "../constants/countries";
2
+ /**
3
+ * Every ISO 3166-1 country as an option named in the reader's language (`Intl.DisplayNames`, type
4
+ * `region`), sorted as that language sorts. A code the runtime has no name for is shown as the code.
5
+ * The locale is the page's (`usePhiIntlLocale`), never the browser's, so the server and the browser draw
6
+ * the same list.
7
+ */
8
+ export function listPhiCountryOptions(locale) {
9
+ const names = new Intl.DisplayNames([locale], { type: "region", fallback: "code" });
10
+ const collator = new Intl.Collator(locale);
11
+ return PHI_ISO_3166_ALPHA2_CODES
12
+ .map((code) => ({ value: code, label: names.of(code) ?? code }))
13
+ .sort((left, right) => collator.compare(left.label, right.label));
14
+ }
@@ -10,6 +10,13 @@ export declare function isPhiMinorAmount(value: unknown): value is string;
10
10
  * integer, which is how a row out of JSON often carries it. The answer is always the contract's shape.
11
11
  */
12
12
  export declare function readPhiMoneyValue(value: unknown): PhisPaymentMoney | null;
13
+ /**
14
+ * The amounts a value handed over as money holds, in its order, or `null` where it is none: one amount as
15
+ * `readPhiMoneyValue` reads it, or a price list as the `money` Form field holds one -- minor units per
16
+ * currency code (`{ CHF: "1990", GBP: "1590" }`), each a currency a payment accepts. A list with no entry,
17
+ * or with one entry that is not an amount, is none: half a price list drawn would read as the whole.
18
+ */
19
+ export declare function readPhiMoneyValues(value: unknown): readonly PhisPaymentMoney[] | null;
13
20
  /** `-1`, `0` or `1` as `left` is less than, equal to or more than `right`; both minor amounts. */
14
21
  export declare function comparePhiMinorAmounts(left: string, right: string): number;
15
22
  /**
@@ -40,6 +40,21 @@ export function readPhiMoneyValue(value) {
40
40
  const text = typeof minor === "number" && Number.isSafeInteger(minor) && minor >= 0 ? String(minor) : minor;
41
41
  return isPhiMinorAmount(text) ? { currency, minor: text } : null;
42
42
  }
43
+ /**
44
+ * The amounts a value handed over as money holds, in its order, or `null` where it is none: one amount as
45
+ * `readPhiMoneyValue` reads it, or a price list as the `money` Form field holds one -- minor units per
46
+ * currency code (`{ CHF: "1990", GBP: "1590" }`), each a currency a payment accepts. A list with no entry,
47
+ * or with one entry that is not an amount, is none: half a price list drawn would read as the whole.
48
+ */
49
+ export function readPhiMoneyValues(value) {
50
+ const one = readPhiMoneyValue(value);
51
+ if (one)
52
+ return [one];
53
+ if (typeof value !== "object" || value === null || Array.isArray(value))
54
+ return null;
55
+ const amounts = Object.entries(value).map(([currency, minor]) => readPhiMoneyValue({ currency, minor }));
56
+ return amounts.length > 0 && amounts.every((amount) => amount !== null) ? amounts : null;
57
+ }
43
58
  /** `-1`, `0` or `1` as `left` is less than, equal to or more than `right`; both minor amounts. */
44
59
  export function comparePhiMinorAmounts(left, right) {
45
60
  const difference = BigInt(left) - BigInt(right);
@@ -3,6 +3,36 @@ import type { PhiCmsAreaKey } from "../constants/cms-areas";
3
3
  import { type PhiAreaMeta } from "./cms-area-config";
4
4
  import type { PhiSignetHead } from "./phi-signet-head";
5
5
  import { type PhiPublicPageAddress } from "./phi-seo";
6
+ /**
7
+ * What the head says of a Site that has said nothing: neither the Page's description nor the Theme's
8
+ * slogan. Worded as the placeholder it is, so a link shared before anybody replaced it tells the operator
9
+ * where to.
10
+ */
11
+ export declare const PHI_DEFAULT_SITE_DESCRIPTION = "Default description of the phis starter. Set your own in the Page meta or as the Theme's slogan.";
12
+ /** The Site's description: the Theme's slogan, else the starter's placeholder. */
13
+ export declare function resolvePhiSiteDescription(slogan: string | null | undefined): string;
14
+ /** The picture of a link preview, resolved: its absolute address, its exact size and what it shows. */
15
+ export type PhiLinkPreviewImage = {
16
+ url: string;
17
+ width: number;
18
+ height: number;
19
+ alt: string;
20
+ type: string;
21
+ };
22
+ /**
23
+ * What a Public Page's link preview is built from, beside the Page's own title and description
24
+ * (NEXT_INTEGRATION.md, "Link previews").
25
+ */
26
+ export type PhiLinkPreviewInput = {
27
+ /** The record's preview title and description, where the Page is about a record whose Provider marks them. */
28
+ recordTitle?: string | null;
29
+ recordDescription?: string | null;
30
+ /** The Theme's slogan, the description where the Page states none. */
31
+ slogan?: string | null;
32
+ image?: PhiLinkPreviewImage | null;
33
+ /** `brand.xAccount`; stated as `twitter:site` only where it is an X account name. */
34
+ xAccount?: string | null;
35
+ };
6
36
  export type PhiMetadataScope = {
7
37
  title?: string | null;
8
38
  description?: string | null;
@@ -49,7 +79,7 @@ export declare function buildPhiRootMetadata(options?: PhiRootMetadataInput): Me
49
79
  * be indexed, because naming the preferred address of a Page that asks to stay out says nothing a
50
80
  * search engine can use, and an hreflang set pointing at it contradicts the sitemap that leaves it out.
51
81
  */
52
- export declare function buildPhiAreaPageMetadata({ area, meta, siteName, pageTitle, pageDescription, pageNoindex, publicAddress, }: {
82
+ export declare function buildPhiAreaPageMetadata({ area, meta, siteName, pageTitle, pageDescription, pageNoindex, publicAddress, linkPreview, }: {
53
83
  area: PhiCmsAreaKey;
54
84
  meta: PhiAreaMeta | null | undefined;
55
85
  siteName?: string | null;
@@ -58,4 +88,6 @@ export declare function buildPhiAreaPageMetadata({ area, meta, siteName, pageTit
58
88
  pageNoindex?: boolean | null;
59
89
  /** Where this Page lives. Only Public has such an address; elsewhere it is ignored. */
60
90
  publicAddress?: PhiPublicPageAddress | null;
91
+ /** What a link preview is built from; stated only for a Public Page with an address. */
92
+ linkPreview?: PhiLinkPreviewInput | null;
61
93
  }): Metadata;
@@ -1,5 +1,20 @@
1
1
  import { PHI_AREA_META_PUBLIC_DEFAULTS, PHI_AREA_TITLE_TEMPLATE_PLACEHOLDER, } from "./cms-area-config";
2
2
  import { buildPhiPublicPageAlternates } from "./phi-seo";
3
+ import { readPhiXAccount } from "../types/link-preview";
4
+ /**
5
+ * What the head says of a Site that has said nothing: neither the Page's description nor the Theme's
6
+ * slogan. Worded as the placeholder it is, so a link shared before anybody replaced it tells the operator
7
+ * where to.
8
+ */
9
+ export const PHI_DEFAULT_SITE_DESCRIPTION = "Default description of the phis starter. Set your own in the Page meta or as the Theme's slogan.";
10
+ /** The Site's description: the Theme's slogan, else the starter's placeholder. */
11
+ export function resolvePhiSiteDescription(slogan) {
12
+ return slogan?.trim() || PHI_DEFAULT_SITE_DESCRIPTION;
13
+ }
14
+ /** A Site locale as Open Graph spells it: `pt-BR` is `pt_BR`. */
15
+ function toPhiOpenGraphLocale(locale) {
16
+ return locale.replaceAll("-", "_");
17
+ }
3
18
  function resolveFirstText(...values) {
4
19
  for (const value of values) {
5
20
  const trimmed = value?.trim();
@@ -92,7 +107,7 @@ export function buildPhiRootMetadata(options = {}) {
92
107
  * be indexed, because naming the preferred address of a Page that asks to stay out says nothing a
93
108
  * search engine can use, and an hreflang set pointing at it contradicts the sitemap that leaves it out.
94
109
  */
95
- export function buildPhiAreaPageMetadata({ area, meta, siteName, pageTitle, pageDescription, pageNoindex, publicAddress, }) {
110
+ export function buildPhiAreaPageMetadata({ area, meta, siteName, pageTitle, pageDescription, pageNoindex, publicAddress, linkPreview, }) {
96
111
  const resolvedSiteName = resolveFirstText(siteName);
97
112
  const resolvedPageTitle = resolveFirstText(pageTitle);
98
113
  const template = resolveFirstText(meta?.titleTemplate);
@@ -114,10 +129,56 @@ export function buildPhiAreaPageMetadata({ area, meta, siteName, pageTitle, page
114
129
  && (meta?.index ?? PHI_AREA_META_PUBLIC_DEFAULTS.index)
115
130
  && pageNoindex !== true;
116
131
  const alternates = indexable && publicAddress ? buildPhiPublicPageAlternates(publicAddress) : null;
132
+ const preview = area === "public" && publicAddress && linkPreview
133
+ ? buildPhiLinkPreviewMetadata({
134
+ input: linkPreview,
135
+ address: publicAddress,
136
+ siteName: resolvedSiteName,
137
+ title: resolveFirstText(resolvedPageTitle, fallbackTitle),
138
+ description,
139
+ })
140
+ : null;
117
141
  return {
118
142
  ...(title ? { title: { absolute: title } } : {}),
119
143
  ...(description ? { description } : {}),
120
144
  ...(indexable ? {} : { robots: { index: false, follow: false } }),
121
145
  ...(alternates ? { alternates: { canonical: alternates.canonical, languages: alternates.languages } } : {}),
146
+ ...(preview ?? {}),
147
+ };
148
+ }
149
+ /**
150
+ * The Open Graph and X tags of one Public Page (NEXT_INTEGRATION.md, "Link previews").
151
+ *
152
+ * Said of every Public Page, indexable or not: a link is shared whether or not a search engine may file
153
+ * it. The title is the Page's own, without the template the tab title wears -- the preview names the Site
154
+ * beside it as `og:site_name` -- and a record the Page is about may answer title and description first.
155
+ * The description falls back as the Root's does: the Theme's slogan, then the starter's placeholder. X
156
+ * reads the Open Graph tags; what this states for it is the card, large with a picture, and the Site's
157
+ * account where the Theme names one. Next copies title, description and picture into `twitter:*` itself.
158
+ */
159
+ function buildPhiLinkPreviewMetadata({ input, address, siteName, title, description, }) {
160
+ const url = buildPhiPublicPageAlternates(address)?.canonical;
161
+ const image = input.image ?? null;
162
+ const xAccount = readPhiXAccount(input.xAccount);
163
+ const previewTitle = resolveFirstText(input.recordTitle, title, siteName);
164
+ return {
165
+ openGraph: {
166
+ type: "website",
167
+ ...(siteName ? { siteName } : {}),
168
+ ...(previewTitle ? { title: previewTitle } : {}),
169
+ description: resolveFirstText(input.recordDescription, description) ?? resolvePhiSiteDescription(input.slogan),
170
+ ...(url ? { url } : {}),
171
+ locale: toPhiOpenGraphLocale(address.locale),
172
+ alternateLocale: address.availableLocales
173
+ .filter((code) => code !== address.locale)
174
+ .map(toPhiOpenGraphLocale),
175
+ ...(image
176
+ ? { images: [{ url: image.url, width: image.width, height: image.height, alt: image.alt, type: image.type }] }
177
+ : {}),
178
+ },
179
+ twitter: {
180
+ card: image ? "summary_large_image" : "summary",
181
+ ...(xAccount ? { site: xAccount } : {}),
182
+ },
122
183
  };
123
184
  }
@@ -0,0 +1,34 @@
1
+ import type { PhiResolvedCmsPageTree } from "../types/cms";
2
+ import { type PhiTableProviderResourceDescriptor } from "../types/table-widget";
3
+ import type { PhiPresetTreeContractFinding } from "./preset-tree-contract-check";
4
+ import type { PhiRuntimeModuleDefinition } from "../types/cms-plugins";
5
+ /**
6
+ * Every Table of a preset tree, read as the Table reads itself in the browser before its first request
7
+ * (THIRD_PARTY_MODULES.md, "Checking a Page preset"): its binding to its Provider's resource
8
+ * (`validatePhiTableWidgetBinding`) and every icon its actions and binding tools name (`isPhiIconNameKnown`).
9
+ *
10
+ * In the browser a finding leaves the Widget unavailable -- no table at all, only a console warning --
11
+ * while the Page around it renders, so nobody sees it until somebody misses the table. A package runs this
12
+ * in its own tests over every tree its presets build, beside `checkPhiPresetTreeContract`, with every Table
13
+ * Provider it ships. A Table on a Provider not handed over is not judged.
14
+ *
15
+ * Verify-time only, and apart from the contract check on purpose: that one also runs while a Site serves
16
+ * a Page, where an unavailable Table stays one Widget and must not become a 500 for the whole Page.
17
+ */
18
+ export declare function checkPhiPresetTables(tree: PhiResolvedCmsPageTree, options: {
19
+ dataProviders: Iterable<PresetTreeTableProvider>;
20
+ }): PhiPresetTreeContractFinding[];
21
+ /** A Table Provider as a package declares it: its key and the resources a Table binds to. */
22
+ export type PresetTreeTableProvider = {
23
+ key: string;
24
+ resources?: readonly PhiTableProviderResourceDescriptor[];
25
+ };
26
+ /**
27
+ * Every Table a Module offers to Markdown (TABLES.md, "Tables in Markdown"), checked as a Preset's Table is
28
+ * above: its columns against its resource, and what makes it an embed -- no editor; pinned filters and
29
+ * parameters naming a filter field or binding field of the resource, with values a parameter can check;
30
+ * `maxRows` on a resource that pages; each required binding field fixed or settable. The catalog refuses
31
+ * the key, Provider, resource and access policy itself; this half needs the Table's own code, so it runs
32
+ * where Preset Tables are checked: a package's tests, and `validate-module-descriptors` here.
33
+ */
34
+ export declare function checkPhiEmbeddableTables(definition: Pick<PhiRuntimeModuleDefinition, "embeddableTables" | "dataProviders">): PhiPresetTreeContractFinding[];