@phis/ui 0.4.3 → 0.4.5

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 (282) hide show
  1. package/README.md +9 -3
  2. package/cms/plugins.d.ts +1 -0
  3. package/cms/plugins.js +2 -0
  4. package/components/cms/phi-cms-root-layout.js +30 -1
  5. package/components/controls/phi-anchor-nav-control.js +4 -1
  6. package/components/controls/phi-background-control.d.ts +6 -1
  7. package/components/controls/phi-background-control.js +30 -7
  8. package/components/controls/phi-bullet-list-control.d.ts +7 -2
  9. package/components/controls/phi-bullet-list-control.js +4 -3
  10. package/components/controls/phi-button-control.d.ts +13 -1
  11. package/components/controls/phi-button-control.js +21 -3
  12. package/components/controls/phi-color-control.js +4 -2
  13. package/components/controls/phi-drawer-control-adapter.js +3 -2
  14. package/components/controls/phi-dropdown-control.js +2 -2
  15. package/components/controls/phi-inline-text-editor.js +7 -1
  16. package/components/controls/phi-length-control.js +1 -1
  17. package/components/controls/phi-media-asset-tile-control.js +10 -10
  18. package/components/controls/phi-progress-control.d.ts +10 -2
  19. package/components/controls/phi-progress-control.js +6 -2
  20. package/components/controls/phi-ribbon-control.d.ts +16 -4
  21. package/components/controls/phi-ribbon-control.js +14 -8
  22. package/components/controls/phi-ribbon-wrap-control.d.ts +32 -0
  23. package/components/controls/phi-ribbon-wrap-control.js +31 -0
  24. package/components/controls/phi-segmented-control.d.ts +4 -1
  25. package/components/controls/phi-segmented-control.js +13 -2
  26. package/components/controls/phi-select-control.js +5 -2
  27. package/components/controls/phi-series-chart-control.d.ts +48 -0
  28. package/components/controls/phi-series-chart-control.js +82 -0
  29. package/components/controls/phi-surface-control.d.ts +2 -0
  30. package/components/controls/phi-surface-control.js +16 -1
  31. package/components/controls/phi-switch-control.d.ts +4 -1
  32. package/components/controls/phi-switch-control.js +8 -2
  33. package/components/controls/phi-tag-control.d.ts +4 -1
  34. package/components/controls/phi-tag-control.js +11 -3
  35. package/components/controls/phi-text-control.js +57 -3
  36. package/components/controls/phi-tree-control.js +1 -1
  37. package/components/controls/phi-truncated-hover-text.d.ts +15 -0
  38. package/components/controls/phi-truncated-hover-text.js +25 -0
  39. package/components/forms/link-target-form-control.d.ts +1 -1
  40. package/components/forms/link-target-form-control.js +2 -45
  41. package/components/forms/phi-form-widget-frame.js +4 -2
  42. package/components/layouts/clients/phi-three-column-layout-client.js +10 -1
  43. package/components/layouts/phi-layout-view-model.js +10 -1
  44. package/components/navigation/phi-link.js +6 -1
  45. package/components/regions/clients/cms-region-container-client.js +16 -1
  46. package/components/regions/phi-cms-region-container.js +7 -0
  47. package/components/regions/phi-cms-region-shell.d.ts +22 -1
  48. package/components/regions/phi-cms-region-shell.js +131 -23
  49. package/components/root/phi-config-provider.d.ts +13 -0
  50. package/components/root/phi-config-provider.js +12 -1
  51. package/components/root/phi-root-background.d.ts +7 -0
  52. package/components/root/phi-root-background.js +20 -1
  53. package/components/root/phi-root-layout.d.ts +1 -0
  54. package/components/root/phi-root-layout.js +1 -0
  55. package/components/root/phi-root-theme-resolver.js +15 -1
  56. package/components/root/phi-shell-chrome-overlay.d.ts +18 -1
  57. package/components/root/phi-shell-chrome-overlay.js +26 -4
  58. package/components/runtime/runtime-module-context.d.ts +12 -1
  59. package/components/runtime/runtime-module-context.js +6 -1
  60. package/components/shell/phi-antd-icon.d.ts +1 -0
  61. package/components/shell/phi-antd-icon.js +3 -0
  62. package/components/shell/phi-cms-shell.d.ts +7 -1
  63. package/components/shell/phi-cms-shell.js +4 -2
  64. package/components/shell/use-phi-shell-header-bands.d.ts +5 -0
  65. package/components/shell/use-phi-shell-header-bands.js +64 -0
  66. package/components/shell/use-phi-shell-sticky-bottom.d.ts +18 -0
  67. package/components/shell/use-phi-shell-sticky-bottom.js +54 -0
  68. package/components/shell/use-phi-shell-sticky-top.js +61 -16
  69. package/components/surface/phi-surface-tone.d.ts +13 -0
  70. package/components/surface/phi-surface-tone.js +21 -0
  71. package/components/tables/client/phi-table-binding.d.ts +1 -0
  72. package/components/tables/client/phi-table-binding.js +22 -3
  73. package/components/trees/client/phi-tree-binding.d.ts +1 -0
  74. package/components/trees/client/phi-tree-binding.js +11 -2
  75. package/components/widgets/client/bullet-list-entries-editor.js +7 -1
  76. package/components/widgets/client/html-editor.js +1 -1
  77. package/components/widgets/client/shared/phi-collection-provider.js +4 -3
  78. package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
  79. package/components/widgets/client/shared/phi-collection-view-binding.js +16 -2
  80. package/components/widgets/client/shared/phi-command-buttons.js +6 -2
  81. package/components/widgets/client/shared/use-page-reference-options.d.ts +17 -0
  82. package/components/widgets/client/shared/use-page-reference-options.js +57 -0
  83. package/components/widgets/config/background.d.ts +52 -1
  84. package/components/widgets/config/background.js +85 -4
  85. package/components/widgets/config/button-variant.d.ts +22 -4
  86. package/components/widgets/config/button-variant.js +24 -5
  87. package/components/widgets/config/common-action-field.d.ts +1 -1
  88. package/components/widgets/config/parser-primitives.js +4 -2
  89. package/components/widgets/config/theme-gradient.d.ts +11 -0
  90. package/components/widgets/config/theme-gradient.js +12 -0
  91. package/components/widgets/label-sets/background.js +4 -0
  92. package/components/widgets/label-sets/geometry.js +2 -0
  93. package/components/widgets/label-sets/inspector.js +4 -0
  94. package/components/widgets/label-types/background.d.ts +2 -0
  95. package/components/widgets/label-types/background.js +2 -0
  96. package/components/widgets/label-types/common-controls.js +2 -2
  97. package/components/widgets/label-types/geometry.d.ts +1 -0
  98. package/components/widgets/label-types/geometry.js +1 -0
  99. package/components/widgets/label-types/inspector.d.ts +4 -0
  100. package/components/widgets/label-types/inspector.js +2 -0
  101. package/components/widgets/shared/bullet-list-vocabulary.d.ts +10 -0
  102. package/components/widgets/shared/bullet-list-vocabulary.js +5 -2
  103. package/components/widgets/shared/card-body-client.d.ts +16 -3
  104. package/components/widgets/shared/card-body-client.js +79 -8
  105. package/components/widgets/shared/card-vocabulary.d.ts +12 -2
  106. package/components/widgets/shared/card-vocabulary.js +7 -0
  107. package/components/widgets/shared/collection-source-failure.d.ts +26 -0
  108. package/components/widgets/shared/collection-source-failure.js +42 -0
  109. package/components/widgets/shared/markdown-body-client.js +39 -10
  110. package/components/widgets/shared/markdown-render.js +16 -3
  111. package/components/widgets/shared/widget-failure-client.d.ts +10 -0
  112. package/components/widgets/shared/widget-failure-client.js +20 -0
  113. package/components/widgets/shared/widget-failure.d.ts +31 -0
  114. package/components/widgets/shared/widget-failure.js +20 -0
  115. package/components/widgets/shared/widget-failure.server.d.ts +9 -0
  116. package/components/widgets/shared/widget-failure.server.js +12 -0
  117. package/gateway/dashboard-card-memo.d.ts +3 -0
  118. package/gateway/dashboard-card-memo.js +25 -0
  119. package/helpers/cms-container-chrome.js +6 -1
  120. package/helpers/cms-region-keys.d.ts +1 -1
  121. package/helpers/layout-style.d.ts +8 -4
  122. package/helpers/layout-style.js +3 -2
  123. package/helpers/locale.d.ts +8 -0
  124. package/helpers/locale.js +18 -0
  125. package/helpers/mode-paint.d.ts +4 -0
  126. package/helpers/mode-paint.js +47 -0
  127. package/helpers/shell-region-style.js +2 -1
  128. package/helpers/surface-style.d.ts +12 -1
  129. package/helpers/surface-style.js +60 -12
  130. package/module-dashboard-cards.d.ts +2 -1
  131. package/module-dashboard-cards.js +2 -1
  132. package/module-records.d.ts +7 -0
  133. package/module-records.js +6 -0
  134. package/package.json +1 -1
  135. package/plugins/runtime-modules/area-definitions.d.ts +0 -42
  136. package/plugins/runtime-modules/area-definitions.js +3 -8
  137. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +21 -2
  138. package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
  139. package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +10 -5
  140. package/plugins/runtime-modules/builder/clients/region-inspector.js +47 -2
  141. package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
  142. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +7 -4
  143. package/plugins/runtime-modules/builder/controller/page-controller.js +7 -0
  144. package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +3 -2
  145. package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
  146. package/plugins/runtime-modules/builder/persistence.js +9 -1
  147. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +25 -15
  148. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +4 -0
  149. package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +15 -4
  150. package/plugins/runtime-modules/client-authoring-module.d.ts +8 -1
  151. package/plugins/runtime-modules/client-authoring-module.js +13 -3
  152. package/plugins/runtime-modules/core/content-entries/record-source.server.d.ts +3 -1
  153. package/plugins/runtime-modules/core/content-entries/record-source.server.js +7 -4
  154. package/plugins/runtime-modules/core/widgets/brand/client.d.ts +12 -3
  155. package/plugins/runtime-modules/core/widgets/brand/client.js +3 -11
  156. package/plugins/runtime-modules/core/widgets/brand/home.d.ts +15 -0
  157. package/plugins/runtime-modules/core/widgets/brand/home.js +18 -0
  158. package/plugins/runtime-modules/core/widgets/brand/plugin.js +3 -2
  159. package/plugins/runtime-modules/core/widgets/brand/server.d.ts +2 -2
  160. package/plugins/runtime-modules/core/widgets/brand/server.js +2 -2
  161. package/plugins/runtime-modules/core/widgets/button/client.js +2 -2
  162. package/plugins/runtime-modules/core/widgets/button/config.d.ts +40 -4
  163. package/plugins/runtime-modules/core/widgets/button/config.js +12 -0
  164. package/plugins/runtime-modules/core/widgets/card/config.d.ts +100 -1
  165. package/plugins/runtime-modules/core/widgets/card/config.js +57 -3
  166. package/plugins/runtime-modules/core/widgets/card/editor.js +21 -4
  167. package/plugins/runtime-modules/core/widgets/card/server.js +5 -0
  168. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +4 -1
  169. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -3
  170. package/plugins/runtime-modules/core/widgets/collection-view/authoring.js +1 -1
  171. package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +3 -0
  172. package/plugins/runtime-modules/core/widgets/collection-view/client.js +47 -11
  173. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +4 -1
  174. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
  175. package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +3 -2
  176. package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +6 -1
  177. package/plugins/runtime-modules/core/widgets/collection-view/server.js +21 -3
  178. package/plugins/runtime-modules/core/widgets/description/client.js +3 -3
  179. package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -0
  180. package/plugins/runtime-modules/core/widgets/description/editor.js +3 -2
  181. package/plugins/runtime-modules/core/widgets/description/server.js +3 -2
  182. package/plugins/runtime-modules/core/widgets/entry-detail/plugin.js +1 -1
  183. package/plugins/runtime-modules/core/widgets/entry-detail/server.d.ts +3 -1
  184. package/plugins/runtime-modules/core/widgets/entry-detail/server.js +5 -2
  185. package/plugins/runtime-modules/core/widgets/entry-header/plugin.js +1 -1
  186. package/plugins/runtime-modules/core/widgets/entry-header/server.d.ts +3 -1
  187. package/plugins/runtime-modules/core/widgets/entry-header/server.js +5 -2
  188. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -0
  189. package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -1
  190. package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +6 -3
  191. package/plugins/runtime-modules/core/widgets/entry-list/server.js +13 -6
  192. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -0
  193. package/plugins/runtime-modules/core/widgets/gallery/plugin.js +1 -1
  194. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -3
  195. package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -6
  196. package/plugins/runtime-modules/core/widgets/header-navigation/client.js +2 -2
  197. package/plugins/runtime-modules/core/widgets/html/client.js +1 -1
  198. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +320 -2
  199. package/plugins/runtime-modules/core/widgets/markdown/config.js +18 -4
  200. package/plugins/runtime-modules/core/widgets/markdown/editor.js +9 -1
  201. package/plugins/runtime-modules/core/widgets/markdown-toc/client.js +6 -1
  202. package/plugins/runtime-modules/core/widgets/markdown-toc/config.d.ts +14 -0
  203. package/plugins/runtime-modules/core/widgets/markdown-toc/config.js +14 -2
  204. package/plugins/runtime-modules/core/widgets/quick-links/authoring.js +7 -2
  205. package/plugins/runtime-modules/core/widgets/quick-links/client.js +2 -2
  206. package/plugins/runtime-modules/core/widgets/quick-links/items.d.ts +0 -2
  207. package/plugins/runtime-modules/core/widgets/quick-links/items.js +0 -15
  208. package/plugins/runtime-modules/core/widgets/record/client.d.ts +4 -1
  209. package/plugins/runtime-modules/core/widgets/record/client.js +8 -3
  210. package/plugins/runtime-modules/core/widgets/record/plugin.js +3 -2
  211. package/plugins/runtime-modules/core/widgets/record/server.d.ts +3 -1
  212. package/plugins/runtime-modules/core/widgets/record/server.js +2 -2
  213. package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -0
  214. package/plugins/runtime-modules/core/widgets/segmented/client.js +1 -1
  215. package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +21 -1
  216. package/plugins/runtime-modules/core/widgets/segmented/config.js +11 -1
  217. package/plugins/runtime-modules/core/widgets/sidebar-navigation/authoring.js +1 -1
  218. package/plugins/runtime-modules/core/widgets/sidebar-navigation/client.js +1 -1
  219. package/plugins/runtime-modules/core/widgets/simple-text/client.js +8 -3
  220. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -0
  221. package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
  222. package/plugins/runtime-modules/core/widgets/switch/client.js +1 -1
  223. package/plugins/runtime-modules/core/widgets/switch/config.d.ts +19 -0
  224. package/plugins/runtime-modules/core/widgets/switch/config.js +11 -0
  225. package/plugins/runtime-modules/core/widgets/table/authoring.js +1 -1
  226. package/plugins/runtime-modules/core/widgets/table/client.d.ts +4 -1
  227. package/plugins/runtime-modules/core/widgets/table/client.js +16 -3
  228. package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -0
  229. package/plugins/runtime-modules/core/widgets/table/plugin.js +3 -2
  230. package/plugins/runtime-modules/core/widgets/table/server.d.ts +3 -1
  231. package/plugins/runtime-modules/core/widgets/table/server.js +2 -2
  232. package/plugins/runtime-modules/core/widgets/table/static-resource-editor.js +2 -1
  233. package/plugins/runtime-modules/core/widgets/timeline/authoring.js +1 -1
  234. package/plugins/runtime-modules/core/widgets/timeline/client.d.ts +1 -3
  235. package/plugins/runtime-modules/core/widgets/timeline/client.js +14 -4
  236. package/plugins/runtime-modules/core/widgets/tree/authoring.js +1 -1
  237. package/plugins/runtime-modules/core/widgets/tree/client.d.ts +4 -1
  238. package/plugins/runtime-modules/core/widgets/tree/client.js +13 -2
  239. package/plugins/runtime-modules/core/widgets/tree/plugin.js +3 -2
  240. package/plugins/runtime-modules/core/widgets/tree/server.d.ts +3 -1
  241. package/plugins/runtime-modules/core/widgets/tree/server.js +2 -2
  242. package/plugins/runtime-modules/dashboard/card-rows.d.ts +3 -1
  243. package/plugins/runtime-modules/dashboard/card-rows.js +30 -2
  244. package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +29 -7
  245. package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +5 -40
  246. package/plugins/runtime-modules/theme/presets.d.ts +9 -1
  247. package/plugins/runtime-modules/theme/tour.d.ts +9 -1
  248. package/plugins/runtime-modules/theme/tour.js +10 -1
  249. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +157 -22
  250. package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +5 -9
  251. package/runtime-data-provider-client.d.ts +2 -0
  252. package/runtime-data-provider-client.js +7 -0
  253. package/server-helpers/cms-link-targets.js +6 -0
  254. package/styles/controls.css +74 -7
  255. package/styles/gradients.css +101 -0
  256. package/styles/layout.css +45 -2
  257. package/styles/root.css +18 -0
  258. package/styles/shell.css +137 -0
  259. package/theme/phi-antd-token-resolver.js +20 -1
  260. package/theme/phi-button-shadow.d.ts +6 -0
  261. package/theme/phi-theme-gradients.d.ts +96 -0
  262. package/theme/phi-theme-gradients.js +245 -0
  263. package/theme/phi-theme-presets.d.ts +3 -0
  264. package/theme/phi-theme-presets.js +3 -0
  265. package/theme/phi-theme-tokens.d.ts +6 -2
  266. package/theme/phi-theme-tokens.js +15 -0
  267. package/theme/phi-theme.d.ts +5 -0
  268. package/theme/phi-theme.js +21 -0
  269. package/theme/phi-tokens.d.ts +16 -15
  270. package/theme/phi-tokens.js +16 -15
  271. package/types/cms-plugins.d.ts +2 -0
  272. package/types/cms-presets.d.ts +7 -0
  273. package/types/core-widget-placements.d.ts +3 -0
  274. package/types/dashboard-cards.d.ts +39 -4
  275. package/types/dashboard-cards.js +6 -0
  276. package/types/layout-style.d.ts +9 -8
  277. package/types/layout-style.js +9 -8
  278. package/types/site-theme.d.ts +10 -2
  279. package/types/surface.d.ts +4 -0
  280. package/types/surface.js +4 -0
  281. package/types.d.ts +1 -1
  282. package/types.js +1 -1
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { createContext, lazy, useContext, useMemo, } from "react";
3
+ import { createContext, lazy, useCallback, useContext, useMemo, } from "react";
4
4
  const PhiRuntimeModuleAuthoringContext = createContext(new Map());
5
5
  function createPhiLazyAuthoringLayout(load) {
6
6
  return lazy(async () => {
@@ -54,8 +54,7 @@ export function usePhiRuntimeModuleAuthoringRegistration(moduleId) {
54
54
  const modules = useContext(PhiRuntimeModuleAuthoringContext);
55
55
  return moduleId ? modules.get(moduleId) ?? null : null;
56
56
  }
57
- export function usePhiAuthoringLayoutDefinition(type) {
58
- const modules = useContext(PhiRuntimeModuleAuthoringContext);
57
+ function findPhiAuthoringLayoutDefinition(modules, type) {
59
58
  for (const registration of modules.values()) {
60
59
  const definition = registration.layoutsByType.get(type);
61
60
  if (definition) {
@@ -64,3 +63,14 @@ export function usePhiAuthoringLayoutDefinition(type) {
64
63
  }
65
64
  return null;
66
65
  }
66
+ /**
67
+ * The authoring Layout definitions, as a lookup by type rather than one type's answer.
68
+ *
69
+ * A Layout names its nested Layouts only while it renders its children, and a parent Layout sizes each
70
+ * slot by the props of the element standing in it, before that element renders: a nested Layout's
71
+ * element has to carry its policy already, and a hook inside it would be too late.
72
+ */
73
+ export function usePhiAuthoringLayoutDefinitionResolver() {
74
+ const modules = useContext(PhiRuntimeModuleAuthoringContext);
75
+ return useCallback((type) => findPhiAuthoringLayoutDefinition(modules, type), [modules]);
76
+ }
@@ -6,7 +6,8 @@ import type { PhiRuntimeDataProviderBinding } from "../../../../types/runtime-da
6
6
  /**
7
7
  * The entry an entry Widget is bound to, as the three of them draw it: the record, none by that address,
8
8
  * or none to be had. A record of another shape -- a binding to some other Module's Provider -- is no entry,
9
- * and is said as unavailable rather than drawn as an empty one.
9
+ * and is said as unavailable rather than drawn as an empty one. An unavailable one says why, which is
10
+ * what the author reads in the Builder and the operator in the log.
10
11
  */
11
12
  export declare function readPhiBoundContentEntry(input: {
12
13
  registry: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey"> | undefined;
@@ -19,4 +20,5 @@ export declare function readPhiBoundContentEntry(input: {
19
20
  status: "missing";
20
21
  } | {
21
22
  status: "unavailable";
23
+ reason: string;
22
24
  }>;
@@ -4,16 +4,19 @@ import { readPhiContentEntryRecord } from "../../../../types/content-entries";
4
4
  /**
5
5
  * The entry an entry Widget is bound to, as the three of them draw it: the record, none by that address,
6
6
  * or none to be had. A record of another shape -- a binding to some other Module's Provider -- is no entry,
7
- * and is said as unavailable rather than drawn as an empty one.
7
+ * and is said as unavailable rather than drawn as an empty one. An unavailable one says why, which is
8
+ * what the author reads in the Builder and the operator in the log.
8
9
  */
9
10
  export async function readPhiBoundContentEntry(input) {
10
11
  if (!input.registry) {
11
- return { status: "unavailable" };
12
+ return { status: "unavailable", reason: "No record providers are available outside a page render." };
12
13
  }
13
14
  const result = await resolvePhiRecordSource({ ...input, registry: input.registry });
14
15
  if (result.status !== "ok") {
15
- return result.status === "missing" ? result : { status: "unavailable" };
16
+ return result;
16
17
  }
17
18
  const record = readPhiContentEntryRecord(result.record);
18
- return record ? { status: "ok", record } : { status: "unavailable" };
19
+ return record
20
+ ? { status: "ok", record }
21
+ : { status: "unavailable", reason: `The record bound from "${input.binding.providerKey}" is not a content entry.` };
19
22
  }
@@ -11,10 +11,19 @@ export type PhiBrandWidgetConfig = {
11
11
  export declare const PHI_BRAND_LINE_FALLBACK_ICONS: Record<PhiBrandWidgetLineMode, string>;
12
12
  export type PhiBrandWidgetClientProps = PhiClientBlockBaseProps<PhiNoLabels, PhiBrandWidgetConfig> & {
13
13
  fallbackTitle?: ReactNode;
14
- /** The language being read, which the way home keeps. */
15
- locale?: string;
14
+ /**
15
+ * Where the Brand leads, resolved on the Server: the Theme's `homeLinkTarget`, or the Site root in the
16
+ * language being read. A Page reference means nothing in a browser, so the address travels instead.
17
+ */
18
+ home?: PhiBrandWidgetHome;
16
19
  interactive?: boolean;
17
20
  };
21
+ /** A ready address, and whether it leaves the Site -- the shape `resolvePhiLinkHref` answers. */
22
+ export type PhiBrandWidgetHome = {
23
+ href: string;
24
+ newTab: boolean;
25
+ external: boolean;
26
+ };
18
27
  /**
19
28
  * The Brand in the Site frame: what `PhiBrandControl` shows, and where clicking it leads.
20
29
  *
@@ -22,4 +31,4 @@ export type PhiBrandWidgetClientProps = PhiClientBlockBaseProps<PhiNoLabels, Phi
22
31
  * because the Theme workspace preview shows the same Brand without being in a frame and without
23
32
  * leading anywhere.
24
33
  */
25
- export declare function PhiBrandWidgetClient({ config, locale, fallbackTitle, interactive, }: PhiBrandWidgetClientProps): import("react").JSX.Element | null;
34
+ export declare function PhiBrandWidgetClient({ config, home, fallbackTitle, interactive, }: PhiBrandWidgetClientProps): import("react").JSX.Element | null;
@@ -1,13 +1,12 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import Link from "next/link";
4
3
  import { PhiBrandControl, PhiBrandLineControl, phiBrandControlIsEmpty, } from "../../../../../components/controls/phi-brand-control";
5
4
  import { isPhiBrandWidgetLineMode, } from "./mode";
6
5
  import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
7
6
  import { usePhiSiteBrand } from "../../../../../components/root/phi-root-live-theme-provider";
8
7
  import { resolvePhiWidgetFontFamily } from "../../../../../components/widgets/helpers/font-family";
9
8
  import { resolvePhiWidgetFontSize } from "../../../../../components/widgets/helpers/font-size";
10
- import { localizePath } from "../../../../../helpers/locale";
9
+ import { PhiLink } from "../../../../../components/navigation/phi-link";
11
10
  /** What a line shows in front of itself where the Brand names no icon for it. */
12
11
  export const PHI_BRAND_LINE_FALLBACK_ICONS = {
13
12
  slogan: "antd:star",
@@ -20,7 +19,7 @@ export const PHI_BRAND_LINE_FALLBACK_ICONS = {
20
19
  * because the Theme workspace preview shows the same Brand without being in a frame and without
21
20
  * leading anywhere.
22
21
  */
23
- export function PhiBrandWidgetClient({ config, locale, fallbackTitle, interactive = true, }) {
22
+ export function PhiBrandWidgetClient({ config, home, fallbackTitle, interactive = true, }) {
24
23
  const brand = usePhiSiteBrand();
25
24
  // The Theme's mode, not the Widget's: one picks the Logo's picture, the other what is drawn at all.
26
25
  const { fonts, token, mode: themeMode } = usePhiConfig();
@@ -54,13 +53,6 @@ export function PhiBrandWidgetClient({ config, locale, fallbackTitle, interactiv
54
53
  if (phiBrandControlIsEmpty(presentation)) {
55
54
  return null;
56
55
  }
57
- /*
58
- * The front page in the language being read. `/` alone is answered with a redirect to the visitor's
59
- * preferred language, so a reader of `/de` could be led to `/en`; and Next's prefetch of it, which loses
60
- * its `_rsc` on that redirect, came back with the static tree's own address and a 404
61
- * (AUDIT-2026-10-13, PM15).
62
- */
63
- const homeHref = brand?.homeHref?.trim() || (locale ? localizePath(locale, "/") : "/");
64
56
  const linkStyle = {
65
57
  color: "inherit",
66
58
  textDecoration: "none",
@@ -73,5 +65,5 @@ export function PhiBrandWidgetClient({ config, locale, fallbackTitle, interactiv
73
65
  if (!interactive) {
74
66
  return (_jsx("span", { "aria-disabled": "true", style: linkStyle, children: _jsx(PhiBrandControl, { ...presentation }) }));
75
67
  }
76
- return (_jsx(Link, { href: homeHref, style: linkStyle, children: _jsx(PhiBrandControl, { ...presentation }) }));
68
+ return (_jsx(PhiLink, { href: home?.href ?? "/", external: home?.external, newTab: home?.newTab, style: linkStyle, children: _jsx(PhiBrandControl, { ...presentation }) }));
77
69
  }
@@ -0,0 +1,15 @@
1
+ import type { PhiBlockRuntime } from "../../../../../types";
2
+ import { type PhiResolvedLinkTargets } from "../../../../../types/references";
3
+ import type { PhiBrandWidgetHome } from "./client";
4
+ /**
5
+ * Where the Brand leads, as an address: the Theme's target, resolved in this render's batch of link
6
+ * targets (`resolvePhiCmsTreeLinkTargets` collects the Brand's beside the tree's), or the Site root.
7
+ *
8
+ * The root is the root in the language being read. `/` alone is answered with a redirect to the
9
+ * visitor's preferred language, so a reader of `/de` could be led to `/en`; and Next's prefetch of it,
10
+ * which loses its `_rsc` on that redirect, came back with the static tree's own address and a 404
11
+ * (AUDIT-2026-10-13, PM15). A target that does not resolve -- a Page deleted, unpublished, or brought by
12
+ * a Module that is switched off -- leads there too: the Brand is the way home and always leads somewhere.
13
+ * A resolved Page path is already locale- and Area-correct (`REFERENCES.md`).
14
+ */
15
+ export declare function resolvePhiBrandWidgetHome(runtime: Pick<PhiBlockRuntime, "site" | "locale">, links: PhiResolvedLinkTargets | null | undefined): PhiBrandWidgetHome;
@@ -0,0 +1,18 @@
1
+ import { resolvePhiLinkHref } from "../../../../../helpers/link-target";
2
+ import { localizePath } from "../../../../../helpers/locale";
3
+ import { readPhiLinkTarget } from "../../../../../types/references";
4
+ /**
5
+ * Where the Brand leads, as an address: the Theme's target, resolved in this render's batch of link
6
+ * targets (`resolvePhiCmsTreeLinkTargets` collects the Brand's beside the tree's), or the Site root.
7
+ *
8
+ * The root is the root in the language being read. `/` alone is answered with a redirect to the
9
+ * visitor's preferred language, so a reader of `/de` could be led to `/en`; and Next's prefetch of it,
10
+ * which loses its `_rsc` on that redirect, came back with the static tree's own address and a 404
11
+ * (AUDIT-2026-10-13, PM15). A target that does not resolve -- a Page deleted, unpublished, or brought by
12
+ * a Module that is switched off -- leads there too: the Brand is the way home and always leads somewhere.
13
+ * A resolved Page path is already locale- and Area-correct (`REFERENCES.md`).
14
+ */
15
+ export function resolvePhiBrandWidgetHome(runtime, links) {
16
+ return resolvePhiLinkHref(readPhiLinkTarget(runtime.site.theme?.brand?.homeLinkTarget), links)
17
+ ?? { href: localizePath(runtime.locale.current, "/"), newTab: false, external: false };
18
+ }
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { resolvePhiBrandWordmarkText } from "../../../../../helpers/brand-wordmark";
3
+ import { resolvePhiBrandWidgetHome } from "./home";
3
4
  import { PhiBrandWidget } from "./server";
4
5
  import { PHI_BRAND_WIDGET_DEFINITION, PHI_BRAND_WIDGET_PLUGIN_TYPE, } from "./config";
5
6
  /*
@@ -13,7 +14,7 @@ import { PHI_BRAND_WIDGET_DEFINITION, PHI_BRAND_WIDGET_PLUGIN_TYPE, } from "./co
13
14
  */
14
15
  export const PHI_BRAND_WIDGET_PLUGIN = {
15
16
  ...PHI_BRAND_WIDGET_DEFINITION,
16
- render: ({ widget, config, runtime }) => (_jsx(PhiBrandWidget, { fallbackTitle: resolvePhiBrandWordmarkText(runtime), locale: runtime.locale.current, mode: config.mode, fontFamily: config.fontFamily, fontSize: config.fontSize }, `widget-${widget.id}`)),
17
- renderPreview: ({ widget, config, runtime }) => (_jsx(PhiBrandWidget, { fallbackTitle: resolvePhiBrandWordmarkText(runtime), locale: runtime.locale.current, mode: config.mode, fontFamily: config.fontFamily, fontSize: config.fontSize, interactive: false }, `widget-${widget.id}`)),
17
+ render: ({ widget, config, runtime, links }) => (_jsx(PhiBrandWidget, { fallbackTitle: resolvePhiBrandWordmarkText(runtime), home: resolvePhiBrandWidgetHome(runtime, links), mode: config.mode, fontFamily: config.fontFamily, fontSize: config.fontSize }, `widget-${widget.id}`)),
18
+ renderPreview: ({ widget, config, runtime, links }) => (_jsx(PhiBrandWidget, { fallbackTitle: resolvePhiBrandWordmarkText(runtime), home: resolvePhiBrandWidgetHome(runtime, links), mode: config.mode, fontFamily: config.fontFamily, fontSize: config.fontSize, interactive: false }, `widget-${widget.id}`)),
18
19
  };
19
20
  export { PHI_BRAND_WIDGET_PLUGIN_TYPE };
@@ -1,3 +1,3 @@
1
1
  import type { PhiBrandWidgetClientProps, PhiBrandWidgetConfig } from "./client";
2
- export type PhiBrandWidgetProps = Pick<PhiBrandWidgetClientProps, "fallbackTitle" | "interactive" | "locale"> & PhiBrandWidgetConfig;
3
- export declare function PhiBrandWidget({ fallbackTitle, interactive, locale, mode, fontFamily, fontSize, }: PhiBrandWidgetProps): import("react").JSX.Element;
2
+ export type PhiBrandWidgetProps = Pick<PhiBrandWidgetClientProps, "fallbackTitle" | "interactive" | "home"> & PhiBrandWidgetConfig;
3
+ export declare function PhiBrandWidget({ fallbackTitle, interactive, home, mode, fontFamily, fontSize, }: PhiBrandWidgetProps): import("react").JSX.Element;
@@ -5,12 +5,12 @@ import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runt
5
5
  * The Brand itself is not read here. It comes from the root on the Client (`usePhiSiteBrand`), which
6
6
  * holds it with the Theme Set's Logo folded in and follows a live Theme draft.
7
7
  */
8
- export function PhiBrandWidget({ fallbackTitle, interactive, locale, mode, fontFamily, fontSize, }) {
8
+ export function PhiBrandWidget({ fallbackTitle, interactive, home, mode, fontFamily, fontSize, }) {
9
9
  const config = { mode, fontFamily, fontSize };
10
10
  return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Brand, componentProps: {
11
11
  config,
12
12
  fallbackTitle,
13
- locale,
13
+ home,
14
14
  interactive,
15
15
  } }));
16
16
  }
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { resolvePhiButtonVariantType } from "../../../../../components/widgets/config/button-variant";
3
+ import { resolvePhiButtonVariantPresentation } from "../../../../../components/widgets/config/button-variant";
4
4
  import { usePhiControlSignalController } from "../../../../../components/widgets/client/shared/phi-control-signals";
5
5
  import { usePhiControlBadgeController } from "../../../../../components/widgets/client/shared/phi-control-badge";
6
6
  import { resolvePhiButtonIcon } from "../../../../../components/widgets/client/shared/phi-button-icons";
@@ -57,7 +57,7 @@ export function PhiButtonWidget({ config, labels, link, disabled, signalsEnabled
57
57
  const tooltip = config?.tooltip;
58
58
  return (_jsx(PhiButtonControl, { label: label, ...(label ? {} : { ariaLabel: tooltip ?? action?.label }), ...(link && !config?.signalRoutes?.emits?.length
59
59
  ? { href: link.href, newTab: link.newTab, external: link.external }
60
- : {}), tooltip: tooltip, type: resolvePhiButtonVariantType(action ? action.variant : config?.variant), danger: action ? action.danger === true : config?.danger === true, disabled: resolvedDisabled, size: config?.controlSize, icon: icon, onClick: publish, badge: {
60
+ : {}), tooltip: tooltip, ...resolvePhiButtonVariantPresentation(action ? action.variant : config?.variant, config?.gradient), danger: action ? action.danger === true : config?.danger === true, disabled: resolvedDisabled, size: config?.controlSize, icon: icon, onClick: publish, badge: {
61
61
  enabled: badge.enabled,
62
62
  value: badge.visible ? badge.value : 0,
63
63
  color: badge.color,
@@ -1,3 +1,4 @@
1
+ import { type PhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
1
2
  import { type PhiButtonVariant } from "../../../../../components/widgets/config/button-variant";
2
3
  import { type PhiCommonControlActionKey } from "../../../../../components/widgets/label-types/common-controls";
3
4
  import { type PhiLinkTarget } from "../../../../../types/references";
@@ -15,6 +16,8 @@ export type PhiButtonWidgetConfig = PhiCmsWidgetConfigBase & PhiControlBadgeConf
15
16
  icon?: string;
16
17
  value?: string;
17
18
  variant?: PhiButtonVariant;
19
+ /** The Theme gradient slot a `gradient` Button is filled with; absent, the first. */
20
+ gradient?: PhiThemeGradientKey;
18
21
  /**
19
22
  * Where it leads, for a Button that is a way somewhere rather than a command.
20
23
  *
@@ -146,38 +149,69 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
146
149
  } | {
147
150
  readonly value: "link";
148
151
  readonly label: "Link";
152
+ } | {
153
+ readonly value: "gradient";
154
+ readonly label: "Gradient";
155
+ } | {
156
+ readonly value: "glass";
157
+ readonly label: "Glass";
149
158
  })[];
159
+ description?: undefined;
160
+ placeholder?: undefined;
161
+ visibleWhen?: undefined;
162
+ emptyValue?: undefined;
163
+ editorPlacement?: undefined;
164
+ heading?: undefined;
165
+ } | {
166
+ key: string;
167
+ type: "choice";
168
+ label: string;
169
+ description: string;
170
+ options: {
171
+ value: "gradient1" | "gradient2" | "gradient3";
172
+ label: string;
173
+ }[];
174
+ placeholder: string;
175
+ visibleWhen: {
176
+ field: string;
177
+ equals: string;
178
+ };
150
179
  emptyValue?: undefined;
151
180
  editorPlacement?: undefined;
152
181
  heading?: undefined;
153
- visibleWhen?: undefined;
154
182
  } | {
155
183
  key: string;
156
184
  type: "string";
157
185
  label: string;
158
186
  emptyValue: "";
159
187
  options?: undefined;
188
+ description?: undefined;
189
+ placeholder?: undefined;
190
+ visibleWhen?: undefined;
160
191
  editorPlacement?: undefined;
161
192
  heading?: undefined;
162
- visibleWhen?: undefined;
163
193
  } | {
164
194
  key: string;
165
195
  type: "string";
166
196
  label: string;
167
197
  options?: undefined;
198
+ description?: undefined;
199
+ placeholder?: undefined;
200
+ visibleWhen?: undefined;
168
201
  emptyValue?: undefined;
169
202
  editorPlacement?: undefined;
170
203
  heading?: undefined;
171
- visibleWhen?: undefined;
172
204
  } | {
173
205
  key: string;
174
206
  type: "icon";
175
207
  label: string;
176
208
  editorPlacement: "toolbar";
177
209
  options?: undefined;
210
+ description?: undefined;
211
+ placeholder?: undefined;
212
+ visibleWhen?: undefined;
178
213
  emptyValue?: undefined;
179
214
  heading?: undefined;
180
- visibleWhen?: undefined;
181
215
  } | {
182
216
  key: string;
183
217
  type: "link-target";
@@ -188,6 +222,8 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
188
222
  equals: null;
189
223
  };
190
224
  options?: undefined;
225
+ description?: undefined;
226
+ placeholder?: undefined;
191
227
  emptyValue?: undefined;
192
228
  editorPlacement?: undefined;
193
229
  })[];
@@ -1,4 +1,6 @@
1
1
  import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
2
+ import { readPhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
3
+ import { PHI_THEME_GRADIENT_FIELD_OPTIONS } from "../../../../../components/widgets/config/theme-gradient";
2
4
  import { PHI_BUTTON_VARIANT_FIELD_OPTIONS, readPhiButtonVariant, } from "../../../../../components/widgets/config/button-variant";
3
5
  import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../../types/signals";
4
6
  import { createPhiCommonActionField, readPhiControlLabel, } from "../../../../../components/widgets/config/common-action-field";
@@ -21,6 +23,7 @@ function parsePhiButtonWidgetConfig(config) {
21
23
  icon: readString(config.icon),
22
24
  value: readString(config.value),
23
25
  variant: readPhiButtonVariant(config.variant),
26
+ gradient: readPhiThemeGradientKey(config.gradient),
24
27
  linkTarget: readPhiLinkTarget(config.linkTarget) ?? undefined,
25
28
  danger: readBoolean(config.danger),
26
29
  };
@@ -71,6 +74,15 @@ export const PHI_BUTTON_WIDGET_DEFINITION = {
71
74
  label: "Variant",
72
75
  options: [...PHI_BUTTON_VARIANT_FIELD_OPTIONS],
73
76
  },
77
+ {
78
+ key: "gradient",
79
+ type: "choice",
80
+ label: "Gradient",
81
+ description: "Which of the Theme's gradients fills the Button. The Theme decides how each one looks, per mode.",
82
+ options: [...PHI_THEME_GRADIENT_FIELD_OPTIONS],
83
+ placeholder: "Gradient 1",
84
+ visibleWhen: { field: "variant", equals: "gradient" },
85
+ },
74
86
  { key: "label", type: "string", label: "Label", emptyValue: "" },
75
87
  { key: "tooltip", type: "string", label: "Tooltip" },
76
88
  { key: "icon", type: "icon", label: "Icon", editorPlacement: "toolbar" },
@@ -1,8 +1,11 @@
1
+ import { type PhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
2
+ import { type PhiButtonVariant } from "../../../../../components/widgets/config/button-variant";
1
3
  import type { PhiCmsConfigField } from "../../../../../types/cms-plugins";
2
4
  import type { PhiImageAssetVariantKeyValue } from "../../../../../types/media";
3
5
  import { type PhiLinkTarget } from "../../../../../types/references";
6
+ import { type PhiBackgroundOverlay } from "../../../../../components/widgets/config/background";
4
7
  import { type PhiBulletListEntry, type PhiBulletListStyle } from "../../../../../components/widgets/shared/bullet-list-vocabulary";
5
- import { type PhiCardBillingPeriod, type PhiCardHeadingLevel, type PhiCardHoverEffect, type PhiCardIconPlacement, type PhiCardTextAlign, type PhiCardVariant, type PhiCardWidgetBody } from "../../../../../components/widgets/shared/card-vocabulary";
8
+ import { type PhiCardBillingPeriod, type PhiCardHeadingLevel, type PhiCardHoverEffect, type PhiCardIconPlacement, type PhiCardTextAlign, type PhiCardBadgeStyle, type PhiCardVariant, type PhiCardWidgetBody } from "../../../../../components/widgets/shared/card-vocabulary";
6
9
  import { type PhiSignalRouteSet } from "../../../../../types/signals";
7
10
  import { type PhiCmsWidgetConfigBase } from "../../../../../components/widgets/config/parser-primitives";
8
11
  type PhiCardImageSource = {
@@ -27,6 +30,10 @@ export type PhiCmsCardWidgetConfig = PhiCmsWidgetConfigBase & PhiCardImageSource
27
30
  badge?: string;
28
31
  /** The band's colour; absent, the Theme's primary. */
29
32
  badgeColor?: string;
33
+ /** How the badge is drawn (`PHI_CARD_BADGE_STYLES`); absent, `none`. */
34
+ badgeStyle?: PhiCardBadgeStyle;
35
+ /** A Theme gradient slot the badge is filled with, over `badgeColor`; absent, the colour. */
36
+ badgeGradient?: PhiThemeGradientKey;
30
37
  /** A `plan` body's prices, never translated, and what each is paid per (`/ month`), which is. */
31
38
  price?: string;
32
39
  pricePeriod?: string;
@@ -51,6 +58,12 @@ export type PhiCmsCardWidgetConfig = PhiCmsWidgetConfigBase & PhiCardImageSource
51
58
  alt?: string;
52
59
  /** How much of the picture shows, in percent; the card's ground shows through the rest. */
53
60
  imageOpacity?: number;
61
+ /**
62
+ * A layer laid over the picture, under the card's marks and words: a colour, a gradient that fades the
63
+ * picture into the card, a pattern. The Background Overlay's shape (`PhiBackgroundOverlay`); stated by
64
+ * a Preset or an agent, not offered in the Inspector yet.
65
+ */
66
+ imageOverlay?: PhiBackgroundOverlay;
54
67
  /** Where the whole card leads. */
55
68
  linkTarget?: PhiLinkTarget;
56
69
  /** Whether the card draws its action button. */
@@ -63,6 +76,10 @@ export type PhiCmsCardWidgetConfig = PhiCmsWidgetConfigBase & PhiCardImageSource
63
76
  actionIcon?: string;
64
77
  /** Where the action button leads; absent, nowhere -- it then only emits `activate`. */
65
78
  actionLinkTarget?: PhiLinkTarget;
79
+ /** How the action button stands out; absent, primary on a highlighted card and normal otherwise. */
80
+ actionVariant?: PhiButtonVariant;
81
+ /** The Theme gradient slot a `gradient` action button is filled with; absent, the first. */
82
+ actionGradient?: PhiThemeGradientKey;
66
83
  /** How the card is set; the look is the card's Surface. */
67
84
  variant?: PhiCardVariant;
68
85
  highlight?: boolean;
@@ -106,6 +123,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
106
123
  imageOpacity: number;
107
124
  headingLevel: "h3";
108
125
  textAlign: "start";
126
+ badgeStyle: "none";
109
127
  };
110
128
  creationConfig: {
111
129
  surface: {
@@ -130,6 +148,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
130
148
  imageOpacity: number;
131
149
  headingLevel: "h3";
132
150
  textAlign: "start";
151
+ badgeStyle: "none";
133
152
  };
134
153
  fields: (({
135
154
  key: string;
@@ -142,6 +161,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
142
161
  } & {
143
162
  type: "string" | "url" | "icon";
144
163
  emptyValue?: "";
164
+ placeholder?: string;
145
165
  }) | ({
146
166
  key: string;
147
167
  label: string;
@@ -441,7 +461,86 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
441
461
  visibleWhen: {
442
462
  field: string;
443
463
  notEquals: null;
464
+ equals?: undefined;
465
+ };
466
+ description?: undefined;
467
+ emptyOption?: undefined;
468
+ placeholder?: undefined;
469
+ } | {
470
+ key: string;
471
+ type: "choice";
472
+ label: string;
473
+ description: string;
474
+ options: ({
475
+ readonly value: "normal";
476
+ readonly label: "Normal";
477
+ } | {
478
+ readonly value: "primary";
479
+ readonly label: "Primary";
480
+ } | {
481
+ readonly value: "dashed";
482
+ readonly label: "Dashed";
483
+ } | {
484
+ readonly value: "subtle";
485
+ readonly label: "Subtle";
486
+ } | {
487
+ readonly value: "link";
488
+ readonly label: "Link";
489
+ } | {
490
+ readonly value: "gradient";
491
+ readonly label: "Gradient";
492
+ } | {
493
+ readonly value: "glass";
494
+ readonly label: "Glass";
495
+ })[];
496
+ emptyOption: {
497
+ value: string;
498
+ label: string;
499
+ };
500
+ visibleWhen: {
501
+ field: string;
502
+ equals: true;
503
+ notEquals?: undefined;
504
+ };
505
+ presentation?: undefined;
506
+ placeholder?: undefined;
507
+ } | {
508
+ key: string;
509
+ type: "choice";
510
+ label: string;
511
+ options: {
512
+ value: "gradient1" | "gradient2" | "gradient3";
513
+ label: string;
514
+ }[];
515
+ placeholder: string;
516
+ visibleWhen: {
517
+ field: string;
518
+ equals: string;
519
+ notEquals?: undefined;
520
+ };
521
+ presentation?: undefined;
522
+ description?: undefined;
523
+ emptyOption?: undefined;
524
+ } | {
525
+ key: string;
526
+ type: "choice";
527
+ label: string;
528
+ description: string;
529
+ options: {
530
+ value: "gradient1" | "gradient2" | "gradient3";
531
+ label: string;
532
+ }[];
533
+ emptyOption: {
534
+ value: string;
535
+ label: string;
536
+ };
537
+ visibleWhen: {
538
+ field: string;
539
+ notEquals: string;
540
+ equals?: undefined;
444
541
  };
542
+ presentation?: undefined;
543
+ placeholder?: undefined;
445
544
  })[];
446
545
  parseConfig: typeof parsePhiCmsCardWidgetConfig;
447
546
  };
@@ -1,10 +1,14 @@
1
+ import { readPhiThemeGradientKey } from "../../../../../theme/phi-theme-gradients";
2
+ import { PHI_THEME_GRADIENT_FIELD_OPTIONS } from "../../../../../components/widgets/config/theme-gradient";
3
+ import { PHI_BUTTON_VARIANT_FIELD_OPTIONS, readPhiButtonVariant, } from "../../../../../components/widgets/config/button-variant";
1
4
  import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
2
5
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
3
6
  import { readPhiLinkTarget } from "../../../../../types/references";
4
7
  import { readPhiMediaImageSourceConfig } from "../../../../../components/widgets/config/image-source-parser";
5
8
  import { PHI_SURFACE_CARD } from "../../../../../helpers/surface-presets";
9
+ import { normalizePhiBackgroundWidgetConfig } from "../../../../../components/widgets/config/background";
6
10
  import { buildPhiBulletListFields, readPhiBulletListEntries, readPhiBulletListStyle, } from "../../../../../components/widgets/shared/bullet-list-vocabulary";
7
- import { PHI_CARD_HEADING_LEVELS, PHI_CARD_HOVER_EFFECTS, PHI_CARD_ICON_PLACEMENTS, PHI_CARD_TEXT_ALIGNS, PHI_CARD_VARIANTS, readPhiCardBillingPeriod, } from "../../../../../components/widgets/shared/card-vocabulary";
11
+ import { PHI_CARD_HEADING_LEVELS, PHI_CARD_HOVER_EFFECTS, PHI_CARD_ICON_PLACEMENTS, PHI_CARD_TEXT_ALIGNS, PHI_CARD_BADGE_STYLES, PHI_CARD_VARIANTS, readPhiCardBillingPeriod, } from "../../../../../components/widgets/shared/card-vocabulary";
8
12
  import { readPhiControlLabel } from "../../../../../components/widgets/config/common-action-field";
9
13
  import { PHI_CARD_SIGNALS } from "../../../../../components/widgets/signals/control-signal-capabilities";
10
14
  import { readPhiSignalRouteSet } from "../../../../../types/signals";
@@ -13,6 +17,10 @@ import { readBoolean, readRenderableBlockConfig, readString, } from "../../../..
13
17
  function readPhiCardImageOpacity(value) {
14
18
  return typeof value === "number" && Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : undefined;
15
19
  }
20
+ /** The Overlay over the picture, read as a Background reads its own; one it cannot read is none. */
21
+ function readPhiCardImageOverlay(value) {
22
+ return value == null ? undefined : normalizePhiBackgroundWidgetConfig({ base: { kind: "none" }, overlay: value }).overlay ?? undefined;
23
+ }
16
24
  function readChoice(value, choices) {
17
25
  return choices.includes(value) ? value : undefined;
18
26
  }
@@ -27,6 +35,8 @@ function parsePhiCmsCardWidgetConfig(config) {
27
35
  value: readString(config.value),
28
36
  badge: readString(config.badge),
29
37
  badgeColor: readString(config.badgeColor),
38
+ badgeStyle: readChoice(readString(config.badgeStyle), PHI_CARD_BADGE_STYLES),
39
+ badgeGradient: readPhiThemeGradientKey(config.badgeGradient),
30
40
  price: readString(config.price),
31
41
  pricePeriod: readString(config.pricePeriod),
32
42
  priceYearly: readString(config.priceYearly),
@@ -43,11 +53,14 @@ function parsePhiCmsCardWidgetConfig(config) {
43
53
  iconBackground: readString(config.iconBackground),
44
54
  alt: readString(config.alt),
45
55
  imageOpacity: readPhiCardImageOpacity(config.imageOpacity),
56
+ imageOverlay: readPhiCardImageOverlay(config.imageOverlay),
46
57
  linkTarget: readPhiLinkTarget(config.linkTarget) ?? undefined,
47
58
  actionEnabled: readBoolean(config.actionEnabled),
48
59
  actionLabel: readPhiControlLabel(config.actionLabel),
49
60
  actionIcon: readString(config.actionIcon),
50
61
  actionLinkTarget: readPhiLinkTarget(config.actionLinkTarget) ?? undefined,
62
+ actionVariant: readPhiButtonVariant(config.actionVariant),
63
+ actionGradient: readPhiThemeGradientKey(config.actionGradient),
51
64
  variant: readChoice(readString(config.variant), PHI_CARD_VARIANTS),
52
65
  highlight: readBoolean(config.highlight),
53
66
  hoverEffect: readChoice(readString(config.hoverEffect), PHI_CARD_HOVER_EFFECTS),
@@ -68,6 +81,7 @@ const PHI_CARD_DEFAULT_CONFIG = {
68
81
  imageOpacity: 100,
69
82
  headingLevel: "h3",
70
83
  textAlign: "start",
84
+ badgeStyle: "none",
71
85
  };
72
86
  export const PHI_CARD_WIDGET_DEFINITION = {
73
87
  kind: "widget",
@@ -247,6 +261,23 @@ export const PHI_CARD_WIDGET_DEFINITION = {
247
261
  label: "",
248
262
  visibleWhen: { field: "actionEnabled", equals: true },
249
263
  },
264
+ {
265
+ key: "actionVariant",
266
+ type: "choice",
267
+ label: "Variant",
268
+ description: "How the button stands out. Empty follows the card: primary when it is highlighted, normal otherwise.",
269
+ options: [...PHI_BUTTON_VARIANT_FIELD_OPTIONS],
270
+ emptyOption: { value: "", label: "Card" },
271
+ visibleWhen: { field: "actionEnabled", equals: true },
272
+ },
273
+ {
274
+ key: "actionGradient",
275
+ type: "choice",
276
+ label: "Gradient",
277
+ options: [...PHI_THEME_GRADIENT_FIELD_OPTIONS],
278
+ placeholder: "Gradient 1",
279
+ visibleWhen: { field: "actionVariant", equals: "gradient" },
280
+ },
250
281
  {
251
282
  key: "variant",
252
283
  type: "choice",
@@ -259,15 +290,38 @@ export const PHI_CARD_WIDGET_DEFINITION = {
259
290
  ],
260
291
  },
261
292
  { key: "highlight", type: "boolean", label: "Highlight" },
262
- /* The band's words are written on the card; its colour is the one thing asked here. */
293
+ /* The band's words are written on the card; how it is drawn and its colour are asked here. */
294
+ {
295
+ key: "badgeStyle",
296
+ type: "choice",
297
+ heading: "Badge",
298
+ label: "Style",
299
+ presentation: "segmented",
300
+ description: "Corner: a band in the card's top corner. Tag: a rounded mark a little down the edge. Ribbon: hangs over the card's edge with a fold, and needs room beside the card -- a Layout that clips at the card's edge cuts it off. None: hides the badge and keeps its words.",
301
+ options: [
302
+ { value: "none", label: "None" },
303
+ { value: "corner", label: "Corner" },
304
+ { value: "tag", label: "Tag" },
305
+ { value: "ribbon", label: "Ribbon" },
306
+ ],
307
+ },
263
308
  {
264
309
  key: "badgeColor",
265
310
  type: "color",
266
- heading: "Badge",
267
311
  label: "Color",
312
+ visibleWhen: { field: "badgeStyle", notEquals: "none" },
268
313
  mode: "single",
269
314
  defaultToken: "colorPrimary",
270
315
  },
316
+ {
317
+ key: "badgeGradient",
318
+ type: "choice",
319
+ label: "Gradient",
320
+ description: "Fills the badge with one of the Theme's gradients instead of the colour. A ribbon's fold keeps the colour.",
321
+ options: [...PHI_THEME_GRADIENT_FIELD_OPTIONS],
322
+ emptyOption: { value: "", label: "None" },
323
+ visibleWhen: { field: "badgeStyle", notEquals: "none" },
324
+ },
271
325
  ...buildPhiBulletListFields("featureList", "Features").map((field) => ({
272
326
  ...field,
273
327
  visibleWhen: { field: "body", equals: "plan" },