@phis/ui 0.4.8 → 0.4.12
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/components/cms/phi-cms-area-access-guard.js +9 -1
- package/components/cms/phi-cms-area-render-scope.d.ts +8 -4
- package/components/cms/phi-cms-area-render-scope.js +26 -11
- package/components/cms/phi-cms-root-layout.js +4 -2
- package/components/cms/phi-cms-runtime-registry.d.ts +2 -1
- package/components/cms/phi-cms-runtime-registry.js +1 -1
- package/components/controls/phi-color-control.js +2 -1
- package/components/controls/phi-drawer-control-adapter.js +2 -3
- package/components/controls/phi-drawer-control.js +3 -3
- package/components/controls/phi-dropdown-control.js +2 -1
- package/components/controls/phi-float-button-control.js +3 -3
- package/components/controls/phi-modal-control-adapter.js +2 -2
- package/components/controls/phi-modal-control.js +3 -3
- package/components/controls/phi-ribbon-wrap-control.js +2 -1
- package/components/controls/phi-zoom-image-overlay.js +11 -5
- package/components/forms/auth-admin-settings-labels.d.ts +35 -0
- package/components/forms/auth-admin-settings-labels.js +27 -0
- package/components/forms/content-entry-forms.js +1 -5
- package/components/forms/form-descriptor-runtime-client.js +2 -1
- package/components/forms/form-descriptor-text.d.ts +17 -0
- package/components/forms/form-descriptor-text.js +14 -0
- package/components/forms/runtime-form-controller-plugin.d.ts +0 -115
- package/components/forms/runtime-form-controller-plugin.js +1 -1
- package/components/forms/upload-form-control.d.ts +0 -7
- package/components/forms/upload-form-control.js +1 -1
- package/components/layouts/clients/phi-collapsible-layout-client.js +2 -1
- package/components/layouts/clients/phi-flex-layout-client.js +7 -1
- package/components/layouts/clients/phi-sequence-slot-editor.js +2 -1
- package/components/layouts/clients/phi-split-card-half.js +2 -1
- package/components/layouts/phi-base-layout.js +2 -1
- package/components/layouts/phi-layout-surface-box.js +2 -1
- package/components/media/phi-media-picker-server.js +3 -11
- package/components/navigation/use-phi-protected-mail.js +1 -9
- package/components/regions/presets/clients/sider-context.js +4 -2
- package/components/root/phi-config-provider.js +2 -1
- package/components/root/phi-dayjs-locale.d.ts +4 -1
- package/components/root/phi-dayjs-locale.js +2 -2
- package/components/root/phi-intl-locale.d.ts +7 -1
- package/components/root/phi-intl-locale.js +20 -15
- package/components/root/phi-root-layout.js +2 -1
- package/components/runtime/core-runtime-controller-plugin.d.ts +0 -84
- package/components/runtime/core-runtime-controller-plugin.js +1 -1
- package/components/runtime/runtime-controller-server-host.js +20 -9
- package/components/runtime/runtime-signal-bus.js +39 -4
- package/components/shell/phi-antd-icon.d.ts +3 -0
- package/components/shell/phi-antd-icon.js +9 -0
- package/components/state/use-phi-hydrated.d.ts +6 -0
- package/components/state/use-phi-hydrated.js +11 -0
- package/components/tables/phi-plain-table.d.ts +4 -0
- package/components/tables/phi-plain-table.js +1 -1
- package/components/widgets/client/shared/phi-rendered-value.js +4 -3
- package/components/widgets/config/parser-primitives.d.ts +5 -0
- package/components/widgets/config/parser-primitives.js +11 -0
- package/components/widgets/label-sets/runtime-options.d.ts +1 -1
- package/components/widgets/server/builder-chrome.js +2 -6
- package/components/widgets/server/search.js +2 -6
- package/components/widgets/shared/markdown-body-client.d.ts +7 -0
- package/components/widgets/shared/markdown-body-client.js +2 -0
- package/components/widgets/shared/markdown-render.js +48 -1
- package/controls.d.ts +2 -0
- package/controls.js +3 -0
- package/gateway/dashboard-cards-route.js +5 -7
- package/gateway/navigation-target-route.js +7 -9
- package/gateway/page-references-route.js +6 -8
- package/gateway/site-config.js +3 -0
- package/gateway/site-proxy.js +13 -2
- package/helpers/class-names.d.ts +7 -0
- package/helpers/class-names.js +10 -0
- package/helpers/cms-navigation-catalog.js +4 -2
- package/helpers/cms-page-catalog.js +35 -6
- package/helpers/cms-region-keys.d.ts +0 -1
- package/helpers/cms-region-keys.js +1 -1
- package/helpers/format-date-time.d.ts +14 -3
- package/helpers/format-date-time.js +27 -11
- package/helpers/region-page-scope.d.ts +1 -3
- package/helpers/region-page-scope.js +0 -4
- package/helpers/translation-format.d.ts +6 -0
- package/helpers/translation-format.js +15 -8
- package/package.json +2 -2
- package/plugins/runtime/phi-slot-child-frame-view.js +2 -1
- package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +1 -1
- package/plugins/runtime-modules/admin/forms.js +1 -1
- package/plugins/runtime-modules/admin/trees/phi-default-admin-settings-page-tree.js +2 -5
- package/plugins/runtime-modules/app/forms.js +1 -1
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +2 -6
- package/plugins/runtime-modules/asset/metadata-form.js +2 -6
- package/plugins/runtime-modules/asset/settings-forms.js +1 -1
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +2 -5
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -6
- package/plugins/runtime-modules/asset/widgets/area-upload/server.js +2 -6
- package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +1 -3
- package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -6
- package/plugins/runtime-modules/asset/widgets.js +5 -7
- package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
- package/plugins/runtime-modules/auth/data-providers.d.ts +5 -0
- package/plugins/runtime-modules/auth/data-providers.js +3 -0
- package/plugins/runtime-modules/auth/definition.d.ts +5 -0
- package/plugins/runtime-modules/auth/ids.d.ts +7 -7
- package/plugins/runtime-modules/auth/ids.js +7 -7
- package/plugins/runtime-modules/auth/services/installations-table.js +3 -1
- package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +2 -6
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +26 -14
- package/plugins/runtime-modules/auth/widgets/security/client.js +5 -1
- package/plugins/runtime-modules/auth/widgets.d.ts +1 -2
- package/plugins/runtime-modules/auth/widgets.js +5 -7
- package/plugins/runtime-modules/avatar/overlay-tree.server.js +2 -6
- package/plugins/runtime-modules/avatar/widgets/account-avatar/server.js +2 -6
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/server.js +2 -6
- package/plugins/runtime-modules/avatar/widgets.js +3 -5
- package/plugins/runtime-modules/builder/clients/pages-workspace.d.ts +2 -3
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +5 -18
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +1 -0
- package/plugins/runtime-modules/builder/controller/page-controller.js +1 -1
- package/plugins/runtime-modules/builder/controller/server-definition.js +3 -11
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +2 -6
- package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +2 -8
- package/plugins/runtime-modules/builder/developer-workspace-store.js +24 -44
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +0 -5
- package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +2 -1
- package/plugins/runtime-modules/builder/inspector-section-widget.js +6 -31
- package/plugins/runtime-modules/builder/navigation-persistence.js +12 -3
- package/plugins/runtime-modules/builder/page-meta-form.js +4 -12
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +0 -1
- package/plugins/runtime-modules/builder/page-presets.server.js +0 -24
- package/plugins/runtime-modules/builder/pages-workspace.js +6 -16
- package/plugins/runtime-modules/builder/persistence.d.ts +6 -4
- package/plugins/runtime-modules/builder/persistence.js +6 -7
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +0 -1
- package/plugins/runtime-modules/builder/shells-workspace.js +3 -11
- package/plugins/runtime-modules/builder/signal-wiring-form.js +3 -7
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +2 -6
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -26
- package/plugins/runtime-modules/builder/trees/phi-default-builder-settings-page-tree.js +2 -6
- package/plugins/runtime-modules/builder/widgets/developer-builder-pages-header/plugin.js +2 -6
- package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.js +2 -6
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +3 -2
- package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +1 -6
- package/plugins/runtime-modules/builder/widgets.js +10 -12
- package/plugins/runtime-modules/client-authoring-module.js +18 -1
- package/plugins/runtime-modules/contracts.d.ts +15 -1
- package/plugins/runtime-modules/contracts.js +10 -0
- package/plugins/runtime-modules/core/messaging/forms.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
- package/plugins/runtime-modules/core/widgets/description/server.js +12 -9
- package/plugins/runtime-modules/core/widgets/dimension/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/draft-status/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/entry-list/config.js +2 -9
- package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +1 -1
- package/plugins/runtime-modules/core/widgets/form-preview/client.js +2 -15
- package/plugins/runtime-modules/core/widgets/gallery/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/image/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/length/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/markdown-toc/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/page-title/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/pagination/config.js +4 -8
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/result/config.js +15 -10
- package/plugins/runtime-modules/core/widgets/result/server.js +1 -1
- package/plugins/runtime-modules/core/widgets/search-results/config.js +2 -8
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.js +8 -13
- package/plugins/runtime-modules/core/widgets/table/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/theme-mode-switch/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +16 -31
- package/plugins/runtime-modules/core/widgets/timeline/client.js +9 -4
- package/plugins/runtime-modules/core/widgets/tour-button/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/tree/client.js +1 -1
- package/plugins/runtime-modules/core/widgets.js +59 -61
- package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +7 -5
- package/plugins/runtime-modules/dashboard/trees/phi-default-admin-dashboard-page-tree.js +2 -6
- package/plugins/runtime-modules/dashboard/trees/phi-default-area-dashboard-page-tree.js +2 -6
- package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +2 -6
- package/plugins/runtime-modules/descriptor-compiler.js +6 -6
- package/plugins/runtime-modules/groups/controller/client.d.ts +0 -56
- package/plugins/runtime-modules/groups/controller/client.js +1 -1
- package/plugins/runtime-modules/groups/forms.js +1 -5
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +2 -6
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -6
- package/plugins/runtime-modules/localization/forms.js +2 -6
- package/plugins/runtime-modules/localization/services/options.js +19 -9
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -11
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -11
- package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +3 -11
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +4 -109
- package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +2 -2
- package/plugins/runtime-modules/preset-contracts/pub-area.js +0 -4
- package/plugins/runtime-modules/pub-area-preset.js +0 -20
- package/plugins/runtime-modules/public/trees/phi-default-pub-error-page-tree.js +5 -5
- package/plugins/runtime-modules/revisions/forms.js +1 -1
- package/plugins/runtime-modules/revisions/services/table.js +6 -2
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
- package/plugins/runtime-modules/theme/controller/server-definition.js +2 -6
- package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +2 -6
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -21
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +0 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +0 -8
- package/plugins/runtime-modules/theme/widgets.js +6 -8
- package/plugins/runtime-modules/threads/controller/client.d.ts +0 -78
- package/plugins/runtime-modules/threads/controller/client.js +1 -1
- package/plugins/runtime-modules/threads/forms.js +1 -1
- package/plugins/runtime-modules/threads/ids.d.ts +0 -1
- package/plugins/runtime-modules/threads/ids.js +0 -2
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +8 -6
- package/plugins/runtime-modules/user-management/controller/client.d.ts +0 -73
- package/plugins/runtime-modules/user-management/controller/client.js +1 -1
- package/plugins/runtime-modules/user-management/forms.js +1 -5
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +3 -7
- package/plugins/runtime-modules/video/widgets.js +2 -4
- package/server-helpers/cms-request.d.ts +19 -0
- package/server-helpers/cms-request.js +26 -8
- package/server-helpers/cms-root.js +27 -21
- package/server-helpers/public-login-route.js +6 -8
- package/server-helpers/runtime.js +1 -1
- package/server-helpers/search-index.js +34 -14
- package/styles/controls.css +11 -0
- package/styles/shell.css +11 -1
- package/types/length.js +8 -3
- package/types/site-config.d.ts +6 -4
- package/types/widget-runtime.d.ts +2 -3
- package/types.d.ts +5 -3
- package/types.js +3 -0
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import type { PhiFormFieldProviderProps } from "./form-provider-registry";
|
|
2
|
-
/**
|
|
3
|
-
* What the Form value is: the Media Asset ids the finished uploads left behind.
|
|
4
|
-
*
|
|
5
|
-
* Exported because a handler and a test read the same shape, and because the one thing a caller must not
|
|
6
|
-
* do is guess it from a sample payload.
|
|
7
|
-
*/
|
|
8
|
-
export declare function readPhiFormUploadAssetIds(value: unknown): readonly number[];
|
|
9
2
|
/**
|
|
10
3
|
* The shared upload field Control: attach a file, watch it arrive, take it back out again.
|
|
11
4
|
*
|
|
@@ -22,7 +22,7 @@ const MEDIA_KINDS = new Set(Object.values(PhiMediaKind));
|
|
|
22
22
|
* Exported because a handler and a test read the same shape, and because the one thing a caller must not
|
|
23
23
|
* do is guess it from a sample payload.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
function readPhiFormUploadAssetIds(value) {
|
|
26
26
|
if (!Array.isArray(value)) {
|
|
27
27
|
return [];
|
|
28
28
|
}
|
|
@@ -17,6 +17,7 @@ import { PhiSurfaceGroundLayer } from "../../surface/phi-surface-ground";
|
|
|
17
17
|
import { usePhiLayoutSignalSurface } from "../phi-layout-signal-surface";
|
|
18
18
|
import { PhiSurfaceTone } from "../../surface/phi-surface-tone";
|
|
19
19
|
import { resolvePhiSurfaceToneClassName } from "../../../types/surface";
|
|
20
|
+
import { joinPhiClassNames } from "../../../helpers/class-names";
|
|
20
21
|
function isRenderableSlotChild(child) {
|
|
21
22
|
return child !== null && child !== undefined && child !== false;
|
|
22
23
|
}
|
|
@@ -402,7 +403,7 @@ function PhiCollapsibleLayoutBody({ blockId, slots, slotKeys, slotMeta, panelMin
|
|
|
402
403
|
};
|
|
403
404
|
})
|
|
404
405
|
.filter((item) => item !== null);
|
|
405
|
-
return (_jsx(PhiSurfaceTone, { tone: surface?.tone, children: _jsxs("div", { "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className:
|
|
406
|
+
return (_jsx(PhiSurfaceTone, { tone: surface?.tone, children: _jsxs("div", { "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: joinPhiClassNames("phi-layout", resolvePhiSurfaceToneClassName(surface?.tone)), style: resolvedStyle, children: [_jsx(PhiSurfaceGroundLayer, { ground: ground }), _jsx("div", {
|
|
406
407
|
/*
|
|
407
408
|
* The grounds inside follow the corner outside.
|
|
408
409
|
*
|
|
@@ -129,7 +129,13 @@ export function PhiFlexLayout({ slots, ...layoutProps }) {
|
|
|
129
129
|
flexBasis: "auto",
|
|
130
130
|
...collapsedStyle,
|
|
131
131
|
width: shouldFillCrossAxis ? "100%" : undefined,
|
|
132
|
-
|
|
132
|
+
/*
|
|
133
|
+
* No `height: 100%` on the main axis: filling it is `flex-grow`'s job. A percentage here is
|
|
134
|
+
* the flex basis, and once the column's height is known -- the sum of its slots' content,
|
|
135
|
+
* from the intrinsic pass -- every filling slot would start at the whole column and be
|
|
136
|
+
* shrunk back in equal shares, cutting each below its content so it ran into the next.
|
|
137
|
+
* From content, a slot only grows into room that is left over.
|
|
138
|
+
*/
|
|
133
139
|
minWidth: 0,
|
|
134
140
|
minHeight: 0,
|
|
135
141
|
alignSelf: shouldFillCrossAxis ? "stretch" : undefined,
|
|
@@ -12,6 +12,7 @@ import { PhiIcon } from "../../shell/phi-icon";
|
|
|
12
12
|
import { PhiSurfaceGroundLayer } from "../../surface/phi-surface-ground";
|
|
13
13
|
import { PhiSurfaceTone } from "../../surface/phi-surface-tone";
|
|
14
14
|
import { resolvePhiSurfaceToneClassName } from "../../../types/surface";
|
|
15
|
+
import { joinPhiClassNames } from "../../../helpers/class-names";
|
|
15
16
|
export function PhiSequenceSlotEditor({ slots, slotKeys, slotLabels, slotCount, activeIndex, onActiveIndexChange, slotNoun, layoutKind, renderMode, authoring, chrome, editSlotAction, editRenderInsertControl, editSlotAnchor = "center", style, }) {
|
|
16
17
|
const isAuthoringRender = isPhiLayoutAuthoringRender({ ...authoring, renderMode });
|
|
17
18
|
const editableSlotCount = Math.max(slotCount, 1);
|
|
@@ -24,7 +25,7 @@ export function PhiSequenceSlotEditor({ slots, slotKeys, slotLabels, slotCount,
|
|
|
24
25
|
const hasNextSlot = currentIndex < editableSlotCount - 1;
|
|
25
26
|
const { style: resolvedLayoutStyle, ground, hasExplicitLayoutBackground, } = resolvePhiBaseLayoutChrome(chrome);
|
|
26
27
|
const resolvedLayoutInset = resolvePhiLayoutInset(chrome);
|
|
27
|
-
return (_jsx(PhiSurfaceTone, { tone: chrome.surface?.tone, children: _jsxs("div", { "data-layout-kind": layoutKind, "data-phi-block-render-mode": renderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className:
|
|
28
|
+
return (_jsx(PhiSurfaceTone, { tone: chrome.surface?.tone, children: _jsxs("div", { "data-layout-kind": layoutKind, "data-phi-block-render-mode": renderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: joinPhiClassNames("phi-layout", resolvePhiSurfaceToneClassName(chrome.surface?.tone)), style: {
|
|
28
29
|
position: "relative",
|
|
29
30
|
display: "flex",
|
|
30
31
|
flexDirection: "column",
|
|
@@ -7,6 +7,7 @@ import { resolvePhiSplitCardGroundFrame } from "../split-card-geometry";
|
|
|
7
7
|
import { PhiSurfaceTone } from "../../surface/phi-surface-tone";
|
|
8
8
|
import { PHI_LAYOUT_SURFACE_RADIUS } from "../phi-layout-contract";
|
|
9
9
|
import { usePhiLayoutSignalSurface } from "../phi-layout-signal-surface";
|
|
10
|
+
import { joinPhiClassNames } from "../../../helpers/class-names";
|
|
10
11
|
/**
|
|
11
12
|
* One of the Split Card's two cards.
|
|
12
13
|
*
|
|
@@ -29,5 +30,5 @@ export function PhiSplitCardHalf({ blockId, surface, side, gap, swapped, style,
|
|
|
29
30
|
forceGroundLayer: true,
|
|
30
31
|
});
|
|
31
32
|
const toneClassName = resolvePhiSurfaceToneClassName(still?.tone);
|
|
32
|
-
return (_jsxs("div", { ...attributes, className:
|
|
33
|
+
return (_jsxs("div", { ...attributes, className: joinPhiClassNames(className, toneClassName), style: { ...card.style, ...style }, children: [_jsx(PhiSurfaceGroundLayer, { ground: card.ground, frame: resolvePhiSplitCardGroundFrame(side, gap, swapped) }), toneClassName ? _jsx(PhiSurfaceTone, { tone: still?.tone, children: children }) : children] }));
|
|
33
34
|
}
|
|
@@ -4,6 +4,7 @@ import { resolvePhiLayoutBoxStyle } from "./phi-layout-contract";
|
|
|
4
4
|
import { resolvePhiBaseLayoutSlotStates, resolvePhiBaseLayoutChrome, } from "./phi-layout-view-model";
|
|
5
5
|
import { isPhiLayoutAuthoringRender, phiLayoutDebugLayerMarker, } from "../../helpers/layout-authoring-markers";
|
|
6
6
|
import { PhiLayoutSurfaceBox } from "./phi-layout-surface-box";
|
|
7
|
+
import { joinPhiClassNames } from "../../helpers/class-names";
|
|
7
8
|
function resolvePhiRenderableBlockStyleValue(value) {
|
|
8
9
|
return value == null || value === 0 || value === "0" || value === "0px" ? undefined : value;
|
|
9
10
|
}
|
|
@@ -94,5 +95,5 @@ export function PhiBaseLayout({ slots, editSlotLabels, layoutKind, labelEnd, pad
|
|
|
94
95
|
overflow: resolvedVisibility === "collapsed" ? "hidden" : undefined,
|
|
95
96
|
...style,
|
|
96
97
|
};
|
|
97
|
-
return (_jsxs(PhiLayoutSurfaceBox, { blockId: blockId, surface: surface, ground: ground, "data-phi-block-id": blockId ?? undefined, "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-block-visibility": resolvedVisibility, "data-phi-block-enabled": resolvedEnabled ? "true" : "false", "data-phi-block-selectable": capabilities?.selectable ? "true" : undefined, "data-phi-block-draggable": capabilities?.draggable ? "true" : undefined, "data-phi-block-hoverable": capabilities?.hoverable ? "true" : undefined, "data-phi-block-activatable": capabilities?.activatable ? "true" : undefined, "data-phi-block-focusable": capabilities?.focusable ? "true" : undefined, "data-phi-block-droppable": capabilities?.droppable ? "true" : undefined, "data-phi-block-selected": runtime?.selected ? "true" : undefined, "data-phi-block-hovered": runtime?.hovered ? "true" : undefined, "data-phi-block-dragging": runtime?.dragging ? "true" : undefined, "data-phi-block-focused": runtime?.focused ? "true" : undefined, "data-phi-block-active": runtime?.active ? "true" : undefined, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-debug-scaffold": resolvedDebugMode ? "on" : undefined, "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className:
|
|
98
|
+
return (_jsxs(PhiLayoutSurfaceBox, { blockId: blockId, surface: surface, ground: ground, "data-phi-block-id": blockId ?? undefined, "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-block-visibility": resolvedVisibility, "data-phi-block-enabled": resolvedEnabled ? "true" : "false", "data-phi-block-selectable": capabilities?.selectable ? "true" : undefined, "data-phi-block-draggable": capabilities?.draggable ? "true" : undefined, "data-phi-block-hoverable": capabilities?.hoverable ? "true" : undefined, "data-phi-block-activatable": capabilities?.activatable ? "true" : undefined, "data-phi-block-focusable": capabilities?.focusable ? "true" : undefined, "data-phi-block-droppable": capabilities?.droppable ? "true" : undefined, "data-phi-block-selected": runtime?.selected ? "true" : undefined, "data-phi-block-hovered": runtime?.hovered ? "true" : undefined, "data-phi-block-dragging": runtime?.dragging ? "true" : undefined, "data-phi-block-focused": runtime?.focused ? "true" : undefined, "data-phi-block-active": runtime?.active ? "true" : undefined, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-debug-scaffold": resolvedDebugMode ? "on" : undefined, "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: joinPhiClassNames("phi-layout", className), style: resolvedContainerStyle, children: [underlay, resolvedSlots] }));
|
|
98
99
|
}
|
|
@@ -6,6 +6,7 @@ import { PhiSurfaceTone } from "../surface/phi-surface-tone";
|
|
|
6
6
|
import { resolvePhiSurfaceToneClassName } from "../../types/surface";
|
|
7
7
|
import { PHI_LAYOUT_SURFACE_RADIUS } from "./phi-layout-contract";
|
|
8
8
|
import { usePhiLayoutSignalSurface } from "./phi-layout-signal-surface";
|
|
9
|
+
import { joinPhiClassNames } from "../../helpers/class-names";
|
|
9
10
|
/*
|
|
10
11
|
* Kept where a Signal replaces the Surface: the Layout states them for its topology as well, and a box
|
|
11
12
|
* that lost its own `position` would let its overlays escape it.
|
|
@@ -37,5 +38,5 @@ export function PhiLayoutSurfaceBox({ blockId, surface, ground, style, children,
|
|
|
37
38
|
const signalled = usePhiLayoutSignalSurface(blockId, surface);
|
|
38
39
|
const next = signalled === surface ? { style, ground } : resolvePhiLayoutSignalledSurfaceStyle(style, surface, signalled);
|
|
39
40
|
const toneClassName = resolvePhiSurfaceToneClassName(signalled?.tone);
|
|
40
|
-
return (_jsxs("div", { ...attributes, className:
|
|
41
|
+
return (_jsxs("div", { ...attributes, className: joinPhiClassNames(attributes.className, toneClassName), style: next.style, children: [_jsx(PhiSurfaceGroundLayer, { ground: next.ground }), toneClassName ? _jsx(PhiSurfaceTone, { tone: signalled?.tone, children: children }) : children] }));
|
|
41
42
|
}
|
|
@@ -3,17 +3,9 @@ import { getPhiSearchWidgetLabels } from "../widgets/label-sets/search";
|
|
|
3
3
|
import { getPhiMediaWidgetLabels } from "./label-sets/media";
|
|
4
4
|
import { PhiCmsWidgetType } from "../../constants/cms-widget-types";
|
|
5
5
|
import { PhiRuntimeModuleRenderClientHost } from "../runtime/runtime-module-render-client-manifest";
|
|
6
|
-
import {
|
|
6
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../widgets/label-sets/runtime-options";
|
|
7
7
|
export async function PhiMediaPickerWidgetServer({ runtime, config, }) {
|
|
8
|
-
const labels = await getPhiMediaWidgetLabels(
|
|
9
|
-
|
|
10
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
11
|
-
locale: runtime.locale.current,
|
|
12
|
-
});
|
|
13
|
-
const searchLabels = await getPhiSearchWidgetLabels({
|
|
14
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
15
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
16
|
-
locale: runtime.locale.current,
|
|
17
|
-
});
|
|
8
|
+
const labels = await getPhiMediaWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
9
|
+
const searchLabels = await getPhiSearchWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
18
10
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.MediaPicker, componentProps: { labels, searchLabels, config } }));
|
|
19
11
|
}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useSyncExternalStore } from "react";
|
|
4
3
|
import { decodePhiProtectedMail, isPhiProtectedMail } from "../../helpers/protected-mail";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Whether this render runs in a hydrated browser. False on the server and during hydration -- the HTML a
|
|
8
|
-
* crawler reads -- and true in the render that follows.
|
|
9
|
-
*/
|
|
10
|
-
function usePhiHydrated() {
|
|
11
|
-
return useSyncExternalStore(subscribeNever, () => true, () => false);
|
|
12
|
-
}
|
|
4
|
+
import { usePhiHydrated } from "../state/use-phi-hydrated";
|
|
13
5
|
/**
|
|
14
6
|
* The href a link may show: a protected address only once the page is hydrated, everything else at once.
|
|
15
7
|
*
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext } from "react";
|
|
3
|
+
import { createContext, useContext, useMemo } from "react";
|
|
4
4
|
const PhiSiderContext = createContext(null);
|
|
5
5
|
export function PhiSiderContextProvider({ value, children, }) {
|
|
6
|
-
|
|
6
|
+
// One object while its two fields hold, whatever object the caller wrote: the readers render for a change, not for a render.
|
|
7
|
+
const held = useMemo(() => ({ collapsed: value.collapsed, collapsedWidth: value.collapsedWidth }), [value.collapsed, value.collapsedWidth]);
|
|
8
|
+
return _jsx(PhiSiderContext.Provider, { value: held, children: children });
|
|
7
9
|
}
|
|
8
10
|
export function usePhiSiderContext() {
|
|
9
11
|
return useContext(PhiSiderContext);
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { ConfigProvider as AntdConfigProvider, theme as antdTheme, } from "antd";
|
|
4
4
|
import { createContext, useContext, useEffect, useMemo, } from "react";
|
|
5
5
|
import { buildPhiControlShapeCssVars, PHI_SURFACE_SHAPE_CSS_VAR, resolvePhiSurfaceShapeRadius, } from "../../theme/phi-control-shape";
|
|
6
|
+
import { joinPhiClassNames } from "../../helpers/class-names";
|
|
6
7
|
const PhiConfigContext = createContext(null);
|
|
7
8
|
function PhiConfigValueProvider({ children, customColors, fonts, fontFamilies, heroHeight, mode, controlShape, presets, rootClassName, rootStyle, themeCssVarKey, }) {
|
|
8
9
|
const { token, cssVar } = antdTheme.useToken();
|
|
@@ -63,7 +64,7 @@ function PhiConfigValueProvider({ children, customColors, fonts, fontFamilies, h
|
|
|
63
64
|
presets,
|
|
64
65
|
token,
|
|
65
66
|
}), [controlShape, customColors, fonts, fontFamilies, heroHeight, mode, presets, token]);
|
|
66
|
-
return (_jsx(PhiConfigContext.Provider, { value: value, children: _jsx("div", { className:
|
|
67
|
+
return (_jsx(PhiConfigContext.Provider, { value: value, children: _jsx("div", { className: joinPhiClassNames(themeCssVarKey, rootClassName), style: {
|
|
67
68
|
...rootStyle,
|
|
68
69
|
...controlShapeVars,
|
|
69
70
|
fontSize: cssVar.fontSize,
|
|
@@ -5,8 +5,11 @@ import type { ReactNode } from "react";
|
|
|
5
5
|
* Both sit in this one Client reference because the root layout is under every route, and each Client
|
|
6
6
|
* reference it reaches is paid for by every page (`validate-area-client-reach.mjs`).
|
|
7
7
|
*/
|
|
8
|
-
export declare function PhiDayjsLocale({ locale, intlLocale, children, }: {
|
|
8
|
+
export declare function PhiDayjsLocale({ locale, intlLocale, timeZone, renderedAt, children, }: {
|
|
9
9
|
locale?: string | null;
|
|
10
10
|
intlLocale: string;
|
|
11
|
+
/** The Site's time zone and the moment of this render (components/root/phi-intl-locale.tsx). */
|
|
12
|
+
timeZone: string;
|
|
13
|
+
renderedAt: number;
|
|
11
14
|
children: ReactNode;
|
|
12
15
|
}): import("react").JSX.Element;
|
|
@@ -122,7 +122,7 @@ function resolvePhiDayjsLocale(locale) {
|
|
|
122
122
|
* Both sit in this one Client reference because the root layout is under every route, and each Client
|
|
123
123
|
* reference it reaches is paid for by every page (`validate-area-client-reach.mjs`).
|
|
124
124
|
*/
|
|
125
|
-
export function PhiDayjsLocale({ locale, intlLocale, children, }) {
|
|
125
|
+
export function PhiDayjsLocale({ locale, intlLocale, timeZone, renderedAt, children, }) {
|
|
126
126
|
useEffect(() => {
|
|
127
127
|
let active = true;
|
|
128
128
|
async function applyLocale() {
|
|
@@ -141,5 +141,5 @@ export function PhiDayjsLocale({ locale, intlLocale, children, }) {
|
|
|
141
141
|
active = false;
|
|
142
142
|
};
|
|
143
143
|
}, [locale]);
|
|
144
|
-
return _jsx(PhiIntlLocaleProvider, { locale: intlLocale, children: children });
|
|
144
|
+
return (_jsx(PhiIntlLocaleProvider, { locale: intlLocale, timeZone: timeZone, renderedAt: renderedAt, children: children }));
|
|
145
145
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
export declare function PhiIntlLocaleProvider({ locale, children }: {
|
|
2
|
+
export declare function PhiIntlLocaleProvider({ locale, timeZone, renderedAt, children, }: {
|
|
3
3
|
locale: string;
|
|
4
|
+
timeZone: string;
|
|
5
|
+
renderedAt: number;
|
|
4
6
|
children: ReactNode;
|
|
5
7
|
}): import("react").JSX.Element;
|
|
6
8
|
export declare function usePhiIntlLocale(): string;
|
|
9
|
+
/** The Site's time zone, for every date and time a Client component formats. */
|
|
10
|
+
export declare function usePhiIntlTimeZone(): string;
|
|
11
|
+
/** The moment the server rendered this page, for relative times that have to hydrate unchanged. */
|
|
12
|
+
export declare function usePhiIntlRenderedAt(): number;
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useContext } from "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* `/de/...` would show English dates in a German page, and the server's render would show a third. The
|
|
9
|
-
* Root Layout sets it once from the resolved locale, the same value `<html lang>` carries.
|
|
10
|
-
*/
|
|
11
|
-
const PhiIntlLocaleContext = createContext(null);
|
|
12
|
-
export function PhiIntlLocaleProvider({ locale, children }) {
|
|
13
|
-
return _jsx(PhiIntlLocaleContext.Provider, { value: locale, children: children });
|
|
3
|
+
import { createContext, useContext, useMemo } from "react";
|
|
4
|
+
const PhiIntlContext = createContext(null);
|
|
5
|
+
export function PhiIntlLocaleProvider({ locale, timeZone, renderedAt, children, }) {
|
|
6
|
+
const value = useMemo(() => ({ locale, timeZone, renderedAt }), [locale, renderedAt, timeZone]);
|
|
7
|
+
return _jsx(PhiIntlContext.Provider, { value: value, children: children });
|
|
14
8
|
}
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
9
|
+
function usePhiIntl() {
|
|
10
|
+
const value = useContext(PhiIntlContext);
|
|
11
|
+
if (!value) {
|
|
18
12
|
throw new Error("usePhiIntlLocale needs a PhiIntlLocaleProvider above it; the Root Layout sets one.");
|
|
19
13
|
}
|
|
20
|
-
return
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
16
|
+
export function usePhiIntlLocale() {
|
|
17
|
+
return usePhiIntl().locale;
|
|
18
|
+
}
|
|
19
|
+
/** The Site's time zone, for every date and time a Client component formats. */
|
|
20
|
+
export function usePhiIntlTimeZone() {
|
|
21
|
+
return usePhiIntl().timeZone;
|
|
22
|
+
}
|
|
23
|
+
/** The moment the server rendered this page, for relative times that have to hydrate unchanged. */
|
|
24
|
+
export function usePhiIntlRenderedAt() {
|
|
25
|
+
return usePhiIntl().renderedAt;
|
|
21
26
|
}
|
|
@@ -18,6 +18,7 @@ import "../../styles/gradients.css";
|
|
|
18
18
|
import { getResolvedSiteConfig } from "../../gateway/site-config";
|
|
19
19
|
import { loadPhiAntdLocale } from "../../helpers/antd-locale";
|
|
20
20
|
import { PhiDayjsLocale } from "./phi-dayjs-locale";
|
|
21
|
+
import { readPhiRenderMoment } from "../../helpers/format-date-time";
|
|
21
22
|
import { PhiRootLiveThemeProvider } from "./phi-root-live-theme-provider";
|
|
22
23
|
import { resolvePhiRootThemeState } from "./phi-root-theme-resolver";
|
|
23
24
|
import { PhiSignalRuntimePartitionProvider } from "../runtime/runtime-signal-partition";
|
|
@@ -120,5 +121,5 @@ export async function PhiRootLayout({ children, apiBaseUrl, internalToken, siteK
|
|
|
120
121
|
});
|
|
121
122
|
return (_jsxs(_Fragment, { children: [assetFonts.css ? (_jsx("style", { href: `phi-site-fonts:${site.key}`, precedence: "default", dangerouslySetInnerHTML: { __html: assetFonts.css } })) : null, _jsx(AntdRegistry, { children: _jsx(PhiSignalRuntimePartitionProvider, { id: `site:${site.key}`, kind: "site", context: { siteKey: site.key }, children: _jsx(PhiRootLiveThemeProvider, { siteKey: site.key, siteName: site.name, siteTheme: siteTheme, locale: antdLocale, initialMode: resolvedThemeMode, themeModePreference: themeModePreference, initialLocale: resolvedLocale?.locale ?? site.defaultLocale, availableLocales: site.availableLocales.map((option) => option.code), fonts: themeFonts, themeState: themeState, fontFamilies: fontCatalogue.entries.map(({ family, cssVariable }) => ({ family, cssVariable })), presets: themePresets, rootClassName: fontCatalogue.className, rootStyle: headingFontFamily
|
|
122
123
|
? { ...publishedRootTheme.style, [PHI_THEME_HEADING_FONT_VARIABLE]: headingFontFamily }
|
|
123
|
-
: publishedRootTheme.style, children: _jsxs("div", { "data-phi-app-ground": "true", children: [_jsx(PhiCoreRuntimeApplicationAdapter, { labels: sessionLabels }), _jsx(PhiDayjsLocale, { locale: resolvedLocale?.locale ?? resolvedLocale?.intlLocale, intlLocale: resolvedLocale?.intlLocale ?? site.defaultLocale, children: children })] }) }) }) })] }));
|
|
124
|
+
: publishedRootTheme.style, children: _jsxs("div", { "data-phi-app-ground": "true", children: [_jsx(PhiCoreRuntimeApplicationAdapter, { labels: sessionLabels }), _jsx(PhiDayjsLocale, { locale: resolvedLocale?.locale ?? resolvedLocale?.intlLocale, intlLocale: resolvedLocale?.intlLocale ?? site.defaultLocale, timeZone: site.timeZone, renderedAt: readPhiRenderMoment(), children: children })] }) }) }) })] }));
|
|
124
125
|
}
|
|
@@ -1,85 +1 @@
|
|
|
1
|
-
import { type PhiCoreRuntimeControllerConfig } from "./core-runtime-controller-definition";
|
|
2
|
-
export declare const PHI_CORE_RUNTIME_CONTROLLER_PLUGIN: {
|
|
3
|
-
renderController: () => null;
|
|
4
|
-
kind: "controller";
|
|
5
|
-
pluginKey: string;
|
|
6
|
-
key: string;
|
|
7
|
-
title: string;
|
|
8
|
-
description: string;
|
|
9
|
-
iconFamily: string;
|
|
10
|
-
allowedMountScopes: "site"[];
|
|
11
|
-
runtimeSignals: {
|
|
12
|
-
emits: ({
|
|
13
|
-
id: string;
|
|
14
|
-
action: "change";
|
|
15
|
-
valueType: "json";
|
|
16
|
-
valueSchema: `${string}/signals/${string}`;
|
|
17
|
-
} | {
|
|
18
|
-
id: string;
|
|
19
|
-
action: "change";
|
|
20
|
-
valueType: "string";
|
|
21
|
-
valueSchema?: undefined;
|
|
22
|
-
} | {
|
|
23
|
-
id: string;
|
|
24
|
-
action: "change";
|
|
25
|
-
valueType: "boolean";
|
|
26
|
-
valueSchema?: undefined;
|
|
27
|
-
} | {
|
|
28
|
-
id: string;
|
|
29
|
-
action: "clear";
|
|
30
|
-
valueType: "none";
|
|
31
|
-
valueSchema?: undefined;
|
|
32
|
-
} | {
|
|
33
|
-
id: string;
|
|
34
|
-
action: "change";
|
|
35
|
-
valueType: "image";
|
|
36
|
-
valueSchema?: undefined;
|
|
37
|
-
})[];
|
|
38
|
-
listens: ({
|
|
39
|
-
id: string;
|
|
40
|
-
channel: string;
|
|
41
|
-
action: "change";
|
|
42
|
-
valueType: "string";
|
|
43
|
-
valueSchema?: undefined;
|
|
44
|
-
} | {
|
|
45
|
-
id: string;
|
|
46
|
-
channel: string;
|
|
47
|
-
action: "clear";
|
|
48
|
-
valueType: "none";
|
|
49
|
-
valueSchema?: undefined;
|
|
50
|
-
} | {
|
|
51
|
-
id: string;
|
|
52
|
-
channel: string;
|
|
53
|
-
action: "change";
|
|
54
|
-
valueType: "image";
|
|
55
|
-
valueSchema?: undefined;
|
|
56
|
-
} | {
|
|
57
|
-
id: string;
|
|
58
|
-
channel: string;
|
|
59
|
-
action: "change";
|
|
60
|
-
valueType: "json";
|
|
61
|
-
valueSchema: `${string}/signals/${string}`;
|
|
62
|
-
} | {
|
|
63
|
-
id: string;
|
|
64
|
-
channel: string;
|
|
65
|
-
action: "change";
|
|
66
|
-
valueType: "boolean";
|
|
67
|
-
valueSchema?: undefined;
|
|
68
|
-
} | {
|
|
69
|
-
id: string;
|
|
70
|
-
channel: string;
|
|
71
|
-
action: "activate";
|
|
72
|
-
valueType: "json";
|
|
73
|
-
valueSchema: `${string}/signals/${string}`;
|
|
74
|
-
} | {
|
|
75
|
-
id: string;
|
|
76
|
-
channel: string;
|
|
77
|
-
action: "activate";
|
|
78
|
-
valueType: "none";
|
|
79
|
-
valueSchema?: undefined;
|
|
80
|
-
})[];
|
|
81
|
-
};
|
|
82
|
-
defaultConfig: {};
|
|
83
|
-
parseConfig: () => PhiCoreRuntimeControllerConfig;
|
|
84
|
-
};
|
|
85
1
|
export declare const PhiCoreRuntimeControllerClient: (props: import("../../types").PhiRuntimeModuleControllerClientProps) => import("react").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createPhiRuntimeControllerClient } from "./runtime-controller-client-factory";
|
|
3
3
|
import { PHI_CORE_RUNTIME_CONTROLLER_DEFINITION, } from "./core-runtime-controller-definition";
|
|
4
|
-
|
|
4
|
+
const PHI_CORE_RUNTIME_CONTROLLER_PLUGIN = {
|
|
5
5
|
...PHI_CORE_RUNTIME_CONTROLLER_DEFINITION,
|
|
6
6
|
renderController: () => null,
|
|
7
7
|
};
|
|
@@ -7,6 +7,8 @@ export async function resolvePhiRuntimeControllerPreloads({ controllers, runtime
|
|
|
7
7
|
const activeControllers = [];
|
|
8
8
|
const preloadDataByAddress = {};
|
|
9
9
|
const seenAddresses = new Set();
|
|
10
|
+
// Started only once every mount has been checked, so a refused mount leaves no preload running.
|
|
11
|
+
const preloads = [];
|
|
10
12
|
for (const setting of controllers ?? []) {
|
|
11
13
|
const definition = registry.get(setting.type);
|
|
12
14
|
if (!definition) {
|
|
@@ -29,18 +31,27 @@ export async function resolvePhiRuntimeControllerPreloads({ controllers, runtime
|
|
|
29
31
|
continue;
|
|
30
32
|
}
|
|
31
33
|
const parsedConfig = parsePhiRuntimeControllerConfig(definition, setting.config);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
instanceKey,
|
|
34
|
+
const serverPreload = definition.serverPreload;
|
|
35
|
+
preloads.push({
|
|
35
36
|
address,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
load: () => serverPreload({
|
|
38
|
+
key: definition.key,
|
|
39
|
+
instanceKey,
|
|
40
|
+
address,
|
|
41
|
+
mountScope: setting.mountScope,
|
|
42
|
+
runtime,
|
|
43
|
+
runtimeModuleCatalog,
|
|
44
|
+
serverCapabilities,
|
|
45
|
+
setting: resolvedSetting,
|
|
46
|
+
config: parsedConfig,
|
|
47
|
+
}),
|
|
42
48
|
});
|
|
43
49
|
}
|
|
50
|
+
// Controllers do not read each other's preload, so the reads run together; the map keeps mount order.
|
|
51
|
+
const loaded = await Promise.all(preloads.map((entry) => entry.load()));
|
|
52
|
+
preloads.forEach((entry, index) => {
|
|
53
|
+
preloadDataByAddress[entry.address] = loaded[index];
|
|
54
|
+
});
|
|
44
55
|
return {
|
|
45
56
|
controllers: activeControllers,
|
|
46
57
|
preloadDataByAddress,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCallback, useEffect, useEffectEvent, } from "react";
|
|
2
|
+
import { useCallback, useEffect, useEffectEvent, useMemo, } from "react";
|
|
3
3
|
import { readPhiSignalValueSchema } from "../../types/signals";
|
|
4
4
|
import { matchesPhiSignalRuntimeContext, resolvePhiSignalDeliverability, resolvePhiSignalReceiverScope, resolvePhiSignalDeliveryPartition, } from "./runtime-signal-registry";
|
|
5
5
|
import { usePhiSignalRuntimePartition, } from "./runtime-signal-partition";
|
|
@@ -371,15 +371,50 @@ export function usePhiSignalDispatcher() {
|
|
|
371
371
|
emitPhiSignal(partition, signal);
|
|
372
372
|
}, [partition]);
|
|
373
373
|
}
|
|
374
|
+
function listKey(list) {
|
|
375
|
+
return list ? list.map(String).join("\u0001") : "";
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* A filter's content as one string, so that an effect can depend on what a filter says rather than on
|
|
379
|
+
* which object says it.
|
|
380
|
+
*
|
|
381
|
+
* Callers write the filter as a literal -- `{ scopes: ["page"], channels: [...], receiver }` -- and a
|
|
382
|
+
* literal is a new object every render. Keyed on the object, the subscription below was torn down and
|
|
383
|
+
* made again on every render of every Controller, and each re-subscription with a receiver flushed the
|
|
384
|
+
* partition's pending signals once more. Equality by content, decided here once, lets a caller write
|
|
385
|
+
* what it means.
|
|
386
|
+
*/
|
|
387
|
+
function filterKey(filter) {
|
|
388
|
+
if (filter === null)
|
|
389
|
+
return "null";
|
|
390
|
+
if (filter === undefined)
|
|
391
|
+
return "";
|
|
392
|
+
const context = filter.context;
|
|
393
|
+
return [
|
|
394
|
+
listKey(filter.scopes), listKey(filter.channels), listKey(filter.actions), listKey(filter.valueSchemas),
|
|
395
|
+
filter.receiver === undefined ? "" : String(filter.receiver),
|
|
396
|
+
context ? [context.siteKey, context.area, context.pageKey, context.regionKey, context.slotKey].map(String).join("\u0001") : "",
|
|
397
|
+
].join("\u0002");
|
|
398
|
+
}
|
|
399
|
+
function receiverKey(receiver) {
|
|
400
|
+
if (receiver == null)
|
|
401
|
+
return receiver === null ? "null" : "";
|
|
402
|
+
return Array.isArray(receiver) ? `[${listKey(receiver)}]` : String(receiver);
|
|
403
|
+
}
|
|
374
404
|
export function usePhiSignalListener(handler, filter, readyReceiver) {
|
|
375
405
|
const partition = usePhiSignalRuntimePartition();
|
|
376
406
|
const handleSignal = useEffectEvent((signal) => {
|
|
377
407
|
handler(signal);
|
|
378
408
|
});
|
|
409
|
+
const filterContent = filterKey(filter);
|
|
410
|
+
const receiverContent = receiverKey(readyReceiver);
|
|
411
|
+
// The same filter in a new object is the same subscription (filterKey above); the keys stand for them.
|
|
412
|
+
const stableFilter = useMemo(() => filter, [filterContent]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
413
|
+
const stableReceiver = useMemo(() => readyReceiver, [receiverContent]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
379
414
|
useEffect(() => {
|
|
380
|
-
if (
|
|
415
|
+
if (stableFilter === null) {
|
|
381
416
|
return undefined;
|
|
382
417
|
}
|
|
383
|
-
return subscribePhiSignals(partition, handleSignal,
|
|
384
|
-
}, [
|
|
418
|
+
return subscribePhiSignals(partition, handleSignal, stableFilter, stableReceiver);
|
|
419
|
+
}, [stableFilter, partition, stableReceiver]);
|
|
385
420
|
}
|
|
@@ -16,6 +16,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
|
|
|
16
16
|
readonly BranchesOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/BranchesOutlined")>;
|
|
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
|
+
readonly ClearOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ClearOutlined")>;
|
|
19
20
|
readonly CloseOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CloseOutlined")>;
|
|
20
21
|
readonly CloudDownloadOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CloudDownloadOutlined")>;
|
|
21
22
|
readonly CloudUploadOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CloudUploadOutlined")>;
|
|
@@ -54,6 +55,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
|
|
|
54
55
|
readonly HolderOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/HolderOutlined")>;
|
|
55
56
|
readonly HomeOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/HomeOutlined")>;
|
|
56
57
|
readonly IdcardOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/IdcardOutlined")>;
|
|
58
|
+
readonly InboxOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/InboxOutlined")>;
|
|
57
59
|
readonly InfoCircleOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/InfoCircleOutlined")>;
|
|
58
60
|
readonly LayoutOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LayoutOutlined")>;
|
|
59
61
|
readonly LeftOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LeftOutlined")>;
|
|
@@ -80,6 +82,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
|
|
|
80
82
|
readonly RedoOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/RedoOutlined")>;
|
|
81
83
|
readonly ReloadOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ReloadOutlined")>;
|
|
82
84
|
readonly RightOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/RightOutlined")>;
|
|
85
|
+
readonly RollbackOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/RollbackOutlined")>;
|
|
83
86
|
readonly SafetyCertificateOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/SafetyCertificateOutlined")>;
|
|
84
87
|
readonly SaveOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/SaveOutlined")>;
|
|
85
88
|
readonly SearchOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/SearchOutlined")>;
|
|
@@ -37,6 +37,7 @@ const PHI_ANTD_ICON_LOADERS = {
|
|
|
37
37
|
BranchesOutlined: () => import("@ant-design/icons-svg/es/asn/BranchesOutlined"),
|
|
38
38
|
CalendarOutlined: () => import("@ant-design/icons-svg/es/asn/CalendarOutlined"),
|
|
39
39
|
CheckOutlined: () => import("@ant-design/icons-svg/es/asn/CheckOutlined"),
|
|
40
|
+
ClearOutlined: () => import("@ant-design/icons-svg/es/asn/ClearOutlined"),
|
|
40
41
|
CloseOutlined: () => import("@ant-design/icons-svg/es/asn/CloseOutlined"),
|
|
41
42
|
CloudDownloadOutlined: () => import("@ant-design/icons-svg/es/asn/CloudDownloadOutlined"),
|
|
42
43
|
CloudUploadOutlined: () => import("@ant-design/icons-svg/es/asn/CloudUploadOutlined"),
|
|
@@ -75,6 +76,7 @@ const PHI_ANTD_ICON_LOADERS = {
|
|
|
75
76
|
HolderOutlined: () => import("@ant-design/icons-svg/es/asn/HolderOutlined"),
|
|
76
77
|
HomeOutlined: () => import("@ant-design/icons-svg/es/asn/HomeOutlined"),
|
|
77
78
|
IdcardOutlined: () => import("@ant-design/icons-svg/es/asn/IdcardOutlined"),
|
|
79
|
+
InboxOutlined: () => import("@ant-design/icons-svg/es/asn/InboxOutlined"),
|
|
78
80
|
InfoCircleOutlined: () => import("@ant-design/icons-svg/es/asn/InfoCircleOutlined"),
|
|
79
81
|
LayoutOutlined: () => import("@ant-design/icons-svg/es/asn/LayoutOutlined"),
|
|
80
82
|
LeftOutlined: () => import("@ant-design/icons-svg/es/asn/LeftOutlined"),
|
|
@@ -101,6 +103,7 @@ const PHI_ANTD_ICON_LOADERS = {
|
|
|
101
103
|
RedoOutlined: () => import("@ant-design/icons-svg/es/asn/RedoOutlined"),
|
|
102
104
|
ReloadOutlined: () => import("@ant-design/icons-svg/es/asn/ReloadOutlined"),
|
|
103
105
|
RightOutlined: () => import("@ant-design/icons-svg/es/asn/RightOutlined"),
|
|
106
|
+
RollbackOutlined: () => import("@ant-design/icons-svg/es/asn/RollbackOutlined"),
|
|
104
107
|
SafetyCertificateOutlined: () => import("@ant-design/icons-svg/es/asn/SafetyCertificateOutlined"),
|
|
105
108
|
SaveOutlined: () => import("@ant-design/icons-svg/es/asn/SaveOutlined"),
|
|
106
109
|
SearchOutlined: () => import("@ant-design/icons-svg/es/asn/SearchOutlined"),
|
|
@@ -200,6 +203,8 @@ export const PHI_ANTD_ICON_NAMES = {
|
|
|
200
203
|
"branches-outlined": "BranchesOutlined",
|
|
201
204
|
check: "CheckOutlined",
|
|
202
205
|
"check-outlined": "CheckOutlined",
|
|
206
|
+
// Only the long name: a bare `clear` already means the close mark on a Button (phi-button-icons.tsx).
|
|
207
|
+
"clear-outlined": "ClearOutlined",
|
|
203
208
|
close: "CloseOutlined",
|
|
204
209
|
"close-outlined": "CloseOutlined",
|
|
205
210
|
code: "CodeOutlined",
|
|
@@ -342,10 +347,14 @@ export const PHI_ANTD_ICON_NAMES = {
|
|
|
342
347
|
"link-outlined": "LinkOutlined",
|
|
343
348
|
minus: "MinusOutlined",
|
|
344
349
|
"minus-outlined": "MinusOutlined",
|
|
350
|
+
inbox: "InboxOutlined",
|
|
351
|
+
"inbox-outlined": "InboxOutlined",
|
|
345
352
|
redo: "RedoOutlined",
|
|
346
353
|
"redo-outlined": "RedoOutlined",
|
|
347
354
|
reload: "ReloadOutlined",
|
|
348
355
|
"reload-outlined": "ReloadOutlined",
|
|
356
|
+
rollback: "RollbackOutlined",
|
|
357
|
+
"rollback-outlined": "RollbackOutlined",
|
|
349
358
|
save: "SaveOutlined",
|
|
350
359
|
"save-outlined": "SaveOutlined",
|
|
351
360
|
search: "SearchOutlined",
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this render runs in a hydrated browser: false on the server and during hydration -- the HTML a
|
|
3
|
+
* crawler reads -- and true in the render that follows. Seven Controls each kept a copy of this with a
|
|
4
|
+
* `subscribe` that never fires; one hook, so a lazily mounted shell and a protected mail agree on when.
|
|
5
|
+
*/
|
|
6
|
+
export declare function usePhiHydrated(): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
const subscribeNever = () => () => { };
|
|
4
|
+
/**
|
|
5
|
+
* Whether this render runs in a hydrated browser: false on the server and during hydration -- the HTML a
|
|
6
|
+
* crawler reads -- and true in the render that follows. Seven Controls each kept a copy of this with a
|
|
7
|
+
* `subscribe` that never fires; one hook, so a lazily mounted shell and a protected mail agree on when.
|
|
8
|
+
*/
|
|
9
|
+
export function usePhiHydrated() {
|
|
10
|
+
return useSyncExternalStore(subscribeNever, () => true, () => false);
|
|
11
|
+
}
|
|
@@ -4,6 +4,10 @@ export type PhiPlainTableColumn = {
|
|
|
4
4
|
key: string;
|
|
5
5
|
title: ReactNode;
|
|
6
6
|
align?: PhiPlainTableAlign;
|
|
7
|
+
/** The column's width, a CSS length such as `30%`; absent, the browser shares the row out by content. */
|
|
8
|
+
width?: string;
|
|
9
|
+
/** Keep the column's cells on one line; the column then takes the width of its longest entry. */
|
|
10
|
+
nowrap?: boolean;
|
|
7
11
|
};
|
|
8
12
|
export type PhiPlainTableRow = {
|
|
9
13
|
key: string;
|