@phis/ui 0.4.4 → 0.4.6
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 +31 -2
- package/components/controls/phi-background-control.d.ts +6 -1
- package/components/controls/phi-background-control.js +12 -4
- package/components/controls/phi-button-control.d.ts +15 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-collapse-control.d.ts +6 -2
- package/components/controls/phi-collapse-control.js +2 -2
- package/components/controls/phi-dialog-control.d.ts +11 -5
- package/components/controls/phi-dialog-control.js +19 -13
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-media-asset-tile-control.js +10 -10
- package/components/controls/phi-menu-control-vocabulary.d.ts +7 -0
- package/components/controls/phi-menu-control-vocabulary.js +10 -0
- package/components/controls/phi-menu-control.d.ts +4 -1
- package/components/controls/phi-menu-control.js +6 -1
- package/components/controls/phi-progress-control.d.ts +10 -2
- package/components/controls/phi-progress-control.js +6 -2
- package/components/controls/phi-ribbon-control.d.ts +4 -1
- package/components/controls/phi-ribbon-control.js +5 -3
- package/components/controls/phi-ribbon-wrap-control.d.ts +7 -1
- package/components/controls/phi-ribbon-wrap-control.js +8 -2
- package/components/controls/phi-segmented-control.d.ts +4 -1
- package/components/controls/phi-segmented-control.js +13 -2
- package/components/controls/phi-surface-control.d.ts +2 -0
- package/components/controls/phi-surface-control.js +16 -1
- package/components/controls/phi-switch-control.d.ts +4 -1
- package/components/controls/phi-switch-control.js +8 -2
- package/components/controls/phi-tag-control.d.ts +4 -1
- package/components/controls/phi-tag-control.js +11 -3
- package/components/layouts/clients/phi-split-card-layout-client.js +13 -5
- package/components/layouts/clients/phi-three-column-layout-client.js +9 -3
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/layouts/split-card-geometry.js +6 -2
- package/components/media/aspect-ratios.d.ts +2 -2
- package/components/menus/phi-account-menu.js +3 -1
- package/components/navigation/phi-link.js +7 -2
- package/components/navigation/use-phi-protected-mail.d.ts +11 -0
- package/components/navigation/use-phi-protected-mail.js +29 -0
- package/components/regions/clients/cms-region-container-client.js +16 -2
- package/components/regions/phi-cms-region-container.js +5 -1
- package/components/regions/phi-cms-region-shell.d.ts +11 -0
- package/components/regions/phi-cms-region-shell.js +64 -7
- package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -1
- package/components/root/phi-config-provider.js +16 -0
- package/components/root/phi-root-layout.d.ts +1 -0
- package/components/root/phi-root-layout.js +1 -0
- package/components/root/phi-root-theme-resolver.js +12 -1
- package/components/root/phi-shell-chrome-overlay.d.ts +6 -0
- package/components/root/phi-shell-chrome-overlay.js +7 -1
- package/components/runtime/runtime-module-context.d.ts +12 -1
- package/components/runtime/runtime-module-context.js +6 -1
- package/components/shell/phi-cms-shell.d.ts +9 -1
- package/components/shell/phi-cms-shell.js +10 -4
- package/components/shell/phi-nav-link.js +7 -2
- package/components/shell/phi-shell-sider-drawer.d.ts +17 -0
- package/components/shell/phi-shell-sider-drawer.js +88 -0
- package/components/shell/use-phi-shell-header-bands.d.ts +5 -0
- package/components/shell/use-phi-shell-header-bands.js +64 -0
- package/components/shell/use-phi-shell-sticky-bottom.d.ts +18 -0
- package/components/shell/use-phi-shell-sticky-bottom.js +54 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -0
- package/components/tables/client/phi-table-binding.js +22 -3
- package/components/trees/client/phi-tree-binding.d.ts +1 -0
- package/components/trees/client/phi-tree-binding.js +11 -2
- package/components/widgets/client/shared/phi-collection-provider.js +4 -3
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +16 -2
- package/components/widgets/client/shared/phi-command-buttons.js +6 -2
- package/components/widgets/config/background.d.ts +20 -0
- package/components/widgets/config/background.js +44 -2
- package/components/widgets/config/button-variant.d.ts +22 -4
- package/components/widgets/config/button-variant.js +24 -5
- package/components/widgets/config/common-action-field.d.ts +1 -1
- package/components/widgets/config/parser-primitives.js +4 -2
- package/components/widgets/config/theme-gradient.d.ts +11 -0
- package/components/widgets/config/theme-gradient.js +12 -0
- package/components/widgets/helpers/internal-reference-resolver.server.d.ts +1 -0
- package/components/widgets/helpers/internal-reference-resolver.server.js +4 -1
- package/components/widgets/label-sets/background.js +2 -0
- package/components/widgets/label-sets/geometry.js +2 -0
- package/components/widgets/label-sets/inspector.js +6 -0
- package/components/widgets/label-types/background.d.ts +1 -0
- package/components/widgets/label-types/background.js +1 -0
- package/components/widgets/label-types/common-controls.js +2 -2
- package/components/widgets/label-types/geometry.d.ts +1 -0
- package/components/widgets/label-types/geometry.js +1 -0
- package/components/widgets/label-types/inspector.d.ts +6 -0
- package/components/widgets/label-types/inspector.js +3 -0
- package/components/widgets/server/navigation-request.js +13 -1
- package/components/widgets/shared/card-body-client.d.ts +13 -0
- package/components/widgets/shared/card-body-client.js +40 -11
- package/components/widgets/shared/card-vocabulary.d.ts +36 -0
- package/components/widgets/shared/card-vocabulary.js +52 -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.d.ts +29 -0
- package/components/widgets/shared/markdown-body-client.js +60 -5
- package/components/widgets/shared/markdown-image-vocabulary.d.ts +31 -0
- package/components/widgets/shared/markdown-image-vocabulary.js +68 -0
- package/components/widgets/shared/markdown-render.d.ts +5 -0
- package/components/widgets/shared/markdown-render.js +139 -11
- package/components/widgets/shared/markdown-sections.d.ts +40 -0
- package/components/widgets/shared/markdown-sections.js +111 -0
- package/components/widgets/shared/widget-failure-client.d.ts +10 -0
- package/components/widgets/shared/widget-failure-client.js +20 -0
- package/components/widgets/shared/widget-failure.d.ts +31 -0
- package/components/widgets/shared/widget-failure.js +20 -0
- package/components/widgets/shared/widget-failure.server.d.ts +9 -0
- package/components/widgets/shared/widget-failure.server.js +12 -0
- package/gateway/dashboard-card-memo.d.ts +3 -0
- package/gateway/dashboard-card-memo.js +25 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/external-href.js +1 -1
- package/helpers/layout-style.d.ts +8 -4
- package/helpers/layout-style.js +3 -2
- package/helpers/mode-paint.d.ts +4 -0
- package/helpers/mode-paint.js +47 -0
- package/helpers/protected-mail.d.ts +16 -0
- package/helpers/protected-mail.js +81 -0
- package/helpers/surface-style.js +33 -11
- package/module-dashboard-cards.d.ts +1 -0
- package/module-dashboard-cards.js +1 -0
- package/module-records.d.ts +7 -0
- package/module-records.js +6 -0
- package/package.json +2 -2
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
- package/plugins/runtime-modules/builder/clients/region-inspector.js +67 -3
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +7 -4
- package/plugins/runtime-modules/builder/controller/page-controller.js +7 -0
- package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
- package/plugins/runtime-modules/builder/persistence.js +9 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.d.ts +3 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.js +7 -4
- package/plugins/runtime-modules/core/widgets/button/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +40 -4
- package/plugins/runtime-modules/core/widgets/button/config.js +12 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +102 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +60 -1
- package/plugins/runtime-modules/core/widgets/card/editor.js +17 -2
- package/plugins/runtime-modules/core/widgets/card/server.js +13 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -3
- package/plugins/runtime-modules/core/widgets/collection-view/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +47 -11
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
- package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +21 -3
- package/plugins/runtime-modules/core/widgets/entry-detail/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-header/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.js +13 -6
- package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +2 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +3 -3
- 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.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +40 -13
- package/plugins/runtime-modules/core/widgets/header-navigation/config.d.ts +26 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/config.js +27 -0
- package/plugins/runtime-modules/core/widgets/header-navigation/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/server.js +3 -1
- package/plugins/runtime-modules/core/widgets/image/client.js +11 -7
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +16 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +46 -1
- package/plugins/runtime-modules/core/widgets/markdown/server.js +22 -8
- package/plugins/runtime-modules/core/widgets/record/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/record/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/record/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/record/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/segmented/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +21 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.js +11 -1
- package/plugins/runtime-modules/core/widgets/simple-text/server.js +11 -1
- package/plugins/runtime-modules/core/widgets/switch/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/switch/config.d.ts +19 -0
- package/plugins/runtime-modules/core/widgets/switch/config.js +11 -0
- package/plugins/runtime-modules/core/widgets/table/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +16 -3
- package/plugins/runtime-modules/core/widgets/table/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/table/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/table/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/table/static-resource-editor.js +2 -1
- package/plugins/runtime-modules/core/widgets/timeline/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/timeline/client.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/timeline/client.js +14 -4
- package/plugins/runtime-modules/core/widgets/tree/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/tree/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/tree/client.js +13 -2
- package/plugins/runtime-modules/core/widgets/tree/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/tree/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/tree/server.js +2 -2
- package/plugins/runtime-modules/theme/presets.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.js +10 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +138 -7
- package/runtime-data-provider-client.d.ts +2 -0
- package/runtime-data-provider-client.js +7 -0
- package/styles/controls.css +118 -15
- package/styles/gradients.css +101 -0
- package/styles/layout.css +35 -0
- package/styles/root.css +18 -0
- package/styles/shell.css +206 -0
- package/theme/phi-button-shadow.d.ts +6 -0
- package/theme/phi-theme-gradients.d.ts +96 -0
- package/theme/phi-theme-gradients.js +245 -0
- package/theme/phi-theme-presets.d.ts +3 -0
- package/theme/phi-theme-presets.js +3 -0
- package/theme/phi-theme-tokens.d.ts +5 -1
- package/theme/phi-theme-tokens.js +14 -0
- package/theme/phi-tokens.d.ts +6 -0
- package/theme/phi-tokens.js +6 -0
- package/theme.d.ts +1 -0
- package/theme.js +6 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +8 -0
- package/types/layout-style.d.ts +9 -8
- package/types/layout-style.js +9 -8
- package/types/surface.d.ts +4 -0
- package/types/surface.js +4 -0
- package/types.d.ts +1 -1
- package/types.js +1 -1
|
@@ -1,32 +1,60 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { createElement } from "react";
|
|
4
|
-
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
5
4
|
import { PhiCollectionViewSkeletonControl } from "../../../../../components/controls/phi-collection-view-control";
|
|
6
5
|
import { normalizePhiCssSize } from "../../../../../components/layouts/phi-layout-contract";
|
|
7
6
|
import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
|
|
7
|
+
import { usePhiRuntimeModuleState } from "../../../../../components/runtime/runtime-module-context";
|
|
8
8
|
import { usePhiRuntimeModuleRenderClient } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
9
9
|
import { usePhiSignalIdentity } from "../../../../../components/runtime/runtime-signal-identity";
|
|
10
10
|
import { usePhiVisualAnchorParts } from "../../../../../components/runtime/runtime-visual-anchors";
|
|
11
11
|
import { createPhiSignalAddress } from "../../../../../types/signals";
|
|
12
12
|
import { usePhiControlSignalController } from "../../../../../components/widgets/client/shared/phi-control-signals";
|
|
13
13
|
import { usePhiCollectionViewBinding } from "../../../../../components/widgets/client/shared/phi-collection-view-binding";
|
|
14
|
+
import { PhiCollectionSourceFailureText, readPhiCollectionViewDeclaredFailure, } from "../../../../../components/widgets/shared/collection-source-failure";
|
|
15
|
+
import { PhiWidgetFailure } from "../../../../../components/widgets/shared/widget-failure-client";
|
|
16
|
+
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
14
17
|
/**
|
|
15
18
|
* The parts of a Collection View a Tour can point at, as `cms:<instanceId>:<part>` (design/TOURS.md): the
|
|
16
19
|
* filters and search, the toolbar, the items and the pagination. A part the view does not draw is simply
|
|
17
20
|
* not found, and the step pointing at it does what its `ifMissing` says.
|
|
18
21
|
*/
|
|
19
22
|
const PHI_COLLECTION_VIEW_VISUAL_ANCHOR_PARTS = ["filters", "toolbar", "items", "pagination"];
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The shape the items will take, since the Builder reads no data -- or the reason there will be none.
|
|
25
|
+
*
|
|
26
|
+
* A skeleton alone hid every misconfiguration from the one person who could fix it: the canvas looked
|
|
27
|
+
* right and the live page was empty. What is plain from the declarations is said here -- in the editor
|
|
28
|
+
* against the descriptors the Builder holds for the edited Area, in the server preview by the plugin,
|
|
29
|
+
* which has that Area's registry. A read that would fail is not knowable without reading, and the
|
|
30
|
+
* Builder does not read.
|
|
31
|
+
*/
|
|
32
|
+
function PhiCollectionViewWidgetPreview({ config, widgetId, renderMode, skeletonActive = true, }) {
|
|
21
33
|
const { token } = usePhiConfig();
|
|
34
|
+
const { dataProviderDescriptorsByKey, collectionItemRendererKeys } = usePhiRuntimeModuleState();
|
|
22
35
|
const presentation = config?.presentation;
|
|
36
|
+
/*
|
|
37
|
+
* Judged only in the editor: that is where the Builder mounts the edited Area's descriptors. Anywhere
|
|
38
|
+
* else the context could be another Area's or none, and an empty one would claim every provider gone.
|
|
39
|
+
*/
|
|
40
|
+
const declaredFailure = renderMode === "editor"
|
|
41
|
+
? readPhiCollectionViewDeclaredFailure({
|
|
42
|
+
source: config?.source,
|
|
43
|
+
itemRendererKey: config?.itemRendererKey,
|
|
44
|
+
dataProviderDescriptorsByKey,
|
|
45
|
+
itemRendererKeys: collectionItemRendererKeys,
|
|
46
|
+
})
|
|
47
|
+
: null;
|
|
48
|
+
if (declaredFailure) {
|
|
49
|
+
return (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.CollectionView, widgetId: widgetId, title: declaredFailure }));
|
|
50
|
+
}
|
|
23
51
|
return (_jsx(PhiCollectionViewSkeletonControl, { mode: presentation?.mode ?? "grid", gap: normalizePhiCssSize(presentation?.gap) ?? token.paddingSM, minColumnWidth: normalizePhiCssSize(presentation?.minColumnWidth) ?? 102, active: skeletonActive }));
|
|
24
52
|
}
|
|
25
|
-
function PhiCollectionViewWidgetLive({ config, labels, widgetId, }) {
|
|
53
|
+
function PhiCollectionViewWidgetLive({ config, labels, widgetId, renderMode, }) {
|
|
26
54
|
const signalIdentity = usePhiSignalIdentity();
|
|
27
55
|
usePhiVisualAnchorParts(signalIdentity.receiver?.startsWith("cms:") ? signalIdentity.receiver : null, PHI_COLLECTION_VIEW_VISUAL_ANCHOR_PARTS);
|
|
28
56
|
const source = config?.source ?? null;
|
|
29
|
-
const { resource, bindingError, binding } = usePhiCollectionViewBinding({
|
|
57
|
+
const { resource, bindingError, queryError, binding } = usePhiCollectionViewBinding({
|
|
30
58
|
source,
|
|
31
59
|
initialQuery: config?.initialQuery,
|
|
32
60
|
pageSize: config?.features.pagination?.pageSize,
|
|
@@ -47,19 +75,27 @@ function PhiCollectionViewWidgetLive({ config, labels, widgetId, }) {
|
|
|
47
75
|
return true;
|
|
48
76
|
},
|
|
49
77
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
78
|
+
/*
|
|
79
|
+
* The source's failures end the Widget here, before any renderer: the binding, the renderer and the
|
|
80
|
+
* read. An action the Provider refused is not among them -- that lands in `binding.error` alone, and
|
|
81
|
+
* the renderer says it to the person who acted.
|
|
82
|
+
*/
|
|
83
|
+
const failure = !config
|
|
84
|
+
? "Collection View configuration is unavailable."
|
|
85
|
+
: bindingError ??
|
|
86
|
+
(!ItemRenderer && rendererKey ? PhiCollectionSourceFailureText.rendererUnavailable(rendererKey) : null) ??
|
|
87
|
+
queryError;
|
|
88
|
+
if (failure || !config || !resource || !ItemRenderer) {
|
|
89
|
+
return (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.CollectionView, widgetId: widgetId, title: failure ?? "Collection View configuration is unavailable." }));
|
|
55
90
|
}
|
|
56
91
|
// `createElement` rather than a JSX tag: the renderer is looked up, not written down, and a looked-up
|
|
57
92
|
// component in tag position reads to React -- and to `react-hooks/static-components` -- as a new
|
|
58
93
|
// component per render. This is the same call `PhiRuntimeModuleRenderClientHost` makes for a Widget.
|
|
59
|
-
|
|
94
|
+
// `renderMode` goes along so a renderer's own configuration failures are said the same way.
|
|
95
|
+
return createElement(ItemRenderer, { config, binding, labels, widgetId, renderMode });
|
|
60
96
|
}
|
|
61
97
|
export function PhiCollectionViewWidget(props) {
|
|
62
98
|
return props.preview
|
|
63
|
-
? _jsx(PhiCollectionViewWidgetPreview, { config: props.config, skeletonActive: props.skeletonActive })
|
|
99
|
+
? (_jsx(PhiCollectionViewWidgetPreview, { config: props.config, widgetId: props.widgetId, renderMode: props.renderMode, skeletonActive: props.skeletonActive }))
|
|
64
100
|
: _jsx(PhiCollectionViewWidgetLive, { ...props });
|
|
65
101
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { PhiCmsAssetPreviewGridWidgetConfig } from "./config";
|
|
2
2
|
import type { PhiAssetPreviewGridWidgetLabels } from "../../../../../components/media/media-widget-labels";
|
|
3
|
+
import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
|
|
3
4
|
export type PhiAssetPreviewGridWidgetProps = {
|
|
4
5
|
config?: PhiCmsAssetPreviewGridWidgetConfig | null;
|
|
5
6
|
labels: PhiAssetPreviewGridWidgetLabels;
|
|
7
|
+
/** Who reads a failure of the asset source: the author outside "live", the log on a live page. */
|
|
8
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
6
9
|
};
|
|
7
|
-
export declare function PhiAssetPreviewGridWidget({ config, labels }: PhiAssetPreviewGridWidgetProps): import("react").JSX.Element;
|
|
10
|
+
export declare function PhiAssetPreviewGridWidget({ config, labels, renderMode }: PhiAssetPreviewGridWidgetProps): import("react").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { PHI_MEDIA_WIDGET_DEFAULT_LABELS } from "../../../../../components/media/media-widget-labels";
|
|
3
3
|
import { PHI_ASSET_COLLECTION_DATA_SOURCE } from "../../../../../components/media/asset-collection-runtime";
|
|
4
4
|
import { PhiCollectionViewWidget } from "./client";
|
|
5
|
-
export function PhiAssetPreviewGridWidget({ config, labels }) {
|
|
5
|
+
export function PhiAssetPreviewGridWidget({ config, labels, renderMode }) {
|
|
6
6
|
return (_jsx(PhiCollectionViewWidget, { config: {
|
|
7
7
|
presentation: {
|
|
8
8
|
mode: "grid",
|
|
@@ -12,5 +12,5 @@ export function PhiAssetPreviewGridWidget({ config, labels }) {
|
|
|
12
12
|
},
|
|
13
13
|
features: { tools: { mode: "external" }, pagination: { enabled: false } },
|
|
14
14
|
source: PHI_ASSET_COLLECTION_DATA_SOURCE,
|
|
15
|
-
}, labels: { ...PHI_MEDIA_WIDGET_DEFAULT_LABELS, grid: labels } }));
|
|
15
|
+
}, labels: { ...PHI_MEDIA_WIDGET_DEFAULT_LABELS, grid: labels }, renderMode: renderMode }));
|
|
16
16
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PhiCollectionViewWidgetServer } from "./server";
|
|
3
3
|
import { PhiWidgetInertPreview } from "../../../../../components/widgets/built-in/widget-preview";
|
|
4
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
4
5
|
import { PHI_COLLECTION_VIEW_WIDGET_DEFINITION, PHI_COLLECTION_VIEW_WIDGET_PLUGIN_TYPE, } from "./config";
|
|
5
6
|
export const PHI_COLLECTION_VIEW_WIDGET_PLUGIN = {
|
|
6
7
|
...PHI_COLLECTION_VIEW_WIDGET_DEFINITION,
|
|
7
|
-
render: ({ widget, runtime, config }) => (_jsx(PhiCollectionViewWidgetServer, { runtime: runtime, config: config, widgetId: widget.id }, `widget-${widget.id}`)),
|
|
8
|
-
renderPreview: ({ widget, runtime, config }) => (_jsx(PhiWidgetInertPreview, { children: _jsx(PhiCollectionViewWidgetServer, { runtime: runtime, config: config, widgetId: widget.id, preview: true }, `widget-${widget.id}`) })),
|
|
8
|
+
render: ({ widget, runtime, config }) => (_jsx(PhiCollectionViewWidgetServer, { runtime: runtime, config: config, widgetId: widget.id, renderMode: readPhiRuntimeTreeRenderMode(widget.config) }, `widget-${widget.id}`)),
|
|
9
|
+
renderPreview: ({ widget, runtime, registry, config }) => (_jsx(PhiWidgetInertPreview, { children: _jsx(PhiCollectionViewWidgetServer, { runtime: runtime, registry: registry, config: config, widgetId: widget.id, renderMode: readPhiRuntimeTreeRenderMode(widget.config), preview: true }, `widget-${widget.id}`) })),
|
|
9
10
|
};
|
|
10
11
|
export { PHI_COLLECTION_VIEW_WIDGET_PLUGIN_TYPE };
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { PhiBlockRuntime } from "../../../../../types";
|
|
2
|
+
import type { PhiCmsRuntimeRenderRegistry } from "../../../../../types/cms-plugins";
|
|
2
3
|
import type { PhiCmsCollectionViewWidgetConfig } from "../../../../../types/collection-view-widget";
|
|
3
4
|
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
5
|
+
import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
|
|
4
6
|
export type PhiCollectionViewWidgetServerProps = {
|
|
5
7
|
runtime: Pick<PhiBlockRuntime, "locale">;
|
|
8
|
+
/** The Area's declarations, which the preview judges the binding against; absent outside a page render. */
|
|
9
|
+
registry?: Pick<PhiCmsRuntimeRenderRegistry, "dataProviderDescriptorsByKey">;
|
|
6
10
|
config?: PhiCmsCollectionViewWidgetConfig | null;
|
|
7
11
|
widgetId?: PhiCmsInstanceId | null;
|
|
12
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
8
13
|
preview?: boolean;
|
|
9
14
|
};
|
|
10
|
-
export declare function PhiCollectionViewWidgetServer({ config, widgetId, preview, }: PhiCollectionViewWidgetServerProps): Promise<import("react").JSX.Element>;
|
|
15
|
+
export declare function PhiCollectionViewWidgetServer({ config, widgetId, registry, renderMode, preview, }: PhiCollectionViewWidgetServerProps): Promise<import("react").JSX.Element>;
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
|
-
|
|
4
|
+
import { readPhiCollectionViewDeclaredFailure } from "../../../../../components/widgets/shared/collection-source-failure";
|
|
5
|
+
import { PhiWidgetFailureServer } from "../../../../../components/widgets/shared/widget-failure.server";
|
|
6
|
+
export async function PhiCollectionViewWidgetServer({ config, widgetId, registry, renderMode, preview = false, }) {
|
|
5
7
|
if (preview) {
|
|
6
|
-
|
|
8
|
+
/*
|
|
9
|
+
* The preview reads no data, so this is the one place its binding is judged: against the providers
|
|
10
|
+
* the edited Area's Modules declare. The renderer a Site picked from another Module is not -- the
|
|
11
|
+
* registry does not list renderers -- and is left to the editor canvas, which has them.
|
|
12
|
+
*/
|
|
13
|
+
const declaredFailure = registry
|
|
14
|
+
? readPhiCollectionViewDeclaredFailure({
|
|
15
|
+
source: config?.source,
|
|
16
|
+
itemRendererKey: config?.itemRendererKey,
|
|
17
|
+
dataProviderDescriptorsByKey: registry.dataProviderDescriptorsByKey,
|
|
18
|
+
itemRendererKeys: null,
|
|
19
|
+
})
|
|
20
|
+
: null;
|
|
21
|
+
if (declaredFailure) {
|
|
22
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: renderMode, widgetType: PhiCmsWidgetType.CollectionView, widgetId: widgetId, title: declaredFailure }));
|
|
23
|
+
}
|
|
24
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.CollectionView, componentProps: { config, widgetId, renderMode, preview: true } }));
|
|
7
25
|
}
|
|
8
|
-
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.CollectionView, componentProps: { config, widgetId, preview: false } }));
|
|
26
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.CollectionView, componentProps: { config, widgetId, renderMode, preview: false } }));
|
|
9
27
|
}
|
|
@@ -4,5 +4,5 @@ import { PHI_ENTRY_DETAIL_WIDGET_DEFINITION } from "./config";
|
|
|
4
4
|
import { PhiEntryDetailWidget } from "./server";
|
|
5
5
|
export const PHI_ENTRY_DETAIL_WIDGET_PLUGIN = {
|
|
6
6
|
...PHI_ENTRY_DETAIL_WIDGET_DEFINITION,
|
|
7
|
-
...definePhiPassiveWidgetRenderers(({ widget, config, runtime, registry }) => (_jsx(PhiEntryDetailWidget, { config: config, runtime: runtime, registry: registry }, `widget-${widget.id}`))),
|
|
7
|
+
...definePhiPassiveWidgetRenderers(({ widget, config, runtime, registry }) => (_jsx(PhiEntryDetailWidget, { config: config, runtime: runtime, registry: registry, widgetId: widget.id }, `widget-${widget.id}`))),
|
|
8
8
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { PhiNoLabels, PhiServerBlockBaseProps } from "../../../../../types";
|
|
2
2
|
import type { PhiCmsRuntimeRenderRegistry } from "../../../../../types/cms-plugins";
|
|
3
|
+
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
3
4
|
import { type PhiEntryDetailWidgetConfig } from "./config";
|
|
4
5
|
export type PhiEntryDetailWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, PhiEntryDetailWidgetConfig> & {
|
|
5
6
|
/** Where the record binding is answered; absent outside a page render, where nothing is bound. */
|
|
6
7
|
registry?: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey">;
|
|
8
|
+
widgetId?: PhiCmsInstanceId | null;
|
|
7
9
|
};
|
|
8
10
|
/**
|
|
9
11
|
* The text of one published entry, read while the page is drawn (`CONTENT_ENTRIES.md`).
|
|
@@ -15,4 +17,4 @@ export type PhiEntryDetailWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, Phi
|
|
|
15
17
|
* expired between the two reads or a slug a Site typed into a Page of its own. Both say so rather than
|
|
16
18
|
* draw an empty Page.
|
|
17
19
|
*/
|
|
18
|
-
export declare function PhiEntryDetailWidget({ config, runtime, registry }: PhiEntryDetailWidgetProps): Promise<import("react").JSX.Element>;
|
|
20
|
+
export declare function PhiEntryDetailWidget({ config, runtime, registry, widgetId }: PhiEntryDetailWidgetProps): Promise<import("react").JSX.Element>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
3
|
+
import { PhiWidgetFailureServer } from "../../../../../components/widgets/shared/widget-failure.server";
|
|
3
4
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
5
|
import { getPhiContentEntryReaderLabels } from "../../../../../components/widgets/label-sets/content-entries";
|
|
5
6
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
6
7
|
import { phiRuntime } from "../../../../../server-helpers/phi-runtime";
|
|
8
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
7
9
|
import { readPhiBoundContentEntry } from "../../content-entries/record-source.server";
|
|
8
10
|
import { buildPhiEntryViews } from "../entry-list/view.server";
|
|
9
11
|
import { normalizePhiEntryDetailWidgetConfig } from "./config";
|
|
@@ -17,7 +19,7 @@ import { normalizePhiEntryDetailWidgetConfig } from "./config";
|
|
|
17
19
|
* expired between the two reads or a slug a Site typed into a Page of its own. Both say so rather than
|
|
18
20
|
* draw an empty Page.
|
|
19
21
|
*/
|
|
20
|
-
export async function PhiEntryDetailWidget({ config, runtime, registry }) {
|
|
22
|
+
export async function PhiEntryDetailWidget({ config, runtime, registry, widgetId }) {
|
|
21
23
|
const settings = normalizePhiEntryDetailWidgetConfig(config);
|
|
22
24
|
const rt = phiRuntime(runtime);
|
|
23
25
|
const labels = await getPhiContentEntryReaderLabels({
|
|
@@ -27,8 +29,9 @@ export async function PhiEntryDetailWidget({ config, runtime, registry }) {
|
|
|
27
29
|
});
|
|
28
30
|
const bound = await readPhiBoundContentEntry({ registry, runtime, binding: settings.entry });
|
|
29
31
|
if (bound.status === "unavailable") {
|
|
30
|
-
return _jsx(
|
|
32
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: readPhiRuntimeTreeRenderMode(config ?? {}), widgetType: PhiCmsWidgetType.EntryDetail, widgetId: widgetId, title: labels.unavailable, description: bound.reason }));
|
|
31
33
|
}
|
|
34
|
+
// No entry at that address is said to the reader: it is the page's content, not a broken binding.
|
|
32
35
|
if (bound.status === "missing") {
|
|
33
36
|
return _jsx(PhiAlertControl, { level: "info", showIcon: true, title: labels.emptyTitle, description: labels.emptyText });
|
|
34
37
|
}
|
|
@@ -4,5 +4,5 @@ import { PHI_ENTRY_HEADER_WIDGET_DEFINITION } from "./config";
|
|
|
4
4
|
import { PhiEntryHeaderWidget } from "./server";
|
|
5
5
|
export const PHI_ENTRY_HEADER_WIDGET_PLUGIN = {
|
|
6
6
|
...PHI_ENTRY_HEADER_WIDGET_DEFINITION,
|
|
7
|
-
...definePhiPassiveWidgetRenderers(({ widget, config, runtime, registry }) => (_jsx(PhiEntryHeaderWidget, { config: config, runtime: runtime, registry: registry }, `widget-${widget.id}`))),
|
|
7
|
+
...definePhiPassiveWidgetRenderers(({ widget, config, runtime, registry }) => (_jsx(PhiEntryHeaderWidget, { config: config, runtime: runtime, registry: registry, widgetId: widget.id }, `widget-${widget.id}`))),
|
|
8
8
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { PhiNoLabels, PhiServerBlockBaseProps } from "../../../../../types";
|
|
2
2
|
import type { PhiCmsRuntimeRenderRegistry } from "../../../../../types/cms-plugins";
|
|
3
|
+
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
3
4
|
import { type PhiEntryHeaderWidgetConfig } from "./config";
|
|
4
5
|
export type PhiEntryHeaderWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, PhiEntryHeaderWidgetConfig> & {
|
|
5
6
|
/** Where the record binding is answered; absent outside a page render, where nothing is bound. */
|
|
6
7
|
registry?: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey">;
|
|
8
|
+
widgetId?: PhiCmsInstanceId | null;
|
|
7
9
|
};
|
|
8
10
|
/**
|
|
9
11
|
* The opening of one published entry, read while the page is drawn (`CONTENT_ENTRIES.md`).
|
|
@@ -12,4 +14,4 @@ export type PhiEntryHeaderWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, Phi
|
|
|
12
14
|
* same parameters are answered once per request, so the two cost Core one read between them. Only the
|
|
13
15
|
* meta is prepared: the body is not parsed for a header.
|
|
14
16
|
*/
|
|
15
|
-
export declare function PhiEntryHeaderWidget({ config, runtime, registry }: PhiEntryHeaderWidgetProps): Promise<import("react").JSX.Element>;
|
|
17
|
+
export declare function PhiEntryHeaderWidget({ config, runtime, registry, widgetId }: PhiEntryHeaderWidgetProps): Promise<import("react").JSX.Element>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
3
|
+
import { PhiWidgetFailureServer } from "../../../../../components/widgets/shared/widget-failure.server";
|
|
3
4
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
5
|
import { getPhiContentEntryReaderLabels } from "../../../../../components/widgets/label-sets/content-entries";
|
|
5
6
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
6
7
|
import { phiRuntime } from "../../../../../server-helpers/phi-runtime";
|
|
8
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
7
9
|
import { readPhiBoundContentEntry } from "../../content-entries/record-source.server";
|
|
8
10
|
import { buildPhiEntryViews } from "../entry-list/view.server";
|
|
9
11
|
import { normalizePhiEntryHeaderWidgetConfig } from "./config";
|
|
@@ -14,7 +16,7 @@ import { normalizePhiEntryHeaderWidgetConfig } from "./config";
|
|
|
14
16
|
* same parameters are answered once per request, so the two cost Core one read between them. Only the
|
|
15
17
|
* meta is prepared: the body is not parsed for a header.
|
|
16
18
|
*/
|
|
17
|
-
export async function PhiEntryHeaderWidget({ config, runtime, registry }) {
|
|
19
|
+
export async function PhiEntryHeaderWidget({ config, runtime, registry, widgetId }) {
|
|
18
20
|
const settings = normalizePhiEntryHeaderWidgetConfig(config);
|
|
19
21
|
const rt = phiRuntime(runtime);
|
|
20
22
|
const labels = await getPhiContentEntryReaderLabels({
|
|
@@ -24,8 +26,9 @@ export async function PhiEntryHeaderWidget({ config, runtime, registry }) {
|
|
|
24
26
|
});
|
|
25
27
|
const bound = await readPhiBoundContentEntry({ registry, runtime, binding: settings.entry });
|
|
26
28
|
if (bound.status === "unavailable") {
|
|
27
|
-
return _jsx(
|
|
29
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: readPhiRuntimeTreeRenderMode(config ?? {}), widgetType: PhiCmsWidgetType.EntryHeader, widgetId: widgetId, title: labels.unavailable, description: bound.reason }));
|
|
28
30
|
}
|
|
31
|
+
// No entry at that address is said to the reader: it is the page's content, not a broken binding.
|
|
29
32
|
if (bound.status === "missing") {
|
|
30
33
|
return _jsx(PhiAlertControl, { level: "info", showIcon: true, title: labels.emptyTitle, description: labels.emptyText });
|
|
31
34
|
}
|
|
@@ -7,5 +7,5 @@ import { PhiEntryListWidget } from "./server";
|
|
|
7
7
|
export const PHI_ENTRY_LIST_WIDGET_PLUGIN = {
|
|
8
8
|
...PHI_ENTRY_LIST_WIDGET_DEFINITION,
|
|
9
9
|
// `links` carries the detail route, resolved with every other target of the page before anything drew.
|
|
10
|
-
...definePhiPassiveWidgetRenderers(({ widget, config, runtime, registry, links }) => (_jsx(PhiEntryListWidget, { config: config, runtime: runtime, registry: registry, links: links, translate: !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate) }, `widget-${widget.id}`))),
|
|
10
|
+
...definePhiPassiveWidgetRenderers(({ widget, config, runtime, registry, links }) => (_jsx(PhiEntryListWidget, { config: config, runtime: runtime, registry: registry, links: links, translate: !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate), widgetId: widget.id }, `widget-${widget.id}`))),
|
|
11
11
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PhiNoLabels, PhiServerBlockBaseProps } from "../../../../../types";
|
|
2
2
|
import type { PhiCmsRuntimeRenderRegistry } from "../../../../../types/cms-plugins";
|
|
3
3
|
import type { PhiResolvedLinkTargets } from "../../../../../types/references";
|
|
4
|
+
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
4
5
|
import { type PhiEntryListWidgetConfig } from "./config";
|
|
5
6
|
export type PhiEntryListWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, PhiEntryListWidgetConfig> & {
|
|
6
7
|
/** Where the record binding is answered; absent outside a page render, where nothing is bound. */
|
|
@@ -8,6 +9,7 @@ export type PhiEntryListWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, PhiEn
|
|
|
8
9
|
links?: PhiResolvedLinkTargets | null;
|
|
9
10
|
/** Whether the heading is translated: the node's `NoTranslate` flag, read by the plugin. */
|
|
10
11
|
translate?: boolean;
|
|
12
|
+
widgetId?: PhiCmsInstanceId | null;
|
|
11
13
|
};
|
|
12
14
|
/**
|
|
13
15
|
* One kind's published entries, read while the page is drawn (`CONTENT_ENTRIES.md`).
|
|
@@ -16,12 +18,13 @@ export type PhiEntryListWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, PhiEn
|
|
|
16
18
|
* the render rather than in a request the browser makes afterwards. On a Public page that is also the only
|
|
17
19
|
* way an expired entry can be absent instead of appearing and then disappearing.
|
|
18
20
|
*
|
|
19
|
-
* A failed read
|
|
20
|
-
*
|
|
21
|
+
* A failed read is not drawn as a heading with nothing under it, which a visitor reads as "this Site has
|
|
22
|
+
* published nothing". It goes through `PhiWidgetFailureServer`: the author reads why in the Builder, an
|
|
23
|
+
* operator finds it in the log, and the live page goes on without the list.
|
|
21
24
|
*
|
|
22
25
|
* A `related` list is the exception twice over. It reads through its record binding, the one the header
|
|
23
26
|
* and text are bound to, so it costs Core nothing the Page did not already ask, and it is cut to as many
|
|
24
27
|
* as that record carries. And with nothing related -- or nothing to be related to -- it draws
|
|
25
28
|
* nothing at all: a "more like this" heading over an empty space says something false.
|
|
26
29
|
*/
|
|
27
|
-
export declare function PhiEntryListWidget({ config, runtime, registry, links, translate }: PhiEntryListWidgetProps): Promise<import("react").JSX.Element | null>;
|
|
30
|
+
export declare function PhiEntryListWidget({ config, runtime, registry, links, translate, widgetId, }: PhiEntryListWidgetProps): Promise<import("react").JSX.Element | null>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
3
2
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
3
|
import { getPhiContentEntryReaderLabels } from "../../../../../components/widgets/label-sets/content-entries";
|
|
4
|
+
import { PhiWidgetFailureServer } from "../../../../../components/widgets/shared/widget-failure.server";
|
|
5
5
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
6
6
|
import { fetchPhiSiteContentEntries } from "../../../../../gateway/content-entries";
|
|
7
7
|
import { phiRuntime } from "../../../../../server-helpers/phi-runtime";
|
|
8
8
|
import { trBulkForLocale } from "../../../../../server-helpers/translate";
|
|
9
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
9
10
|
import { readPhiBoundContentEntry } from "../../content-entries/record-source.server";
|
|
10
11
|
import { buildPhiEntryViews } from "./view.server";
|
|
11
12
|
import { normalizePhiEntryListWidgetConfig } from "./config";
|
|
@@ -17,16 +18,18 @@ import { pickPhiSequenceSettings } from "../../../../../components/widgets/confi
|
|
|
17
18
|
* the render rather than in a request the browser makes afterwards. On a Public page that is also the only
|
|
18
19
|
* way an expired entry can be absent instead of appearing and then disappearing.
|
|
19
20
|
*
|
|
20
|
-
* A failed read
|
|
21
|
-
*
|
|
21
|
+
* A failed read is not drawn as a heading with nothing under it, which a visitor reads as "this Site has
|
|
22
|
+
* published nothing". It goes through `PhiWidgetFailureServer`: the author reads why in the Builder, an
|
|
23
|
+
* operator finds it in the log, and the live page goes on without the list.
|
|
22
24
|
*
|
|
23
25
|
* A `related` list is the exception twice over. It reads through its record binding, the one the header
|
|
24
26
|
* and text are bound to, so it costs Core nothing the Page did not already ask, and it is cut to as many
|
|
25
27
|
* as that record carries. And with nothing related -- or nothing to be related to -- it draws
|
|
26
28
|
* nothing at all: a "more like this" heading over an empty space says something false.
|
|
27
29
|
*/
|
|
28
|
-
export async function PhiEntryListWidget({ config, runtime, registry, links, translate = true }) {
|
|
30
|
+
export async function PhiEntryListWidget({ config, runtime, registry, links, translate = true, widgetId, }) {
|
|
29
31
|
const settings = normalizePhiEntryListWidgetConfig(config);
|
|
32
|
+
const renderMode = readPhiRuntimeTreeRenderMode(config ?? {});
|
|
30
33
|
const rt = phiRuntime(runtime);
|
|
31
34
|
const locale = runtime.locale.current;
|
|
32
35
|
const labels = await getPhiContentEntryReaderLabels({
|
|
@@ -41,6 +44,10 @@ export async function PhiEntryListWidget({ config, runtime, registry, links, tra
|
|
|
41
44
|
const bound = settings.relatedTo
|
|
42
45
|
? await readPhiBoundContentEntry({ registry, runtime, binding: settings.relatedTo })
|
|
43
46
|
: null;
|
|
47
|
+
// A source that cannot answer is a failure; one that answers nothing is only nothing related.
|
|
48
|
+
if (bound?.status === "unavailable") {
|
|
49
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: renderMode, widgetType: PhiCmsWidgetType.EntryList, widgetId: widgetId, title: labels.unavailable, description: bound.reason }));
|
|
50
|
+
}
|
|
44
51
|
if (bound?.status !== "ok") {
|
|
45
52
|
return null;
|
|
46
53
|
}
|
|
@@ -59,8 +66,8 @@ export async function PhiEntryListWidget({ config, runtime, registry, links, tra
|
|
|
59
66
|
categories: settings.categories,
|
|
60
67
|
});
|
|
61
68
|
}
|
|
62
|
-
catch {
|
|
63
|
-
return _jsx(
|
|
69
|
+
catch (error) {
|
|
70
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: renderMode, widgetType: PhiCmsWidgetType.EntryList, widgetId: widgetId, title: labels.unavailable, description: error instanceof Error ? error.message : String(error), error: error }));
|
|
64
71
|
}
|
|
65
72
|
}
|
|
66
73
|
const views = await buildPhiEntryViews({
|
|
@@ -11,7 +11,8 @@ function inlineText(inlines) {
|
|
|
11
11
|
return inline.text;
|
|
12
12
|
if (inline.kind === "break")
|
|
13
13
|
return " ";
|
|
14
|
-
|
|
14
|
+
// A teaser is plain text, so a protected address (`helpers/protected-mail.ts`) is left out of it.
|
|
15
|
+
if (inline.kind === "image" || inline.kind === "mail_text")
|
|
15
16
|
return "";
|
|
16
17
|
return inlineText(inline.children);
|
|
17
18
|
}).join("");
|
|
@@ -338,8 +338,8 @@ export declare const PHI_GALLERY_WIDGET_DEFINITION: {
|
|
|
338
338
|
type: "choice";
|
|
339
339
|
label: string;
|
|
340
340
|
options: {
|
|
341
|
-
value: "
|
|
342
|
-
label: "
|
|
341
|
+
value: "3:2" | "4:3" | "16:9" | "1:1" | "3:4" | "2:3" | "9:16" | "21:9";
|
|
342
|
+
label: "3:2" | "4:3" | "16:9" | "1:1" | "3:4" | "2:3" | "9:16" | "21:9";
|
|
343
343
|
}[];
|
|
344
344
|
visibleWhen: {
|
|
345
345
|
field: string;
|
|
@@ -362,7 +362,7 @@ export declare const PHI_GALLERY_WIDGET_DEFINITION: {
|
|
|
362
362
|
params: {};
|
|
363
363
|
};
|
|
364
364
|
preview: false;
|
|
365
|
-
aspectRatio: "
|
|
365
|
+
aspectRatio: "3:2" | "4:3" | "16:9" | "1:1" | "3:4" | "2:3" | "9:16" | "21:9";
|
|
366
366
|
fit: "cover";
|
|
367
367
|
};
|
|
368
368
|
parseConfig: typeof parsePhiCmsGalleryWidgetConfig;
|
|
@@ -4,5 +4,5 @@ import { PHI_GALLERY_WIDGET_DEFINITION, } from "./config";
|
|
|
4
4
|
import { PhiGalleryWidgetServer } from "./server";
|
|
5
5
|
export const PHI_GALLERY_WIDGET_PLUGIN = {
|
|
6
6
|
...PHI_GALLERY_WIDGET_DEFINITION,
|
|
7
|
-
...definePhiPassiveWidgetRenderers(({ widget, runtime, registry, config }) => (_jsx(PhiGalleryWidgetServer, { runtime: runtime, registry: registry, config: config }, `widget-${widget.id}`))),
|
|
7
|
+
...definePhiPassiveWidgetRenderers(({ widget, runtime, registry, config }) => (_jsx(PhiGalleryWidgetServer, { runtime: runtime, registry: registry, config: config, widgetId: widget.id }, `widget-${widget.id}`))),
|
|
8
8
|
};
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import type { PhiBlockRuntime } from "../../../../../types";
|
|
3
3
|
import type { PhiCmsRuntimeRenderRegistry } from "../../../../../types/cms-plugins";
|
|
4
|
+
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
4
5
|
import type { PhiCmsGalleryWidgetConfig } from "./config";
|
|
5
6
|
export type PhiGalleryWidgetServerProps = {
|
|
6
7
|
runtime: PhiBlockRuntime;
|
|
7
8
|
/** Where the record binding is answered; absent outside a page render, where nothing is bound. */
|
|
8
9
|
registry?: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey">;
|
|
9
10
|
config: PhiCmsGalleryWidgetConfig;
|
|
11
|
+
widgetId?: PhiCmsInstanceId | null;
|
|
10
12
|
};
|
|
11
13
|
/**
|
|
12
14
|
* The pictures come from the record the binding names -- a Folder, read while the page is drawn -- so
|
|
13
15
|
* they are in the HTML and the window knows what to load before anything is on screen. A record of
|
|
14
|
-
* another shape is somebody else's Provider bound here by mistake
|
|
15
|
-
*
|
|
16
|
+
* another shape is somebody else's Provider bound here by mistake. Either failure is the author's to
|
|
17
|
+
* read and is nothing on a live page, rather than an empty gallery anywhere.
|
|
16
18
|
*/
|
|
17
|
-
export declare function PhiGalleryWidgetServer({ runtime, registry, config }: PhiGalleryWidgetServerProps): Promise<import("react").JSX.Element | null>;
|
|
19
|
+
export declare function PhiGalleryWidgetServer({ runtime, registry, config, widgetId }: PhiGalleryWidgetServerProps): Promise<import("react").JSX.Element | null>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import "server-only";
|
|
3
|
-
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
4
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
5
4
|
import { getPhiGalleryWidgetLabels } from "../../../../../components/widgets/label-sets/gallery";
|
|
5
|
+
import { PhiWidgetFailureServer } from "../../../../../components/widgets/shared/widget-failure.server";
|
|
6
6
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
7
7
|
import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
|
|
8
8
|
import { resolvePhiRecordSource } from "../../../../../server-helpers/record-source";
|
|
9
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
9
10
|
function isPublicAssetReference(value) {
|
|
10
11
|
return typeof value === "object" && value !== null &&
|
|
11
12
|
typeof value.id === "number" &&
|
|
@@ -14,26 +15,27 @@ function isPublicAssetReference(value) {
|
|
|
14
15
|
/**
|
|
15
16
|
* The pictures come from the record the binding names -- a Folder, read while the page is drawn -- so
|
|
16
17
|
* they are in the HTML and the window knows what to load before anything is on screen. A record of
|
|
17
|
-
* another shape is somebody else's Provider bound here by mistake
|
|
18
|
-
*
|
|
18
|
+
* another shape is somebody else's Provider bound here by mistake. Either failure is the author's to
|
|
19
|
+
* read and is nothing on a live page, rather than an empty gallery anywhere.
|
|
19
20
|
*/
|
|
20
|
-
export async function PhiGalleryWidgetServer({ runtime, registry, config }) {
|
|
21
|
+
export async function PhiGalleryWidgetServer({ runtime, registry, config, widgetId }) {
|
|
21
22
|
const labels = await getPhiGalleryWidgetLabels({
|
|
22
23
|
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
23
24
|
internalToken: readPhiServerApiCredentials().internalToken,
|
|
24
25
|
locale: runtime.locale.current,
|
|
25
26
|
});
|
|
27
|
+
const renderMode = readPhiRuntimeTreeRenderMode(config);
|
|
26
28
|
const result = registry && config.source
|
|
27
29
|
? await resolvePhiRecordSource({ registry, runtime, binding: config.source })
|
|
28
30
|
: { status: "missing" };
|
|
29
31
|
if (result.status === "unavailable") {
|
|
30
|
-
return _jsx(
|
|
32
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Gallery, widgetId: widgetId, title: labels.unavailable, description: result.reason }));
|
|
31
33
|
}
|
|
32
34
|
const images = result.status === "ok" && Array.isArray(result.record)
|
|
33
35
|
? result.record.filter(isPublicAssetReference)
|
|
34
36
|
: null;
|
|
35
37
|
if (result.status === "ok" && images == null) {
|
|
36
|
-
return _jsx(
|
|
38
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Gallery, widgetId: widgetId, title: labels.unavailable, description: `The record bound from "${config.source?.providerKey ?? ""}" is not a list of images.` }));
|
|
37
39
|
}
|
|
38
40
|
if (!images || images.length === 0) {
|
|
39
41
|
return null;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
|
+
import type { PhiMenuSelectionStyle } from "../../../../../components/controls/phi-menu-control-vocabulary";
|
|
2
3
|
import type { PhiClientBlockBaseProps, PhiBlockRuntime, PhiNoLabels } from "../../../../../types";
|
|
3
4
|
import { type PhiMenuTheme, type PhiNavItem } from "../../../../../components/shell/shell-types";
|
|
5
|
+
import type { PhiHeaderNavigationPhoneMenu } from "./config";
|
|
4
6
|
export type PhiHeaderNavigationWidgetClientProps = PhiClientBlockBaseProps<PhiNoLabels, Record<string, never>, Pick<PhiBlockRuntime, "site" | "locale" | "area">> & {
|
|
5
7
|
runtime: Pick<PhiBlockRuntime, "site" | "locale" | "area">;
|
|
6
8
|
items: PhiNavItem[];
|
|
7
9
|
menuTheme?: PhiMenuTheme;
|
|
8
10
|
height?: CSSProperties["height"];
|
|
9
11
|
align?: "left" | "center";
|
|
12
|
+
selectionStyle?: PhiMenuSelectionStyle;
|
|
13
|
+
/** Below 768px: the entries behind a menu button (the default), or the row as on a wider screen. */
|
|
14
|
+
phoneMenu?: PhiHeaderNavigationPhoneMenu;
|
|
10
15
|
interactive?: boolean;
|
|
11
16
|
};
|
|
12
|
-
export declare function PhiHeaderNavigationWidgetClient({ runtime, items, menuTheme, height, align, interactive, }: PhiHeaderNavigationWidgetClientProps): import("react").JSX.Element | null;
|
|
17
|
+
export declare function PhiHeaderNavigationWidgetClient({ runtime, items, menuTheme, height, align, selectionStyle, phoneMenu, interactive, }: PhiHeaderNavigationWidgetClientProps): import("react").JSX.Element | null;
|