@phis/ui 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/cms/plugins.d.ts +1 -0
- package/cms/plugins.js +2 -0
- package/components/cms/phi-cms-root-layout.js +30 -1
- package/components/controls/phi-anchor-nav-control.js +4 -1
- package/components/controls/phi-background-control.d.ts +6 -1
- package/components/controls/phi-background-control.js +30 -7
- package/components/controls/phi-bullet-list-control.d.ts +7 -2
- package/components/controls/phi-bullet-list-control.js +4 -3
- package/components/controls/phi-button-control.d.ts +13 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-color-control.js +4 -2
- package/components/controls/phi-drawer-control-adapter.js +3 -2
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-inline-text-editor.js +7 -1
- package/components/controls/phi-length-control.js +1 -1
- package/components/controls/phi-media-asset-tile-control.js +10 -10
- package/components/controls/phi-progress-control.d.ts +10 -2
- package/components/controls/phi-progress-control.js +6 -2
- package/components/controls/phi-ribbon-control.d.ts +16 -4
- package/components/controls/phi-ribbon-control.js +14 -8
- package/components/controls/phi-ribbon-wrap-control.d.ts +32 -0
- package/components/controls/phi-ribbon-wrap-control.js +31 -0
- package/components/controls/phi-segmented-control.d.ts +4 -1
- package/components/controls/phi-segmented-control.js +13 -2
- package/components/controls/phi-select-control.js +5 -2
- package/components/controls/phi-series-chart-control.d.ts +48 -0
- package/components/controls/phi-series-chart-control.js +82 -0
- package/components/controls/phi-surface-control.d.ts +2 -0
- package/components/controls/phi-surface-control.js +16 -1
- package/components/controls/phi-switch-control.d.ts +4 -1
- package/components/controls/phi-switch-control.js +8 -2
- package/components/controls/phi-tag-control.d.ts +4 -1
- package/components/controls/phi-tag-control.js +11 -3
- package/components/controls/phi-text-control.js +57 -3
- package/components/controls/phi-tree-control.js +1 -1
- package/components/controls/phi-truncated-hover-text.d.ts +15 -0
- package/components/controls/phi-truncated-hover-text.js +25 -0
- package/components/forms/link-target-form-control.d.ts +1 -1
- package/components/forms/link-target-form-control.js +2 -45
- package/components/forms/phi-form-widget-frame.js +4 -2
- package/components/layouts/clients/phi-three-column-layout-client.js +10 -1
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/navigation/phi-link.js +6 -1
- package/components/regions/clients/cms-region-container-client.js +16 -1
- package/components/regions/phi-cms-region-container.js +7 -0
- package/components/regions/phi-cms-region-shell.d.ts +22 -1
- package/components/regions/phi-cms-region-shell.js +131 -23
- package/components/root/phi-config-provider.d.ts +13 -0
- package/components/root/phi-config-provider.js +12 -1
- package/components/root/phi-root-background.d.ts +7 -0
- package/components/root/phi-root-background.js +20 -1
- package/components/root/phi-root-layout.d.ts +1 -0
- package/components/root/phi-root-layout.js +1 -0
- package/components/root/phi-root-theme-resolver.js +15 -1
- package/components/root/phi-shell-chrome-overlay.d.ts +18 -1
- package/components/root/phi-shell-chrome-overlay.js +26 -4
- package/components/runtime/runtime-module-context.d.ts +12 -1
- package/components/runtime/runtime-module-context.js +6 -1
- package/components/shell/phi-antd-icon.d.ts +1 -0
- package/components/shell/phi-antd-icon.js +3 -0
- package/components/shell/phi-cms-shell.d.ts +7 -1
- package/components/shell/phi-cms-shell.js +4 -2
- package/components/shell/use-phi-shell-header-bands.d.ts +5 -0
- package/components/shell/use-phi-shell-header-bands.js +64 -0
- package/components/shell/use-phi-shell-sticky-bottom.d.ts +18 -0
- package/components/shell/use-phi-shell-sticky-bottom.js +54 -0
- package/components/shell/use-phi-shell-sticky-top.js +61 -16
- package/components/surface/phi-surface-tone.d.ts +13 -0
- package/components/surface/phi-surface-tone.js +21 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -0
- package/components/tables/client/phi-table-binding.js +22 -3
- package/components/trees/client/phi-tree-binding.d.ts +1 -0
- package/components/trees/client/phi-tree-binding.js +11 -2
- package/components/widgets/client/bullet-list-entries-editor.js +7 -1
- package/components/widgets/client/html-editor.js +1 -1
- package/components/widgets/client/shared/phi-collection-provider.js +4 -3
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +16 -2
- package/components/widgets/client/shared/phi-command-buttons.js +6 -2
- package/components/widgets/client/shared/use-page-reference-options.d.ts +17 -0
- package/components/widgets/client/shared/use-page-reference-options.js +57 -0
- package/components/widgets/config/background.d.ts +52 -1
- package/components/widgets/config/background.js +85 -4
- package/components/widgets/config/button-variant.d.ts +22 -4
- package/components/widgets/config/button-variant.js +24 -5
- package/components/widgets/config/common-action-field.d.ts +1 -1
- package/components/widgets/config/parser-primitives.js +4 -2
- package/components/widgets/config/theme-gradient.d.ts +11 -0
- package/components/widgets/config/theme-gradient.js +12 -0
- package/components/widgets/label-sets/background.js +4 -0
- package/components/widgets/label-sets/geometry.js +2 -0
- package/components/widgets/label-sets/inspector.js +4 -0
- package/components/widgets/label-types/background.d.ts +2 -0
- package/components/widgets/label-types/background.js +2 -0
- package/components/widgets/label-types/common-controls.js +2 -2
- package/components/widgets/label-types/geometry.d.ts +1 -0
- package/components/widgets/label-types/geometry.js +1 -0
- package/components/widgets/label-types/inspector.d.ts +4 -0
- package/components/widgets/label-types/inspector.js +2 -0
- package/components/widgets/shared/bullet-list-vocabulary.d.ts +10 -0
- package/components/widgets/shared/bullet-list-vocabulary.js +5 -2
- package/components/widgets/shared/card-body-client.d.ts +16 -3
- package/components/widgets/shared/card-body-client.js +79 -8
- package/components/widgets/shared/card-vocabulary.d.ts +12 -2
- package/components/widgets/shared/card-vocabulary.js +7 -0
- package/components/widgets/shared/collection-source-failure.d.ts +26 -0
- package/components/widgets/shared/collection-source-failure.js +42 -0
- package/components/widgets/shared/markdown-body-client.js +39 -10
- package/components/widgets/shared/markdown-render.js +16 -3
- package/components/widgets/shared/widget-failure-client.d.ts +10 -0
- package/components/widgets/shared/widget-failure-client.js +20 -0
- package/components/widgets/shared/widget-failure.d.ts +31 -0
- package/components/widgets/shared/widget-failure.js +20 -0
- package/components/widgets/shared/widget-failure.server.d.ts +9 -0
- package/components/widgets/shared/widget-failure.server.js +12 -0
- package/gateway/dashboard-card-memo.d.ts +3 -0
- package/gateway/dashboard-card-memo.js +25 -0
- package/helpers/cms-container-chrome.js +6 -1
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/layout-style.d.ts +8 -4
- package/helpers/layout-style.js +3 -2
- package/helpers/locale.d.ts +8 -0
- package/helpers/locale.js +18 -0
- package/helpers/mode-paint.d.ts +4 -0
- package/helpers/mode-paint.js +47 -0
- package/helpers/shell-region-style.js +2 -1
- package/helpers/surface-style.d.ts +12 -1
- package/helpers/surface-style.js +60 -12
- package/module-dashboard-cards.d.ts +2 -1
- package/module-dashboard-cards.js +2 -1
- package/module-records.d.ts +7 -0
- package/module-records.js +6 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/area-definitions.d.ts +0 -42
- package/plugins/runtime-modules/area-definitions.js +3 -8
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +21 -2
- package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
- package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +10 -5
- package/plugins/runtime-modules/builder/clients/region-inspector.js +47 -2
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +7 -4
- package/plugins/runtime-modules/builder/controller/page-controller.js +7 -0
- package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +3 -2
- package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
- package/plugins/runtime-modules/builder/persistence.js +9 -1
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +25 -15
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +4 -0
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +15 -4
- package/plugins/runtime-modules/client-authoring-module.d.ts +8 -1
- package/plugins/runtime-modules/client-authoring-module.js +13 -3
- package/plugins/runtime-modules/core/content-entries/record-source.server.d.ts +3 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.js +7 -4
- package/plugins/runtime-modules/core/widgets/brand/client.d.ts +12 -3
- package/plugins/runtime-modules/core/widgets/brand/client.js +3 -11
- package/plugins/runtime-modules/core/widgets/brand/home.d.ts +15 -0
- package/plugins/runtime-modules/core/widgets/brand/home.js +18 -0
- package/plugins/runtime-modules/core/widgets/brand/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/brand/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/brand/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/button/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +40 -4
- package/plugins/runtime-modules/core/widgets/button/config.js +12 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +100 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +57 -3
- package/plugins/runtime-modules/core/widgets/card/editor.js +21 -4
- package/plugins/runtime-modules/core/widgets/card/server.js +5 -0
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -3
- package/plugins/runtime-modules/core/widgets/collection-view/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +47 -11
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
- package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +21 -3
- package/plugins/runtime-modules/core/widgets/description/client.js +3 -3
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/description/editor.js +3 -2
- package/plugins/runtime-modules/core/widgets/description/server.js +3 -2
- package/plugins/runtime-modules/core/widgets/entry-detail/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-header/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.js +13 -6
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/gallery/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -3
- package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -6
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/html/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +320 -2
- package/plugins/runtime-modules/core/widgets/markdown/config.js +18 -4
- package/plugins/runtime-modules/core/widgets/markdown/editor.js +9 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/client.js +6 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/config.d.ts +14 -0
- package/plugins/runtime-modules/core/widgets/markdown-toc/config.js +14 -2
- package/plugins/runtime-modules/core/widgets/quick-links/authoring.js +7 -2
- package/plugins/runtime-modules/core/widgets/quick-links/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/quick-links/items.d.ts +0 -2
- package/plugins/runtime-modules/core/widgets/quick-links/items.js +0 -15
- package/plugins/runtime-modules/core/widgets/record/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/record/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/record/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/record/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/segmented/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +21 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.js +11 -1
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
- package/plugins/runtime-modules/core/widgets/switch/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/switch/config.d.ts +19 -0
- package/plugins/runtime-modules/core/widgets/switch/config.js +11 -0
- package/plugins/runtime-modules/core/widgets/table/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +16 -3
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/table/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/table/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/table/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/table/static-resource-editor.js +2 -1
- package/plugins/runtime-modules/core/widgets/timeline/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/timeline/client.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/timeline/client.js +14 -4
- package/plugins/runtime-modules/core/widgets/tree/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/tree/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/tree/client.js +13 -2
- package/plugins/runtime-modules/core/widgets/tree/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/tree/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/tree/server.js +2 -2
- package/plugins/runtime-modules/dashboard/card-rows.d.ts +3 -1
- package/plugins/runtime-modules/dashboard/card-rows.js +30 -2
- package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +29 -7
- package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +5 -40
- package/plugins/runtime-modules/theme/presets.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.js +10 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +157 -22
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +5 -9
- package/runtime-data-provider-client.d.ts +2 -0
- package/runtime-data-provider-client.js +7 -0
- package/server-helpers/cms-link-targets.js +6 -0
- package/styles/controls.css +74 -7
- package/styles/gradients.css +101 -0
- package/styles/layout.css +45 -2
- package/styles/root.css +18 -0
- package/styles/shell.css +137 -0
- package/theme/phi-antd-token-resolver.js +20 -1
- package/theme/phi-button-shadow.d.ts +6 -0
- package/theme/phi-theme-gradients.d.ts +96 -0
- package/theme/phi-theme-gradients.js +245 -0
- package/theme/phi-theme-presets.d.ts +3 -0
- package/theme/phi-theme-presets.js +3 -0
- package/theme/phi-theme-tokens.d.ts +6 -2
- package/theme/phi-theme-tokens.js +15 -0
- package/theme/phi-theme.d.ts +5 -0
- package/theme/phi-theme.js +21 -0
- package/theme/phi-tokens.d.ts +16 -15
- package/theme/phi-tokens.js +16 -15
- package/types/cms-plugins.d.ts +2 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +3 -0
- package/types/dashboard-cards.d.ts +39 -4
- package/types/dashboard-cards.js +6 -0
- package/types/layout-style.d.ts +9 -8
- package/types/layout-style.js +9 -8
- package/types/site-theme.d.ts +10 -2
- package/types/surface.d.ts +4 -0
- package/types/surface.js +4 -0
- package/types.d.ts +1 -1
- package/types.js +1 -1
|
@@ -36,7 +36,11 @@ const PHI_CARD_BODY_TEXT_SLOTS = {
|
|
|
36
36
|
* Slots a card often goes without. Empty, they stand on the canvas only while the card is under the
|
|
37
37
|
* pointer or being written in (`styles/layout.css`), so an empty card does not read as four empty lines.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
/*
|
|
40
|
+
* Not the badge: it is drawn only once a style is chosen for it, and a band or ribbon that disappeared
|
|
41
|
+
* whenever the pointer left the card left nothing to see of the choice just made.
|
|
42
|
+
*/
|
|
43
|
+
const PHI_CARD_OPTIONAL_TEXT_SLOTS = new Set(["eyebrow", "meta"]);
|
|
40
44
|
/**
|
|
41
45
|
* One of the card's words, edited where it stands: underlined, in the type of the text it edits.
|
|
42
46
|
*
|
|
@@ -55,7 +59,12 @@ function PhiCardInlineText({ slot, text, onCommit, }) {
|
|
|
55
59
|
* into beside them, and its wrapping is the card's own anyway. The text still wraps and aligns as
|
|
56
60
|
* the card sets it.
|
|
57
61
|
*/
|
|
58
|
-
|
|
62
|
+
/*
|
|
63
|
+
* The ground stays the card's, here as well as on the text: with a clear button the field is a
|
|
64
|
+
* wrapper around the text, and Ant Design's underlined wrapper paints the container ground -- white
|
|
65
|
+
* over the badge's band, whose light words then vanished on it.
|
|
66
|
+
*/
|
|
67
|
+
style: { width: "100%", backgroundColor: "transparent" },
|
|
59
68
|
/* The text's own type, and the page showing through: an edit in place reads like what it edits. */
|
|
60
69
|
inputStyle: {
|
|
61
70
|
paddingInline: 0,
|
|
@@ -116,7 +125,7 @@ export function PhiCardWidgetEditor({ config, onChange }) {
|
|
|
116
125
|
&& presentation.width != null
|
|
117
126
|
&& canvasWidth != null
|
|
118
127
|
&& presentation.width < canvasWidth;
|
|
119
|
-
return (_jsxs("div", { ref: canvasRef, className: "phi-card-editor", style: { position: "relative", width: "100%" }, children: [_jsx(PhiCardWidgetClient, { labels: {
|
|
128
|
+
return (_jsxs("div", { ref: canvasRef, className: "phi-card-editor", style: { position: "relative", display: "flex", width: "100%" }, children: [_jsx(PhiCardWidgetClient, { labels: {
|
|
120
129
|
eyebrow: config.eyebrow,
|
|
121
130
|
title: config.title,
|
|
122
131
|
description: config.description,
|
|
@@ -143,6 +152,7 @@ export function PhiCardWidgetEditor({ config, onChange }) {
|
|
|
143
152
|
? {
|
|
144
153
|
presentation,
|
|
145
154
|
...(config.imageOpacity == null ? {} : { opacity: config.imageOpacity / 100 }),
|
|
155
|
+
...(config.imageOverlay ? { overlay: config.imageOverlay } : {}),
|
|
146
156
|
source: config.sourceKind === "asset" ? "asset" : "url",
|
|
147
157
|
alt: config.alt ?? asset?.altText ?? "",
|
|
148
158
|
blurDataUrl: asset?.blurDataUrl ?? null,
|
|
@@ -159,12 +169,19 @@ export function PhiCardWidgetEditor({ config, onChange }) {
|
|
|
159
169
|
* Builder. The button is drawn whenever it is on, wherever it would lead.
|
|
160
170
|
*/
|
|
161
171
|
action: config.actionEnabled === true
|
|
162
|
-
? {
|
|
172
|
+
? {
|
|
173
|
+
...(config.actionIcon ? { icon: config.actionIcon } : {}),
|
|
174
|
+
ariaLabel: PHI_CARD_WIDGET_DEFAULT_LABELS.actionLabel,
|
|
175
|
+
...(config.actionVariant ? { variant: config.actionVariant } : {}),
|
|
176
|
+
...(config.actionGradient ? { gradient: config.actionGradient } : {}),
|
|
177
|
+
}
|
|
163
178
|
: null,
|
|
164
179
|
variant: config.variant,
|
|
165
180
|
body: config.body,
|
|
166
181
|
highlight: config.highlight,
|
|
167
182
|
badgeColor: config.badgeColor,
|
|
183
|
+
badgeStyle: config.badgeStyle,
|
|
184
|
+
badgeGradient: config.badgeGradient,
|
|
168
185
|
billingPeriod: config.billingPeriod,
|
|
169
186
|
hoverEffect: config.linkTarget ? config.hoverEffect : undefined,
|
|
170
187
|
}, ...(config.body === "plan" ? {
|
|
@@ -78,6 +78,7 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
78
78
|
? {
|
|
79
79
|
presentation,
|
|
80
80
|
...(config?.imageOpacity == null ? {} : { opacity: config.imageOpacity / 100 }),
|
|
81
|
+
...(config?.imageOverlay ? { overlay: config.imageOverlay } : {}),
|
|
81
82
|
source: config?.sourceKind === "asset" ? "asset" : "url",
|
|
82
83
|
alt: (config?.alt ?? resolvedAsset?.altText ?? "").trim(),
|
|
83
84
|
blurDataUrl: resolvedAsset?.blurDataUrl ?? null,
|
|
@@ -107,12 +108,16 @@ export async function PhiCardWidget({ labels, config, runtime, links, translate,
|
|
|
107
108
|
...(actionLink ? { href: actionLink.href, newTab: actionLink.newTab, external: actionLink.external } : {}),
|
|
108
109
|
...(config?.actionIcon ? { icon: config.actionIcon } : {}),
|
|
109
110
|
...(defaultLabels ? { ariaLabel: defaultLabels.actionLabel } : {}),
|
|
111
|
+
...(config?.actionVariant ? { variant: config.actionVariant } : {}),
|
|
112
|
+
...(config?.actionGradient ? { gradient: config.actionGradient } : {}),
|
|
110
113
|
}
|
|
111
114
|
: null,
|
|
112
115
|
variant: config?.variant,
|
|
113
116
|
body: config?.body,
|
|
114
117
|
highlight: config?.highlight,
|
|
115
118
|
badgeColor: config?.badgeColor,
|
|
119
|
+
badgeStyle: config?.badgeStyle,
|
|
120
|
+
badgeGradient: config?.badgeGradient,
|
|
116
121
|
billingPeriod: config?.billingPeriod,
|
|
117
122
|
// Only a card that leads somewhere answers the pointer; the preview has no link but shows it.
|
|
118
123
|
hoverEffect: config?.linkTarget ? config.hoverEffect : undefined,
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
2
2
|
import type { PhiCollectionViewBindingModel } from "../../../../../types/collection-provider";
|
|
3
3
|
import type { PhiCmsCollectionViewWidgetConfig } from "../../../../../types/collection-view-widget";
|
|
4
|
-
|
|
4
|
+
import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
|
|
5
|
+
export declare function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabels, widgetId, renderMode, }: {
|
|
5
6
|
config: PhiCmsCollectionViewWidgetConfig;
|
|
6
7
|
binding: PhiCollectionViewBindingModel;
|
|
7
8
|
labels?: unknown;
|
|
8
9
|
widgetId?: PhiCmsInstanceId | null;
|
|
10
|
+
/** Handed on by the Collection View, so a configuration this renderer cannot serve is said its way. */
|
|
11
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
9
12
|
}): import("react").JSX.Element;
|
|
@@ -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(
|
|
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,
|
|
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
|
-
|
|
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
|
}
|
|
@@ -8,7 +8,6 @@ import { PhiBulletListControl } from "../../../../../components/controls/phi-bul
|
|
|
8
8
|
import { buildPhiBulletListTree, resolvePhiBulletListStyle, } from "../../../../../components/widgets/shared/bullet-list-vocabulary";
|
|
9
9
|
import { resolvePhiTextPlaceholders } from "../../../../../helpers/text-placeholders";
|
|
10
10
|
const PHI_LINE_HEIGHT_BASE = 1.5;
|
|
11
|
-
const PHI_LINE_HEIGHT_LG = 1.6;
|
|
12
11
|
const PHI_FONT_WEIGHT_STRONG = 600;
|
|
13
12
|
export function PhiDescriptionWidgetClient({ labels, config, }) {
|
|
14
13
|
const { token } = usePhiConfig();
|
|
@@ -18,6 +17,7 @@ export function PhiDescriptionWidgetClient({ labels, config, }) {
|
|
|
18
17
|
borderRadius: 999,
|
|
19
18
|
paddingInline: token.paddingSM,
|
|
20
19
|
paddingBlock: token.paddingXXS,
|
|
20
|
+
fontSize: token.fontSizeSM,
|
|
21
21
|
fontWeight: PHI_FONT_WEIGHT_STRONG,
|
|
22
22
|
letterSpacing: "0.04em",
|
|
23
23
|
color: token.colorTextTertiary,
|
|
@@ -26,8 +26,8 @@ export function PhiDescriptionWidgetClient({ labels, config, }) {
|
|
|
26
26
|
}, children: labels.eyebrow })) : null, labels.title || labels.description ? (_jsxs("div", { children: [labels.title ? (_jsx(PhiTypographyControl, { presentation: "title", level: 2, style: { marginBottom: labels.description ? token.paddingXS : 0 }, children: labels.title })) : null, labels.description ? (_jsx(PhiTypographyControl, { presentation: "paragraph", type: config?.tone, style: {
|
|
27
27
|
marginBottom: 0,
|
|
28
28
|
color: config?.tone ? undefined : token.colorTextSecondary,
|
|
29
|
-
fontSize: token.
|
|
30
|
-
lineHeight:
|
|
29
|
+
fontSize: token.fontSize,
|
|
30
|
+
lineHeight: PHI_LINE_HEIGHT_BASE,
|
|
31
31
|
}, children: labels.description })) : null] })) : null, labels.asideTitle || asideItems.length > 0 ? (_jsxs(PhiFlexControl, { vertical: true, gap: token.paddingMD, style: { width: "100%" }, children: [labels.asideTitle ? (_jsx(PhiTypographyControl, { strong: true, style: {
|
|
32
32
|
fontSize: token.fontSize,
|
|
33
33
|
lineHeight: PHI_LINE_HEIGHT_BASE,
|
|
@@ -60,6 +60,7 @@ export function PhiDescriptionWidgetEditor({ config, onChange, }) {
|
|
|
60
60
|
borderRadius: 999,
|
|
61
61
|
paddingInline: "var(--ant-padding-sm)",
|
|
62
62
|
paddingBlock: "var(--ant-padding-xxs)",
|
|
63
|
+
fontSize: "var(--ant-font-size-sm)",
|
|
63
64
|
fontWeight: 600,
|
|
64
65
|
letterSpacing: "0.04em",
|
|
65
66
|
color: "var(--ant-color-text-tertiary)",
|
|
@@ -74,8 +75,8 @@ export function PhiDescriptionWidgetEditor({ config, onChange, }) {
|
|
|
74
75
|
} }), _jsx(PhiTextControl, { presentation: "textarea", value: draft.description, readOnly: !onChange, variant: "borderless", placeholder: "Description", autoSize: { minRows: 2, maxRows: 8 }, onChange: (value) => updateField("description", value ?? ""), onBlur: () => commitField("description"), style: {
|
|
75
76
|
...EDITOR_TEXTAREA_STYLE,
|
|
76
77
|
color: "var(--ant-color-text-secondary)",
|
|
77
|
-
fontSize: "
|
|
78
|
-
lineHeight: 1.
|
|
78
|
+
fontSize: "var(--ant-font-size)",
|
|
79
|
+
lineHeight: 1.5,
|
|
79
80
|
} })] })) : null, sections.aside ? (_jsxs(PhiFlexControl, { vertical: true, gap: 12, style: { width: "100%" }, children: [_jsx(PhiTextControl, { presentation: "textarea", value: draft.asideTitle, readOnly: !onChange, variant: "borderless", placeholder: "Aside title", autoSize: { minRows: 1, maxRows: 3 }, onChange: (value) => updateField("asideTitle", value ?? ""), onBlur: () => commitField("asideTitle"), style: {
|
|
80
81
|
...EDITOR_TEXTAREA_STYLE,
|
|
81
82
|
color: "var(--ant-color-text-heading)",
|
|
@@ -64,6 +64,7 @@ export async function PhiDescriptionWidget({ labels, config, runtime, translate,
|
|
|
64
64
|
borderRadius: "9999px",
|
|
65
65
|
paddingInline: PHI_SPACE.sm,
|
|
66
66
|
paddingBlock: PHI_SPACE.xxs,
|
|
67
|
+
fontSize: PHI_FONT_SIZE.sm,
|
|
67
68
|
fontWeight: 600,
|
|
68
69
|
letterSpacing: "0.04em",
|
|
69
70
|
color: PHI_COLOR.textTertiary,
|
|
@@ -82,8 +83,8 @@ export async function PhiDescriptionWidget({ labels, config, runtime, translate,
|
|
|
82
83
|
margin: 0,
|
|
83
84
|
marginBottom: 0,
|
|
84
85
|
color: resolveDescriptionToneColor(config?.tone),
|
|
85
|
-
fontSize: PHI_FONT_SIZE.
|
|
86
|
-
lineHeight: PHI_LINE_HEIGHT.
|
|
86
|
+
fontSize: PHI_FONT_SIZE.base,
|
|
87
|
+
lineHeight: PHI_LINE_HEIGHT.base,
|
|
87
88
|
}, children: description })) : null] })) : null, asideTitle || resolvedAsideItems.length > 0 ? (_jsxs("div", { style: subStackStyle, children: [asideTitle ? (_jsx("span", { style: {
|
|
88
89
|
display: "block",
|
|
89
90
|
fontSize: PHI_FONT_SIZE.base,
|
|
@@ -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
|
};
|