@phis/ui 0.4.4 → 0.4.6

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 (238) 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 +31 -2
  5. package/components/controls/phi-background-control.d.ts +6 -1
  6. package/components/controls/phi-background-control.js +12 -4
  7. package/components/controls/phi-button-control.d.ts +15 -1
  8. package/components/controls/phi-button-control.js +21 -3
  9. package/components/controls/phi-collapse-control.d.ts +6 -2
  10. package/components/controls/phi-collapse-control.js +2 -2
  11. package/components/controls/phi-dialog-control.d.ts +11 -5
  12. package/components/controls/phi-dialog-control.js +19 -13
  13. package/components/controls/phi-dropdown-control.js +2 -2
  14. package/components/controls/phi-media-asset-tile-control.js +10 -10
  15. package/components/controls/phi-menu-control-vocabulary.d.ts +7 -0
  16. package/components/controls/phi-menu-control-vocabulary.js +10 -0
  17. package/components/controls/phi-menu-control.d.ts +4 -1
  18. package/components/controls/phi-menu-control.js +6 -1
  19. package/components/controls/phi-progress-control.d.ts +10 -2
  20. package/components/controls/phi-progress-control.js +6 -2
  21. package/components/controls/phi-ribbon-control.d.ts +4 -1
  22. package/components/controls/phi-ribbon-control.js +5 -3
  23. package/components/controls/phi-ribbon-wrap-control.d.ts +7 -1
  24. package/components/controls/phi-ribbon-wrap-control.js +8 -2
  25. package/components/controls/phi-segmented-control.d.ts +4 -1
  26. package/components/controls/phi-segmented-control.js +13 -2
  27. package/components/controls/phi-surface-control.d.ts +2 -0
  28. package/components/controls/phi-surface-control.js +16 -1
  29. package/components/controls/phi-switch-control.d.ts +4 -1
  30. package/components/controls/phi-switch-control.js +8 -2
  31. package/components/controls/phi-tag-control.d.ts +4 -1
  32. package/components/controls/phi-tag-control.js +11 -3
  33. package/components/layouts/clients/phi-split-card-layout-client.js +13 -5
  34. package/components/layouts/clients/phi-three-column-layout-client.js +9 -3
  35. package/components/layouts/phi-layout-view-model.js +10 -1
  36. package/components/layouts/split-card-geometry.js +6 -2
  37. package/components/media/aspect-ratios.d.ts +2 -2
  38. package/components/menus/phi-account-menu.js +3 -1
  39. package/components/navigation/phi-link.js +7 -2
  40. package/components/navigation/use-phi-protected-mail.d.ts +11 -0
  41. package/components/navigation/use-phi-protected-mail.js +29 -0
  42. package/components/regions/clients/cms-region-container-client.js +16 -2
  43. package/components/regions/phi-cms-region-container.js +5 -1
  44. package/components/regions/phi-cms-region-shell.d.ts +11 -0
  45. package/components/regions/phi-cms-region-shell.js +64 -7
  46. package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -1
  47. package/components/root/phi-config-provider.js +16 -0
  48. package/components/root/phi-root-layout.d.ts +1 -0
  49. package/components/root/phi-root-layout.js +1 -0
  50. package/components/root/phi-root-theme-resolver.js +12 -1
  51. package/components/root/phi-shell-chrome-overlay.d.ts +6 -0
  52. package/components/root/phi-shell-chrome-overlay.js +7 -1
  53. package/components/runtime/runtime-module-context.d.ts +12 -1
  54. package/components/runtime/runtime-module-context.js +6 -1
  55. package/components/shell/phi-cms-shell.d.ts +9 -1
  56. package/components/shell/phi-cms-shell.js +10 -4
  57. package/components/shell/phi-nav-link.js +7 -2
  58. package/components/shell/phi-shell-sider-drawer.d.ts +17 -0
  59. package/components/shell/phi-shell-sider-drawer.js +88 -0
  60. package/components/shell/use-phi-shell-header-bands.d.ts +5 -0
  61. package/components/shell/use-phi-shell-header-bands.js +64 -0
  62. package/components/shell/use-phi-shell-sticky-bottom.d.ts +18 -0
  63. package/components/shell/use-phi-shell-sticky-bottom.js +54 -0
  64. package/components/tables/client/phi-table-binding.d.ts +1 -0
  65. package/components/tables/client/phi-table-binding.js +22 -3
  66. package/components/trees/client/phi-tree-binding.d.ts +1 -0
  67. package/components/trees/client/phi-tree-binding.js +11 -2
  68. package/components/widgets/client/shared/phi-collection-provider.js +4 -3
  69. package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
  70. package/components/widgets/client/shared/phi-collection-view-binding.js +16 -2
  71. package/components/widgets/client/shared/phi-command-buttons.js +6 -2
  72. package/components/widgets/config/background.d.ts +20 -0
  73. package/components/widgets/config/background.js +44 -2
  74. package/components/widgets/config/button-variant.d.ts +22 -4
  75. package/components/widgets/config/button-variant.js +24 -5
  76. package/components/widgets/config/common-action-field.d.ts +1 -1
  77. package/components/widgets/config/parser-primitives.js +4 -2
  78. package/components/widgets/config/theme-gradient.d.ts +11 -0
  79. package/components/widgets/config/theme-gradient.js +12 -0
  80. package/components/widgets/helpers/internal-reference-resolver.server.d.ts +1 -0
  81. package/components/widgets/helpers/internal-reference-resolver.server.js +4 -1
  82. package/components/widgets/label-sets/background.js +2 -0
  83. package/components/widgets/label-sets/geometry.js +2 -0
  84. package/components/widgets/label-sets/inspector.js +6 -0
  85. package/components/widgets/label-types/background.d.ts +1 -0
  86. package/components/widgets/label-types/background.js +1 -0
  87. package/components/widgets/label-types/common-controls.js +2 -2
  88. package/components/widgets/label-types/geometry.d.ts +1 -0
  89. package/components/widgets/label-types/geometry.js +1 -0
  90. package/components/widgets/label-types/inspector.d.ts +6 -0
  91. package/components/widgets/label-types/inspector.js +3 -0
  92. package/components/widgets/server/navigation-request.js +13 -1
  93. package/components/widgets/shared/card-body-client.d.ts +13 -0
  94. package/components/widgets/shared/card-body-client.js +40 -11
  95. package/components/widgets/shared/card-vocabulary.d.ts +36 -0
  96. package/components/widgets/shared/card-vocabulary.js +52 -0
  97. package/components/widgets/shared/collection-source-failure.d.ts +26 -0
  98. package/components/widgets/shared/collection-source-failure.js +42 -0
  99. package/components/widgets/shared/markdown-body-client.d.ts +29 -0
  100. package/components/widgets/shared/markdown-body-client.js +60 -5
  101. package/components/widgets/shared/markdown-image-vocabulary.d.ts +31 -0
  102. package/components/widgets/shared/markdown-image-vocabulary.js +68 -0
  103. package/components/widgets/shared/markdown-render.d.ts +5 -0
  104. package/components/widgets/shared/markdown-render.js +139 -11
  105. package/components/widgets/shared/markdown-sections.d.ts +40 -0
  106. package/components/widgets/shared/markdown-sections.js +111 -0
  107. package/components/widgets/shared/widget-failure-client.d.ts +10 -0
  108. package/components/widgets/shared/widget-failure-client.js +20 -0
  109. package/components/widgets/shared/widget-failure.d.ts +31 -0
  110. package/components/widgets/shared/widget-failure.js +20 -0
  111. package/components/widgets/shared/widget-failure.server.d.ts +9 -0
  112. package/components/widgets/shared/widget-failure.server.js +12 -0
  113. package/gateway/dashboard-card-memo.d.ts +3 -0
  114. package/gateway/dashboard-card-memo.js +25 -0
  115. package/helpers/cms-region-keys.d.ts +1 -1
  116. package/helpers/external-href.js +1 -1
  117. package/helpers/layout-style.d.ts +8 -4
  118. package/helpers/layout-style.js +3 -2
  119. package/helpers/mode-paint.d.ts +4 -0
  120. package/helpers/mode-paint.js +47 -0
  121. package/helpers/protected-mail.d.ts +16 -0
  122. package/helpers/protected-mail.js +81 -0
  123. package/helpers/surface-style.js +33 -11
  124. package/module-dashboard-cards.d.ts +1 -0
  125. package/module-dashboard-cards.js +1 -0
  126. package/module-records.d.ts +7 -0
  127. package/module-records.js +6 -0
  128. package/package.json +2 -2
  129. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +1 -1
  130. package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
  131. package/plugins/runtime-modules/builder/clients/region-inspector.js +67 -3
  132. package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
  133. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +7 -4
  134. package/plugins/runtime-modules/builder/controller/page-controller.js +7 -0
  135. package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
  136. package/plugins/runtime-modules/builder/persistence.js +9 -1
  137. package/plugins/runtime-modules/core/content-entries/record-source.server.d.ts +3 -1
  138. package/plugins/runtime-modules/core/content-entries/record-source.server.js +7 -4
  139. package/plugins/runtime-modules/core/widgets/button/client.js +2 -2
  140. package/plugins/runtime-modules/core/widgets/button/config.d.ts +40 -4
  141. package/plugins/runtime-modules/core/widgets/button/config.js +12 -0
  142. package/plugins/runtime-modules/core/widgets/card/config.d.ts +102 -1
  143. package/plugins/runtime-modules/core/widgets/card/config.js +60 -1
  144. package/plugins/runtime-modules/core/widgets/card/editor.js +17 -2
  145. package/plugins/runtime-modules/core/widgets/card/server.js +13 -1
  146. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +4 -1
  147. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -3
  148. package/plugins/runtime-modules/core/widgets/collection-view/authoring.js +1 -1
  149. package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +3 -0
  150. package/plugins/runtime-modules/core/widgets/collection-view/client.js +47 -11
  151. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +4 -1
  152. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
  153. package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +3 -2
  154. package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +6 -1
  155. package/plugins/runtime-modules/core/widgets/collection-view/server.js +21 -3
  156. package/plugins/runtime-modules/core/widgets/entry-detail/plugin.js +1 -1
  157. package/plugins/runtime-modules/core/widgets/entry-detail/server.d.ts +3 -1
  158. package/plugins/runtime-modules/core/widgets/entry-detail/server.js +5 -2
  159. package/plugins/runtime-modules/core/widgets/entry-header/plugin.js +1 -1
  160. package/plugins/runtime-modules/core/widgets/entry-header/server.d.ts +3 -1
  161. package/plugins/runtime-modules/core/widgets/entry-header/server.js +5 -2
  162. package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -1
  163. package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +6 -3
  164. package/plugins/runtime-modules/core/widgets/entry-list/server.js +13 -6
  165. package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +2 -1
  166. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +3 -3
  167. package/plugins/runtime-modules/core/widgets/gallery/plugin.js +1 -1
  168. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -3
  169. package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -6
  170. package/plugins/runtime-modules/core/widgets/header-navigation/client.d.ts +6 -1
  171. package/plugins/runtime-modules/core/widgets/header-navigation/client.js +40 -13
  172. package/plugins/runtime-modules/core/widgets/header-navigation/config.d.ts +26 -1
  173. package/plugins/runtime-modules/core/widgets/header-navigation/config.js +27 -0
  174. package/plugins/runtime-modules/core/widgets/header-navigation/plugin.js +1 -1
  175. package/plugins/runtime-modules/core/widgets/header-navigation/server.d.ts +2 -2
  176. package/plugins/runtime-modules/core/widgets/header-navigation/server.js +3 -1
  177. package/plugins/runtime-modules/core/widgets/image/client.js +11 -7
  178. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +16 -0
  179. package/plugins/runtime-modules/core/widgets/markdown/config.js +46 -1
  180. package/plugins/runtime-modules/core/widgets/markdown/server.js +22 -8
  181. package/plugins/runtime-modules/core/widgets/record/client.d.ts +4 -1
  182. package/plugins/runtime-modules/core/widgets/record/client.js +8 -3
  183. package/plugins/runtime-modules/core/widgets/record/plugin.js +3 -2
  184. package/plugins/runtime-modules/core/widgets/record/server.d.ts +3 -1
  185. package/plugins/runtime-modules/core/widgets/record/server.js +2 -2
  186. package/plugins/runtime-modules/core/widgets/segmented/client.js +1 -1
  187. package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +21 -1
  188. package/plugins/runtime-modules/core/widgets/segmented/config.js +11 -1
  189. package/plugins/runtime-modules/core/widgets/simple-text/server.js +11 -1
  190. package/plugins/runtime-modules/core/widgets/switch/client.js +1 -1
  191. package/plugins/runtime-modules/core/widgets/switch/config.d.ts +19 -0
  192. package/plugins/runtime-modules/core/widgets/switch/config.js +11 -0
  193. package/plugins/runtime-modules/core/widgets/table/authoring.js +1 -1
  194. package/plugins/runtime-modules/core/widgets/table/client.d.ts +4 -1
  195. package/plugins/runtime-modules/core/widgets/table/client.js +16 -3
  196. package/plugins/runtime-modules/core/widgets/table/plugin.js +3 -2
  197. package/plugins/runtime-modules/core/widgets/table/server.d.ts +3 -1
  198. package/plugins/runtime-modules/core/widgets/table/server.js +2 -2
  199. package/plugins/runtime-modules/core/widgets/table/static-resource-editor.js +2 -1
  200. package/plugins/runtime-modules/core/widgets/timeline/authoring.js +1 -1
  201. package/plugins/runtime-modules/core/widgets/timeline/client.d.ts +1 -3
  202. package/plugins/runtime-modules/core/widgets/timeline/client.js +14 -4
  203. package/plugins/runtime-modules/core/widgets/tree/authoring.js +1 -1
  204. package/plugins/runtime-modules/core/widgets/tree/client.d.ts +4 -1
  205. package/plugins/runtime-modules/core/widgets/tree/client.js +13 -2
  206. package/plugins/runtime-modules/core/widgets/tree/plugin.js +3 -2
  207. package/plugins/runtime-modules/core/widgets/tree/server.d.ts +3 -1
  208. package/plugins/runtime-modules/core/widgets/tree/server.js +2 -2
  209. package/plugins/runtime-modules/theme/presets.d.ts +9 -1
  210. package/plugins/runtime-modules/theme/tour.d.ts +9 -1
  211. package/plugins/runtime-modules/theme/tour.js +10 -1
  212. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +138 -7
  213. package/runtime-data-provider-client.d.ts +2 -0
  214. package/runtime-data-provider-client.js +7 -0
  215. package/styles/controls.css +118 -15
  216. package/styles/gradients.css +101 -0
  217. package/styles/layout.css +35 -0
  218. package/styles/root.css +18 -0
  219. package/styles/shell.css +206 -0
  220. package/theme/phi-button-shadow.d.ts +6 -0
  221. package/theme/phi-theme-gradients.d.ts +96 -0
  222. package/theme/phi-theme-gradients.js +245 -0
  223. package/theme/phi-theme-presets.d.ts +3 -0
  224. package/theme/phi-theme-presets.js +3 -0
  225. package/theme/phi-theme-tokens.d.ts +5 -1
  226. package/theme/phi-theme-tokens.js +14 -0
  227. package/theme/phi-tokens.d.ts +6 -0
  228. package/theme/phi-tokens.js +6 -0
  229. package/theme.d.ts +1 -0
  230. package/theme.js +6 -0
  231. package/types/cms-presets.d.ts +7 -0
  232. package/types/core-widget-placements.d.ts +8 -0
  233. package/types/layout-style.d.ts +9 -8
  234. package/types/layout-style.js +9 -8
  235. package/types/surface.d.ts +4 -0
  236. package/types/surface.js +4 -0
  237. package/types.d.ts +1 -1
  238. package/types.js +1 -1
@@ -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";
@@ -11,7 +12,7 @@ import { resolvePhiRenderableBlockGeometry } from "../../types/renderable-block-
11
12
  import { createPhiSignalAddress } from "../../types/signals";
12
13
  import { readPhiCmsRegionReveal } from "../../helpers/region-page-scope";
13
14
  import { resolvePhiPaddingStyle } from "../layouts/phi-layout-contract";
14
- import { PHI_SHELL_STICKY_TOP_PROPERTY, 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";
15
16
  import { normalizePhiBackgroundWidgetConfig, phiBackgroundWidgetConfigPaintsGround, resolvePhiBackgroundGroundFilter, resolvePhiBackgroundMotion, resolvePhiBackgroundMotionHostStyle, resolvePhiBackgroundPane, resolvePhiBackgroundWidgetStyle, } from "../widgets/config/background";
16
17
  /*
17
18
  * The longhands every Region that paints the Shell Chrome Overlay (SHELL.md) carries, read from the
@@ -61,6 +62,27 @@ export function phiCmsRegionSiderSticks(regionKey, config) {
61
62
  && hasPhiFlag(config?.flags, PhiCmsFlags.Sticky)
62
63
  && !hasPhiFlag(config?.flags, PhiCmsFlags.FullHeight);
63
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
+ /**
78
+ * Whether a Region is the Sider that opens as a drawer on a phone (SHELL.md "The Sider on a phone").
79
+ *
80
+ * `sider_left` alone: it is the Area's, where an Area's navigation stands, and the Shell's menu button sits
81
+ * at the inline start of the Header beside it. `sider_right` belongs to the Page and keeps its column.
82
+ */
83
+ function phiCmsRegionSiderOpensAsDrawer(regionKey, config) {
84
+ return regionKey === "sider_left" && hasPhiFlag(config?.flags, PhiCmsFlags.MobileDrawer);
85
+ }
64
86
  /** The line a stuck Sider stands at: under the Header as measured, plus its own offset. */
65
87
  function resolvePhiCmsRegionSiderStuckTop(topCss) {
66
88
  return `calc(var(${PHI_SHELL_STICKY_TOP_PROPERTY}, 0px) + ${topCss})`;
@@ -123,6 +145,11 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
123
145
  const siderCollapsedWidth = normalizeCssLength(config.collapsedWidth) ?? resolvePhiShellSiderCollapsedWidth(shellTheme);
124
146
  const top = normalizeCssLength(config.offsetTop) ?? 0;
125
147
  const topCss = typeof top === "number" ? `${top}px` : top;
148
+ // How far `content` reaches up into the Hero; `styles/shell.css` applies it only where there is one.
149
+ const heroOverlap = regionKey === "content" ? normalizeCssLength(config.heroOverlap) : null;
150
+ const heroOverlapCss = heroOverlap == null || heroOverlap === 0
151
+ ? null
152
+ : typeof heroOverlap === "number" ? `${heroOverlap}px` : heroOverlap;
126
153
  const sticky = hasPhiFlag(config.flags, PhiCmsFlags.Sticky);
127
154
  // A preview shows the Region where it stands, so an author can see what they are editing.
128
155
  const reveal = previewMode ? "always" : readPhiCmsRegionReveal(regionKey, config);
@@ -136,7 +163,12 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
136
163
  * A revealing `header_top` sticks whatever its flag says: coming back into view at the top edge is what
137
164
  * revealing means, and only a sticky band has a top edge to come back to.
138
165
  */
139
- const stuck = isHeader ? sticky || reveal !== "always" : isSider && (sticky || fullHeight);
166
+ const footerSticks = phiCmsRegionFooterSticks(regionKey, config);
167
+ const stuck = isHeader
168
+ ? sticky || reveal !== "always"
169
+ : footerSticks || (isSider && (sticky || fullHeight));
170
+ const bottom = normalizeCssLength(config.offsetBottom) ?? 0;
171
+ const stuckBottom = footerSticks ? (typeof bottom === "number" ? `${bottom}px` : bottom) : undefined;
140
172
  /*
141
173
  * The Header bands below `header_top` stick under it while it is in view and close up when it leaves.
142
174
  * `--phi-shell-header-top-stack` is how much of the viewport's top it holds right now; only a
@@ -149,7 +181,7 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
149
181
  * tall as what is left of the viewport below that line.
150
182
  */
151
183
  const siderUnderHeader = isSider && sticky && !fullHeight;
152
- const stuckTop = !stuck
184
+ const stuckTop = !stuck || footerSticks
153
185
  ? undefined
154
186
  : isHeader && regionKey !== "header_top"
155
187
  ? `calc(${topCss} + var(--phi-shell-header-top-stack, 0px))`
@@ -160,7 +192,10 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
160
192
  const fullHeightSize = fullHeight && !blockSize
161
193
  ? `calc(100dvh - ${topCss})`
162
194
  : blockSize;
163
- const underHeaderMaxSize = siderUnderHeader ? `calc(100dvh - ${resolvePhiCmsRegionSiderStuckTop(topCss)})` : undefined;
195
+ // Below the Header as measured, and above a stuck Footer as measured: the room left between the two.
196
+ const underHeaderMaxSize = siderUnderHeader
197
+ ? `calc(100dvh - ${resolvePhiCmsRegionSiderStuckTop(topCss)} - var(${PHI_SHELL_STICKY_BOTTOM_PROPERTY}, 0px))`
198
+ : undefined;
164
199
  const zIndex = config.zIndex ?? resolvePhiShellRegionZIndex(regionKey, hasPhiFlag(config.flags, PhiCmsFlags.FullHeight));
165
200
  /*
166
201
  * A Background config that paints nothing is not an authored ground. The Builder writes one onto every
@@ -200,10 +235,26 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
200
235
  const backgroundMoves = animatesBackground &&
201
236
  backgroundConfig != null &&
202
237
  resolvePhiBackgroundMotion(backgroundConfig) != null;
203
- const groundFilter = backgroundConfig == null ? null : resolvePhiBackgroundGroundFilter(backgroundConfig);
238
+ /*
239
+ * The ground in dark mode (`PhiSurface.backgroundDark`), for a Region that paints a ground of its own in
240
+ * light mode: the page's mode picks between the two in CSS (`helpers/mode-paint.ts`). Not for the
241
+ * Theme's Overlay, which is per mode already, nor for a moving picture, which the motion layer draws
242
+ * from one Background.
243
+ */
244
+ const backgroundDarkConfig = backgroundConfig != null && !themeGround && !backgroundMoves && surface?.backgroundDark
245
+ ? normalizePhiBackgroundWidgetConfig(surface.backgroundDark)
246
+ : null;
247
+ const groundFilterLight = backgroundConfig == null ? null : resolvePhiBackgroundGroundFilter(backgroundConfig);
248
+ const groundFilterDark = backgroundDarkConfig == null ? null : resolvePhiBackgroundGroundFilter(backgroundDarkConfig);
249
+ const groundFilter = backgroundDarkConfig && groundFilterLight !== groundFilterDark
250
+ ? resolvePhiModeValue(groundFilterLight ?? "none", groundFilterDark ?? "none")
251
+ : groundFilterLight;
252
+ const layerPaint = (entry) => resolvePhiBackgroundWidgetStyle({ ...entry, filter: null, motion: null });
204
253
  const ground = backgroundConfig != null && groundFilter != null && !backgroundMoves
205
254
  ? {
206
- paint: resolvePhiBackgroundWidgetStyle({ ...backgroundConfig, filter: null, motion: null }),
255
+ paint: backgroundDarkConfig
256
+ ? composePhiModePaint(layerPaint(backgroundConfig), layerPaint(backgroundDarkConfig))
257
+ : layerPaint(backgroundConfig),
207
258
  filter: groundFilter,
208
259
  motion: null,
209
260
  }
@@ -219,7 +270,9 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
219
270
  ? null
220
271
  : backgroundMoves
221
272
  ? resolvePhiBackgroundMotionHostStyle(backgroundConfig)
222
- : resolvePhiBackgroundWidgetStyle(backgroundConfig);
273
+ : backgroundDarkConfig
274
+ ? composePhiModePaint(resolvePhiBackgroundWidgetStyle(backgroundConfig), resolvePhiBackgroundWidgetStyle(backgroundDarkConfig))
275
+ : resolvePhiBackgroundWidgetStyle(backgroundConfig);
223
276
  const chromeInput = {
224
277
  shadow: surface?.shadow ?? undefined,
225
278
  effect: shellPane ?? undefined,
@@ -341,6 +394,7 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
341
394
  position: stuck ? "sticky" : "relative",
342
395
  top: stuckTop,
343
396
  insetBlockStart: isHeader ? stuckTop : undefined,
397
+ bottom: stuckBottom,
344
398
  zIndex,
345
399
  ...geometryStyle,
346
400
  color: liveChrome ? liveChrome.color : "var(--phi-region-color)",
@@ -367,6 +421,7 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
367
421
  ? { marginBlockEnd: `calc(-1 * ${blockSize ?? "var(--phi-region-reveal-extent, 0px)"})` }
368
422
  : {}),
369
423
  ...(reveal === "always" ? {} : { "--phi-region-reveal-offset": topCss }),
424
+ ...(heroOverlapCss ? { "--phi-region-hero-overlap": heroOverlapCss } : {}),
370
425
  };
371
426
  return {
372
427
  family,
@@ -392,6 +447,8 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
392
447
  "data-phi-viewport-flags": viewportFlags,
393
448
  "data-phi-block-enabled": enabled ? "true" : "false",
394
449
  "data-phi-region-reveal": reveal === "always" ? undefined : reveal,
450
+ // `styles/shell.css` takes this Sider out of its column on a phone; `PhiShellSiderDrawer` opens it.
451
+ "data-phi-sider-mobile": phiCmsRegionSiderOpensAsDrawer(regionKey, config) ? "drawer" : undefined,
395
452
  ...effectsAttributes,
396
453
  className: ["phi-cms-region-shell", resolvePhiSurfaceToneClassName(surface?.tone), className]
397
454
  .filter(Boolean)
@@ -107,7 +107,8 @@ export function buildPhiAreaShellSiderLeftNodes({ nodes, runtime, labelPrefix, n
107
107
  sortOrder: 25,
108
108
  // Structure only: the frame's look is the Theme's (SHELL.md, Shell Chrome Overlay).
109
109
  config: {
110
- flags: PhiCmsFlags.Sticky | PhiCmsFlags.FullHeight | PhiCmsFlags.Collapsible,
110
+ // On a phone the navigation opens from the Header's menu button (SHELL.md "The Sider on a phone").
111
+ flags: PhiCmsFlags.Sticky | PhiCmsFlags.FullHeight | PhiCmsFlags.Collapsible | PhiCmsFlags.MobileDrawer,
111
112
  size: { width: `${resolvedShellLeftWidth}px` },
112
113
  ...(typeof shellSiderLeftOffsetTop === "number" ? { offsetTop: shellSiderLeftOffsetTop } : { offsetTop: 0 }),
113
114
  },
@@ -37,6 +37,22 @@ function PhiConfigValueProvider({ children, customColors, fonts, fontFamilies, h
37
37
  }
38
38
  };
39
39
  }, [controlShapeVars]);
40
+ /*
41
+ * The typefaces, for the same reason. The font catalogue's classes are what define
42
+ * `--phi-font-source-*`, which the Theme's `--ant-font-family` points at; a Drawer or a Modal on
43
+ * `document.body` found the variable undefined and fell back to the browser's sans-serif.
44
+ */
45
+ useEffect(() => {
46
+ const classes = rootClassName.split(/\s+/u).filter(Boolean);
47
+ if (classes.length === 0)
48
+ return;
49
+ const root = document.documentElement;
50
+ const added = classes.filter((name) => !root.classList.contains(name));
51
+ root.classList.add(...added);
52
+ return () => {
53
+ root.classList.remove(...added);
54
+ };
55
+ }, [rootClassName]);
40
56
  const value = useMemo(() => ({
41
57
  customColors,
42
58
  fonts,
@@ -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";
@@ -2,9 +2,10 @@ import { resolvePhiShellChromeOverlayVariables, } from "./phi-shell-chrome-overl
2
2
  import { resolvePhiShellRegionBackground, resolvePhiShellRegionColor, } from "../../helpers/shell-region-style";
3
3
  import { createPhiAntdThemeCssVarKey, resolvePhiAntdAliasTokens, } from "../../theme/phi-antd-token-resolver";
4
4
  import { buildPhiComponentTokens, buildPhiThemeStructuralTokens, } from "../../theme/phi-theme";
5
- import { PHI_THEME_PALETTE_MODE_SEED_KEYS, resolvePhiThemePresetPlugin, resolvePhiThemeColorTokens, } from "../../theme/phi-theme-presets";
5
+ import { mergePhiThemePalettes, PHI_THEME_PALETTE_MODE_SEED_KEYS, resolvePhiThemePresetPlugin, resolvePhiThemeColorTokens, } from "../../theme/phi-theme-presets";
6
6
  import { assertPhiThemeVocabulary } from "../../theme/phi-theme-tokens";
7
7
  import { applyPhiButtonShadowComponentTokens } from "../../theme/phi-button-shadow";
8
+ import { buildPhiThemeGradientTokens, readPhiThemeGradientKey } from "../../theme/phi-theme-gradients";
8
9
  import { applyPhiControlShapeComponentTokens, applyPhiSurfaceShapeComponentTokens, resolvePhiControlShape, } from "../../theme/phi-control-shape";
9
10
  const PHI_DEFAULT_DARK_NAV_BACKGROUND = "#001529";
10
11
  function mergeComponentThemes(defaults, overrides) {
@@ -79,8 +80,18 @@ export function resolvePhiRootTheme({ siteTheme, mode, fonts, presets, }) {
79
80
  });
80
81
  const resolvedControlShape = resolvePhiControlShape(siteTheme.shape?.controls);
81
82
  const components = applyPhiSurfaceShapeComponentTokens(applyPhiControlShapeComponentTokens(mergeComponentThemes(sharedComponentDefaults, applyPhiButtonShadowComponentTokens(siteTheme?.components, siteTheme?.buttons, mode)), resolvedControlShape, effectiveThemeTokens), resolvedControlShape, effectiveThemeTokens);
83
+ /*
84
+ * The gradient slots ride as tokens of their own, so Ant Design writes them as custom properties under
85
+ * this mode's class like every other token (theme/phi-theme-gradients.ts). Derived from the resolved
86
+ * colours, so a slot the palette leaves out follows the brand.
87
+ */
82
88
  const token = {
83
89
  ...effectiveThemeTokens,
90
+ ...buildPhiThemeGradientTokens({
91
+ gradients: mergePhiThemePalettes(themePreset.palette, siteTheme?.palette).modes?.[mode]?.gradients,
92
+ token: effectiveThemeTokens,
93
+ primaryButtonGradient: readPhiThemeGradientKey(siteTheme?.buttons?.primaryGradient),
94
+ }),
84
95
  };
85
96
  return {
86
97
  mode,
@@ -136,6 +136,12 @@ export declare const PHI_SHELL_HEADER_TOP_STACK_PROPERTY = "--phi-shell-header-t
136
136
  * and a stuck Sider stand under it; unset, it reads `0px`.
137
137
  */
138
138
  export declare const PHI_SHELL_STICKY_TOP_PROPERTY = "--phi-shell-sticky-top";
139
+ /**
140
+ * The Footer's measured top, from below: how much of the viewport's bottom a stuck `footer_bottom` holds
141
+ * right now, written on the Shell by `usePhiShellStickyBottom` (components/shell/use-phi-shell-sticky-bottom.ts).
142
+ * A Sider stuck under the Header ends above it; unset, it reads `0px`.
143
+ */
144
+ export declare const PHI_SHELL_STICKY_BOTTOM_PROPERTY = "--phi-shell-sticky-bottom";
139
145
  /**
140
146
  * How `header_top` behaves where the browser decides it, as far as the Header pane is concerned.
141
147
  */
@@ -24,7 +24,7 @@ import { normalizePhiBackgroundWidgetConfig, resolvePhiBackgroundFilter, resolve
24
24
  * A wash of colour over the frame is an Overlay rather than a Filter, and the overlay offers those
25
25
  * unnarrowed.
26
26
  */
27
- export const PHI_SHELL_CHROME_OVERLAY_FILTERS = ["glass", "haze"];
27
+ export const PHI_SHELL_CHROME_OVERLAY_FILTERS = ["glass", "haze", "clear"];
28
28
  /**
29
29
  * The Base kinds the overlay offers and honours, which is the whole contract.
30
30
  *
@@ -239,6 +239,12 @@ export const PHI_SHELL_HEADER_TOP_STACK_PROPERTY = "--phi-shell-header-top-stack
239
239
  * and a stuck Sider stand under it; unset, it reads `0px`.
240
240
  */
241
241
  export const PHI_SHELL_STICKY_TOP_PROPERTY = "--phi-shell-sticky-top";
242
+ /**
243
+ * The Footer's measured top, from below: how much of the viewport's bottom a stuck `footer_bottom` holds
244
+ * right now, written on the Shell by `usePhiShellStickyBottom` (components/shell/use-phi-shell-sticky-bottom.ts).
245
+ * A Sider stuck under the Header ends above it; unset, it reads `0px`.
246
+ */
247
+ export const PHI_SHELL_STICKY_BOTTOM_PROPERTY = "--phi-shell-sticky-bottom";
242
248
  /**
243
249
  * Where the Header pane sticks when `header_top` may come and go.
244
250
  *
@@ -3,6 +3,7 @@ import type { PhiRuntimeModuleDataProviderDescriptor, PhiRuntimeModuleClientWidg
3
3
  import type { PhiRuntimeDataProviderKey } from "../../types/runtime-data-provider";
4
4
  import type { PhiCalendarAdapterDescriptor, PhiCalendarAdapterKey } from "../../types/calendar";
5
5
  import type { PhiVideoProviderDescriptor, PhiVideoProviderKey } from "../../types/video";
6
+ import type { PhiCollectionItemRendererDescriptor } from "../../types/collection-provider";
6
7
  type PhiRuntimeModuleClientState = {
7
8
  moduleIds: ReadonlySet<string>;
8
9
  widgetTypes: ReadonlySet<string>;
@@ -18,8 +19,17 @@ type PhiRuntimeModuleClientState = {
18
19
  * nothing, which is how a placement outlives the Module that once served it.
19
20
  */
20
21
  videoProviderDescriptorsByKey: ReadonlyMap<PhiVideoProviderKey, PhiVideoProviderDescriptor>;
22
+ /**
23
+ * The Collection item renderers the Area's Modules declare, by key -- or null where nobody said.
24
+ *
25
+ * Only the Builder says: it is where a Collection View's configuration is judged without drawing any
26
+ * items, and a renderer a Site picked from another Module is one of the things it judges. A live page
27
+ * looks its renderer up in the Render Client manifest, which is the real answer there. Null rather than
28
+ * an empty set, so that "not known here" can never read as "none offered".
29
+ */
30
+ collectionItemRendererKeys: ReadonlySet<string> | null;
21
31
  };
22
- export declare function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layoutTypes, widgetDefinitions, dataProviderDescriptors, calendarAdapterDescriptors, videoProviderDescriptors, children, }: {
32
+ export declare function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layoutTypes, widgetDefinitions, dataProviderDescriptors, calendarAdapterDescriptors, videoProviderDescriptors, collectionItemRendererDescriptors, children, }: {
23
33
  moduleIds: readonly string[];
24
34
  widgetTypes: readonly string[];
25
35
  layoutTypes: readonly string[];
@@ -27,6 +37,7 @@ export declare function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layou
27
37
  dataProviderDescriptors?: readonly PhiRuntimeModuleDataProviderDescriptor[];
28
38
  calendarAdapterDescriptors?: readonly PhiCalendarAdapterDescriptor[];
29
39
  videoProviderDescriptors?: readonly PhiVideoProviderDescriptor[];
40
+ collectionItemRendererDescriptors?: readonly PhiCollectionItemRendererDescriptor[];
30
41
  children: ReactNode;
31
42
  }): import("react").JSX.Element;
32
43
  export declare function usePhiRuntimeModuleState(): PhiRuntimeModuleClientState;
@@ -9,9 +9,10 @@ const EMPTY_RUNTIME_MODULE_STATE = {
9
9
  dataProviderDescriptorsByKey: new Map(),
10
10
  calendarAdapterDescriptorsByKey: new Map(),
11
11
  videoProviderDescriptorsByKey: new Map(),
12
+ collectionItemRendererKeys: null,
12
13
  };
13
14
  const PhiRuntimeModuleContext = createContext(EMPTY_RUNTIME_MODULE_STATE);
14
- export function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layoutTypes, widgetDefinitions = [], dataProviderDescriptors = [], calendarAdapterDescriptors = [], videoProviderDescriptors = [], children, }) {
15
+ export function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layoutTypes, widgetDefinitions = [], dataProviderDescriptors = [], calendarAdapterDescriptors = [], videoProviderDescriptors = [], collectionItemRendererDescriptors, children, }) {
15
16
  const state = useMemo(() => ({
16
17
  moduleIds: new Set(moduleIds),
17
18
  widgetTypes: new Set(widgetTypes),
@@ -20,8 +21,12 @@ export function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layoutTypes,
20
21
  dataProviderDescriptorsByKey: new Map(dataProviderDescriptors.map((descriptor) => [descriptor.key, descriptor])),
21
22
  calendarAdapterDescriptorsByKey: new Map(calendarAdapterDescriptors.map((descriptor) => [descriptor.key, descriptor])),
22
23
  videoProviderDescriptorsByKey: new Map(videoProviderDescriptors.map((descriptor) => [descriptor.key, descriptor])),
24
+ collectionItemRendererKeys: collectionItemRendererDescriptors
25
+ ? new Set(collectionItemRendererDescriptors.map((descriptor) => descriptor.key))
26
+ : null,
23
27
  }), [
24
28
  calendarAdapterDescriptors,
29
+ collectionItemRendererDescriptors,
25
30
  dataProviderDescriptors,
26
31
  layoutTypes,
27
32
  moduleIds,
@@ -9,6 +9,8 @@ export type PhiCmsShellProps = {
9
9
  siderLeft?: ReactNode;
10
10
  siderRight?: ReactNode;
11
11
  siderLeftFullHeight?: boolean;
12
+ /** `sider_left` opens as a drawer on a phone (SHELL.md "The Sider on a phone"). */
13
+ siderLeftMobileDrawer?: boolean;
12
14
  footerTop?: ReactNode;
13
15
  footerMain?: ReactNode;
14
16
  footerBottom?: ReactNode;
@@ -25,5 +27,11 @@ export type PhiCmsShellProps = {
25
27
  * pane and the bands below read it.
26
28
  */
27
29
  headerTopRoom?: Record<`--phi-shell-header-top-${string}`, string>;
30
+ /**
31
+ * The room the Header bands hold, as far as the configs state it (`--phi-shell-band-top`,
32
+ * `--phi-shell-band-main`, and `--phi-shell-band-bottom` where the Page states it): what a Hero stands
33
+ * behind on the first paint. The browser measures the rest (`use-phi-shell-header-bands.ts`).
34
+ */
35
+ headerBandRoom?: Record<`--phi-shell-band-${string}`, string>;
28
36
  };
29
- export declare function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, }: PhiCmsShellProps): import("react").JSX.Element;
37
+ export declare function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight, siderLeftMobileDrawer, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, headerBandRoom, }: PhiCmsShellProps): import("react").JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "../../styles/shell.css";
3
+ import { PhiShellSiderDrawer } from "./phi-shell-sider-drawer";
3
4
  /**
4
5
  * One continuous pane per Chrome family (SHELL.md "Root Background and Shell Backdrop Layers").
5
6
  *
@@ -44,8 +45,10 @@ function PhiShellChromePane({ family, stickyTop, }) {
44
45
  ? { ...PHI_SHELL_CHROME_PANE_PAINT, boxShadow }
45
46
  : { ...PHI_SHELL_CHROME_PANE_PAINT, boxShadow, position: "sticky", top: stickyTop } }));
46
47
  }
47
- export function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight = false, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, }) {
48
- const roomStyle = headerTopRoom;
48
+ export function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight = false, siderLeftMobileDrawer = false, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, headerBandRoom, }) {
49
+ const roomStyle = headerTopRoom || headerBandRoom
50
+ ? { ...headerTopRoom, ...headerBandRoom }
51
+ : undefined;
49
52
  const hasLeftFullHeightSidebar = siderLeftFullHeight && Boolean(siderLeft);
50
53
  const shellVariant = hasLeftFullHeightSidebar
51
54
  ? "full-height-sider"
@@ -59,8 +62,11 @@ export function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero
59
62
  */
60
63
  const hasHeader = Boolean(headerTop || headerMain || headerBottom);
61
64
  const hasFooter = Boolean(footerTop || footerMain || footerBottom);
65
+ // The Client is mounted only where a Sider asks for it: every other Shell stays without one.
66
+ const siderDrawer = siderLeftMobileDrawer && siderLeft ? _jsx(PhiShellSiderDrawer, {}) : null;
67
+ const siderDrawerAttribute = siderDrawer ? "sider_left" : undefined;
62
68
  if (hasLeftFullHeightSidebar) {
63
- return (_jsxs("div", { className: "shell-sider-full", "data-phi-shell-layout": "cms", "data-phi-shell-variant": shellVariant, "data-phi-shell-chrome-panes": "true", style: roomStyle, children: [hasHeader ? _jsx(PhiShellChromePane, { family: "header", stickyTop: headerPaneStickyTop }) : null, _jsx(PhiShellChromePane, { family: "sider" }), siderRight ? _jsx(PhiShellChromePane, { family: "sider-right" }) : null, hasFooter ? _jsx(PhiShellChromePane, { family: "footer" }) : null, siderLeft, headerTop, headerMain, headerBottom, hero, _jsx("main", { className: "content phi-shell-content-main", children: content }), siderRight, footerTop, footerMain, footerBottom, drawer] }));
69
+ return (_jsxs("div", { className: "shell-sider-full", "data-phi-shell-layout": "cms", "data-phi-shell-variant": shellVariant, "data-phi-shell-chrome-panes": "true", "data-phi-shell-sider-drawer": siderDrawerAttribute, style: roomStyle, children: [siderDrawer, hasHeader ? _jsx(PhiShellChromePane, { family: "header", stickyTop: headerPaneStickyTop }) : null, _jsx(PhiShellChromePane, { family: "sider" }), siderRight ? _jsx(PhiShellChromePane, { family: "sider-right" }) : null, hasFooter ? _jsx(PhiShellChromePane, { family: "footer" }) : null, siderLeft, headerTop, headerMain, headerBottom, hero, _jsx("main", { className: "content phi-shell-content-main", children: content }), siderRight, footerTop, footerMain, footerBottom, drawer] }));
64
70
  }
65
- return (_jsxs("div", { className: siderLeft ? "shell-sider-embedded" : "shell-sider-embedded shell-sider-embedded--no-sider", "data-phi-shell-layout": "cms", "data-phi-shell-variant": shellVariant, "data-phi-shell-chrome-panes": "true", style: roomStyle, children: [headerTop || headerMain ? _jsx(PhiShellChromePane, { family: "header", stickyTop: headerPaneStickyTop }) : null, headerBottom ? _jsx(PhiShellChromePane, { family: "header-bottom" }) : null, siderLeft ? _jsx(PhiShellChromePane, { family: "sider" }) : null, siderRight ? _jsx(PhiShellChromePane, { family: "sider-right" }) : null, hasFooter ? _jsx(PhiShellChromePane, { family: "footer" }) : null, headerTop, headerMain, headerBottom, hero, siderLeft, _jsx("main", { className: "content phi-shell-content-main", children: content }), siderRight, footerTop, footerMain, footerBottom, drawer] }));
71
+ return (_jsxs("div", { className: siderLeft ? "shell-sider-embedded" : "shell-sider-embedded shell-sider-embedded--no-sider", "data-phi-shell-layout": "cms", "data-phi-shell-variant": shellVariant, "data-phi-shell-chrome-panes": "true", "data-phi-shell-sider-drawer": siderDrawerAttribute, style: roomStyle, children: [siderDrawer, headerTop || headerMain ? _jsx(PhiShellChromePane, { family: "header", stickyTop: headerPaneStickyTop }) : null, headerBottom ? _jsx(PhiShellChromePane, { family: "header-bottom" }) : null, siderLeft ? _jsx(PhiShellChromePane, { family: "sider" }) : null, siderRight ? _jsx(PhiShellChromePane, { family: "sider-right" }) : null, hasFooter ? _jsx(PhiShellChromePane, { family: "footer" }) : null, headerTop, headerMain, headerBottom, hero, siderLeft, _jsx("main", { className: "content phi-shell-content-main", children: content }), siderRight, footerTop, footerMain, footerBottom, drawer] }));
66
72
  }
@@ -1,10 +1,15 @@
1
+ "use client";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import Link from "next/link";
3
4
  import { isPhiExternalHref } from "../../helpers/external-href";
5
+ import { isPhiProtectedMail } from "../../helpers/protected-mail";
6
+ import { usePhiRevealedHref } from "../navigation/use-phi-protected-mail";
4
7
  export function PhiNavLink({ href, children, external, newTab, className, style, }) {
5
- const useAnchor = external ?? isPhiExternalHref(href);
8
+ // A protected address is never a route, whatever the caller says it is.
9
+ const useAnchor = isPhiProtectedMail(href) || (external ?? isPhiExternalHref(href));
10
+ const anchorHref = usePhiRevealedHref(href);
6
11
  if (useAnchor) {
7
- return (_jsx("a", { href: href, target: newTab ? "_blank" : undefined, rel: newTab ? "noreferrer noopener" : undefined, className: className, style: style, children: children }));
12
+ return (_jsx("a", { href: anchorHref, target: newTab ? "_blank" : undefined, rel: newTab ? "noreferrer noopener" : undefined, className: className, style: style, children: children }));
8
13
  }
9
14
  return (_jsx(Link, { href: href, className: className, style: style, children: children }));
10
15
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A `sider_left` with `MobileDrawer`, on a phone: the menu button that opens it, the mask behind it, and
3
+ * the rules that close it again (SHELL.md "The Sider on a phone").
4
+ *
5
+ * The Sider itself does not move. `styles/shell.css` takes it out of its column below 768px and stands it
6
+ * at the inline start, off screen until the Shell says `data-phi-sider-drawer-open`; this component only
7
+ * says so. The Region keeps rendering where it always renders -- statically or through its own client --
8
+ * so nothing it holds is mounted twice.
9
+ *
10
+ * **The Shell is a container**, and a container is the containing block of what is `position: fixed`
11
+ * inside it: the drawer's top is the Shell's, not the viewport's. So the page stops scrolling while the
12
+ * drawer is open, and the drawer is moved to where the viewport's top is on the Shell at that moment.
13
+ *
14
+ * The button goes into `header_main`, at its inline start; a Shell without one gets it at its own top.
15
+ * Opening needs JavaScript: without it the Sider stays off screen on a phone.
16
+ */
17
+ export declare function PhiShellSiderDrawer(): import("react").JSX.Element;
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useEffect, useLayoutEffect, useState } from "react";
4
+ import { createPortal } from "react-dom";
5
+ import { usePhiPathname } from "../runtime/use-phi-pathname";
6
+ import { PhiButtonControl } from "../controls/phi-button-control";
7
+ import { PhiIcon } from "./phi-icon";
8
+ /** Where the drawer's top stands within the Shell, published on the Shell element (`styles/shell.css`). */
9
+ const PHI_SHELL_SIDER_DRAWER_TOP_PROPERTY = "--phi-shell-sider-drawer-top";
10
+ /**
11
+ * A `sider_left` with `MobileDrawer`, on a phone: the menu button that opens it, the mask behind it, and
12
+ * the rules that close it again (SHELL.md "The Sider on a phone").
13
+ *
14
+ * The Sider itself does not move. `styles/shell.css` takes it out of its column below 768px and stands it
15
+ * at the inline start, off screen until the Shell says `data-phi-sider-drawer-open`; this component only
16
+ * says so. The Region keeps rendering where it always renders -- statically or through its own client --
17
+ * so nothing it holds is mounted twice.
18
+ *
19
+ * **The Shell is a container**, and a container is the containing block of what is `position: fixed`
20
+ * inside it: the drawer's top is the Shell's, not the viewport's. So the page stops scrolling while the
21
+ * drawer is open, and the drawer is moved to where the viewport's top is on the Shell at that moment.
22
+ *
23
+ * The button goes into `header_main`, at its inline start; a Shell without one gets it at its own top.
24
+ * Opening needs JavaScript: without it the Sider stays off screen on a phone.
25
+ */
26
+ export function PhiShellSiderDrawer() {
27
+ const pathname = usePhiPathname();
28
+ const [shell, setShell] = useState(null);
29
+ /*
30
+ * The Page the drawer was opened on. Following a link to another Page closes it without an effect
31
+ * having to notice the navigation: on the new path it is simply not open.
32
+ */
33
+ const [openedOn, setOpenedOn] = useState(null);
34
+ const open = openedOn != null && openedOn === pathname;
35
+ const close = useCallback(() => setOpenedOn(null), []);
36
+ const anchorRef = useCallback((node) => {
37
+ setShell(node?.closest("[data-phi-shell-layout]") ?? null);
38
+ }, []);
39
+ const sider = shell?.querySelector('[data-phi-sider-mobile="drawer"]') ?? null;
40
+ const header = shell?.querySelector('[data-phi-region-key="header_main"]') ?? null;
41
+ useLayoutEffect(() => {
42
+ if (!shell)
43
+ return;
44
+ if (!open) {
45
+ shell.removeAttribute("data-phi-sider-drawer-open");
46
+ return;
47
+ }
48
+ const root = document.documentElement;
49
+ const previousOverflow = root.style.overflow;
50
+ root.style.overflow = "hidden";
51
+ shell.style.setProperty(PHI_SHELL_SIDER_DRAWER_TOP_PROPERTY, `${-shell.getBoundingClientRect().top}px`);
52
+ shell.setAttribute("data-phi-sider-drawer-open", "true");
53
+ return () => {
54
+ root.style.overflow = previousOverflow;
55
+ shell.removeAttribute("data-phi-sider-drawer-open");
56
+ shell.style.removeProperty(PHI_SHELL_SIDER_DRAWER_TOP_PROPERTY);
57
+ };
58
+ }, [open, shell]);
59
+ useEffect(() => {
60
+ if (!open || !sider)
61
+ return;
62
+ const onKeyDown = (event) => {
63
+ if (event.key === "Escape")
64
+ close();
65
+ };
66
+ // A link chosen in the drawer is where the reader is going; one to the Page they are on goes nowhere.
67
+ const onClick = (event) => {
68
+ if (event.target instanceof Element && event.target.closest("a[href]"))
69
+ close();
70
+ };
71
+ const previousTabIndex = sider.getAttribute("tabindex");
72
+ if (previousTabIndex == null)
73
+ sider.setAttribute("tabindex", "-1");
74
+ sider.focus({ preventScroll: true });
75
+ document.addEventListener("keydown", onKeyDown);
76
+ sider.addEventListener("click", onClick);
77
+ return () => {
78
+ document.removeEventListener("keydown", onKeyDown);
79
+ sider.removeEventListener("click", onClick);
80
+ if (previousTabIndex == null)
81
+ sider.removeAttribute("tabindex");
82
+ };
83
+ }, [close, open, sider]);
84
+ const button = (_jsx("span", { className: header ? "phi-shell-sider-drawer-button" : "phi-shell-sider-drawer-button phi-shell-sider-drawer-button--shell", children: _jsx(PhiButtonControl, { type: "text", ariaLabel: open ? "Close menu" : "Open menu", ariaExpanded: open, icon: _jsx(PhiIcon, { name: open ? "close" : "menu", size: "inherit" }), onClick: () => setOpenedOn(open ? null : pathname) }) }));
85
+ return (_jsxs(_Fragment, { children: [_jsx("span", { hidden: true, ref: anchorRef }), shell ? createPortal(button, header ?? shell) : null, shell && open
86
+ ? createPortal(_jsx("div", { "aria-hidden": true, className: "phi-shell-sider-drawer-mask", onClick: close }), shell)
87
+ : null] }));
88
+ }
@@ -0,0 +1,5 @@
1
+ import { type RefObject } from "react";
2
+ export declare function usePhiShellHeaderBands({ active, elementRef, }: {
3
+ active: boolean;
4
+ elementRef: RefObject<HTMLElement | null>;
5
+ }): void;
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { useEffect } from "react";
3
+ /**
4
+ * The room each Header band holds, published on the Shell for a Page with a Hero.
5
+ *
6
+ * A Hero starts at the top of the window, behind the Header bands (`styles/shell.css`, "Hero at the
7
+ * top"): the Header rows hold no room there, so each band is set down by the bands above it, and the
8
+ * Hero's content and the Header's glass pane take the bands' sum. The grid itself does not depend on any
9
+ * of it -- a late value moves a band or the Hero's words for a frame, never the page below.
10
+ *
11
+ * The Shell is handed the configured heights by the server (`phi-cms-root-layout.tsx`); this measures
12
+ * what the bands actually hold, `header_bottom` included, which the Area never sees. A band's room is
13
+ * its height less what it gives back below itself -- a `header_top` that reveals on hover takes none.
14
+ */
15
+ const PHI_SHELL_HEADER_BANDS = [
16
+ ["header_top", "--phi-shell-band-top"],
17
+ ["header_main", "--phi-shell-band-main"],
18
+ ["header_bottom", "--phi-shell-band-bottom"],
19
+ ];
20
+ function readBandRoom(shell, regionKey) {
21
+ const band = shell.querySelector(`:scope > [data-phi-region-key="${regionKey}"]:not([hidden])`);
22
+ if (!band) {
23
+ return 0;
24
+ }
25
+ const givenBack = Number.parseFloat(getComputedStyle(band).marginBlockEnd) || 0;
26
+ return Math.max(0, Math.round(band.offsetHeight + givenBack));
27
+ }
28
+ export function usePhiShellHeaderBands({ active, elementRef, }) {
29
+ useEffect(() => {
30
+ const element = elementRef.current;
31
+ const shell = active && element ? element.closest("[data-phi-shell-layout]") : null;
32
+ if (!element || !shell) {
33
+ return undefined;
34
+ }
35
+ let frame = 0;
36
+ const publish = () => {
37
+ frame = 0;
38
+ for (const [regionKey, property] of PHI_SHELL_HEADER_BANDS) {
39
+ const next = `${readBandRoom(shell, regionKey)}px`;
40
+ if (shell.style.getPropertyValue(property) !== next) {
41
+ shell.style.setProperty(property, next);
42
+ }
43
+ }
44
+ };
45
+ const schedule = () => {
46
+ if (frame === 0) {
47
+ frame = window.requestAnimationFrame(publish);
48
+ }
49
+ };
50
+ publish();
51
+ window.addEventListener("resize", schedule);
52
+ const observer = new ResizeObserver(schedule);
53
+ for (const band of shell.querySelectorAll(':scope > [data-phi-region-key^="header_"]')) {
54
+ observer.observe(band);
55
+ }
56
+ return () => {
57
+ if (frame !== 0) {
58
+ window.cancelAnimationFrame(frame);
59
+ }
60
+ window.removeEventListener("resize", schedule);
61
+ observer.disconnect();
62
+ };
63
+ }, [active, elementRef]);
64
+ }
@@ -0,0 +1,18 @@
1
+ import { type RefObject } from "react";
2
+ /**
3
+ * How much of the viewport's bottom a stuck `footer_bottom` holds right now, published on the Shell.
4
+ *
5
+ * The counterpart of `usePhiShellStickyTop`. A Sider stuck under the Header is as tall as what is left of
6
+ * the viewport, and with a Footer stuck to the bottom edge what is left ends at the Footer's top -- a
7
+ * Sider that did not know would run behind it, its last entries out of reach. The Footer's height is not
8
+ * a constant (its content wraps on a narrow screen, and at the page's end it stands in the flow higher
9
+ * up), so the edge is measured: the part of the viewport below the band's top, written as
10
+ * `--phi-shell-sticky-bottom` on the Shell element. Unset, a reader falls back to `0px`.
11
+ *
12
+ * Run by the Footer band itself (`phiCmsRegionFooterSticks`), so a Shell without a sticky Footer loads
13
+ * nothing for it, and it takes the property away again when the band stops sticking.
14
+ */
15
+ export declare function usePhiShellStickyBottom({ active, elementRef, }: {
16
+ active: boolean;
17
+ elementRef: RefObject<HTMLElement | null>;
18
+ }): void;