@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
@@ -0,0 +1,124 @@
1
+ import { PhiCmsWidgetType } from "../constants/cms-widget-types";
2
+ import { isPhiIconNameKnown } from "../components/shell/phi-icon-names";
3
+ import { validatePhiTableWidgetBinding, } from "../types/table-widget";
4
+ /**
5
+ * Every Table of a preset tree, read as the Table reads itself in the browser before its first request
6
+ * (THIRD_PARTY_MODULES.md, "Checking a Page preset"): its binding to its Provider's resource
7
+ * (`validatePhiTableWidgetBinding`) and every icon its actions and binding tools name (`isPhiIconNameKnown`).
8
+ *
9
+ * In the browser a finding leaves the Widget unavailable -- no table at all, only a console warning --
10
+ * while the Page around it renders, so nobody sees it until somebody misses the table. A package runs this
11
+ * in its own tests over every tree its presets build, beside `checkPhiPresetTreeContract`, with every Table
12
+ * Provider it ships. A Table on a Provider not handed over is not judged.
13
+ *
14
+ * Verify-time only, and apart from the contract check on purpose: that one also runs while a Site serves
15
+ * a Page, where an unavailable Table stays one Widget and must not become a 500 for the whole Page.
16
+ */
17
+ export function checkPhiPresetTables(tree, options) {
18
+ const findings = [];
19
+ checkTables(tree, options.dataProviders, (node, message) => findings.push({ node, message }));
20
+ return findings;
21
+ }
22
+ function checkTables(tree, dataProviders, report) {
23
+ const providers = new Map([...dataProviders].map((provider) => [provider.key, provider]));
24
+ for (const widget of tree.contentWidgets) {
25
+ if (widget.widgetType !== PhiCmsWidgetType.Table)
26
+ continue;
27
+ // The config as the preset wrote it, which is what the Table receives: a preset states the whole shape.
28
+ const config = widget.config;
29
+ const source = config.source;
30
+ const provider = source?.providerKey ? providers.get(source.providerKey) : undefined;
31
+ if (!source || !provider)
32
+ continue;
33
+ const resource = provider.resources?.find((candidate) => candidate.resourceKey === source.resourceKey);
34
+ if (!resource) {
35
+ report(widget.id, `Table is bound to resource "${source.resourceKey}", which "${provider.key}" does not declare.`);
36
+ continue;
37
+ }
38
+ for (const error of validatePhiTableWidgetBinding(config, resource))
39
+ report(widget.id, error);
40
+ const actions = [
41
+ ...(config.features?.actions?.toolbar ?? []),
42
+ ...(config.features?.actions?.row ?? []),
43
+ ...(config.features?.actions?.bulk ?? []),
44
+ ];
45
+ for (const action of actions) {
46
+ if (action.display !== "label" && action.icon && !isPhiIconNameKnown(action.icon.trim())) {
47
+ report(widget.id, `Table action "${action.key}" names the icon "${action.icon}", which PhiIcon does not know.`);
48
+ }
49
+ }
50
+ for (const tool of config.features?.tools?.bindingFields ?? []) {
51
+ if (tool.create?.display !== "label" && tool.create?.icon && !isPhiIconNameKnown(tool.create.icon.trim())) {
52
+ report(widget.id, `Table binding field "${tool.key}" names the create icon "${tool.create.icon}", which PhiIcon does not know.`);
53
+ }
54
+ }
55
+ }
56
+ }
57
+ const hasStaticOptions = (field) => (field.options?.length ?? 0) > 0 && !field.optionsProvider;
58
+ /**
59
+ * Every Table a Module offers to Markdown (TABLES.md, "Tables in Markdown"), checked as a Preset's Table is
60
+ * above: its columns against its resource, and what makes it an embed -- no editor; pinned filters and
61
+ * parameters naming a filter field or binding field of the resource, with values a parameter can check;
62
+ * `maxRows` on a resource that pages; each required binding field fixed or settable. The catalog refuses
63
+ * the key, Provider, resource and access policy itself; this half needs the Table's own code, so it runs
64
+ * where Preset Tables are checked: a package's tests, and `validate-module-descriptors` here.
65
+ */
66
+ export function checkPhiEmbeddableTables(definition) {
67
+ const findings = [];
68
+ for (const embed of definition.embeddableTables ?? []) {
69
+ const report = (message) => findings.push({ node: embed.key, message });
70
+ const provider = definition.dataProviders?.find((candidate) => candidate.key === embed.source.providerKey);
71
+ const resource = provider?.kind === "table"
72
+ ? provider.resources.find((candidate) => candidate.resourceKey === embed.source.resourceKey)
73
+ : undefined;
74
+ if (!resource) {
75
+ report("reads a resource no table Provider of this Module declares.");
76
+ continue;
77
+ }
78
+ const { query, bindingFields = [], fields } = resource;
79
+ const pager = embed.maxRows || query.pagination === "none" ? { pagination: { enabled: false } } : {};
80
+ const config = { presentation: embed.presentation, features: pager, source: embed.source };
81
+ validatePhiTableWidgetBinding(config, resource).forEach(report);
82
+ if (!embed.title?.trim())
83
+ report("needs a title.");
84
+ if (embed.presentation.columns.some((column) => column.editor))
85
+ report("has a column editor; an embedded Table is read-only.");
86
+ const filterFields = new Set(query.filterFields ?? []);
87
+ for (const key of Object.keys(embed.fixedFilters ?? {})) {
88
+ if (!filterFields.has(key))
89
+ report(`pins "${key}", which is no filter field of the resource.`);
90
+ }
91
+ if (embed.maxRows !== undefined && (!Number.isInteger(embed.maxRows) || embed.maxRows < 1 || embed.maxRows > 100)) {
92
+ report("needs maxRows from 1 to 100.");
93
+ }
94
+ else if (embed.maxRows !== undefined && query.pagination !== "offset" && query.pagination !== "cursor") {
95
+ report("has maxRows, which needs a resource that pages.");
96
+ }
97
+ const params = Object.entries(embed.params ?? {});
98
+ const fixed = (key) => Object.hasOwn(embed.source.params ?? {}, key);
99
+ for (const field of bindingFields) {
100
+ if (field.required && field.defaultValue === undefined && !fixed(field.key) &&
101
+ !params.some(([, param]) => "binding" in param && param.binding === field.key)) {
102
+ report(`leaves the required binding field "${field.key}" open.`);
103
+ }
104
+ }
105
+ const targets = new Set();
106
+ for (const [name, param] of params) {
107
+ const key = "binding" in param ? param.binding : param.filter;
108
+ const field = "binding" in param ? bindingFields.find((candidate) => candidate.key === key) : fields.find((candidate) => candidate.key === key);
109
+ const problem = !/^[A-Za-z][A-Za-z0-9_-]*$/u.test(name) ? "is no parameter name"
110
+ : targets.has(`${"binding" in param}:${key}`) ? "sets what another parameter sets"
111
+ : !field || ("filter" in param && !filterFields.has(key)) ? `names "${key}", which the resource does not declare for this`
112
+ : "binding" in param ? fixed(key) ? `binds "${key}", which the source fixes` : null
113
+ : Object.hasOwn(embed.fixedFilters ?? {}, key) ? `filters by "${key}", which a fixed filter pins`
114
+ : !["string", "number", "boolean", "enum"].includes(field.type) ? `filters by a ${field.type} field`
115
+ : null;
116
+ targets.add(`${"binding" in param}:${key}`);
117
+ if (problem)
118
+ report(`parameter "${name}" ${problem}.`);
119
+ else if (field?.type === "enum" && !hasStaticOptions(field))
120
+ report(`parameter "${name}" needs choices it can check, not a Provider's.`);
121
+ }
122
+ }
123
+ return findings;
124
+ }
@@ -12,7 +12,10 @@ import type { PhiResolvedCmsPageTree } from "../types/cms";
12
12
  * own package does not run it: every word in its Pages is the Site's, which is what no marker means.
13
13
  *
14
14
  * It reads the config as stated, by the field names alone (`helpers/config-text-fields.ts`), so it needs
15
- * no Widget definition: a text under a text's name, at the top or inside a list's entries.
15
+ * no Widget definition: a text under a text's name, at the top, inside a list's entries or inside a nested
16
+ * object -- a Table's `presentation.columns[].title`, `features.filters[].label` and
17
+ * `presentation.emptyState.title` are words as much as a Button's label. A Table whose texts come from the
18
+ * Module's Label Set, already in the reader's language, says so with `NoTranslate` on its node.
16
19
  */
17
20
  export type PhiPresetTextSourceFinding = {
18
21
  /** The node's label, or its id where it has none. */
@@ -3,7 +3,7 @@ import { readPhiTextSource } from "./text-source";
3
3
  import { PhiCmsFlags } from "../constants/phi-cms";
4
4
  import { hasPhiFlag } from "./flags";
5
5
  function findTextKey(value, depth = 0) {
6
- if (depth > 4 || value == null || typeof value !== "object")
6
+ if (depth > 6 || value == null || typeof value !== "object")
7
7
  return null;
8
8
  if (Array.isArray(value)) {
9
9
  for (const item of value) {
@@ -21,6 +21,11 @@ function findTextKey(value, depth = 0) {
21
21
  if (found)
22
22
  return `${key}[].${found}`;
23
23
  }
24
+ else if (entry !== null && typeof entry === "object") {
25
+ const found = findTextKey(entry, depth + 1);
26
+ if (found)
27
+ return `${key}.${found}`;
28
+ }
24
29
  }
25
30
  return null;
26
31
  }
@@ -10,8 +10,9 @@ import type { PhiCmsPageNode, PhiResolvedCmsPageTree } from "../types/cms";
10
10
  *
11
11
  * The rules: every node a preset instance id, none twice, every parent, Region root, Overlay root and Page
12
12
  * root resolved; the base page layout node only as the canonical scaffold; an actions Footer the canonical
13
- * Flex preset; a modal's body and actions the dialog's (`helpers/cms-dialog.ts`), and a modal at the default
14
- * `PHI_DIALOG_WIDTH` not holding only Forms of one column; a Form's or a record Widget's title from its
13
+ * Flex preset; an Overlay's geometry the block's pairs, never `width` or one bare length; a modal's body
14
+ * and actions the dialog's (`helpers/cms-dialog.ts`), and a modal at the default `PHI_DIALOG_WIDTH` not
15
+ * holding only Forms of one column; a Form's or a record Widget's title from its
15
16
  * record read, sent, and heard where it goes. The findings come in the order the compiler used to throw them, so its first is the
16
17
  * error it always gave.
17
18
  *
@@ -4,6 +4,7 @@ import { PhiCmsWidgetType } from "../constants/cms-widget-types";
4
4
  import { isPhiCmsInstanceId, readPhiCmsInstanceIdDescriptor } from "../types/cms-instance-id";
5
5
  import { PHI_DIALOG_BLEED_BODY_CONFIG, PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH, isPhiFormSingleColumn, } from "./cms-dialog";
6
6
  import { resolvePhiLayoutCreationPreset } from "./cms-layout-defaults";
7
+ import { isPhiRecord } from "./is-record";
7
8
  import { PHI_FORM_RECORD_TITLE_CAPABILITY, readPhiFormWidgetTitleFromRecord, } from "../components/forms/form-record-title";
8
9
  import { readPhiRecordWidgetTitleFromRecord } from "./record-widget";
9
10
  function stablePresetNodeJson(value) {
@@ -106,6 +107,7 @@ export function checkPhiPresetTreeContract(tree, options = {}) {
106
107
  }
107
108
  }
108
109
  for (const overlay of tree.overlays) {
110
+ checkOverlayGeometry(overlay, report);
109
111
  if (overlay.overlayType !== "modal")
110
112
  continue;
111
113
  const body = layoutsById.get(overlay.bodyLayoutNodeId);
@@ -182,14 +184,37 @@ function checkDialogCommands(overlayId, footerLayoutId, widgets, report) {
182
184
  }
183
185
  }
184
186
  }
187
+ /** The keys an Overlay states its geometry in: the block's three pairs. */
188
+ const PHI_OVERLAY_GEOMETRY_KEYS = ["size", "minSize", "maxSize"];
189
+ /*
190
+ * An Overlay is sized like a block: `size`, `minSize` and `maxSize`, each a `{ width?, height? }` pair
191
+ * (OVERLAYS.md, "Presentation config"). The Modal's `width` and the Drawer's single length are gone, and
192
+ * nothing reads them -- so a preset still writing either would open a dialog at a width nobody chose,
193
+ * with nothing said. Refused instead, with the spelling that replaces it. A bare length is refused too,
194
+ * although the block reader takes it as a width: a Drawer at the top or bottom opens along its height,
195
+ * and a bare `size: 377` there is the old single length meaning the wrong axis.
196
+ */
197
+ function checkOverlayGeometry(overlay, report) {
198
+ if (overlay.config.width !== undefined) {
199
+ report(overlay.id, `Preset Overlay "${overlay.id}" states \`width\`; an Overlay is sized like a block. ` +
200
+ "State `size: { width }` (a dialog: `size: { width: PHI_DIALOG_WIDTH_SINGLE_COLUMN }`), and a viewport limit as `maxSize`.");
201
+ }
202
+ for (const key of PHI_OVERLAY_GEOMETRY_KEYS) {
203
+ const value = overlay.config[key];
204
+ if (value != null && !isPhiRecord(value)) {
205
+ report(overlay.id, `Preset Overlay "${overlay.id}" states \`${key}\` as one length; state the pair, \`${key}: { width }\` or \`${key}: { height }\`.`);
206
+ }
207
+ }
208
+ }
185
209
  /*
186
210
  * A dialog is as wide as its Form needs (`helpers/cms-dialog.ts`): one column takes
187
- * `PHI_DIALOG_WIDTH_SINGLE_COLUMN`, two keep `PHI_DIALOG_WIDTH`. What is refused is the one width a Preset
188
- * did not choose -- the default, holding nothing but Forms of one column. Any other width was stated, by a
189
- * caller that knows what else the body holds; a Form the caller cannot see is not judged.
211
+ * `PHI_DIALOG_WIDTH_SINGLE_COLUMN`, two keep `PHI_DIALOG_WIDTH`, either as the width of the Overlay's
212
+ * `size`. What is refused is the one width a Preset did not choose -- the default, holding nothing but
213
+ * Forms of one column. Any other width was stated, by a caller that knows what else the body holds; a
214
+ * Form the caller cannot see is not judged.
190
215
  */
191
216
  function checkDialogWidth(overlay, tree, forms, report) {
192
- if (stablePresetNodeJson(overlay.config.width) !== stablePresetNodeJson(PHI_DIALOG_WIDTH))
217
+ if (stablePresetNodeJson(overlay.config.size) !== stablePresetNodeJson({ width: PHI_DIALOG_WIDTH }))
193
218
  return;
194
219
  const bodyLayoutIds = new Set([overlay.bodyLayoutNodeId]);
195
220
  for (let grown = true; grown;) {
@@ -209,7 +234,7 @@ function checkDialogWidth(overlay, tree, forms, report) {
209
234
  const descriptors = formIds.map((formId) => (typeof formId === "string" ? forms.get(formId) : undefined)?.descriptor);
210
235
  if (descriptors.every((descriptor) => descriptor != null && isPhiFormSingleColumn(descriptor))) {
211
236
  report(overlay.id, `Preset Overlay "${overlay.id}" holds the one-column Form "${String(formIds[0])}" at the full dialog width ` +
212
- "(PHI_DIALOG_WIDTH). Hand the Form to `dialog` as `body.form`, or state `width: PHI_DIALOG_WIDTH_SINGLE_COLUMN`.");
237
+ "(PHI_DIALOG_WIDTH). Hand the Form to `dialog` as `body.form`, or state `size: { width: PHI_DIALOG_WIDTH_SINGLE_COLUMN }`.");
213
238
  }
214
239
  }
215
240
  function readRoutes(config, side) {
@@ -35,6 +35,13 @@ export type PhiPublicRoutePathCollision = {
35
35
  /** The address contested: the assignment this Site already made, or the declared path. */
36
36
  path: string;
37
37
  heldBy: PhiPublicRouteAddressHolder;
38
+ /**
39
+ * How the two addresses meet: the same address, or one beneath the other -- a Page and a folder at once
40
+ * (`isPhiRouteAddressBeneath`, THIRD_PARTY_MODULES.md "Addresses and folders").
41
+ */
42
+ relation: "same" | "beneath" | "above";
43
+ /** The holder's address: `path` itself, or the one above or beneath it. */
44
+ heldPath: string;
38
45
  };
39
46
  /**
40
47
  * The address a route answers on: what this Site assigned it, or what it declared.
@@ -62,7 +69,8 @@ export declare function buildPhiPublicRouteAddressMap({ claims, activeModuleIds,
62
69
  }[];
63
70
  }): Map<string, PhiPublicRouteAddressHolder>;
64
71
  /**
65
- * The addresses a Module could not have if it were switched on now.
72
+ * The addresses a Module could not have if it were switched on now: one another holder answers on, or one
73
+ * beneath or above another holder's -- a Site Page's or another Module's route.
66
74
  *
67
75
  * `/` is left out on purpose: it is an application for the Area root slot, not a route of the Module's
68
76
  * own, and several applicants are a list to choose from rather than a conflict.
@@ -1,3 +1,4 @@
1
+ import { isPhiRouteAddressBeneath } from "./route-address-check";
1
2
  function buildPhiPublicRouteIdentity(ownerModuleId, presetKey) {
2
3
  return `${ownerModuleId}/${presetKey}`;
3
4
  }
@@ -38,7 +39,8 @@ export function buildPhiPublicRouteAddressMap({ claims, activeModuleIds, assignm
38
39
  return addresses;
39
40
  }
40
41
  /**
41
- * The addresses a Module could not have if it were switched on now.
42
+ * The addresses a Module could not have if it were switched on now: one another holder answers on, or one
43
+ * beneath or above another holder's -- a Site Page's or another Module's route.
42
44
  *
43
45
  * `/` is left out on purpose: it is an application for the Area root slot, not a route of the Module's
44
46
  * own, and several applicants are a list to choose from rather than a conflict.
@@ -50,9 +52,27 @@ export function findPhiPublicRoutePathCollisions({ moduleId, claims, addresses,
50
52
  continue;
51
53
  }
52
54
  const path = resolvePhiPublicRoutePath(claim, assignments);
55
+ const foreign = (holder) => !(holder.kind === "module" && holder.claim.ownerModuleId === moduleId);
53
56
  const heldBy = addresses.get(path);
54
- if (heldBy && !(heldBy.kind === "module" && heldBy.claim.ownerModuleId === moduleId)) {
55
- collisions.push({ claim, path, heldBy });
57
+ if (heldBy && foreign(heldBy)) {
58
+ collisions.push({ claim, path, heldBy, relation: "same", heldPath: path });
59
+ continue;
60
+ }
61
+ /*
62
+ * An address that is free can still lie beneath another one, or above it: a route assigned
63
+ * `/contracts/terms` under a Site Page `/contracts` makes that Page a folder, which equality alone
64
+ * never saw.
65
+ */
66
+ for (const [heldPath, holder] of addresses) {
67
+ if (!foreign(holder))
68
+ continue;
69
+ const relation = isPhiRouteAddressBeneath(heldPath, path)
70
+ ? "beneath"
71
+ : isPhiRouteAddressBeneath(path, heldPath) ? "above" : null;
72
+ if (relation) {
73
+ collisions.push({ claim, path, heldBy: holder, relation, heldPath });
74
+ break;
75
+ }
56
76
  }
57
77
  }
58
78
  return collisions;
@@ -1,13 +1,9 @@
1
+ import { type PHI_RECORD_TEXT_FIELD_KINDS } from "../constants/record-field-kinds";
1
2
  import type { PhiRuntimeModuleCatalogEntry } from "../types/cms-plugins";
2
3
  import type { PhiRuntimeDataProviderKey } from "../types/runtime-data-provider";
3
4
  import type { PhiRecordDeclaration, PhiRecordField, PhiRecordFieldKind, PhiRecordFieldValueByKind } from "../types/record-provider";
4
5
  /** `value` as a field of `kind`, or `undefined` where it is not one. */
5
6
  export declare function readPhiRecordFieldValue<K extends PhiRecordFieldKind>(kind: K, value: unknown): PhiRecordFieldValueByKind[K] | undefined;
6
- /**
7
- * The kinds a line of text can show: a text as it is, a number, a date and an amount of money in the
8
- * page's language.
9
- */
10
- export declare const PHI_RECORD_TEXT_FIELD_KINDS: readonly ["text", "number", "date", "money"];
11
7
  /**
12
8
  * A text, number, date or money field as the words a page shows, written for `locale`; a date on the
13
9
  * calendar of the Site's `timeZone`, as every other date the page shows (`formatPhiDate`).
@@ -1,4 +1,6 @@
1
1
  import { formatPhisMoney } from "@phis/contracts/payments";
2
+ import { PHI_RECORD_MARKDOWN_KNOWN_FLAGS } from "../constants/record-field-kinds";
3
+ import { isPhiRuntimeModuleSourceLocale } from "../types/runtime-module-locale";
2
4
  import { formatPhiDate } from "./format-date-time";
3
5
  import { isPhiMinorAmount, readPhiCurrencyExponent } from "./money-amount";
4
6
  /*
@@ -43,6 +45,17 @@ function readLink(value) {
43
45
  return undefined;
44
46
  return typeof value.label === "string" && value.label ? { href, label: value.label } : { href };
45
47
  }
48
+ /** A text, the locale key it is written in, and flags of no other bits than `PhiRecordMarkdownFlag` names. */
49
+ function readMarkdown(value) {
50
+ if (!isRecord(value) || typeof value.text !== "string" || !isPhiRuntimeModuleSourceLocale(value.sourceLocale)) {
51
+ return undefined;
52
+ }
53
+ const { flags } = value;
54
+ if (typeof flags !== "number" || !Number.isInteger(flags) || flags < 0 || (flags & ~PHI_RECORD_MARKDOWN_KNOWN_FLAGS) !== 0) {
55
+ return undefined;
56
+ }
57
+ return { text: value.text, sourceLocale: value.sourceLocale.trim(), flags };
58
+ }
46
59
  /** The contract's money exactly: a currency a payment accepts and `minor` as an integer string. */
47
60
  function readMoney(value) {
48
61
  if (!isRecord(value) || typeof value.currency !== "string" || readPhiCurrencyExponent(value.currency) === undefined) {
@@ -59,8 +72,9 @@ function readAll(value, read) {
59
72
  export function readPhiRecordFieldValue(kind, value) {
60
73
  switch (kind) {
61
74
  case "text":
62
- case "markdown":
63
75
  return typeof value === "string" ? value : undefined;
76
+ case "markdown":
77
+ return readMarkdown(value);
64
78
  case "picture":
65
79
  return readPicture(value);
66
80
  case "pictures":
@@ -79,11 +93,6 @@ export function readPhiRecordFieldValue(kind, value) {
79
93
  return readLink(value);
80
94
  }
81
95
  }
82
- /**
83
- * The kinds a line of text can show: a text as it is, a number, a date and an amount of money in the
84
- * page's language.
85
- */
86
- export const PHI_RECORD_TEXT_FIELD_KINDS = ["text", "number", "date", "money"];
87
96
  /**
88
97
  * A text, number, date or money field as the words a page shows, written for `locale`; a date on the
89
98
  * calendar of the Site's `timeZone`, as every other date the page shows (`formatPhiDate`).
@@ -17,8 +17,12 @@ import type { PhiCmsAreaKey } from "../constants/cms-areas";
17
17
  * Compared by segment, a parameter by its name like any other segment: `/shop/:slug` and `/shop/cart`
18
18
  * are siblings. `/` is the Area's root slot and no folder.
19
19
  *
20
- * Verify-time only, from `@phis/ui/module/page-check`: a package runs it over its own routes, and
21
- * phis-ui over the first-party ones. The Site's own Pages are refused by phis-server when written.
20
+ * From `@phis/ui/module/page-check`: a package runs it over its own routes, and phis-ui over the
21
+ * first-party ones. `refusePhiCatalogRouteAddresses` is the same rule over a compiled catalog, every
22
+ * installed package's routes together: the descriptor compiler refuses a catalog that breaks it, so an
23
+ * installed package that does is refused. The addresses a Site assigns on
24
+ * Public are held to it in the Builder (`findPhiPublicRoutePathCollisions`). The Site's own Pages are
25
+ * refused by phis-server when written.
22
26
  */
23
27
  export type PhiRouteAddressSubject = {
24
28
  area: PhiCmsAreaKey;
@@ -32,4 +36,20 @@ export type PhiRouteAddressFinding = {
32
36
  above: string;
33
37
  message: string;
34
38
  };
39
+ /**
40
+ * Whether `lowerPath` lies beneath `upperPath` so that the upper one would be a Page and a folder at once:
41
+ * by segment, `/` never above anything, a list's entries -- one parameter directly beneath -- excepted.
42
+ */
43
+ export declare function isPhiRouteAddressBeneath(upperPath: string, lowerPath: string): boolean;
35
44
  export declare function checkPhiRouteAddresses(routes: readonly PhiRouteAddressSubject[]): PhiRouteAddressFinding[];
45
+ /** Every route of a compiled catalog as the rule reads it, Area by Area. */
46
+ export declare function listPhiCatalogRouteAddressSubjects(routesByArea: ReadonlyMap<PhiCmsAreaKey, readonly {
47
+ descriptor: PhiRouteAddressSubject;
48
+ }[]>): PhiRouteAddressSubject[];
49
+ /**
50
+ * The rule over a compiled catalog, as compiling it would refuse it: throws naming every route that lies
51
+ * beneath another of its Area, whichever packages the two come from.
52
+ */
53
+ export declare function refusePhiCatalogRouteAddresses(routesByArea: ReadonlyMap<PhiCmsAreaKey, readonly {
54
+ descriptor: PhiRouteAddressSubject;
55
+ }[]>): void;
@@ -1,20 +1,27 @@
1
1
  function segments(path) {
2
2
  return path.split("/").filter(Boolean);
3
3
  }
4
+ /**
5
+ * Whether `lowerPath` lies beneath `upperPath` so that the upper one would be a Page and a folder at once:
6
+ * by segment, `/` never above anything, a list's entries -- one parameter directly beneath -- excepted.
7
+ */
8
+ export function isPhiRouteAddressBeneath(upperPath, lowerPath) {
9
+ const upper = segments(upperPath);
10
+ const own = segments(lowerPath);
11
+ if (upper.length === 0 || upper.length >= own.length)
12
+ return false;
13
+ if (!upper.every((segment, index) => segment === own[index]))
14
+ return false;
15
+ // A list's entries, one parameter directly beneath it.
16
+ return !(own.length === upper.length + 1 && own[own.length - 1].startsWith(":"));
17
+ }
4
18
  export function checkPhiRouteAddresses(routes) {
5
19
  const findings = [];
6
20
  for (const route of routes) {
7
- const own = segments(route.path);
8
21
  for (const other of routes) {
9
22
  if (other === route || other.area !== route.area)
10
23
  continue;
11
- const upper = segments(other.path);
12
- if (upper.length === 0 || upper.length >= own.length)
13
- continue;
14
- if (!upper.every((segment, index) => segment === own[index]))
15
- continue;
16
- // A list's entries, one parameter directly beneath it.
17
- if (own.length === upper.length + 1 && own[own.length - 1].startsWith(":"))
24
+ if (!isPhiRouteAddressBeneath(other.path, route.path))
18
25
  continue;
19
26
  findings.push({
20
27
  route: route.presetKey,
@@ -26,3 +33,17 @@ export function checkPhiRouteAddresses(routes) {
26
33
  }
27
34
  return findings;
28
35
  }
36
+ /** Every route of a compiled catalog as the rule reads it, Area by Area. */
37
+ export function listPhiCatalogRouteAddressSubjects(routesByArea) {
38
+ return [...routesByArea.values()].flatMap((routes) => routes.map(({ descriptor }) => ({ area: descriptor.area, path: descriptor.path, presetKey: descriptor.presetKey })));
39
+ }
40
+ /**
41
+ * The rule over a compiled catalog, as compiling it would refuse it: throws naming every route that lies
42
+ * beneath another of its Area, whichever packages the two come from.
43
+ */
44
+ export function refusePhiCatalogRouteAddresses(routesByArea) {
45
+ const findings = checkPhiRouteAddresses(listPhiCatalogRouteAddressSubjects(routesByArea));
46
+ if (findings.length > 0) {
47
+ throw new Error(`Module routes break the address rule:\n- ${findings.map((finding) => finding.message).join("\n- ")}`);
48
+ }
49
+ }
@@ -0,0 +1,23 @@
1
+ /** The parts of an address a person writes (`PhisSiteAddressInput`), in the order a form asks them. */
2
+ export declare const PHI_SITE_ADDRESS_TEXT_KEYS: readonly ["companyName", "name", "line1", "line2", "postalCode", "city", "region", "country"];
3
+ /**
4
+ * One address of a Site's book (`PhisSiteAddress`) as a Table and an edit Form read it: its parts, one by
5
+ * one and as the `address` field's value, the flags as four marks, as tags and as the number, and the parts
6
+ * after the name on one line. Only the purposes and
7
+ * defaults are read off the flags; Core lists no `Superseded` or `Removed` address to an account or a
8
+ * customer file. Shared by the account's own addresses and staff's customer file.
9
+ */
10
+ export declare function toPhiSiteAddressRow(address: Record<string, unknown>): {
11
+ createdAt: {} | null;
12
+ flags: number;
13
+ billing: boolean;
14
+ shipping: boolean;
15
+ defaultBilling: boolean;
16
+ defaultShipping: boolean;
17
+ address: {
18
+ [k: string]: string | null;
19
+ };
20
+ lines: string;
21
+ purposes: ("billing" | "shipping" | "defaultBilling" | "defaultShipping")[];
22
+ id: unknown;
23
+ };
@@ -0,0 +1,36 @@
1
+ import { PhisSiteAddressFlags } from "@phis/contracts/users";
2
+ /** The parts of an address a person writes (`PhisSiteAddressInput`), in the order a form asks them. */
3
+ export const PHI_SITE_ADDRESS_TEXT_KEYS = ["companyName", "name", "line1", "line2", "postalCode", "city", "region", "country"];
4
+ function text(value) {
5
+ return typeof value === "string" && value.trim() ? value.trim() : null;
6
+ }
7
+ /**
8
+ * One address of a Site's book (`PhisSiteAddress`) as a Table and an edit Form read it: its parts, one by
9
+ * one and as the `address` field's value, the flags as four marks, as tags and as the number, and the parts
10
+ * after the name on one line. Only the purposes and
11
+ * defaults are read off the flags; Core lists no `Superseded` or `Removed` address to an account or a
12
+ * customer file. Shared by the account's own addresses and staff's customer file.
13
+ */
14
+ export function toPhiSiteAddressRow(address) {
15
+ const flags = typeof address.flags === "number" ? address.flags : 0;
16
+ const has = (bit) => (flags & bit) !== 0;
17
+ const marks = {
18
+ billing: has(PhisSiteAddressFlags.Billing),
19
+ shipping: has(PhisSiteAddressFlags.Shipping),
20
+ defaultBilling: has(PhisSiteAddressFlags.DefaultBilling),
21
+ defaultShipping: has(PhisSiteAddressFlags.DefaultShipping),
22
+ };
23
+ const place = [text(address.postalCode), text(address.city)].filter(Boolean).join(" ");
24
+ return {
25
+ id: address.id,
26
+ ...Object.fromEntries(PHI_SITE_ADDRESS_TEXT_KEYS.map((key) => [key, text(address[key]) ?? ""])),
27
+ // The parts as one value, as the `address` Form field holds them: an edit Form opens on it.
28
+ address: Object.fromEntries(PHI_SITE_ADDRESS_TEXT_KEYS.map((key) => [key, text(address[key])])),
29
+ lines: [text(address.companyName), text(address.line1), text(address.line2), place || null, text(address.region), text(address.country)]
30
+ .filter(Boolean).join(", "),
31
+ purposes: Object.keys(marks).filter((key) => marks[key]),
32
+ ...marks,
33
+ createdAt: address.createdAt ?? null,
34
+ flags,
35
+ };
36
+ }
@@ -50,8 +50,15 @@ export type PhiSurfaceStyleOptions = {
50
50
  */
51
51
  groundLayer?: boolean;
52
52
  };
53
- /** The ground a toned Surface paints where it states none: the container ground of the tone's mode. */
53
+ /** The ground a `light` or `dark` Surface paints where it states none: the container ground of the tone's mode. */
54
54
  export declare const PHI_SURFACE_TONE_GROUND = "var(--phi-color-bg-container)";
55
+ /**
56
+ * The ground a toned Surface paints where it states none (`phiSurfaceTakesToneGround`): an `inverse` one
57
+ * stands on the Theme's Inverse Ground (THEME.md "Ground"), which is that mode's container ground unless
58
+ * the Theme states another; `light` and `dark` on their mode's container ground. Both resolve under the
59
+ * tone's class the box carries.
60
+ */
61
+ export declare function resolvePhiSurfaceToneGround(tone: PhiSurface["tone"] | null | undefined): string;
55
62
  /**
56
63
  * Whether a Surface takes its tone's ground (`PHI_SURFACE_TONE_GROUND`): it asks for a mode of its own and
57
64
  * its Background paints nothing. A stated ground wins, and the Theme's Overlay (`base.kind: "theme"`) is
@@ -1,11 +1,21 @@
1
1
  import { PHI_BACKGROUND_CONTAINER_GROUND, normalizePhiBackgroundWidgetConfig, phiBackgroundWidgetConfigPaintsGround, resolvePhiBackgroundGroundFilter, resolvePhiBackgroundMotion, resolvePhiBackgroundMotionHostStyle, resolvePhiBackgroundWidgetStyle, } from "../components/widgets/config/background";
2
+ import { PHI_INVERSE_GROUND } from "../theme/phi-theme-inverse-ground";
2
3
  import { resolvePhiCmsBorderSource } from "../types/cms-border-source";
3
4
  import { resolvePhiSurfaceToneClassName } from "../types/surface";
4
5
  import { resolvePhiSourcedBorderStyle } from "./border-widget-style";
5
6
  import { composePhiModePaint, resolvePhiModeValue } from "./mode-paint";
6
7
  import { combinePhiBoxShadows, resolvePhiShadow } from "./layout-style";
7
- /** The ground a toned Surface paints where it states none: the container ground of the tone's mode. */
8
+ /** The ground a `light` or `dark` Surface paints where it states none: the container ground of the tone's mode. */
8
9
  export const PHI_SURFACE_TONE_GROUND = PHI_BACKGROUND_CONTAINER_GROUND;
10
+ /**
11
+ * The ground a toned Surface paints where it states none (`phiSurfaceTakesToneGround`): an `inverse` one
12
+ * stands on the Theme's Inverse Ground (THEME.md "Ground"), which is that mode's container ground unless
13
+ * the Theme states another; `light` and `dark` on their mode's container ground. Both resolve under the
14
+ * tone's class the box carries.
15
+ */
16
+ export function resolvePhiSurfaceToneGround(tone) {
17
+ return tone === "inverse" ? PHI_INVERSE_GROUND : PHI_SURFACE_TONE_GROUND;
18
+ }
9
19
  /**
10
20
  * Whether a Surface takes its tone's ground (`PHI_SURFACE_TONE_GROUND`): it asks for a mode of its own and
11
21
  * its Background paints nothing. A stated ground wins, and the Theme's Overlay (`base.kind: "theme"`) is
@@ -93,7 +103,7 @@ export function resolvePhiSurfaceStyle(surface, options = {}) {
93
103
  return {
94
104
  style: {
95
105
  ...hostPaint,
96
- ...(toneGround ? { backgroundColor: PHI_SURFACE_TONE_GROUND } : {}),
106
+ ...(toneGround ? { backgroundColor: resolvePhiSurfaceToneGround(surface.tone) } : {}),
97
107
  ...(line == null ? {} : { border: line }),
98
108
  ...resolvePhiSurfaceCorners(options.cornerFallback, configuredCorners),
99
109
  ...(boxShadow == null ? {} : { boxShadow }),
@@ -0,0 +1,20 @@
1
+ /**
2
+ * What a cell shows and what a condition reads, neither of which is a flag.
3
+ *
4
+ * `state` is the name a badge draws and `archived` and `locked` the answers a row action asks for; the
5
+ * enum values are strings because that is what an enum column and a condition compare against. The
6
+ * status itself stays on the row, because the filter above is written against what the route takes.
7
+ *
8
+ * One badge, so one state wins: archived over everything, then unread -- a message waiting to be read is
9
+ * what the reader acts on, and a lock is read in the conversation once it is open -- then locked.
10
+ *
11
+ * Foundation, because two listings read Core's inbox rows: Core's thread inbox and the threads Module's
12
+ * customer file.
13
+ */
14
+ export declare function readPhiThreadInboxRow(row: Record<string, unknown>): {
15
+ kind: string;
16
+ status: string;
17
+ archived: boolean;
18
+ locked: boolean;
19
+ state: string;
20
+ };
@@ -0,0 +1,26 @@
1
+ import { PhisThreadFlag, PhisThreadStatus } from "../constants/threads";
2
+ /**
3
+ * What a cell shows and what a condition reads, neither of which is a flag.
4
+ *
5
+ * `state` is the name a badge draws and `archived` and `locked` the answers a row action asks for; the
6
+ * enum values are strings because that is what an enum column and a condition compare against. The
7
+ * status itself stays on the row, because the filter above is written against what the route takes.
8
+ *
9
+ * One badge, so one state wins: archived over everything, then unread -- a message waiting to be read is
10
+ * what the reader acts on, and a lock is read in the conversation once it is open -- then locked.
11
+ *
12
+ * Foundation, because two listings read Core's inbox rows: Core's thread inbox and the threads Module's
13
+ * customer file.
14
+ */
15
+ export function readPhiThreadInboxRow(row) {
16
+ const archived = row.status === PhisThreadStatus.Archived;
17
+ const locked = typeof row.flags === "number" && (row.flags & PhisThreadFlag.Locked) !== 0;
18
+ return {
19
+ ...row,
20
+ kind: String(row.kind),
21
+ status: String(row.status),
22
+ archived,
23
+ locked,
24
+ state: archived ? "archived" : row.unread === true ? "unread" : locked ? "locked" : "open",
25
+ };
26
+ }