@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
@@ -1,7 +1,8 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
+ import type { PhiControlSize } from "../../types/control";
2
3
  import type { PhiCmsMountPolicy } from "../../types/cms-mount-policy";
3
- import type { PhiCmsOverlaySize, PhiOverlayCloseSource, PhiOverlayMaskBehaviour } from "../../types/cms-overlay";
4
- import { type PhiResolvedResponsiveValue, type PhiResponsiveValue } from "../../types/responsive";
4
+ import type { PhiCmsOverlayConfig, PhiOverlayCloseSource, PhiOverlayMaskBehaviour } from "../../types/cms-overlay";
5
+ import type { PhiRenderableBlockSize } from "../../types/renderable-block";
5
6
  export type PhiOverlayControlDismissEvent = {
6
7
  target: EventTarget | null;
7
8
  key?: string;
@@ -55,26 +56,60 @@ export declare function resolvePhiOverlayMaskPresentation(mask: PhiOverlayMaskBe
55
56
  background?: string | undefined;
56
57
  };
57
58
  };
58
- export type PhiModalWidth = PhiCmsOverlaySize | PhiResponsiveValue<PhiCmsOverlaySize>;
59
- export type PhiModalResponsiveMode = keyof PhiResolvedResponsiveValue<unknown>;
60
59
  /**
61
- * Where a Modal's width switches from `compact` to `medium` and from `medium` to `wide`.
60
+ * An Overlay's geometry as a Control takes it: the block's own three pairs (`PhiCmsOverlayConfig`), one
61
+ * value per axis.
62
+ */
63
+ export type PhiOverlayControlGeometryProps = {
64
+ size?: PhiRenderableBlockSize | null;
65
+ minSize?: PhiRenderableBlockSize | null;
66
+ maxSize?: PhiRenderableBlockSize | null;
67
+ };
68
+ /** The width each `controlSize` step gives a Modal whose `size` names none. */
69
+ export declare const PHI_MODAL_WIDTH_BY_CONTROL_SIZE: Record<PhiControlSize, number>;
70
+ /** What a Modal draws of its geometry, as CSS: the dialog's width and box, and its container's height. */
71
+ export type PhiModalGeometry = {
72
+ /** Handed to the Modal as its width; undefined leaves it Ant Design's default. */
73
+ width: string | undefined;
74
+ minWidth: string | undefined;
75
+ maxWidth: string;
76
+ blockSize: string | undefined;
77
+ minBlockSize: string | undefined;
78
+ maxBlockSize: string;
79
+ };
80
+ /**
81
+ * A Modal's geometry, read once through the block's resolver.
62
82
  *
63
- * The container scale, the same pair the Form switches at, and not Ant Design's device breakpoints
64
- * (768/992): a Modal's box is the viewport it floats in, and a width stated per mode means "this much
65
- * room is there", which is the question the container scale answers.
83
+ * The width is the one a Signal told (`toldSize`, the `size` input), else the stated `size`, else the
84
+ * `controlSize` step; the height the told one, else the stated one, else none -- the Modal is as tall as
85
+ * its content up to the viewport. A minimum and a maximum are the stated ones, each held inside the
86
+ * viewport room, and with no maximum stated the viewport room is the maximum.
66
87
  */
67
- export declare const PHI_MODAL_RESPONSIVE_MIN_WIDTH: {
68
- readonly medium: 144 | 233 | 377 | 610 | 987;
69
- readonly wide: 144 | 233 | 377 | 610 | 987;
88
+ export declare function resolvePhiModalGeometry({ size, minSize, maxSize, toldSize, controlSize, }: PhiOverlayControlGeometryProps & {
89
+ toldSize?: PhiRenderableBlockSize | null;
90
+ controlSize?: PhiControlSize;
91
+ }): PhiModalGeometry;
92
+ /** What a Drawer draws of its geometry: the length along the axis it opens on, and its bounds. */
93
+ export type PhiDrawerGeometry = {
94
+ /**
95
+ * Handed to the Drawer as its `size`, a pixel length as a number (the Drawer warns on a string that is
96
+ * one); undefined leaves it Ant Design's default.
97
+ */
98
+ size: number | string | undefined;
99
+ /** How far a resizable Drawer may be dragged, where the stated maximum is in pixels. */
100
+ resizeMaxSize: number | undefined;
101
+ /** The bounds on the panel (`min-width`/`max-width`, or the height pair at `top` and `bottom`). */
102
+ style: CSSProperties;
70
103
  };
71
- export declare function resolvePhiModalResponsiveMode(availableWidth: number): PhiModalResponsiveMode;
72
104
  /**
73
- * The one width a Modal takes at one mode.
105
+ * A Drawer's geometry, read once through the block's resolver.
74
106
  *
75
- * A responsive width cascades like every responsive value (`resolvePhiResponsiveValue`): an unset mode
76
- * takes the nearest smaller one that is set, and a mode below every stated one takes `fallback` -- the
77
- * width `controlSize` gives, or none, which leaves the Modal its own default.
107
+ * A Drawer opens along one axis: `width` at `left` and `right`, `height` at `top` and `bottom`. The other
108
+ * axis is the viewport's, and what a config states for it is not drawn. The maximum reaches the panel as
109
+ * CSS whatever its unit, and Ant Design's resize as a limit only where it is in pixels, the one unit a
110
+ * drag counts in.
78
111
  */
79
- export declare function resolvePhiModalWidth(width: PhiModalWidth | undefined, fallback: PhiCmsOverlaySize | undefined, mode: PhiModalResponsiveMode): PhiCmsOverlaySize | undefined;
112
+ export declare function resolvePhiDrawerGeometry({ size, minSize, maxSize, placement, }: PhiOverlayControlGeometryProps & {
113
+ placement: PhiCmsOverlayConfig["placement"];
114
+ }): PhiDrawerGeometry;
80
115
  export declare function resolvePhiOverlayDismissSource(event: PhiOverlayControlDismissEvent): PhiOverlayCloseSource;
@@ -1,5 +1,5 @@
1
- import { PHI_CONTAINER_BREAKPOINT_COL3, PHI_CONTAINER_BREAKPOINT_CONTENT, } from "../../theme/phi-container-breakpoints";
2
- import { resolvePhiResponsiveValue, } from "../../types/responsive";
1
+ import { PHI_SPACE } from "../../theme/antd-css-var-contract";
2
+ import { resolvePhiRenderableBlockGeometry, } from "../../types/renderable-block-geometry";
3
3
  export const PHI_OVERLAY_DEFAULT_MASK = {
4
4
  appearance: "normal",
5
5
  allowOutsideInteraction: false,
@@ -36,41 +36,66 @@ export function resolvePhiOverlayMaskPresentation(mask) {
36
36
  },
37
37
  };
38
38
  }
39
+ /** The width each `controlSize` step gives a Modal whose `size` names none. */
40
+ export const PHI_MODAL_WIDTH_BY_CONTROL_SIZE = {
41
+ small: 520,
42
+ medium: 720,
43
+ large: 960,
44
+ };
39
45
  /**
40
- * Where a Modal's width switches from `compact` to `medium` and from `medium` to `wide`.
46
+ * The room a Modal never leaves: one `base` step clear of the viewport on both inline sides, one `lg`
47
+ * step on both block sides. Every stated length is held inside it, a minimum included, so a floor that
48
+ * keeps a Form in two columns on a desk does not push the dialog off a phone.
49
+ */
50
+ const PHI_MODAL_VIEWPORT_INLINE = `calc(100vw - ${PHI_SPACE.base} - ${PHI_SPACE.base})`;
51
+ const PHI_MODAL_VIEWPORT_BLOCK = `calc(100dvh - ${PHI_SPACE.lg} - ${PHI_SPACE.lg})`;
52
+ function withinViewport(length, viewport) {
53
+ return length == null ? undefined : `min(${length.css}, ${viewport})`;
54
+ }
55
+ /**
56
+ * A Modal's geometry, read once through the block's resolver.
41
57
  *
42
- * The container scale, the same pair the Form switches at, and not Ant Design's device breakpoints
43
- * (768/992): a Modal's box is the viewport it floats in, and a width stated per mode means "this much
44
- * room is there", which is the question the container scale answers.
58
+ * The width is the one a Signal told (`toldSize`, the `size` input), else the stated `size`, else the
59
+ * `controlSize` step; the height the told one, else the stated one, else none -- the Modal is as tall as
60
+ * its content up to the viewport. A minimum and a maximum are the stated ones, each held inside the
61
+ * viewport room, and with no maximum stated the viewport room is the maximum.
45
62
  */
46
- export const PHI_MODAL_RESPONSIVE_MIN_WIDTH = {
47
- medium: PHI_CONTAINER_BREAKPOINT_COL3,
48
- wide: PHI_CONTAINER_BREAKPOINT_CONTENT,
49
- };
50
- export function resolvePhiModalResponsiveMode(availableWidth) {
51
- if (availableWidth >= PHI_MODAL_RESPONSIVE_MIN_WIDTH.wide)
52
- return "wide";
53
- if (availableWidth >= PHI_MODAL_RESPONSIVE_MIN_WIDTH.medium)
54
- return "medium";
55
- return "compact";
63
+ export function resolvePhiModalGeometry({ size, minSize, maxSize, toldSize, controlSize, }) {
64
+ const stated = resolvePhiRenderableBlockGeometry({ size, minSize, maxSize });
65
+ const told = resolvePhiRenderableBlockGeometry({ size: toldSize });
66
+ const width = told.inline.size?.css
67
+ ?? stated.inline.size?.css
68
+ ?? (controlSize == null ? undefined : `${PHI_MODAL_WIDTH_BY_CONTROL_SIZE[controlSize]}px`);
69
+ return {
70
+ width,
71
+ minWidth: withinViewport(stated.inline.min, PHI_MODAL_VIEWPORT_INLINE),
72
+ maxWidth: withinViewport(stated.inline.max, PHI_MODAL_VIEWPORT_INLINE) ?? PHI_MODAL_VIEWPORT_INLINE,
73
+ blockSize: told.block.size?.css ?? stated.block.size?.css,
74
+ minBlockSize: withinViewport(stated.block.min, PHI_MODAL_VIEWPORT_BLOCK),
75
+ maxBlockSize: withinViewport(stated.block.max, PHI_MODAL_VIEWPORT_BLOCK) ?? PHI_MODAL_VIEWPORT_BLOCK,
76
+ };
56
77
  }
57
78
  /**
58
- * The one width a Modal takes at one mode.
79
+ * A Drawer's geometry, read once through the block's resolver.
59
80
  *
60
- * A responsive width cascades like every responsive value (`resolvePhiResponsiveValue`): an unset mode
61
- * takes the nearest smaller one that is set, and a mode below every stated one takes `fallback` -- the
62
- * width `controlSize` gives, or none, which leaves the Modal its own default.
81
+ * A Drawer opens along one axis: `width` at `left` and `right`, `height` at `top` and `bottom`. The other
82
+ * axis is the viewport's, and what a config states for it is not drawn. The maximum reaches the panel as
83
+ * CSS whatever its unit, and Ant Design's resize as a limit only where it is in pixels, the one unit a
84
+ * drag counts in.
63
85
  */
64
- export function resolvePhiModalWidth(width, fallback, mode) {
65
- if (width == null)
66
- return fallback;
67
- if (typeof width !== "object")
68
- return width;
69
- return resolvePhiResponsiveValue(width, {
70
- compact: fallback,
71
- medium: fallback,
72
- wide: fallback,
73
- })[mode];
86
+ export function resolvePhiDrawerGeometry({ size, minSize, maxSize, placement, }) {
87
+ const geometry = resolvePhiRenderableBlockGeometry({ size, minSize, maxSize });
88
+ const horizontal = placement === "left" || placement === "right";
89
+ const axis = horizontal ? geometry.inline : geometry.block;
90
+ const min = axis.min?.css;
91
+ const max = axis.max?.css;
92
+ return {
93
+ size: axis.size?.part?.unit === "px" ? axis.size.part.value : axis.size?.css,
94
+ resizeMaxSize: axis.max?.part?.unit === "px" ? axis.max.part.value : undefined,
95
+ style: horizontal
96
+ ? { ...(min == null ? null : { minWidth: min }), ...(max == null ? null : { maxWidth: max }) }
97
+ : { ...(min == null ? null : { minHeight: min }), ...(max == null ? null : { maxHeight: max }) },
98
+ };
74
99
  }
75
100
  export function resolvePhiOverlayDismissSource(event) {
76
101
  if ("key" in event && event.key === "Escape")
@@ -0,0 +1,21 @@
1
+ import { type PhiRevealOnceDialogLabels } from "./phi-reveal-once-dialog-labels";
2
+ /** Writes the value to the clipboard: true where it was written, false where the browser refused. */
3
+ export declare function copyPhiRevealedValue(value: string, clipboard?: Pick<Clipboard, "writeText"> | undefined): Promise<boolean>;
4
+ export type PhiRevealOnceDialogControlProps = {
5
+ /** The value shown once -- a new key's activation code. Null closes the Dialog. */
6
+ value: string | null;
7
+ title: string;
8
+ /** What the reader is told about it: that it is shown only now. */
9
+ description?: string;
10
+ labels?: Partial<PhiRevealOnceDialogLabels>;
11
+ /** Called when the Dialog closes, copied or not; the caller forgets the value then. */
12
+ onClose: () => void;
13
+ };
14
+ /**
15
+ * A value shown once, in a Dialog that copies it and closes: the answer of an act whose result is not kept
16
+ * anywhere it could be read again -- an activation code stored as its hash. The value stands in a code
17
+ * box the reader can select; "Copy and close" writes it to the clipboard and closes, and where the browser
18
+ * refuses, the Dialog stays open and says so. Nothing here keeps the value: the caller holds it until
19
+ * `onClose` and drops it then.
20
+ */
21
+ export declare function PhiRevealOnceDialogControl({ value, title, description, labels, onClose, }: PhiRevealOnceDialogControlProps): import("react").JSX.Element;
@@ -0,0 +1,52 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { PhiDialogControl } from "./phi-dialog-control";
5
+ import { PhiTypographyControl } from "./phi-typography-control";
6
+ import { PhiIcon } from "../shell/phi-icon";
7
+ import { PHI_REVEAL_ONCE_DIALOG_DEFAULT_LABELS } from "./phi-reveal-once-dialog-labels";
8
+ /** Writes the value to the clipboard: true where it was written, false where the browser refused. */
9
+ export async function copyPhiRevealedValue(value, clipboard = typeof navigator === "undefined" ? undefined : navigator.clipboard) {
10
+ if (!clipboard)
11
+ return false;
12
+ try {
13
+ await clipboard.writeText(value);
14
+ return true;
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }
20
+ /**
21
+ * A value shown once, in a Dialog that copies it and closes: the answer of an act whose result is not kept
22
+ * anywhere it could be read again -- an activation code stored as its hash. The value stands in a code
23
+ * box the reader can select; "Copy and close" writes it to the clipboard and closes, and where the browser
24
+ * refuses, the Dialog stays open and says so. Nothing here keeps the value: the caller holds it until
25
+ * `onClose` and drops it then.
26
+ */
27
+ export function PhiRevealOnceDialogControl({ value, title, description, labels, onClose, }) {
28
+ const words = { ...PHI_REVEAL_ONCE_DIALOG_DEFAULT_LABELS, ...labels };
29
+ const [failed, setFailed] = useState(false);
30
+ const close = () => {
31
+ setFailed(false);
32
+ onClose();
33
+ };
34
+ const copyAndClose = async () => {
35
+ if (value == null)
36
+ return;
37
+ if (await copyPhiRevealedValue(value))
38
+ close();
39
+ else
40
+ setFailed(true);
41
+ };
42
+ return (_jsxs(PhiDialogControl, { open: value != null, title: title, alert: failed ? { level: "warning", showIcon: true, title: words.copyFailed } : null, actions: [
43
+ { key: "close", label: words.close, onClick: close },
44
+ {
45
+ key: "copy",
46
+ label: words.copyAndClose,
47
+ type: "primary",
48
+ icon: _jsx(PhiIcon, { name: "copy", size: "inherit" }),
49
+ onClick: () => void copyAndClose(),
50
+ },
51
+ ], onDismiss: close, children: [description ? _jsx(PhiTypographyControl, { type: "secondary", children: description }) : null, _jsx(PhiTypographyControl, { code: true, style: { fontSize: "1.25em", userSelect: "all", wordBreak: "break-all" }, children: value ?? "" })] }));
52
+ }
@@ -0,0 +1,10 @@
1
+ /** The words of `PhiRevealOnceDialogControl`, apart from it so a server Label Set can name them. */
2
+ export type PhiRevealOnceDialogLabels = {
3
+ /** The primary button: copies the value and closes. */
4
+ copyAndClose: string;
5
+ /** Closes without copying. */
6
+ close: string;
7
+ /** Said where the browser refused the copy; the value stays on screen to be selected by hand. */
8
+ copyFailed: string;
9
+ };
10
+ export declare const PHI_REVEAL_ONCE_DIALOG_DEFAULT_LABELS: PhiRevealOnceDialogLabels;
@@ -0,0 +1,5 @@
1
+ export const PHI_REVEAL_ONCE_DIALOG_DEFAULT_LABELS = {
2
+ copyAndClose: "Copy and close",
3
+ close: "Close",
4
+ copyFailed: "The value could not be copied. Select it and copy it by hand before closing.",
5
+ };
@@ -1,4 +1,4 @@
1
- import type { ComponentType } from "react";
1
+ import { type ComponentType } from "react";
2
2
  import type { PhiFormFieldProviderProps } from "./form-provider-registry";
3
3
  export declare const PhiSliderFormControl: ComponentType<PhiFormFieldProviderProps>;
4
4
  export declare const PhiCascaderFormControl: ComponentType<PhiFormFieldProviderProps>;
@@ -1,12 +1,13 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect } from "react";
3
4
  import { PhiCascaderControl } from "../controls/phi-cascader-control";
4
5
  import { PhiFlexControl } from "../controls/phi-flex-control";
5
6
  import { PhiMoneyControl } from "../controls/phi-money-control";
6
7
  import { PhiNumberControl } from "../controls/phi-number-control";
7
8
  import { PhiSliderControl } from "../controls/phi-slider-control";
8
9
  import { resolvePhiFormText } from "./form-descriptor-contract";
9
- import { readPhiMoneyFieldAmount, readPhiMoneyFieldAmounts, readPhiMoneyFieldConfig, updatePhiMoneyFieldAmounts, } from "./money-field";
10
+ import { readPhiMoneyFieldAmount, readPhiMoneyFieldAmounts, readPhiMoneyFieldConfig, readPhiMoneyFieldLinkedCurrency, readPhiMoneyFieldOptionCurrencies, updatePhiMoneyFieldAmounts, } from "./money-field";
10
11
  import { usePhiIntlLocale } from "../root/phi-intl-locale";
11
12
  import { PHI_STORAGE_SIZE_UNIT_LABEL, phiBytesToStorageSize, phiStorageSizeToBytes, } from "./storage-size";
12
13
  /**
@@ -65,14 +66,29 @@ export const PhiStorageSizeFormControl = ({ id, value, onChange, placeholder, di
65
66
  * the conversion is the Control's, on the digits (`helpers/money-amount.ts`), and a handler reads the
66
67
  * contract's money and nothing else. The shapes and the config are `money-field.ts`.
67
68
  */
68
- export const PhiMoneyFormControl = ({ id, field, value, onChange, label, placeholder, disabled, readOnly, }) => {
69
+ export const PhiMoneyFormControl = ({ id, field, value, onChange, label, placeholder, disabled, readOnly, options, formValues, }) => {
69
70
  const locale = usePhiIntlLocale();
70
- const config = readPhiMoneyFieldConfig(field.config);
71
- const { currency, currencies, min, max } = config;
72
- if (currency !== undefined) {
73
- return (_jsx(PhiMoneyControl, { id: id, value: readPhiMoneyFieldAmount(value, currency)?.minor ?? null, currency: currency, locale: locale, min: min, max: max, placeholder: placeholder, disabled: disabled, readOnly: readOnly, style: { width: "100%" }, onChange: (minor) => onChange?.(minor === null ? null : { currency, minor }) }));
71
+ const config = readPhiMoneyFieldConfig(field.config, { hasOptionsProvider: field.optionsProvider !== undefined });
72
+ const { currencies, currenciesFromOptions, currencyField, min, max } = config;
73
+ const currency = currencyField === undefined ? config.currency : readPhiMoneyFieldLinkedCurrency(currencyField, formValues);
74
+ /*
75
+ * An amount the value holds in another currency than the one its field now names was entered for the
76
+ * old one: it is no price in the new one, so it is shown empty and cleared, as a dependent choice is
77
+ * when its parent changes. Only a `currencyField` amount can get there; a fixed currency that does not
78
+ * match is a record that does not fit the Form and throws below.
79
+ */
80
+ const stale = currencyField !== undefined && value != null
81
+ && !(typeof value === "object" && value.currency === currency);
82
+ useEffect(() => {
83
+ if (stale)
84
+ onChange?.(null);
85
+ }, [onChange, stale]);
86
+ if (currencyField !== undefined && currency === null)
87
+ return null;
88
+ if (currency !== undefined && currency !== null) {
89
+ return (_jsx(PhiMoneyControl, { id: id, value: stale ? null : readPhiMoneyFieldAmount(value, currency)?.minor ?? null, currency: currency, locale: locale, min: min, max: max, placeholder: placeholder, disabled: disabled, readOnly: readOnly, style: { width: "100%" }, onChange: (minor) => onChange?.(minor === null ? null : { currency, minor }) }));
74
90
  }
75
- const list = currencies ?? [];
91
+ const list = currenciesFromOptions ? readPhiMoneyFieldOptionCurrencies(options, value) : currencies ?? [];
76
92
  const amounts = readPhiMoneyFieldAmounts(value, list);
77
93
  return (_jsx(PhiFlexControl, { vertical: true, gap: "small", children: list.map((entry, index) => (_jsx(PhiMoneyControl, {
78
94
  // The field's label names the first input; each one after it is named by the label and its currency.
@@ -0,0 +1,22 @@
1
+ import type { PhiControlOption } from "../controls/phi-control-options";
2
+ /**
3
+ * The `flags` field: several yes-or-no answers held as one bit-flag number, the shape every yes-or-no
4
+ * state of a Core contract has. Each option's `value` is its bit, written as the decimal number
5
+ * (`"1"`, `"2"`, `"4"`, ...); the value is the sum of the bits checked, `0` for none. `config.requires`
6
+ * names, by option value, the option an option needs: it is offered only while that one is checked and
7
+ * is cleared when it is unchecked -- a default only for a purpose the address has.
8
+ */
9
+ export type PhiFlagsFieldConfig = {
10
+ bits: ReadonlyMap<string, number>;
11
+ requires: ReadonlyMap<number, number>;
12
+ };
13
+ /** The field's bits and dependencies, or an Error naming what is wrong: a field nobody can read the value of is refused. */
14
+ export declare function readPhiFlagsFieldConfig(config: Readonly<Record<string, unknown>> | undefined, options: readonly Pick<PhiControlOption, "value">[]): PhiFlagsFieldConfig;
15
+ /** The value as a number of the field's bits: anything else is none, and bits it does not offer are kept. */
16
+ export declare function readPhiFlagsFieldValue(value: unknown): number;
17
+ /**
18
+ * The value after a change of the checked options: the bits of those checked set, the field's other bits
19
+ * cleared, an option whose required one is not set cleared with it, and bits the field does not offer
20
+ * kept as they were.
21
+ */
22
+ export declare function writePhiFlagsFieldValue(config: PhiFlagsFieldConfig, previous: number, checked: readonly string[]): number;
@@ -0,0 +1,58 @@
1
+ import { isPhiRecord } from "../../helpers/is-record";
2
+ function readBit(value, where) {
3
+ const bit = /^[1-9][0-9]*$/u.test(value) ? Number(value) : Number.NaN;
4
+ if (!Number.isSafeInteger(bit) || (bit & (bit - 1)) !== 0) {
5
+ throw new Error(`The flags field ${where} "${value}" is no bit: an option's value is a power of two as a decimal number.`);
6
+ }
7
+ return bit;
8
+ }
9
+ /** The field's bits and dependencies, or an Error naming what is wrong: a field nobody can read the value of is refused. */
10
+ export function readPhiFlagsFieldConfig(config, options) {
11
+ const bits = new Map();
12
+ let all = 0;
13
+ for (const option of options) {
14
+ const bit = readBit(option.value, "option");
15
+ if ((all & bit) !== 0)
16
+ throw new Error(`The flags field names the bit ${bit} twice.`);
17
+ all |= bit;
18
+ bits.set(option.value, bit);
19
+ }
20
+ const requires = new Map();
21
+ const stated = config?.requires;
22
+ if (stated !== undefined) {
23
+ if (!isPhiRecord(stated)) {
24
+ throw new Error("The flags field's requires is no map of option values.");
25
+ }
26
+ for (const [dependent, needed] of Object.entries(stated)) {
27
+ const dependentBit = bits.get(dependent);
28
+ const neededBit = typeof needed === "string" ? bits.get(needed) : undefined;
29
+ if (dependentBit === undefined || neededBit === undefined || dependentBit === neededBit) {
30
+ throw new Error(`The flags field's requires names "${dependent}" -> "${String(needed)}", which are not two of its options.`);
31
+ }
32
+ requires.set(dependentBit, neededBit);
33
+ }
34
+ }
35
+ return { bits, requires };
36
+ }
37
+ /** The value as a number of the field's bits: anything else is none, and bits it does not offer are kept. */
38
+ export function readPhiFlagsFieldValue(value) {
39
+ return Number.isSafeInteger(value) && value >= 0 ? value : 0;
40
+ }
41
+ /**
42
+ * The value after a change of the checked options: the bits of those checked set, the field's other bits
43
+ * cleared, an option whose required one is not set cleared with it, and bits the field does not offer
44
+ * kept as they were.
45
+ */
46
+ export function writePhiFlagsFieldValue(config, previous, checked) {
47
+ let offered = 0;
48
+ for (const bit of config.bits.values())
49
+ offered |= bit;
50
+ let next = previous & ~offered;
51
+ for (const value of checked)
52
+ next |= config.bits.get(value) ?? 0;
53
+ for (const [dependent, needed] of config.requires) {
54
+ if ((next & needed) === 0)
55
+ next &= ~dependent;
56
+ }
57
+ return next;
58
+ }
@@ -0,0 +1,20 @@
1
+ import type { PhiFormFieldDescriptor } from "../../types/form-descriptor";
2
+ /**
3
+ * The fields whose chosen option an `optionFlag` condition of the Form reads, by key.
4
+ *
5
+ * Only these report their option's flags upward: every other field's options stay its own business, so
6
+ * a Form without such a condition renders exactly as before.
7
+ */
8
+ export declare function collectFormOptionFlagFieldKeys(fields: readonly PhiFormFieldDescriptor[]): ReadonlySet<string>;
9
+ /**
10
+ * The flags of what a field holds, among the options it offers: every chosen option's `flags` together,
11
+ * 0 for a field that holds nothing.
12
+ *
13
+ * `undefined` where a held value is among none of the options -- the list still loading, or a value the
14
+ * answer left out -- because then nobody knows what was chosen, and an `optionFlag` condition on it is
15
+ * unavailable rather than false.
16
+ */
17
+ export declare function resolveFormChosenOptionFlags(options: readonly {
18
+ value: string | number;
19
+ flags?: number;
20
+ }[] | null | undefined, held: unknown): number | undefined;
@@ -0,0 +1,38 @@
1
+ import { collectPhiRuntimeValueConditions } from "../../types/runtime-condition";
2
+ /**
3
+ * The fields whose chosen option an `optionFlag` condition of the Form reads, by key.
4
+ *
5
+ * Only these report their option's flags upward: every other field's options stay its own business, so
6
+ * a Form without such a condition renders exactly as before.
7
+ */
8
+ export function collectFormOptionFlagFieldKeys(fields) {
9
+ const keys = new Set();
10
+ for (const field of fields) {
11
+ for (const expression of [field.visibleWhen, field.disabledWhen]) {
12
+ for (const condition of collectPhiRuntimeValueConditions(expression)) {
13
+ if (condition.operator === "optionFlag")
14
+ keys.add(condition.valuePath);
15
+ }
16
+ }
17
+ }
18
+ return keys;
19
+ }
20
+ /**
21
+ * The flags of what a field holds, among the options it offers: every chosen option's `flags` together,
22
+ * 0 for a field that holds nothing.
23
+ *
24
+ * `undefined` where a held value is among none of the options -- the list still loading, or a value the
25
+ * answer left out -- because then nobody knows what was chosen, and an `optionFlag` condition on it is
26
+ * unavailable rather than false.
27
+ */
28
+ export function resolveFormChosenOptionFlags(options, held) {
29
+ const values = (Array.isArray(held) ? held : [held]).filter((entry) => (typeof entry === "string" && entry !== "") || (typeof entry === "number" && Number.isFinite(entry)));
30
+ let flags = 0;
31
+ for (const value of values) {
32
+ const option = options?.find((entry) => entry.value === value);
33
+ if (!option)
34
+ return undefined;
35
+ flags |= option.flags ?? 0;
36
+ }
37
+ return flags;
38
+ }
@@ -25,6 +25,9 @@ export declare const PHI_FORM_FIELD_PROVIDER_KEYS: {
25
25
  readonly upload: `${string}/${string}`;
26
26
  readonly linkTarget: `${string}/${string}`;
27
27
  readonly money: `${string}/${string}`;
28
+ readonly country: `${string}/${string}`;
29
+ readonly address: `${string}/${string}`;
30
+ readonly flags: `${string}/${string}`;
28
31
  };
29
32
  export declare const PHI_AUTH_FORM_FIELD_PROVIDER_KEYS: {
30
33
  readonly termsConsent: `${string}/${string}`;
@@ -411,6 +414,11 @@ export declare const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS: readonly [
411
414
  value: string;
412
415
  label: string;
413
416
  }[];
417
+ }, {
418
+ readonly key: "currencyField";
419
+ readonly type: "string";
420
+ readonly label: "Currency field";
421
+ readonly description: "The key of the field whose value is the currency of one amount, instead of a fixed currency.";
414
422
  }, {
415
423
  readonly key: "currencies";
416
424
  readonly type: "choice";
@@ -437,6 +445,26 @@ export declare const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS: readonly [
437
445
  readonly min: 0;
438
446
  readonly precision: 0;
439
447
  }];
448
+ }, {
449
+ readonly key: `${string}/${string}`;
450
+ readonly title: "Country";
451
+ readonly valueType: "string";
452
+ readonly presentation: "control";
453
+ readonly settingsFields: readonly [{
454
+ readonly key: "allowClear";
455
+ readonly type: "boolean";
456
+ readonly label: "Allow clear";
457
+ }];
458
+ }, {
459
+ readonly key: `${string}/${string}`;
460
+ readonly title: "Address";
461
+ readonly valueType: "json";
462
+ readonly presentation: "control";
463
+ }, {
464
+ readonly key: `${string}/${string}`;
465
+ readonly title: "Flags";
466
+ readonly valueType: "number";
467
+ readonly presentation: "control";
440
468
  }];
441
469
  export declare const PHI_SHARED_FORM_VALIDATION_PROVIDER_DESCRIPTORS: readonly [{
442
470
  readonly key: `${string}/${string}`;
@@ -36,6 +36,9 @@ export const PHI_FORM_FIELD_PROVIDER_KEYS = {
36
36
  upload: PHI_FORM_UPLOAD_FIELD_PROVIDER_KEY,
37
37
  linkTarget: createPhiSharedFormProviderKey("field", "link-target"),
38
38
  money: createPhiSharedFormProviderKey("field", "money"),
39
+ country: createPhiSharedFormProviderKey("field", "country"),
40
+ address: createPhiSharedFormProviderKey("field", "address"),
41
+ flags: createPhiSharedFormProviderKey("field", "flags"),
39
42
  };
40
43
  export const PHI_AUTH_FORM_FIELD_PROVIDER_KEYS = {
41
44
  termsConsent: createPhiSharedFormProviderKey("field", "auth-terms-consent"),
@@ -273,8 +276,9 @@ export const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS = [
273
276
  /*
274
277
  * An amount of money: minor units in the value, major units on screen beside the currency's code.
275
278
  * `json`, because the value is the contract's money (`{ currency, minor }`) for one `currency`, or a
276
- * price list (`{ CHF: "1990" }`) for several `currencies` -- see `money-field.ts`. `min` and `max`
277
- * are minor units.
279
+ * price list (`{ CHF: "1990" }`) for several `currencies`, or for the currencies an `optionsProvider`
280
+ * answers; one amount's currency may be another field's value (`currencyField`) -- see
281
+ * `money-field.ts`. `min` and `max` are minor units.
278
282
  */
279
283
  {
280
284
  key: PHI_FORM_FIELD_PROVIDER_KEYS.money,
@@ -291,6 +295,12 @@ export const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS = [
291
295
  description: "The currency of one amount.",
292
296
  options: PHI_MONEY_CURRENCY_OPTIONS,
293
297
  },
298
+ {
299
+ key: "currencyField",
300
+ type: "string",
301
+ label: "Currency field",
302
+ description: "The key of the field whose value is the currency of one amount, instead of a fixed currency.",
303
+ },
294
304
  {
295
305
  key: "currencies",
296
306
  type: "choice",
@@ -304,6 +314,39 @@ export const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS = [
304
314
  { key: "max", type: "number", label: "Maximum", description: "In minor units.", min: 0, precision: 0 },
305
315
  ],
306
316
  },
317
+ /*
318
+ * A country of ISO 3166-1: the value is its alpha-2 code, uppercase, as Core stores an address's
319
+ * country; the options are named in the reader's language (`helpers/country-names.ts`) and searchable.
320
+ */
321
+ {
322
+ key: PHI_FORM_FIELD_PROVIDER_KEYS.country,
323
+ title: "Country",
324
+ valueType: "string",
325
+ presentation: "control",
326
+ settingsFields: [{ key: "allowClear", type: "boolean", label: "Allow clear" }],
327
+ },
328
+ /*
329
+ * One postal address as Core writes it (`PhisSiteAddressInput` of `@phis/contracts/users`): `json`, the
330
+ * parts in one object, an empty optional part `null`. The field holds each part to what Core takes
331
+ * (`helpers/address-field.ts`) and reads its words from the Form's Label Set
332
+ * (`PHI_FORM_ADDRESS_LABEL_KEYS`).
333
+ */
334
+ {
335
+ key: PHI_FORM_FIELD_PROVIDER_KEYS.address,
336
+ title: "Address",
337
+ valueType: "json",
338
+ presentation: "control",
339
+ },
340
+ /*
341
+ * Several yes-or-no answers as one bit-flag number: each option's value is its bit as a decimal number,
342
+ * `config.requires` an option another needs (`flags-field.ts`).
343
+ */
344
+ {
345
+ key: PHI_FORM_FIELD_PROVIDER_KEYS.flags,
346
+ title: "Flags",
347
+ valueType: "number",
348
+ presentation: "control",
349
+ },
307
350
  ];
308
351
  export const PHI_SHARED_FORM_VALIDATION_PROVIDER_DESCRIPTORS = [
309
352
  { key: PHI_FORM_VALIDATION_PROVIDER_KEYS.required, title: "Required" },
@@ -33,9 +33,19 @@ export type PhiFormFieldProviderProps = {
33
33
  * shows if somebody submits anyway; `null` releases it. For a value that only arrives later -- an
34
34
  * upload whose Asset id comes once the body is there. A submit while a hold stands does not reach
35
35
  * the handler: it fails the way a rule fails, on this field and through `onValidationFailed`.
36
+ *
37
+ * A field whose parts each say what is wrong with them (the address) passes `onRefused`: a refused
38
+ * submit then calls it instead of writing the sentence under the whole field, so no part's sentence
39
+ * stands a second time below the last part.
36
40
  */
37
- holdSubmit(fieldKey: string, reason: string | null): void;
41
+ holdSubmit(fieldKey: string, reason: string | null, onRefused?: () => void): void;
38
42
  };
43
+ /**
44
+ * The live values of the fields this Form watches -- those a `visibleWhen`, `disabledWhen` or options
45
+ * dependency reads, and a money field's `currencyField` -- for a field whose own drawing follows a
46
+ * sibling. Only those keys: any other is absent, however it is filled.
47
+ */
48
+ formValues?: Readonly<Record<string, unknown>>;
39
49
  /** What the Widget was placed with, for text a field takes from its placement rather than its form. */
40
50
  formConfig?: Readonly<Record<string, unknown>>;
41
51
  /**