@phis/ui 0.4.4 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/README.md +9 -3
  2. package/cms/plugins.d.ts +1 -0
  3. package/cms/plugins.js +2 -0
  4. package/components/cms/phi-cms-root-layout.js +30 -1
  5. package/components/controls/phi-background-control.d.ts +6 -1
  6. package/components/controls/phi-background-control.js +12 -4
  7. package/components/controls/phi-button-control.d.ts +13 -1
  8. package/components/controls/phi-button-control.js +21 -3
  9. package/components/controls/phi-dropdown-control.js +2 -2
  10. package/components/controls/phi-media-asset-tile-control.js +10 -10
  11. package/components/controls/phi-progress-control.d.ts +10 -2
  12. package/components/controls/phi-progress-control.js +6 -2
  13. package/components/controls/phi-ribbon-control.d.ts +4 -1
  14. package/components/controls/phi-ribbon-control.js +5 -3
  15. package/components/controls/phi-ribbon-wrap-control.d.ts +7 -1
  16. package/components/controls/phi-ribbon-wrap-control.js +8 -2
  17. package/components/controls/phi-segmented-control.d.ts +4 -1
  18. package/components/controls/phi-segmented-control.js +13 -2
  19. package/components/controls/phi-surface-control.d.ts +2 -0
  20. package/components/controls/phi-surface-control.js +16 -1
  21. package/components/controls/phi-switch-control.d.ts +4 -1
  22. package/components/controls/phi-switch-control.js +8 -2
  23. package/components/controls/phi-tag-control.d.ts +4 -1
  24. package/components/controls/phi-tag-control.js +11 -3
  25. package/components/layouts/phi-layout-view-model.js +10 -1
  26. package/components/regions/clients/cms-region-container-client.js +11 -1
  27. package/components/regions/phi-cms-region-container.js +5 -1
  28. package/components/regions/phi-cms-region-shell.d.ts +10 -0
  29. package/components/regions/phi-cms-region-shell.js +53 -7
  30. package/components/root/phi-root-layout.d.ts +1 -0
  31. package/components/root/phi-root-layout.js +1 -0
  32. package/components/root/phi-root-theme-resolver.js +12 -1
  33. package/components/root/phi-shell-chrome-overlay.d.ts +6 -0
  34. package/components/root/phi-shell-chrome-overlay.js +7 -1
  35. package/components/runtime/runtime-module-context.d.ts +12 -1
  36. package/components/runtime/runtime-module-context.js +6 -1
  37. package/components/shell/phi-cms-shell.d.ts +7 -1
  38. package/components/shell/phi-cms-shell.js +4 -2
  39. package/components/shell/use-phi-shell-header-bands.d.ts +5 -0
  40. package/components/shell/use-phi-shell-header-bands.js +64 -0
  41. package/components/shell/use-phi-shell-sticky-bottom.d.ts +18 -0
  42. package/components/shell/use-phi-shell-sticky-bottom.js +54 -0
  43. package/components/tables/client/phi-table-binding.d.ts +1 -0
  44. package/components/tables/client/phi-table-binding.js +22 -3
  45. package/components/trees/client/phi-tree-binding.d.ts +1 -0
  46. package/components/trees/client/phi-tree-binding.js +11 -2
  47. package/components/widgets/client/shared/phi-collection-provider.js +4 -3
  48. package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
  49. package/components/widgets/client/shared/phi-collection-view-binding.js +16 -2
  50. package/components/widgets/client/shared/phi-command-buttons.js +6 -2
  51. package/components/widgets/config/background.d.ts +20 -0
  52. package/components/widgets/config/background.js +44 -2
  53. package/components/widgets/config/button-variant.d.ts +22 -4
  54. package/components/widgets/config/button-variant.js +24 -5
  55. package/components/widgets/config/common-action-field.d.ts +1 -1
  56. package/components/widgets/config/parser-primitives.js +4 -2
  57. package/components/widgets/config/theme-gradient.d.ts +11 -0
  58. package/components/widgets/config/theme-gradient.js +12 -0
  59. package/components/widgets/label-sets/background.js +2 -0
  60. package/components/widgets/label-sets/geometry.js +2 -0
  61. package/components/widgets/label-sets/inspector.js +4 -0
  62. package/components/widgets/label-types/background.d.ts +1 -0
  63. package/components/widgets/label-types/background.js +1 -0
  64. package/components/widgets/label-types/common-controls.js +2 -2
  65. package/components/widgets/label-types/geometry.d.ts +1 -0
  66. package/components/widgets/label-types/geometry.js +1 -0
  67. package/components/widgets/label-types/inspector.d.ts +4 -0
  68. package/components/widgets/label-types/inspector.js +2 -0
  69. package/components/widgets/shared/card-body-client.d.ts +11 -0
  70. package/components/widgets/shared/card-body-client.js +32 -4
  71. package/components/widgets/shared/collection-source-failure.d.ts +26 -0
  72. package/components/widgets/shared/collection-source-failure.js +42 -0
  73. package/components/widgets/shared/markdown-render.js +16 -3
  74. package/components/widgets/shared/widget-failure-client.d.ts +10 -0
  75. package/components/widgets/shared/widget-failure-client.js +20 -0
  76. package/components/widgets/shared/widget-failure.d.ts +31 -0
  77. package/components/widgets/shared/widget-failure.js +20 -0
  78. package/components/widgets/shared/widget-failure.server.d.ts +9 -0
  79. package/components/widgets/shared/widget-failure.server.js +12 -0
  80. package/gateway/dashboard-card-memo.d.ts +3 -0
  81. package/gateway/dashboard-card-memo.js +25 -0
  82. package/helpers/cms-region-keys.d.ts +1 -1
  83. package/helpers/layout-style.d.ts +8 -4
  84. package/helpers/layout-style.js +3 -2
  85. package/helpers/mode-paint.d.ts +4 -0
  86. package/helpers/mode-paint.js +47 -0
  87. package/helpers/surface-style.js +33 -11
  88. package/module-dashboard-cards.d.ts +1 -0
  89. package/module-dashboard-cards.js +1 -0
  90. package/module-records.d.ts +7 -0
  91. package/module-records.js +6 -0
  92. package/package.json +1 -1
  93. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +1 -1
  94. package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
  95. package/plugins/runtime-modules/builder/clients/region-inspector.js +47 -2
  96. package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
  97. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +7 -4
  98. package/plugins/runtime-modules/builder/controller/page-controller.js +7 -0
  99. package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
  100. package/plugins/runtime-modules/builder/persistence.js +9 -1
  101. package/plugins/runtime-modules/core/content-entries/record-source.server.d.ts +3 -1
  102. package/plugins/runtime-modules/core/content-entries/record-source.server.js +7 -4
  103. package/plugins/runtime-modules/core/widgets/button/client.js +2 -2
  104. package/plugins/runtime-modules/core/widgets/button/config.d.ts +40 -4
  105. package/plugins/runtime-modules/core/widgets/button/config.js +12 -0
  106. package/plugins/runtime-modules/core/widgets/card/config.d.ts +94 -0
  107. package/plugins/runtime-modules/core/widgets/card/config.js +38 -0
  108. package/plugins/runtime-modules/core/widgets/card/editor.js +8 -1
  109. package/plugins/runtime-modules/core/widgets/card/server.js +4 -0
  110. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +4 -1
  111. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -3
  112. package/plugins/runtime-modules/core/widgets/collection-view/authoring.js +1 -1
  113. package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +3 -0
  114. package/plugins/runtime-modules/core/widgets/collection-view/client.js +47 -11
  115. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +4 -1
  116. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
  117. package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +3 -2
  118. package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +6 -1
  119. package/plugins/runtime-modules/core/widgets/collection-view/server.js +21 -3
  120. package/plugins/runtime-modules/core/widgets/entry-detail/plugin.js +1 -1
  121. package/plugins/runtime-modules/core/widgets/entry-detail/server.d.ts +3 -1
  122. package/plugins/runtime-modules/core/widgets/entry-detail/server.js +5 -2
  123. package/plugins/runtime-modules/core/widgets/entry-header/plugin.js +1 -1
  124. package/plugins/runtime-modules/core/widgets/entry-header/server.d.ts +3 -1
  125. package/plugins/runtime-modules/core/widgets/entry-header/server.js +5 -2
  126. package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -1
  127. package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +6 -3
  128. package/plugins/runtime-modules/core/widgets/entry-list/server.js +13 -6
  129. package/plugins/runtime-modules/core/widgets/gallery/plugin.js +1 -1
  130. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -3
  131. package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -6
  132. package/plugins/runtime-modules/core/widgets/record/client.d.ts +4 -1
  133. package/plugins/runtime-modules/core/widgets/record/client.js +8 -3
  134. package/plugins/runtime-modules/core/widgets/record/plugin.js +3 -2
  135. package/plugins/runtime-modules/core/widgets/record/server.d.ts +3 -1
  136. package/plugins/runtime-modules/core/widgets/record/server.js +2 -2
  137. package/plugins/runtime-modules/core/widgets/segmented/client.js +1 -1
  138. package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +21 -1
  139. package/plugins/runtime-modules/core/widgets/segmented/config.js +11 -1
  140. package/plugins/runtime-modules/core/widgets/switch/client.js +1 -1
  141. package/plugins/runtime-modules/core/widgets/switch/config.d.ts +19 -0
  142. package/plugins/runtime-modules/core/widgets/switch/config.js +11 -0
  143. package/plugins/runtime-modules/core/widgets/table/authoring.js +1 -1
  144. package/plugins/runtime-modules/core/widgets/table/client.d.ts +4 -1
  145. package/plugins/runtime-modules/core/widgets/table/client.js +16 -3
  146. package/plugins/runtime-modules/core/widgets/table/plugin.js +3 -2
  147. package/plugins/runtime-modules/core/widgets/table/server.d.ts +3 -1
  148. package/plugins/runtime-modules/core/widgets/table/server.js +2 -2
  149. package/plugins/runtime-modules/core/widgets/table/static-resource-editor.js +2 -1
  150. package/plugins/runtime-modules/core/widgets/timeline/authoring.js +1 -1
  151. package/plugins/runtime-modules/core/widgets/timeline/client.d.ts +1 -3
  152. package/plugins/runtime-modules/core/widgets/timeline/client.js +14 -4
  153. package/plugins/runtime-modules/core/widgets/tree/authoring.js +1 -1
  154. package/plugins/runtime-modules/core/widgets/tree/client.d.ts +4 -1
  155. package/plugins/runtime-modules/core/widgets/tree/client.js +13 -2
  156. package/plugins/runtime-modules/core/widgets/tree/plugin.js +3 -2
  157. package/plugins/runtime-modules/core/widgets/tree/server.d.ts +3 -1
  158. package/plugins/runtime-modules/core/widgets/tree/server.js +2 -2
  159. package/plugins/runtime-modules/theme/presets.d.ts +9 -1
  160. package/plugins/runtime-modules/theme/tour.d.ts +9 -1
  161. package/plugins/runtime-modules/theme/tour.js +10 -1
  162. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +138 -7
  163. package/runtime-data-provider-client.d.ts +2 -0
  164. package/runtime-data-provider-client.js +7 -0
  165. package/styles/controls.css +10 -5
  166. package/styles/gradients.css +101 -0
  167. package/styles/root.css +18 -0
  168. package/styles/shell.css +64 -0
  169. package/theme/phi-button-shadow.d.ts +6 -0
  170. package/theme/phi-theme-gradients.d.ts +96 -0
  171. package/theme/phi-theme-gradients.js +245 -0
  172. package/theme/phi-theme-presets.d.ts +3 -0
  173. package/theme/phi-theme-presets.js +3 -0
  174. package/theme/phi-theme-tokens.d.ts +5 -1
  175. package/theme/phi-theme-tokens.js +14 -0
  176. package/types/cms-presets.d.ts +7 -0
  177. package/types/core-widget-placements.d.ts +3 -0
  178. package/types/layout-style.d.ts +9 -8
  179. package/types/layout-style.js +9 -8
  180. package/types/surface.d.ts +4 -0
  181. package/types/surface.js +4 -0
  182. package/types.d.ts +1 -1
  183. package/types.js +1 -1
@@ -21,6 +21,8 @@ import { usePhiControlSignalController } from "../../../../../components/widgets
21
21
  import { usePhiSearchDraft } from "../../../../../components/widgets/client/shared/phi-search-draft";
22
22
  import { buildPhiMediaSpaceOptions, usePhiMediaSpaceSelectionAllowed, } from "../../../../../components/media/media-space-selection";
23
23
  import { buildPhiMediaFolderCascaderOptions, buildPhiMediaFolderValueById, combinePhiMediaFlagValues, resolvePhiMediaFolderIdFromValue, } from "../../../../../components/media/media-folder-options";
24
+ import { PhiWidgetFailure } from "../../../../../components/widgets/shared/widget-failure-client";
25
+ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
24
26
  import { PHI_ASSET_CONTROLLER_STORE_KEY } from "../../../../../components/media/asset-controller-signals";
25
27
  import { applyPhiAssetCollectionData } from "../../../../../components/media/asset-collection-runtime";
26
28
  import { readPhiMediaAssetTiles, readPhiMediaFolders } from "../../../../../components/media/phi-image-preview-data";
@@ -59,7 +61,7 @@ function overlayPhiAssetLabels(base, override) {
59
61
  }
60
62
  return result;
61
63
  }
62
- export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabels, widgetId, }) {
64
+ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabels, widgetId, renderMode, }) {
63
65
  const labels = useMemo(() => overlayPhiAssetLabels(PHI_MEDIA_WIDGET_DEFAULT_LABELS, config.presentation.labels ?? rawLabels), [config.presentation.labels, rawLabels]);
64
66
  const { token } = usePhiConfig();
65
67
  const { showMessage } = usePhiApplicationFeedback();
@@ -145,7 +147,7 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
145
147
  typeKey: "collection-action",
146
148
  });
147
149
  if (unsupportedFilter || unsupportedAction) {
148
- return (_jsx(PhiAlertControl, { level: "error", showIcon: true, title: unsupportedFilter
150
+ return (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.CollectionView, widgetId: widgetId, title: unsupportedFilter
149
151
  ? `Asset collection filter "${unsupportedFilter.key}" is not supported.`
150
152
  : `Asset collection action "${unsupportedAction?.key ?? "unknown"}" is not supported.` }));
151
153
  }
@@ -257,7 +259,12 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
257
259
  folderPath: null,
258
260
  presentationFlags: state.presentationFlags,
259
261
  query,
260
- } })) : null, diagnostics: state.error ? _jsx(PhiAlertControl, { level: "error", showIcon: true, title: state.error }) : null, body: body, items: state.assets.map((asset) => (_jsx(PhiMediaAssetTileControl, { asset: asset, minColumnWidth: minColumnWidth, selected: state.selectedAssetId === asset.id, mode: mode, deleting: deletingAssetIds.includes(asset.id), onSelect: selectAsset, onDelete: (nextAsset) => { void deleteAsset(nextAsset); }, deleteLabel: labels.grid.deleteLabel, showTypeLabel: true, showDeleteAction: true, showDimensions: true, showIdLabel: true }, asset.id))), mode: mode, gap: gap, minColumnWidth: minColumnWidth, pagination: features.pagination?.enabled === false ? null : {
262
+ } })) : null,
263
+ /*
264
+ * Only what an action left behind reaches this: a failed read of the source ends the Collection
265
+ * View before this renderer is drawn. A refusal is the acting person's to read, live or not.
266
+ */
267
+ diagnostics: state.error ? _jsx(PhiAlertControl, { level: "error", showIcon: true, title: state.error }) : null, body: body, items: state.assets.map((asset) => (_jsx(PhiMediaAssetTileControl, { asset: asset, minColumnWidth: minColumnWidth, selected: state.selectedAssetId === asset.id, mode: mode, deleting: deletingAssetIds.includes(asset.id), onSelect: selectAsset, onDelete: (nextAsset) => { void deleteAsset(nextAsset); }, deleteLabel: labels.grid.deleteLabel, showTypeLabel: true, showDeleteAction: true, showDimensions: true, showIdLabel: true }, asset.id))), mode: mode, gap: gap, minColumnWidth: minColumnWidth, pagination: features.pagination?.enabled === false ? null : {
261
268
  page: state.page,
262
269
  pageSize: state.pageSize,
263
270
  total: state.pagination?.total ?? 0,
@@ -4,5 +4,5 @@ import { PHI_COLLECTION_VIEW_WIDGET_DEFINITION } from "./config";
4
4
  import { PhiCollectionViewWidget } from "./client";
5
5
  export const PHI_COLLECTION_VIEW_WIDGET_BUILDER_PLUGIN = {
6
6
  ...PHI_COLLECTION_VIEW_WIDGET_DEFINITION,
7
- renderEditor: ({ config }) => (_jsx(PhiCollectionViewWidget, { config: config, preview: true, skeletonActive: false })),
7
+ renderEditor: ({ widget, config }) => (_jsx(PhiCollectionViewWidget, { config: config, widgetId: widget.id, renderMode: "editor", preview: true, skeletonActive: false })),
8
8
  };
@@ -1,9 +1,12 @@
1
1
  import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
2
2
  import type { PhiCmsCollectionViewWidgetConfig } from "../../../../../types/collection-view-widget";
3
+ import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
3
4
  export type PhiCollectionViewWidgetProps = {
4
5
  config?: PhiCmsCollectionViewWidgetConfig | null;
5
6
  widgetId?: PhiCmsInstanceId | null;
6
7
  labels?: unknown;
8
+ /** Where this draws; the parsed config does not carry it, so the plugin reads it off the node. */
9
+ renderMode: PhiRenderableBlockRenderMode;
7
10
  preview?: boolean;
8
11
  skeletonActive?: boolean;
9
12
  };
@@ -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
- function PhiCollectionViewWidgetPreview({ config, skeletonActive = true, }) {
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
- if (!config || bindingError || !resource || !ItemRenderer) {
51
- return (_jsx(PhiAlertControl, { level: "error", showIcon: true, title: bindingError ??
52
- (rendererKey && !ItemRenderer
53
- ? `Item renderer "${rendererKey}" is not available from the active runtime modules.`
54
- : "Collection View configuration is unavailable.") }));
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
- return createElement(ItemRenderer, { config, binding, labels, widgetId });
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
- export async function PhiCollectionViewWidgetServer({ config, widgetId, preview = false, }) {
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
- return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.CollectionView, componentProps: { config, widgetId, preview: true } }));
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(PhiAlertControl, { level: "warning", showIcon: true, title: labels.unavailable });
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(PhiAlertControl, { level: "warning", showIcon: true, title: labels.unavailable });
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 says so. The alternative is a page with a heading and nothing under it, which a visitor
20
- * reads as "this Site has published nothing" and an operator cannot tell from the real thing.
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 says so. The alternative is a page with a heading and nothing under it, which a visitor
21
- * reads as "this Site has published nothing" and an operator cannot tell from the real thing.
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(PhiAlertControl, { level: "warning", showIcon: true, title: labels.unavailable });
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({
@@ -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, and is said as unavailable rather
15
- * than drawn as an empty gallery.
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, and is said as unavailable rather
18
- * than drawn as an empty gallery.
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(PhiAlertControl, { level: "error", showIcon: true, title: labels.unavailable, description: result.reason });
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(PhiAlertControl, { level: "error", showIcon: true, title: labels.unavailable });
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,7 +1,10 @@
1
1
  import { type PhiRecordWidgetLabels } from "../../../../../components/widgets/label-types/record";
2
2
  import type { PhiRecordWidgetConfig } from "../../../../../types/record-widget";
3
+ import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
3
4
  export type PhiRecordWidgetClientProps = {
4
5
  config: PhiRecordWidgetConfig;
5
6
  labels?: PhiRecordWidgetLabels;
7
+ /** Where this draws, which decides who reads a failed read: the author, or only the log. */
8
+ renderMode: PhiRenderableBlockRenderMode;
6
9
  };
7
- export declare function PhiRecordWidgetClient({ config, labels, }: PhiRecordWidgetClientProps): import("react").JSX.Element;
10
+ export declare function PhiRecordWidgetClient({ config, labels, renderMode, }: PhiRecordWidgetClientProps): import("react").JSX.Element;