@phis/ui 0.4.14 → 0.4.15

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 (32) hide show
  1. package/README.md +0 -1
  2. package/components/cms/phi-cms-root-layout.js +1 -1
  3. package/components/layouts/clients/phi-split-card-layout-client.js +6 -2
  4. package/components/regions/phi-cms-region-shell.js +1 -1
  5. package/components/regions/presets/phi-area-shell-preset-nodes.js +3 -2
  6. package/components/root/phi-antd-registry.d.ts +15 -0
  7. package/components/root/phi-antd-registry.js +29 -0
  8. package/components/root/phi-root-layout.js +2 -2
  9. package/components/shell/phi-shell-sider-drawer.d.ts +1 -1
  10. package/components/shell/phi-shell-sider-drawer.js +1 -1
  11. package/components/widgets/config/text-case-vocabulary.d.ts +33 -0
  12. package/components/widgets/config/text-case-vocabulary.js +29 -0
  13. package/components/widgets/label-types/inspector.d.ts +1 -1
  14. package/components/widgets/shared/card-body-client.js +2 -1
  15. package/components/widgets/shared/eyebrow-style.d.ts +9 -0
  16. package/components/widgets/shared/eyebrow-style.js +9 -0
  17. package/components/widgets/shared/markdown-body-client.d.ts +7 -3
  18. package/components/widgets/shared/markdown-body-client.js +26 -11
  19. package/package.json +2 -3
  20. package/plugins/runtime-modules/builder/clients/region-inspector.js +6 -5
  21. package/plugins/runtime-modules/core/widgets/entry-list/client.js +1 -1
  22. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +6 -0
  23. package/plugins/runtime-modules/core/widgets/markdown/config.js +2 -0
  24. package/plugins/runtime-modules/core/widgets/markdown/plugin.js +7 -2
  25. package/plugins/runtime-modules/core/widgets/markdown/server.js +7 -1
  26. package/plugins/runtime-modules/core/widgets/quick-links/client.js +11 -8
  27. package/plugins/runtime-modules/core/widgets/simple-text/client.d.ts +3 -0
  28. package/plugins/runtime-modules/core/widgets/simple-text/client.js +3 -0
  29. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +30 -0
  30. package/plugins/runtime-modules/core/widgets/simple-text/config.js +15 -0
  31. package/styles/layout.css +33 -0
  32. package/types/core-widget-placements.d.ts +7 -0
package/README.md CHANGED
@@ -39,7 +39,6 @@ It does not own:
39
39
  | `react`, `react-dom` | `^19.2.8` |
40
40
  | `antd` | `^6.5.1` |
41
41
  | `@ant-design/icons` | `^6.3.2` |
42
- | `@ant-design/nextjs-registry` | `^1.3.0` |
43
42
 
44
43
  ## For Site operators
45
44
 
@@ -290,7 +290,7 @@ export async function PhiCmsAreaShell({ root, cmsBridge, children, chrome = "she
290
290
  return (_jsx(PhiCmsShell, { content: children, headerPaneStickyTop: headerPaneStickyTop, headerBandRoom: headerBandRoom, headerTopRoom: headerTopBehaviour == null ? undefined : {
291
291
  [PHI_SHELL_HEADER_TOP_EXTENT_PROPERTY]: `${headerTopRoom.extent}px`,
292
292
  [PHI_SHELL_HEADER_TOP_STACK_PROPERTY]: `${headerTopRoom.stack}px`,
293
- }, 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 }));
293
+ }, 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.MobileColumn), 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 }));
294
294
  }
295
295
  /**
296
296
  * Boundary and Shell in one component, for a caller that is not a pair of Layouts.
@@ -13,9 +13,13 @@ function renderSplitCardSlot(isAuthoringRender, key, child, slotRole, slotIndex,
13
13
  const showInsertButton = typeof editSlotAction === "function" && editRenderInsertControl != null;
14
14
  return (_jsxs(PhiSplitCardHalf, { blockId: card.blockId, surface: card.surface, side: slotRole, gap: card.gap, swapped: card.swapped, "data-layout-kind": "split", className: phiLayoutSlotClassName(isAuthoringRender), "data-phi-layout-has-content": phiLayoutSlotContentMarker(isAuthoringRender, hasContent), style: {
15
15
  position: "relative",
16
- height: "100%",
16
+ /*
17
+ * No `height: 100%` and no `minHeight: 0`: the grid stretches both cards to the row already, and
18
+ * the content's own height has to stay the card's lower bound. Without it Safari keeps the row's
19
+ * height when the Split Card's width changes, and text that wraps onto more lines runs out of the
20
+ * card (`styles/layout.css`, the Split Card).
21
+ */
17
22
  minWidth: 0,
18
- minHeight: 0,
19
23
  display: "flex",
20
24
  alignItems: "stretch",
21
25
  boxSizing: "border-box",
@@ -81,7 +81,7 @@ export function phiCmsRegionFooterSticks(regionKey, config) {
81
81
  * at the inline start of the Header beside it. `sider_right` belongs to the Page and keeps its column.
82
82
  */
83
83
  function phiCmsRegionSiderOpensAsDrawer(regionKey, config) {
84
- return regionKey === "sider_left" && hasPhiFlag(config?.flags, PhiCmsFlags.MobileDrawer);
84
+ return regionKey === "sider_left" && !hasPhiFlag(config?.flags, PhiCmsFlags.MobileColumn);
85
85
  }
86
86
  /** The line a stuck Sider stands at: under the Header as measured, plus its own offset. */
87
87
  function resolvePhiCmsRegionSiderStuckTop(topCss) {
@@ -107,8 +107,9 @@ 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
- // 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,
110
+ // On a phone the navigation opens from the Header's menu button, as every `sider_left` does
111
+ // unless it says `MobileColumn` (SHELL.md "The Sider on a phone").
112
+ flags: PhiCmsFlags.Sticky | PhiCmsFlags.FullHeight | PhiCmsFlags.Collapsible,
112
113
  size: { width: `${resolvedShellLeftWidth}px` },
113
114
  ...(typeof shellSiderLeftOffsetTop === "number" ? { offsetTop: shellSiderLeftOffsetTop } : { offsetTop: 0 }),
114
115
  },
@@ -0,0 +1,15 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * Collects what Ant Design registers while the server renders and writes it into the streamed HTML.
4
+ *
5
+ * `AntdRegistry` from `@ant-design/nextjs-registry` (1.3.0) did this and dropped every flush after the
6
+ * first. It took an extract whose cache-path rule reads `content:""` for an empty one, but that rule
7
+ * only lists structure styles, and the root runs with `zeroRuntime` (`phi-root-theme-resolver.ts`): after
8
+ * the first flush there are none, only the CSS variables of the components that streamed in since. A
9
+ * Sider streams in late, so its Menu reached the browser without its item height variable, its items
10
+ * stood at line height 0 with only their icons showing, and jumped open once the client had rendered.
11
+ * Here an extract counts as empty when nothing stands before that closing rule.
12
+ */
13
+ export declare function PhiAntdRegistry({ children }: {
14
+ children: ReactNode;
15
+ }): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { createCache, extractStyle, StyleProvider } from "@ant-design/cssinjs";
5
+ import { useServerInsertedHTML } from "next/navigation";
6
+ /** The rule `extractStyle` closes every extract with; with nothing before it, the extract is empty. */
7
+ const PHI_ANTD_CACHE_PATH_RULE = /\.data-ant-cssinjs-cache-path\{content:"[^"]*";\}$/;
8
+ /**
9
+ * Collects what Ant Design registers while the server renders and writes it into the streamed HTML.
10
+ *
11
+ * `AntdRegistry` from `@ant-design/nextjs-registry` (1.3.0) did this and dropped every flush after the
12
+ * first. It took an extract whose cache-path rule reads `content:""` for an empty one, but that rule
13
+ * only lists structure styles, and the root runs with `zeroRuntime` (`phi-root-theme-resolver.ts`): after
14
+ * the first flush there are none, only the CSS variables of the components that streamed in since. A
15
+ * Sider streams in late, so its Menu reached the browser without its item height variable, its items
16
+ * stood at line height 0 with only their icons showing, and jumped open once the client had rendered.
17
+ * Here an extract counts as empty when nothing stands before that closing rule.
18
+ */
19
+ export function PhiAntdRegistry({ children }) {
20
+ const [cache] = useState(() => createCache());
21
+ useServerInsertedHTML(() => {
22
+ const styleText = extractStyle(cache, { plain: true, once: true });
23
+ if (styleText.replace(PHI_ANTD_CACHE_PATH_RULE, "").length === 0) {
24
+ return null;
25
+ }
26
+ return (_jsx("style", { id: "antd-cssinjs", "data-rc-order": "prepend", "data-rc-priority": "-1000", dangerouslySetInnerHTML: { __html: styleText } }));
27
+ });
28
+ return _jsx(StyleProvider, { cache: cache, children: children });
29
+ }
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { preload } from "react-dom";
3
- import { AntdRegistry } from "@ant-design/nextjs-registry";
4
3
  import "antd/dist/reset.css";
5
4
  /*
6
5
  * Ant Design's structure, generated in the Site from its Ant Design (`@phis/ui/next/config`) because the
@@ -20,6 +19,7 @@ import { loadPhiAntdLocale } from "../../helpers/antd-locale";
20
19
  import { PhiDayjsLocale } from "./phi-dayjs-locale";
21
20
  import { readPhiRenderMoment } from "../../helpers/format-date-time";
22
21
  import { PhiRootLiveThemeProvider } from "./phi-root-live-theme-provider";
22
+ import { PhiAntdRegistry } from "./phi-antd-registry";
23
23
  import { resolvePhiRootThemeState } from "./phi-root-theme-resolver";
24
24
  import { PhiSignalRuntimePartitionProvider } from "../runtime/runtime-signal-partition";
25
25
  import { PhiCoreRuntimeApplicationAdapter } from "../runtime/core-runtime-application-adapter";
@@ -119,7 +119,7 @@ export async function PhiRootLayout({ children, apiBaseUrl, internalToken, siteK
119
119
  mode: resolvedThemeMode,
120
120
  themePresets,
121
121
  });
122
- return (_jsxs(_Fragment, { children: [assetFonts.css ? (_jsx("style", { href: `phi-site-fonts:${site.key}`, precedence: "default", dangerouslySetInnerHTML: { __html: assetFonts.css } })) : null, _jsx(AntdRegistry, { children: _jsx(PhiSignalRuntimePartitionProvider, { id: `site:${site.key}`, kind: "site", context: { siteKey: site.key }, children: _jsx(PhiRootLiveThemeProvider, { siteKey: site.key, siteName: site.name, siteTheme: siteTheme, locale: antdLocale, initialMode: resolvedThemeMode, themeModePreference: themeModePreference, initialLocale: resolvedLocale?.locale ?? site.defaultLocale, availableLocales: site.availableLocales.map((option) => option.code), fonts: themeFonts, themeState: themeState, fontFamilies: fontCatalogue.entries.map(({ family, cssVariable }) => ({ family, cssVariable })), presets: themePresets, rootClassName: fontCatalogue.className, rootStyle: headingFontFamily
122
+ return (_jsxs(_Fragment, { children: [assetFonts.css ? (_jsx("style", { href: `phi-site-fonts:${site.key}`, precedence: "default", dangerouslySetInnerHTML: { __html: assetFonts.css } })) : null, _jsx(PhiAntdRegistry, { children: _jsx(PhiSignalRuntimePartitionProvider, { id: `site:${site.key}`, kind: "site", context: { siteKey: site.key }, children: _jsx(PhiRootLiveThemeProvider, { siteKey: site.key, siteName: site.name, siteTheme: siteTheme, locale: antdLocale, initialMode: resolvedThemeMode, themeModePreference: themeModePreference, initialLocale: resolvedLocale?.locale ?? site.defaultLocale, availableLocales: site.availableLocales.map((option) => option.code), fonts: themeFonts, themeState: themeState, fontFamilies: fontCatalogue.entries.map(({ family, cssVariable }) => ({ family, cssVariable })), presets: themePresets, rootClassName: fontCatalogue.className, rootStyle: headingFontFamily
123
123
  ? { ...publishedRootTheme.style, [PHI_THEME_HEADING_FONT_VARIABLE]: headingFontFamily }
124
124
  : publishedRootTheme.style, children: _jsxs("div", { "data-phi-app-ground": "true", children: [_jsx(PhiCoreRuntimeApplicationAdapter, { labels: sessionLabels }), _jsx(PhiDayjsLocale, { locale: resolvedLocale?.locale ?? resolvedLocale?.intlLocale, intlLocale: resolvedLocale?.intlLocale ?? site.defaultLocale, timeZone: site.timeZone, renderedAt: readPhiRenderMoment(), children: children })] }) }) }) })] }));
125
125
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * A `sider_left` with `MobileDrawer`, on a phone: the menu button that opens it, the mask behind it, and
2
+ * A `sider_left` without `MobileColumn`, on a phone: the menu button that opens it, the mask behind it, and
3
3
  * the rules that close it again (SHELL.md "The Sider on a phone").
4
4
  *
5
5
  * The Sider itself does not move. `styles/shell.css` takes it out of its column below 768px and stands it
@@ -8,7 +8,7 @@ import { PhiIcon } from "./phi-icon";
8
8
  /** Where the drawer's top stands within the Shell, published on the Shell element (`styles/shell.css`). */
9
9
  const PHI_SHELL_SIDER_DRAWER_TOP_PROPERTY = "--phi-shell-sider-drawer-top";
10
10
  /**
11
- * A `sider_left` with `MobileDrawer`, on a phone: the menu button that opens it, the mask behind it, and
11
+ * A `sider_left` without `MobileColumn`, on a phone: the menu button that opens it, the mask behind it, and
12
12
  * the rules that close it again (SHELL.md "The Sider on a phone").
13
13
  *
14
14
  * The Sider itself does not move. `styles/shell.css` takes it out of its column below 768px and stands it
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Capitals and letter spacing for a short text, as config: so a preset or an agent sets a label the way a
3
+ * Card's eyebrow is set (`components/widgets/shared/eyebrow-style.ts`) without a style of its own.
4
+ *
5
+ * Steps, not lengths: `wide` is the eyebrow's spacing, `wider` the step above it for a label in larger type.
6
+ */
7
+ export declare const PHI_TEXT_TRANSFORMS: readonly ["none", "uppercase"];
8
+ export type PhiTextTransform = (typeof PHI_TEXT_TRANSFORMS)[number];
9
+ export declare const PHI_LETTER_SPACING_STEPS: {
10
+ readonly normal: "normal";
11
+ readonly wide: "0.04em";
12
+ readonly wider: "0.08em";
13
+ };
14
+ export type PhiLetterSpacingStep = keyof typeof PHI_LETTER_SPACING_STEPS;
15
+ export declare function readPhiTextTransform(value: unknown): PhiTextTransform | undefined;
16
+ export declare function readPhiLetterSpacingStep(value: unknown): PhiLetterSpacingStep | undefined;
17
+ export declare const PHI_TEXT_TRANSFORM_FIELD_OPTIONS: readonly [{
18
+ readonly value: "none";
19
+ readonly label: "As written";
20
+ }, {
21
+ readonly value: "uppercase";
22
+ readonly label: "Capitals";
23
+ }];
24
+ export declare const PHI_LETTER_SPACING_FIELD_OPTIONS: readonly [{
25
+ readonly value: "normal";
26
+ readonly label: "Normal";
27
+ }, {
28
+ readonly value: "wide";
29
+ readonly label: "Wide";
30
+ }, {
31
+ readonly value: "wider";
32
+ readonly label: "Wider";
33
+ }];
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Capitals and letter spacing for a short text, as config: so a preset or an agent sets a label the way a
3
+ * Card's eyebrow is set (`components/widgets/shared/eyebrow-style.ts`) without a style of its own.
4
+ *
5
+ * Steps, not lengths: `wide` is the eyebrow's spacing, `wider` the step above it for a label in larger type.
6
+ */
7
+ export const PHI_TEXT_TRANSFORMS = ["none", "uppercase"];
8
+ export const PHI_LETTER_SPACING_STEPS = {
9
+ normal: "normal",
10
+ wide: "0.04em",
11
+ wider: "0.08em",
12
+ };
13
+ export function readPhiTextTransform(value) {
14
+ return PHI_TEXT_TRANSFORMS.includes(value) ? value : undefined;
15
+ }
16
+ export function readPhiLetterSpacingStep(value) {
17
+ return typeof value === "string" && Object.hasOwn(PHI_LETTER_SPACING_STEPS, value)
18
+ ? value
19
+ : undefined;
20
+ }
21
+ export const PHI_TEXT_TRANSFORM_FIELD_OPTIONS = [
22
+ { value: "none", label: "As written" },
23
+ { value: "uppercase", label: "Capitals" },
24
+ ];
25
+ export const PHI_LETTER_SPACING_FIELD_OPTIONS = [
26
+ { value: "normal", label: "Normal" },
27
+ { value: "wide", label: "Wide" },
28
+ { value: "wider", label: "Wider" },
29
+ ];
@@ -74,7 +74,7 @@ export type PhiInspectorRegionVisibilityLabels = {
74
74
  pageOwned: string;
75
75
  /** How far the Page's `content` reaches up into its Hero (`PhiCmsRegionConfig.heroOverlap`). */
76
76
  heroOverlap: string;
77
- /** `sider_left` opens as a drawer on a phone (`PhiCmsFlags.MobileDrawer`). */
77
+ /** `sider_left` opens as a drawer on a phone: on unless `PhiCmsFlags.MobileColumn` is set. */
78
78
  siderMobileDrawer: string;
79
79
  };
80
80
  export type PhiInspectorLinkTargetLabels = {
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { resolvePhiEyebrowTypeStyle } from "./eyebrow-style";
3
4
  import { useState } from "react";
4
5
  import { PhiButtonControl } from "../../controls/phi-button-control";
5
6
  import { PHI_BACKGROUND_OVERLAY_DEFAULT_OPACITY, resolvePhiBackgroundWidgetStyle, } from "../config/background";
@@ -194,7 +195,7 @@ export function PhiCardWidgetClient({ labels: placedLabels, config, binding, lis
194
195
  const description = textOf("description");
195
196
  const meta = textOf("meta");
196
197
  const badge = textOf("badge");
197
- const eyebrowType = { fontSize: token.fontSizeSM, letterSpacing: "0.04em", textTransform: "uppercase" };
198
+ const eyebrowType = resolvePhiEyebrowTypeStyle(token);
198
199
  /* On the picture's corner where the variant puts it there and there is a picture to put it on. */
199
200
  const eyebrowOnMedia = metrics.eyebrowOnMedia === true && image != null;
200
201
  const heading = title != null ? (_jsx(PhiTypographyControl, { presentation: "title", level: Number(headingLevel.slice(1)), style: { margin: 0, ...headingType[headingLevel], color: PHI_COLOR.textHeading, ...slotWidth }, children: title })) : null;
@@ -0,0 +1,9 @@
1
+ import type { CSSProperties } from "react";
2
+ /**
3
+ * How an eyebrow is set: the small capitals a label stands in above a heading -- a Card's, a Markdown
4
+ * text's. One place, so a label looks the same wherever it stands; the colour is the caller's (a
5
+ * highlighted Card draws it in the primary colour).
6
+ */
7
+ export declare function resolvePhiEyebrowTypeStyle(token: {
8
+ fontSizeSM: number;
9
+ }): CSSProperties;
@@ -0,0 +1,9 @@
1
+ import { PHI_LETTER_SPACING_STEPS } from "../config/text-case-vocabulary";
2
+ /**
3
+ * How an eyebrow is set: the small capitals a label stands in above a heading -- a Card's, a Markdown
4
+ * text's. One place, so a label looks the same wherever it stands; the colour is the caller's (a
5
+ * highlighted Card draws it in the primary colour).
6
+ */
7
+ export function resolvePhiEyebrowTypeStyle(token) {
8
+ return { fontSize: token.fontSizeSM, letterSpacing: PHI_LETTER_SPACING_STEPS.wide, textTransform: "uppercase" };
9
+ }
@@ -1,4 +1,4 @@
1
- import type { PhiClientBlockBaseProps, PhiNoLabels } from "../../../types";
1
+ import type { PhiClientBlockBaseProps } from "../../../types";
2
2
  import type { PhiCodeToken } from "./markdown-code-tokens";
3
3
  import type { PhiMarkdownImageFloat, PhiMarkdownTextAlign } from "../../../types/core-widget-placements";
4
4
  import { type PhiSpacingScaleKey } from "../config/spacing-options";
@@ -100,7 +100,11 @@ export type PhiMarkdownBlock = {
100
100
  kind: "image";
101
101
  image: PhiMarkdownFigure;
102
102
  };
103
- export type PhiMarkdownWidgetClientProps = PhiClientBlockBaseProps<PhiNoLabels, {
103
+ export type PhiMarkdownWidgetClientProps = PhiClientBlockBaseProps<
104
+ /** The label above the text, translated on the server. */
105
+ {
106
+ eyebrow?: string;
107
+ }, {
104
108
  blocks: PhiMarkdownBlock[];
105
109
  error?: string;
106
110
  widgetId?: string | number | null;
@@ -119,4 +123,4 @@ export type PhiMarkdownWidgetClientProps = PhiClientBlockBaseProps<PhiNoLabels,
119
123
  /** How far the text's headings moved down, which moves the level that folds with them. */
120
124
  headingOffset?: number;
121
125
  }>;
122
- export declare function PhiMarkdownWidgetClient({ config }: PhiMarkdownWidgetClientProps): import("react").JSX.Element | null;
126
+ export declare function PhiMarkdownWidgetClient({ config, labels }: PhiMarkdownWidgetClientProps): import("react").JSX.Element | null;
@@ -1,22 +1,32 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Fragment, useEffect, useMemo, useState } from "react";
4
+ import dynamic from "next/dynamic";
4
5
  import { PhiProtectedMailText } from "../../navigation/use-phi-protected-mail";
5
6
  import { PhiLink } from "../../navigation/phi-link";
6
7
  import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../types/signals";
7
8
  import { usePhiSignalEmitter } from "../../runtime/runtime-signal-identity";
8
9
  import { usePhiConfig } from "../../root/phi-config-provider";
9
10
  import { resolvePhiSpacingScaleValue } from "../config/spacing-options";
10
- import { PHI_SPACE } from "../../../theme/antd-css-var-contract";
11
+ import { PHI_COLOR, PHI_SPACE } from "../../../theme/antd-css-var-contract";
12
+ import { resolvePhiEyebrowTypeStyle } from "./eyebrow-style";
11
13
  import { PhiPlainTable } from "../../tables/phi-plain-table";
12
14
  import { PhiTypographyControl } from "../../controls/phi-typography-control";
13
15
  import { PhiDividerControl } from "../../controls/phi-divider-control";
14
16
  import { PhiBulletListControl } from "../../controls/phi-bullet-list-control";
15
- import { PhiImageControl } from "../../controls/phi-image-control";
16
- import { PhiCollapseControl } from "../../controls/phi-collapse-control";
17
17
  import { resolvePhiMarkdownFoldLevel, splitPhiMarkdownSegments, } from "./markdown-sections";
18
18
  import { resolvePhiMarkdownFigureSizes } from "./markdown-image-vocabulary";
19
19
  import { resolvePhiBulletListStyle, } from "./bullet-list-vocabulary";
20
+ /*
21
+ * A picture standing on its own and the folding sections, each its own chunk. Most texts have neither,
22
+ * and the picture brings `next/image` with its loader and blur placeholder, the folds Ant Design's
23
+ * Collapse: statically imported they were on every page with a Markdown text, the Public landing's
24
+ * largest addition since 04.11.2026 (AUDIT-2026-10-13-performance.md, 0g). Rendered on the server as
25
+ * before, so the HTML is the same and a figure's box is reserved from the start; the browser fetches the
26
+ * chunk where one is drawn.
27
+ */
28
+ const PhiImageControl = dynamic(() => import("../../controls/phi-image-control").then((module) => module.PhiImageControl));
29
+ const PhiCollapseControl = dynamic(() => import("../../controls/phi-collapse-control").then((module) => module.PhiCollapseControl));
20
30
  /**
21
31
  * The colour a kind of code is drawn in, from the Theme and from nowhere else.
22
32
  *
@@ -152,7 +162,7 @@ function renderBlocks(blocks, token, paragraphStyle, headingStyle, lists, atStar
152
162
  }
153
163
  });
154
164
  }
155
- export function PhiMarkdownWidgetClient({ config }) {
165
+ export function PhiMarkdownWidgetClient({ config, labels }) {
156
166
  const { token } = usePhiConfig();
157
167
  const blocks = config?.blocks ?? [];
158
168
  const headings = useMemo(() => config?.headings ?? [], [config?.headings]);
@@ -198,18 +208,23 @@ export function PhiMarkdownWidgetClient({ config }) {
198
208
  marginBlockEnd: resolvePhiSpacingScaleValue(config?.headingBlockSpacingAfter ?? "sm"),
199
209
  };
200
210
  const lists = { style: resolvePhiBulletListStyle(config?.list), depth: 1 };
201
- return (_jsx("div", { className: config?.imageFloat
211
+ return (_jsxs("div", { className: config?.imageFloat
202
212
  ? `phi-markdown-text phi-markdown-body phi-markdown-body--float-${config.imageFloat}`
203
213
  : "phi-markdown-text",
204
214
  // The text's line height for everything in it, lists included: a list entry otherwise takes the
205
215
  // browser's `normal`, and its marker centres on a line shorter than the one its words stand on.
206
216
  style: config?.imageFloat
207
217
  ? { display: "flow-root", width: "100%", textAlign: config.textAlign, containerType: "inline-size", lineHeight: token.lineHeight }
208
- : { display: "grid", gap: 0, width: "100%", textAlign: config?.textAlign, lineHeight: token.lineHeight }, children: config?.foldSections && config.foldSections !== "none"
209
- ? splitPhiMarkdownSegments(blocks, resolvePhiMarkdownFoldLevel(config.headingOffset)).map((segment, index) => segment.kind === "text"
210
- ? _jsx(Fragment, { children: renderBlocks(segment.blocks, token, paragraphBlockStyle, headingBlockStyle, lists, index === 0) }, `text-${index}`)
211
- : (_jsx(PhiMarkdownFoldedSections, { sections: segment.sections, accordion: config.foldSections === "accordion", renderBody: (sectionBlocks) => renderBlocks(sectionBlocks, token, paragraphBlockStyle, headingBlockStyle, lists, true) }, `sections-${index}`)))
212
- : renderBlocks(blocks, token, paragraphBlockStyle, headingBlockStyle, lists, true) }));
218
+ : { display: "grid", gap: 0, width: "100%", textAlign: config?.textAlign, lineHeight: token.lineHeight }, children: [labels?.eyebrow ? (_jsx(PhiTypographyControl, { type: "secondary", style: {
219
+ ...resolvePhiEyebrowTypeStyle(token),
220
+ display: "block",
221
+ color: PHI_COLOR.textTertiary,
222
+ marginBlockEnd: PHI_SPACE.xs,
223
+ }, children: labels.eyebrow })) : null, config?.foldSections && config.foldSections !== "none"
224
+ ? splitPhiMarkdownSegments(blocks, resolvePhiMarkdownFoldLevel(config.headingOffset)).map((segment, index) => segment.kind === "text"
225
+ ? _jsx(Fragment, { children: renderBlocks(segment.blocks, token, paragraphBlockStyle, headingBlockStyle, lists, index === 0) }, `text-${index}`)
226
+ : (_jsx(PhiMarkdownFoldedSections, { sections: segment.sections, accordion: config.foldSections === "accordion", renderBody: (sectionBlocks) => renderBlocks(sectionBlocks, token, paragraphBlockStyle, headingBlockStyle, lists, true) }, `sections-${index}`)))
227
+ : renderBlocks(blocks, token, paragraphBlockStyle, headingBlockStyle, lists, true)] }));
213
228
  }
214
229
  /*
215
230
  * The sections that fold: each heading is a header, what follows it the body. Every answer is drawn even
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -481,7 +481,6 @@
481
481
  ],
482
482
  "peerDependencies": {
483
483
  "@ant-design/icons": "^6.3.2",
484
- "@ant-design/nextjs-registry": "^1.3.0",
485
484
  "antd": "^6.5.1",
486
485
  "next": "^16.2.11",
487
486
  "react": "^19.2.8",
@@ -503,7 +502,7 @@
503
502
  "@lexical/rich-text": "0.50.0",
504
503
  "@lexical/selection": "0.50.0",
505
504
  "@lexical/utils": "0.50.0",
506
- "@phis/contracts": "^0.7.6",
505
+ "@phis/contracts": "^0.7.7",
507
506
  "dayjs": "^1.11.23",
508
507
  "dom-serializer": "^2.0.0",
509
508
  "htmlparser2": "^10.1.0",
@@ -97,8 +97,9 @@ export function PhiDeveloperBuilderRegionInspectorWidgetClient({ section, builde
97
97
  title: geometryLabels?.fields.viewport ?? "Viewport",
98
98
  children: (_jsxs("div", { style: { display: "grid", gap: PHI_GAP_SM, width: "100%" }, children: [_jsx(PhiViewportVisibilityControl, { disabled: isPreviewMode || !onDraftChange, value: effectiveDraft.viewportFlags, labels: geometryLabels?.viewport, onChange: (viewportFlags) => updateDraft({ viewportFlags }) }), selectedRegionKey === "sider_left" ? renderPhiInspectorConfigField({
99
99
  field: { key: "mobileDrawer", type: "boolean", label: visibilityLabels.siderMobileDrawer },
100
- value: hasPhiFlag(readPhiFlags(effectiveDraft.regionConfig?.flags), PhiCmsFlags.MobileDrawer),
101
- defaultValue: false,
100
+ // On unless the Sider says it keeps its column (`MobileColumn`).
101
+ value: !hasPhiFlag(readPhiFlags(effectiveDraft.regionConfig?.flags), PhiCmsFlags.MobileColumn),
102
+ defaultValue: true,
102
103
  config: effectiveDraft.regionConfig ?? {},
103
104
  disabled: isPreviewMode || !onDraftChange,
104
105
  onChange: (patch) => {
@@ -106,9 +107,9 @@ export function PhiDeveloperBuilderRegionInspectorWidgetClient({ section, builde
106
107
  updateDraft({
107
108
  regionConfig: {
108
109
  ...(effectiveDraft.regionConfig ?? {}),
109
- flags: patch.mobileDrawer === true
110
- ? flags | PhiCmsFlags.MobileDrawer
111
- : flags & ~PhiCmsFlags.MobileDrawer,
110
+ flags: patch.mobileDrawer === false
111
+ ? flags | PhiCmsFlags.MobileColumn
112
+ : flags & ~PhiCmsFlags.MobileColumn,
112
113
  },
113
114
  });
114
115
  },
@@ -93,7 +93,7 @@ export function PhiEntryMeta({ entry, parts, titleLevel = 3, byline = "above", a
93
93
  * contributes nothing to the page's table of contents.
94
94
  */
95
95
  export function PhiEntryBody({ entry, parts, labels, }) {
96
- return (_jsxs(PhiFlexControl, { vertical: true, gap: PHI_SPACE.xs, children: [entry.blocks.length > 0 ? _jsx(PhiMarkdownWidgetClient, { config: { blocks: entry.blocks } }) : null, hasPhiContentEntryPart(parts, PhiContentEntryPart.Tags) ? _jsx(PhiEntryTags, { tags: entry.tags }) : null, hasPhiContentEntryPart(parts, PhiContentEntryPart.Link) && entry.link ? (_jsx(PhiLink, { href: entry.link.href, external: entry.link.external, newTab: entry.link.newTab, children: labels.readMore })) : null] }));
96
+ return (_jsxs(PhiFlexControl, { vertical: true, gap: PHI_SPACE.xs, children: [entry.blocks.length > 0 ? _jsx(PhiMarkdownWidgetClient, { labels: {}, config: { blocks: entry.blocks } }) : null, hasPhiContentEntryPart(parts, PhiContentEntryPart.Tags) ? _jsx(PhiEntryTags, { tags: entry.tags }) : null, hasPhiContentEntryPart(parts, PhiContentEntryPart.Link) && entry.link ? (_jsx(PhiLink, { href: entry.link.href, external: entry.link.external, newTab: entry.link.newTab, children: labels.readMore })) : null] }));
97
97
  }
98
98
  /**
99
99
  * The parts a list entry's meta shows, and the one left for after its text. The tags lead with the byline
@@ -6,6 +6,12 @@ import type { PhiCmsResolvedContent } from "../../../../../types/cms";
6
6
  import { type PhiBulletListStyle } from "../../../../../components/widgets/shared/bullet-list-vocabulary";
7
7
  import { type PhiCmsWidgetConfigBase } from "../../../../../components/widgets/config/parser-primitives";
8
8
  export type PhiCmsMarkdownWidgetConfig = PhiCmsWidgetConfigBase & {
9
+ /**
10
+ * A section's label above the text -- "The story", "Why phis" -- drawn as a Card's eyebrow is
11
+ * (`eyebrow-style.ts`) and translated like the text. Markdown has no form for it, and a bold line
12
+ * reads as a small title.
13
+ */
14
+ eyebrow?: string;
9
15
  sourceMode?: "inline" | "url";
10
16
  markdown?: string;
11
17
  widgetId?: string | number | null;
@@ -43,6 +43,7 @@ export function parsePhiCmsMarkdownWidgetConfig(config) {
43
43
  const sourceUrl = readString(config.sourceUrl);
44
44
  return {
45
45
  ...readRenderableBlockConfig(config),
46
+ eyebrow: readString(config.eyebrow),
46
47
  sourceMode: readMarkdownSourceMode(config.sourceMode) ?? (sourceUrl ? "url" : "inline"),
47
48
  widgetId: typeof config.widgetId === "number" || typeof config.widgetId === "string" ? config.widgetId : undefined,
48
49
  markdown: readString(config.markdown),
@@ -105,6 +106,7 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
105
106
  },
106
107
  },
107
108
  fields: [
109
+ { key: "eyebrow", type: "string", label: "Eyebrow" },
108
110
  {
109
111
  key: "sourceMode",
110
112
  type: "choice",
@@ -3,7 +3,7 @@ import { PhiWidgetInertPreview } from "../../../../../components/widgets/built-i
3
3
  import { resolveMarkdownRenderData } from "../../../../../components/widgets/shared/markdown-render";
4
4
  import { PhiCmsFlags } from "../../../../../constants/phi-cms";
5
5
  import { hasPhiFlag } from "../../../../../helpers/flags";
6
- import { readPhiMarkdownSearchText } from "../../../../../server-helpers/search-text";
6
+ import { readPhiMarkdownSearchText, translatePhiSearchWidgetTexts } from "../../../../../server-helpers/search-text";
7
7
  import { PhiMarkdownWidget } from "./server";
8
8
  import { PHI_MARKDOWN_WIDGET_DEFINITION, PHI_MARKDOWN_WIDGET_PLUGIN_TYPE, } from "./config";
9
9
  export const PHI_MARKDOWN_WIDGET_PLUGIN = {
@@ -20,7 +20,12 @@ export const PHI_MARKDOWN_WIDGET_PLUGIN = {
20
20
  resolvedContent: widget.resolvedContent ?? null,
21
21
  translate: !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate),
22
22
  }, runtime);
23
- return "error" in data ? [] : readPhiMarkdownSearchText(data.blocks);
23
+ if ("error" in data)
24
+ return [];
25
+ const eyebrow = await translatePhiSearchWidgetTexts(runtime, [config.eyebrow], {
26
+ translate: !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate),
27
+ });
28
+ return [...eyebrow, ...readPhiMarkdownSearchText(data.blocks)];
24
29
  },
25
30
  render: ({ widget, config, runtime }) => (_jsx(PhiMarkdownWidget, { config: {
26
31
  ...config,
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
3
+ import { trBulk, trBulkForLocale } from "../../../../../server-helpers/translate";
3
4
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
4
5
  import { resolveMarkdownRenderData } from "../../../../../components/widgets/shared/markdown-render";
5
6
  import { buildPhiMarkdownFaqStructuredData, resolvePhiMarkdownFoldLevel } from "../../../../../components/widgets/shared/markdown-sections";
@@ -16,7 +17,11 @@ export async function PhiMarkdownWidget({ config, runtime, }) {
16
17
  * out of a Content record -- went to the page's payload as well, every address in it in the clear while
17
18
  * the blocks protected them (`helpers/protected-mail.ts`).
18
19
  */
19
- const { markdown: _markdown, resolvedContent: _resolvedContent, ...presentation } = config ?? {};
20
+ const { markdown: _markdown, resolvedContent: _resolvedContent, eyebrow: sourceEyebrow, ...presentation } = config ?? {};
21
+ // The label above the text, translated as the text is: not where the node says `NoTranslate`.
22
+ const [eyebrow] = sourceEyebrow && config?.translate !== false
23
+ ? await (runtime?.locale.current ? trBulkForLocale(runtime.locale.current, [sourceEyebrow]) : trBulk([sourceEyebrow]))
24
+ : [sourceEyebrow];
20
25
  /*
21
26
  * The folding sections as questions and answers, written into the page for search engines: data, never
22
27
  * run, and its `<` escaped so no answer can close the element it stands in.
@@ -25,6 +30,7 @@ export async function PhiMarkdownWidget({ config, runtime, }) {
25
30
  ? buildPhiMarkdownFaqStructuredData(renderData.blocks, resolvePhiMarkdownFoldLevel(config.headingOffset))
26
31
  : null;
27
32
  return (_jsxs(_Fragment, { children: [faq ? (_jsx("script", { type: "application/ld+json", dangerouslySetInnerHTML: { __html: JSON.stringify(faq).replace(/</gu, "\\u003c") } })) : null, _jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Markdown, componentProps: {
33
+ labels: { eyebrow: eyebrow || undefined },
28
34
  config: {
29
35
  ...presentation,
30
36
  blocks: renderData.blocks,
@@ -4,7 +4,7 @@ import { useEffect, useState } from "react";
4
4
  import { PhiLink } from "../../../../../components/navigation/phi-link";
5
5
  import { PhiIcon } from "../../../../../components/shell/phi-icon";
6
6
  import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
7
- import { PHI_CONTAINER_BREAKPOINT_COL2, PHI_CONTAINER_BREAKPOINT_COL3, } from "../../../../../theme/phi-container-breakpoints";
7
+ import { PHI_CONTAINER_BREAKPOINT_COL2 } from "../../../../../theme/phi-container-breakpoints";
8
8
  import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
9
9
  import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
10
10
  import { usePhiPathname } from "../../../../../components/runtime/use-phi-pathname";
@@ -15,10 +15,6 @@ function useQuickLinksContainerWidth() {
15
15
  */
16
16
  const [node, ref] = useState(null);
17
17
  const [width, setWidth] = useState(0);
18
- const breakpoints = {
19
- col2: PHI_CONTAINER_BREAKPOINT_COL2,
20
- col3: PHI_CONTAINER_BREAKPOINT_COL3,
21
- };
22
18
  useEffect(() => {
23
19
  if (!node) {
24
20
  return;
@@ -39,7 +35,7 @@ function useQuickLinksContainerWidth() {
39
35
  observer.disconnect();
40
36
  };
41
37
  }, [node]);
42
- return { ref, width, breakpoints };
38
+ return { ref, width };
43
39
  }
44
40
  function groupQuickLinksItems(items, columns) {
45
41
  const resolvedColumnCount = Math.min(columns, Math.max(1, items.length));
@@ -56,12 +52,19 @@ function groupQuickLinksItems(items, columns) {
56
52
  }
57
53
  export function PhiQuickLinksWidgetClient({ labels, config, }) {
58
54
  const { token } = usePhiConfig();
59
- const { ref, width, breakpoints } = useQuickLinksContainerWidth();
55
+ const { ref, width } = useQuickLinksContainerWidth();
60
56
  const pathname = usePhiPathname();
61
57
  const maxColumns = config?.columns === 1 || config?.columns === 3 ? config.columns : 2;
62
58
  const interactive = config?.interactive !== false;
63
59
  const items = config?.items ?? [];
64
- const effectiveColumnsByWidth = width >= breakpoints.col3 ? 3 : width >= breakpoints.col2 ? 2 : 1;
60
+ /*
61
+ * As many columns as fit with each at least `PHI_CONTAINER_BREAKPOINT_COL2` wide, the space between
62
+ * two columns (`paddingMD` on either side of their edge) counted. The ruler's step was once read as
63
+ * the width two columns need together, so a footer 275px wide still split "Terms & Conditions" across
64
+ * two lines beside a second column.
65
+ */
66
+ const columnGutter = token.paddingMD * 2;
67
+ const effectiveColumnsByWidth = Math.max(1, Math.min(3, Math.floor((width + columnGutter) / (PHI_CONTAINER_BREAKPOINT_COL2 + columnGutter))));
65
68
  const effectiveColumns = maxColumns === 1
66
69
  ? 1
67
70
  : maxColumns === 2
@@ -1,3 +1,4 @@
1
+ import { type PhiLetterSpacingStep, type PhiTextTransform } from "../../../../../components/widgets/config/text-case-vocabulary";
1
2
  import type { PhiClientBlockBaseProps, PhiCmsInstanceId, PhiRenderableBlockRenderMode } from "../../../../../types";
2
3
  import type { PhiTextTone } from "../../../../../components/widgets/config/text-tone";
3
4
  import type { PhiSimpleTextMark } from "../../../../../types/core-widget-placements";
@@ -16,6 +17,8 @@ export type PhiSimpleTextWidgetClientConfig = {
16
17
  newTab?: boolean;
17
18
  tone?: PhiTextTone;
18
19
  marks?: PhiSimpleTextMark[];
20
+ textTransform?: PhiTextTransform;
21
+ letterSpacing?: PhiLetterSpacingStep;
19
22
  disabled?: boolean;
20
23
  };
21
24
  export type PhiSimpleTextWidgetClientProps = PhiClientBlockBaseProps<PhiSimpleTextWidgetClientLabels, PhiSimpleTextWidgetClientConfig> & {
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { PHI_LETTER_SPACING_STEPS, } from "../../../../../components/widgets/config/text-case-vocabulary";
3
4
  import { isPhiRecord } from "../../../../../helpers/is-record";
4
5
  import { useState } from "react";
5
6
  import { createPhiRenderableBlockReceiver, usePhiRenderableBlockSignalListener, } from "../../../../../components/runtime/renderable-block-runtime";
@@ -123,6 +124,8 @@ export function PhiSimpleTextWidgetClient({ blockId, labels, config, }) {
123
124
  fontSize: resolvedFontSize ?? "inherit",
124
125
  lineHeight: resolvedFontSize ? PHI_LINE_HEIGHT_LG : "inherit",
125
126
  ...(resolvedFontFamily ? { fontFamily: resolvedFontFamily } : {}),
127
+ ...(config?.textTransform === "uppercase" ? { textTransform: "uppercase" } : {}),
128
+ ...(config?.letterSpacing ? { letterSpacing: PHI_LETTER_SPACING_STEPS[config.letterSpacing] } : {}),
126
129
  }, children: textValue })] }));
127
130
  if (!hasHref) {
128
131
  return contentNode;
@@ -3,6 +3,7 @@ import { type PhiSimpleTextMark } from "../../../../../types/core-widget-placeme
3
3
  import type { PhiCmsResolvedContent } from "../../../../../types";
4
4
  import type { PhiWidgetFontFamilyKey, PhiWidgetFontSizeKey } from "../../../../../types/site-theme";
5
5
  import { type PhiCmsWidgetConfigBase } from "../../../../../components/widgets/config/parser-primitives";
6
+ import { type PhiLetterSpacingStep, type PhiTextTransform } from "../../../../../components/widgets/config/text-case-vocabulary";
6
7
  import { type PhiTextTone } from "../../../../../components/widgets/config/text-tone";
7
8
  export type PhiCmsSimpleTextWidgetConfig = PhiCmsWidgetConfigBase & {
8
9
  text?: string;
@@ -15,6 +16,10 @@ export type PhiCmsSimpleTextWidgetConfig = PhiCmsWidgetConfigBase & {
15
16
  newTab?: boolean;
16
17
  tone?: PhiTextTone;
17
18
  marks?: PhiSimpleTextMark[];
19
+ /** Capitals for a label (`text-case-vocabulary.ts`); absent, as written. */
20
+ textTransform?: PhiTextTransform;
21
+ /** A spacing step for a label in capitals; absent, normal. */
22
+ letterSpacing?: PhiLetterSpacingStep;
18
23
  disabled?: boolean;
19
24
  /** `"preset"` while the words are a Preset's and translated globally (`helpers/text-source.ts`). */
20
25
  textSource?: PhiTextSource;
@@ -355,6 +360,31 @@ export declare const PHI_SIMPLE_TEXT_WIDGET_DEFINITION: {
355
360
  readonly value: "danger";
356
361
  readonly label: "Danger";
357
362
  })[];
363
+ } | {
364
+ key: string;
365
+ type: "choice";
366
+ label: string;
367
+ options: ({
368
+ readonly value: "none";
369
+ readonly label: "As written";
370
+ } | {
371
+ readonly value: "uppercase";
372
+ readonly label: "Capitals";
373
+ })[];
374
+ } | {
375
+ key: string;
376
+ type: "choice";
377
+ label: string;
378
+ options: ({
379
+ readonly value: "normal";
380
+ readonly label: "Normal";
381
+ } | {
382
+ readonly value: "wide";
383
+ readonly label: "Wide";
384
+ } | {
385
+ readonly value: "wider";
386
+ readonly label: "Wider";
387
+ })[];
358
388
  })[];
359
389
  defaultConfig: {
360
390
  maxSize: {
@@ -6,6 +6,7 @@ import { PHI_RENDERABLE_BLOCK_GEOMETRY_FIELDS } from "../../../../../helpers/ren
6
6
  import { readBoolean, readRenderableBlockConfig, readString, } from "../../../../../components/widgets/config/parser-primitives";
7
7
  import { PHI_WIDGET_FONT_FAMILY_OPTIONS, readPhiWidgetFontFamily, } from "../../../../../components/widgets/helpers/font-family";
8
8
  import { PHI_WIDGET_FONT_SIZE_OPTIONS, readPhiWidgetFontSize, } from "../../../../../components/widgets/helpers/font-size";
9
+ import { PHI_LETTER_SPACING_FIELD_OPTIONS, PHI_TEXT_TRANSFORM_FIELD_OPTIONS, readPhiLetterSpacingStep, readPhiTextTransform, } from "../../../../../components/widgets/config/text-case-vocabulary";
9
10
  import { PHI_TEXT_TONE_FIELD_OPTIONS, readPhiTextTone, } from "../../../../../components/widgets/config/text-tone";
10
11
  function readSimpleTextMarks(value) {
11
12
  if (!Array.isArray(value)) {
@@ -27,6 +28,8 @@ function parsePhiCmsSimpleTextWidgetConfig(config) {
27
28
  newTab: readBoolean(config.newTab),
28
29
  tone: readPhiTextTone(config.tone),
29
30
  marks: readSimpleTextMarks(config.marks),
31
+ textTransform: readPhiTextTransform(config.textTransform),
32
+ letterSpacing: readPhiLetterSpacingStep(config.letterSpacing),
30
33
  disabled: readBoolean(config.disabled),
31
34
  textSource: readPhiTextSource(config.textSource),
32
35
  };
@@ -72,6 +75,18 @@ export const PHI_SIMPLE_TEXT_WIDGET_DEFINITION = {
72
75
  label: "Tone",
73
76
  options: [...PHI_TEXT_TONE_FIELD_OPTIONS],
74
77
  },
78
+ {
79
+ key: "textTransform",
80
+ type: "choice",
81
+ label: "Case",
82
+ options: [...PHI_TEXT_TRANSFORM_FIELD_OPTIONS],
83
+ },
84
+ {
85
+ key: "letterSpacing",
86
+ type: "choice",
87
+ label: "Letter Spacing",
88
+ options: [...PHI_LETTER_SPACING_FIELD_OPTIONS],
89
+ },
75
90
  { key: "external", type: "boolean", label: "External" },
76
91
  { key: "newTab", type: "boolean", label: "Open In New Tab" },
77
92
  { key: "marks", type: "string", label: "Marks", editorPlacement: "toolbar" },
package/styles/layout.css CHANGED
@@ -696,6 +696,39 @@
696
696
  height: 100%;
697
697
  }
698
698
 
699
+ /*
700
+ * A card is at least as tall as its content, and its content fills it by stretching, never by a
701
+ * percentage.
702
+ *
703
+ * The grid row takes its height from the cards. With `min-height: 0` on the card and its anchor, and
704
+ * `height: 100%` down the chain under it -- anchor, its content, the slot child, the Layout -- the
705
+ * content gave the row no lower bound of its own. Safari then keeps the row's height when the Split
706
+ * Card's width changes (fresh layouts are right): the window narrows, the text wraps onto more lines,
707
+ * and it runs out of a card that stays as tall as it was; widened again, the card stays too tall.
708
+ * `min-height: auto` on the card and the anchor carries the content's height into the row, which is
709
+ * what fixes it; stretching instead of percentages keeps the content filling the card. Every step is
710
+ * a flex row, so stretching gives the same height. Only the direct chain, child by child: a Layout
711
+ * further in keeps its own rules. `!important` where the anchor and the slot child state the old values
712
+ * inline.
713
+ */
714
+ /* The card itself: `:where([data-layout-kind])` gives every Layout element `min-height: 0`. */
715
+ .phi-split-card__grid > * {
716
+ min-height: auto;
717
+ }
718
+
719
+ .phi-split-card__grid > * > .phi-layout-scaffold-anchor--flow {
720
+ height: auto !important;
721
+ min-height: auto !important;
722
+ }
723
+
724
+ .phi-split-card__grid > * > .phi-layout-scaffold-anchor--flow > .phi-layout-scaffold-anchor__content[data-phi-slot-size-block="fill"],
725
+ .phi-split-card__grid > * > .phi-layout-scaffold-anchor--flow > .phi-layout-scaffold-anchor__content > .phi-slot-child--block-fill,
726
+ .phi-split-card__grid > * > .phi-layout-scaffold-anchor--flow > .phi-layout-scaffold-anchor__content > .phi-slot-child--block-fill > .phi-layout {
727
+ height: auto !important;
728
+ max-height: none !important;
729
+ align-self: stretch;
730
+ }
731
+
699
732
  @container phi-split-card (width < 36rem) {
700
733
  .phi-split-card__grid {
701
734
  grid-template-columns: minmax(0, 1fr);
@@ -1,6 +1,7 @@
1
1
  import type { PhiBulletListEntry, PhiBulletListStyle } from "../components/widgets/shared/bullet-list-vocabulary";
2
2
  import type { PhiMarkdownImageAspectRatio } from "../components/widgets/shared/markdown-image-vocabulary";
3
3
  import type { PhiMarkdownFoldSections } from "../components/widgets/shared/markdown-sections";
4
+ import type { PhiLetterSpacingStep, PhiTextTransform } from "../components/widgets/config/text-case-vocabulary";
4
5
  import type { PhiRenderableBlockBase } from "./renderable-block";
5
6
  import type { PhiTextSource } from "../helpers/text-source";
6
7
  import type { PhiRuntimeConditionExpression } from "./runtime-condition";
@@ -48,6 +49,8 @@ export type PhiMarkdownTextAlign = "start" | "center" | "end" | "justify";
48
49
  /** Which edge the text's pictures stand at, with the words flowing past them; logical like the align. */
49
50
  export type PhiMarkdownImageFloat = "start" | "end";
50
51
  export type PhiMarkdownWidgetPlacement = PhiWidgetPlacementBase & {
52
+ /** A section's label above the text, drawn as a Card's eyebrow; translated like the text. */
53
+ eyebrow?: string;
51
54
  sourceMode?: "inline" | "url";
52
55
  markdown?: string;
53
56
  sourceUrl?: string;
@@ -80,6 +83,10 @@ export type PhiSimpleTextWidgetPlacement = PhiWidgetPlacementBase & {
80
83
  newTab?: boolean;
81
84
  tone?: PhiTextTone;
82
85
  marks?: PhiSimpleTextMark[];
86
+ /** Capitals for a label; absent, as written. */
87
+ textTransform?: PhiTextTransform;
88
+ /** A spacing step for a label in capitals; absent, normal. */
89
+ letterSpacing?: PhiLetterSpacingStep;
83
90
  disabled?: boolean;
84
91
  /** `"preset"` while the words are a Preset's (`helpers/text-source.ts`). */
85
92
  textSource?: PhiTextSource;