@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,8 +1,8 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useEffect, useState } from "react";
4
3
  import { isPhiCmsAreaKey } from "../../constants/cms-areas";
5
4
  import { PhiLinkTargetControl } from "../widgets/client/shared/phi-link-target-control";
5
+ import { usePhiPageReferenceOptions } from "../widgets/client/shared/use-page-reference-options";
6
6
  import { PHI_FORM_LINK_TARGET_LABEL_KEYS } from "./form-provider-contract";
7
7
  const DEFAULT_LABELS = {
8
8
  none: "None",
@@ -13,32 +13,6 @@ const DEFAULT_LABELS = {
13
13
  newTab: "Open in a new tab",
14
14
  pagesUnavailable: "The Pages could not be loaded.",
15
15
  };
16
- /*
17
- * One request per Area for as long as the page lives: the create and the edit dialog offer the same
18
- * Pages, and a list that changed meanwhile is a Page somebody published while this one was being written.
19
- * A failed request is forgotten, so the next dialog asks again.
20
- */
21
- const pageOptionsByArea = new Map();
22
- function loadPageOptions(area) {
23
- const cached = pageOptionsByArea.get(area);
24
- if (cached)
25
- return cached;
26
- const request = (async () => {
27
- const response = await fetch(`/api/site/page-references?area=${encodeURIComponent(area)}`, {
28
- cache: "no-store",
29
- credentials: "same-origin",
30
- headers: { accept: "application/json" },
31
- });
32
- const payload = (await response.json().catch(() => null));
33
- if (!response.ok || !Array.isArray(payload?.options)) {
34
- throw new Error(`Page references for "${area}" answered ${response.status}.`);
35
- }
36
- return payload.options;
37
- })();
38
- pageOptionsByArea.set(area, request);
39
- request.catch(() => pageOptionsByArea.delete(area));
40
- return request;
41
- }
42
16
  /**
43
17
  * The `link-target` field: one link, to a Page of an Area or to an address elsewhere (`FORMS.md`).
44
18
  *
@@ -48,24 +22,7 @@ function loadPageOptions(area) {
48
22
  */
49
23
  export const PhiLinkTargetFormControl = ({ field, value, labels, disabled, readOnly, onChange, }) => {
50
24
  const area = isPhiCmsAreaKey(field.config?.area) ? field.config.area : "public";
51
- const [options, setOptions] = useState([]);
52
- const [failed, setFailed] = useState(false);
53
- useEffect(() => {
54
- let current = true;
55
- loadPageOptions(area).then((next) => {
56
- if (current) {
57
- setOptions(next);
58
- setFailed(false);
59
- }
60
- }, (error) => {
61
- console.warn("[phi-form] Page references could not be loaded.", { area, error });
62
- if (current)
63
- setFailed(true);
64
- });
65
- return () => {
66
- current = false;
67
- };
68
- }, [area]);
25
+ const { options, failed } = usePhiPageReferenceOptions(area, "phi-form");
69
26
  const read = (key, fallback) => labels?.[key]?.trim() || fallback;
70
27
  const controlLabels = {
71
28
  none: read(PHI_FORM_LINK_TARGET_LABEL_KEYS.none, DEFAULT_LABELS.none),
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { createContext, Fragment, useContext, useEffect, useMemo, useRef, useState, } from "react";
4
- import { PHI_COLOR, PHI_SPACE } from "../../theme/antd-css-var-contract";
4
+ import { PHI_FONT_SIZE, PHI_COLOR, PHI_SPACE } from "../../theme/antd-css-var-contract";
5
5
  import { PHI_THEME_BORDER_WIDTH } from "../../helpers/border-widget-style";
6
6
  import { normalizePhiCssSize, PHI_LAYOUT_SURFACE_RADIUS, PHI_SLOT_INLINE_PLACEMENT_MARGIN_STYLE, } from "../layouts/phi-layout-contract";
7
7
  import { PhiButtonControl } from "../controls/phi-button-control";
@@ -109,7 +109,9 @@ export function PhiFormWidgetFrame({ submit, card, maxFormWidth, links, layout,
109
109
  * Widget rather than beside it: a Widget in the next slot stands in the Layout's box, not on the
110
110
  * form's grid, and no percentage of the outer width lands on that column once the grid has gaps.
111
111
  */
112
- const linksRow = links && links.length > 0 ? (_jsx("div", { className: "phi-form-descriptor-actions", children: _jsx("div", { className: "phi-form-cell phi-form-cell--control", style: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: PHI_SPACE.sm }, children: links.map((link, index) => (_jsxs(Fragment, { children: [index > 0 ? _jsx("span", { "aria-hidden": true, style: { color: PHI_COLOR.textTertiary }, children: "|" }) : null, _jsx(PhiLink, { href: link.href, children: link.label })] }, link.key))) }) })) : null;
112
+ const linksRow = links && links.length > 0 ? (_jsx("div", { className: "phi-form-descriptor-actions", children: _jsx("div", { className: "phi-form-cell phi-form-cell--control",
113
+ // The ways out are asides to the form, taken now and then, so they write small (`sm`).
114
+ style: { display: "flex", flexWrap: "wrap", alignItems: "center", gap: PHI_SPACE.sm, fontSize: PHI_FONT_SIZE.sm }, children: links.map((link, index) => (_jsxs(Fragment, { children: [index > 0 ? _jsx("span", { "aria-hidden": true, style: { color: PHI_COLOR.textTertiary }, children: "|" }) : null, _jsx(PhiLink, { href: link.href, children: link.label })] }, link.key))) }) })) : null;
113
115
  /*
114
116
  * The ways out come first, then the button.
115
117
  *
@@ -75,6 +75,8 @@ function renderColumn(isAuthoringRender, key, child, width, flex, anchor, slotRo
75
75
  width: "100%",
76
76
  } })) : null] }, key));
77
77
  }
78
+ /** How much faster the middle slot grows than each balanced side. */
79
+ const PHI_THREE_COLUMN_MIDDLE_GROW = 2;
78
80
  export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap = PHI_THREE_COLUMN_LAYOUT_DEFAULTS.gap, wrap = PHI_THREE_COLUMN_LAYOUT_DEFAULTS.wrap, align, justify, leftWidth, middleWidth, rightWidth, editSlotAnchor = "center", editSlotAction, editRenderInsertControl, renderMode = "live", ...layoutProps }) {
79
81
  const isAuthoringRender = isPhiLayoutAuthoringRender({ editSlotAction, renderMode });
80
82
  const { style, layoutKind = "threecol", padding, paddingTop, paddingRight, paddingBottom, paddingLeft, surface, labelEnd, size, minSize, maxSize, collapsedSizeHint, } = layoutProps;
@@ -83,7 +85,14 @@ export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap
83
85
  const resolvedMiddleWidth = normalizePhiCssSize(middleWidth);
84
86
  const resolvedRightWidth = normalizePhiCssSize(rightWidth);
85
87
  const leftFlex = resolvedLeftWidth ? `0 0 ${resolvedLeftWidth}` : balancedSides ? "1 1 0" : "0 1 auto";
86
- const middleFlex = resolvedMiddleWidth ? `0 0 ${resolvedMiddleWidth}` : "1 1 0";
88
+ /*
89
+ * The middle is the main thing and takes the larger share: with balanced sides it grows twice as fast as
90
+ * each side, so the sides stay equal to each other and the middle stays centred; without, it takes what
91
+ * the sides' content leaves.
92
+ */
93
+ const middleFlex = resolvedMiddleWidth
94
+ ? `0 0 ${resolvedMiddleWidth}`
95
+ : `${PHI_THREE_COLUMN_MIDDLE_GROW} 1 0`;
87
96
  const rightFlex = resolvedRightWidth ? `0 0 ${resolvedRightWidth}` : balancedSides ? "1 1 0" : "0 1 auto";
88
97
  const showInsertButton = resolvedRenderMode === "editor";
89
98
  const { style: resolvedLayoutStyle, ground, hasExplicitLayoutBackground, } = resolvePhiBaseLayoutChrome({
@@ -18,9 +18,18 @@ export function resolvePhiBaseLayoutChrome({ padding, paddingTop, paddingRight,
18
18
  * a Tree take. A Layout without a Surface states no corner: there is no box there to round.
19
19
  */
20
20
  const resolvedSurface = resolvePhiSurfaceStyle(surface, { cornerFallback: PHI_LAYOUT_SURFACE_RADIUS });
21
+ const paddingStyle = resolvePhiPaddingStyle({ padding, paddingTop, paddingRight, paddingBottom, paddingLeft });
21
22
  const style = {
22
23
  ...resolvedSurface.style,
23
- ...resolvePhiPaddingStyle({ padding, paddingTop, paddingRight, paddingBottom, paddingLeft }),
24
+ ...paddingStyle,
25
+ /*
26
+ * The top inset once more, as a value a stylesheet can add to: a Hero behind the Header gives its
27
+ * root Layout the Header's height on top of it (`styles/shell.css`), and an inline `padding-top`
28
+ * cannot be read from CSS. Only where a top inset is stated; absent, the rule falls back to none.
29
+ */
30
+ ...(paddingStyle.paddingTop == null
31
+ ? {}
32
+ : { "--phi-layout-padding-top": String(paddingStyle.paddingTop) }),
24
33
  /*
25
34
  * The label column, written the two ways it is read: as the grid line a descriptor form places its
26
35
  * labels on, and as the share of the width a labelled Control needs, which knows nothing of the
@@ -10,10 +10,15 @@ export function PhiLink({ href, children, external, newTab, prefetch, className,
10
10
  const [active, setActive] = useState(false);
11
11
  const useAnchor = external ?? isPhiExternalHref(href);
12
12
  const linkStyle = useMemo(() => ({
13
- color: active ? token.colorLinkActive : hovered ? token.colorLinkHover : token.colorLink,
14
13
  textDecoration: "none",
15
14
  cursor: "pointer",
16
15
  ...style,
16
+ /*
17
+ * A colour the caller states is the link at rest -- a Header's text colour, a list's inherited one --
18
+ * and never more: pointed at and pressed, a link answers in the Theme's link colours whatever it
19
+ * rests in. Spread after `style`, a stated colour had silenced the hover of every link that set one.
20
+ */
21
+ color: active ? token.colorLinkActive : hovered ? token.colorLinkHover : style?.color ?? token.colorLink,
17
22
  }), [active, hovered, style, token.colorLink, token.colorLinkActive, token.colorLinkHover]);
18
23
  const interactionProps = {
19
24
  onMouseEnter: () => setHovered(true),
@@ -17,7 +17,10 @@ import { PhiEffectsReadyTrigger } from "../../../plugins/runtime/phi-effects-rea
17
17
  import { PhiSlotChildEffectsVisibilityObserver } from "../../../plugins/runtime/phi-slot-child-effects-visibility-observer";
18
18
  import { PhiSlotChildViewportEffectsObserver } from "../../../plugins/runtime/phi-slot-child-viewport-effects-observer";
19
19
  import { PhiFlexControl } from "../../controls/phi-flex-control";
20
- import { resolvePhiCmsRegionShell } from "../phi-cms-region-shell";
20
+ import { phiCmsRegionFooterSticks, phiCmsRegionSiderSticks, resolvePhiCmsRegionShell, } from "../phi-cms-region-shell";
21
+ import { usePhiShellStickyTop } from "../../shell/use-phi-shell-sticky-top";
22
+ import { usePhiShellStickyBottom } from "../../shell/use-phi-shell-sticky-bottom";
23
+ import { usePhiShellHeaderBands } from "../../shell/use-phi-shell-header-bands";
21
24
  import { usePhiVisualAnchor } from "../../runtime/runtime-visual-anchors";
22
25
  import { usePhiPathname } from "../../runtime/use-phi-pathname";
23
26
  import { stripLocaleAndAreaFromPathname } from "../../../helpers/locale";
@@ -100,6 +103,18 @@ export function PhiCmsRegionContainerClient({ children, className, regionKey, co
100
103
  elementRef,
101
104
  placeholderRef,
102
105
  });
106
+ usePhiShellStickyTop({
107
+ active: !previewMode && inScope && phiCmsRegionSiderSticks(regionKey, initialConfig),
108
+ elementRef,
109
+ });
110
+ usePhiShellStickyBottom({
111
+ active: !previewMode && inScope && resolvedVisibility !== "hidden" && phiCmsRegionFooterSticks(regionKey, initialConfig),
112
+ elementRef,
113
+ });
114
+ usePhiShellHeaderBands({
115
+ active: !previewMode && inScope && regionKey === "hero",
116
+ elementRef,
117
+ });
103
118
  /*
104
119
  * Off this Page, the Region leaves a hidden marker rather than nothing: `header_top` still has to tell
105
120
  * the Shell it holds no room, and it finds the Shell from here.
@@ -3,6 +3,7 @@ import { isPhiCmsPageOwnedRegion } from "../../helpers/cms-region-keys";
3
3
  import { hasPhiFlag } from "../../helpers/flags";
4
4
  import { PhiCmsFlags } from "../../constants/phi-cms";
5
5
  import { PhiCmsRegionStatic } from "./phi-cms-region-static";
6
+ import { phiCmsRegionFooterSticks, phiCmsRegionSiderSticks } from "./phi-cms-region-shell";
6
7
  import { resolveRenderableBlockEffectsAttributes, resolveRenderableBlockViewportEffects, } from "../../helpers/renderable-block-effects";
7
8
  import { PhiRuntimeModuleRenderClientHost } from "../runtime/runtime-module-render-client-manifest";
8
9
  import { PhiRuntimeRenderClientType } from "../../constants/runtime-render-client-types";
@@ -21,6 +22,12 @@ export function PhiCmsRegionContainer({ children, className, regionKey, config,
21
22
  const requiresClientEnhancement = signalParticipant ||
22
23
  pageScoped ||
23
24
  (!previewMode && readPhiCmsRegionReveal(regionKey, config) !== "always") ||
25
+ // A stuck Sider stands under the Header as measured, and only the browser can measure it.
26
+ (!previewMode && phiCmsRegionSiderSticks(regionKey, config)) ||
27
+ // A stuck Footer tells the Shell how much of the viewport's bottom it holds, which is measured.
28
+ (!previewMode && phiCmsRegionFooterSticks(regionKey, config)) ||
29
+ // A Hero stands behind the Header bands, whose heights only the browser can measure for certain.
30
+ (!previewMode && regionKey === "hero") ||
24
31
  hasPhiFlag(config?.flags, PhiCmsFlags.Collapsible) ||
25
32
  requiresEffectsObserver ||
26
33
  resolvePhiBackgroundMotion(config?.surface?.background) != null;
@@ -3,7 +3,7 @@ import type { CSSProperties } from "react";
3
3
  import { type PhiRenderableBlockEffectsAttributes } from "../../helpers/renderable-block-effects";
4
4
  import { resolvePhiShellRegionChrome } from "../../helpers/shell-region-style";
5
5
  import type { PhiBlockRuntime, PhiCmsRegionConfig, PhiCmsRegionKey, PhiRenderableBlock } from "../../types";
6
- import type { PhiSurfaceGround } from "../../helpers/surface-style";
6
+ import { type PhiSurfaceGround } from "../../helpers/surface-style";
7
7
  import type { PhiCmsRegionReveal } from "../../types/cms-presets";
8
8
  import { type PhiCmsBackgroundWidgetConfig } from "../widgets/config/background";
9
9
  /**
@@ -92,6 +92,27 @@ export type PhiCmsRegionShell = {
92
92
  /** The content wrapper's style, which is where Region padding lives (LAYOUTING.md "Regions"). */
93
93
  contentStyle: CSSProperties;
94
94
  };
95
+ /**
96
+ * Whether a Region is a Sider that sticks under the Header, and so needs the Header's measured bottom.
97
+ *
98
+ * Two kinds of Sider stick, and only one of them under the Header. A `FullHeight` Sider is a column of the
99
+ * Shell from the viewport's top to its bottom -- an Admin or Builder navigation beside the Header, not
100
+ * below it -- and stands at its configured `offsetTop`. A `Sticky` Sider without it stands in the page
101
+ * below the Header -- a contents beside a text -- and sticks under the line the Shell publishes as
102
+ * `--phi-shell-sticky-top` (`usePhiShellStickyTop`), with its offset added. The Region renderer runs that
103
+ * measurement for such a Sider, which is why this is asked before the Region renders.
104
+ */
105
+ export declare function phiCmsRegionSiderSticks(regionKey: PhiCmsRegionKey, config: Pick<PhiCmsRegionConfig, "flags"> | null | undefined): boolean;
106
+ /**
107
+ * Whether a Region is the Footer band that sticks to the viewport's bottom.
108
+ *
109
+ * Only `footer_bottom`, the counterpart of `header_top`: the lowest band is the one that can stand at the
110
+ * bottom edge while the page scrolls past it. A middle band that stuck would have the band below it either
111
+ * cover it or stick with it, and neither is a Footer anybody asked for; `footer_top` and `footer_main`
112
+ * scroll with the page and arrive above it at the end. It measures the room it holds
113
+ * (`usePhiShellStickyBottom`), so a Sider stuck under the Header ends above it.
114
+ */
115
+ export declare function phiCmsRegionFooterSticks(regionKey: PhiCmsRegionKey, config: Pick<PhiCmsRegionConfig, "flags"> | null | undefined): boolean;
95
116
  /**
96
117
  * The Region's shell, or null where the Region renders nothing: hidden, or collapsed in a preview.
97
118
  * `header_bottom` is exempt from the preview collapse because the Page, not the Area, owns its content.
@@ -1,4 +1,5 @@
1
1
  import { resolvePhiSurfaceToneClassName } from "../../types/surface";
2
+ import { composePhiModePaint, resolvePhiModeValue } from "../../helpers/mode-paint";
2
3
  import { PHI_THEME_BORDER_LINE, resolvePhiBorderWidgetStyle } from "../../helpers/border-widget-style";
3
4
  import { hasPhiFlag } from "../../helpers/flags";
4
5
  import { combinePhiBoxShadows } from "../../helpers/layout-style";
@@ -6,11 +7,12 @@ import { resolveRenderableBlockEffectsAttributes, resolveRenderableBlockEffectsS
6
7
  import { resolvePhiShellRegionChrome, resolvePhiShellRegionGroundStyle, resolvePhiShellRegionTypography, resolvePhiShellRegionZIndex, resolvePhiShellSiderCollapsedWidth, resolvePhiShellSiderWidth, } from "../../helpers/shell-region-style";
7
8
  import { PhiCmsFlags } from "../../constants/phi-cms";
8
9
  import { resolvePhiCmsBorderSource } from "../../types/cms-border-source";
10
+ import { PHI_SURFACE_TONE_GROUND, phiSurfaceTakesToneGround, } from "../../helpers/surface-style";
9
11
  import { resolvePhiRenderableBlockGeometry } from "../../types/renderable-block-geometry";
10
12
  import { createPhiSignalAddress } from "../../types/signals";
11
13
  import { readPhiCmsRegionReveal } from "../../helpers/region-page-scope";
12
14
  import { resolvePhiPaddingStyle } from "../layouts/phi-layout-contract";
13
- import { phiRegionUsesShellChromeOverlay } from "../root/phi-shell-chrome-overlay";
15
+ import { PHI_SHELL_STICKY_BOTTOM_PROPERTY, PHI_SHELL_STICKY_TOP_PROPERTY, phiRegionUsesShellChromeOverlay, } from "../root/phi-shell-chrome-overlay";
14
16
  import { normalizePhiBackgroundWidgetConfig, phiBackgroundWidgetConfigPaintsGround, resolvePhiBackgroundGroundFilter, resolvePhiBackgroundMotion, resolvePhiBackgroundMotionHostStyle, resolvePhiBackgroundPane, resolvePhiBackgroundWidgetStyle, } from "../widgets/config/background";
15
17
  /*
16
18
  * The longhands every Region that paints the Shell Chrome Overlay (SHELL.md) carries, read from the
@@ -45,6 +47,37 @@ function resolvePhiCmsRegionShellFamily(regionKey) {
45
47
  }
46
48
  return "other";
47
49
  }
50
+ /**
51
+ * Whether a Region is a Sider that sticks under the Header, and so needs the Header's measured bottom.
52
+ *
53
+ * Two kinds of Sider stick, and only one of them under the Header. A `FullHeight` Sider is a column of the
54
+ * Shell from the viewport's top to its bottom -- an Admin or Builder navigation beside the Header, not
55
+ * below it -- and stands at its configured `offsetTop`. A `Sticky` Sider without it stands in the page
56
+ * below the Header -- a contents beside a text -- and sticks under the line the Shell publishes as
57
+ * `--phi-shell-sticky-top` (`usePhiShellStickyTop`), with its offset added. The Region renderer runs that
58
+ * measurement for such a Sider, which is why this is asked before the Region renders.
59
+ */
60
+ export function phiCmsRegionSiderSticks(regionKey, config) {
61
+ return resolvePhiCmsRegionShellFamily(regionKey) === "sider"
62
+ && hasPhiFlag(config?.flags, PhiCmsFlags.Sticky)
63
+ && !hasPhiFlag(config?.flags, PhiCmsFlags.FullHeight);
64
+ }
65
+ /**
66
+ * Whether a Region is the Footer band that sticks to the viewport's bottom.
67
+ *
68
+ * Only `footer_bottom`, the counterpart of `header_top`: the lowest band is the one that can stand at the
69
+ * bottom edge while the page scrolls past it. A middle band that stuck would have the band below it either
70
+ * cover it or stick with it, and neither is a Footer anybody asked for; `footer_top` and `footer_main`
71
+ * scroll with the page and arrive above it at the end. It measures the room it holds
72
+ * (`usePhiShellStickyBottom`), so a Sider stuck under the Header ends above it.
73
+ */
74
+ export function phiCmsRegionFooterSticks(regionKey, config) {
75
+ return regionKey === "footer_bottom" && hasPhiFlag(config?.flags, PhiCmsFlags.Sticky);
76
+ }
77
+ /** The line a stuck Sider stands at: under the Header as measured, plus its own offset. */
78
+ function resolvePhiCmsRegionSiderStuckTop(topCss) {
79
+ return `calc(var(${PHI_SHELL_STICKY_TOP_PROPERTY}, 0px) + ${topCss})`;
80
+ }
48
81
  /*
49
82
  * A Region's edge, from its Surface.
50
83
  *
@@ -103,6 +136,11 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
103
136
  const siderCollapsedWidth = normalizeCssLength(config.collapsedWidth) ?? resolvePhiShellSiderCollapsedWidth(shellTheme);
104
137
  const top = normalizeCssLength(config.offsetTop) ?? 0;
105
138
  const topCss = typeof top === "number" ? `${top}px` : top;
139
+ // How far `content` reaches up into the Hero; `styles/shell.css` applies it only where there is one.
140
+ const heroOverlap = regionKey === "content" ? normalizeCssLength(config.heroOverlap) : null;
141
+ const heroOverlapCss = heroOverlap == null || heroOverlap === 0
142
+ ? null
143
+ : typeof heroOverlap === "number" ? `${heroOverlap}px` : heroOverlap;
106
144
  const sticky = hasPhiFlag(config.flags, PhiCmsFlags.Sticky);
107
145
  // A preview shows the Region where it stands, so an author can see what they are editing.
108
146
  const reveal = previewMode ? "always" : readPhiCmsRegionReveal(regionKey, config);
@@ -116,22 +154,39 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
116
154
  * A revealing `header_top` sticks whatever its flag says: coming back into view at the top edge is what
117
155
  * revealing means, and only a sticky band has a top edge to come back to.
118
156
  */
119
- const stuck = isHeader ? sticky || reveal !== "always" : isSider && (sticky || fullHeight);
157
+ const footerSticks = phiCmsRegionFooterSticks(regionKey, config);
158
+ const stuck = isHeader
159
+ ? sticky || reveal !== "always"
160
+ : footerSticks || (isSider && (sticky || fullHeight));
161
+ const bottom = normalizeCssLength(config.offsetBottom) ?? 0;
162
+ const stuckBottom = footerSticks ? (typeof bottom === "number" ? `${bottom}px` : bottom) : undefined;
120
163
  /*
121
164
  * The Header bands below `header_top` stick under it while it is in view and close up when it leaves.
122
165
  * `--phi-shell-header-top-stack` is how much of the viewport's top it holds right now; only a
123
166
  * `scroll-up` band ever publishes it (SHELL.md "Region visibility per Page"), so for every other Shell
124
167
  * it is unset and the offset is the one configured.
125
168
  */
126
- const stuckTop = !stuck
169
+ /*
170
+ * A full-height Sider is a Shell column from the viewport's top and stands at its own offset; a sticky
171
+ * one stands under the Header as it is measured right now (`phiCmsRegionSiderSticks`) and is at most as
172
+ * tall as what is left of the viewport below that line.
173
+ */
174
+ const siderUnderHeader = isSider && sticky && !fullHeight;
175
+ const stuckTop = !stuck || footerSticks
127
176
  ? undefined
128
177
  : isHeader && regionKey !== "header_top"
129
178
  ? `calc(${topCss} + var(--phi-shell-header-top-stack, 0px))`
130
- : top;
179
+ : siderUnderHeader
180
+ ? resolvePhiCmsRegionSiderStuckTop(topCss)
181
+ : top;
131
182
  const blockSize = geometry.block.size?.css;
132
183
  const fullHeightSize = fullHeight && !blockSize
133
184
  ? `calc(100dvh - ${topCss})`
134
185
  : blockSize;
186
+ // Below the Header as measured, and above a stuck Footer as measured: the room left between the two.
187
+ const underHeaderMaxSize = siderUnderHeader
188
+ ? `calc(100dvh - ${resolvePhiCmsRegionSiderStuckTop(topCss)} - var(${PHI_SHELL_STICKY_BOTTOM_PROPERTY}, 0px))`
189
+ : undefined;
135
190
  const zIndex = config.zIndex ?? resolvePhiShellRegionZIndex(regionKey, hasPhiFlag(config.flags, PhiCmsFlags.FullHeight));
136
191
  /*
137
192
  * A Background config that paints nothing is not an authored ground. The Builder writes one onto every
@@ -143,28 +198,72 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
143
198
  ? normalizePhiBackgroundWidgetConfig(surface.background)
144
199
  : null;
145
200
  const backgroundConfig = phiBackgroundWidgetConfigPaintsGround(surfaceBackground) ? surfaceBackground : null;
201
+ /*
202
+ * A tone turns the ground as well, by the rule every Surface follows (LAYOUTING.md "Surface tone"):
203
+ * where the Background paints nothing, the Region takes its tone's container ground, which resolves
204
+ * under the tone class the root element carries. That is a ground of the Region's own, so the Shell's
205
+ * -- the Theme's record, the Chrome Overlay, a pane frosting either -- does not show beneath it.
206
+ */
207
+ const toneGround = phiSurfaceTakesToneGround(surface?.tone, backgroundConfig != null);
208
+ /*
209
+ * The Theme's Overlay as the ground (`base.kind: "theme"`). Without a tone a Chrome Region takes it the
210
+ * way a Region without a Background does -- the `data-phi-shell-chrome` marker, so that where the Shell
211
+ * draws its panes the pane behind shows through instead of a second frosting -- but over any ground the
212
+ * Shell record sets. Every other Region, and a toned one, paints it itself, which under a tone's class
213
+ * is the Overlay of the tone's mode.
214
+ */
215
+ const themeGround = backgroundConfig?.base.kind === "theme";
216
+ const themeGroundIsShellChrome = themeGround
217
+ && resolvePhiSurfaceToneClassName(surface?.tone) == null
218
+ && phiRegionUsesShellChromeOverlay({ regionKey, backgroundConfig, grounds: [] });
146
219
  /*
147
220
  * A pane on a Region without a ground of its own frosts the Shell's ground for this Region -- the
148
221
  * Theme's record, or the family's fallback -- which is what glass on a bare Header has always meant.
149
- * A Region that paints its own ground carries its pane inside that Background, as every Surface does.
222
+ * A Region that paints its own ground carries its pane inside that Background, as every Surface does;
223
+ * the tone's ground is one, so its pane stays on the box under that ground, as on a toned Layout.
150
224
  */
151
- const shellPane = backgroundConfig == null ? resolvePhiBackgroundPane(surfaceBackground) : null;
225
+ const shellPane = backgroundConfig == null && !toneGround ? resolvePhiBackgroundPane(surfaceBackground) : null;
152
226
  const backgroundMoves = animatesBackground &&
153
227
  backgroundConfig != null &&
154
228
  resolvePhiBackgroundMotion(backgroundConfig) != null;
155
- const groundFilter = backgroundConfig == null ? null : resolvePhiBackgroundGroundFilter(backgroundConfig);
229
+ /*
230
+ * The ground in dark mode (`PhiSurface.backgroundDark`), for a Region that paints a ground of its own in
231
+ * light mode: the page's mode picks between the two in CSS (`helpers/mode-paint.ts`). Not for the
232
+ * Theme's Overlay, which is per mode already, nor for a moving picture, which the motion layer draws
233
+ * from one Background.
234
+ */
235
+ const backgroundDarkConfig = backgroundConfig != null && !themeGround && !backgroundMoves && surface?.backgroundDark
236
+ ? normalizePhiBackgroundWidgetConfig(surface.backgroundDark)
237
+ : null;
238
+ const groundFilterLight = backgroundConfig == null ? null : resolvePhiBackgroundGroundFilter(backgroundConfig);
239
+ const groundFilterDark = backgroundDarkConfig == null ? null : resolvePhiBackgroundGroundFilter(backgroundDarkConfig);
240
+ const groundFilter = backgroundDarkConfig && groundFilterLight !== groundFilterDark
241
+ ? resolvePhiModeValue(groundFilterLight ?? "none", groundFilterDark ?? "none")
242
+ : groundFilterLight;
243
+ const layerPaint = (entry) => resolvePhiBackgroundWidgetStyle({ ...entry, filter: null, motion: null });
156
244
  const ground = backgroundConfig != null && groundFilter != null && !backgroundMoves
157
245
  ? {
158
- paint: resolvePhiBackgroundWidgetStyle({ ...backgroundConfig, filter: null, motion: null }),
246
+ paint: backgroundDarkConfig
247
+ ? composePhiModePaint(layerPaint(backgroundConfig), layerPaint(backgroundDarkConfig))
248
+ : layerPaint(backgroundConfig),
159
249
  filter: groundFilter,
160
250
  motion: null,
161
251
  }
162
252
  : null;
163
- const backgroundStyle = backgroundConfig == null || ground != null
253
+ const backgroundStyle = themeGroundIsShellChrome
164
254
  ? null
165
- : backgroundMoves
166
- ? resolvePhiBackgroundMotionHostStyle(backgroundConfig)
167
- : resolvePhiBackgroundWidgetStyle(backgroundConfig);
255
+ : toneGround
256
+ ? {
257
+ ...(surfaceBackground ? resolvePhiBackgroundWidgetStyle(surfaceBackground) : {}),
258
+ backgroundColor: PHI_SURFACE_TONE_GROUND,
259
+ }
260
+ : backgroundConfig == null || ground != null
261
+ ? null
262
+ : backgroundMoves
263
+ ? resolvePhiBackgroundMotionHostStyle(backgroundConfig)
264
+ : backgroundDarkConfig
265
+ ? composePhiModePaint(resolvePhiBackgroundWidgetStyle(backgroundConfig), resolvePhiBackgroundWidgetStyle(backgroundDarkConfig))
266
+ : resolvePhiBackgroundWidgetStyle(backgroundConfig);
168
267
  const chromeInput = {
169
268
  shadow: surface?.shadow ?? undefined,
170
269
  effect: shellPane ?? undefined,
@@ -184,12 +283,14 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
184
283
  * the stored one: the Builder persists an empty Background record for every Region an author has ever
185
284
  * opened, and the raw value is never null for those.
186
285
  */
187
- const usesShellChromeOverlay = phiRegionUsesShellChromeOverlay({
188
- regionKey,
189
- backgroundConfig,
190
- pane: shellPane,
191
- grounds: [chrome.light.background, chrome.dark.background],
192
- });
286
+ const usesShellChromeOverlay = themeGround
287
+ ? themeGroundIsShellChrome
288
+ : !toneGround && phiRegionUsesShellChromeOverlay({
289
+ regionKey,
290
+ backgroundConfig,
291
+ pane: shellPane,
292
+ grounds: [chrome.light.background, chrome.dark.background],
293
+ });
193
294
  /*
194
295
  * The ground. Published, it is the pair of custom properties `shell.css` paints from, because it may
195
296
  * be a colour or a gradient and only CSS can tell which without guessing; nothing inline may name a
@@ -203,13 +304,18 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
203
304
  * drop one of those from an element whose `background` shorthand is still set.
204
305
  */
205
306
  const liveChrome = paint.kind === "live" ? chrome[paint.mode] : null;
307
+ /*
308
+ * A toned Region publishes no Shell ground: `shell.css` would paint a gradient one beneath its own. Nor
309
+ * does one whose ground is the Theme's: the Overlay stands where the Shell record's ground would.
310
+ */
311
+ const withoutShellGround = toneGround || themeGround;
206
312
  const modeStyle = liveChrome
207
313
  ? {}
208
314
  : {
209
- ...(chrome.light.background == null
315
+ ...(chrome.light.background == null || withoutShellGround
210
316
  ? {}
211
317
  : { "--phi-region-background-light": String(chrome.light.background) }),
212
- ...(chrome.dark.background == null
318
+ ...(chrome.dark.background == null || withoutShellGround
213
319
  ? {}
214
320
  : { "--phi-region-background-dark": String(chrome.dark.background) }),
215
321
  "--phi-region-color-light": String(chrome.light.color),
@@ -219,7 +325,7 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
219
325
  const effectStyle = liveChrome || paintedChrome.effectStyle?.backgroundColor == null
220
326
  ? paintedChrome.effectStyle
221
327
  : { ...paintedChrome.effectStyle, backgroundColor: "var(--phi-region-background)" };
222
- const groundStyle = liveChrome && backgroundStyle == null
328
+ const groundStyle = liveChrome && backgroundStyle == null && !themeGround
223
329
  ? resolvePhiShellRegionGroundStyle(liveChrome.background)
224
330
  : {};
225
331
  const typography = resolvePhiShellRegionTypography(regionKey, shellTheme, {
@@ -258,11 +364,11 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
258
364
  maxWidth: geometry.inline.max?.css ?? siderWidth,
259
365
  height: fullHeightSize,
260
366
  minHeight: geometry.block.min?.css ?? (fullHeight ? fullHeightSize : undefined),
261
- maxHeight: geometry.block.max?.css,
367
+ maxHeight: geometry.block.max?.css ?? underHeaderMaxSize,
262
368
  alignSelf: fullHeight ? "stretch" : "start",
263
369
  flex: fullHeight ? "1 1 auto" : undefined,
264
370
  overflowX: "visible",
265
- overflowY: fullHeight ? "auto" : "visible",
371
+ overflowY: fullHeight || siderUnderHeader ? "auto" : "visible",
266
372
  }
267
373
  : {
268
374
  width: geometry.inline.size?.css ?? "100%",
@@ -279,6 +385,7 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
279
385
  position: stuck ? "sticky" : "relative",
280
386
  top: stuckTop,
281
387
  insetBlockStart: isHeader ? stuckTop : undefined,
388
+ bottom: stuckBottom,
282
389
  zIndex,
283
390
  ...geometryStyle,
284
391
  color: liveChrome ? liveChrome.color : "var(--phi-region-color)",
@@ -305,6 +412,7 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
305
412
  ? { marginBlockEnd: `calc(-1 * ${blockSize ?? "var(--phi-region-reveal-extent, 0px)"})` }
306
413
  : {}),
307
414
  ...(reveal === "always" ? {} : { "--phi-region-reveal-offset": topCss }),
415
+ ...(heroOverlapCss ? { "--phi-region-hero-overlap": heroOverlapCss } : {}),
308
416
  };
309
417
  return {
310
418
  family,
@@ -30,6 +30,11 @@ export type PhiConfig = {
30
30
  * the reader rather than quietly working until the day the Theme is computed by something else.
31
31
  */
32
32
  token: PhiThemeTokens;
33
+ /**
34
+ * The page's Theme where `token` is a Surface tone's (`PhiNestedModeConfigProvider`): set only inside
35
+ * a tone scope, so outside one the page's Theme is `token` itself. Read through `usePhiPageModeToken`.
36
+ */
37
+ pageToken?: PhiThemeTokens;
33
38
  };
34
39
  export type PhiFontCatalogueFamily = {
35
40
  family: string;
@@ -49,6 +54,14 @@ export declare function PhiConfigProvider({ children, locale, fonts, fontFamilie
49
54
  controlShape: PhiControlShape;
50
55
  }): import("react").JSX.Element;
51
56
  export declare function usePhiConfig(): PhiConfig;
57
+ /**
58
+ * The Theme of the page's own mode, wherever this is asked -- inside a Surface tone too.
59
+ *
60
+ * What draws the page's tools rather than its content takes its colours from here: the Builder's scaffolds
61
+ * mark Layouts and Widgets in the editor's mode, and a Region turned inverse leaves them as they were
62
+ * instead of turning them with the content they stand around.
63
+ */
64
+ export declare function usePhiPageModeToken(): PhiThemeTokens;
52
65
  /** The locale the root adapter configures Ant Design with, for whoever hands it on. */
53
66
  export type PhiConfigLocale = ConfigProviderProps["locale"];
54
67
  /**
@@ -70,6 +70,17 @@ export function usePhiConfig() {
70
70
  }
71
71
  return config;
72
72
  }
73
+ /**
74
+ * The Theme of the page's own mode, wherever this is asked -- inside a Surface tone too.
75
+ *
76
+ * What draws the page's tools rather than its content takes its colours from here: the Builder's scaffolds
77
+ * mark Layouts and Widgets in the editor's mode, and a Region turned inverse leaves them as they were
78
+ * instead of turning them with the content they stand around.
79
+ */
80
+ export function usePhiPageModeToken() {
81
+ const config = usePhiConfig();
82
+ return config.pageToken ?? config.token;
83
+ }
73
84
  /**
74
85
  * The page's config in another mode: Ant Design's Theme for `mode` and the house config with that mode's
75
86
  * colours and tokens.
@@ -89,6 +100,6 @@ export function PhiNestedModeConfigProvider({ mode, theme, cssVarKey, locale, cu
89
100
  function PhiNestedModeConfigValue({ mode, customColors, children, }) {
90
101
  const outer = usePhiConfig();
91
102
  const { token } = antdTheme.useToken();
92
- const value = useMemo(() => ({ ...outer, mode, customColors, token }), [customColors, mode, outer, token]);
103
+ const value = useMemo(() => ({ ...outer, mode, customColors, token, pageToken: outer.pageToken ?? outer.token }), [customColors, mode, outer, token]);
93
104
  return _jsx(PhiConfigContext.Provider, { value: value, children: children });
94
105
  }
@@ -53,6 +53,13 @@ export declare const PHI_ROOT_BACKGROUND_IMAGE_SOURCE_KINDS: readonly PhiBackgro
53
53
  * simply resolves away.
54
54
  */
55
55
  export declare const PHI_ROOT_BACKGROUND_FILTERS: readonly PhiBackgroundFilter[];
56
+ /**
57
+ * The Base kinds the Theme Root Background offers and honours: every one but `theme`.
58
+ *
59
+ * `theme` is the Chrome Overlay standing in for a box's ground, and the Root Background is no box on the
60
+ * page but the ground beneath all of them. A stored value outside the offer resolves to `none`.
61
+ */
62
+ export declare const PHI_ROOT_BACKGROUND_BASE_KINDS: readonly PhiCmsBackgroundWidgetConfig["base"]["kind"][];
56
63
  /**
57
64
  * What the ground paints, without the geometry of the layer that paints it.
58
65
  *
@@ -59,8 +59,27 @@ export const PHI_ROOT_BACKGROUND_FILTERS = [];
59
59
  function withoutPhiRootBackgroundFilter(config) {
60
60
  return config ? { ...normalizePhiBackgroundWidgetConfig(config), filter: null } : null;
61
61
  }
62
+ /**
63
+ * The Base kinds the Theme Root Background offers and honours: every one but `theme`.
64
+ *
65
+ * `theme` is the Chrome Overlay standing in for a box's ground, and the Root Background is no box on the
66
+ * page but the ground beneath all of them. A stored value outside the offer resolves to `none`.
67
+ */
68
+ export const PHI_ROOT_BACKGROUND_BASE_KINDS = [
69
+ "none",
70
+ "color",
71
+ "gradient",
72
+ "image",
73
+ ];
62
74
  function readPhiRootBackgroundConfig(root, mode) {
63
- return (mode === "dark" ? root?.background?.dark : root?.background?.light) ?? null;
75
+ const configured = (mode === "dark" ? root?.background?.dark : root?.background?.light) ?? null;
76
+ if (configured == null) {
77
+ return null;
78
+ }
79
+ const normalized = normalizePhiBackgroundWidgetConfig(configured);
80
+ return PHI_ROOT_BACKGROUND_BASE_KINDS.includes(normalized.base.kind)
81
+ ? configured
82
+ : { ...normalized, base: { kind: "none" } };
64
83
  }
65
84
  /**
66
85
  * What the ground paints, without the geometry of the layer that paints it.
@@ -5,6 +5,7 @@ import "../../styles/root.css";
5
5
  import "../../styles/layout.css";
6
6
  import "../../styles/control-shape.css";
7
7
  import "../../styles/controls.css";
8
+ import "../../styles/gradients.css";
8
9
  import type { PhiSiteConfig } from "../../types/site-config";
9
10
  import type { PhiResolvedLocale } from "../../helpers/site-locale-config";
10
11
  import { type PhiThemeMode, type PhiThemePresetPlugin } from "../../theme/phi-theme-presets";
@@ -14,6 +14,7 @@ import "../../styles/root.css";
14
14
  import "../../styles/layout.css";
15
15
  import "../../styles/control-shape.css";
16
16
  import "../../styles/controls.css";
17
+ import "../../styles/gradients.css";
17
18
  import { getResolvedSiteConfig } from "../../gateway/site-config";
18
19
  import { loadPhiAntdLocale } from "../../helpers/antd-locale";
19
20
  import { PhiDayjsLocale } from "./phi-dayjs-locale";