@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,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PHI_COLOR, PHI_FONT_SIZE, PHI_SPACE } from "../../theme/antd-css-var-contract";
3
+ import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
3
4
  import { PhiTruncatedHoverText } from "./phi-truncated-hover-text";
4
5
  /**
5
6
  * A band of words at the end edge of a box: "Popular", "New", "-20 %".
@@ -18,7 +19,8 @@ import { PhiTruncatedHoverText } from "./phi-truncated-hover-text";
18
19
  * clicks, so a card that is a link stays one under its band; with one it has to take the pointer to be
19
20
  * pointed at, and hands a click on through `onClick`.
20
21
  */
21
- export function PhiRibbonControl({ children, color, placement = "edge", style, fullText, onClick }) {
22
+ export function PhiRibbonControl({ children, color, gradient, placement = "edge", style, fullText, onClick }) {
23
+ const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
22
24
  const radius = "var(--phi-control-radius-sm)";
23
25
  const position = placement === "corner"
24
26
  ? {
@@ -40,8 +42,8 @@ export function PhiRibbonControl({ children, color, placement = "edge", style, f
40
42
  maxWidth: "70%",
41
43
  boxSizing: "border-box",
42
44
  paddingInline: PHI_SPACE.sm,
43
- background: color ?? PHI_COLOR.primary,
44
- color: PHI_COLOR.textLightSolid,
45
+ background: gradientVars ? `var(${gradientVars.paint})` : color ?? PHI_COLOR.primary,
46
+ color: gradientVars ? `var(${gradientVars.text})` : PHI_COLOR.textLightSolid,
45
47
  fontSize: PHI_FONT_SIZE.sm,
46
48
  fontWeight: 600,
47
49
  lineHeight: 2,
@@ -1,4 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
+ import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
2
3
  export type PhiRibbonWrapControlProps = {
3
4
  /** The box the ribbon hangs on. */
4
5
  children: ReactNode;
@@ -6,6 +7,11 @@ export type PhiRibbonWrapControlProps = {
6
7
  text: ReactNode;
7
8
  /** The ribbon's ground; absent, the Theme's primary. The fold under it is a darker shade of it. */
8
9
  color?: string;
10
+ /**
11
+ * A Theme gradient slot to fill the ribbon with. The fold under it keeps one colour -- `color`, else the
12
+ * Theme's primary -- because Ant Design draws it as a border, which takes a colour and no run.
13
+ */
14
+ gradient?: PhiThemeGradientKey;
9
15
  /** Takes the pointer, for an editor that writes in the ribbon; otherwise clicks pass to the box. */
10
16
  interactive?: boolean;
11
17
  className?: string;
@@ -23,4 +29,4 @@ export type PhiRibbonWrapControlProps = {
23
29
  * Imported from its own module, not from `antd`'s Badge: the Badge brings its scroll-number motion along,
24
30
  * which a ribbon never uses.
25
31
  */
26
- export declare function PhiRibbonWrapControl({ children, text, color, interactive, className }: PhiRibbonWrapControlProps): import("react").JSX.Element;
32
+ export declare function PhiRibbonWrapControl({ children, text, color, gradient, interactive, className }: PhiRibbonWrapControlProps): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import Ribbon from "antd/es/badge/Ribbon";
4
+ import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
4
5
  /**
5
6
  * A ribbon that hangs over a box's end edge, with a fold behind it: Ant Design's `Badge.Ribbon`.
6
7
  *
@@ -14,8 +15,13 @@ import Ribbon from "antd/es/badge/Ribbon";
14
15
  * Imported from its own module, not from `antd`'s Badge: the Badge brings its scroll-number motion along,
15
16
  * which a ribbon never uses.
16
17
  */
17
- export function PhiRibbonWrapControl({ children, text, color, interactive = false, className }) {
18
- const indicator = interactive ? { zIndex: 4 } : { zIndex: 4, pointerEvents: "none" };
18
+ export function PhiRibbonWrapControl({ children, text, color, gradient, interactive = false, className }) {
19
+ const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
20
+ const indicator = {
21
+ zIndex: 4,
22
+ ...(interactive ? {} : { pointerEvents: "none" }),
23
+ ...(gradientVars ? { background: `var(${gradientVars.paint})`, color: `var(${gradientVars.text})` } : {}),
24
+ };
19
25
  /*
20
26
  * An editor's field in the ribbon measures itself against the ribbon, which is as wide as its words:
21
27
  * empty, both were nothing, and only the fold showed. Room for a word, as the inner band keeps it.
@@ -1,4 +1,5 @@
1
1
  import type { PhiControlSize } from "../../types/control";
2
+ import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
2
3
  import type { PhiControlOption } from "./phi-control-options";
3
4
  export type PhiSegmentedControlProps<TValue extends string | number = string> = {
4
5
  /**
@@ -12,8 +13,10 @@ export type PhiSegmentedControlProps<TValue extends string | number = string> =
12
13
  readOnly?: boolean;
13
14
  block?: boolean;
14
15
  size?: PhiControlSize;
16
+ /** A Theme gradient slot the selected segment is filled with; its words take the slot's text colour. */
17
+ gradient?: PhiThemeGradientKey;
15
18
  onFocus?: () => void;
16
19
  onBlur?: () => void;
17
20
  onChange?: (value: TValue) => void;
18
21
  };
19
- export declare function PhiSegmentedControl<TValue extends string | number = string>({ value, label, options, disabled, readOnly, block, size, onFocus, onBlur, onChange, }: PhiSegmentedControlProps<TValue>): import("react").JSX.Element;
22
+ export declare function PhiSegmentedControl<TValue extends string | number = string>({ value, label, options, disabled, readOnly, block, size, gradient, onFocus, onBlur, onChange, }: PhiSegmentedControlProps<TValue>): import("react").JSX.Element;
@@ -1,9 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Segmented } from "antd";
4
+ import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
4
5
  import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
5
- export function PhiSegmentedControl({ value, label, options, disabled, readOnly, block, size, onFocus, onBlur, onChange, }) {
6
+ export function PhiSegmentedControl({ value, label, options, disabled, readOnly, block, size, gradient, onFocus, onBlur, onChange, }) {
6
7
  const { labelId, labelledBy } = usePhiControlLabel(label);
8
+ const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
7
9
  const control = (_jsx(Segmented, { "aria-labelledby": labelledBy, block: block, value: value, disabled: disabled || readOnly || !onChange, options: options.map((option) => ({
8
10
  value: option.value,
9
11
  label: option.label,
@@ -15,6 +17,15 @@ export function PhiSegmentedControl({ value, label, options, disabled, readOnly,
15
17
  */
16
18
  title: "",
17
19
  tooltip: option.description || undefined,
18
- })), size: size, onChange: (nextValue) => onChange?.(nextValue), onFocus: onFocus, onBlur: onBlur, style: { minWidth: 0, width: block ? "100%" : undefined } }));
20
+ })), size: size, onChange: (nextValue) => onChange?.(nextValue), onFocus: onFocus, onBlur: onBlur, className: gradientVars ? "phi-segmented-gradient" : undefined, style: {
21
+ minWidth: 0,
22
+ width: block ? "100%" : undefined,
23
+ ...(gradientVars
24
+ ? {
25
+ "--phi-control-gradient": `var(${gradientVars.paint})`,
26
+ "--phi-control-gradient-text": `var(${gradientVars.text})`,
27
+ }
28
+ : {}),
29
+ } }));
19
30
  return _jsx(PhiLabeledControl, { label: label, labelId: labelId, fill: block, children: control });
20
31
  }
@@ -15,6 +15,8 @@ export type PhiSurfaceControlLabels = {
15
15
  shadow: string;
16
16
  tone: string;
17
17
  tones: Record<PhiSurfaceTone, string>;
18
+ /** The switch for a ground of its own in dark mode; the two grounds are then named by `tones`. */
19
+ backgroundPerMode?: string;
18
20
  };
19
21
  export type PhiSurfaceControlProps = {
20
22
  value?: PhiSurface | null;
@@ -5,6 +5,7 @@ import { PhiBackgroundControl } from "./phi-background-control";
5
5
  import { PhiBorderControl } from "./phi-border-control";
6
6
  import { PhiFlexControl } from "./phi-flex-control";
7
7
  import { PhiSegmentedControl } from "./phi-segmented-control";
8
+ import { PhiSwitchControl } from "./phi-switch-control";
8
9
  import { PhiShadowControl } from "./phi-shadow-control";
9
10
  import { PhiDividerControl } from "./phi-divider-control";
10
11
  import { PHI_CMS_BORDER_SOURCES, resolvePhiCmsBorderSource, } from "../../types/cms-border-source";
@@ -23,6 +24,7 @@ const PHI_SURFACE_CONTROL_DEFAULT_LABELS = {
23
24
  dark: "Dark",
24
25
  inverse: "Inverse",
25
26
  },
27
+ backgroundPerMode: "Own background in dark mode",
26
28
  };
27
29
  /** Read only where the Border labels have not arrived; the words themselves live in their label set. */
28
30
  const PHI_BORDER_SOURCE_FALLBACK_LABELS = {
@@ -71,6 +73,10 @@ export function PhiSurfaceControl({ value, onChange, disabled = false, labels =
71
73
  * next selected node) drops it, one this Control wrote keeps it.
72
74
  */
73
75
  const [customChosen, setCustomChosen] = useState(false);
76
+ /* Which of the two grounds is open, where the Surface has one per mode. */
77
+ const [backgroundMode, setBackgroundMode] = useState("light");
78
+ const perMode = current.backgroundDark != null;
79
+ const editedMode = perMode ? backgroundMode : "light";
74
80
  const [seenValue, setSeenValue] = useState(value);
75
81
  const [writtenValue, setWrittenValue] = useState(undefined);
76
82
  if (seenValue !== value) {
@@ -102,7 +108,16 @@ export function PhiSurfaceControl({ value, onChange, disabled = false, labels =
102
108
  { value: "none", label: labels.styles.none },
103
109
  ...PHI_SURFACE_PRESET_IDS.map((id) => ({ value: id, label: labels.styles[id] })),
104
110
  { value: "custom", label: labels.styles.custom },
105
- ], block: true, disabled: isDisabled, onChange: chooseStyle })] }), tone ? (_jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.tone }), _jsx(PhiSegmentedControl, { value: current.tone ?? "inherit", options: PHI_SURFACE_TONES.map((entry) => ({ value: entry, label: labels.tones[entry] })), block: true, disabled: isDisabled, onChange: (next) => patch({ tone: next === "inherit" ? undefined : next }) })] })) : null, style === "custom" ? (_jsxs(_Fragment, { children: [_jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.background }), _jsx(PhiBackgroundControl, { mode: "control", disabled: isDisabled, value: current.background ?? null, onChange: (background) => patch({ background }), labels: backgroundLabels, colorPickerLabels: colorPickerLabels, colorPickerPlacement: colorPickerPlacement, filters: backgroundFilters, renderMediaPicker: renderMediaPicker })] }), _jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.border }), _jsx(PhiSegmentedControl, { value: borderSource, options: PHI_CMS_BORDER_SOURCES.map((source) => ({
111
+ ], block: true, disabled: isDisabled, onChange: chooseStyle })] }), tone ? (_jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.tone }), _jsx(PhiSegmentedControl, { value: current.tone ?? "inherit", options: PHI_SURFACE_TONES.map((entry) => ({ value: entry, label: labels.tones[entry] })), block: true, disabled: isDisabled, onChange: (next) => patch({ tone: next === "inherit" ? undefined : next }) })] })) : null, style === "custom" ? (_jsxs(_Fragment, { children: [_jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.background }), _jsx(PhiSwitchControl, { label: labels.backgroundPerMode ?? PHI_SURFACE_CONTROL_DEFAULT_LABELS.backgroundPerMode, checked: perMode, disabled: isDisabled, onChange: (checked) => {
112
+ // Switched on, the dark ground starts as a copy of the light one, to be changed from there.
113
+ setBackgroundMode(checked ? "dark" : "light");
114
+ patch({ backgroundDark: checked ? (current.background ?? { base: { kind: "none" } }) : undefined });
115
+ } }), perMode ? (_jsx(PhiSegmentedControl, { value: editedMode, options: [
116
+ { value: "light", label: labels.tones.light },
117
+ { value: "dark", label: labels.tones.dark },
118
+ ], block: true, disabled: isDisabled, onChange: setBackgroundMode })) : null, _jsx(PhiBackgroundControl, { mode: "control", disabled: isDisabled, value: (editedMode === "dark" ? current.backgroundDark : current.background) ?? null, onChange: (next) => patch(editedMode === "dark"
119
+ ? { backgroundDark: next ?? { base: { kind: "none" } } }
120
+ : { background: next }), labels: backgroundLabels, colorPickerLabels: colorPickerLabels, colorPickerPlacement: colorPickerPlacement, filters: backgroundFilters, renderMediaPicker: renderMediaPicker }, editedMode)] }), _jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.border }), _jsx(PhiSegmentedControl, { value: borderSource, options: PHI_CMS_BORDER_SOURCES.map((source) => ({
106
121
  value: source,
107
122
  label: borderLabels?.sources?.[source] ?? PHI_BORDER_SOURCE_FALLBACK_LABELS[source],
108
123
  })), block: true, disabled: isDisabled, onChange: (nextSource) => patch({ borderSource: nextSource }) }), borderSource === "custom" ? (_jsx(PhiBorderControl, { mode: "control", disabled: isDisabled, value: current.border ?? null, onChange: (border) => patch({ border, borderSource: "custom" }), labels: borderLabels, colorPickerLabels: colorPickerLabels, colorPickerPlacement: colorPickerPlacement })) : null] }), _jsxs(PhiFlexControl, { vertical: true, gap: "small", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: labels.shadow }), _jsx(PhiShadowControl, { mode: "control", disabled: isDisabled, value: current.shadow ?? null, onChange: (shadow) => patch({ shadow }) })] })] })) : null] }));
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import type { PhiControlSize } from "../../types/control";
3
+ import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
3
4
  export type PhiSwitchControlProps = {
4
5
  /** The DOM id of the input, so a `<label for>` outside the control can name it. */
5
6
  id?: string;
@@ -13,6 +14,8 @@ export type PhiSwitchControlProps = {
13
14
  /** What the switch reads while off. */
14
15
  uncheckedLabel?: ReactNode;
15
16
  size?: Exclude<PhiControlSize, "large">;
17
+ /** A Theme gradient slot the switch is filled with while on, instead of the primary colour. */
18
+ gradient?: PhiThemeGradientKey;
16
19
  onChange?: (checked: boolean) => void;
17
20
  };
18
- export declare function PhiSwitchControl({ id, checked, label, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, onChange, }: PhiSwitchControlProps): import("react").JSX.Element;
21
+ export declare function PhiSwitchControl({ id, checked, label, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, gradient, onChange, }: PhiSwitchControlProps): import("react").JSX.Element;
@@ -1,8 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Switch } from "antd";
4
+ import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
4
5
  import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
5
- export function PhiSwitchControl({ id, checked, label, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, onChange, }) {
6
+ export function PhiSwitchControl({ id, checked, label, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, gradient, onChange, }) {
6
7
  const { labelId, labelledBy } = usePhiControlLabel(label);
7
- return (_jsx(PhiLabeledControl, { label: label, labelId: labelId, children: _jsx(Switch, { id: id, "aria-labelledby": labelledBy, checked: checked, disabled: disabled || readOnly || !onChange, loading: loading, checkedChildren: checkedLabel, unCheckedChildren: uncheckedLabel, size: size, onChange: onChange }) }));
8
+ return (_jsx(PhiLabeledControl, { label: label, labelId: labelId, children: _jsx(Switch, { id: id, "aria-labelledby": labelledBy, checked: checked, disabled: disabled || readOnly || !onChange, loading: loading, checkedChildren: checkedLabel, unCheckedChildren: uncheckedLabel, size: size, onChange: onChange, ...(gradient
9
+ ? {
10
+ className: "phi-switch-gradient",
11
+ style: { "--phi-control-gradient": `var(${PHI_THEME_GRADIENT_CSS_VARS[gradient].paint})` },
12
+ }
13
+ : {}) }) }));
8
14
  }
@@ -1,7 +1,10 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
+ import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
2
3
  export type PhiTagControlProps = {
3
4
  children: ReactNode;
4
5
  color?: string;
6
+ /** A Theme gradient slot to fill the tag with; it then draws solid, in the slot's text colour. */
7
+ gradient?: PhiThemeGradientKey;
5
8
  variant?: "filled" | "outlined" | "solid";
6
9
  /**
7
10
  * Offers the remove affordance Ant Design draws inside the capsule.
@@ -23,4 +26,4 @@ export type PhiTagControlProps = {
23
26
  onClose?: () => void;
24
27
  style?: CSSProperties;
25
28
  };
26
- export declare function PhiTagControl({ children, color, variant, closable, onClose, style, }: PhiTagControlProps): import("react").JSX.Element;
29
+ export declare function PhiTagControl({ children, color, gradient, variant, closable, onClose, style, }: PhiTagControlProps): import("react").JSX.Element;
@@ -1,9 +1,17 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { Tag } from "antd";
4
- export function PhiTagControl({ children, color, variant = "outlined", closable, onClose, style, }) {
5
- return (_jsx(Tag, { color: color, variant: variant, closeIcon: closable || undefined, onClose: onClose ? (event) => {
4
+ import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
5
+ export function PhiTagControl({ children, color, gradient, variant = "outlined", closable, onClose, style, }) {
6
+ const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
7
+ return (_jsx(Tag, { color: gradientVars ? undefined : color, variant: gradientVars ? "solid" : variant, closeIcon: closable || undefined, onClose: onClose ? (event) => {
6
8
  event.preventDefault();
7
9
  onClose();
8
- } : undefined, style: { marginInlineEnd: 0, ...style }, children: children }));
10
+ } : undefined, style: {
11
+ marginInlineEnd: 0,
12
+ ...(gradientVars
13
+ ? { background: `var(${gradientVars.paint})`, color: `var(${gradientVars.text})`, borderColor: "transparent" }
14
+ : {}),
15
+ ...style,
16
+ }, children: children }));
9
17
  }
@@ -57,17 +57,25 @@ export function PhiSplitCardLayout({ blockId, slots, gap, swapRatio = false, edi
57
57
  swapped: swapRatio,
58
58
  inset: resolvePhiPaddingStyle({ padding, paddingTop, paddingRight, paddingBottom, paddingLeft }),
59
59
  };
60
+ /*
61
+ * The box is the query container -- for the shared Background's `cqw` and for the stacking rule in
62
+ * `styles/layout.css` -- and the grid is the element inside it: a container cannot ask about its own
63
+ * width. Below the rule's width the two cards stand one above the other, the first on top.
64
+ */
60
65
  const resolvedStyle = {
61
66
  position: "relative",
62
67
  containerType: "inline-size",
68
+ containerName: "phi-split-card",
63
69
  ...resolvedLayoutStyle,
64
- display: "grid",
65
- gridTemplateColumns: resolvePhiSplitCardColumns(swapRatio),
66
- gap: resolvedGap,
67
- alignItems: "stretch",
70
+ // Not the grid `[data-layout-kind="split"]` makes every split box: the grid is the element inside.
71
+ display: "block",
68
72
  minWidth: 0,
69
73
  minHeight: 0,
70
74
  ...style,
71
75
  };
72
- return (_jsxs(PhiLayoutSurfaceBox, { blockId: blockId, surface: undefined, ground: null, "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: "phi-layout", style: resolvedStyle, children: [renderSplitCardSlot(isAuthoringRender, "slot-1", slots[0] ?? null, "left", 0, editSlotAnchor, editSlotAction, editRenderInsertControl, "Slot 1", card), renderSplitCardSlot(isAuthoringRender, "slot-2", slots[1] ?? null, "right", 1, editSlotAnchor, editSlotAction, editRenderInsertControl, "Slot 2", card)] }));
76
+ const gridStyle = {
77
+ "--phi-split-card-columns": resolvePhiSplitCardColumns(swapRatio),
78
+ gap: resolvedGap,
79
+ };
80
+ return (_jsx(PhiLayoutSurfaceBox, { blockId: blockId, surface: undefined, ground: null, "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: "phi-layout", style: resolvedStyle, children: _jsxs("div", { className: "phi-split-card__grid", style: gridStyle, children: [renderSplitCardSlot(isAuthoringRender, "slot-1", slots[0] ?? null, "left", 0, editSlotAnchor, editSlotAction, editRenderInsertControl, "Slot 1", card), renderSplitCardSlot(isAuthoringRender, "slot-2", slots[1] ?? null, "right", 1, editSlotAnchor, editSlotAction, editRenderInsertControl, "Slot 2", card)] }) }));
73
81
  }
@@ -84,7 +84,13 @@ export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap
84
84
  const resolvedLeftWidth = normalizePhiCssSize(leftWidth);
85
85
  const resolvedMiddleWidth = normalizePhiCssSize(middleWidth);
86
86
  const resolvedRightWidth = normalizePhiCssSize(rightWidth);
87
- const leftFlex = resolvedLeftWidth ? `0 0 ${resolvedLeftWidth}` : balancedSides ? "1 1 0" : "0 1 auto";
87
+ /*
88
+ * Balanced sides are a wide screen's: on a phone (`styles/layout.css`) the variables below make every
89
+ * side as wide as its content and nothing when empty, and the middle takes the rest. A centred middle
90
+ * was worth two equal sides of a 390px row; a link of 83px in a side of 81 was not.
91
+ */
92
+ const balancedSideFlex = "var(--phi-three-column-side-flex, 1 1 0)";
93
+ const leftFlex = resolvedLeftWidth ? `0 0 ${resolvedLeftWidth}` : balancedSides ? balancedSideFlex : "0 1 auto";
88
94
  /*
89
95
  * The middle is the main thing and takes the larger share: with balanced sides it grows twice as fast as
90
96
  * each side, so the sides stay equal to each other and the middle stays centred; without, it takes what
@@ -92,8 +98,8 @@ export function PhiThreeColumnLayout({ blockId, slots, balancedSides = true, gap
92
98
  */
93
99
  const middleFlex = resolvedMiddleWidth
94
100
  ? `0 0 ${resolvedMiddleWidth}`
95
- : `${PHI_THREE_COLUMN_MIDDLE_GROW} 1 0`;
96
- const rightFlex = resolvedRightWidth ? `0 0 ${resolvedRightWidth}` : balancedSides ? "1 1 0" : "0 1 auto";
101
+ : `var(--phi-three-column-middle-flex, ${PHI_THREE_COLUMN_MIDDLE_GROW} 1 0)`;
102
+ const rightFlex = resolvedRightWidth ? `0 0 ${resolvedRightWidth}` : balancedSides ? balancedSideFlex : "0 1 auto";
97
103
  const showInsertButton = resolvedRenderMode === "editor";
98
104
  const { style: resolvedLayoutStyle, ground, hasExplicitLayoutBackground, } = resolvePhiBaseLayoutChrome({
99
105
  labelEnd,
@@ -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
@@ -19,9 +19,13 @@ const PHI_SPLIT_CARD_SHARES = "2.61803398875";
19
19
  export function resolvePhiSplitCardGroundFrame(side, gap, swapped = false) {
20
20
  const leftShare = swapped ? ` * ${PHI_SPLIT_CARD_RATIO}` : "";
21
21
  const leftWidth = `((100cqw - ${gap})${leftShare} / ${PHI_SPLIT_CARD_SHARES})`;
22
+ /*
23
+ * Stacked (`styles/layout.css`), each card shows the whole Background on its own: the cards no longer
24
+ * share a row, and the height the lower card's piece would start at is not something CSS knows.
25
+ */
22
26
  return {
23
- left: side === "left" ? "0px" : `calc(-1 * (${leftWidth} + ${gap}))`,
24
- width: "100cqw",
27
+ left: `var(--phi-split-card-ground-left, ${side === "left" ? "0px" : `calc(-1 * (${leftWidth} + ${gap}))`})`,
28
+ width: "var(--phi-split-card-ground-width, 100cqw)",
25
29
  };
26
30
  }
27
31
  /** The two columns: the smaller card left and the larger right, or the other way round when swapped. */
@@ -7,8 +7,8 @@
7
7
  export declare const PHI_MEDIA_ASPECT_RATIOS: readonly ["16:9", "3:2", "4:3", "1:1", "3:4", "2:3", "9:16", "21:9"];
8
8
  export type PhiMediaAspectRatio = (typeof PHI_MEDIA_ASPECT_RATIOS)[number];
9
9
  export declare const PHI_MEDIA_ASPECT_RATIO_OPTIONS: {
10
- value: "16:9" | "3:2" | "4:3" | "1:1" | "3:4" | "2:3" | "9:16" | "21:9";
11
- label: "16:9" | "3:2" | "4:3" | "1:1" | "3:4" | "2:3" | "9:16" | "21:9";
10
+ value: "3:2" | "4:3" | "16:9" | "1:1" | "3:4" | "2:3" | "9:16" | "21:9";
11
+ label: "3:2" | "4:3" | "16:9" | "1:1" | "3:4" | "2:3" | "9:16" | "21:9";
12
12
  }[];
13
13
  /** The ratio as CSS `aspect-ratio` writes it. */
14
14
  export declare function resolvePhiMediaAspectRatioCss(ratio: PhiMediaAspectRatio): string;
@@ -145,5 +145,7 @@ export function PhiAccountMenu({ labels, state, contributedItems, areaEntries, o
145
145
  // A signed-in person has a name; a guest has none, and falls through to the generic icon.
146
146
  initialsFrom: state.kind === "authenticated" ? state.displayName ?? null : null, icon: icon, label: state.kind === "authenticated"
147
147
  ? (state.displayName ?? labels.trigger.account)
148
- : labels.trigger.account, menuItems: menuItems, triggerRef: triggerRef, open: open, onOpenChange: onOpenChange, showLabel: resolvedShowLabel, showChevron: resolvedShowChevron, labelPill: resolvedShowLabel }));
148
+ : labels.trigger.account, menuItems: menuItems, triggerRef: triggerRef, open: open, onOpenChange: onOpenChange, showLabel: resolvedShowLabel, showChevron: resolvedShowChevron, labelPill: resolvedShowLabel,
149
+ // On a phone the label pill is read, not shown: the avatar alone opens the menu (`styles/shell.css`).
150
+ className: "phi-account-menu" }));
149
151
  }
@@ -3,12 +3,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useMemo, useState } from "react";
4
4
  import Link from "next/link";
5
5
  import { isPhiExternalHref } from "../../helpers/external-href";
6
+ import { isPhiProtectedMail } from "../../helpers/protected-mail";
6
7
  import { usePhiConfig } from "../root/phi-config-provider";
8
+ import { usePhiRevealedHref } from "./use-phi-protected-mail";
7
9
  export function PhiLink({ href, children, external, newTab, prefetch, className, style, onClick, }) {
8
10
  const { token } = usePhiConfig();
9
11
  const [hovered, setHovered] = useState(false);
10
12
  const [active, setActive] = useState(false);
11
- const useAnchor = external ?? isPhiExternalHref(href);
13
+ // A protected address is never a route, whatever the caller says it is.
14
+ const useAnchor = isPhiProtectedMail(href) || (external ?? isPhiExternalHref(href));
15
+ // A protected address (`helpers/protected-mail.ts`) is written into the anchor once mounted.
16
+ const anchorHref = usePhiRevealedHref(href);
12
17
  const linkStyle = useMemo(() => ({
13
18
  textDecoration: "none",
14
19
  cursor: "pointer",
@@ -31,7 +36,7 @@ export function PhiLink({ href, children, external, newTab, prefetch, className,
31
36
  onBlur: () => setActive(false),
32
37
  };
33
38
  if (useAnchor) {
34
- return (_jsx("a", { href: href, target: newTab ? "_blank" : undefined, rel: newTab ? "noreferrer noopener" : undefined, className: className, style: linkStyle, onClick: onClick, ...interactionProps, children: children }));
39
+ return (_jsx("a", { href: anchorHref, target: newTab ? "_blank" : undefined, rel: newTab ? "noreferrer noopener" : undefined, className: className, style: linkStyle, onClick: onClick, ...interactionProps, children: children }));
35
40
  }
36
41
  return (_jsx(Link, { href: href, ...(prefetch === undefined ? {} : { prefetch }), className: className, style: linkStyle, onClick: onClick, ...interactionProps, children: children }));
37
42
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The href a link may show: a protected address only once the page is hydrated, everything else at once.
3
+ *
4
+ * Before -- on the server, in the HTML, during hydration -- a protected href is absent, so the anchor in
5
+ * the source carries no address (`helpers/protected-mail.ts`).
6
+ */
7
+ export declare function usePhiRevealedHref(href: string): string | undefined;
8
+ /** An address in running text, written in once the page is hydrated; nothing before. */
9
+ export declare function PhiProtectedMailText({ token }: {
10
+ token: string;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useSyncExternalStore } from "react";
4
+ import { decodePhiProtectedMail, isPhiProtectedMail } from "../../helpers/protected-mail";
5
+ const subscribeNever = () => () => { };
6
+ /**
7
+ * Whether this render runs in a hydrated browser. False on the server and during hydration -- the HTML a
8
+ * crawler reads -- and true in the render that follows.
9
+ */
10
+ function usePhiHydrated() {
11
+ return useSyncExternalStore(subscribeNever, () => true, () => false);
12
+ }
13
+ /**
14
+ * The href a link may show: a protected address only once the page is hydrated, everything else at once.
15
+ *
16
+ * Before -- on the server, in the HTML, during hydration -- a protected href is absent, so the anchor in
17
+ * the source carries no address (`helpers/protected-mail.ts`).
18
+ */
19
+ export function usePhiRevealedHref(href) {
20
+ const hydrated = usePhiHydrated();
21
+ if (!isPhiProtectedMail(href))
22
+ return href;
23
+ return hydrated ? decodePhiProtectedMail(href) ?? undefined : undefined;
24
+ }
25
+ /** An address in running text, written in once the page is hydrated; nothing before. */
26
+ export function PhiProtectedMailText({ token }) {
27
+ const hydrated = usePhiHydrated();
28
+ return _jsx("span", { "data-phi-mail": "", children: hydrated ? decodePhiProtectedMail(token) ?? "" : "" });
29
+ }
@@ -17,8 +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 { phiCmsRegionSiderSticks, resolvePhiCmsRegionShell, } from "../phi-cms-region-shell";
20
+ import { phiCmsRegionFooterSticks, phiCmsRegionSiderSticks, resolvePhiCmsRegionShell, } from "../phi-cms-region-shell";
21
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";
22
24
  import { usePhiVisualAnchor } from "../../runtime/runtime-visual-anchors";
23
25
  import { usePhiPathname } from "../../runtime/use-phi-pathname";
24
26
  import { stripLocaleAndAreaFromPathname } from "../../../helpers/locale";
@@ -105,6 +107,14 @@ export function PhiCmsRegionContainerClient({ children, className, regionKey, co
105
107
  active: !previewMode && inScope && phiCmsRegionSiderSticks(regionKey, initialConfig),
106
108
  elementRef,
107
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
+ });
108
118
  /*
109
119
  * Off this Page, the Region leaves a hidden marker rather than nothing: `header_top` still has to tell
110
120
  * the Shell it holds no room, and it finds the Shell from here.
@@ -189,7 +199,11 @@ export function PhiCmsRegionContainerClient({ children, className, regionKey, co
189
199
  height: "100%",
190
200
  minWidth: 0,
191
201
  minHeight: 0,
192
- }, children: [collapsible ? (_jsx(PhiFlexControl, { align: "center", justify: collapsed ? "center" : isRightSider ? "flex-end" : "flex-start", style: {
202
+ }, children: [collapsible ? (_jsx(PhiFlexControl
203
+ // Hidden where the Sider is a phone's drawer (`styles/shell.css`): a drawer does not fold.
204
+ , {
205
+ // Hidden where the Sider is a phone's drawer (`styles/shell.css`): a drawer does not fold.
206
+ className: "phi-sider-collapse-bar", align: "center", justify: collapsed ? "center" : isRightSider ? "flex-end" : "flex-start", style: {
193
207
  minHeight: collapsedWidth,
194
208
  paddingTop: 0,
195
209
  paddingInline: collapsed ? 0 : token.paddingXS,
@@ -3,7 +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 { phiCmsRegionSiderSticks } from "./phi-cms-region-shell";
6
+ import { phiCmsRegionFooterSticks, phiCmsRegionSiderSticks } from "./phi-cms-region-shell";
7
7
  import { resolveRenderableBlockEffectsAttributes, resolveRenderableBlockViewportEffects, } from "../../helpers/renderable-block-effects";
8
8
  import { PhiRuntimeModuleRenderClientHost } from "../runtime/runtime-module-render-client-manifest";
9
9
  import { PhiRuntimeRenderClientType } from "../../constants/runtime-render-client-types";
@@ -24,6 +24,10 @@ export function PhiCmsRegionContainer({ children, className, regionKey, config,
24
24
  (!previewMode && readPhiCmsRegionReveal(regionKey, config) !== "always") ||
25
25
  // A stuck Sider stands under the Header as measured, and only the browser can measure it.
26
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") ||
27
31
  hasPhiFlag(config?.flags, PhiCmsFlags.Collapsible) ||
28
32
  requiresEffectsObserver ||
29
33
  resolvePhiBackgroundMotion(config?.surface?.background) != null;
@@ -44,6 +44,7 @@ export type PhiCmsRegionShellAttributes = PhiRenderableBlockEffectsAttributes &
44
44
  "data-phi-viewport-flags": number | undefined;
45
45
  "data-phi-block-enabled": "true" | "false";
46
46
  "data-phi-region-reveal": Exclude<PhiCmsRegionReveal, "always"> | undefined;
47
+ "data-phi-sider-mobile": "drawer" | undefined;
47
48
  className: string;
48
49
  };
49
50
  export type PhiCmsRegionShellInput = {
@@ -103,6 +104,16 @@ export type PhiCmsRegionShell = {
103
104
  * measurement for such a Sider, which is why this is asked before the Region renders.
104
105
  */
105
106
  export declare function phiCmsRegionSiderSticks(regionKey: PhiCmsRegionKey, config: Pick<PhiCmsRegionConfig, "flags"> | null | undefined): boolean;
107
+ /**
108
+ * Whether a Region is the Footer band that sticks to the viewport's bottom.
109
+ *
110
+ * Only `footer_bottom`, the counterpart of `header_top`: the lowest band is the one that can stand at the
111
+ * bottom edge while the page scrolls past it. A middle band that stuck would have the band below it either
112
+ * cover it or stick with it, and neither is a Footer anybody asked for; `footer_top` and `footer_main`
113
+ * scroll with the page and arrive above it at the end. It measures the room it holds
114
+ * (`usePhiShellStickyBottom`), so a Sider stuck under the Header ends above it.
115
+ */
116
+ export declare function phiCmsRegionFooterSticks(regionKey: PhiCmsRegionKey, config: Pick<PhiCmsRegionConfig, "flags"> | null | undefined): boolean;
106
117
  /**
107
118
  * The Region's shell, or null where the Region renders nothing: hidden, or collapsed in a preview.
108
119
  * `header_bottom` is exempt from the preview collapse because the Page, not the Area, owns its content.