@phis/ui 0.4.3 → 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-anchor-nav-control.js +4 -1
- package/components/controls/phi-background-control.d.ts +6 -1
- package/components/controls/phi-background-control.js +30 -7
- package/components/controls/phi-bullet-list-control.d.ts +7 -2
- package/components/controls/phi-bullet-list-control.js +4 -3
- package/components/controls/phi-button-control.d.ts +13 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-color-control.js +4 -2
- package/components/controls/phi-drawer-control-adapter.js +3 -2
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-inline-text-editor.js +7 -1
- package/components/controls/phi-length-control.js +1 -1
- 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 +16 -4
- package/components/controls/phi-ribbon-control.js +14 -8
- package/components/controls/phi-ribbon-wrap-control.d.ts +32 -0
- package/components/controls/phi-ribbon-wrap-control.js +31 -0
- package/components/controls/phi-segmented-control.d.ts +4 -1
- package/components/controls/phi-segmented-control.js +13 -2
- package/components/controls/phi-select-control.js +5 -2
- package/components/controls/phi-series-chart-control.d.ts +48 -0
- package/components/controls/phi-series-chart-control.js +82 -0
- 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/controls/phi-text-control.js +57 -3
- package/components/controls/phi-tree-control.js +1 -1
- package/components/controls/phi-truncated-hover-text.d.ts +15 -0
- package/components/controls/phi-truncated-hover-text.js +25 -0
- package/components/forms/link-target-form-control.d.ts +1 -1
- package/components/forms/link-target-form-control.js +2 -45
- package/components/forms/phi-form-widget-frame.js +4 -2
- package/components/layouts/clients/phi-three-column-layout-client.js +10 -1
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/navigation/phi-link.js +6 -1
- package/components/regions/clients/cms-region-container-client.js +16 -1
- package/components/regions/phi-cms-region-container.js +7 -0
- package/components/regions/phi-cms-region-shell.d.ts +22 -1
- package/components/regions/phi-cms-region-shell.js +131 -23
- package/components/root/phi-config-provider.d.ts +13 -0
- package/components/root/phi-config-provider.js +12 -1
- package/components/root/phi-root-background.d.ts +7 -0
- package/components/root/phi-root-background.js +20 -1
- 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 +15 -1
- package/components/root/phi-shell-chrome-overlay.d.ts +18 -1
- package/components/root/phi-shell-chrome-overlay.js +26 -4
- package/components/runtime/runtime-module-context.d.ts +12 -1
- package/components/runtime/runtime-module-context.js +6 -1
- package/components/shell/phi-antd-icon.d.ts +1 -0
- package/components/shell/phi-antd-icon.js +3 -0
- 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/shell/use-phi-shell-sticky-top.js +61 -16
- package/components/surface/phi-surface-tone.d.ts +13 -0
- package/components/surface/phi-surface-tone.js +21 -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/bullet-list-entries-editor.js +7 -1
- package/components/widgets/client/html-editor.js +1 -1
- 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/client/shared/use-page-reference-options.d.ts +17 -0
- package/components/widgets/client/shared/use-page-reference-options.js +57 -0
- package/components/widgets/config/background.d.ts +52 -1
- package/components/widgets/config/background.js +85 -4
- 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 +4 -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 +2 -0
- package/components/widgets/label-types/background.js +2 -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/bullet-list-vocabulary.d.ts +10 -0
- package/components/widgets/shared/bullet-list-vocabulary.js +5 -2
- package/components/widgets/shared/card-body-client.d.ts +16 -3
- package/components/widgets/shared/card-body-client.js +79 -8
- package/components/widgets/shared/card-vocabulary.d.ts +12 -2
- package/components/widgets/shared/card-vocabulary.js +7 -0
- 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-body-client.js +39 -10
- 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-container-chrome.js +6 -1
- 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/locale.d.ts +8 -0
- package/helpers/locale.js +18 -0
- package/helpers/mode-paint.d.ts +4 -0
- package/helpers/mode-paint.js +47 -0
- package/helpers/shell-region-style.js +2 -1
- package/helpers/surface-style.d.ts +12 -1
- package/helpers/surface-style.js +60 -12
- package/module-dashboard-cards.d.ts +2 -1
- package/module-dashboard-cards.js +2 -1
- package/module-records.d.ts +7 -0
- package/module-records.js +6 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/area-definitions.d.ts +0 -42
- package/plugins/runtime-modules/area-definitions.js +3 -8
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +21 -2
- package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
- package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +10 -5
- 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/edit-scaffold-drawer.js +3 -2
- package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
- package/plugins/runtime-modules/builder/persistence.js +9 -1
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +25 -15
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +4 -0
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +15 -4
- package/plugins/runtime-modules/client-authoring-module.d.ts +8 -1
- package/plugins/runtime-modules/client-authoring-module.js +13 -3
- 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/brand/client.d.ts +12 -3
- package/plugins/runtime-modules/core/widgets/brand/client.js +3 -11
- package/plugins/runtime-modules/core/widgets/brand/home.d.ts +15 -0
- package/plugins/runtime-modules/core/widgets/brand/home.js +18 -0
- package/plugins/runtime-modules/core/widgets/brand/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/brand/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/brand/server.js +2 -2
- 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 +100 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +57 -3
- package/plugins/runtime-modules/core/widgets/card/editor.js +21 -4
- package/plugins/runtime-modules/core/widgets/card/server.js +5 -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/description/client.js +3 -3
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/description/editor.js +3 -2
- package/plugins/runtime-modules/core/widgets/description/server.js +3 -2
- 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/config.d.ts +1 -0
- 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/config.d.ts +1 -0
- 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/header-navigation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/html/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +320 -2
- package/plugins/runtime-modules/core/widgets/markdown/config.js +18 -4
- package/plugins/runtime-modules/core/widgets/markdown/editor.js +9 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/client.js +6 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/markdown-toc/config.js +14 -2
- package/plugins/runtime-modules/core/widgets/quick-links/authoring.js +7 -2
- package/plugins/runtime-modules/core/widgets/quick-links/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/quick-links/items.d.ts +0 -2
- package/plugins/runtime-modules/core/widgets/quick-links/items.js +0 -15
- 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/result/config.d.ts +1 -0
- 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/sidebar-navigation/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
- 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/config.d.ts +3 -0
- 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/dashboard/card-rows.d.ts +3 -1
- package/plugins/runtime-modules/dashboard/card-rows.js +30 -2
- package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +29 -7
- package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +5 -40
- 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 +157 -22
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +5 -9
- package/runtime-data-provider-client.d.ts +2 -0
- package/runtime-data-provider-client.js +7 -0
- package/server-helpers/cms-link-targets.js +6 -0
- package/styles/controls.css +74 -7
- package/styles/gradients.css +101 -0
- package/styles/layout.css +45 -2
- package/styles/root.css +18 -0
- package/styles/shell.css +137 -0
- package/theme/phi-antd-token-resolver.js +20 -1
- 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 +6 -2
- package/theme/phi-theme-tokens.js +15 -0
- package/theme/phi-theme.d.ts +5 -0
- package/theme/phi-theme.js +21 -0
- package/theme/phi-tokens.d.ts +16 -15
- package/theme/phi-tokens.js +16 -15
- package/types/cms-plugins.d.ts +2 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +3 -0
- package/types/dashboard-cards.d.ts +39 -4
- package/types/dashboard-cards.js +6 -0
- package/types/layout-style.d.ts +9 -8
- package/types/layout-style.js +9 -8
- package/types/site-theme.d.ts +10 -2
- package/types/surface.d.ts +4 -0
- package/types/surface.js +4 -0
- package/types.d.ts +1 -1
- package/types.js +1 -1
|
@@ -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) {
|
|
@@ -53,6 +54,9 @@ export function resolvePhiRootTheme({ siteTheme, mode, fonts, presets, }) {
|
|
|
53
54
|
const resolvedShellHeaderMainBackground = resolvePhiShellRegionBackground(siteTheme?.shell, mode, { family: "header", region: "main" }) ??
|
|
54
55
|
(mode === "dark" ? PHI_DEFAULT_DARK_NAV_BACKGROUND : undefined);
|
|
55
56
|
const sharedComponentDefaults = buildPhiComponentTokens({
|
|
57
|
+
...(typeof effectiveThemeTokens.fontSizeSM === "number" ? { fontSizeSM: effectiveThemeTokens.fontSizeSM } : {}),
|
|
58
|
+
...(typeof effectiveThemeTokens.fontSize === "number" ? { fontSize: effectiveThemeTokens.fontSize } : {}),
|
|
59
|
+
...(typeof effectiveThemeTokens.lineHeight === "number" ? { lineHeight: effectiveThemeTokens.lineHeight } : {}),
|
|
56
60
|
layout: {
|
|
57
61
|
...(resolvedShellSiderBackground ? { siderBg: resolvedShellSiderBackground } : {}),
|
|
58
62
|
...(resolvedShellHeaderMainBackground ? { headerBg: resolvedShellHeaderMainBackground } : {}),
|
|
@@ -76,8 +80,18 @@ export function resolvePhiRootTheme({ siteTheme, mode, fonts, presets, }) {
|
|
|
76
80
|
});
|
|
77
81
|
const resolvedControlShape = resolvePhiControlShape(siteTheme.shape?.controls);
|
|
78
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
|
+
*/
|
|
79
88
|
const token = {
|
|
80
89
|
...effectiveThemeTokens,
|
|
90
|
+
...buildPhiThemeGradientTokens({
|
|
91
|
+
gradients: mergePhiThemePalettes(themePreset.palette, siteTheme?.palette).modes?.[mode]?.gradients,
|
|
92
|
+
token: effectiveThemeTokens,
|
|
93
|
+
primaryButtonGradient: readPhiThemeGradientKey(siteTheme?.buttons?.primaryGradient),
|
|
94
|
+
}),
|
|
81
95
|
};
|
|
82
96
|
return {
|
|
83
97
|
mode,
|
|
@@ -58,13 +58,18 @@ export declare const PHI_SHELL_CHROME_OVERLAY_IMAGE_SOURCE_KINDS: readonly PhiBa
|
|
|
58
58
|
export declare const PHI_SHELL_CHROME_OVERLAY_MOTION_MODES: readonly PhiBackgroundMotionMode[];
|
|
59
59
|
export type PhiShellChromeOverlayVariables = Record<`--phi-shell-chrome-${string}`, string>;
|
|
60
60
|
/**
|
|
61
|
-
* Whether this Region paints the shared overlay, which it does
|
|
61
|
+
* Whether this Region paints the shared overlay, which it does while it authored nothing itself -- or
|
|
62
|
+
* while what it authored is the overlay.
|
|
62
63
|
*
|
|
63
64
|
* A Region that authored its own chrome paints over the Theme, and that is how an Area keeps a look of
|
|
64
65
|
* its own. Authored means every carrier, not just one: the Region Surface's Background, the ground the
|
|
65
66
|
* Shell record sets, and a glass pane the Region asks for over that ground. Reading only the
|
|
66
67
|
* first let the Builder's Sider take the Site's overlay on top of the container ground it paints on
|
|
67
68
|
* purpose, which is what this exists to prevent.
|
|
69
|
+
*
|
|
70
|
+
* A Background whose Base is `theme` states the overlay, so a Chrome Region takes it whatever the Shell
|
|
71
|
+
* record says. The caller asks this only for a Region without a tone: a toned one wants the overlay of
|
|
72
|
+
* its tone's mode, which it paints itself (`PHI_BACKGROUND_THEME_STYLE`).
|
|
68
73
|
*/
|
|
69
74
|
export declare function phiRegionUsesShellChromeOverlay({ regionKey, backgroundConfig, pane, grounds, }: {
|
|
70
75
|
regionKey: string;
|
|
@@ -125,6 +130,18 @@ export declare function resolvePhiShellChromePaneStickyTop(bands: readonly PhiSh
|
|
|
125
130
|
*/
|
|
126
131
|
export declare const PHI_SHELL_HEADER_TOP_EXTENT_PROPERTY = "--phi-shell-header-top-extent";
|
|
127
132
|
export declare const PHI_SHELL_HEADER_TOP_STACK_PROPERTY = "--phi-shell-header-top-stack";
|
|
133
|
+
/**
|
|
134
|
+
* The Header's measured bottom: the lowest bottom of every Header band stuck right now, written on the
|
|
135
|
+
* Shell by `usePhiShellStickyTop` (components/shell/use-phi-shell-sticky-top.ts). A sticky Table header
|
|
136
|
+
* and a stuck Sider stand under it; unset, it reads `0px`.
|
|
137
|
+
*/
|
|
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";
|
|
128
145
|
/**
|
|
129
146
|
* How `header_top` behaves where the browser decides it, as far as the Header pane is concerned.
|
|
130
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
|
*
|
|
@@ -76,17 +76,27 @@ const PHI_SHELL_CHROME_OVERLAY_REGION_KEYS = [
|
|
|
76
76
|
"footer_bottom",
|
|
77
77
|
];
|
|
78
78
|
/**
|
|
79
|
-
* Whether this Region paints the shared overlay, which it does
|
|
79
|
+
* Whether this Region paints the shared overlay, which it does while it authored nothing itself -- or
|
|
80
|
+
* while what it authored is the overlay.
|
|
80
81
|
*
|
|
81
82
|
* A Region that authored its own chrome paints over the Theme, and that is how an Area keeps a look of
|
|
82
83
|
* its own. Authored means every carrier, not just one: the Region Surface's Background, the ground the
|
|
83
84
|
* Shell record sets, and a glass pane the Region asks for over that ground. Reading only the
|
|
84
85
|
* first let the Builder's Sider take the Site's overlay on top of the container ground it paints on
|
|
85
86
|
* purpose, which is what this exists to prevent.
|
|
87
|
+
*
|
|
88
|
+
* A Background whose Base is `theme` states the overlay, so a Chrome Region takes it whatever the Shell
|
|
89
|
+
* record says. The caller asks this only for a Region without a tone: a toned one wants the overlay of
|
|
90
|
+
* its tone's mode, which it paints itself (`PHI_BACKGROUND_THEME_STYLE`).
|
|
86
91
|
*/
|
|
87
92
|
export function phiRegionUsesShellChromeOverlay({ regionKey, backgroundConfig, pane, grounds, }) {
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
if (!PHI_SHELL_CHROME_OVERLAY_REGION_KEYS.includes(regionKey)) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
if (backgroundConfig != null && normalizePhiBackgroundWidgetConfig(backgroundConfig).base.kind === "theme") {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return (backgroundConfig == null &&
|
|
90
100
|
pane == null &&
|
|
91
101
|
grounds.every((ground) => ground == null));
|
|
92
102
|
}
|
|
@@ -223,6 +233,18 @@ export function resolvePhiShellChromePaneStickyTop(bands) {
|
|
|
223
233
|
*/
|
|
224
234
|
export const PHI_SHELL_HEADER_TOP_EXTENT_PROPERTY = "--phi-shell-header-top-extent";
|
|
225
235
|
export const PHI_SHELL_HEADER_TOP_STACK_PROPERTY = "--phi-shell-header-top-stack";
|
|
236
|
+
/**
|
|
237
|
+
* The Header's measured bottom: the lowest bottom of every Header band stuck right now, written on the
|
|
238
|
+
* Shell by `usePhiShellStickyTop` (components/shell/use-phi-shell-sticky-top.ts). A sticky Table header
|
|
239
|
+
* and a stuck Sider stand under it; unset, it reads `0px`.
|
|
240
|
+
*/
|
|
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";
|
|
226
248
|
/**
|
|
227
249
|
* Where the Header pane sticks when `header_top` may come and go.
|
|
228
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,
|
|
@@ -17,6 +17,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
|
|
|
17
17
|
readonly CalendarOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CalendarOutlined")>;
|
|
18
18
|
readonly CheckOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CheckOutlined")>;
|
|
19
19
|
readonly CloseOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CloseOutlined")>;
|
|
20
|
+
readonly CloudDownloadOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CloudDownloadOutlined")>;
|
|
20
21
|
readonly CloudUploadOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CloudUploadOutlined")>;
|
|
21
22
|
readonly ClusterOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ClusterOutlined")>;
|
|
22
23
|
readonly CodeOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CodeOutlined")>;
|
|
@@ -38,6 +38,7 @@ const PHI_ANTD_ICON_LOADERS = {
|
|
|
38
38
|
CalendarOutlined: () => import("@ant-design/icons-svg/es/asn/CalendarOutlined"),
|
|
39
39
|
CheckOutlined: () => import("@ant-design/icons-svg/es/asn/CheckOutlined"),
|
|
40
40
|
CloseOutlined: () => import("@ant-design/icons-svg/es/asn/CloseOutlined"),
|
|
41
|
+
CloudDownloadOutlined: () => import("@ant-design/icons-svg/es/asn/CloudDownloadOutlined"),
|
|
41
42
|
CloudUploadOutlined: () => import("@ant-design/icons-svg/es/asn/CloudUploadOutlined"),
|
|
42
43
|
ClusterOutlined: () => import("@ant-design/icons-svg/es/asn/ClusterOutlined"),
|
|
43
44
|
CodeOutlined: () => import("@ant-design/icons-svg/es/asn/CodeOutlined"),
|
|
@@ -327,6 +328,8 @@ export const PHI_ANTD_ICON_NAMES = {
|
|
|
327
328
|
"video-camera-two-tone": "VideoCameraTwoTone",
|
|
328
329
|
warning: "WarningOutlined",
|
|
329
330
|
"warning-outlined": "WarningOutlined",
|
|
331
|
+
"cloud-download": "CloudDownloadOutlined",
|
|
332
|
+
"cloud-download-outlined": "CloudDownloadOutlined",
|
|
330
333
|
"cloud-upload": "CloudUploadOutlined",
|
|
331
334
|
"cloud-upload-outlined": "CloudUploadOutlined",
|
|
332
335
|
"eye-invisible": "EyeInvisibleOutlined",
|
|
@@ -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
|
+
}
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
+
import { PHI_SHELL_STICKY_TOP_PROPERTY } from "../root/phi-shell-chrome-overlay";
|
|
3
4
|
/**
|
|
4
5
|
* How far down the viewport the Shell's Header holds right now, published on the Shell.
|
|
5
6
|
*
|
|
6
7
|
* Something that sticks to the top of the page -- a Table's header row -- has to stick under the Header
|
|
7
8
|
* rather than behind it, and where the Header ends is not a constant: each band sticks or scrolls by its
|
|
8
9
|
* own config, and a revealing `header_top` slides away while the visitor reads down and comes back when
|
|
9
|
-
* they scroll up. So the edge is measured, not configured: the lowest bottom of
|
|
10
|
-
* stuck
|
|
10
|
+
* they scroll up. So the edge is measured, not configured: the lowest visible bottom of the Header bands,
|
|
11
|
+
* stuck or in the flow, written as `--phi-shell-sticky-top` on the Shell element. Unset, a reader falls
|
|
11
12
|
* back to `0px`, which is right for a Shell without a sticky Header.
|
|
12
13
|
*
|
|
13
|
-
* Run by whatever sticks under it -- every sticky Table does
|
|
14
|
-
*
|
|
15
|
-
* Modal's or Drawer's body scrolls on
|
|
14
|
+
* Run by whatever sticks under it -- every sticky Table does, and the Region renderer for a stuck Sider
|
|
15
|
+
* (`phiCmsRegionSiderSticks`) -- so a page without one loads nothing for it. Each runner measures all the
|
|
16
|
+
* bands and they all write the same value. Not inside an Overlay: a Modal's or Drawer's body scrolls on
|
|
17
|
+
* its own, and its top edge is the line.
|
|
16
18
|
*/
|
|
17
|
-
const PHI_SHELL_STICKY_TOP_PROPERTY = "--phi-shell-sticky-top";
|
|
18
19
|
const HEADER_BANDS = '[data-phi-region-key^="header_"]:not([hidden])';
|
|
19
20
|
function measurePhiShellStickyTop(shell) {
|
|
21
|
+
/*
|
|
22
|
+
* The lowest visible bottom of the Header bands, stuck or not. Counting only the bands stuck at this
|
|
23
|
+
* moment made the edge jump: a band leaving its sticking line for its place in the flow -- the main
|
|
24
|
+
* band while the top band scrolls back in above it -- dropped out of the count at once, and whatever
|
|
25
|
+
* stuck under it leapt up by the band's height. Counted while it is in view, the edge moves with the
|
|
26
|
+
* scroll instead. A band in the flow stands above the content anyway, so nothing sticks too low for it.
|
|
27
|
+
*/
|
|
20
28
|
let bottom = 0;
|
|
21
29
|
for (const band of shell.querySelectorAll(HEADER_BANDS)) {
|
|
22
|
-
const style = window.getComputedStyle(band);
|
|
23
|
-
if (style.position !== "sticky" && style.position !== "fixed") {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
30
|
const rect = band.getBoundingClientRect();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
if (rect.height === 0 || rect.top > stuckAt + 1 || rect.bottom <= 0) {
|
|
31
|
+
// Empty, or scrolled or slid out of the viewport.
|
|
32
|
+
if (rect.height === 0 || rect.bottom <= 0) {
|
|
30
33
|
continue;
|
|
31
34
|
}
|
|
32
35
|
bottom = Math.max(bottom, rect.bottom);
|
|
@@ -57,10 +60,46 @@ export function usePhiShellStickyTop({ active, elementRef, }) {
|
|
|
57
60
|
}
|
|
58
61
|
};
|
|
59
62
|
publish();
|
|
63
|
+
/*
|
|
64
|
+
* A revealing band moves by a transition. Measured only where it settled, whatever sticks under it
|
|
65
|
+
* would stand still while the band slides and then jump; so while a transition runs in the Shell the
|
|
66
|
+
* edge is measured every frame, and once more where it ends.
|
|
67
|
+
*/
|
|
68
|
+
let following = 0;
|
|
69
|
+
let followFrame = 0;
|
|
70
|
+
const follow = () => {
|
|
71
|
+
publish();
|
|
72
|
+
followFrame = following > 0 ? window.requestAnimationFrame(follow) : 0;
|
|
73
|
+
};
|
|
74
|
+
// Only a Header band's own transitions move the edge; a button's hover elsewhere in the Shell does not.
|
|
75
|
+
const isBandTransition = (event) => event.target instanceof Element && event.target.closest(HEADER_BANDS) !== null;
|
|
76
|
+
// A transition whose element leaves the page never ends; the follow stops on its own regardless.
|
|
77
|
+
let followTimeout = 0;
|
|
78
|
+
const stopFollowing = () => {
|
|
79
|
+
following = 0;
|
|
80
|
+
followTimeout = 0;
|
|
81
|
+
};
|
|
82
|
+
const transitionStarted = (event) => {
|
|
83
|
+
if (!isBandTransition(event))
|
|
84
|
+
return;
|
|
85
|
+
following += 1;
|
|
86
|
+
window.clearTimeout(followTimeout);
|
|
87
|
+
followTimeout = window.setTimeout(stopFollowing, 2000);
|
|
88
|
+
if (followFrame === 0) {
|
|
89
|
+
followFrame = window.requestAnimationFrame(follow);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const transitionStopped = (event) => {
|
|
93
|
+
if (!isBandTransition(event))
|
|
94
|
+
return;
|
|
95
|
+
following = Math.max(0, following - 1);
|
|
96
|
+
schedule();
|
|
97
|
+
};
|
|
60
98
|
window.addEventListener("scroll", schedule, { passive: true });
|
|
61
99
|
window.addEventListener("resize", schedule);
|
|
62
|
-
|
|
63
|
-
shell.addEventListener("transitionend",
|
|
100
|
+
shell.addEventListener("transitionrun", transitionStarted);
|
|
101
|
+
shell.addEventListener("transitionend", transitionStopped);
|
|
102
|
+
shell.addEventListener("transitioncancel", transitionStopped);
|
|
64
103
|
const observer = new ResizeObserver(schedule);
|
|
65
104
|
for (const band of shell.querySelectorAll(HEADER_BANDS)) {
|
|
66
105
|
observer.observe(band);
|
|
@@ -69,9 +108,15 @@ export function usePhiShellStickyTop({ active, elementRef, }) {
|
|
|
69
108
|
if (frame !== 0) {
|
|
70
109
|
window.cancelAnimationFrame(frame);
|
|
71
110
|
}
|
|
111
|
+
if (followFrame !== 0) {
|
|
112
|
+
window.cancelAnimationFrame(followFrame);
|
|
113
|
+
}
|
|
114
|
+
window.clearTimeout(followTimeout);
|
|
72
115
|
window.removeEventListener("scroll", schedule);
|
|
73
116
|
window.removeEventListener("resize", schedule);
|
|
74
|
-
shell.removeEventListener("
|
|
117
|
+
shell.removeEventListener("transitionrun", transitionStarted);
|
|
118
|
+
shell.removeEventListener("transitionend", transitionStopped);
|
|
119
|
+
shell.removeEventListener("transitioncancel", transitionStopped);
|
|
75
120
|
observer.disconnect();
|
|
76
121
|
};
|
|
77
122
|
}, [active, elementRef]);
|
|
@@ -16,3 +16,16 @@ export declare function PhiSurfaceTone({ tone, children, }: {
|
|
|
16
16
|
tone: PhiSurfaceToneValue | null | undefined;
|
|
17
17
|
children: ReactNode;
|
|
18
18
|
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* The page's own mode around something that belongs to the page's tools rather than to its content.
|
|
21
|
+
*
|
|
22
|
+
* The Builder draws its scaffolds -- tool bars, drag handles, the effects preview -- inside the Surfaces
|
|
23
|
+
* they edit, and a toned Surface would turn them with its content. This turns them back: inside a tone
|
|
24
|
+
* scope it mounts the page's mode again (its Ant Design components take it by themselves), outside one it
|
|
25
|
+
* renders the children as they are. `className` is the class an element of the caller's that reads the
|
|
26
|
+
* Theme's variables itself must carry, so they resolve in the page's mode there too; empty outside a tone.
|
|
27
|
+
*/
|
|
28
|
+
export declare function usePhiPageModeTone(): {
|
|
29
|
+
className: string | undefined;
|
|
30
|
+
wrap: (children: ReactNode) => ReactNode;
|
|
31
|
+
};
|
|
@@ -34,3 +34,24 @@ export function PhiSurfaceTone({ tone, children, }) {
|
|
|
34
34
|
}
|
|
35
35
|
return (_jsx(Suspense, { fallback: null, children: _jsx(PhiSurfaceToneScope, { mode: target, cssVarKey: cssVarKey, source: source, children: children }) }));
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The page's own mode around something that belongs to the page's tools rather than to its content.
|
|
39
|
+
*
|
|
40
|
+
* The Builder draws its scaffolds -- tool bars, drag handles, the effects preview -- inside the Surfaces
|
|
41
|
+
* they edit, and a toned Surface would turn them with its content. This turns them back: inside a tone
|
|
42
|
+
* scope it mounts the page's mode again (its Ant Design components take it by themselves), outside one it
|
|
43
|
+
* renders the children as they are. `className` is the class an element of the caller's that reads the
|
|
44
|
+
* Theme's variables itself must carry, so they resolve in the page's mode there too; empty outside a tone.
|
|
45
|
+
*/
|
|
46
|
+
export function usePhiPageModeTone() {
|
|
47
|
+
const { mode } = usePhiConfig();
|
|
48
|
+
const source = usePhiThemeToneSource();
|
|
49
|
+
const pageMode = source?.pageMode ?? mode;
|
|
50
|
+
if (pageMode === mode) {
|
|
51
|
+
return { className: undefined, wrap: (children) => children };
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
className: resolvePhiSurfaceToneClassName(pageMode),
|
|
55
|
+
wrap: (children) => _jsx(PhiSurfaceTone, { tone: pageMode, children: children }),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -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>>;
|