@phis/ui 0.8.0 → 0.8.2

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 (304) hide show
  1. package/README.md +9 -2
  2. package/components/cms/phi-cms-layout-renderer.js +15 -7
  3. package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
  4. package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
  5. package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
  6. package/components/cms/phi-cms-render-diagnostic.js +12 -2
  7. package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
  8. package/components/cms/phi-cms-render-error-boundary.js +1 -1
  9. package/components/cms/phi-cms-root-layout.js +3 -1
  10. package/components/controls/phi-media-picker-control.d.ts +9 -0
  11. package/components/controls/phi-media-picker-control.js +1 -1
  12. package/components/controls/phi-popover-control.js +4 -1
  13. package/components/controls/phi-table-control.d.ts +7 -1
  14. package/components/controls/phi-table-control.js +26 -11
  15. package/components/forms/form-descriptor-field-check.d.ts +18 -0
  16. package/components/forms/form-descriptor-field-check.js +41 -0
  17. package/components/forms/form-descriptor-runtime-client.js +11 -10
  18. package/components/forms/form-record-source.d.ts +38 -0
  19. package/components/forms/form-record-source.js +48 -0
  20. package/components/forms/shared-form-descriptors.d.ts +0 -34
  21. package/components/forms/shared-form-descriptors.js +0 -6
  22. package/components/forms/shared-form-ids.d.ts +1 -1
  23. package/components/forms/shared-form-ids.js +1 -1
  24. package/components/media/media-settings-labels.d.ts +1 -0
  25. package/components/media/media-settings-labels.js +2 -0
  26. package/components/media/media-upload-flow.d.ts +62 -5
  27. package/components/media/media-upload-flow.js +62 -24
  28. package/components/media/phi-area-upload-widget.d.ts +44 -1
  29. package/components/media/phi-area-upload-widget.js +32 -7
  30. package/components/media/phi-media-picker-binding.d.ts +41 -33
  31. package/components/media/phi-media-picker-binding.js +2 -1
  32. package/components/media/phi-media-upload.d.ts +10 -3
  33. package/components/media/phi-media-upload.js +11 -8
  34. package/components/media/use-media-library-add-picker.d.ts +33 -32
  35. package/components/overlays/phi-overlay-container-client.js +11 -9
  36. package/components/regions/presets/phi-settings-page-shell-tree.d.ts +7 -0
  37. package/components/regions/presets/phi-settings-page-shell-tree.js +3 -3
  38. package/components/shell/phi-icon-names.d.ts +3 -0
  39. package/components/shell/phi-icon-names.js +3 -0
  40. package/components/shell/phi-icon.d.ts +5 -7
  41. package/components/shell/phi-icon.js +8 -21
  42. package/components/shell/phi-widget-icon.js +1 -0
  43. package/components/tables/client/phi-table-binding-params.d.ts +24 -0
  44. package/components/tables/client/phi-table-binding-params.js +39 -0
  45. package/components/tables/client/phi-table-binding.d.ts +1 -3
  46. package/components/tables/client/phi-table-binding.js +5 -9
  47. package/components/widgets/client/html-editor-link-node.d.ts +12 -0
  48. package/components/widgets/client/html-editor-link-node.js +60 -0
  49. package/components/widgets/client/html-editor.js +10 -6
  50. package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
  51. package/components/widgets/client/shared/phi-button-icons.js +8 -12
  52. package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
  53. package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
  54. package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
  55. package/components/widgets/client/shared/phi-collection-provider.js +5 -0
  56. package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
  57. package/components/widgets/client/shared/phi-collection-view-binding.js +33 -26
  58. package/components/widgets/client/shared/phi-command-buttons.d.ts +16 -0
  59. package/components/widgets/client/shared/phi-command-buttons.js +9 -1
  60. package/components/widgets/label-sets/admin-users.d.ts +1 -0
  61. package/components/widgets/label-sets/admin-users.js +2 -0
  62. package/components/widgets/label-sets/builder-modules.js +4 -0
  63. package/components/widgets/label-sets/profile.d.ts +0 -16
  64. package/components/widgets/label-sets/profile.js +0 -37
  65. package/components/widgets/label-sets/registration.d.ts +0 -1
  66. package/components/widgets/label-sets/registration.js +0 -2
  67. package/components/widgets/label-sets/revisions.js +2 -0
  68. package/components/widgets/label-sets/signals.js +2 -0
  69. package/components/widgets/label-types/builder-modules.d.ts +4 -0
  70. package/components/widgets/label-types/builder-modules.js +2 -0
  71. package/components/widgets/label-types/revisions.d.ts +2 -0
  72. package/components/widgets/label-types/revisions.js +2 -1
  73. package/components/widgets/label-types/signals.d.ts +2 -0
  74. package/components/widgets/label-types/signals.js +1 -0
  75. package/components/widgets/shared/widget-failure-audience.d.ts +7 -0
  76. package/components/widgets/shared/widget-failure-audience.js +21 -0
  77. package/components/widgets/shared/widget-failure-client.js +5 -2
  78. package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
  79. package/components/widgets/shared/widget-failure-notice-client.js +10 -0
  80. package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
  81. package/components/widgets/shared/widget-failure-notice.js +17 -0
  82. package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
  83. package/components/widgets/shared/widget-failure-staff.js +18 -0
  84. package/components/widgets/shared/widget-failure.d.ts +9 -6
  85. package/components/widgets/shared/widget-failure.js +0 -9
  86. package/components/widgets/shared/widget-failure.server.d.ts +4 -2
  87. package/components/widgets/shared/widget-failure.server.js +8 -3
  88. package/constants/cms-widget-types.d.ts +1 -0
  89. package/constants/cms-widget-types.js +3 -0
  90. package/constants/customer-file.d.ts +12 -3
  91. package/constants/customer-file.js +12 -3
  92. package/constants/runtime-module-ownership.js +5 -3
  93. package/constants/site-address.d.ts +9 -0
  94. package/constants/site-address.js +10 -0
  95. package/constants/table-loading.d.ts +14 -0
  96. package/constants/table-loading.js +14 -0
  97. package/constants.d.ts +2 -1
  98. package/constants.js +3 -1
  99. package/gateway/site-cms-write-validation.js +19 -3
  100. package/gateway/site-proxy.d.ts +12 -0
  101. package/gateway/site-proxy.js +20 -0
  102. package/helpers/announced-action.d.ts +17 -0
  103. package/helpers/announced-action.js +29 -0
  104. package/helpers/phi-metadata.d.ts +0 -8
  105. package/helpers/phi-metadata.js +1 -10
  106. package/helpers/phi-site-description.d.ts +11 -0
  107. package/helpers/phi-site-description.js +13 -0
  108. package/helpers/preset-form-check.d.ts +14 -0
  109. package/helpers/preset-form-check.js +12 -0
  110. package/helpers/preset-table-check.d.ts +19 -15
  111. package/helpers/preset-table-check.js +33 -39
  112. package/helpers/record-widget-binding.d.ts +10 -0
  113. package/helpers/record-widget-binding.js +35 -0
  114. package/helpers/record-widget.d.ts +1 -10
  115. package/helpers/record-widget.js +4 -33
  116. package/helpers/table-widget-binding.d.ts +12 -0
  117. package/helpers/table-widget-binding.js +296 -0
  118. package/helpers/tree-widget-binding.d.ts +19 -0
  119. package/helpers/tree-widget-binding.js +72 -0
  120. package/helpers/typed-confirmation.d.ts +9 -0
  121. package/helpers/typed-confirmation.js +13 -0
  122. package/helpers/widget-binding-check.d.ts +22 -0
  123. package/helpers/widget-binding-check.js +91 -0
  124. package/module-page-check.d.ts +2 -0
  125. package/module-page-check.js +2 -0
  126. package/net/phi-next-proxy.d.ts +7 -0
  127. package/net/phi-next-proxy.js +1 -1
  128. package/next/root-route.js +2 -1
  129. package/package.json +27 -14
  130. package/plugins/runtime-modules/accounting/ids.d.ts +7 -4
  131. package/plugins/runtime-modules/accounting/ids.js +14 -3
  132. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +21 -9
  133. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +29 -15
  134. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +11 -8
  135. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +206 -137
  136. package/plugins/runtime-modules/app/client-data-providers.js +1 -1
  137. package/plugins/runtime-modules/app/data-providers.d.ts +14 -69
  138. package/plugins/runtime-modules/app/data-providers.js +19 -54
  139. package/plugins/runtime-modules/app/definition.d.ts +8 -80
  140. package/plugins/runtime-modules/app/forms.d.ts +1 -16
  141. package/plugins/runtime-modules/app/forms.js +0 -59
  142. package/plugins/runtime-modules/app/ids.d.ts +2 -1
  143. package/plugins/runtime-modules/app/ids.js +3 -2
  144. package/plugins/runtime-modules/app/module.d.ts +8 -80
  145. package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
  146. package/plugins/runtime-modules/app/services/{addresses-table.js → addresses-collection.js} +23 -19
  147. package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +10 -6
  148. package/plugins/runtime-modules/app/trees/account-addresses-panel.js +37 -73
  149. package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +0 -5
  150. package/plugins/runtime-modules/app/trees/addresses-label-set.js +2 -6
  151. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
  152. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +1 -17
  153. package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +0 -2
  154. package/plugins/runtime-modules/app/trees/profile-label-set.js +2 -14
  155. package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
  156. package/plugins/runtime-modules/area-contributions/admin.js +2 -0
  157. package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
  158. package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
  159. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
  160. package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -1
  161. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
  162. package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
  163. package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
  164. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +5 -0
  165. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -1
  166. package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
  167. package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
  168. package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
  169. package/plugins/runtime-modules/cdn/authoring.js +8 -0
  170. package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
  171. package/plugins/runtime-modules/cdn/bytes.js +17 -0
  172. package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
  173. package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
  174. package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
  175. package/plugins/runtime-modules/cdn/data-providers.js +117 -0
  176. package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
  177. package/plugins/runtime-modules/cdn/definition.js +23 -0
  178. package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
  179. package/plugins/runtime-modules/cdn/ids.js +20 -0
  180. package/plugins/runtime-modules/cdn/module.d.ts +131 -0
  181. package/plugins/runtime-modules/cdn/module.js +4 -0
  182. package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
  183. package/plugins/runtime-modules/cdn/platform.js +73 -0
  184. package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
  185. package/plugins/runtime-modules/cdn/presets.js +20 -0
  186. package/plugins/runtime-modules/cdn/server.d.ts +1 -0
  187. package/plugins/runtime-modules/cdn/server.js +14 -0
  188. package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
  189. package/plugins/runtime-modules/cdn/services/table.js +296 -0
  190. package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
  191. package/plugins/runtime-modules/cdn/services/upload.js +146 -0
  192. package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
  193. package/plugins/runtime-modules/cdn/table-params.js +10 -0
  194. package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
  195. package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
  196. package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
  197. package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +479 -0
  198. package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
  199. package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
  200. package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
  201. package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
  202. package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
  203. package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
  204. package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
  205. package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
  206. package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
  207. package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
  208. package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
  209. package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
  210. package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
  211. package/plugins/runtime-modules/cdn/widgets.js +13 -0
  212. package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
  213. package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
  214. package/plugins/runtime-modules/client-manifests/admin.js +11 -1
  215. package/plugins/runtime-modules/client-manifests/common.js +6 -0
  216. package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
  217. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
  218. package/plugins/runtime-modules/core/widgets/collection-view/client.js +5 -2
  219. package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
  220. package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
  221. package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +175 -0
  222. package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
  223. package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
  224. package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +1 -1
  225. package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
  226. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
  227. package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +1 -1
  228. package/plugins/runtime-modules/core/widgets/form/config.d.ts +1 -1
  229. package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
  230. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
  231. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
  232. package/plugins/runtime-modules/core/widgets/record/client.js +2 -6
  233. package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
  234. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
  235. package/plugins/runtime-modules/core/widgets/table/client.js +36 -52
  236. package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
  237. package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
  238. package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +2 -2
  239. package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
  240. package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
  241. package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
  242. package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
  243. package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
  244. package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.d.ts +2 -0
  245. package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -0
  246. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +5 -0
  247. package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
  248. package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
  249. package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
  250. package/plugins/runtime-modules/revisions/controller/client.js +74 -50
  251. package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
  252. package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
  253. package/plugins/runtime-modules/revisions/forms.js +1 -1
  254. package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
  255. package/plugins/runtime-modules/revisions/page-ids.js +4 -1
  256. package/plugins/runtime-modules/revisions/services/options.js +14 -4
  257. package/plugins/runtime-modules/revisions/services/table.js +41 -21
  258. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +76 -3
  259. package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
  260. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +39 -13
  261. package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
  262. package/plugins/runtime-modules/threads/controller/client.js +62 -2
  263. package/plugins/runtime-modules/threads/controller/definition.js +48 -0
  264. package/plugins/runtime-modules/threads/data-providers.d.ts +22 -37
  265. package/plugins/runtime-modules/threads/data-providers.js +35 -24
  266. package/plugins/runtime-modules/threads/definition.d.ts +22 -37
  267. package/plugins/runtime-modules/threads/ids.d.ts +2 -0
  268. package/plugins/runtime-modules/threads/ids.js +2 -0
  269. package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
  270. package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
  271. package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
  272. package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
  273. package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +14 -80
  274. package/plugins/runtime-modules/threads/services/customer-file-table.js +27 -112
  275. package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +4 -0
  276. package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +4 -0
  277. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +15 -0
  278. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -0
  279. package/server-helpers/runtime.js +0 -1
  280. package/styles/controls.css +4 -2
  281. package/styles/layout.css +7 -0
  282. package/theme/phi-antd-token-resolver.d.ts +8 -0
  283. package/theme/phi-antd-token-resolver.js +10 -0
  284. package/theme/phi-theme-color.d.ts +19 -0
  285. package/theme/phi-theme-color.js +42 -0
  286. package/theme/phi-theme-gradients.js +4 -22
  287. package/theme/phi-theme-palette-defaults.d.ts +16 -0
  288. package/theme/phi-theme-palette-defaults.js +103 -0
  289. package/types/cms-plugins.d.ts +6 -1
  290. package/types/collection-provider.d.ts +27 -0
  291. package/types/collection-signal-values.d.ts +2 -0
  292. package/types/collection-signal-values.js +23 -0
  293. package/types/collection-view-widget.d.ts +9 -0
  294. package/types/core-widget-placements.d.ts +6 -0
  295. package/types/signals.d.ts +2 -0
  296. package/types/signals.js +2 -0
  297. package/types/table-widget.d.ts +17 -3
  298. package/types/table-widget.js +0 -282
  299. package/types/tree-widget.d.ts +0 -1
  300. package/types/tree-widget.js +0 -60
  301. package/types/widget-runtime.d.ts +0 -1
  302. package/types.d.ts +1 -1
  303. package/types.js +1 -1
  304. package/plugins/runtime-modules/app/services/addresses-table.d.ts +0 -135
@@ -1,11 +1,17 @@
1
1
  import { readPhiSignalRouteSet, } from "../../../../types/signals";
2
2
  import { findPhiControlListenRoute } from "../../../../components/widgets/client/shared/phi-control-signal-routing";
3
+ function readText(value) {
4
+ return typeof value === "string" && value.trim() ? value.trim() : undefined;
5
+ }
3
6
  export function parsePhiThreadWidgetConfig(rawConfig) {
4
7
  const raw = rawConfig ?? {};
5
8
  const padding = raw.padding;
6
9
  return {
7
10
  padding: typeof padding === "number" || typeof padding === "string" ? padding : undefined,
8
11
  reply: raw.reply === true,
12
+ title: readText(raw.title),
13
+ replyLabel: readText(raw.replyLabel),
14
+ emptyDescription: readText(raw.emptyDescription),
9
15
  signalRoutes: readPhiSignalRouteSet(raw.signalRoutes),
10
16
  };
11
17
  }
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { isPhiRecord } from "../../../../../helpers/is-record";
4
4
  import { useCallback, useEffect, useMemo, useState } from "react";
5
- import { readPhiTreeProviderError, validatePhiTreeWidgetBinding } from "../../../../../types/tree-widget";
5
+ import { readPhiTreeProviderError } from "../../../../../types/tree-widget";
6
6
  import { usePhiTreeBinding } from "../../../../../components/trees/client/phi-tree-binding";
7
7
  import { PhiTreeActionButton, PhiTreeControl } from "../../../../../components/controls/phi-tree-control";
8
8
  import { PhiTextControl } from "../../../../../components/controls/phi-text-control";
@@ -84,7 +84,6 @@ export function PhiTreeWidgetClient({ config, labels, renderMode }) {
84
84
  binding.setQuery({ ...(config.initialQuery ?? {}) });
85
85
  emitCapability("bindingParamsChange", { params: nextParams });
86
86
  }, [binding, config.initialQuery, config.source?.params, emitCapability, setBindingParams]);
87
- const contractError = binding.resource ? validatePhiTreeWidgetBinding(config, binding.resource)[0] ?? null : null;
88
87
  const treeQuery = binding.query;
89
88
  const setTreeQuery = binding.setQuery;
90
89
  const activate = useCallback((action, identity, correlationId) => {
@@ -186,11 +185,12 @@ export function PhiTreeWidgetClient({ config, labels, renderMode }) {
186
185
  hasResettableQuery && tools?.reset !== false ||
187
186
  tools?.reload === true) ? (_jsxs(PhiToolbarControl, { size: controlSize, compact: true, children: [(config.features.actions?.toolbar ?? []).map((action) => (_jsx(PhiTreeActionButton, { action: action, size: controlSize, onActivate: () => activate(action) }, action.key))), (config.features.actions?.selection ?? []).map((action) => (_jsx(PhiTreeActionButton, { action: action, size: controlSize, disabled: binding.selectedNodeIdentities.length === 0, onActivate: () => activate(action) }, action.key))), hasResettableQuery && tools?.reset !== false ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "rollback-outlined", size: "inherit" }), ariaLabel: labels.reset, tooltip: labels.reset, size: controlSize, onClick: resetTools })) : null, tools?.reload ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "reload", size: "inherit" }), ariaLabel: labels.reload, tooltip: labels.reload, size: controlSize, onClick: binding.reload })) : null] })) : null;
188
187
  /*
189
- * The source's failures end the Tree here: a binding that does not hold, a resource the configuration
190
- * does not fit, a read that failed. A refused change stays in `binding.error` alone, said above the
191
- * nodes to the person who made it.
188
+ * The source's failures end the Tree here: a Provider the Area does not offer, a read that failed. A
189
+ * refused change stays in `binding.error` alone, said above the nodes to the person who made it. The
190
+ * configuration against the resource is checked where it is made (`checkPhiPresetTables`, the
191
+ * Builder's save), not here.
192
192
  */
193
- const sourceFailure = binding.bindingError ?? contractError ?? binding.queryError?.message ?? null;
193
+ const sourceFailure = binding.bindingError ?? binding.queryError?.message ?? null;
194
194
  if (sourceFailure) {
195
195
  return (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Tree, title: sourceFailure, error: binding.queryError }));
196
196
  }
@@ -45,6 +45,8 @@ export type PhiEditorTranslationsWidgetLabels = {
45
45
  title: string;
46
46
  text: string;
47
47
  };
48
+ /** The Table's footer; %1 the source messages the query finds. */
49
+ footer: string;
48
50
  feedback: {
49
51
  saveSuccess: string;
50
52
  deleteSuccess: string;
@@ -37,6 +37,7 @@ const PHI_EDITOR_TRANSLATIONS_WIDGET_LABEL_SET = definePhiRuntimeModuleLabelSet(
37
37
  delete_description: definePhiMessageLabel("Delete this translated variant?"),
38
38
  empty_title: definePhiMessageLabel("No translations found."),
39
39
  empty_text: definePhiMessageLabel("No source messages match the current filters."),
40
+ footer_count: "%1 source messages",
40
41
  load_error: definePhiMessageLabel("Failed to load translations."),
41
42
  save_error: definePhiMessageLabel("Failed to save translation."),
42
43
  required_translation: definePhiMessageLabel("A translation is required."),
@@ -91,6 +92,7 @@ export async function getPhiEditorTranslationsWidgetLabels(options) {
91
92
  title: labels.empty_title,
92
93
  text: labels.empty_text,
93
94
  },
95
+ footer: labels.footer_count,
94
96
  feedback: {
95
97
  saveSuccess: labels.save_success,
96
98
  deleteSuccess: labels.delete_success,
@@ -162,6 +162,11 @@ export async function buildPhiDefaultEditorTranslationsPageTree({ page, runtime,
162
162
  { key: "updatedAt", fieldKey: "updatedAt", title: widgetLabels.columns.updated, renderer: "datetime", sizing: { mode: "content", minWidth: 168 } },
163
163
  ],
164
164
  emptyState: { title: widgetLabels.empty.title, description: widgetLabels.empty.text },
165
+ footer: {
166
+ template: widgetLabels.footer,
167
+ values: [{ key: "messages", value: { source: "core", fieldKey: "totalRows" } }],
168
+ align: "start",
169
+ },
165
170
  controlSize: "small",
166
171
  },
167
172
  features: {
@@ -0,0 +1,37 @@
1
+ import { type PhiBuilderAreaKey } from "../../../../constants/cms-areas";
2
+ import type { PhiWorkspaceCatalogState } from "../../../../components/workspace/catalog-state";
3
+ import { type PhiCmsReviewKind } from "../../../../helpers/cms-scope-search-params";
4
+ /** The scope the Revisions Controller hands the history Table: the one binding the Table reads by. */
5
+ export type PhiRevisionsTableBinding = {
6
+ area: PhiBuilderAreaKey;
7
+ kind: PhiCmsReviewKind;
8
+ scopeKey: string;
9
+ };
10
+ type CatalogState = Pick<PhiWorkspaceCatalogState, "area" | "pageKey" | "catalogHydrated" | "pageCatalogHydratedByArea" | "modulePresetPagesByArea" | "customPages" | "persistedPageCatalogByArea">;
11
+ /**
12
+ * Whether the workspace catalog stands for the Area the address names.
13
+ *
14
+ * Before the Builder has read the address, the catalog answers its default Area (`public`) with whatever
15
+ * it holds of it; a scope resolved then belongs to another Area -- a Module Page of the App was asked for
16
+ * as a Public Page and, handed to the Table, written back into the address as the Public Area. So nothing
17
+ * is resolved until the preload is in, the open Area is the one the address names, and its Pages are read.
18
+ */
19
+ export declare function isPhiRevisionsCatalogReady(state: CatalogState, search: URLSearchParams): boolean;
20
+ /** The kind the address names, the Area where it names none. */
21
+ export declare function readPhiRevisionsAddressKind(search: URLSearchParams): PhiCmsReviewKind;
22
+ /**
23
+ * The scope the address names, resolved against the workspace catalog -- or null while the catalog does
24
+ * not stand for that address yet (`isPhiRevisionsCatalogReady`), which is a moment, not a fault.
25
+ */
26
+ export declare function resolvePhiRevisionsControllerBinding(state: CatalogState, search: URLSearchParams): PhiRevisionsTableBinding | null;
27
+ /**
28
+ * The binding a Table request carries, when it carries a whole one.
29
+ *
30
+ * The history Table mounts with its labels and nothing to ask about; the Controller hands it the scope
31
+ * once the catalog stands for the address. Until then -- and while a kind chosen in the Table's own
32
+ * select still stands beside the scope of the kind before it, until the scope select answers -- there is
33
+ * no question, and a request that asked one anyway asked for the wrong history and was thrown away a
34
+ * moment later: the flicker of the Table on every open.
35
+ */
36
+ export declare function readPhiRevisionsTableBinding(params: unknown): PhiRevisionsTableBinding | null;
37
+ export {};
@@ -0,0 +1,75 @@
1
+ import { isPhiBuilderAreaKey } from "../../../../constants/cms-areas";
2
+ import { PHI_BUILDER_AREA_SEARCH_PARAM, PHI_BUILDER_NAVIGATION_KEY_SEARCH_PARAM, PHI_BUILDER_PAGE_SEARCH_PARAM, PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM, PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM, PHI_BUILDER_THEME_KEY_SEARCH_PARAM, normalizePhiBuilderAreaSearchParam, normalizePhiBuilderPageSearchParam, normalizePhiBuilderRevisionsKindSearchParam, } from "../../../../helpers/cms-scope-search-params";
3
+ import { resolvePhiBuilderActivePageCatalog, resolvePhiBuilderActivePageKey, } from "../../../../helpers/cms-page-catalog";
4
+ import { resolvePhiBuilderRevisionNavScopeKey } from "../../../../helpers/cms-navigation-scope-key";
5
+ import { resolvePhiBuilderRevisionPagePath } from "../types";
6
+ import { isPhiRecord } from "../../../../helpers/is-record";
7
+ /**
8
+ * Whether the workspace catalog stands for the Area the address names.
9
+ *
10
+ * Before the Builder has read the address, the catalog answers its default Area (`public`) with whatever
11
+ * it holds of it; a scope resolved then belongs to another Area -- a Module Page of the App was asked for
12
+ * as a Public Page and, handed to the Table, written back into the address as the Public Area. So nothing
13
+ * is resolved until the preload is in, the open Area is the one the address names, and its Pages are read.
14
+ */
15
+ export function isPhiRevisionsCatalogReady(state, search) {
16
+ if (!state.catalogHydrated || state.pageCatalogHydratedByArea[state.area] !== true)
17
+ return false;
18
+ const area = normalizePhiBuilderAreaSearchParam(search.get(PHI_BUILDER_AREA_SEARCH_PARAM));
19
+ return area == null || area === state.area;
20
+ }
21
+ /** The kind the address names, the Area where it names none. */
22
+ export function readPhiRevisionsAddressKind(search) {
23
+ return normalizePhiBuilderRevisionsKindSearchParam(search.get(PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM)) ?? "area";
24
+ }
25
+ /**
26
+ * The scope the address names, resolved against the workspace catalog -- or null while the catalog does
27
+ * not stand for that address yet (`isPhiRevisionsCatalogReady`), which is a moment, not a fault.
28
+ */
29
+ export function resolvePhiRevisionsControllerBinding(state, search) {
30
+ if (!isPhiRevisionsCatalogReady(state, search))
31
+ return null;
32
+ const pages = resolvePhiBuilderActivePageCatalog(state.area, state.modulePresetPagesByArea, state.customPages, state.persistedPageCatalogByArea);
33
+ const pageKey = resolvePhiBuilderActivePageKey(normalizePhiBuilderPageSearchParam(search.get(PHI_BUILDER_PAGE_SEARCH_PARAM)) ?? state.pageKey, pages);
34
+ if (!pageKey)
35
+ return null;
36
+ const kind = readPhiRevisionsAddressKind(search);
37
+ const requestedScope = search.get(PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM)?.trim() ?? "";
38
+ const scopeKey = kind === "page"
39
+ ? requestedScope.startsWith("/")
40
+ ? requestedScope
41
+ : resolvePhiBuilderRevisionPagePath(state.area, pageKey, pages)
42
+ : kind === "navigation"
43
+ ? requestedScope.includes(":")
44
+ ? requestedScope
45
+ : resolvePhiBuilderRevisionNavScopeKey(state.area, search.get(PHI_BUILDER_NAVIGATION_KEY_SEARCH_PARAM))
46
+ : kind === "theme"
47
+ ? requestedScope || search.get(PHI_BUILDER_THEME_KEY_SEARCH_PARAM) || "default"
48
+ : normalizePhiBuilderAreaSearchParam(requestedScope) ?? state.area;
49
+ return { area: state.area, kind, scopeKey };
50
+ }
51
+ /**
52
+ * The binding a Table request carries, when it carries a whole one.
53
+ *
54
+ * The history Table mounts with its labels and nothing to ask about; the Controller hands it the scope
55
+ * once the catalog stands for the address. Until then -- and while a kind chosen in the Table's own
56
+ * select still stands beside the scope of the kind before it, until the scope select answers -- there is
57
+ * no question, and a request that asked one anyway asked for the wrong history and was thrown away a
58
+ * moment later: the flicker of the Table on every open.
59
+ */
60
+ export function readPhiRevisionsTableBinding(params) {
61
+ if (!isPhiRecord(params) || !isPhiBuilderAreaKey(params.area))
62
+ return null;
63
+ const kind = normalizePhiBuilderRevisionsKindSearchParam(params.kind);
64
+ const scopeKey = typeof params.scopeKey === "string" ? params.scopeKey.trim() : "";
65
+ if (!kind || !scopeKey)
66
+ return null;
67
+ const fits = kind === "area"
68
+ ? isPhiBuilderAreaKey(scopeKey)
69
+ : kind === "page"
70
+ ? scopeKey.startsWith("/")
71
+ : kind === "navigation"
72
+ ? scopeKey.includes(":")
73
+ : !isPhiBuilderAreaKey(scopeKey);
74
+ return fits ? { area: params.area, kind, scopeKey } : null;
75
+ }
@@ -23,6 +23,11 @@ export declare const PHI_REVISIONS_RUNTIME_CONTROLLER_PLUGIN: {
23
23
  action: "change";
24
24
  valueType: "string";
25
25
  valueSchema?: undefined;
26
+ } | {
27
+ id: string;
28
+ action: "change";
29
+ valueType: "boolean";
30
+ valueSchema?: undefined;
26
31
  } | {
27
32
  id: string;
28
33
  action: "activate";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { createElement, useCallback, useEffect, useMemo } from "react";
2
+ import { createElement, useCallback, useEffect, useMemo, useRef } from "react";
3
3
  import { useRouter } from "next/navigation";
4
4
  import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../types/signals";
5
5
  import { readPhiTableBindingParamsSignalValue } from "../../../../types/table-signal-values";
@@ -9,14 +9,13 @@ import { usePhiSignalDispatcher, usePhiSignalListener } from "../../../../compon
9
9
  import { dispatchPhiSignalCapability } from "../../../../components/runtime/runtime-signal-identity";
10
10
  import { usePhiApplicationFeedback } from "../../../../components/runtime/use-phi-application-feedback";
11
11
  import { getPhiWorkspaceCatalogSnapshot, usePhiWorkspaceCatalogValue, } from "../../../../components/workspace/catalog-store";
12
- import { PHI_BUILDER_NAVIGATION_KEY_SEARCH_PARAM, PHI_BUILDER_PAGE_SEARCH_PARAM, PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM, PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM, PHI_BUILDER_THEME_KEY_SEARCH_PARAM, normalizePhiBuilderAreaSearchParam, normalizePhiBuilderPageSearchParam, normalizePhiBuilderRevisionsKindSearchParam, } from "../../../../helpers/cms-scope-search-params";
13
- import { resolvePhiBuilderRevisionPagePath, } from "../types";
14
- import { resolvePhiBuilderActivePageCatalog, resolvePhiBuilderActivePageKey, } from "../../../../helpers/cms-page-catalog";
12
+ import { PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM, PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM, normalizePhiBuilderRevisionsKindSearchParam, } from "../../../../helpers/cms-scope-search-params";
13
+ import { isPhiRevisionsCatalogReady, readPhiRevisionsAddressKind, readPhiRevisionsTableBinding, resolvePhiRevisionsControllerBinding, } from "./binding";
15
14
  import { PHI_REVISIONS_RUNTIME_CONTROLLER_DEFINITION, } from "../controller/definition";
16
15
  import { resolvePhiRevisionsDraftContextTarget } from "./draft-context-target";
17
- import { resolvePhiBuilderRevisionNavScopeKey } from "../../../../helpers/cms-navigation-scope-key";
18
16
  import { deleteCmsDraft } from "../../../../helpers/cms-draft-delete";
19
17
  import { isPhiRecord } from "../../../../helpers/is-record";
18
+ import { matchesPhiTypedConfirmation } from "../../../../helpers/typed-confirmation";
20
19
  import { usePhiPathname } from "../../../../components/runtime/use-phi-pathname";
21
20
  function PhiRevisionsControllerMount({ address, config, }) {
22
21
  const dispatchSignal = usePhiSignalDispatcher();
@@ -51,33 +50,39 @@ function PhiRevisionsControllerMount({ address, config, }) {
51
50
  const modulePresetPagesByArea = usePhiWorkspaceCatalogValue((state) => state.modulePresetPagesByArea);
52
51
  const customPages = usePhiWorkspaceCatalogValue((state) => state.customPages);
53
52
  const persistedPageCatalogByArea = usePhiWorkspaceCatalogValue((state) => state.persistedPageCatalogByArea);
53
+ const catalogHydrated = usePhiWorkspaceCatalogValue((state) => state.catalogHydrated);
54
+ const pageCatalogHydratedByArea = usePhiWorkspaceCatalogValue((state) => state.pageCatalogHydratedByArea);
55
+ /*
56
+ * The scope the address names, handed to the Table once the catalog stands for that address.
57
+ *
58
+ * Before, it was resolved on the catalog's first answer, which names the default Area (`public`)
59
+ * until the Builder has read the address: a Module Page of the App was handed as a Public Page,
60
+ * then again as the App's, each a history read. The catalog changes many times more while the
61
+ * Builder opens, and after every Page action, and each change hands the scope again; the Table
62
+ * takes the same scope as no change (`updateBindingParams`), so only another scope is read.
63
+ */
64
+ /*
65
+ * The last scope handed, to know it when the Table hands it back: the Table announces every change
66
+ * of its binding, this Controller's own among them, and written into the address the scope that was
67
+ * read off the address (or the open Page standing in for it) is one more fetch of the Page for nothing.
68
+ */
69
+ const handedBindingKey = useRef(null);
70
+ const handBinding = useCallback((binding, correlationId) => {
71
+ handedBindingKey.current = JSON.stringify(binding);
72
+ emitCapability("bindingParamsChange", { params: binding }, correlationId);
73
+ }, [emitCapability]);
54
74
  useEffect(() => {
55
- const state = getPhiWorkspaceCatalogSnapshot();
56
- const pages = resolvePhiBuilderActivePageCatalog(state.area, state.modulePresetPagesByArea, state.customPages, state.persistedPageCatalogByArea);
57
- const search = new URLSearchParams(window.location.search);
58
- const pageKey = resolvePhiBuilderActivePageKey(normalizePhiBuilderPageSearchParam(search.get(PHI_BUILDER_PAGE_SEARCH_PARAM)) ?? state.pageKey, pages);
59
- if (!pageKey)
60
- return;
61
- const kind = normalizePhiBuilderRevisionsKindSearchParam(search.get(PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM)) ?? "area";
62
- const requestedScope = search.get(PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM)?.trim() ?? "";
63
- const scopeKey = kind === "page"
64
- ? requestedScope.startsWith("/")
65
- ? requestedScope
66
- : resolvePhiBuilderRevisionPagePath(state.area, pageKey, pages)
67
- : kind === "navigation"
68
- ? requestedScope.includes(":")
69
- ? requestedScope
70
- : resolvePhiBuilderRevisionNavScopeKey(state.area, search.get(PHI_BUILDER_NAVIGATION_KEY_SEARCH_PARAM))
71
- : kind === "theme"
72
- ? requestedScope || search.get(PHI_BUILDER_THEME_KEY_SEARCH_PARAM) || "default"
73
- : normalizePhiBuilderAreaSearchParam(requestedScope) ?? state.area;
74
- emitCapability("bindingParamsChange", { params: { area: state.area, kind, scopeKey } });
75
+ const binding = resolvePhiRevisionsControllerBinding(getPhiWorkspaceCatalogSnapshot(), new URLSearchParams(window.location.search));
76
+ if (binding)
77
+ handBinding(binding);
75
78
  }, [
76
79
  builderArea,
77
80
  builderPageKey,
81
+ catalogHydrated,
78
82
  customPages,
79
- emitCapability,
83
+ handBinding,
80
84
  modulePresetPagesByArea,
85
+ pageCatalogHydratedByArea,
81
86
  persistedPageCatalogByArea,
82
87
  ]);
83
88
  /*
@@ -119,10 +124,16 @@ function PhiRevisionsControllerMount({ address, config, }) {
119
124
  signal.action === "change" &&
120
125
  isPhiBuilderAreaKey(signal.value)) {
121
126
  const search = new URLSearchParams(window.location.search);
122
- const kind = normalizePhiBuilderRevisionsKindSearchParam(search.get(PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM)) ?? "area";
123
- if (kind !== "area")
127
+ /*
128
+ * Not before the catalog stands for the address: the Area select says which Area it shows when it
129
+ * mounts, which is the catalog's default until the Builder has read the address -- the App's
130
+ * Revisions read the Public Area's history first.
131
+ */
132
+ if (readPhiRevisionsAddressKind(search) !== "area" ||
133
+ !isPhiRevisionsCatalogReady(getPhiWorkspaceCatalogSnapshot(), search)) {
124
134
  return;
125
- emitCapability("bindingParamsChange", { params: { kind: "area", scopeKey: signal.value } }, signal.correlationId);
135
+ }
136
+ handBinding({ area: signal.value, kind: "area", scopeKey: signal.value }, signal.correlationId);
126
137
  return;
127
138
  }
128
139
  if (signal.receiver !== address)
@@ -138,15 +149,26 @@ function PhiRevisionsControllerMount({ address, config, }) {
138
149
  */
139
150
  const area = getPhiWorkspaceCatalogSnapshot().area;
140
151
  emitCapability("deleteAreaWarning", `The structure this Site stored for ${area} is cleared -- its Shell, drafts and published alike. What is live changes at once, the shell's preset takes the Area back, and no revision is left to restore it from. It cannot be undone. The Module selection is kept.`, signal.correlationId);
152
+ emitCapability("deleteAreaKey", area, signal.correlationId);
153
+ emitCapability("deleteAreaConfirmEnabled", false, signal.correlationId);
141
154
  emitCapability("deleteAreaOpen", null, signal.correlationId);
142
155
  return;
143
156
  }
157
+ /*
158
+ * The key as it is typed: the confirm button wakes the moment it matches and sleeps again when it
159
+ * no longer does, so pressing it is never answered with "that is not the key".
160
+ */
161
+ if (signal.channel === "deleteAreaTyped" && signal.action === "change") {
162
+ const payload = isPhiRecord(signal.value) ? signal.value : null;
163
+ const values = isPhiRecord(payload?.values) ? payload.values : null;
164
+ emitCapability("deleteAreaConfirmEnabled", matchesPhiTypedConfirmation(values?.areaKey, getPhiWorkspaceCatalogSnapshot().area), signal.correlationId);
165
+ return;
166
+ }
144
167
  if (signal.channel === "formValues" && signal.action === "change") {
145
168
  const payload = isPhiRecord(signal.value) ? signal.value : null;
146
169
  const values = isPhiRecord(payload?.values) ? payload.values : null;
147
- const typed = typeof values?.areaKey === "string" ? values.areaKey.trim() : "";
148
170
  const area = getPhiWorkspaceCatalogSnapshot().area;
149
- if (typed !== area) {
171
+ if (!matchesPhiTypedConfirmation(values?.areaKey, area)) {
150
172
  // The Overlay stays open: what is wrong is the answer, not the question.
151
173
  showMessage({ level: "error", content: "That is not the Area key." }, { correlationId: signal.correlationId });
152
174
  return;
@@ -155,31 +177,33 @@ function PhiRevisionsControllerMount({ address, config, }) {
155
177
  return;
156
178
  }
157
179
  if (signal.channel === "bindingParams" && signal.action === "change") {
158
- const binding = readPhiTableBindingParamsSignalValue(signal.value);
159
- const kind = normalizePhiBuilderRevisionsKindSearchParam(binding?.params.kind);
160
- const scopeKey = typeof binding?.params.scopeKey === "string"
161
- ? binding.params.scopeKey.trim()
162
- : "";
163
- if (!kind || !pathname)
180
+ /*
181
+ * A whole scope only. The Table's kind select answers before its scope select does, and the kind
182
+ * beside the scope of the kind before it names nothing; written into the address it was a
183
+ * navigation, and the scope's answer a second one.
184
+ */
185
+ const binding = readPhiRevisionsTableBinding({
186
+ area: getPhiWorkspaceCatalogSnapshot().area,
187
+ ...readPhiTableBindingParamsSignalValue(signal.value)?.params,
188
+ });
189
+ if (!binding || !pathname || JSON.stringify(binding) === handedBindingKey.current)
164
190
  return;
191
+ const { kind, scopeKey } = binding;
165
192
  const search = new URLSearchParams(window.location.search);
166
193
  const currentKind = normalizePhiBuilderRevisionsKindSearchParam(search.get(PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM));
167
- if (kind === "area" &&
168
- isPhiBuilderAreaKey(scopeKey) &&
169
- (currentKind == null || currentKind === "area")) {
194
+ /*
195
+ * An Area's history is not written into the address beyond its kind, and an absent kind is the
196
+ * Area: nothing to navigate to. Asked to write `revisionKind=area` the Controller fetched the Page
197
+ * anew for an address that meant the same.
198
+ */
199
+ if (kind === "area" && (currentKind == null || currentKind === "area")) {
170
200
  return;
171
201
  }
172
202
  search.set(PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM, kind);
173
- if (kind === "area" && isPhiBuilderAreaKey(scopeKey)) {
203
+ if (kind === "area") {
174
204
  search.delete(PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM);
175
205
  }
176
- else if (kind === "page" && scopeKey.startsWith("/")) {
177
- search.set(PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM, scopeKey);
178
- }
179
- else if (kind === "navigation" && scopeKey.includes(":")) {
180
- search.set(PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM, scopeKey);
181
- }
182
- else if (kind === "theme" && scopeKey) {
206
+ else {
183
207
  search.set(PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM, scopeKey);
184
208
  }
185
209
  /*
@@ -226,9 +250,9 @@ function PhiRevisionsControllerMount({ address, config, }) {
226
250
  else if (key === "deleteSelected")
227
251
  showMessage({ level: "success", content: `Deleted ${String(action?.deletedCount ?? 0)} revisions.` }, { correlationId: signal.correlationId });
228
252
  }
229
- }, [address, deleteAreaShell, emitCapability, pathname, reportDraftStatus, router, showMessage]), {
253
+ }, [address, deleteAreaShell, emitCapability, handBinding, pathname, reportDraftStatus, router, showMessage]), {
230
254
  scopes: ["area", "page"],
231
- channels: ["areaSelection", "bindingParams", "command", "formValues", "mutation"],
255
+ channels: ["areaSelection", "bindingParams", "command", "deleteAreaTyped", "formValues", "mutation"],
232
256
  },
233
257
  /*
234
258
  * The address this listener answers for.
@@ -26,6 +26,11 @@ export declare const PHI_REVISIONS_RUNTIME_CONTROLLER_DEFINITION: {
26
26
  action: "change";
27
27
  valueType: "string";
28
28
  valueSchema?: undefined;
29
+ } | {
30
+ id: string;
31
+ action: "change";
32
+ valueType: "boolean";
33
+ valueSchema?: undefined;
29
34
  } | {
30
35
  id: string;
31
36
  action: "activate";
@@ -23,6 +23,9 @@ export const PHI_REVISIONS_RUNTIME_CONTROLLER_DEFINITION = {
23
23
  valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.revisionsDraftStatus,
24
24
  },
25
25
  { id: "deleteAreaWarning", action: "change", valueType: "string" },
26
+ /* The Area key the dialog shows to be typed, and its confirm button, awake only while it matches. */
27
+ { id: "deleteAreaKey", action: "change", valueType: "string" },
28
+ { id: "deleteAreaConfirmEnabled", action: "change", valueType: "boolean" },
26
29
  { id: "deleteAreaOpen", action: "activate", valueType: "none" },
27
30
  { id: "deleteAreaClose", action: "close", valueType: "none" },
28
31
  /* The history is out of date once an Area is cleared: every revision it listed is gone. */
@@ -62,6 +65,13 @@ export const PHI_REVISIONS_RUNTIME_CONTROLLER_DEFINITION = {
62
65
  action: "change",
63
66
  valueType: "json",
64
67
  valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.formValues,
68
+ }, {
69
+ /* The same Form's values while the key is typed (`valuesChange`), for the confirm button. */
70
+ id: "deleteAreaTyped",
71
+ channel: "deleteAreaTyped",
72
+ action: "change",
73
+ valueType: "json",
74
+ valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.formValues,
65
75
  }],
66
76
  },
67
77
  defaultConfig: { signalRoutes: null },
@@ -31,7 +31,7 @@ const PHI_REVISIONS_DELETE_AREA_FORM_DESCRIPTOR = {
31
31
  {
32
32
  key: "areaKey",
33
33
  fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.text,
34
- label: label("areaKey", "Type the Area key to confirm"),
34
+ label: label("areaKey", "Area key"),
35
35
  validation: [{
36
36
  providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.required,
37
37
  message: label("areaKeyRequired", "Write the Area key out to confirm."),
@@ -6,4 +6,4 @@ export declare const PHI_REVISIONS_TABLE_WIDGET_ID: import("@phis/contracts/cms"
6
6
  /** The Revisions page's one irreversible command: deleting an Area's own shell. */
7
7
  export declare const PHI_REVISIONS_DELETE_AREA_OVERLAY_IDS: Readonly<Record<"overlayDeleteArea", import("@phis/contracts/cms").PhiCmsInstanceId>>;
8
8
  export declare const PHI_REVISIONS_DELETE_AREA_LAYOUT_IDS: Readonly<Record<"deleteAreaBody" | "deleteAreaFooter", import("@phis/contracts/cms").PhiCmsInstanceId>>;
9
- export declare const PHI_REVISIONS_DELETE_AREA_WIDGET_IDS: Readonly<Record<"deleteAreaWarning" | "deleteAreaSurvives" | "deleteAreaForm" | "deleteAreaCommands", import("@phis/contracts/cms").PhiCmsInstanceId>>;
9
+ export declare const PHI_REVISIONS_DELETE_AREA_WIDGET_IDS: Readonly<Record<"deleteAreaWarning" | "deleteAreaKey" | "deleteAreaSurvives" | "deleteAreaTypeToConfirm" | "deleteAreaForm" | "deleteAreaCommands", import("@phis/contracts/cms").PhiCmsInstanceId>>;
@@ -25,4 +25,7 @@ export const PHI_REVISIONS_TABLE_WIDGET_ID = createPhiPresetCmsInstanceId({
25
25
  /** The Revisions page's one irreversible command: deleting an Area's own shell. */
26
26
  export const PHI_REVISIONS_DELETE_AREA_OVERLAY_IDS = createPhiPresetCmsInstanceIdMap(PHI_REVISIONS_PAGE_DIALOG_ID_CONTEXT, ["overlayDeleteArea"]);
27
27
  export const PHI_REVISIONS_DELETE_AREA_LAYOUT_IDS = createPhiPresetCmsInstanceIdMap(PHI_REVISIONS_PAGE_DIALOG_ID_CONTEXT, ["deleteAreaBody", "deleteAreaFooter"]);
28
- export const PHI_REVISIONS_DELETE_AREA_WIDGET_IDS = createPhiPresetCmsInstanceIdMap(PHI_REVISIONS_PAGE_DIALOG_ID_CONTEXT, ["deleteAreaWarning", "deleteAreaSurvives", "deleteAreaForm", "deleteAreaCommands"]);
28
+ export const PHI_REVISIONS_DELETE_AREA_WIDGET_IDS = createPhiPresetCmsInstanceIdMap(PHI_REVISIONS_PAGE_DIALOG_ID_CONTEXT, [
29
+ "deleteAreaWarning", "deleteAreaSurvives", "deleteAreaTypeToConfirm", "deleteAreaKey", "deleteAreaForm",
30
+ "deleteAreaCommands",
31
+ ]);
@@ -5,6 +5,7 @@ import { resolvePhiBuilderActivePageCatalog, } from "../../../../helpers/cms-pag
5
5
  import { phiWorkspaceCatalogStore, PHI_WORKSPACE_CATALOG_SCOPE, } from "../../../../components/workspace/catalog-store";
6
6
  import { PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM, } from "../../../../helpers/cms-scope-search-params";
7
7
  import { resolvePhiBuilderRevisionPagePath } from "../types";
8
+ import { isPhiRevisionsCatalogReady, readPhiRevisionsAddressKind } from "../controller/binding";
8
9
  import { createPhiControlOptionsProviderClient, readPhiControlOptionsProviderParam, readPhiControlOptionsProviderSourceValue, } from "../../../../components/controls/phi-options-provider";
9
10
  function readSnapshot(context) {
10
11
  return context.snapshot;
@@ -26,6 +27,17 @@ function resolveKind(context) {
26
27
  function resolveOptions(context) {
27
28
  const snapshot = readSnapshot(context);
28
29
  const mode = readPhiControlOptionsProviderParam(context.optionsProvider, "mode");
30
+ const search = typeof window === "undefined" ? null : new URLSearchParams(window.location.search);
31
+ /*
32
+ * Nothing to offer until the catalog stands for the address, as the Controller hands no scope before
33
+ * then (`resolvePhiRevisionsControllerBinding`). A select that answers a value is set to it, and
34
+ * the Table hands the value on: the kind select answered `area` whatever the address said, before the
35
+ * Controller had said `page`, and the Controller wrote the Area's history into the address -- a
36
+ * Module Page's Revisions opened on the Area's.
37
+ */
38
+ if (!search || !isPhiRevisionsCatalogReady(snapshot, search)) {
39
+ return { options: [] };
40
+ }
29
41
  if (mode === "kind") {
30
42
  return {
31
43
  options: [
@@ -34,7 +46,7 @@ function resolveOptions(context) {
34
46
  { value: "navigation", label: "Navigation" },
35
47
  { value: "theme", label: "Theme" },
36
48
  ],
37
- value: "area",
49
+ value: readPhiRevisionsAddressKind(search),
38
50
  };
39
51
  }
40
52
  const area = snapshot.area;
@@ -42,9 +54,7 @@ function resolveOptions(context) {
42
54
  const currentValue = typeof context.sourceConfig?.scopeKey === "string"
43
55
  ? context.sourceConfig.scopeKey
44
56
  : null;
45
- const requestedScope = typeof window === "undefined"
46
- ? null
47
- : new URLSearchParams(window.location.search).get(PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM);
57
+ const requestedScope = search.get(PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM);
48
58
  if (kind === "area") {
49
59
  return {
50
60
  options: [...PHI_BUILDER_AREA_OPTIONS],