@phis/ui 0.4.14 → 0.4.16
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.
- package/README.md +0 -1
- package/components/cms/phi-cms-layout-renderer.js +2 -1
- package/components/cms/phi-cms-root-layout.js +1 -1
- package/components/layouts/clients/phi-split-card-layout-client.js +6 -2
- package/components/regions/clients/cms-region-container-client.d.ts +3 -1
- package/components/regions/clients/cms-region-container-client.js +2 -1
- package/components/regions/phi-cms-region-container.d.ts +3 -1
- package/components/regions/phi-cms-region-container.js +3 -2
- package/components/regions/phi-cms-region-shell.d.ts +16 -1
- package/components/regions/phi-cms-region-shell.js +40 -11
- package/components/regions/phi-cms-region-static.d.ts +3 -1
- package/components/regions/phi-cms-region-static.js +2 -1
- package/components/regions/presets/phi-area-shell-preset-nodes.js +3 -2
- package/components/root/phi-antd-registry.d.ts +15 -0
- package/components/root/phi-antd-registry.js +29 -0
- package/components/root/phi-root-layout.js +2 -2
- package/components/shell/phi-shell-sider-drawer.d.ts +1 -1
- package/components/shell/phi-shell-sider-drawer.js +1 -1
- package/components/widgets/config/text-case-vocabulary.d.ts +33 -0
- package/components/widgets/config/text-case-vocabulary.js +29 -0
- package/components/widgets/label-types/inspector.d.ts +1 -1
- package/components/widgets/shared/card-body-client.js +2 -1
- package/components/widgets/shared/eyebrow-style.d.ts +9 -0
- package/components/widgets/shared/eyebrow-style.js +9 -0
- package/components/widgets/shared/markdown-body-client.d.ts +7 -3
- package/components/widgets/shared/markdown-body-client.js +26 -11
- package/helpers/renderable-block-defaults.js +1 -0
- package/helpers/renderable-block-serialization.js +7 -1
- package/package.json +3 -4
- package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +13 -0
- package/plugins/runtime-modules/builder/clients/region-inspector.js +6 -5
- package/plugins/runtime-modules/builder/page-meta-form.js +11 -0
- package/plugins/runtime-modules/core/widgets/entry-list/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +6 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +2 -0
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +7 -2
- package/plugins/runtime-modules/core/widgets/markdown/server.js +7 -1
- package/plugins/runtime-modules/core/widgets/quick-links/client.js +11 -8
- package/plugins/runtime-modules/core/widgets/simple-text/client.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/simple-text/client.js +3 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +30 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +15 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +15 -1
- package/styles/layout.css +33 -0
- package/styles/root.css +2 -0
- package/styles/shell.css +41 -18
- package/types/core-widget-placements.d.ts +7 -0
- package/types/renderable-block.d.ts +5 -0
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ import { PhiFlexVerticalLayout } from "../layouts/phi-flex-vertical-layout";
|
|
|
11
11
|
import { resolvePhiSlotChildSizingForConfig, } from "../../plugins/runtime/slot-size-policy";
|
|
12
12
|
import { PhiSlotChildFrame } from "../../plugins/runtime/phi-slot-child-frame";
|
|
13
13
|
import { PhiCmsRegionContainer } from "../regions/phi-cms-region-container";
|
|
14
|
+
import { phiCmsRegionRootLayoutPaintsGround } from "../regions/phi-cms-region-shell";
|
|
14
15
|
import { PhiCmsRenderErrorBoundary } from "./phi-cms-render-error-boundary";
|
|
15
16
|
import { PhiCmsRenderDiagnostic } from "./phi-cms-render-diagnostic";
|
|
16
17
|
import { resolvePhiRuntimeLayoutPluginByTypeKey, resolvePhiRuntimeLayoutPluginConfigParser, } from "../../plugins/runtime/layout-plugin-resolution";
|
|
@@ -792,7 +793,7 @@ export async function PhiCmsLayoutRenderer({ tree, runtime, regionClassName, reg
|
|
|
792
793
|
layoutPluginsByType.get(resolveLayoutRegistryType(root.widgetType))?.runtimeSignals != null,
|
|
793
794
|
})
|
|
794
795
|
: null;
|
|
795
|
-
return (_jsx(PhiCmsRegionContainer, { className: regionClassName, regionKey: regionKey, regionType: region.regionType, config: region.config, pageScope: resolvePhiCmsRegionPageScope(readPhiCmsRegionPageScope(regionKey, region.config), links, runtime.site.availableLocales.map((option) => option.code)), shellTheme: runtime.site.theme?.shell, previewMode: root?.config.renderMode === "preview", runtime: runtime, signalParticipant: signalParticipants.has(createPhiSignalAddress("region", regionKey)), children: renderedRoot }, `region-${region.id}`));
|
|
796
|
+
return (_jsx(PhiCmsRegionContainer, { className: regionClassName, regionKey: regionKey, regionType: region.regionType, config: region.config, pageScope: resolvePhiCmsRegionPageScope(readPhiCmsRegionPageScope(regionKey, region.config), links, runtime.site.availableLocales.map((option) => option.code)), shellTheme: runtime.site.theme?.shell, previewMode: root?.config.renderMode === "preview", rootPaintsGround: phiCmsRegionRootLayoutPaintsGround(root?.config), runtime: runtime, signalParticipant: signalParticipants.has(createPhiSignalAddress("region", regionKey)), children: renderedRoot }, `region-${region.id}`));
|
|
796
797
|
});
|
|
797
798
|
if (renderedRegions.length === 1) {
|
|
798
799
|
return renderedRegions[0];
|
|
@@ -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.
|
|
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
|
-
|
|
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",
|
|
@@ -18,6 +18,8 @@ type PhiCmsRegionContainerClientProps = {
|
|
|
18
18
|
pageScope?: PhiCmsResolvedRegionPageScope | null;
|
|
19
19
|
/** The Site's locales, handed over only where the Region has a Page scope to ask. */
|
|
20
20
|
availableLocales?: string[];
|
|
21
|
+
/** Whether the Region's top Layout paints a ground of its own (`phiCmsRegionRootLayoutPaintsGround`). */
|
|
22
|
+
rootPaintsGround?: boolean;
|
|
21
23
|
};
|
|
22
24
|
/**
|
|
23
25
|
* A Region that stays alive after it has rendered: it takes signals, runs effects, collapses, or moves
|
|
@@ -25,5 +27,5 @@ type PhiCmsRegionContainerClientProps = {
|
|
|
25
27
|
* fed with the config merged with the live runtime state and painted in the live colour mode. What is
|
|
26
28
|
* left here is what only a live Region has.
|
|
27
29
|
*/
|
|
28
|
-
export declare function PhiCmsRegionContainerClient({ children, className, regionKey, config: initialConfig, shellTheme, style, regionType, previewMode, runtime, routeScope, pageScope: resolvedPageScope, availableLocales, }: PhiCmsRegionContainerClientProps): import("react").JSX.Element | null;
|
|
30
|
+
export declare function PhiCmsRegionContainerClient({ children, className, regionKey, config: initialConfig, shellTheme, style, regionType, previewMode, runtime, routeScope, pageScope: resolvedPageScope, availableLocales, rootPaintsGround, }: PhiCmsRegionContainerClientProps): import("react").JSX.Element | null;
|
|
29
31
|
export {};
|
|
@@ -32,7 +32,7 @@ import { usePhiRegionRevealed, usePhiShellHeaderTopRoom } from "./use-phi-region
|
|
|
32
32
|
* fed with the config merged with the live runtime state and painted in the live colour mode. What is
|
|
33
33
|
* left here is what only a live Region has.
|
|
34
34
|
*/
|
|
35
|
-
export function PhiCmsRegionContainerClient({ children, className, regionKey, config: initialConfig, shellTheme, style, regionType, previewMode = false, runtime, routeScope, pageScope: resolvedPageScope = null, availableLocales, }) {
|
|
35
|
+
export function PhiCmsRegionContainerClient({ children, className, regionKey, config: initialConfig, shellTheme, style, regionType, previewMode = false, runtime, routeScope, pageScope: resolvedPageScope = null, availableLocales, rootPaintsGround = false, }) {
|
|
36
36
|
const { mode: liveThemeMode, token } = usePhiConfig();
|
|
37
37
|
const receiver = createPhiRenderableBlockReceiver("region", regionKey);
|
|
38
38
|
const anchorRef = usePhiVisualAnchor(receiver);
|
|
@@ -142,6 +142,7 @@ export function PhiCmsRegionContainerClient({ children, className, regionKey, co
|
|
|
142
142
|
regionType,
|
|
143
143
|
className,
|
|
144
144
|
style,
|
|
145
|
+
rootPaintsGround,
|
|
145
146
|
});
|
|
146
147
|
if (shell == null) {
|
|
147
148
|
return null;
|
|
@@ -15,6 +15,8 @@ export type PhiCmsRegionContainerProps = {
|
|
|
15
15
|
signalParticipant?: boolean;
|
|
16
16
|
/** The Pages this Region stands on, resolved for this render; null where it stands on every Page. */
|
|
17
17
|
pageScope?: PhiCmsResolvedRegionPageScope | null;
|
|
18
|
+
/** Whether the Region's top Layout paints a ground of its own (`phiCmsRegionRootLayoutPaintsGround`). */
|
|
19
|
+
rootPaintsGround?: boolean;
|
|
18
20
|
};
|
|
19
|
-
export declare function PhiCmsRegionContainer({ children, className, regionKey, config, shellTheme, style, regionType, previewMode, runtime, signalParticipant, pageScope, }: PhiCmsRegionContainerProps): import("react").JSX.Element;
|
|
21
|
+
export declare function PhiCmsRegionContainer({ children, className, regionKey, config, shellTheme, style, regionType, previewMode, runtime, signalParticipant, pageScope, rootPaintsGround, }: PhiCmsRegionContainerProps): import("react").JSX.Element;
|
|
20
22
|
export {};
|
|
@@ -9,7 +9,7 @@ import { PhiRuntimeModuleRenderClientHost } from "../runtime/runtime-module-rend
|
|
|
9
9
|
import { PhiRuntimeRenderClientType } from "../../constants/runtime-render-client-types";
|
|
10
10
|
import { resolvePhiBackgroundMotion } from "../widgets/config/background";
|
|
11
11
|
import { readPhiCmsRegionReveal } from "../../helpers/region-page-scope";
|
|
12
|
-
export function PhiCmsRegionContainer({ children, className, regionKey, config, shellTheme, style, regionType, previewMode = false, runtime, signalParticipant = false, pageScope = null, }) {
|
|
12
|
+
export function PhiCmsRegionContainer({ children, className, regionKey, config, shellTheme, style, regionType, previewMode = false, runtime, signalParticipant = false, pageScope = null, rootPaintsGround = false, }) {
|
|
13
13
|
const routeScope = isPhiCmsPageOwnedRegion(regionKey) ? "page" : "area";
|
|
14
14
|
const effectsConfig = config?.effects == null ? undefined : { effects: config.effects };
|
|
15
15
|
const effectsAttributes = resolveRenderableBlockEffectsAttributes(effectsConfig);
|
|
@@ -32,7 +32,7 @@ export function PhiCmsRegionContainer({ children, className, regionKey, config,
|
|
|
32
32
|
requiresEffectsObserver ||
|
|
33
33
|
resolvePhiBackgroundMotion(config?.surface?.background) != null;
|
|
34
34
|
if (!requiresClientEnhancement) {
|
|
35
|
-
return (_jsx(PhiCmsRegionStatic, { className: className, regionKey: regionKey, config: config, shellTheme: shellTheme, style: style, regionType: regionType, previewMode: previewMode, children: children }));
|
|
35
|
+
return (_jsx(PhiCmsRegionStatic, { className: className, regionKey: regionKey, config: config, shellTheme: shellTheme, style: style, regionType: regionType, previewMode: previewMode, rootPaintsGround: rootPaintsGround, children: children }));
|
|
36
36
|
}
|
|
37
37
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiRuntimeRenderClientType.RegionContainerEnhancer, componentProps: {
|
|
38
38
|
children,
|
|
@@ -43,6 +43,7 @@ export function PhiCmsRegionContainer({ children, className, regionKey, config,
|
|
|
43
43
|
style,
|
|
44
44
|
regionType,
|
|
45
45
|
previewMode,
|
|
46
|
+
rootPaintsGround,
|
|
46
47
|
runtime: {
|
|
47
48
|
siteKey: runtime.site.key,
|
|
48
49
|
publicUrl: runtime.site.publicUrl ?? null,
|
|
@@ -38,6 +38,7 @@ export type PhiCmsRegionShellAttributes = PhiRenderableBlockEffectsAttributes &
|
|
|
38
38
|
"data-phi-region-key": PhiCmsRegionKey;
|
|
39
39
|
"data-phi-region-type": number | undefined;
|
|
40
40
|
"data-phi-shell-chrome": "true" | undefined;
|
|
41
|
+
"data-phi-shell-own-ground": "band" | "box" | undefined;
|
|
41
42
|
"data-phi-renderable-block": "true";
|
|
42
43
|
"data-phi-signal-receiver": string;
|
|
43
44
|
"data-phi-block-visibility": string;
|
|
@@ -63,6 +64,13 @@ export type PhiCmsRegionShellInput = {
|
|
|
63
64
|
regionType?: number;
|
|
64
65
|
className?: string;
|
|
65
66
|
style?: CSSProperties;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the Layout at the top of this Region paints a ground of its own
|
|
69
|
+
* (`phiCmsRegionRootLayoutPaintsGround`). Such a band brings its own chrome -- a floating Header bar is
|
|
70
|
+
* the case it was made for -- so it neither paints the Theme's Chrome Overlay itself nor lets its
|
|
71
|
+
* family's pane paint one behind it (SHELL.md "A band with a ground of its own").
|
|
72
|
+
*/
|
|
73
|
+
rootPaintsGround?: boolean;
|
|
66
74
|
};
|
|
67
75
|
export type PhiCmsRegionShell = {
|
|
68
76
|
family: PhiCmsRegionShellFamily;
|
|
@@ -118,5 +126,12 @@ export declare function phiCmsRegionFooterSticks(regionKey: PhiCmsRegionKey, con
|
|
|
118
126
|
* The Region's shell, or null where the Region renders nothing: hidden, or collapsed in a preview.
|
|
119
127
|
* `header_bottom` is exempt from the preview collapse because the Page, not the Area, owns its content.
|
|
120
128
|
*/
|
|
121
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Whether a Region's top Layout paints a ground of its own: a tone, or a Background that paints something
|
|
131
|
+
* in either mode. Only the top Layout counts -- a Card or a Button somewhere inside a Header is content,
|
|
132
|
+
* not the band's chrome. "Paints" is `phiBackgroundWidgetConfigPaintsGround`'s answer, so the empty
|
|
133
|
+
* Background record the Builder stores on every box it has opened is no ground.
|
|
134
|
+
*/
|
|
135
|
+
export declare function phiCmsRegionRootLayoutPaintsGround(rootConfig: unknown): boolean;
|
|
136
|
+
export declare function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint, animatesBackground, previewMode, regionType, className, style, rootPaintsGround, }: PhiCmsRegionShellInput): PhiCmsRegionShell | null;
|
|
122
137
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolvePhiSurfaceToneClassName } from "../../types/surface";
|
|
1
|
+
import { readPhiSurface, resolvePhiSurfaceToneClassName } from "../../types/surface";
|
|
2
2
|
import { composePhiModePaint, resolvePhiModeValue } from "../../helpers/mode-paint";
|
|
3
3
|
import { PHI_THEME_BORDER_LINE, resolvePhiBorderWidgetStyle } from "../../helpers/border-widget-style";
|
|
4
4
|
import { hasPhiFlag } from "../../helpers/flags";
|
|
@@ -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.
|
|
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) {
|
|
@@ -129,7 +129,22 @@ function resolveRegionBorderLine(surface) {
|
|
|
129
129
|
* The Region's shell, or null where the Region renders nothing: hidden, or collapsed in a preview.
|
|
130
130
|
* `header_bottom` is exempt from the preview collapse because the Page, not the Area, owns its content.
|
|
131
131
|
*/
|
|
132
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Whether a Region's top Layout paints a ground of its own: a tone, or a Background that paints something
|
|
134
|
+
* in either mode. Only the top Layout counts -- a Card or a Button somewhere inside a Header is content,
|
|
135
|
+
* not the band's chrome. "Paints" is `phiBackgroundWidgetConfigPaintsGround`'s answer, so the empty
|
|
136
|
+
* Background record the Builder stores on every box it has opened is no ground.
|
|
137
|
+
*/
|
|
138
|
+
export function phiCmsRegionRootLayoutPaintsGround(rootConfig) {
|
|
139
|
+
const surface = readPhiSurface(rootConfig != null && typeof rootConfig === "object" ? rootConfig.surface : null);
|
|
140
|
+
if (!surface) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
return resolvePhiSurfaceToneClassName(surface.tone) != null
|
|
144
|
+
|| phiBackgroundWidgetConfigPaintsGround(surface.background ?? null)
|
|
145
|
+
|| phiBackgroundWidgetConfigPaintsGround(surface.backgroundDark ?? null);
|
|
146
|
+
}
|
|
147
|
+
export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint, animatesBackground = false, previewMode = false, regionType, className, style, rootPaintsGround = false, }) {
|
|
133
148
|
const visibility = config.visibility ?? "visible";
|
|
134
149
|
const enabled = config.enabled ?? true;
|
|
135
150
|
if (visibility === "hidden" ||
|
|
@@ -292,14 +307,16 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
292
307
|
* the stored one: the Builder persists an empty Background record for every Region an author has ever
|
|
293
308
|
* opened, and the raw value is never null for those.
|
|
294
309
|
*/
|
|
295
|
-
const usesShellChromeOverlay =
|
|
296
|
-
?
|
|
297
|
-
:
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
310
|
+
const usesShellChromeOverlay = rootPaintsGround
|
|
311
|
+
? false
|
|
312
|
+
: themeGround
|
|
313
|
+
? themeGroundIsShellChrome
|
|
314
|
+
: !toneGround && phiRegionUsesShellChromeOverlay({
|
|
315
|
+
regionKey,
|
|
316
|
+
backgroundConfig,
|
|
317
|
+
pane: shellPane,
|
|
318
|
+
grounds: [chrome.light.background, chrome.dark.background],
|
|
319
|
+
});
|
|
303
320
|
/*
|
|
304
321
|
* The ground. Published, it is the pair of custom properties `shell.css` paints from, because it may
|
|
305
322
|
* be a colour or a gradient and only CSS can tell which without guessing; nothing inline may name a
|
|
@@ -441,6 +458,18 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
441
458
|
"data-phi-region-key": regionKey,
|
|
442
459
|
"data-phi-region-type": regionType,
|
|
443
460
|
"data-phi-shell-chrome": usesShellChromeOverlay ? "true" : undefined,
|
|
461
|
+
/*
|
|
462
|
+
* A band with a ground of its own (SHELL.md): `band` where the Region paints it -- a tone, or an
|
|
463
|
+
* authored Background other than the Theme's Overlay taken as the Shell's -- and `box` where its top
|
|
464
|
+
* Layout does, which is a bar inside the band rather than the band. `shell.css` lets the family's
|
|
465
|
+
* pane step aside for either, and for a `box` takes the pane's Shadow away too: the frame's edge
|
|
466
|
+
* would run the full width behind a bar that is narrower.
|
|
467
|
+
*/
|
|
468
|
+
"data-phi-shell-own-ground": rootPaintsGround
|
|
469
|
+
? "box"
|
|
470
|
+
: resolvePhiSurfaceToneClassName(surface?.tone) != null || (backgroundConfig != null && !themeGroundIsShellChrome)
|
|
471
|
+
? "band"
|
|
472
|
+
: undefined,
|
|
444
473
|
"data-phi-renderable-block": "true",
|
|
445
474
|
"data-phi-signal-receiver": createPhiSignalAddress("region", regionKey),
|
|
446
475
|
"data-phi-block-visibility": visibility,
|
|
@@ -10,10 +10,12 @@ export type PhiCmsRegionStaticProps = {
|
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
regionType?: number;
|
|
12
12
|
previewMode?: boolean;
|
|
13
|
+
/** Whether the Region's top Layout paints a ground of its own (`phiCmsRegionRootLayoutPaintsGround`). */
|
|
14
|
+
rootPaintsGround?: boolean;
|
|
13
15
|
};
|
|
14
16
|
/**
|
|
15
17
|
* A Region with nothing to do after it has rendered. Everything it draws comes from the Region-shell
|
|
16
18
|
* resolver it shares with the client renderer; it does not know the colour mode, so it publishes both
|
|
17
19
|
* and lets `shell.css` switch them.
|
|
18
20
|
*/
|
|
19
|
-
export declare function PhiCmsRegionStatic({ children, className, regionKey, config, shellTheme, style, regionType, previewMode, }: PhiCmsRegionStaticProps): import("react").JSX.Element | null;
|
|
21
|
+
export declare function PhiCmsRegionStatic({ children, className, regionKey, config, shellTheme, style, regionType, previewMode, rootPaintsGround, }: PhiCmsRegionStaticProps): import("react").JSX.Element | null;
|
|
@@ -7,7 +7,7 @@ import { PhiSurfaceTone } from "../surface/phi-surface-tone";
|
|
|
7
7
|
* resolver it shares with the client renderer; it does not know the colour mode, so it publishes both
|
|
8
8
|
* and lets `shell.css` switch them.
|
|
9
9
|
*/
|
|
10
|
-
export function PhiCmsRegionStatic({ children, className, regionKey, config = {}, shellTheme, style, regionType, previewMode = false, }) {
|
|
10
|
+
export function PhiCmsRegionStatic({ children, className, regionKey, config = {}, shellTheme, style, regionType, previewMode = false, rootPaintsGround = false, }) {
|
|
11
11
|
const shell = resolvePhiCmsRegionShell({
|
|
12
12
|
regionKey,
|
|
13
13
|
config,
|
|
@@ -17,6 +17,7 @@ export function PhiCmsRegionStatic({ children, className, regionKey, config = {}
|
|
|
17
17
|
regionType,
|
|
18
18
|
className,
|
|
19
19
|
style,
|
|
20
|
+
rootPaintsGround,
|
|
20
21
|
});
|
|
21
22
|
if (shell == null) {
|
|
22
23
|
return null;
|
|
@@ -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
|
|
111
|
-
|
|
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(
|
|
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`
|
|
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`
|
|
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
|
|
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 =
|
|
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
|
|
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<
|
|
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 (
|
|
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:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|