@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PhiNoLabels, PhiServerBlockBaseProps } from "../../../../../types";
|
|
2
2
|
import type { PhiCmsRuntimeRenderRegistry } from "../../../../../types/cms-plugins";
|
|
3
3
|
import type { PhiResolvedLinkTargets } from "../../../../../types/references";
|
|
4
|
+
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
4
5
|
import { type PhiEntryListWidgetConfig } from "./config";
|
|
5
6
|
export type PhiEntryListWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, PhiEntryListWidgetConfig> & {
|
|
6
7
|
/** Where the record binding is answered; absent outside a page render, where nothing is bound. */
|
|
@@ -8,6 +9,7 @@ export type PhiEntryListWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, PhiEn
|
|
|
8
9
|
links?: PhiResolvedLinkTargets | null;
|
|
9
10
|
/** Whether the heading is translated: the node's `NoTranslate` flag, read by the plugin. */
|
|
10
11
|
translate?: boolean;
|
|
12
|
+
widgetId?: PhiCmsInstanceId | null;
|
|
11
13
|
};
|
|
12
14
|
/**
|
|
13
15
|
* One kind's published entries, read while the page is drawn (`CONTENT_ENTRIES.md`).
|
|
@@ -16,12 +18,13 @@ export type PhiEntryListWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, PhiEn
|
|
|
16
18
|
* the render rather than in a request the browser makes afterwards. On a Public page that is also the only
|
|
17
19
|
* way an expired entry can be absent instead of appearing and then disappearing.
|
|
18
20
|
*
|
|
19
|
-
* A failed read
|
|
20
|
-
*
|
|
21
|
+
* A failed read is not drawn as a heading with nothing under it, which a visitor reads as "this Site has
|
|
22
|
+
* published nothing". It goes through `PhiWidgetFailureServer`: the author reads why in the Builder, an
|
|
23
|
+
* operator finds it in the log, and the live page goes on without the list.
|
|
21
24
|
*
|
|
22
25
|
* A `related` list is the exception twice over. It reads through its record binding, the one the header
|
|
23
26
|
* and text are bound to, so it costs Core nothing the Page did not already ask, and it is cut to as many
|
|
24
27
|
* as that record carries. And with nothing related -- or nothing to be related to -- it draws
|
|
25
28
|
* nothing at all: a "more like this" heading over an empty space says something false.
|
|
26
29
|
*/
|
|
27
|
-
export declare function PhiEntryListWidget({ config, runtime, registry, links, translate }: PhiEntryListWidgetProps): Promise<import("react").JSX.Element | null>;
|
|
30
|
+
export declare function PhiEntryListWidget({ config, runtime, registry, links, translate, widgetId, }: PhiEntryListWidgetProps): Promise<import("react").JSX.Element | null>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
3
2
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
3
|
import { getPhiContentEntryReaderLabels } from "../../../../../components/widgets/label-sets/content-entries";
|
|
4
|
+
import { PhiWidgetFailureServer } from "../../../../../components/widgets/shared/widget-failure.server";
|
|
5
5
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
6
6
|
import { fetchPhiSiteContentEntries } from "../../../../../gateway/content-entries";
|
|
7
7
|
import { phiRuntime } from "../../../../../server-helpers/phi-runtime";
|
|
8
8
|
import { trBulkForLocale } from "../../../../../server-helpers/translate";
|
|
9
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
9
10
|
import { readPhiBoundContentEntry } from "../../content-entries/record-source.server";
|
|
10
11
|
import { buildPhiEntryViews } from "./view.server";
|
|
11
12
|
import { normalizePhiEntryListWidgetConfig } from "./config";
|
|
@@ -17,16 +18,18 @@ import { pickPhiSequenceSettings } from "../../../../../components/widgets/confi
|
|
|
17
18
|
* the render rather than in a request the browser makes afterwards. On a Public page that is also the only
|
|
18
19
|
* way an expired entry can be absent instead of appearing and then disappearing.
|
|
19
20
|
*
|
|
20
|
-
* A failed read
|
|
21
|
-
*
|
|
21
|
+
* A failed read is not drawn as a heading with nothing under it, which a visitor reads as "this Site has
|
|
22
|
+
* published nothing". It goes through `PhiWidgetFailureServer`: the author reads why in the Builder, an
|
|
23
|
+
* operator finds it in the log, and the live page goes on without the list.
|
|
22
24
|
*
|
|
23
25
|
* A `related` list is the exception twice over. It reads through its record binding, the one the header
|
|
24
26
|
* and text are bound to, so it costs Core nothing the Page did not already ask, and it is cut to as many
|
|
25
27
|
* as that record carries. And with nothing related -- or nothing to be related to -- it draws
|
|
26
28
|
* nothing at all: a "more like this" heading over an empty space says something false.
|
|
27
29
|
*/
|
|
28
|
-
export async function PhiEntryListWidget({ config, runtime, registry, links, translate = true }) {
|
|
30
|
+
export async function PhiEntryListWidget({ config, runtime, registry, links, translate = true, widgetId, }) {
|
|
29
31
|
const settings = normalizePhiEntryListWidgetConfig(config);
|
|
32
|
+
const renderMode = readPhiRuntimeTreeRenderMode(config ?? {});
|
|
30
33
|
const rt = phiRuntime(runtime);
|
|
31
34
|
const locale = runtime.locale.current;
|
|
32
35
|
const labels = await getPhiContentEntryReaderLabels({
|
|
@@ -41,6 +44,10 @@ export async function PhiEntryListWidget({ config, runtime, registry, links, tra
|
|
|
41
44
|
const bound = settings.relatedTo
|
|
42
45
|
? await readPhiBoundContentEntry({ registry, runtime, binding: settings.relatedTo })
|
|
43
46
|
: null;
|
|
47
|
+
// A source that cannot answer is a failure; one that answers nothing is only nothing related.
|
|
48
|
+
if (bound?.status === "unavailable") {
|
|
49
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: renderMode, widgetType: PhiCmsWidgetType.EntryList, widgetId: widgetId, title: labels.unavailable, description: bound.reason }));
|
|
50
|
+
}
|
|
44
51
|
if (bound?.status !== "ok") {
|
|
45
52
|
return null;
|
|
46
53
|
}
|
|
@@ -59,8 +66,8 @@ export async function PhiEntryListWidget({ config, runtime, registry, links, tra
|
|
|
59
66
|
categories: settings.categories,
|
|
60
67
|
});
|
|
61
68
|
}
|
|
62
|
-
catch {
|
|
63
|
-
return _jsx(
|
|
69
|
+
catch (error) {
|
|
70
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: renderMode, widgetType: PhiCmsWidgetType.EntryList, widgetId: widgetId, title: labels.unavailable, description: error instanceof Error ? error.message : String(error), error: error }));
|
|
64
71
|
}
|
|
65
72
|
}
|
|
66
73
|
const views = await buildPhiEntryViews({
|
|
@@ -4,5 +4,5 @@ import { PHI_GALLERY_WIDGET_DEFINITION, } from "./config";
|
|
|
4
4
|
import { PhiGalleryWidgetServer } from "./server";
|
|
5
5
|
export const PHI_GALLERY_WIDGET_PLUGIN = {
|
|
6
6
|
...PHI_GALLERY_WIDGET_DEFINITION,
|
|
7
|
-
...definePhiPassiveWidgetRenderers(({ widget, runtime, registry, config }) => (_jsx(PhiGalleryWidgetServer, { runtime: runtime, registry: registry, config: config }, `widget-${widget.id}`))),
|
|
7
|
+
...definePhiPassiveWidgetRenderers(({ widget, runtime, registry, config }) => (_jsx(PhiGalleryWidgetServer, { runtime: runtime, registry: registry, config: config, widgetId: widget.id }, `widget-${widget.id}`))),
|
|
8
8
|
};
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import type { PhiBlockRuntime } from "../../../../../types";
|
|
3
3
|
import type { PhiCmsRuntimeRenderRegistry } from "../../../../../types/cms-plugins";
|
|
4
|
+
import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
|
|
4
5
|
import type { PhiCmsGalleryWidgetConfig } from "./config";
|
|
5
6
|
export type PhiGalleryWidgetServerProps = {
|
|
6
7
|
runtime: PhiBlockRuntime;
|
|
7
8
|
/** Where the record binding is answered; absent outside a page render, where nothing is bound. */
|
|
8
9
|
registry?: Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey">;
|
|
9
10
|
config: PhiCmsGalleryWidgetConfig;
|
|
11
|
+
widgetId?: PhiCmsInstanceId | null;
|
|
10
12
|
};
|
|
11
13
|
/**
|
|
12
14
|
* The pictures come from the record the binding names -- a Folder, read while the page is drawn -- so
|
|
13
15
|
* they are in the HTML and the window knows what to load before anything is on screen. A record of
|
|
14
|
-
* another shape is somebody else's Provider bound here by mistake
|
|
15
|
-
*
|
|
16
|
+
* another shape is somebody else's Provider bound here by mistake. Either failure is the author's to
|
|
17
|
+
* read and is nothing on a live page, rather than an empty gallery anywhere.
|
|
16
18
|
*/
|
|
17
|
-
export declare function PhiGalleryWidgetServer({ runtime, registry, config }: PhiGalleryWidgetServerProps): Promise<import("react").JSX.Element | null>;
|
|
19
|
+
export declare function PhiGalleryWidgetServer({ runtime, registry, config, widgetId }: PhiGalleryWidgetServerProps): Promise<import("react").JSX.Element | null>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import "server-only";
|
|
3
|
-
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
4
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
5
4
|
import { getPhiGalleryWidgetLabels } from "../../../../../components/widgets/label-sets/gallery";
|
|
5
|
+
import { PhiWidgetFailureServer } from "../../../../../components/widgets/shared/widget-failure.server";
|
|
6
6
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
7
7
|
import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
|
|
8
8
|
import { resolvePhiRecordSource } from "../../../../../server-helpers/record-source";
|
|
9
|
+
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
9
10
|
function isPublicAssetReference(value) {
|
|
10
11
|
return typeof value === "object" && value !== null &&
|
|
11
12
|
typeof value.id === "number" &&
|
|
@@ -14,26 +15,27 @@ function isPublicAssetReference(value) {
|
|
|
14
15
|
/**
|
|
15
16
|
* The pictures come from the record the binding names -- a Folder, read while the page is drawn -- so
|
|
16
17
|
* they are in the HTML and the window knows what to load before anything is on screen. A record of
|
|
17
|
-
* another shape is somebody else's Provider bound here by mistake
|
|
18
|
-
*
|
|
18
|
+
* another shape is somebody else's Provider bound here by mistake. Either failure is the author's to
|
|
19
|
+
* read and is nothing on a live page, rather than an empty gallery anywhere.
|
|
19
20
|
*/
|
|
20
|
-
export async function PhiGalleryWidgetServer({ runtime, registry, config }) {
|
|
21
|
+
export async function PhiGalleryWidgetServer({ runtime, registry, config, widgetId }) {
|
|
21
22
|
const labels = await getPhiGalleryWidgetLabels({
|
|
22
23
|
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
23
24
|
internalToken: readPhiServerApiCredentials().internalToken,
|
|
24
25
|
locale: runtime.locale.current,
|
|
25
26
|
});
|
|
27
|
+
const renderMode = readPhiRuntimeTreeRenderMode(config);
|
|
26
28
|
const result = registry && config.source
|
|
27
29
|
? await resolvePhiRecordSource({ registry, runtime, binding: config.source })
|
|
28
30
|
: { status: "missing" };
|
|
29
31
|
if (result.status === "unavailable") {
|
|
30
|
-
return _jsx(
|
|
32
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Gallery, widgetId: widgetId, title: labels.unavailable, description: result.reason }));
|
|
31
33
|
}
|
|
32
34
|
const images = result.status === "ok" && Array.isArray(result.record)
|
|
33
35
|
? result.record.filter(isPublicAssetReference)
|
|
34
36
|
: null;
|
|
35
37
|
if (result.status === "ok" && images == null) {
|
|
36
|
-
return _jsx(
|
|
38
|
+
return (_jsx(PhiWidgetFailureServer, { renderMode: renderMode, widgetType: PhiCmsWidgetType.Gallery, widgetId: widgetId, title: labels.unavailable, description: `The record bound from "${config.source?.providerKey ?? ""}" is not a list of images.` }));
|
|
37
39
|
}
|
|
38
40
|
if (!images || images.length === 0) {
|
|
39
41
|
return null;
|
|
@@ -28,7 +28,7 @@ export function PhiHeaderNavigationWidgetClient({ runtime, items, menuTheme, hei
|
|
|
28
28
|
minHeight: 0,
|
|
29
29
|
overflow: "hidden",
|
|
30
30
|
whiteSpace: "nowrap",
|
|
31
|
-
fontSize: token.
|
|
31
|
+
fontSize: token.fontSize,
|
|
32
32
|
}, children: items.map((item) => (_jsx("span", { style: {
|
|
33
33
|
display: "inline-flex",
|
|
34
34
|
alignItems: "center",
|
|
@@ -46,7 +46,7 @@ export function PhiHeaderNavigationWidgetClient({ runtime, items, menuTheme, hei
|
|
|
46
46
|
minHeight: 0,
|
|
47
47
|
flex: 1,
|
|
48
48
|
justifyContent: align === "center" ? "center" : "flex-start",
|
|
49
|
-
}, children: _jsx(PhiMenuControl, { mode: "horizontal", menuTheme: menuTheme, selectedKeys: selectedKeys, items: menuItems, fontSize: token.
|
|
49
|
+
}, children: _jsx(PhiMenuControl, { mode: "horizontal", menuTheme: menuTheme, selectedKeys: selectedKeys, items: menuItems, fontSize: token.fontSize, style: {
|
|
50
50
|
display: "flex",
|
|
51
51
|
alignItems: "center",
|
|
52
52
|
justifyContent: align === "center" ? "center" : "flex-start",
|
|
@@ -11,7 +11,7 @@ export function PhiHtmlWidgetClient({ blockId, config, }) {
|
|
|
11
11
|
const [fontSizeOverride, setFontSizeOverride] = useState(null);
|
|
12
12
|
const html = typeof config?.html === "string" ? config.html.trim() : "";
|
|
13
13
|
const resolvedFontFamily = resolvePhiWidgetFontFamily(fontFamilyOverride ?? config?.fontFamily, fonts, token);
|
|
14
|
-
const resolvedFontSize = resolvePhiWidgetFontSize(fontSizeOverride ?? config?.fontSize, token, "
|
|
14
|
+
const resolvedFontSize = resolvePhiWidgetFontSize(fontSizeOverride ?? config?.fontSize, token, "base");
|
|
15
15
|
const receiver = createPhiRenderableBlockReceiver("widget", blockId);
|
|
16
16
|
usePhiRenderableBlockSignalListener(receiver, (signal) => {
|
|
17
17
|
if (signal.channel === "fontFamily" && signal.action === "change") {
|
|
@@ -44,8 +44,15 @@ export declare const PHI_MARKDOWN_WIDGET_DEFINITION: {
|
|
|
44
44
|
textAlign: "start";
|
|
45
45
|
textBlockSpacingBefore: "none";
|
|
46
46
|
textBlockSpacingAfter: "sm";
|
|
47
|
-
headingBlockSpacingBefore: "
|
|
47
|
+
headingBlockSpacingBefore: "sm";
|
|
48
48
|
headingBlockSpacingAfter: "sm";
|
|
49
|
+
headingOffset: number;
|
|
50
|
+
list: {
|
|
51
|
+
level1: "dot";
|
|
52
|
+
level2: "circle";
|
|
53
|
+
level3: "dash";
|
|
54
|
+
gap: "xs";
|
|
55
|
+
};
|
|
49
56
|
};
|
|
50
57
|
contentBinding: {
|
|
51
58
|
storage: "markdown";
|
|
@@ -57,7 +64,318 @@ export declare const PHI_MARKDOWN_WIDGET_DEFINITION: {
|
|
|
57
64
|
value: string;
|
|
58
65
|
};
|
|
59
66
|
};
|
|
60
|
-
fields:
|
|
67
|
+
fields: (({
|
|
68
|
+
key: string;
|
|
69
|
+
label: string;
|
|
70
|
+
description?: string;
|
|
71
|
+
required?: boolean;
|
|
72
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
73
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
74
|
+
heading?: string;
|
|
75
|
+
} & {
|
|
76
|
+
type: "string" | "url" | "icon";
|
|
77
|
+
emptyValue?: "";
|
|
78
|
+
placeholder?: string;
|
|
79
|
+
}) | ({
|
|
80
|
+
key: string;
|
|
81
|
+
label: string;
|
|
82
|
+
description?: string;
|
|
83
|
+
required?: boolean;
|
|
84
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
85
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
86
|
+
heading?: string;
|
|
87
|
+
} & {
|
|
88
|
+
type: "link-target";
|
|
89
|
+
clearsWhenEmpty?: readonly string[];
|
|
90
|
+
}) | ({
|
|
91
|
+
key: string;
|
|
92
|
+
label: string;
|
|
93
|
+
description?: string;
|
|
94
|
+
required?: boolean;
|
|
95
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
96
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
97
|
+
heading?: string;
|
|
98
|
+
} & {
|
|
99
|
+
type: "readonly";
|
|
100
|
+
}) | ({
|
|
101
|
+
key: string;
|
|
102
|
+
label: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
required?: boolean;
|
|
105
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
106
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
107
|
+
heading?: string;
|
|
108
|
+
} & {
|
|
109
|
+
type: "data-provider";
|
|
110
|
+
providerKind?: import("../../../../../types").PhiRuntimeDataProviderKind;
|
|
111
|
+
providerKey?: import("@phis/contracts/controls").PhiRuntimeDataProviderKey;
|
|
112
|
+
}) | ({
|
|
113
|
+
key: string;
|
|
114
|
+
label: string;
|
|
115
|
+
description?: string;
|
|
116
|
+
required?: boolean;
|
|
117
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
118
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
119
|
+
heading?: string;
|
|
120
|
+
} & {
|
|
121
|
+
type: "calendar-adapter";
|
|
122
|
+
}) | ({
|
|
123
|
+
key: string;
|
|
124
|
+
label: string;
|
|
125
|
+
description?: string;
|
|
126
|
+
required?: boolean;
|
|
127
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
128
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
129
|
+
heading?: string;
|
|
130
|
+
} & {
|
|
131
|
+
type: "video-provider";
|
|
132
|
+
}) | ({
|
|
133
|
+
key: string;
|
|
134
|
+
label: string;
|
|
135
|
+
description?: string;
|
|
136
|
+
required?: boolean;
|
|
137
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
138
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
139
|
+
heading?: string;
|
|
140
|
+
} & {
|
|
141
|
+
type: "dimension";
|
|
142
|
+
widthKey?: string;
|
|
143
|
+
heightKey?: string;
|
|
144
|
+
widthPlaceholder?: string;
|
|
145
|
+
heightPlaceholder?: string;
|
|
146
|
+
patchOnChange?: Record<string, unknown>;
|
|
147
|
+
}) | ({
|
|
148
|
+
key: string;
|
|
149
|
+
label: string;
|
|
150
|
+
description?: string;
|
|
151
|
+
required?: boolean;
|
|
152
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
153
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
154
|
+
heading?: string;
|
|
155
|
+
} & {
|
|
156
|
+
type: "length";
|
|
157
|
+
min?: number;
|
|
158
|
+
max?: number;
|
|
159
|
+
step?: number;
|
|
160
|
+
precision?: number;
|
|
161
|
+
}) | ({
|
|
162
|
+
key: string;
|
|
163
|
+
label: string;
|
|
164
|
+
description?: string;
|
|
165
|
+
required?: boolean;
|
|
166
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
167
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
168
|
+
heading?: string;
|
|
169
|
+
} & {
|
|
170
|
+
type: "radius";
|
|
171
|
+
topLeftKey: string;
|
|
172
|
+
topRightKey: string;
|
|
173
|
+
bottomLeftKey: string;
|
|
174
|
+
bottomRightKey: string;
|
|
175
|
+
}) | ({
|
|
176
|
+
key: string;
|
|
177
|
+
label: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
required?: boolean;
|
|
180
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
181
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
182
|
+
heading?: string;
|
|
183
|
+
} & {
|
|
184
|
+
type: "padding";
|
|
185
|
+
paddingKey?: string;
|
|
186
|
+
gapKey?: string;
|
|
187
|
+
paddingTopKey?: string;
|
|
188
|
+
paddingRightKey?: string;
|
|
189
|
+
paddingBottomKey?: string;
|
|
190
|
+
paddingLeftKey?: string;
|
|
191
|
+
section?: string;
|
|
192
|
+
}) | ({
|
|
193
|
+
key: string;
|
|
194
|
+
label: string;
|
|
195
|
+
description?: string;
|
|
196
|
+
required?: boolean;
|
|
197
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
198
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
199
|
+
heading?: string;
|
|
200
|
+
} & {
|
|
201
|
+
type: "color";
|
|
202
|
+
mode?: import("../../../../../types").PhiCmsConfigFieldColorMode;
|
|
203
|
+
defaultToken?: import("../../../../../theme/phi-theme-tokens").PhiThemeTokenKey;
|
|
204
|
+
section?: string;
|
|
205
|
+
}) | ({
|
|
206
|
+
key: string;
|
|
207
|
+
label: string;
|
|
208
|
+
description?: string;
|
|
209
|
+
required?: boolean;
|
|
210
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
211
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
212
|
+
heading?: string;
|
|
213
|
+
} & {
|
|
214
|
+
type: "boolean";
|
|
215
|
+
}) | ({
|
|
216
|
+
key: string;
|
|
217
|
+
label: string;
|
|
218
|
+
description?: string;
|
|
219
|
+
required?: boolean;
|
|
220
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
221
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
222
|
+
heading?: string;
|
|
223
|
+
} & {
|
|
224
|
+
type: "image";
|
|
225
|
+
}) | ({
|
|
226
|
+
key: string;
|
|
227
|
+
label: string;
|
|
228
|
+
description?: string;
|
|
229
|
+
required?: boolean;
|
|
230
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
231
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
232
|
+
heading?: string;
|
|
233
|
+
} & {
|
|
234
|
+
type: "slot-texts";
|
|
235
|
+
}) | ({
|
|
236
|
+
key: string;
|
|
237
|
+
label: string;
|
|
238
|
+
description?: string;
|
|
239
|
+
required?: boolean;
|
|
240
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
241
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
242
|
+
heading?: string;
|
|
243
|
+
} & {
|
|
244
|
+
type: "number-list";
|
|
245
|
+
min?: number;
|
|
246
|
+
}) | ({
|
|
247
|
+
key: string;
|
|
248
|
+
label: string;
|
|
249
|
+
description?: string;
|
|
250
|
+
required?: boolean;
|
|
251
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
252
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
253
|
+
heading?: string;
|
|
254
|
+
} & {
|
|
255
|
+
type: "flags";
|
|
256
|
+
options: readonly {
|
|
257
|
+
value: number;
|
|
258
|
+
label: string;
|
|
259
|
+
}[];
|
|
260
|
+
}) | ({
|
|
261
|
+
key: string;
|
|
262
|
+
label: string;
|
|
263
|
+
description?: string;
|
|
264
|
+
required?: boolean;
|
|
265
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
266
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
267
|
+
heading?: string;
|
|
268
|
+
} & {
|
|
269
|
+
type: "number";
|
|
270
|
+
min?: number;
|
|
271
|
+
max?: number;
|
|
272
|
+
step?: number;
|
|
273
|
+
precision?: number;
|
|
274
|
+
prefix?: string;
|
|
275
|
+
presentation?: "slider";
|
|
276
|
+
suffix?: string;
|
|
277
|
+
}) | ({
|
|
278
|
+
key: string;
|
|
279
|
+
label: string;
|
|
280
|
+
description?: string;
|
|
281
|
+
required?: boolean;
|
|
282
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
283
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
284
|
+
heading?: string;
|
|
285
|
+
} & {
|
|
286
|
+
type: "choice";
|
|
287
|
+
valueType: "number";
|
|
288
|
+
options: import("@phis/contracts/controls").PhiControlOption<number>[];
|
|
289
|
+
emptyOption?: import("@phis/contracts/controls").PhiControlOption;
|
|
290
|
+
emptyValue?: null | undefined;
|
|
291
|
+
placeholder?: string;
|
|
292
|
+
mode?: never;
|
|
293
|
+
presentation?: never;
|
|
294
|
+
optionsProvider?: never;
|
|
295
|
+
allowCustom?: never;
|
|
296
|
+
createBehavior?: never;
|
|
297
|
+
filter?: never;
|
|
298
|
+
patchOnChange?: never;
|
|
299
|
+
optionPresets?: never;
|
|
300
|
+
}) | ({
|
|
301
|
+
key: string;
|
|
302
|
+
label: string;
|
|
303
|
+
description?: string;
|
|
304
|
+
required?: boolean;
|
|
305
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
306
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
307
|
+
heading?: string;
|
|
308
|
+
} & {
|
|
309
|
+
type: "choice";
|
|
310
|
+
mode?: import("../../../../../types").PhiCmsConfigFieldChoiceMode;
|
|
311
|
+
valueType?: Exclude<import("../../../../../types").PhiCmsConfigFieldChoiceValueType, "number">;
|
|
312
|
+
presentation?: import("../../../../../types").PhiCmsConfigFieldChoicePresentation;
|
|
313
|
+
options?: import("@phis/contracts/controls").PhiControlOption[];
|
|
314
|
+
optionsProvider?: import("@phis/contracts/controls").PhiControlOptionsProviderConfig;
|
|
315
|
+
allowCustom?: boolean;
|
|
316
|
+
createBehavior?: import("../../../../../types").PhiCmsConfigFieldChoiceCreateBehavior;
|
|
317
|
+
placeholder?: string;
|
|
318
|
+
filter?: import("../../../../../types").PhiCmsConfigFieldChoiceFilter;
|
|
319
|
+
emptyOption?: import("@phis/contracts/controls").PhiControlOption;
|
|
320
|
+
emptyValue?: null | undefined;
|
|
321
|
+
patchOnChange?: Record<string, unknown>;
|
|
322
|
+
optionPresets?: import("../../../../../types/cms-plugins").PhiCmsConfigFieldOptionPresets;
|
|
323
|
+
}) | ({
|
|
324
|
+
key: string;
|
|
325
|
+
label: string;
|
|
326
|
+
description?: string;
|
|
327
|
+
required?: boolean;
|
|
328
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
329
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
330
|
+
heading?: string;
|
|
331
|
+
} & {
|
|
332
|
+
type: "collection";
|
|
333
|
+
itemKeyField: string;
|
|
334
|
+
itemLabelField?: string;
|
|
335
|
+
itemFields: import("../../../../../types").PhiCmsConfigField[];
|
|
336
|
+
defaultItem?: Record<string, unknown>;
|
|
337
|
+
addLabel?: string;
|
|
338
|
+
emptyLabel?: string;
|
|
339
|
+
minItems?: number;
|
|
340
|
+
maxItems?: number;
|
|
341
|
+
reorderable?: boolean;
|
|
342
|
+
presentation?: import("../../../../../types").PhiCmsConfigFieldCollectionPresentation;
|
|
343
|
+
editLabel?: string;
|
|
344
|
+
}) | ({
|
|
345
|
+
key: string;
|
|
346
|
+
label: string;
|
|
347
|
+
description?: string;
|
|
348
|
+
required?: boolean;
|
|
349
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
350
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
351
|
+
heading?: string;
|
|
352
|
+
} & {
|
|
353
|
+
type: "surface";
|
|
354
|
+
tone?: false;
|
|
355
|
+
}) | ({
|
|
356
|
+
key: string;
|
|
357
|
+
label: string;
|
|
358
|
+
description?: string;
|
|
359
|
+
required?: boolean;
|
|
360
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
361
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
362
|
+
heading?: string;
|
|
363
|
+
} & {
|
|
364
|
+
type: "grid-placement" | "column-count";
|
|
365
|
+
section?: string;
|
|
366
|
+
}) | {
|
|
367
|
+
key: string;
|
|
368
|
+
type: "choice";
|
|
369
|
+
label: string;
|
|
370
|
+
emptyOption: {
|
|
371
|
+
value: string;
|
|
372
|
+
label: string;
|
|
373
|
+
};
|
|
374
|
+
options: {
|
|
375
|
+
value: PhiMarkdownImageFloat;
|
|
376
|
+
label: string;
|
|
377
|
+
}[];
|
|
378
|
+
})[];
|
|
61
379
|
parseConfig: typeof parsePhiCmsMarkdownWidgetConfig;
|
|
62
380
|
};
|
|
63
381
|
export declare const PHI_MARKDOWN_WIDGET_PLUGIN_TYPE: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
2
2
|
import { PHI_SPACING_SCALE_KEYS } from "../../../../../components/widgets/config/spacing-options";
|
|
3
3
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
4
|
-
import { buildPhiBulletListFields, readPhiBulletListStyle, } from "../../../../../components/widgets/shared/bullet-list-vocabulary";
|
|
4
|
+
import { buildPhiBulletListFields, PHI_BULLET_LIST_DEFAULT_STYLE, readPhiBulletListStyle, } from "../../../../../components/widgets/shared/bullet-list-vocabulary";
|
|
5
5
|
import { readNumber, readRenderableBlockConfig, readString, } from "../../../../../components/widgets/config/parser-primitives";
|
|
6
6
|
const PHI_MARKDOWN_TEXT_ALIGN_OPTIONS = [
|
|
7
7
|
{ value: "start", label: "Start" },
|
|
@@ -81,8 +81,11 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
|
|
|
81
81
|
textAlign: "start",
|
|
82
82
|
textBlockSpacingBefore: "none",
|
|
83
83
|
textBlockSpacingAfter: "sm",
|
|
84
|
-
headingBlockSpacingBefore: "
|
|
84
|
+
headingBlockSpacingBefore: "sm",
|
|
85
85
|
headingBlockSpacingAfter: "sm",
|
|
86
|
+
headingOffset: 0,
|
|
87
|
+
// What the list draws with when nothing is set, so the Inspector shows it rather than empty fields.
|
|
88
|
+
list: { ...PHI_BULLET_LIST_DEFAULT_STYLE },
|
|
86
89
|
},
|
|
87
90
|
contentBinding: {
|
|
88
91
|
storage: "markdown",
|
|
@@ -127,6 +130,8 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
|
|
|
127
130
|
key: "imageFloat",
|
|
128
131
|
type: "choice",
|
|
129
132
|
label: "Image Float",
|
|
133
|
+
// No float is the default and stores nothing; the line says so instead of an empty picker.
|
|
134
|
+
emptyOption: { value: "none", label: "None" },
|
|
130
135
|
options: PHI_MARKDOWN_IMAGE_FLOAT_OPTIONS,
|
|
131
136
|
},
|
|
132
137
|
{
|
|
@@ -157,12 +162,21 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
|
|
|
157
162
|
key: "headingOffset",
|
|
158
163
|
type: "number",
|
|
159
164
|
label: "Heading Offset",
|
|
165
|
+
description: "Moves every heading of the text down by this many levels: at 1, a # heading is drawn as H2, ## as H3, and so on. For a text that stands under a page title of its own, so its first heading does not compete with it.",
|
|
160
166
|
min: 0,
|
|
161
167
|
max: PHI_MARKDOWN_HEADING_OFFSET_MAX,
|
|
162
168
|
precision: 0,
|
|
163
169
|
},
|
|
164
|
-
{
|
|
165
|
-
|
|
170
|
+
{
|
|
171
|
+
key: "tocKey",
|
|
172
|
+
type: "string",
|
|
173
|
+
label: "TOC Key",
|
|
174
|
+
// Empty is no key, and a TOC on "Auto" connects to the text all the same.
|
|
175
|
+
placeholder: "Auto",
|
|
176
|
+
description: "A name for this text's table of contents. A Markdown TOC widget set to Binding Mode \"Target\" with the same TOC Key lists this text's headings and no other's. Leave it empty while the page has one Markdown text: a TOC on \"Auto\" finds it by itself.",
|
|
177
|
+
},
|
|
178
|
+
// The markers are an unordered list's: a `1.` list counts, whatever its level's marker says.
|
|
179
|
+
...buildPhiBulletListFields("list", "Unordered Lists"),
|
|
166
180
|
],
|
|
167
181
|
parseConfig: parsePhiCmsMarkdownWidgetConfig,
|
|
168
182
|
};
|
|
@@ -69,7 +69,15 @@ export function PhiMarkdownWidgetEditor({ blockId, config, onChange, onSourceLoc
|
|
|
69
69
|
* On the field's own text, not on `style`: `style` places the control as a whole, and with a clear
|
|
70
70
|
* button the control is a wrapper around the textarea, which is where the text is.
|
|
71
71
|
*/
|
|
72
|
-
inputStyle:
|
|
72
|
+
inputStyle: {
|
|
73
|
+
...(config?.textAlign ? { textAlign: config.textAlign } : {}),
|
|
74
|
+
/*
|
|
75
|
+
* The text's own padding, stated, as a single-line field's would be: half of what the first line
|
|
76
|
+
* leaves of a control's height. Stated, the clear button finds the first line by it, as it does in
|
|
77
|
+
* every field that states one; left to Ant Design it hung at its own offset, half a line above.
|
|
78
|
+
*/
|
|
79
|
+
paddingBlock: "calc((var(--ant-control-height) - 1lh) / 2)",
|
|
80
|
+
}, style: {
|
|
73
81
|
/*
|
|
74
82
|
* As wide as the slot: the Widget fills its inline axis (`fill-inline`), so the frame decides the
|
|
75
83
|
* width and the editor takes it. A fixed 520px here dated from when the Widget was intrinsic and
|
|
@@ -6,11 +6,16 @@ import { usePhiConfig } from "../../../../../components/root/phi-config-provider
|
|
|
6
6
|
import { PhiAnchorNavControl } from "../../../../../components/controls/phi-anchor-nav-control";
|
|
7
7
|
import { PhiEmptyControl } from "../../../../../components/controls/phi-empty-control";
|
|
8
8
|
import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
|
|
9
|
+
/*
|
|
10
|
+
* Indented by depth below the shallowest heading listed, not below `h1`: a contents that starts at `h3`
|
|
11
|
+
* (a document whose headings moved down under a page title) would otherwise stand two steps off its line.
|
|
12
|
+
*/
|
|
9
13
|
function buildAnchorItems(headings, indent) {
|
|
14
|
+
const topLevel = headings.reduce((lowest, heading) => Math.min(lowest, heading.level), Infinity);
|
|
10
15
|
return headings.map((heading) => ({
|
|
11
16
|
key: heading.id,
|
|
12
17
|
href: `#${heading.id}`,
|
|
13
|
-
title: (_jsx("span", { style: { display: "block", paddingInlineStart: (heading.level -
|
|
18
|
+
title: (_jsx("span", { style: { display: "block", paddingInlineStart: (heading.level - topLevel) * indent, minWidth: 0 }, children: _jsx(PhiTypographyControl, { ellipsis: { tooltip: heading.text }, style: { display: "block", color: "inherit", fontSize: "inherit", lineHeight: "inherit" }, children: heading.text }) })),
|
|
14
19
|
}));
|
|
15
20
|
}
|
|
16
21
|
function filterHeadings(headings, config) {
|