@phis/ui 0.8.0 → 0.8.1

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 (233) hide show
  1. package/components/cms/phi-cms-layout-renderer.js +15 -7
  2. package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
  3. package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
  4. package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
  5. package/components/cms/phi-cms-render-diagnostic.js +12 -2
  6. package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
  7. package/components/cms/phi-cms-render-error-boundary.js +1 -1
  8. package/components/cms/phi-cms-root-layout.js +3 -1
  9. package/components/controls/phi-media-picker-control.d.ts +9 -0
  10. package/components/controls/phi-media-picker-control.js +1 -1
  11. package/components/controls/phi-popover-control.js +4 -1
  12. package/components/controls/phi-table-control.d.ts +7 -1
  13. package/components/controls/phi-table-control.js +23 -8
  14. package/components/forms/form-descriptor-field-check.d.ts +18 -0
  15. package/components/forms/form-descriptor-field-check.js +41 -0
  16. package/components/forms/form-descriptor-runtime-client.js +11 -10
  17. package/components/forms/form-record-source.d.ts +38 -0
  18. package/components/forms/form-record-source.js +48 -0
  19. package/components/forms/shared-form-descriptors.d.ts +0 -34
  20. package/components/forms/shared-form-descriptors.js +0 -6
  21. package/components/forms/shared-form-ids.d.ts +1 -1
  22. package/components/forms/shared-form-ids.js +1 -1
  23. package/components/media/media-settings-labels.d.ts +1 -0
  24. package/components/media/media-settings-labels.js +2 -0
  25. package/components/media/phi-media-picker-binding.d.ts +41 -33
  26. package/components/media/phi-media-picker-binding.js +2 -1
  27. package/components/media/use-media-library-add-picker.d.ts +33 -32
  28. package/components/overlays/phi-overlay-container-client.js +11 -9
  29. package/components/regions/presets/phi-settings-page-shell-tree.d.ts +7 -0
  30. package/components/regions/presets/phi-settings-page-shell-tree.js +3 -3
  31. package/components/shell/phi-icon-names.d.ts +3 -0
  32. package/components/shell/phi-icon-names.js +3 -0
  33. package/components/shell/phi-icon.d.ts +5 -7
  34. package/components/shell/phi-icon.js +8 -21
  35. package/components/tables/client/phi-table-binding-params.d.ts +24 -0
  36. package/components/tables/client/phi-table-binding-params.js +39 -0
  37. package/components/tables/client/phi-table-binding.d.ts +1 -3
  38. package/components/tables/client/phi-table-binding.js +5 -9
  39. package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
  40. package/components/widgets/client/shared/phi-button-icons.js +8 -12
  41. package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
  42. package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
  43. package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
  44. package/components/widgets/client/shared/phi-collection-provider.js +5 -0
  45. package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
  46. package/components/widgets/client/shared/phi-command-buttons.d.ts +16 -0
  47. package/components/widgets/client/shared/phi-command-buttons.js +9 -1
  48. package/components/widgets/label-sets/admin-users.d.ts +1 -0
  49. package/components/widgets/label-sets/admin-users.js +2 -0
  50. package/components/widgets/label-sets/builder-modules.js +4 -0
  51. package/components/widgets/label-sets/profile.d.ts +0 -16
  52. package/components/widgets/label-sets/profile.js +0 -37
  53. package/components/widgets/label-sets/registration.d.ts +0 -1
  54. package/components/widgets/label-sets/registration.js +0 -2
  55. package/components/widgets/label-sets/revisions.js +2 -0
  56. package/components/widgets/label-sets/signals.js +2 -0
  57. package/components/widgets/label-types/builder-modules.d.ts +4 -0
  58. package/components/widgets/label-types/builder-modules.js +2 -0
  59. package/components/widgets/label-types/revisions.d.ts +2 -0
  60. package/components/widgets/label-types/revisions.js +2 -1
  61. package/components/widgets/label-types/signals.d.ts +2 -0
  62. package/components/widgets/label-types/signals.js +1 -0
  63. package/components/widgets/shared/widget-failure-audience.d.ts +7 -0
  64. package/components/widgets/shared/widget-failure-audience.js +21 -0
  65. package/components/widgets/shared/widget-failure-client.js +5 -2
  66. package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
  67. package/components/widgets/shared/widget-failure-notice-client.js +10 -0
  68. package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
  69. package/components/widgets/shared/widget-failure-notice.js +17 -0
  70. package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
  71. package/components/widgets/shared/widget-failure-staff.js +18 -0
  72. package/components/widgets/shared/widget-failure.d.ts +9 -6
  73. package/components/widgets/shared/widget-failure.js +0 -9
  74. package/components/widgets/shared/widget-failure.server.d.ts +4 -2
  75. package/components/widgets/shared/widget-failure.server.js +8 -3
  76. package/constants/customer-file.d.ts +12 -3
  77. package/constants/customer-file.js +12 -3
  78. package/constants/runtime-module-ownership.js +4 -3
  79. package/constants/site-address.d.ts +9 -0
  80. package/constants/site-address.js +10 -0
  81. package/constants/table-loading.d.ts +14 -0
  82. package/constants/table-loading.js +14 -0
  83. package/constants.d.ts +2 -1
  84. package/constants.js +3 -1
  85. package/gateway/site-cms-write-validation.js +19 -3
  86. package/helpers/announced-action.d.ts +17 -0
  87. package/helpers/announced-action.js +29 -0
  88. package/helpers/phi-metadata.d.ts +0 -8
  89. package/helpers/phi-metadata.js +1 -10
  90. package/helpers/phi-site-description.d.ts +11 -0
  91. package/helpers/phi-site-description.js +13 -0
  92. package/helpers/preset-form-check.d.ts +14 -0
  93. package/helpers/preset-form-check.js +12 -0
  94. package/helpers/preset-table-check.d.ts +19 -15
  95. package/helpers/preset-table-check.js +33 -39
  96. package/helpers/record-widget-binding.d.ts +10 -0
  97. package/helpers/record-widget-binding.js +35 -0
  98. package/helpers/record-widget.d.ts +1 -10
  99. package/helpers/record-widget.js +4 -33
  100. package/helpers/table-widget-binding.d.ts +12 -0
  101. package/helpers/table-widget-binding.js +296 -0
  102. package/helpers/tree-widget-binding.d.ts +19 -0
  103. package/helpers/tree-widget-binding.js +72 -0
  104. package/helpers/typed-confirmation.d.ts +9 -0
  105. package/helpers/typed-confirmation.js +13 -0
  106. package/helpers/widget-binding-check.d.ts +22 -0
  107. package/helpers/widget-binding-check.js +91 -0
  108. package/module-page-check.d.ts +2 -0
  109. package/module-page-check.js +2 -0
  110. package/next/root-route.js +2 -1
  111. package/package.json +1 -1
  112. package/plugins/runtime-modules/accounting/ids.d.ts +7 -4
  113. package/plugins/runtime-modules/accounting/ids.js +14 -3
  114. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +21 -9
  115. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +29 -15
  116. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +11 -8
  117. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +206 -137
  118. package/plugins/runtime-modules/app/client-data-providers.js +1 -1
  119. package/plugins/runtime-modules/app/data-providers.d.ts +14 -69
  120. package/plugins/runtime-modules/app/data-providers.js +19 -54
  121. package/plugins/runtime-modules/app/definition.d.ts +8 -80
  122. package/plugins/runtime-modules/app/forms.d.ts +1 -16
  123. package/plugins/runtime-modules/app/forms.js +0 -59
  124. package/plugins/runtime-modules/app/ids.d.ts +2 -1
  125. package/plugins/runtime-modules/app/ids.js +3 -2
  126. package/plugins/runtime-modules/app/module.d.ts +8 -80
  127. package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
  128. package/plugins/runtime-modules/app/services/{addresses-table.js → addresses-collection.js} +23 -19
  129. package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +10 -6
  130. package/plugins/runtime-modules/app/trees/account-addresses-panel.js +37 -73
  131. package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +0 -5
  132. package/plugins/runtime-modules/app/trees/addresses-label-set.js +2 -6
  133. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
  134. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +1 -17
  135. package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +0 -2
  136. package/plugins/runtime-modules/app/trees/profile-label-set.js +2 -14
  137. package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
  138. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
  139. package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -1
  140. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
  141. package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
  142. package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
  143. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +5 -0
  144. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -1
  145. package/plugins/runtime-modules/client-manifests/common.js +6 -0
  146. package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
  147. package/plugins/runtime-modules/core/widgets/collection-view/client.js +5 -2
  148. package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
  149. package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
  150. package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +173 -0
  151. package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
  152. package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
  153. package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +1 -1
  154. package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
  155. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
  156. package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +1 -1
  157. package/plugins/runtime-modules/core/widgets/form/config.d.ts +1 -1
  158. package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
  159. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
  160. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
  161. package/plugins/runtime-modules/core/widgets/record/client.js +2 -6
  162. package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
  163. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
  164. package/plugins/runtime-modules/core/widgets/table/client.js +30 -48
  165. package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
  166. package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
  167. package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +2 -2
  168. package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
  169. package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
  170. package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
  171. package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
  172. package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
  173. package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.d.ts +2 -0
  174. package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -0
  175. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +5 -0
  176. package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
  177. package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
  178. package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
  179. package/plugins/runtime-modules/revisions/controller/client.js +74 -50
  180. package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
  181. package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
  182. package/plugins/runtime-modules/revisions/forms.js +1 -1
  183. package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
  184. package/plugins/runtime-modules/revisions/page-ids.js +4 -1
  185. package/plugins/runtime-modules/revisions/services/options.js +14 -4
  186. package/plugins/runtime-modules/revisions/services/table.js +41 -21
  187. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +76 -3
  188. package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
  189. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +39 -13
  190. package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
  191. package/plugins/runtime-modules/threads/controller/client.js +62 -2
  192. package/plugins/runtime-modules/threads/controller/definition.js +48 -0
  193. package/plugins/runtime-modules/threads/data-providers.d.ts +22 -37
  194. package/plugins/runtime-modules/threads/data-providers.js +35 -24
  195. package/plugins/runtime-modules/threads/definition.d.ts +22 -37
  196. package/plugins/runtime-modules/threads/ids.d.ts +2 -0
  197. package/plugins/runtime-modules/threads/ids.js +2 -0
  198. package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
  199. package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
  200. package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
  201. package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
  202. package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +14 -80
  203. package/plugins/runtime-modules/threads/services/customer-file-table.js +27 -112
  204. package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +4 -0
  205. package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +4 -0
  206. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +15 -0
  207. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -0
  208. package/server-helpers/runtime.js +0 -1
  209. package/styles/controls.css +4 -2
  210. package/styles/layout.css +7 -0
  211. package/theme/phi-antd-token-resolver.d.ts +8 -0
  212. package/theme/phi-antd-token-resolver.js +10 -0
  213. package/theme/phi-theme-color.d.ts +19 -0
  214. package/theme/phi-theme-color.js +42 -0
  215. package/theme/phi-theme-gradients.js +4 -22
  216. package/theme/phi-theme-palette-defaults.d.ts +16 -0
  217. package/theme/phi-theme-palette-defaults.js +103 -0
  218. package/types/cms-plugins.d.ts +6 -1
  219. package/types/collection-provider.d.ts +27 -0
  220. package/types/collection-signal-values.d.ts +2 -0
  221. package/types/collection-signal-values.js +23 -0
  222. package/types/collection-view-widget.d.ts +9 -0
  223. package/types/core-widget-placements.d.ts +6 -0
  224. package/types/signals.d.ts +2 -0
  225. package/types/signals.js +2 -0
  226. package/types/table-widget.d.ts +15 -1
  227. package/types/table-widget.js +0 -282
  228. package/types/tree-widget.d.ts +0 -1
  229. package/types/tree-widget.js +0 -60
  230. package/types/widget-runtime.d.ts +0 -1
  231. package/types.d.ts +1 -1
  232. package/types.js +1 -1
  233. package/plugins/runtime-modules/app/services/addresses-table.d.ts +0 -135
@@ -0,0 +1,42 @@
1
+ /**
2
+ * A colour as a palette states it, read into numbers so two spellings of one colour compare equal.
3
+ *
4
+ * A palette is written by hand, by a picker and by a Module, and each spells a colour its own way:
5
+ * `#1677FF` and `#1677ff`, `#fff` and `#ffffff`, `rgb(22, 119, 255)`. Comparing the strings told the
6
+ * Theme workspace that a colour the author had not changed was theirs.
7
+ */
8
+ /* Enough of CSS colour for what a palette states: hex in its four lengths and `rgb()`/`rgba()`. */
9
+ export function parsePhiThemeColor(value) {
10
+ const text = value.trim().toLowerCase();
11
+ const hex = /^#([0-9a-f]{3,8})$/.exec(text)?.[1];
12
+ if (hex) {
13
+ const full = hex.length <= 4 ? [...hex].map((digit) => digit + digit).join("") : hex;
14
+ return {
15
+ r: Number.parseInt(full.slice(0, 2), 16),
16
+ g: Number.parseInt(full.slice(2, 4), 16),
17
+ b: Number.parseInt(full.slice(4, 6), 16),
18
+ a: full.length >= 8 ? Number.parseInt(full.slice(6, 8), 16) / 255 : 1,
19
+ };
20
+ }
21
+ const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+)(%?))?/.exec(text);
22
+ if (!rgb)
23
+ return null;
24
+ const alpha = rgb[4] == null ? 1 : Number(rgb[4]) / (rgb[5] ? 100 : 1);
25
+ return { r: Number(rgb[1]), g: Number(rgb[2]), b: Number(rgb[3]), a: Math.min(1, Math.max(0, alpha)) };
26
+ }
27
+ /**
28
+ * Whether two values name the same colour: the same channels to the unit and the same alpha to the step
29
+ * an eight-digit hex can say. What does not read as a colour compares as text.
30
+ */
31
+ export function isSamePhiThemeColor(left, right) {
32
+ if (typeof left !== "string" || typeof right !== "string")
33
+ return left === right;
34
+ const first = parsePhiThemeColor(left);
35
+ const second = parsePhiThemeColor(right);
36
+ if (!first || !second)
37
+ return left.trim().toLowerCase() === right.trim().toLowerCase();
38
+ return Math.round(first.r) === Math.round(second.r)
39
+ && Math.round(first.g) === Math.round(second.g)
40
+ && Math.round(first.b) === Math.round(second.b)
41
+ && Math.abs(first.a - second.a) < 0.5 / 255;
42
+ }
@@ -13,6 +13,7 @@
13
13
  * Theme workspace's preview writes the draft's, so a control that reads the property is in the right mode
14
14
  * wherever it stands without asking which one that is.
15
15
  */
16
+ import { parsePhiThemeColor } from "./phi-theme-color";
16
17
  export const PHI_THEME_GRADIENT_KEYS = ["gradient1", "gradient2", "gradient3"];
17
18
  export const PHI_THEME_GRADIENT_TEXT_TONES = ["light", "dark"];
18
19
  function isPhiThemeGradientKey(value) {
@@ -84,25 +85,6 @@ const PHI_PRIMARY_BUTTON_GRADIENT_TOKENS = {
84
85
  /** A run a little lighter under the pointer, a little darker while it is pressed. */
85
86
  export const PHI_GRADIENT_HOVER_FILTER = "brightness(1.18) saturate(1.15)";
86
87
  const PHI_GRADIENT_ACTIVE_FILTER = "brightness(0.88)";
87
- /* Enough of CSS colour for what a palette states: hex in its four lengths and `rgb()`/`rgba()`. */
88
- function parseColor(value) {
89
- const text = value.trim().toLowerCase();
90
- const hex = /^#([0-9a-f]{3,8})$/.exec(text)?.[1];
91
- if (hex) {
92
- const full = hex.length <= 4 ? [...hex].map((digit) => digit + digit).join("") : hex;
93
- return {
94
- r: Number.parseInt(full.slice(0, 2), 16),
95
- g: Number.parseInt(full.slice(2, 4), 16),
96
- b: Number.parseInt(full.slice(4, 6), 16),
97
- a: full.length >= 8 ? Number.parseInt(full.slice(6, 8), 16) / 255 : 1,
98
- };
99
- }
100
- const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+)(%?))?/.exec(text);
101
- if (!rgb)
102
- return null;
103
- const alpha = rgb[4] == null ? 1 : Number(rgb[4]) / (rgb[5] ? 100 : 1);
104
- return { r: Number(rgb[1]), g: Number(rgb[2]), b: Number(rgb[3]), a: Math.min(1, Math.max(0, alpha)) };
105
- }
106
88
  /** A translucent text colour as it lands on its ground: the near-black `0.88` text is not black. */
107
89
  function composite(top, ground) {
108
90
  const mix = (front, back) => front * top.a + back * (1 - top.a);
@@ -133,7 +115,7 @@ export function resolvePhiThemeGradientInks(token) {
133
115
  const light = tokenColor(token, "colorTextLightSolid", PHI_GRADIENT_LIGHT_TEXT);
134
116
  const candidates = [tokenColor(token, "colorText", PHI_GRADIENT_DARK_TEXT), tokenColor(token, "colorBgBase", PHI_GRADIENT_DARK_TEXT)];
135
117
  const darkness = (colour) => {
136
- const parsed = parseColor(colour);
118
+ const parsed = parsePhiThemeColor(colour);
137
119
  return parsed ? relativeLuminance(composite(parsed, { r: 255, g: 255, b: 255 })) : Number.POSITIVE_INFINITY;
138
120
  };
139
121
  const dark = candidates.reduce((darkest, next) => (darkness(next) < darkness(darkest) ? next : darkest));
@@ -146,12 +128,12 @@ export function resolvePhiThemeGradientInks(token) {
146
128
  * (`hsl()`, a variable): the Theme workspace then says nothing rather than something wrong.
147
129
  */
148
130
  export function resolvePhiThemeGradientContrast(gradient, text) {
149
- const words = parseColor(text);
131
+ const words = parsePhiThemeColor(text);
150
132
  if (!words)
151
133
  return null;
152
134
  let worst = null;
153
135
  for (const [stopIndex, stop] of gradient.stops.entries()) {
154
- const ground = parseColor(stop.color);
136
+ const ground = parsePhiThemeColor(stop.color);
155
137
  if (!ground)
156
138
  return null;
157
139
  for (const hover of [false, true]) {
@@ -0,0 +1,16 @@
1
+ import { type PhiThemePalette, type PhiThemePresetPlugin } from "./phi-theme-presets";
2
+ /**
3
+ * A Site's palette without the colours that change nothing over the palette block it follows.
4
+ *
5
+ * A palette entry is what an author decided differently from the Theme, and the Theme workspace offers
6
+ * to hand it back ("Reset to Theme", "Reset override"). An entry with the very colour the Theme gives
7
+ * anyway is no decision: the workspace showed a reset for it all the same, and every Site that saved a
8
+ * Module's Theme had one under every seed, because the save takes the Module's palette over
9
+ * (`adoptPhiThemeModulePalette`). The workspace reads ownership off this, and the save stores this, ahead
10
+ * of the takeover, so a Module's palette is still copied in whole and a core palette is simply followed.
11
+ *
12
+ * Entries are taken out one by one, each against what is left, so two entries that only together equal
13
+ * the Theme are both dropped and one that matters keeps the other where it is needed. Custom colours and
14
+ * gradient slots are not looked at here. `baseTokens` are the non-colour tokens the render derives with.
15
+ */
16
+ export declare function omitPhiThemePaletteDefaults(preset: PhiThemePresetPlugin, palette: PhiThemePalette | null | undefined, baseTokens?: Record<string, unknown>): PhiThemePalette;
@@ -0,0 +1,103 @@
1
+ import { readPhiAntdDefaultSeedToken, resolvePhiAntdAliasTokens } from "./phi-antd-token-resolver";
2
+ import { isSamePhiThemeColor } from "./phi-theme-color";
3
+ import { resolvePhiThemeColorTokens, } from "./phi-theme-presets";
4
+ const PHI_THEME_MODES = ["light", "dark"];
5
+ function listPhiThemePaletteEntries(palette) {
6
+ return [
7
+ ...Object.keys(palette.seed ?? {}).map((key) => ({ level: "seed", key })),
8
+ ...PHI_THEME_MODES.flatMap((mode) => [
9
+ ...Object.keys(palette.modes?.[mode]?.seed ?? {})
10
+ .map((key) => ({ level: "modeSeed", mode, key })),
11
+ ...Object.keys(palette.modes?.[mode]?.overrides ?? {})
12
+ .map((key) => ({ level: "modeOverride", mode, key })),
13
+ ]),
14
+ ];
15
+ }
16
+ function readPhiThemePaletteEntry(palette, entry) {
17
+ if (entry.level === "seed")
18
+ return palette.seed?.[entry.key];
19
+ const mode = palette.modes?.[entry.mode];
20
+ return entry.level === "modeSeed" ? mode?.seed?.[entry.key] : mode?.overrides?.[entry.key];
21
+ }
22
+ /** The palette without the one entry; an emptied record or mode goes with it. */
23
+ function omitPhiThemePaletteEntry(palette, entry) {
24
+ const without = (record) => {
25
+ const next = Object.fromEntries(Object.entries(record ?? {}).filter(([key]) => key !== entry.key));
26
+ return Object.keys(next).length > 0 ? next : undefined;
27
+ };
28
+ if (entry.level === "seed") {
29
+ const seed = without(palette.seed);
30
+ const { seed: _seed, ...rest } = palette;
31
+ return seed ? { ...rest, seed } : rest;
32
+ }
33
+ const current = palette.modes?.[entry.mode] ?? {};
34
+ const part = entry.level === "modeSeed" ? "seed" : "overrides";
35
+ const nextMode = { ...current, [part]: without(current[part]) };
36
+ if (nextMode[part] === undefined)
37
+ delete nextMode[part];
38
+ const modes = { ...(palette.modes ?? {}), [entry.mode]: nextMode };
39
+ if (Object.keys(nextMode).length === 0)
40
+ delete modes[entry.mode];
41
+ const { modes: _modes, ...rest } = palette;
42
+ return Object.keys(modes).length > 0 ? { ...rest, modes } : rest;
43
+ }
44
+ function isSamePhiThemeTokenInput(left, right) {
45
+ const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
46
+ return [...keys].every((key) => isSamePhiThemeColor(left[key], right[key]));
47
+ }
48
+ /**
49
+ * Whether the palette renders the same in this mode without the entry.
50
+ *
51
+ * First on the token input, which is what decides the render and costs nothing to compare: a value the
52
+ * block below states the same way, a Module palette taken over on save above all. Where the entry is the
53
+ * only one to state its key, the input differs by that key alone, and the entry changes nothing if it is
54
+ * what Ant Design derives in its place -- a seed equal to the default seed, a hover equal to the hover
55
+ * the seed yields. A seed that releases derived colours the block states outright changes the input in
56
+ * more keys than its own and stays.
57
+ */
58
+ function phiThemePaletteEntryChangesNothing(preset, palette, candidate, entry, mode, baseTokens) {
59
+ const stated = resolvePhiThemeColorTokens(preset, palette, mode);
60
+ const left = resolvePhiThemeColorTokens(preset, candidate, mode);
61
+ if (isSamePhiThemeTokenInput(stated, left))
62
+ return true;
63
+ const differing = [...new Set([...Object.keys(stated), ...Object.keys(left)])]
64
+ .filter((key) => !isSamePhiThemeColor(stated[key], left[key]));
65
+ if (differing.length !== 1 || differing[0] !== entry.key || entry.key in left)
66
+ return false;
67
+ /*
68
+ * A seed goes into the derivation as Ant Design's default seed, which is what to compare with: the
69
+ * alias token of the same name is a colour derived from it, and in the dark mode not the seed itself.
70
+ */
71
+ const defaultSeed = readPhiAntdDefaultSeedToken(entry.key);
72
+ const inPlace = defaultSeed
73
+ ? defaultSeed.value
74
+ : resolvePhiAntdAliasTokens(mode, { ...baseTokens, ...left })[entry.key];
75
+ return isSamePhiThemeColor(stated[entry.key], inPlace);
76
+ }
77
+ /**
78
+ * A Site's palette without the colours that change nothing over the palette block it follows.
79
+ *
80
+ * A palette entry is what an author decided differently from the Theme, and the Theme workspace offers
81
+ * to hand it back ("Reset to Theme", "Reset override"). An entry with the very colour the Theme gives
82
+ * anyway is no decision: the workspace showed a reset for it all the same, and every Site that saved a
83
+ * Module's Theme had one under every seed, because the save takes the Module's palette over
84
+ * (`adoptPhiThemeModulePalette`). The workspace reads ownership off this, and the save stores this, ahead
85
+ * of the takeover, so a Module's palette is still copied in whole and a core palette is simply followed.
86
+ *
87
+ * Entries are taken out one by one, each against what is left, so two entries that only together equal
88
+ * the Theme are both dropped and one that matters keeps the other where it is needed. Custom colours and
89
+ * gradient slots are not looked at here. `baseTokens` are the non-colour tokens the render derives with.
90
+ */
91
+ export function omitPhiThemePaletteDefaults(preset, palette, baseTokens = {}) {
92
+ let current = palette ?? {};
93
+ for (const entry of listPhiThemePaletteEntries(current)) {
94
+ if (readPhiThemePaletteEntry(current, entry) === undefined)
95
+ continue;
96
+ const candidate = omitPhiThemePaletteEntry(current, entry);
97
+ const modes = entry.level === "seed" ? PHI_THEME_MODES : [entry.mode];
98
+ if (modes.every((mode) => phiThemePaletteEntryChangesNothing(preset, current, candidate, entry, mode, baseTokens))) {
99
+ current = candidate;
100
+ }
101
+ }
102
+ return current;
103
+ }
@@ -147,7 +147,12 @@ export type PhiCmsConfigField = (PhiCmsConfigFieldBase & {
147
147
  type: "readonly";
148
148
  }) | (PhiCmsConfigFieldBase & {
149
149
  type: "data-provider";
150
- providerKind?: PhiRuntimeDataProviderKind;
150
+ /**
151
+ * Which kind of Provider the binding names, or the kinds it takes: a record-bound Form reads a Table
152
+ * resource's row or a Collection resource's item, whichever declares `recordRead`. The resource is
153
+ * chosen the way the chosen Provider's kind chooses one.
154
+ */
155
+ providerKind?: PhiRuntimeDataProviderKind | readonly PhiRuntimeDataProviderKind[];
151
156
  /**
152
157
  * The one record Provider this binding names, for a Widget that can only read one: a Gallery
153
158
  * reads a Folder, an entry header an entry. The Inspector then offers no choice of Provider -- a list
@@ -1,4 +1,5 @@
1
1
  import type { PhiSignalValueSchema } from "./signals";
2
+ import type { PhiTableProviderRecordRequest } from "./table-widget";
2
3
  /**
3
4
  * A renderer a Module offers for Collection items, its own or somebody else's.
4
5
  *
@@ -51,6 +52,13 @@ export type PhiCollectionProviderResourceDescriptor = {
51
52
  * Absent means this resource announces no selection, and the Builder offers no route for one.
52
53
  */
53
54
  selectionValueSchema?: PhiSignalValueSchema;
55
+ /**
56
+ * Whether one item can be read on its own, by its key, as a Table resource's `recordRead` says it of a
57
+ * row: the Provider Client then has `readRecord`, and a record-bound Form opened from one of the
58
+ * View's items reads the item through it (FORMS.md, "A record opened from a Collection View"). Absent
59
+ * is no record read, and a Form bound to the resource fails with the reason rather than open empty.
60
+ */
61
+ recordRead?: boolean;
54
62
  defaultForWidget?: boolean;
55
63
  query: {
56
64
  search?: boolean;
@@ -107,6 +115,25 @@ export type PhiCollectionProviderActionRequest = {
107
115
  params?: Record<string, unknown>;
108
116
  signal: AbortSignal;
109
117
  };
118
+ /**
119
+ * One item read on its own (`readRecord` on the Provider Client), the shape a Table Provider's record
120
+ * read already has: the resource, the item's key as `rowIdentity`, the binding's params, the reader's
121
+ * language and the Site's time zone, and the abort. One shape for both kinds, so a record-bound Form
122
+ * asks either the same way and a Provider that serves both writes one function.
123
+ */
124
+ export type PhiCollectionProviderRecordRequest = PhiTableProviderRecordRequest;
125
+ /**
126
+ * What a Collection View announces on its `actionActivate` output (`collection-action`): which action,
127
+ * and for an item action the item's key, as the resource's `itemIdentityPath` reads it. A toolbar action
128
+ * names no item. `query` is the View's query as it stood, for a Controller that acts in its context (the
129
+ * Media library's new Folder in the open one). Read with `readPhiCollectionActionSignalValue`
130
+ * (`types/collection-signal-values.ts`).
131
+ */
132
+ export type PhiCollectionActionSignalValue = {
133
+ actionKey: string;
134
+ itemKey?: string | number | null;
135
+ query?: PhiCollectionProviderQuery;
136
+ };
110
137
  export type PhiCollectionViewBindingModel = {
111
138
  query: PhiCollectionProviderQuery;
112
139
  data: PhiCollectionProviderData | null;
@@ -0,0 +1,2 @@
1
+ import type { PhiCollectionActionSignalValue } from "./collection-provider";
2
+ export declare function readPhiCollectionActionSignalValue(value: unknown): PhiCollectionActionSignalValue | null;
@@ -0,0 +1,23 @@
1
+ import { isPhiRecord } from "../helpers/is-record";
2
+ /*
3
+ * What a Collection View says on its `actionActivate` output, read by whoever listens: a record-bound
4
+ * Form, the Overlay container (which opens on an action) and Module Controllers. The Overlay container is
5
+ * on every page, so the reader lives apart from the Collection Provider's contract and imports nothing
6
+ * else, as the Table's readers do (`table-signal-values.ts`).
7
+ */
8
+ export function readPhiCollectionActionSignalValue(value) {
9
+ if (!isPhiRecord(value) || typeof value.actionKey !== "string" || !value.actionKey.trim()) {
10
+ return null;
11
+ }
12
+ const itemKey = value.itemKey;
13
+ if (itemKey !== undefined && itemKey !== null &&
14
+ !(typeof itemKey === "string" && itemKey.trim()) &&
15
+ !(typeof itemKey === "number" && Number.isFinite(itemKey))) {
16
+ return null;
17
+ }
18
+ return {
19
+ actionKey: value.actionKey.trim(),
20
+ ...(itemKey == null ? {} : { itemKey: itemKey }),
21
+ ...(isPhiRecord(value.query) ? { query: value.query } : {}),
22
+ };
23
+ }
@@ -71,6 +71,15 @@ export type PhiCmsCollectionViewWidgetConfig = PhiCmsWidgetConfigBase & {
71
71
  /** The one kind the upload takes and the picker lists. Absent: the upload takes every kind, the picker lists images. */
72
72
  mediaType?: PhiMediaKindValue;
73
73
  };
74
+ /**
75
+ * Choosing an item, prepared for the Shop's checkout (an address to deliver to) and read by the address
76
+ * renderer (`PHI_SITE_ADDRESS_ITEM_RENDERER_KEY`) only: `single` lets one tile be chosen, and the choice
77
+ * goes out on the Widget's `selection` output as `{ addressId }` (`site-address-selection`, the
78
+ * resource's `selectionValueSchema`). Absent: nothing is chosen. Nothing reads the choice yet.
79
+ */
80
+ selection?: {
81
+ mode: "single";
82
+ };
74
83
  pagination?: {
75
84
  enabled: boolean;
76
85
  pageSize?: number;
@@ -466,6 +466,12 @@ export type PhiCommandToolbarWidgetPlacement = PhiWidgetPlacementBase & PhiContr
466
466
  */
467
467
  export type PhiThreadConversationWidgetPlacement = PhiWidgetPlacementBase & {
468
468
  reply?: boolean;
469
+ /** The heading in place of the conversation's subject, for a placement that shows one kind and names it. */
470
+ title?: string;
471
+ /** What the Reply says where the placement offers it as something else ("Add note"). */
472
+ replyLabel?: string;
473
+ /** The sentence while no conversation is chosen, in place of the Widget's own. */
474
+ emptyDescription?: string;
469
475
  padding?: number | string;
470
476
  };
471
477
  export type PhiThemeModeSwitchSize = "small" | "medium";
@@ -47,6 +47,8 @@ export declare const PHI_SIGNAL_VALUE_SCHEMAS: {
47
47
  readonly runtimeConditionState: `${string}/signals/${string}`;
48
48
  readonly runtimeNavigation: `${string}/signals/${string}`;
49
49
  readonly runtimeTheme: `${string}/signals/${string}`;
50
+ /** One address of a Site's book chosen among the address tiles: `{ addressId }` (COLLECTIONS.md, "The address renderer"). */
51
+ readonly siteAddressSelection: `${string}/signals/${string}`;
50
52
  readonly authWorkflowState: `${string}/signals/${string}`;
51
53
  readonly stackMeta: `${string}/signals/${string}`;
52
54
  readonly tableAction: `${string}/signals/${string}`;
package/types/signals.js CHANGED
@@ -64,6 +64,8 @@ export const PHI_SIGNAL_VALUE_SCHEMAS = {
64
64
  runtimeConditionState: createPhiSharedSignalValueSchema("runtime-condition-state"),
65
65
  runtimeNavigation: createPhiSharedSignalValueSchema("runtime-navigation"),
66
66
  runtimeTheme: createPhiSharedSignalValueSchema("runtime-theme"),
67
+ /** One address of a Site's book chosen among the address tiles: `{ addressId }` (COLLECTIONS.md, "The address renderer"). */
68
+ siteAddressSelection: createPhiSharedSignalValueSchema("site-address-selection"),
67
69
  authWorkflowState: createPhiSharedSignalValueSchema("auth-workflow-state"),
68
70
  stackMeta: createPhiSharedSignalValueSchema("stack-meta"),
69
71
  tableAction: createPhiSharedSignalValueSchema("table-action"),
@@ -384,6 +384,21 @@ export type PhiTableWidgetPresentation = PhiControlPresentationConfig & {
384
384
  /** Whether the header row stays at the top while the rows scroll under it; on unless this says `false`. */
385
385
  stickyHeader?: boolean;
386
386
  footer?: PhiTableFooterConfig;
387
+ /**
388
+ * Why a Table that shows its header has no footer, said by the preset that placed it: a reason for the
389
+ * next person reading the preset, never drawn and never translated. A Table with a header ends in its
390
+ * footer (TABLES.md, "Footer and summary"); one without a header needs neither, so this is only for the
391
+ * rare Table that has a header and nothing a footer could say -- the one setting of a panel, edited in its
392
+ * cell. `checkPhiPresetTables` takes it in place of the footer and refuses it beside one.
393
+ */
394
+ footerOmitted?: string;
395
+ /**
396
+ * How many skeleton rows stand in for the rows while they load: three where this says nothing
397
+ * (`PHI_TABLE_LOADING_ROWS`), at most `PHI_TABLE_LOADING_ROWS_MAX` and never more than a page holds. Few by
398
+ * default so a Table grows when its rows arrive rather than shrinks; a paged listing known to fill its
399
+ * page may say so (TABLES.md, "Loading").
400
+ */
401
+ loadingRows?: number;
387
402
  summary?: PhiTableSummaryConfig;
388
403
  row?: {
389
404
  striped?: boolean;
@@ -702,6 +717,5 @@ export declare function readPhiTableRowOptions(row: Readonly<Record<string, unkn
702
717
  * options accepts only one of them, which is what keeps a Select limited to its choices on write.
703
718
  */
704
719
  export declare function validatePhiTableProviderFieldValue(field: PhiTableProviderFieldDefinition, value: unknown, row?: Readonly<Record<string, unknown>> | null): string | null;
705
- export declare function validatePhiTableWidgetBinding(config: PhiTableWidgetConfig, resource: PhiTableProviderResourceDescriptor): string[];
706
720
  export declare function readPhiTableProviderError(error: unknown): PhiTableProviderError;
707
721
  export {};