@phis/ui 0.4.5 → 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 (78) hide show
  1. package/components/cms/phi-cms-root-layout.js +1 -1
  2. package/components/controls/phi-button-control.d.ts +3 -1
  3. package/components/controls/phi-button-control.js +2 -2
  4. package/components/controls/phi-collapse-control.d.ts +6 -2
  5. package/components/controls/phi-collapse-control.js +2 -2
  6. package/components/controls/phi-dialog-control.d.ts +11 -5
  7. package/components/controls/phi-dialog-control.js +19 -13
  8. package/components/controls/phi-menu-control-vocabulary.d.ts +7 -0
  9. package/components/controls/phi-menu-control-vocabulary.js +10 -0
  10. package/components/controls/phi-menu-control.d.ts +4 -1
  11. package/components/controls/phi-menu-control.js +6 -1
  12. package/components/layouts/clients/phi-split-card-layout-client.js +13 -5
  13. package/components/layouts/clients/phi-three-column-layout-client.js +9 -3
  14. package/components/layouts/split-card-geometry.js +6 -2
  15. package/components/media/aspect-ratios.d.ts +2 -2
  16. package/components/menus/phi-account-menu.js +3 -1
  17. package/components/navigation/phi-link.js +7 -2
  18. package/components/navigation/use-phi-protected-mail.d.ts +11 -0
  19. package/components/navigation/use-phi-protected-mail.js +29 -0
  20. package/components/regions/clients/cms-region-container-client.js +5 -1
  21. package/components/regions/phi-cms-region-shell.d.ts +1 -0
  22. package/components/regions/phi-cms-region-shell.js +11 -0
  23. package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -1
  24. package/components/root/phi-config-provider.js +16 -0
  25. package/components/shell/phi-cms-shell.d.ts +3 -1
  26. package/components/shell/phi-cms-shell.js +7 -3
  27. package/components/shell/phi-nav-link.js +7 -2
  28. package/components/shell/phi-shell-sider-drawer.d.ts +17 -0
  29. package/components/shell/phi-shell-sider-drawer.js +88 -0
  30. package/components/widgets/helpers/internal-reference-resolver.server.d.ts +1 -0
  31. package/components/widgets/helpers/internal-reference-resolver.server.js +4 -1
  32. package/components/widgets/label-sets/inspector.js +2 -0
  33. package/components/widgets/label-types/inspector.d.ts +2 -0
  34. package/components/widgets/label-types/inspector.js +1 -0
  35. package/components/widgets/server/navigation-request.js +13 -1
  36. package/components/widgets/shared/card-body-client.d.ts +2 -0
  37. package/components/widgets/shared/card-body-client.js +8 -7
  38. package/components/widgets/shared/card-vocabulary.d.ts +36 -0
  39. package/components/widgets/shared/card-vocabulary.js +52 -0
  40. package/components/widgets/shared/markdown-body-client.d.ts +29 -0
  41. package/components/widgets/shared/markdown-body-client.js +60 -5
  42. package/components/widgets/shared/markdown-image-vocabulary.d.ts +31 -0
  43. package/components/widgets/shared/markdown-image-vocabulary.js +68 -0
  44. package/components/widgets/shared/markdown-render.d.ts +5 -0
  45. package/components/widgets/shared/markdown-render.js +123 -8
  46. package/components/widgets/shared/markdown-sections.d.ts +40 -0
  47. package/components/widgets/shared/markdown-sections.js +111 -0
  48. package/helpers/external-href.js +1 -1
  49. package/helpers/protected-mail.d.ts +16 -0
  50. package/helpers/protected-mail.js +81 -0
  51. package/package.json +2 -2
  52. package/plugins/runtime-modules/builder/clients/region-inspector.js +20 -1
  53. package/plugins/runtime-modules/core/widgets/card/config.d.ts +8 -1
  54. package/plugins/runtime-modules/core/widgets/card/config.js +22 -1
  55. package/plugins/runtime-modules/core/widgets/card/editor.js +9 -1
  56. package/plugins/runtime-modules/core/widgets/card/server.js +9 -1
  57. package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +2 -1
  58. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +3 -3
  59. package/plugins/runtime-modules/core/widgets/header-navigation/client.d.ts +6 -1
  60. package/plugins/runtime-modules/core/widgets/header-navigation/client.js +40 -13
  61. package/plugins/runtime-modules/core/widgets/header-navigation/config.d.ts +26 -1
  62. package/plugins/runtime-modules/core/widgets/header-navigation/config.js +27 -0
  63. package/plugins/runtime-modules/core/widgets/header-navigation/plugin.js +1 -1
  64. package/plugins/runtime-modules/core/widgets/header-navigation/server.d.ts +2 -2
  65. package/plugins/runtime-modules/core/widgets/header-navigation/server.js +3 -1
  66. package/plugins/runtime-modules/core/widgets/image/client.js +11 -7
  67. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +16 -0
  68. package/plugins/runtime-modules/core/widgets/markdown/config.js +46 -1
  69. package/plugins/runtime-modules/core/widgets/markdown/server.js +22 -8
  70. package/plugins/runtime-modules/core/widgets/simple-text/server.js +11 -1
  71. package/styles/controls.css +108 -10
  72. package/styles/layout.css +35 -0
  73. package/styles/shell.css +142 -0
  74. package/theme/phi-tokens.d.ts +6 -0
  75. package/theme/phi-tokens.js +6 -0
  76. package/theme.d.ts +1 -0
  77. package/theme.js +6 -0
  78. package/types/core-widget-placements.d.ts +5 -0
@@ -288,7 +288,7 @@ export async function PhiCmsAreaShell({ root, cmsBridge, children, chrome = "she
288
288
  return (_jsx(PhiCmsShell, { content: children, headerPaneStickyTop: headerPaneStickyTop, headerBandRoom: headerBandRoom, headerTopRoom: headerTopBehaviour == null ? undefined : {
289
289
  [PHI_SHELL_HEADER_TOP_EXTENT_PROPERTY]: `${headerTopRoom.extent}px`,
290
290
  [PHI_SHELL_HEADER_TOP_STACK_PROPERTY]: `${headerTopRoom.stack}px`,
291
- }, headerTop: hasRenderableHeaderTop ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region header_top", regionTypes: [PhiCmsRegionType.HeaderTop], registry: runtimeRegistry })) : undefined, headerMain: hasRenderableHeaderMain ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region header_main", regionTypes: [PhiCmsRegionType.HeaderMain], registry: runtimeRegistry })) : undefined, headerBottom: headerBottom, hero: hero, siderLeft: hasRenderableSiderLeft ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "sider_left", regionTypes: [PhiCmsRegionType.SiderLeft], stackGap: 0, registry: runtimeRegistry })) : undefined, siderRight: siderRight, siderLeftFullHeight: hasPhiConfigFlag(siderLeftRegion?.config, PhiCmsFlags.FullHeight) && hasRenderableSiderLeft, footerTop: footerTop, drawer: drawer, footerMain: hasRenderableFooterMain ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region footer_main", regionTypes: [PhiCmsRegionType.Footer], registry: runtimeRegistry })) : undefined, footerBottom: hasRenderableFooterBottom ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region footer_bottom", regionTypes: [PhiCmsRegionType.FooterBottom], registry: runtimeRegistry })) : undefined }));
291
+ }, headerTop: hasRenderableHeaderTop ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region header_top", regionTypes: [PhiCmsRegionType.HeaderTop], registry: runtimeRegistry })) : undefined, headerMain: hasRenderableHeaderMain ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region header_main", regionTypes: [PhiCmsRegionType.HeaderMain], registry: runtimeRegistry })) : undefined, headerBottom: headerBottom, hero: hero, siderLeft: hasRenderableSiderLeft ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "sider_left", regionTypes: [PhiCmsRegionType.SiderLeft], stackGap: 0, registry: runtimeRegistry })) : undefined, siderRight: siderRight, siderLeftFullHeight: hasPhiConfigFlag(siderLeftRegion?.config, PhiCmsFlags.FullHeight) && hasRenderableSiderLeft, siderLeftMobileDrawer: hasRenderableSiderLeft && hasPhiConfigFlag(siderLeftRegion?.config, PhiCmsFlags.MobileDrawer), footerTop: footerTop, drawer: drawer, footerMain: hasRenderableFooterMain ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region footer_main", regionTypes: [PhiCmsRegionType.Footer], registry: runtimeRegistry })) : undefined, footerBottom: hasRenderableFooterBottom ? (_jsx(PhiCmsLayoutRenderer, { tree: filteredLayoutTree, runtime: runtime, regionClassName: "phi-shell-region footer_bottom", regionTypes: [PhiCmsRegionType.FooterBottom], registry: runtimeRegistry })) : undefined }));
292
292
  }
293
293
  /**
294
294
  * Boundary and Shell in one component, for a caller that is not a pair of Layouts.
@@ -15,6 +15,8 @@ export type PhiButtonControlProps = {
15
15
  ariaLabel?: string;
16
16
  /** For a button that is a toggle -- pause and play -- whether it is on. */
17
17
  ariaPressed?: boolean;
18
+ /** Whether what the Button opens is open: a menu button's `aria-expanded`. */
19
+ ariaExpanded?: boolean;
18
20
  /**
19
21
  * Renders the button as a link rather than a command.
20
22
  *
@@ -92,4 +94,4 @@ export type PhiButtonControlProps = {
92
94
  ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;
93
95
  onClick?: () => void;
94
96
  };
95
- export declare function PhiButtonControl({ label, ariaLabel, ariaPressed, href, newTab, external, tooltip, icon, type, shape, danger, ghost, gradient, glass, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }: PhiButtonControlProps): import("react").JSX.Element;
97
+ export declare function PhiButtonControl({ label, ariaLabel, ariaPressed, ariaExpanded, href, newTab, external, tooltip, icon, type, shape, danger, ghost, gradient, glass, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }: PhiButtonControlProps): import("react").JSX.Element;
@@ -12,7 +12,7 @@ import { PhiHoverText } from "./phi-hover-text";
12
12
  */
13
13
  const PhiLazyBadge = lazy(() => import("antd/es/badge"));
14
14
  const PHI_GLASS_BUTTON_FILTER = "blur(12px) saturate(140%)";
15
- export function PhiButtonControl({ label, ariaLabel, ariaPressed, href, newTab, external, tooltip, icon, type = "default", shape, danger, ghost, gradient, glass, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }) {
15
+ export function PhiButtonControl({ label, ariaLabel, ariaPressed, ariaExpanded, href, newTab, external, tooltip, icon, type = "default", shape, danger, ghost, gradient, glass, disabled, readOnly, loading, htmlType, block, size, style, badge, className, ref, onClick, }) {
16
16
  const visibleTooltip = typeof label === "string" && typeof tooltip === "string" && label === tooltip
17
17
  ? null
18
18
  : tooltip;
@@ -33,7 +33,7 @@ export function PhiButtonControl({ label, ariaLabel, ariaPressed, href, newTab,
33
33
  gradientVars ? "phi-btn-gradient" : null,
34
34
  glass && !gradientVars ? "phi-btn-glass" : null,
35
35
  ].filter(Boolean).join(" ") || undefined;
36
- const button = (_jsx(Button, { ref: ref, className: paintedClassName, "aria-label": ariaLabel, "aria-pressed": ariaPressed, type: gradientVars ? "primary" : glass ? "default" : type, shape: shape, danger: danger, ghost: ghost, disabled: inert, loading: loading, htmlType: htmlType, block: block, size: size,
36
+ const button = (_jsx(Button, { ref: ref, className: paintedClassName, "aria-label": ariaLabel, "aria-pressed": ariaPressed, "aria-expanded": ariaExpanded, type: gradientVars ? "primary" : glass ? "default" : type, shape: shape, danger: danger, ghost: ghost, disabled: inert, loading: loading, htmlType: htmlType, block: block, size: size,
37
37
  /* Not a pointer target at all, so the Button's own hover and press states never start. */
38
38
  style: readOnly ? { ...paintedStyle, pointerEvents: "none" } : paintedStyle, "aria-disabled": readOnly || undefined, icon: icon, onClick: readOnly ? undefined : onClick, children: label }));
39
39
  /*
@@ -24,8 +24,12 @@ export type PhiCollapseControlProps = {
24
24
  openKeys: readonly string[];
25
25
  onOpenKeysChange?: (keys: string[]) => void;
26
26
  accordion?: boolean;
27
- /** What folds a section: its whole header, only the icon, or nothing. */
28
- collapsible?: "header" | "icon" | "disabled";
27
+ /**
28
+ * What folds a section: the whole header row (`row`), the header's title and its icon (`header`), only
29
+ * the icon, or nothing. Ant Design's `header` answers on the words alone, so a click beside a short
30
+ * title does nothing; `row` is its default, which takes the whole bar.
31
+ */
32
+ collapsible?: "row" | "header" | "icon" | "disabled";
29
33
  /** No ground of its own for headers and bodies. */
30
34
  ghost?: boolean;
31
35
  expandIconPlacement?: "start" | "end";
@@ -24,10 +24,10 @@ function resolveSectionStyles(titleStrong, headerPadding, bodyPadding) {
24
24
  export function PhiCollapseControl({ sections, openKeys, onOpenKeysChange, accordion = false, collapsible = "header", ghost = false, expandIconPlacement = "start", size, headerClassName, headerPadding, bodyPadding, titleStrong = false, style, }) {
25
25
  return (_jsx(Collapse, { accordion: accordion, activeKey: accordion ? openKeys[0] ?? undefined : [...openKeys],
26
26
  // The caller's box draws the outline; what stays here is `ghost`, which decides the inside.
27
- bordered: false, ghost: ghost, collapsible: collapsible, destroyOnHidden: false, expandIconPlacement: expandIconPlacement, size: size, classNames: headerClassName ? { header: headerClassName } : undefined, items: sections.map((section) => ({
27
+ bordered: false, ghost: ghost, collapsible: collapsible === "row" ? undefined : collapsible, destroyOnHidden: false, expandIconPlacement: expandIconPlacement, size: size, classNames: headerClassName ? { header: headerClassName } : undefined, items: sections.map((section) => ({
28
28
  key: section.key,
29
29
  label: section.label,
30
- collapsible,
30
+ collapsible: collapsible === "row" ? undefined : collapsible,
31
31
  forceRender: section.forceRender,
32
32
  ...(section.hidden ? { style: { display: "none" } } : {}),
33
33
  children: section.children,
@@ -4,6 +4,7 @@ import type { PhiOverlayCloseSource, PhiOverlayMaskBehaviour } from "../../types
4
4
  import type { PhiControlSize } from "../../types/control";
5
5
  import { type PhiAlertControlProps } from "./phi-alert-control";
6
6
  import type { PhiButtonType } from "./phi-button-types";
7
+ import { type PhiDrawerControlProps } from "./phi-drawer-control";
7
8
  /**
8
9
  * A Dialog built in code: a title, one subject, an optional notice above it, and the actions below.
9
10
  *
@@ -27,10 +28,9 @@ import type { PhiButtonType } from "./phi-button-types";
27
28
  * the same tokens rather than from each other -- the Layout presets are creation defaults a Builder may
28
29
  * edit afterwards, which is not a constant to depend on.
29
30
  *
30
- * Modal only, on purpose. `PhiDrawerControl` zeroes its zones the same way and will want the same
31
- * treatment, but no Dialog in the house is built in code *and* drawn as a Drawer, and a branch with no
32
- * caller is a guess about the one that eventually arrives. When it arrives, `presentation` is the prop
33
- * it becomes, and its placement and size come with it.
31
+ * A Modal unless `presentation` says `drawer`: the Header Navigation's entries on a phone were the first
32
+ * Dialog built in code and drawn from the side. `PhiDrawerControl` zeroes its zones as the Modal does, so
33
+ * the inside is the same; `placement` and `size` are the Drawer's own and nobody else reads them.
34
34
  */
35
35
  export type PhiDialogControlAction = {
36
36
  key: string;
@@ -70,7 +70,13 @@ export type PhiDialogControlProps = {
70
70
  mountPolicy?: PhiCmsMountPolicy;
71
71
  /** A styling hook for a surface that mounts the Dialog inside its own popup container. */
72
72
  rootClassName?: string;
73
+ /** A Modal (the default) or a Drawer from the side. */
74
+ presentation?: "modal" | "drawer";
75
+ /** The edge a Drawer comes from. */
76
+ placement?: PhiDrawerControlProps["placement"];
77
+ /** A Drawer's width (or height, from the top or bottom). */
78
+ size?: PhiDrawerControlProps["size"];
73
79
  onDismiss?: (source: PhiOverlayCloseSource) => void;
74
80
  afterOpenChange?: (open: boolean) => void;
75
81
  };
76
- export declare function PhiDialogControl({ open, title, children, alert, actions, controlSize, centered, closable, keyboard, mask, mountPolicy, rootClassName, onDismiss, afterOpenChange, }: PhiDialogControlProps): import("react").JSX.Element;
82
+ export declare function PhiDialogControl({ open, title, children, alert, actions, controlSize, centered, closable, keyboard, mask, mountPolicy, rootClassName, presentation, placement, size, onDismiss, afterOpenChange, }: PhiDialogControlProps): import("react").JSX.Element;
@@ -6,17 +6,23 @@ import { PhiButtonControl } from "./phi-button-control";
6
6
  import { PhiCompactGroupControl } from "./phi-compact-group-control";
7
7
  import { PhiFlexControl } from "./phi-flex-control";
8
8
  import { PhiModalControl } from "./phi-modal-control";
9
- export function PhiDialogControl({ open, title, children, alert, actions, controlSize = "medium", centered, closable, keyboard, mask, mountPolicy, rootClassName, onDismiss, afterOpenChange, }) {
10
- return (_jsx(PhiModalControl, { open: open, title: title, closable: closable, keyboard: keyboard, mask: mask, mountPolicy: mountPolicy, centered: centered, controlSize: controlSize, rootClassName: rootClassName, onDismiss: onDismiss, afterOpenChange: afterOpenChange, body: _jsxs(PhiFlexControl, { vertical: true, gap: PHI_SPACE.base, style: { padding: PHI_SPACE.base, width: "100%", minWidth: 0 }, children: [alert == null ? null : _jsx(PhiAlertControl, { ...alert }), children] }),
11
- /*
12
- * The actions are one compact group, as a tree Overlay's footer is (OVERLAYS.md): Cancel and Apply
13
- * are the two ends of one decision, and a gap between them read as two unrelated offers. A compact
14
- * group does not wrap.
15
- */
16
- footer: actions == null || actions.length === 0 ? null : (_jsx(PhiFlexControl, { align: "center", justify: "end", style: {
17
- paddingBlock: PHI_SPACE.xs,
18
- paddingInline: PHI_SPACE.base,
19
- width: "100%",
20
- minWidth: 0,
21
- }, children: _jsx(PhiCompactGroupControl, { children: actions.map((action) => (_jsx(PhiButtonControl, { label: action.label, icon: action.icon, type: action.type, danger: action.danger, disabled: action.disabled, loading: action.loading, onClick: action.onClick }, action.key))) }) })) }));
9
+ import { PhiDrawerControl } from "./phi-drawer-control";
10
+ export function PhiDialogControl({ open, title, children, alert, actions, controlSize = "medium", centered, closable, keyboard, mask, mountPolicy, rootClassName, presentation = "modal", placement, size, onDismiss, afterOpenChange, }) {
11
+ const body = (_jsxs(PhiFlexControl, { vertical: true, gap: PHI_SPACE.base, style: { padding: PHI_SPACE.base, width: "100%", minWidth: 0 }, children: [alert == null ? null : _jsx(PhiAlertControl, { ...alert }), children] }));
12
+ const footer = (
13
+ /*
14
+ * The actions are one compact group, as a tree Overlay's footer is (OVERLAYS.md): Cancel and Apply
15
+ * are the two ends of one decision, and a gap between them read as two unrelated offers. A compact
16
+ * group does not wrap.
17
+ */
18
+ actions == null || actions.length === 0 ? null : (_jsx(PhiFlexControl, { align: "center", justify: "end", style: {
19
+ paddingBlock: PHI_SPACE.xs,
20
+ paddingInline: PHI_SPACE.base,
21
+ width: "100%",
22
+ minWidth: 0,
23
+ }, children: _jsx(PhiCompactGroupControl, { children: actions.map((action) => (_jsx(PhiButtonControl, { label: action.label, icon: action.icon, type: action.type, danger: action.danger, disabled: action.disabled, loading: action.loading, onClick: action.onClick }, action.key))) }) })));
24
+ if (presentation === "drawer") {
25
+ return (_jsx(PhiDrawerControl, { open: open, title: title, closable: closable, keyboard: keyboard, mask: mask, mountPolicy: mountPolicy, placement: placement, size: size, onDismiss: onDismiss, afterOpenChange: afterOpenChange, body: body, footer: footer }));
26
+ }
27
+ return (_jsx(PhiModalControl, { open: open, title: title, closable: closable, keyboard: keyboard, mask: mask, mountPolicy: mountPolicy, centered: centered, controlSize: controlSize, rootClassName: rootClassName, onDismiss: onDismiss, afterOpenChange: afterOpenChange, body: body, footer: footer }));
22
28
  }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * How a horizontal menu marks the entry the reader is on: `underline` is a bar under it, `pill` a rounded
3
+ * ground in the control height, `auto` the bar in light mode and the pill in dark mode. Ant Design itself
4
+ * draws a bar in light mode and fills the whole height of the bar with the primary colour in dark mode.
5
+ */
6
+ export declare const PHI_MENU_SELECTION_STYLES: readonly ["auto", "underline", "pill"];
7
+ export type PhiMenuSelectionStyle = (typeof PHI_MENU_SELECTION_STYLES)[number];
@@ -0,0 +1,10 @@
1
+ /*
2
+ * The Menu Control's words, apart from the Control: a Widget's definition reads them on the server, and a
3
+ * value imported from the Control would make Ant Design's Menu a dependency of every route.
4
+ */
5
+ /**
6
+ * How a horizontal menu marks the entry the reader is on: `underline` is a bar under it, `pill` a rounded
7
+ * ground in the control height, `auto` the bar in light mode and the pill in dark mode. Ant Design itself
8
+ * draws a bar in light mode and fills the whole height of the bar with the primary colour in dark mode.
9
+ */
10
+ export const PHI_MENU_SELECTION_STYLES = ["auto", "underline", "pill"];
@@ -1,5 +1,6 @@
1
1
  import type { CSSProperties, ReactNode } from "react";
2
2
  import type { ItemType } from "antd/es/menu/interface";
3
+ import type { PhiMenuSelectionStyle } from "./phi-menu-control-vocabulary";
3
4
  export type PhiMenuControlDivider = {
4
5
  type: "divider";
5
6
  key?: string;
@@ -31,6 +32,8 @@ export type PhiMenuControlItem = PhiMenuControlDivider | PhiMenuControlGroup | P
31
32
  export type PhiMenuControlProps = {
32
33
  items: readonly PhiMenuControlItem[];
33
34
  mode: "inline" | "horizontal";
35
+ /** A horizontal menu's mark for the current entry (`styles/controls.css`); absent, Ant Design's own. */
36
+ selectionStyle?: PhiMenuSelectionStyle;
34
37
  /** Defaults to the active Phi theme mode. */
35
38
  menuTheme?: "light" | "dark";
36
39
  selectedKeys?: readonly string[];
@@ -50,4 +53,4 @@ export declare function toPhiAntdMenuItems(items: readonly PhiMenuControlItem[])
50
53
  * backgrounds every stacked Phi menu uses, its collapsed width, and the type a Widget configures — so
51
54
  * menu surfaces cannot drift apart in their component tokens.
52
55
  */
53
- export declare function PhiMenuControl({ items, mode, menuTheme, selectedKeys, collapsed, collapsedWidth, inlineIndent, fontFamily, fontSize, style, }: PhiMenuControlProps): import("react").JSX.Element | null;
56
+ export declare function PhiMenuControl({ items, mode, menuTheme, selectedKeys, collapsed, collapsedWidth, inlineIndent, fontFamily, fontSize, selectionStyle, style, }: PhiMenuControlProps): import("react").JSX.Element | null;
@@ -24,7 +24,7 @@ export function toPhiAntdMenuItems(items) {
24
24
  * backgrounds every stacked Phi menu uses, its collapsed width, and the type a Widget configures — so
25
25
  * menu surfaces cannot drift apart in their component tokens.
26
26
  */
27
- export function PhiMenuControl({ items, mode, menuTheme, selectedKeys, collapsed = false, collapsedWidth, inlineIndent, fontFamily, fontSize, style, }) {
27
+ export function PhiMenuControl({ items, mode, menuTheme, selectedKeys, collapsed = false, collapsedWidth, inlineIndent, fontFamily, fontSize, selectionStyle, style, }) {
28
28
  const { mode: themeMode } = usePhiConfig();
29
29
  const resolvedMenuTheme = menuTheme ?? themeMode;
30
30
  /*
@@ -53,6 +53,11 @@ export function PhiMenuControl({ items, mode, menuTheme, selectedKeys, collapsed
53
53
  * defaults, whose item spacing is what separates the entries in a header bar.
54
54
  */
55
55
  mode === "inline" ? "phi-menu-control--inline" : null,
56
+ /*
57
+ * Decided by the Menu's own theme class in CSS, not here: `auto` is one class whatever the mode, so the
58
+ * page a server rendered for both modes marks the entry right in the one the reader sees.
59
+ */
60
+ mode === "horizontal" && selectionStyle ? `phi-menu-control--selection-${selectionStyle}` : null,
56
61
  fontFamily ? "phi-menu-control--font-family" : null,
57
62
  fontSize ? "phi-menu-control--font-size" : null,
58
63
  mode === "inline" && collapsedWidth !== undefined ? "phi-menu-control--collapsed-width" : null,
@@ -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,
@@ -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
+ }
@@ -199,7 +199,11 @@ export function PhiCmsRegionContainerClient({ children, className, regionKey, co
199
199
  height: "100%",
200
200
  minWidth: 0,
201
201
  minHeight: 0,
202
- }, 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: {
203
207
  minHeight: collapsedWidth,
204
208
  paddingTop: 0,
205
209
  paddingInline: collapsed ? 0 : token.paddingXS,
@@ -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 = {
@@ -74,6 +74,15 @@ export function phiCmsRegionSiderSticks(regionKey, config) {
74
74
  export function phiCmsRegionFooterSticks(regionKey, config) {
75
75
  return regionKey === "footer_bottom" && hasPhiFlag(config?.flags, PhiCmsFlags.Sticky);
76
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
+ }
77
86
  /** The line a stuck Sider stands at: under the Header as measured, plus its own offset. */
78
87
  function resolvePhiCmsRegionSiderStuckTop(topCss) {
79
88
  return `calc(var(${PHI_SHELL_STICKY_TOP_PROPERTY}, 0px) + ${topCss})`;
@@ -438,6 +447,8 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
438
447
  "data-phi-viewport-flags": viewportFlags,
439
448
  "data-phi-block-enabled": enabled ? "true" : "false",
440
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,
441
452
  ...effectsAttributes,
442
453
  className: ["phi-cms-region-shell", resolvePhiSurfaceToneClassName(surface?.tone), className]
443
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,
@@ -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;
@@ -32,4 +34,4 @@ export type PhiCmsShellProps = {
32
34
  */
33
35
  headerBandRoom?: Record<`--phi-shell-band-${string}`, string>;
34
36
  };
35
- export declare function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, headerBandRoom, }: 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,7 +45,7 @@ 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, headerBandRoom, }) {
48
+ export function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight = false, siderLeftMobileDrawer = false, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, headerBandRoom, }) {
48
49
  const roomStyle = headerTopRoom || headerBandRoom
49
50
  ? { ...headerTopRoom, ...headerBandRoom }
50
51
  : undefined;
@@ -61,8 +62,11 @@ export function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero
61
62
  */
62
63
  const hasHeader = Boolean(headerTop || headerMain || headerBottom);
63
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;
64
68
  if (hasLeftFullHeightSidebar) {
65
- 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] }));
66
70
  }
67
- 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] }));
68
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;