@phis/ui 0.4.4 → 0.4.5
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 +9 -3
- package/cms/plugins.d.ts +1 -0
- package/cms/plugins.js +2 -0
- package/components/cms/phi-cms-root-layout.js +30 -1
- package/components/controls/phi-background-control.d.ts +6 -1
- package/components/controls/phi-background-control.js +12 -4
- package/components/controls/phi-button-control.d.ts +13 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-media-asset-tile-control.js +10 -10
- package/components/controls/phi-progress-control.d.ts +10 -2
- package/components/controls/phi-progress-control.js +6 -2
- package/components/controls/phi-ribbon-control.d.ts +4 -1
- package/components/controls/phi-ribbon-control.js +5 -3
- package/components/controls/phi-ribbon-wrap-control.d.ts +7 -1
- package/components/controls/phi-ribbon-wrap-control.js +8 -2
- package/components/controls/phi-segmented-control.d.ts +4 -1
- package/components/controls/phi-segmented-control.js +13 -2
- package/components/controls/phi-surface-control.d.ts +2 -0
- package/components/controls/phi-surface-control.js +16 -1
- package/components/controls/phi-switch-control.d.ts +4 -1
- package/components/controls/phi-switch-control.js +8 -2
- package/components/controls/phi-tag-control.d.ts +4 -1
- package/components/controls/phi-tag-control.js +11 -3
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/regions/clients/cms-region-container-client.js +11 -1
- package/components/regions/phi-cms-region-container.js +5 -1
- package/components/regions/phi-cms-region-shell.d.ts +10 -0
- package/components/regions/phi-cms-region-shell.js +53 -7
- package/components/root/phi-root-layout.d.ts +1 -0
- package/components/root/phi-root-layout.js +1 -0
- package/components/root/phi-root-theme-resolver.js +12 -1
- package/components/root/phi-shell-chrome-overlay.d.ts +6 -0
- package/components/root/phi-shell-chrome-overlay.js +7 -1
- package/components/runtime/runtime-module-context.d.ts +12 -1
- package/components/runtime/runtime-module-context.js +6 -1
- package/components/shell/phi-cms-shell.d.ts +7 -1
- package/components/shell/phi-cms-shell.js +4 -2
- package/components/shell/use-phi-shell-header-bands.d.ts +5 -0
- package/components/shell/use-phi-shell-header-bands.js +64 -0
- package/components/shell/use-phi-shell-sticky-bottom.d.ts +18 -0
- package/components/shell/use-phi-shell-sticky-bottom.js +54 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -0
- package/components/tables/client/phi-table-binding.js +22 -3
- package/components/trees/client/phi-tree-binding.d.ts +1 -0
- package/components/trees/client/phi-tree-binding.js +11 -2
- package/components/widgets/client/shared/phi-collection-provider.js +4 -3
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +16 -2
- package/components/widgets/client/shared/phi-command-buttons.js +6 -2
- package/components/widgets/config/background.d.ts +20 -0
- package/components/widgets/config/background.js +44 -2
- package/components/widgets/config/button-variant.d.ts +22 -4
- package/components/widgets/config/button-variant.js +24 -5
- package/components/widgets/config/common-action-field.d.ts +1 -1
- package/components/widgets/config/parser-primitives.js +4 -2
- package/components/widgets/config/theme-gradient.d.ts +11 -0
- package/components/widgets/config/theme-gradient.js +12 -0
- package/components/widgets/label-sets/background.js +2 -0
- package/components/widgets/label-sets/geometry.js +2 -0
- package/components/widgets/label-sets/inspector.js +4 -0
- package/components/widgets/label-types/background.d.ts +1 -0
- package/components/widgets/label-types/background.js +1 -0
- package/components/widgets/label-types/common-controls.js +2 -2
- package/components/widgets/label-types/geometry.d.ts +1 -0
- package/components/widgets/label-types/geometry.js +1 -0
- package/components/widgets/label-types/inspector.d.ts +4 -0
- package/components/widgets/label-types/inspector.js +2 -0
- package/components/widgets/shared/card-body-client.d.ts +11 -0
- package/components/widgets/shared/card-body-client.js +32 -4
- package/components/widgets/shared/collection-source-failure.d.ts +26 -0
- package/components/widgets/shared/collection-source-failure.js +42 -0
- package/components/widgets/shared/markdown-render.js +16 -3
- package/components/widgets/shared/widget-failure-client.d.ts +10 -0
- package/components/widgets/shared/widget-failure-client.js +20 -0
- package/components/widgets/shared/widget-failure.d.ts +31 -0
- package/components/widgets/shared/widget-failure.js +20 -0
- package/components/widgets/shared/widget-failure.server.d.ts +9 -0
- package/components/widgets/shared/widget-failure.server.js +12 -0
- package/gateway/dashboard-card-memo.d.ts +3 -0
- package/gateway/dashboard-card-memo.js +25 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/layout-style.d.ts +8 -4
- package/helpers/layout-style.js +3 -2
- package/helpers/mode-paint.d.ts +4 -0
- package/helpers/mode-paint.js +47 -0
- package/helpers/surface-style.js +33 -11
- package/module-dashboard-cards.d.ts +1 -0
- package/module-dashboard-cards.js +1 -0
- package/module-records.d.ts +7 -0
- package/module-records.js +6 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
- package/plugins/runtime-modules/builder/clients/region-inspector.js +47 -2
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +7 -4
- package/plugins/runtime-modules/builder/controller/page-controller.js +7 -0
- package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
- package/plugins/runtime-modules/builder/persistence.js +9 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.d.ts +3 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.js +7 -4
- package/plugins/runtime-modules/core/widgets/button/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +40 -4
- package/plugins/runtime-modules/core/widgets/button/config.js +12 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +94 -0
- package/plugins/runtime-modules/core/widgets/card/config.js +38 -0
- package/plugins/runtime-modules/core/widgets/card/editor.js +8 -1
- package/plugins/runtime-modules/core/widgets/card/server.js +4 -0
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -3
- package/plugins/runtime-modules/core/widgets/collection-view/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +47 -11
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
- package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +21 -3
- package/plugins/runtime-modules/core/widgets/entry-detail/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-header/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.js +13 -6
- package/plugins/runtime-modules/core/widgets/gallery/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -3
- package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -6
- package/plugins/runtime-modules/core/widgets/record/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/record/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/record/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/record/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/segmented/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +21 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.js +11 -1
- package/plugins/runtime-modules/core/widgets/switch/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/switch/config.d.ts +19 -0
- package/plugins/runtime-modules/core/widgets/switch/config.js +11 -0
- package/plugins/runtime-modules/core/widgets/table/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +16 -3
- package/plugins/runtime-modules/core/widgets/table/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/table/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/table/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/table/static-resource-editor.js +2 -1
- package/plugins/runtime-modules/core/widgets/timeline/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/timeline/client.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/timeline/client.js +14 -4
- package/plugins/runtime-modules/core/widgets/tree/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/tree/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/tree/client.js +13 -2
- package/plugins/runtime-modules/core/widgets/tree/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/tree/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/tree/server.js +2 -2
- package/plugins/runtime-modules/theme/presets.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.js +10 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +138 -7
- package/runtime-data-provider-client.d.ts +2 -0
- package/runtime-data-provider-client.js +7 -0
- package/styles/controls.css +10 -5
- package/styles/gradients.css +101 -0
- package/styles/root.css +18 -0
- package/styles/shell.css +64 -0
- package/theme/phi-button-shadow.d.ts +6 -0
- package/theme/phi-theme-gradients.d.ts +96 -0
- package/theme/phi-theme-gradients.js +245 -0
- package/theme/phi-theme-presets.d.ts +3 -0
- package/theme/phi-theme-presets.js +3 -0
- package/theme/phi-theme-tokens.d.ts +5 -1
- package/theme/phi-theme-tokens.js +14 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +3 -0
- package/types/layout-style.d.ts +9 -8
- package/types/layout-style.js +9 -8
- package/types/surface.d.ts +4 -0
- package/types/surface.js +4 -0
- package/types.d.ts +1 -1
- package/types.js +1 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Switch } from "antd";
|
|
4
|
+
import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
|
|
4
5
|
import { PhiLabeledControl, usePhiControlLabel } from "./phi-labeled-control";
|
|
5
|
-
export function PhiSwitchControl({ id, checked, label, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, onChange, }) {
|
|
6
|
+
export function PhiSwitchControl({ id, checked, label, disabled, readOnly, loading, checkedLabel, uncheckedLabel, size, gradient, onChange, }) {
|
|
6
7
|
const { labelId, labelledBy } = usePhiControlLabel(label);
|
|
7
|
-
return (_jsx(PhiLabeledControl, { label: label, labelId: labelId, children: _jsx(Switch, { id: id, "aria-labelledby": labelledBy, checked: checked, disabled: disabled || readOnly || !onChange, loading: loading, checkedChildren: checkedLabel, unCheckedChildren: uncheckedLabel, size: size, onChange: onChange
|
|
8
|
+
return (_jsx(PhiLabeledControl, { label: label, labelId: labelId, children: _jsx(Switch, { id: id, "aria-labelledby": labelledBy, checked: checked, disabled: disabled || readOnly || !onChange, loading: loading, checkedChildren: checkedLabel, unCheckedChildren: uncheckedLabel, size: size, onChange: onChange, ...(gradient
|
|
9
|
+
? {
|
|
10
|
+
className: "phi-switch-gradient",
|
|
11
|
+
style: { "--phi-control-gradient": `var(${PHI_THEME_GRADIENT_CSS_VARS[gradient].paint})` },
|
|
12
|
+
}
|
|
13
|
+
: {}) }) }));
|
|
8
14
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import { type PhiThemeGradientKey } from "../../theme/phi-theme-gradients";
|
|
2
3
|
export type PhiTagControlProps = {
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
color?: string;
|
|
6
|
+
/** A Theme gradient slot to fill the tag with; it then draws solid, in the slot's text colour. */
|
|
7
|
+
gradient?: PhiThemeGradientKey;
|
|
5
8
|
variant?: "filled" | "outlined" | "solid";
|
|
6
9
|
/**
|
|
7
10
|
* Offers the remove affordance Ant Design draws inside the capsule.
|
|
@@ -23,4 +26,4 @@ export type PhiTagControlProps = {
|
|
|
23
26
|
onClose?: () => void;
|
|
24
27
|
style?: CSSProperties;
|
|
25
28
|
};
|
|
26
|
-
export declare function PhiTagControl({ children, color, variant, closable, onClose, style, }: PhiTagControlProps): import("react").JSX.Element;
|
|
29
|
+
export declare function PhiTagControl({ children, color, gradient, variant, closable, onClose, style, }: PhiTagControlProps): import("react").JSX.Element;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Tag } from "antd";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
|
|
5
|
+
export function PhiTagControl({ children, color, gradient, variant = "outlined", closable, onClose, style, }) {
|
|
6
|
+
const gradientVars = gradient ? PHI_THEME_GRADIENT_CSS_VARS[gradient] : null;
|
|
7
|
+
return (_jsx(Tag, { color: gradientVars ? undefined : color, variant: gradientVars ? "solid" : variant, closeIcon: closable || undefined, onClose: onClose ? (event) => {
|
|
6
8
|
event.preventDefault();
|
|
7
9
|
onClose();
|
|
8
|
-
} : undefined, style: {
|
|
10
|
+
} : undefined, style: {
|
|
11
|
+
marginInlineEnd: 0,
|
|
12
|
+
...(gradientVars
|
|
13
|
+
? { background: `var(${gradientVars.paint})`, color: `var(${gradientVars.text})`, borderColor: "transparent" }
|
|
14
|
+
: {}),
|
|
15
|
+
...style,
|
|
16
|
+
}, children: children }));
|
|
9
17
|
}
|
|
@@ -18,9 +18,18 @@ export function resolvePhiBaseLayoutChrome({ padding, paddingTop, paddingRight,
|
|
|
18
18
|
* a Tree take. A Layout without a Surface states no corner: there is no box there to round.
|
|
19
19
|
*/
|
|
20
20
|
const resolvedSurface = resolvePhiSurfaceStyle(surface, { cornerFallback: PHI_LAYOUT_SURFACE_RADIUS });
|
|
21
|
+
const paddingStyle = resolvePhiPaddingStyle({ padding, paddingTop, paddingRight, paddingBottom, paddingLeft });
|
|
21
22
|
const style = {
|
|
22
23
|
...resolvedSurface.style,
|
|
23
|
-
...
|
|
24
|
+
...paddingStyle,
|
|
25
|
+
/*
|
|
26
|
+
* The top inset once more, as a value a stylesheet can add to: a Hero behind the Header gives its
|
|
27
|
+
* root Layout the Header's height on top of it (`styles/shell.css`), and an inline `padding-top`
|
|
28
|
+
* cannot be read from CSS. Only where a top inset is stated; absent, the rule falls back to none.
|
|
29
|
+
*/
|
|
30
|
+
...(paddingStyle.paddingTop == null
|
|
31
|
+
? {}
|
|
32
|
+
: { "--phi-layout-padding-top": String(paddingStyle.paddingTop) }),
|
|
24
33
|
/*
|
|
25
34
|
* The label column, written the two ways it is read: as the grid line a descriptor form places its
|
|
26
35
|
* labels on, and as the share of the width a labelled Control needs, which knows nothing of the
|
|
@@ -17,8 +17,10 @@ import { PhiEffectsReadyTrigger } from "../../../plugins/runtime/phi-effects-rea
|
|
|
17
17
|
import { PhiSlotChildEffectsVisibilityObserver } from "../../../plugins/runtime/phi-slot-child-effects-visibility-observer";
|
|
18
18
|
import { PhiSlotChildViewportEffectsObserver } from "../../../plugins/runtime/phi-slot-child-viewport-effects-observer";
|
|
19
19
|
import { PhiFlexControl } from "../../controls/phi-flex-control";
|
|
20
|
-
import { phiCmsRegionSiderSticks, resolvePhiCmsRegionShell, } from "../phi-cms-region-shell";
|
|
20
|
+
import { phiCmsRegionFooterSticks, phiCmsRegionSiderSticks, resolvePhiCmsRegionShell, } from "../phi-cms-region-shell";
|
|
21
21
|
import { usePhiShellStickyTop } from "../../shell/use-phi-shell-sticky-top";
|
|
22
|
+
import { usePhiShellStickyBottom } from "../../shell/use-phi-shell-sticky-bottom";
|
|
23
|
+
import { usePhiShellHeaderBands } from "../../shell/use-phi-shell-header-bands";
|
|
22
24
|
import { usePhiVisualAnchor } from "../../runtime/runtime-visual-anchors";
|
|
23
25
|
import { usePhiPathname } from "../../runtime/use-phi-pathname";
|
|
24
26
|
import { stripLocaleAndAreaFromPathname } from "../../../helpers/locale";
|
|
@@ -105,6 +107,14 @@ export function PhiCmsRegionContainerClient({ children, className, regionKey, co
|
|
|
105
107
|
active: !previewMode && inScope && phiCmsRegionSiderSticks(regionKey, initialConfig),
|
|
106
108
|
elementRef,
|
|
107
109
|
});
|
|
110
|
+
usePhiShellStickyBottom({
|
|
111
|
+
active: !previewMode && inScope && resolvedVisibility !== "hidden" && phiCmsRegionFooterSticks(regionKey, initialConfig),
|
|
112
|
+
elementRef,
|
|
113
|
+
});
|
|
114
|
+
usePhiShellHeaderBands({
|
|
115
|
+
active: !previewMode && inScope && regionKey === "hero",
|
|
116
|
+
elementRef,
|
|
117
|
+
});
|
|
108
118
|
/*
|
|
109
119
|
* Off this Page, the Region leaves a hidden marker rather than nothing: `header_top` still has to tell
|
|
110
120
|
* the Shell it holds no room, and it finds the Shell from here.
|
|
@@ -3,7 +3,7 @@ import { isPhiCmsPageOwnedRegion } from "../../helpers/cms-region-keys";
|
|
|
3
3
|
import { hasPhiFlag } from "../../helpers/flags";
|
|
4
4
|
import { PhiCmsFlags } from "../../constants/phi-cms";
|
|
5
5
|
import { PhiCmsRegionStatic } from "./phi-cms-region-static";
|
|
6
|
-
import { phiCmsRegionSiderSticks } from "./phi-cms-region-shell";
|
|
6
|
+
import { phiCmsRegionFooterSticks, phiCmsRegionSiderSticks } from "./phi-cms-region-shell";
|
|
7
7
|
import { resolveRenderableBlockEffectsAttributes, resolveRenderableBlockViewportEffects, } from "../../helpers/renderable-block-effects";
|
|
8
8
|
import { PhiRuntimeModuleRenderClientHost } from "../runtime/runtime-module-render-client-manifest";
|
|
9
9
|
import { PhiRuntimeRenderClientType } from "../../constants/runtime-render-client-types";
|
|
@@ -24,6 +24,10 @@ export function PhiCmsRegionContainer({ children, className, regionKey, config,
|
|
|
24
24
|
(!previewMode && readPhiCmsRegionReveal(regionKey, config) !== "always") ||
|
|
25
25
|
// A stuck Sider stands under the Header as measured, and only the browser can measure it.
|
|
26
26
|
(!previewMode && phiCmsRegionSiderSticks(regionKey, config)) ||
|
|
27
|
+
// A stuck Footer tells the Shell how much of the viewport's bottom it holds, which is measured.
|
|
28
|
+
(!previewMode && phiCmsRegionFooterSticks(regionKey, config)) ||
|
|
29
|
+
// A Hero stands behind the Header bands, whose heights only the browser can measure for certain.
|
|
30
|
+
(!previewMode && regionKey === "hero") ||
|
|
27
31
|
hasPhiFlag(config?.flags, PhiCmsFlags.Collapsible) ||
|
|
28
32
|
requiresEffectsObserver ||
|
|
29
33
|
resolvePhiBackgroundMotion(config?.surface?.background) != null;
|
|
@@ -103,6 +103,16 @@ export type PhiCmsRegionShell = {
|
|
|
103
103
|
* measurement for such a Sider, which is why this is asked before the Region renders.
|
|
104
104
|
*/
|
|
105
105
|
export declare function phiCmsRegionSiderSticks(regionKey: PhiCmsRegionKey, config: Pick<PhiCmsRegionConfig, "flags"> | null | undefined): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Whether a Region is the Footer band that sticks to the viewport's bottom.
|
|
108
|
+
*
|
|
109
|
+
* Only `footer_bottom`, the counterpart of `header_top`: the lowest band is the one that can stand at the
|
|
110
|
+
* bottom edge while the page scrolls past it. A middle band that stuck would have the band below it either
|
|
111
|
+
* cover it or stick with it, and neither is a Footer anybody asked for; `footer_top` and `footer_main`
|
|
112
|
+
* scroll with the page and arrive above it at the end. It measures the room it holds
|
|
113
|
+
* (`usePhiShellStickyBottom`), so a Sider stuck under the Header ends above it.
|
|
114
|
+
*/
|
|
115
|
+
export declare function phiCmsRegionFooterSticks(regionKey: PhiCmsRegionKey, config: Pick<PhiCmsRegionConfig, "flags"> | null | undefined): boolean;
|
|
106
116
|
/**
|
|
107
117
|
* The Region's shell, or null where the Region renders nothing: hidden, or collapsed in a preview.
|
|
108
118
|
* `header_bottom` is exempt from the preview collapse because the Page, not the Area, owns its content.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolvePhiSurfaceToneClassName } from "../../types/surface";
|
|
2
|
+
import { composePhiModePaint, resolvePhiModeValue } from "../../helpers/mode-paint";
|
|
2
3
|
import { PHI_THEME_BORDER_LINE, resolvePhiBorderWidgetStyle } from "../../helpers/border-widget-style";
|
|
3
4
|
import { hasPhiFlag } from "../../helpers/flags";
|
|
4
5
|
import { combinePhiBoxShadows } from "../../helpers/layout-style";
|
|
@@ -11,7 +12,7 @@ import { resolvePhiRenderableBlockGeometry } from "../../types/renderable-block-
|
|
|
11
12
|
import { createPhiSignalAddress } from "../../types/signals";
|
|
12
13
|
import { readPhiCmsRegionReveal } from "../../helpers/region-page-scope";
|
|
13
14
|
import { resolvePhiPaddingStyle } from "../layouts/phi-layout-contract";
|
|
14
|
-
import { PHI_SHELL_STICKY_TOP_PROPERTY, phiRegionUsesShellChromeOverlay } from "../root/phi-shell-chrome-overlay";
|
|
15
|
+
import { PHI_SHELL_STICKY_BOTTOM_PROPERTY, PHI_SHELL_STICKY_TOP_PROPERTY, phiRegionUsesShellChromeOverlay, } from "../root/phi-shell-chrome-overlay";
|
|
15
16
|
import { normalizePhiBackgroundWidgetConfig, phiBackgroundWidgetConfigPaintsGround, resolvePhiBackgroundGroundFilter, resolvePhiBackgroundMotion, resolvePhiBackgroundMotionHostStyle, resolvePhiBackgroundPane, resolvePhiBackgroundWidgetStyle, } from "../widgets/config/background";
|
|
16
17
|
/*
|
|
17
18
|
* The longhands every Region that paints the Shell Chrome Overlay (SHELL.md) carries, read from the
|
|
@@ -61,6 +62,18 @@ export function phiCmsRegionSiderSticks(regionKey, config) {
|
|
|
61
62
|
&& hasPhiFlag(config?.flags, PhiCmsFlags.Sticky)
|
|
62
63
|
&& !hasPhiFlag(config?.flags, PhiCmsFlags.FullHeight);
|
|
63
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Whether a Region is the Footer band that sticks to the viewport's bottom.
|
|
67
|
+
*
|
|
68
|
+
* Only `footer_bottom`, the counterpart of `header_top`: the lowest band is the one that can stand at the
|
|
69
|
+
* bottom edge while the page scrolls past it. A middle band that stuck would have the band below it either
|
|
70
|
+
* cover it or stick with it, and neither is a Footer anybody asked for; `footer_top` and `footer_main`
|
|
71
|
+
* scroll with the page and arrive above it at the end. It measures the room it holds
|
|
72
|
+
* (`usePhiShellStickyBottom`), so a Sider stuck under the Header ends above it.
|
|
73
|
+
*/
|
|
74
|
+
export function phiCmsRegionFooterSticks(regionKey, config) {
|
|
75
|
+
return regionKey === "footer_bottom" && hasPhiFlag(config?.flags, PhiCmsFlags.Sticky);
|
|
76
|
+
}
|
|
64
77
|
/** The line a stuck Sider stands at: under the Header as measured, plus its own offset. */
|
|
65
78
|
function resolvePhiCmsRegionSiderStuckTop(topCss) {
|
|
66
79
|
return `calc(var(${PHI_SHELL_STICKY_TOP_PROPERTY}, 0px) + ${topCss})`;
|
|
@@ -123,6 +136,11 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
123
136
|
const siderCollapsedWidth = normalizeCssLength(config.collapsedWidth) ?? resolvePhiShellSiderCollapsedWidth(shellTheme);
|
|
124
137
|
const top = normalizeCssLength(config.offsetTop) ?? 0;
|
|
125
138
|
const topCss = typeof top === "number" ? `${top}px` : top;
|
|
139
|
+
// How far `content` reaches up into the Hero; `styles/shell.css` applies it only where there is one.
|
|
140
|
+
const heroOverlap = regionKey === "content" ? normalizeCssLength(config.heroOverlap) : null;
|
|
141
|
+
const heroOverlapCss = heroOverlap == null || heroOverlap === 0
|
|
142
|
+
? null
|
|
143
|
+
: typeof heroOverlap === "number" ? `${heroOverlap}px` : heroOverlap;
|
|
126
144
|
const sticky = hasPhiFlag(config.flags, PhiCmsFlags.Sticky);
|
|
127
145
|
// A preview shows the Region where it stands, so an author can see what they are editing.
|
|
128
146
|
const reveal = previewMode ? "always" : readPhiCmsRegionReveal(regionKey, config);
|
|
@@ -136,7 +154,12 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
136
154
|
* A revealing `header_top` sticks whatever its flag says: coming back into view at the top edge is what
|
|
137
155
|
* revealing means, and only a sticky band has a top edge to come back to.
|
|
138
156
|
*/
|
|
139
|
-
const
|
|
157
|
+
const footerSticks = phiCmsRegionFooterSticks(regionKey, config);
|
|
158
|
+
const stuck = isHeader
|
|
159
|
+
? sticky || reveal !== "always"
|
|
160
|
+
: footerSticks || (isSider && (sticky || fullHeight));
|
|
161
|
+
const bottom = normalizeCssLength(config.offsetBottom) ?? 0;
|
|
162
|
+
const stuckBottom = footerSticks ? (typeof bottom === "number" ? `${bottom}px` : bottom) : undefined;
|
|
140
163
|
/*
|
|
141
164
|
* The Header bands below `header_top` stick under it while it is in view and close up when it leaves.
|
|
142
165
|
* `--phi-shell-header-top-stack` is how much of the viewport's top it holds right now; only a
|
|
@@ -149,7 +172,7 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
149
172
|
* tall as what is left of the viewport below that line.
|
|
150
173
|
*/
|
|
151
174
|
const siderUnderHeader = isSider && sticky && !fullHeight;
|
|
152
|
-
const stuckTop = !stuck
|
|
175
|
+
const stuckTop = !stuck || footerSticks
|
|
153
176
|
? undefined
|
|
154
177
|
: isHeader && regionKey !== "header_top"
|
|
155
178
|
? `calc(${topCss} + var(--phi-shell-header-top-stack, 0px))`
|
|
@@ -160,7 +183,10 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
160
183
|
const fullHeightSize = fullHeight && !blockSize
|
|
161
184
|
? `calc(100dvh - ${topCss})`
|
|
162
185
|
: blockSize;
|
|
163
|
-
|
|
186
|
+
// Below the Header as measured, and above a stuck Footer as measured: the room left between the two.
|
|
187
|
+
const underHeaderMaxSize = siderUnderHeader
|
|
188
|
+
? `calc(100dvh - ${resolvePhiCmsRegionSiderStuckTop(topCss)} - var(${PHI_SHELL_STICKY_BOTTOM_PROPERTY}, 0px))`
|
|
189
|
+
: undefined;
|
|
164
190
|
const zIndex = config.zIndex ?? resolvePhiShellRegionZIndex(regionKey, hasPhiFlag(config.flags, PhiCmsFlags.FullHeight));
|
|
165
191
|
/*
|
|
166
192
|
* A Background config that paints nothing is not an authored ground. The Builder writes one onto every
|
|
@@ -200,10 +226,26 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
200
226
|
const backgroundMoves = animatesBackground &&
|
|
201
227
|
backgroundConfig != null &&
|
|
202
228
|
resolvePhiBackgroundMotion(backgroundConfig) != null;
|
|
203
|
-
|
|
229
|
+
/*
|
|
230
|
+
* The ground in dark mode (`PhiSurface.backgroundDark`), for a Region that paints a ground of its own in
|
|
231
|
+
* light mode: the page's mode picks between the two in CSS (`helpers/mode-paint.ts`). Not for the
|
|
232
|
+
* Theme's Overlay, which is per mode already, nor for a moving picture, which the motion layer draws
|
|
233
|
+
* from one Background.
|
|
234
|
+
*/
|
|
235
|
+
const backgroundDarkConfig = backgroundConfig != null && !themeGround && !backgroundMoves && surface?.backgroundDark
|
|
236
|
+
? normalizePhiBackgroundWidgetConfig(surface.backgroundDark)
|
|
237
|
+
: null;
|
|
238
|
+
const groundFilterLight = backgroundConfig == null ? null : resolvePhiBackgroundGroundFilter(backgroundConfig);
|
|
239
|
+
const groundFilterDark = backgroundDarkConfig == null ? null : resolvePhiBackgroundGroundFilter(backgroundDarkConfig);
|
|
240
|
+
const groundFilter = backgroundDarkConfig && groundFilterLight !== groundFilterDark
|
|
241
|
+
? resolvePhiModeValue(groundFilterLight ?? "none", groundFilterDark ?? "none")
|
|
242
|
+
: groundFilterLight;
|
|
243
|
+
const layerPaint = (entry) => resolvePhiBackgroundWidgetStyle({ ...entry, filter: null, motion: null });
|
|
204
244
|
const ground = backgroundConfig != null && groundFilter != null && !backgroundMoves
|
|
205
245
|
? {
|
|
206
|
-
paint:
|
|
246
|
+
paint: backgroundDarkConfig
|
|
247
|
+
? composePhiModePaint(layerPaint(backgroundConfig), layerPaint(backgroundDarkConfig))
|
|
248
|
+
: layerPaint(backgroundConfig),
|
|
207
249
|
filter: groundFilter,
|
|
208
250
|
motion: null,
|
|
209
251
|
}
|
|
@@ -219,7 +261,9 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
219
261
|
? null
|
|
220
262
|
: backgroundMoves
|
|
221
263
|
? resolvePhiBackgroundMotionHostStyle(backgroundConfig)
|
|
222
|
-
:
|
|
264
|
+
: backgroundDarkConfig
|
|
265
|
+
? composePhiModePaint(resolvePhiBackgroundWidgetStyle(backgroundConfig), resolvePhiBackgroundWidgetStyle(backgroundDarkConfig))
|
|
266
|
+
: resolvePhiBackgroundWidgetStyle(backgroundConfig);
|
|
223
267
|
const chromeInput = {
|
|
224
268
|
shadow: surface?.shadow ?? undefined,
|
|
225
269
|
effect: shellPane ?? undefined,
|
|
@@ -341,6 +385,7 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
341
385
|
position: stuck ? "sticky" : "relative",
|
|
342
386
|
top: stuckTop,
|
|
343
387
|
insetBlockStart: isHeader ? stuckTop : undefined,
|
|
388
|
+
bottom: stuckBottom,
|
|
344
389
|
zIndex,
|
|
345
390
|
...geometryStyle,
|
|
346
391
|
color: liveChrome ? liveChrome.color : "var(--phi-region-color)",
|
|
@@ -367,6 +412,7 @@ export function resolvePhiCmsRegionShell({ regionKey, config, shellTheme, paint,
|
|
|
367
412
|
? { marginBlockEnd: `calc(-1 * ${blockSize ?? "var(--phi-region-reveal-extent, 0px)"})` }
|
|
368
413
|
: {}),
|
|
369
414
|
...(reveal === "always" ? {} : { "--phi-region-reveal-offset": topCss }),
|
|
415
|
+
...(heroOverlapCss ? { "--phi-region-hero-overlap": heroOverlapCss } : {}),
|
|
370
416
|
};
|
|
371
417
|
return {
|
|
372
418
|
family,
|
|
@@ -5,6 +5,7 @@ import "../../styles/root.css";
|
|
|
5
5
|
import "../../styles/layout.css";
|
|
6
6
|
import "../../styles/control-shape.css";
|
|
7
7
|
import "../../styles/controls.css";
|
|
8
|
+
import "../../styles/gradients.css";
|
|
8
9
|
import type { PhiSiteConfig } from "../../types/site-config";
|
|
9
10
|
import type { PhiResolvedLocale } from "../../helpers/site-locale-config";
|
|
10
11
|
import { type PhiThemeMode, type PhiThemePresetPlugin } from "../../theme/phi-theme-presets";
|
|
@@ -14,6 +14,7 @@ import "../../styles/root.css";
|
|
|
14
14
|
import "../../styles/layout.css";
|
|
15
15
|
import "../../styles/control-shape.css";
|
|
16
16
|
import "../../styles/controls.css";
|
|
17
|
+
import "../../styles/gradients.css";
|
|
17
18
|
import { getResolvedSiteConfig } from "../../gateway/site-config";
|
|
18
19
|
import { loadPhiAntdLocale } from "../../helpers/antd-locale";
|
|
19
20
|
import { PhiDayjsLocale } from "./phi-dayjs-locale";
|
|
@@ -2,9 +2,10 @@ import { resolvePhiShellChromeOverlayVariables, } from "./phi-shell-chrome-overl
|
|
|
2
2
|
import { resolvePhiShellRegionBackground, resolvePhiShellRegionColor, } from "../../helpers/shell-region-style";
|
|
3
3
|
import { createPhiAntdThemeCssVarKey, resolvePhiAntdAliasTokens, } from "../../theme/phi-antd-token-resolver";
|
|
4
4
|
import { buildPhiComponentTokens, buildPhiThemeStructuralTokens, } from "../../theme/phi-theme";
|
|
5
|
-
import { PHI_THEME_PALETTE_MODE_SEED_KEYS, resolvePhiThemePresetPlugin, resolvePhiThemeColorTokens, } from "../../theme/phi-theme-presets";
|
|
5
|
+
import { mergePhiThemePalettes, PHI_THEME_PALETTE_MODE_SEED_KEYS, resolvePhiThemePresetPlugin, resolvePhiThemeColorTokens, } from "../../theme/phi-theme-presets";
|
|
6
6
|
import { assertPhiThemeVocabulary } from "../../theme/phi-theme-tokens";
|
|
7
7
|
import { applyPhiButtonShadowComponentTokens } from "../../theme/phi-button-shadow";
|
|
8
|
+
import { buildPhiThemeGradientTokens, readPhiThemeGradientKey } from "../../theme/phi-theme-gradients";
|
|
8
9
|
import { applyPhiControlShapeComponentTokens, applyPhiSurfaceShapeComponentTokens, resolvePhiControlShape, } from "../../theme/phi-control-shape";
|
|
9
10
|
const PHI_DEFAULT_DARK_NAV_BACKGROUND = "#001529";
|
|
10
11
|
function mergeComponentThemes(defaults, overrides) {
|
|
@@ -79,8 +80,18 @@ export function resolvePhiRootTheme({ siteTheme, mode, fonts, presets, }) {
|
|
|
79
80
|
});
|
|
80
81
|
const resolvedControlShape = resolvePhiControlShape(siteTheme.shape?.controls);
|
|
81
82
|
const components = applyPhiSurfaceShapeComponentTokens(applyPhiControlShapeComponentTokens(mergeComponentThemes(sharedComponentDefaults, applyPhiButtonShadowComponentTokens(siteTheme?.components, siteTheme?.buttons, mode)), resolvedControlShape, effectiveThemeTokens), resolvedControlShape, effectiveThemeTokens);
|
|
83
|
+
/*
|
|
84
|
+
* The gradient slots ride as tokens of their own, so Ant Design writes them as custom properties under
|
|
85
|
+
* this mode's class like every other token (theme/phi-theme-gradients.ts). Derived from the resolved
|
|
86
|
+
* colours, so a slot the palette leaves out follows the brand.
|
|
87
|
+
*/
|
|
82
88
|
const token = {
|
|
83
89
|
...effectiveThemeTokens,
|
|
90
|
+
...buildPhiThemeGradientTokens({
|
|
91
|
+
gradients: mergePhiThemePalettes(themePreset.palette, siteTheme?.palette).modes?.[mode]?.gradients,
|
|
92
|
+
token: effectiveThemeTokens,
|
|
93
|
+
primaryButtonGradient: readPhiThemeGradientKey(siteTheme?.buttons?.primaryGradient),
|
|
94
|
+
}),
|
|
84
95
|
};
|
|
85
96
|
return {
|
|
86
97
|
mode,
|
|
@@ -136,6 +136,12 @@ export declare const PHI_SHELL_HEADER_TOP_STACK_PROPERTY = "--phi-shell-header-t
|
|
|
136
136
|
* and a stuck Sider stand under it; unset, it reads `0px`.
|
|
137
137
|
*/
|
|
138
138
|
export declare const PHI_SHELL_STICKY_TOP_PROPERTY = "--phi-shell-sticky-top";
|
|
139
|
+
/**
|
|
140
|
+
* The Footer's measured top, from below: how much of the viewport's bottom a stuck `footer_bottom` holds
|
|
141
|
+
* right now, written on the Shell by `usePhiShellStickyBottom` (components/shell/use-phi-shell-sticky-bottom.ts).
|
|
142
|
+
* A Sider stuck under the Header ends above it; unset, it reads `0px`.
|
|
143
|
+
*/
|
|
144
|
+
export declare const PHI_SHELL_STICKY_BOTTOM_PROPERTY = "--phi-shell-sticky-bottom";
|
|
139
145
|
/**
|
|
140
146
|
* How `header_top` behaves where the browser decides it, as far as the Header pane is concerned.
|
|
141
147
|
*/
|
|
@@ -24,7 +24,7 @@ import { normalizePhiBackgroundWidgetConfig, resolvePhiBackgroundFilter, resolve
|
|
|
24
24
|
* A wash of colour over the frame is an Overlay rather than a Filter, and the overlay offers those
|
|
25
25
|
* unnarrowed.
|
|
26
26
|
*/
|
|
27
|
-
export const PHI_SHELL_CHROME_OVERLAY_FILTERS = ["glass", "haze"];
|
|
27
|
+
export const PHI_SHELL_CHROME_OVERLAY_FILTERS = ["glass", "haze", "clear"];
|
|
28
28
|
/**
|
|
29
29
|
* The Base kinds the overlay offers and honours, which is the whole contract.
|
|
30
30
|
*
|
|
@@ -239,6 +239,12 @@ export const PHI_SHELL_HEADER_TOP_STACK_PROPERTY = "--phi-shell-header-top-stack
|
|
|
239
239
|
* and a stuck Sider stand under it; unset, it reads `0px`.
|
|
240
240
|
*/
|
|
241
241
|
export const PHI_SHELL_STICKY_TOP_PROPERTY = "--phi-shell-sticky-top";
|
|
242
|
+
/**
|
|
243
|
+
* The Footer's measured top, from below: how much of the viewport's bottom a stuck `footer_bottom` holds
|
|
244
|
+
* right now, written on the Shell by `usePhiShellStickyBottom` (components/shell/use-phi-shell-sticky-bottom.ts).
|
|
245
|
+
* A Sider stuck under the Header ends above it; unset, it reads `0px`.
|
|
246
|
+
*/
|
|
247
|
+
export const PHI_SHELL_STICKY_BOTTOM_PROPERTY = "--phi-shell-sticky-bottom";
|
|
242
248
|
/**
|
|
243
249
|
* Where the Header pane sticks when `header_top` may come and go.
|
|
244
250
|
*
|
|
@@ -3,6 +3,7 @@ import type { PhiRuntimeModuleDataProviderDescriptor, PhiRuntimeModuleClientWidg
|
|
|
3
3
|
import type { PhiRuntimeDataProviderKey } from "../../types/runtime-data-provider";
|
|
4
4
|
import type { PhiCalendarAdapterDescriptor, PhiCalendarAdapterKey } from "../../types/calendar";
|
|
5
5
|
import type { PhiVideoProviderDescriptor, PhiVideoProviderKey } from "../../types/video";
|
|
6
|
+
import type { PhiCollectionItemRendererDescriptor } from "../../types/collection-provider";
|
|
6
7
|
type PhiRuntimeModuleClientState = {
|
|
7
8
|
moduleIds: ReadonlySet<string>;
|
|
8
9
|
widgetTypes: ReadonlySet<string>;
|
|
@@ -18,8 +19,17 @@ type PhiRuntimeModuleClientState = {
|
|
|
18
19
|
* nothing, which is how a placement outlives the Module that once served it.
|
|
19
20
|
*/
|
|
20
21
|
videoProviderDescriptorsByKey: ReadonlyMap<PhiVideoProviderKey, PhiVideoProviderDescriptor>;
|
|
22
|
+
/**
|
|
23
|
+
* The Collection item renderers the Area's Modules declare, by key -- or null where nobody said.
|
|
24
|
+
*
|
|
25
|
+
* Only the Builder says: it is where a Collection View's configuration is judged without drawing any
|
|
26
|
+
* items, and a renderer a Site picked from another Module is one of the things it judges. A live page
|
|
27
|
+
* looks its renderer up in the Render Client manifest, which is the real answer there. Null rather than
|
|
28
|
+
* an empty set, so that "not known here" can never read as "none offered".
|
|
29
|
+
*/
|
|
30
|
+
collectionItemRendererKeys: ReadonlySet<string> | null;
|
|
21
31
|
};
|
|
22
|
-
export declare function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layoutTypes, widgetDefinitions, dataProviderDescriptors, calendarAdapterDescriptors, videoProviderDescriptors, children, }: {
|
|
32
|
+
export declare function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layoutTypes, widgetDefinitions, dataProviderDescriptors, calendarAdapterDescriptors, videoProviderDescriptors, collectionItemRendererDescriptors, children, }: {
|
|
23
33
|
moduleIds: readonly string[];
|
|
24
34
|
widgetTypes: readonly string[];
|
|
25
35
|
layoutTypes: readonly string[];
|
|
@@ -27,6 +37,7 @@ export declare function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layou
|
|
|
27
37
|
dataProviderDescriptors?: readonly PhiRuntimeModuleDataProviderDescriptor[];
|
|
28
38
|
calendarAdapterDescriptors?: readonly PhiCalendarAdapterDescriptor[];
|
|
29
39
|
videoProviderDescriptors?: readonly PhiVideoProviderDescriptor[];
|
|
40
|
+
collectionItemRendererDescriptors?: readonly PhiCollectionItemRendererDescriptor[];
|
|
30
41
|
children: ReactNode;
|
|
31
42
|
}): import("react").JSX.Element;
|
|
32
43
|
export declare function usePhiRuntimeModuleState(): PhiRuntimeModuleClientState;
|
|
@@ -9,9 +9,10 @@ const EMPTY_RUNTIME_MODULE_STATE = {
|
|
|
9
9
|
dataProviderDescriptorsByKey: new Map(),
|
|
10
10
|
calendarAdapterDescriptorsByKey: new Map(),
|
|
11
11
|
videoProviderDescriptorsByKey: new Map(),
|
|
12
|
+
collectionItemRendererKeys: null,
|
|
12
13
|
};
|
|
13
14
|
const PhiRuntimeModuleContext = createContext(EMPTY_RUNTIME_MODULE_STATE);
|
|
14
|
-
export function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layoutTypes, widgetDefinitions = [], dataProviderDescriptors = [], calendarAdapterDescriptors = [], videoProviderDescriptors = [], children, }) {
|
|
15
|
+
export function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layoutTypes, widgetDefinitions = [], dataProviderDescriptors = [], calendarAdapterDescriptors = [], videoProviderDescriptors = [], collectionItemRendererDescriptors, children, }) {
|
|
15
16
|
const state = useMemo(() => ({
|
|
16
17
|
moduleIds: new Set(moduleIds),
|
|
17
18
|
widgetTypes: new Set(widgetTypes),
|
|
@@ -20,8 +21,12 @@ export function PhiRuntimeModuleProvider({ moduleIds, widgetTypes, layoutTypes,
|
|
|
20
21
|
dataProviderDescriptorsByKey: new Map(dataProviderDescriptors.map((descriptor) => [descriptor.key, descriptor])),
|
|
21
22
|
calendarAdapterDescriptorsByKey: new Map(calendarAdapterDescriptors.map((descriptor) => [descriptor.key, descriptor])),
|
|
22
23
|
videoProviderDescriptorsByKey: new Map(videoProviderDescriptors.map((descriptor) => [descriptor.key, descriptor])),
|
|
24
|
+
collectionItemRendererKeys: collectionItemRendererDescriptors
|
|
25
|
+
? new Set(collectionItemRendererDescriptors.map((descriptor) => descriptor.key))
|
|
26
|
+
: null,
|
|
23
27
|
}), [
|
|
24
28
|
calendarAdapterDescriptors,
|
|
29
|
+
collectionItemRendererDescriptors,
|
|
25
30
|
dataProviderDescriptors,
|
|
26
31
|
layoutTypes,
|
|
27
32
|
moduleIds,
|
|
@@ -25,5 +25,11 @@ export type PhiCmsShellProps = {
|
|
|
25
25
|
* pane and the bands below read it.
|
|
26
26
|
*/
|
|
27
27
|
headerTopRoom?: Record<`--phi-shell-header-top-${string}`, string>;
|
|
28
|
+
/**
|
|
29
|
+
* The room the Header bands hold, as far as the configs state it (`--phi-shell-band-top`,
|
|
30
|
+
* `--phi-shell-band-main`, and `--phi-shell-band-bottom` where the Page states it): what a Hero stands
|
|
31
|
+
* behind on the first paint. The browser measures the rest (`use-phi-shell-header-bands.ts`).
|
|
32
|
+
*/
|
|
33
|
+
headerBandRoom?: Record<`--phi-shell-band-${string}`, string>;
|
|
28
34
|
};
|
|
29
|
-
export declare function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, }: PhiCmsShellProps): import("react").JSX.Element;
|
|
35
|
+
export declare function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, headerBandRoom, }: PhiCmsShellProps): import("react").JSX.Element;
|
|
@@ -44,8 +44,10 @@ function PhiShellChromePane({ family, stickyTop, }) {
|
|
|
44
44
|
? { ...PHI_SHELL_CHROME_PANE_PAINT, boxShadow }
|
|
45
45
|
: { ...PHI_SHELL_CHROME_PANE_PAINT, boxShadow, position: "sticky", top: stickyTop } }));
|
|
46
46
|
}
|
|
47
|
-
export function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight = false, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, }) {
|
|
48
|
-
const roomStyle = headerTopRoom
|
|
47
|
+
export function PhiCmsShell({ content, headerTop, headerMain, headerBottom, hero, siderLeft, siderRight, siderLeftFullHeight = false, footerTop, footerMain, footerBottom, drawer, headerPaneStickyTop, headerTopRoom, headerBandRoom, }) {
|
|
48
|
+
const roomStyle = headerTopRoom || headerBandRoom
|
|
49
|
+
? { ...headerTopRoom, ...headerBandRoom }
|
|
50
|
+
: undefined;
|
|
49
51
|
const hasLeftFullHeightSidebar = siderLeftFullHeight && Boolean(siderLeft);
|
|
50
52
|
const shellVariant = hasLeftFullHeightSidebar
|
|
51
53
|
? "full-height-sider"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* The room each Header band holds, published on the Shell for a Page with a Hero.
|
|
5
|
+
*
|
|
6
|
+
* A Hero starts at the top of the window, behind the Header bands (`styles/shell.css`, "Hero at the
|
|
7
|
+
* top"): the Header rows hold no room there, so each band is set down by the bands above it, and the
|
|
8
|
+
* Hero's content and the Header's glass pane take the bands' sum. The grid itself does not depend on any
|
|
9
|
+
* of it -- a late value moves a band or the Hero's words for a frame, never the page below.
|
|
10
|
+
*
|
|
11
|
+
* The Shell is handed the configured heights by the server (`phi-cms-root-layout.tsx`); this measures
|
|
12
|
+
* what the bands actually hold, `header_bottom` included, which the Area never sees. A band's room is
|
|
13
|
+
* its height less what it gives back below itself -- a `header_top` that reveals on hover takes none.
|
|
14
|
+
*/
|
|
15
|
+
const PHI_SHELL_HEADER_BANDS = [
|
|
16
|
+
["header_top", "--phi-shell-band-top"],
|
|
17
|
+
["header_main", "--phi-shell-band-main"],
|
|
18
|
+
["header_bottom", "--phi-shell-band-bottom"],
|
|
19
|
+
];
|
|
20
|
+
function readBandRoom(shell, regionKey) {
|
|
21
|
+
const band = shell.querySelector(`:scope > [data-phi-region-key="${regionKey}"]:not([hidden])`);
|
|
22
|
+
if (!band) {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
const givenBack = Number.parseFloat(getComputedStyle(band).marginBlockEnd) || 0;
|
|
26
|
+
return Math.max(0, Math.round(band.offsetHeight + givenBack));
|
|
27
|
+
}
|
|
28
|
+
export function usePhiShellHeaderBands({ active, elementRef, }) {
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
const element = elementRef.current;
|
|
31
|
+
const shell = active && element ? element.closest("[data-phi-shell-layout]") : null;
|
|
32
|
+
if (!element || !shell) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
let frame = 0;
|
|
36
|
+
const publish = () => {
|
|
37
|
+
frame = 0;
|
|
38
|
+
for (const [regionKey, property] of PHI_SHELL_HEADER_BANDS) {
|
|
39
|
+
const next = `${readBandRoom(shell, regionKey)}px`;
|
|
40
|
+
if (shell.style.getPropertyValue(property) !== next) {
|
|
41
|
+
shell.style.setProperty(property, next);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const schedule = () => {
|
|
46
|
+
if (frame === 0) {
|
|
47
|
+
frame = window.requestAnimationFrame(publish);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
publish();
|
|
51
|
+
window.addEventListener("resize", schedule);
|
|
52
|
+
const observer = new ResizeObserver(schedule);
|
|
53
|
+
for (const band of shell.querySelectorAll(':scope > [data-phi-region-key^="header_"]')) {
|
|
54
|
+
observer.observe(band);
|
|
55
|
+
}
|
|
56
|
+
return () => {
|
|
57
|
+
if (frame !== 0) {
|
|
58
|
+
window.cancelAnimationFrame(frame);
|
|
59
|
+
}
|
|
60
|
+
window.removeEventListener("resize", schedule);
|
|
61
|
+
observer.disconnect();
|
|
62
|
+
};
|
|
63
|
+
}, [active, elementRef]);
|
|
64
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* How much of the viewport's bottom a stuck `footer_bottom` holds right now, published on the Shell.
|
|
4
|
+
*
|
|
5
|
+
* The counterpart of `usePhiShellStickyTop`. A Sider stuck under the Header is as tall as what is left of
|
|
6
|
+
* the viewport, and with a Footer stuck to the bottom edge what is left ends at the Footer's top -- a
|
|
7
|
+
* Sider that did not know would run behind it, its last entries out of reach. The Footer's height is not
|
|
8
|
+
* a constant (its content wraps on a narrow screen, and at the page's end it stands in the flow higher
|
|
9
|
+
* up), so the edge is measured: the part of the viewport below the band's top, written as
|
|
10
|
+
* `--phi-shell-sticky-bottom` on the Shell element. Unset, a reader falls back to `0px`.
|
|
11
|
+
*
|
|
12
|
+
* Run by the Footer band itself (`phiCmsRegionFooterSticks`), so a Shell without a sticky Footer loads
|
|
13
|
+
* nothing for it, and it takes the property away again when the band stops sticking.
|
|
14
|
+
*/
|
|
15
|
+
export declare function usePhiShellStickyBottom({ active, elementRef, }: {
|
|
16
|
+
active: boolean;
|
|
17
|
+
elementRef: RefObject<HTMLElement | null>;
|
|
18
|
+
}): void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { PHI_SHELL_STICKY_BOTTOM_PROPERTY } from "../root/phi-shell-chrome-overlay";
|
|
4
|
+
/**
|
|
5
|
+
* How much of the viewport's bottom a stuck `footer_bottom` holds right now, published on the Shell.
|
|
6
|
+
*
|
|
7
|
+
* The counterpart of `usePhiShellStickyTop`. A Sider stuck under the Header is as tall as what is left of
|
|
8
|
+
* the viewport, and with a Footer stuck to the bottom edge what is left ends at the Footer's top -- a
|
|
9
|
+
* Sider that did not know would run behind it, its last entries out of reach. The Footer's height is not
|
|
10
|
+
* a constant (its content wraps on a narrow screen, and at the page's end it stands in the flow higher
|
|
11
|
+
* up), so the edge is measured: the part of the viewport below the band's top, written as
|
|
12
|
+
* `--phi-shell-sticky-bottom` on the Shell element. Unset, a reader falls back to `0px`.
|
|
13
|
+
*
|
|
14
|
+
* Run by the Footer band itself (`phiCmsRegionFooterSticks`), so a Shell without a sticky Footer loads
|
|
15
|
+
* nothing for it, and it takes the property away again when the band stops sticking.
|
|
16
|
+
*/
|
|
17
|
+
export function usePhiShellStickyBottom({ active, elementRef, }) {
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const element = elementRef.current;
|
|
20
|
+
const shell = active && element ? element.closest("[data-phi-shell-layout]") : null;
|
|
21
|
+
if (!element || !shell) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
let frame = 0;
|
|
25
|
+
const publish = () => {
|
|
26
|
+
frame = 0;
|
|
27
|
+
const rect = element.getBoundingClientRect();
|
|
28
|
+
const held = rect.height === 0 ? 0 : Math.max(0, Math.min(window.innerHeight, window.innerHeight - rect.top));
|
|
29
|
+
const next = `${Math.round(held)}px`;
|
|
30
|
+
if (shell.style.getPropertyValue(PHI_SHELL_STICKY_BOTTOM_PROPERTY) !== next) {
|
|
31
|
+
shell.style.setProperty(PHI_SHELL_STICKY_BOTTOM_PROPERTY, next);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const schedule = () => {
|
|
35
|
+
if (frame === 0) {
|
|
36
|
+
frame = window.requestAnimationFrame(publish);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
publish();
|
|
40
|
+
window.addEventListener("scroll", schedule, { passive: true });
|
|
41
|
+
window.addEventListener("resize", schedule);
|
|
42
|
+
const observer = new ResizeObserver(schedule);
|
|
43
|
+
observer.observe(element);
|
|
44
|
+
return () => {
|
|
45
|
+
if (frame !== 0) {
|
|
46
|
+
window.cancelAnimationFrame(frame);
|
|
47
|
+
}
|
|
48
|
+
window.removeEventListener("scroll", schedule);
|
|
49
|
+
window.removeEventListener("resize", schedule);
|
|
50
|
+
observer.disconnect();
|
|
51
|
+
shell.style.removeProperty(PHI_SHELL_STICKY_BOTTOM_PROPERTY);
|
|
52
|
+
};
|
|
53
|
+
}, [active, elementRef]);
|
|
54
|
+
}
|
|
@@ -28,6 +28,7 @@ export declare function usePhiTableBinding({ source, initialQuery, externalQuery
|
|
|
28
28
|
contractError: string | null;
|
|
29
29
|
loading: boolean;
|
|
30
30
|
error: PhiTableProviderError | null;
|
|
31
|
+
queryError: PhiTableProviderError | null;
|
|
31
32
|
query: PhiTableQuery;
|
|
32
33
|
resolvedQuery: PhiTableQuery;
|
|
33
34
|
setQuery: import("react").Dispatch<import("react").SetStateAction<PhiTableQuery>>;
|