@phis/ui 0.5.1 → 0.5.3
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 +1 -1
- package/components/controls/phi-border-control.js +1 -1
- package/components/controls/phi-bound-radius-control.js +9 -9
- package/components/controls/phi-brand-control.js +1 -1
- package/components/controls/phi-drawer-control-adapter.js +4 -4
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-form-control.js +1 -1
- package/components/controls/phi-image-control.js +1 -1
- package/components/controls/phi-mask-picker-control.js +6 -6
- package/components/controls/phi-select-control.js +1 -1
- package/components/controls/phi-theme-scope-control.js +1 -1
- package/components/controls/use-phi-color-control-presets.js +2 -2
- package/components/forms/compound-form-controls.js +2 -2
- package/components/forms/extended-form-field-controls.js +1 -1
- package/components/forms/shared-form-provider-registry.js +2 -2
- package/components/layouts/clients/phi-flex-layout-client.js +4 -4
- package/components/layouts/clients/phi-grid-layout-client.js +3 -3
- package/components/layouts/clients/phi-sequence-slot-editor.js +1 -1
- package/components/layouts/layout-definitions.d.ts +4 -4
- package/components/layouts/phi-page-region-layout.js +1 -1
- package/components/layouts/phi-structure-region-layout.js +3 -3
- package/components/media/phi-asset-focal-rect-widget.js +4 -4
- package/components/media/phi-asset-inspector-section.js +1 -1
- package/components/media/phi-media-kind-icon.js +2 -2
- package/components/media/phi-media-restricted-icon.js +1 -1
- package/components/overlays/phi-overlay-container-client.js +1 -1
- package/components/regions/presets/phi-base-page-column.d.ts +5 -2
- package/components/regions/presets/phi-base-page-column.js +6 -2
- package/components/root/phi-config-provider.js +1 -1
- package/components/root/phi-root-background.js +1 -1
- package/components/root/phi-root-theme-resolver.js +1 -1
- package/components/shell/phi-module-icons.js +1 -1
- package/components/widgets/built-in/builder-workspace-preview.js +8 -8
- package/components/widgets/client/bullet-list-entries-editor.js +2 -2
- package/components/widgets/client/external-document-editor.js +1 -1
- package/components/widgets/client/html-editor.js +3 -3
- package/components/widgets/config/background.d.ts +1 -1
- package/components/widgets/config/background.js +1 -1
- package/components/widgets/inspector-field-row.js +1 -1
- package/components/widgets/label-sets/inspector.js +2 -0
- package/components/widgets/label-types/inspector.d.ts +1 -0
- package/components/widgets/label-types/inspector.js +1 -0
- package/components/widgets/shared/card-body-client.js +1 -1
- package/components/widgets/shared/result-body-client.js +1 -1
- package/constants/media-library-provider-keys.d.ts +8 -1
- package/constants/media-library-provider-keys.js +8 -1
- package/constants/record-field-kinds.d.ts +6 -0
- package/constants/record-field-kinds.js +7 -0
- package/constants/runtime-module-ownership.js +1 -1
- package/helpers/border-widget-style.d.ts +2 -2
- package/helpers/border-widget-style.js +2 -2
- package/helpers/cms-dialog.d.ts +4 -4
- package/helpers/cms-layout-defaults.d.ts +2 -2
- package/helpers/cms-page-catalog.d.ts +5 -0
- package/helpers/cms-preset-page-tree.d.ts +4 -0
- package/helpers/cms-preset-page-tree.js +2 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/layout-style.d.ts +2 -2
- package/helpers/page-layout-check.d.ts +4 -1
- package/helpers/page-layout-check.js +26 -0
- package/helpers/record-fields.d.ts +9 -0
- package/helpers/record-fields.js +84 -0
- package/helpers/surface-presets.d.ts +6 -6
- package/helpers/surface-style.d.ts +1 -1
- package/helpers.d.ts +0 -1
- package/helpers.js +0 -2
- package/module-page-check.d.ts +12 -0
- package/module-page-check.js +12 -0
- package/module-records.d.ts +4 -2
- package/module-records.js +3 -1
- package/next/antd-form-context-loader.mjs +31 -0
- package/next/config.d.mts +2 -0
- package/next/config.mjs +36 -3
- package/package.json +10 -1
- package/plugins/runtime-modules/asset/data-providers.d.ts +0 -65
- package/plugins/runtime-modules/asset/data-providers.js +0 -40
- package/plugins/runtime-modules/asset/definition.d.ts +0 -60
- package/plugins/runtime-modules/asset/ids.d.ts +0 -1
- package/plugins/runtime-modules/asset/ids.js +1 -2
- package/plugins/runtime-modules/asset/presets.d.ts +1 -0
- package/plugins/runtime-modules/asset/server.js +0 -5
- package/plugins/runtime-modules/blog/presets.d.ts +1 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +13 -4
- package/plugins/runtime-modules/builder/clients/inspector-link-target-field.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +14 -1
- package/plugins/runtime-modules/builder/clients/inspector-signal-section.js +2 -2
- package/plugins/runtime-modules/builder/clients/layout-inspector.js +1 -1
- package/plugins/runtime-modules/builder/clients/layout-scaffold-buttons.js +4 -4
- package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +1 -1
- package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
- package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
- package/plugins/runtime-modules/builder/clients/shells-workspace.js +1 -1
- package/plugins/runtime-modules/builder/clients/structure-canvas.js +2 -2
- package/plugins/runtime-modules/builder/clients/widget-effects-editor.js +1 -1
- package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +3 -2
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +6 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +8 -0
- package/plugins/runtime-modules/builder/pages-workspace.js +12 -1
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +5 -5
- package/plugins/runtime-modules/builder/structure-dnd.js +2 -2
- package/plugins/runtime-modules/builder/widgets/test-block/client.js +1 -1
- package/plugins/runtime-modules/content-entry-routes.d.ts +1 -0
- package/plugins/runtime-modules/contracts.d.ts +1 -1
- package/plugins/runtime-modules/contracts.js +41 -1
- package/plugins/runtime-modules/core/data-providers.d.ts +60 -0
- package/plugins/runtime-modules/core/data-providers.js +41 -0
- package/plugins/runtime-modules/core/definition.d.ts +55 -0
- package/plugins/runtime-modules/core/server.js +5 -0
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +34 -0
- package/plugins/runtime-modules/core/widgets/button/config.js +16 -0
- package/plugins/runtime-modules/core/widgets/button/plugin.js +37 -6
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +13 -2
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +13 -2
- package/plugins/runtime-modules/core/widgets/description/editor.js +13 -13
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/gallery/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/gallery/client.js +29 -21
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +16 -0
- package/plugins/runtime-modules/core/widgets/gallery/config.js +16 -0
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.js +11 -0
- package/plugins/runtime-modules/core/widgets/header-navigation/authoring.js +2 -3
- package/plugins/runtime-modules/core/widgets/header-navigation/client.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +9 -5
- package/plugins/runtime-modules/core/widgets/header-navigation/config.d.ts +1 -4
- package/plugins/runtime-modules/core/widgets/header-navigation/plugin.js +2 -3
- package/plugins/runtime-modules/core/widgets/header-navigation/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/server.js +1 -2
- package/plugins/runtime-modules/core/widgets/image/config.d.ts +35 -0
- package/plugins/runtime-modules/core/widgets/image/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/image/plugin.js +19 -1
- package/plugins/runtime-modules/core/widgets/image/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/image/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +13 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/markdown/editor.js +7 -7
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
- package/plugins/runtime-modules/core/widgets/record/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +13 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +9 -0
- package/plugins/runtime-modules/core/widgets/simple-text/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +14 -1
- package/plugins/runtime-modules/core/widgets/spacer/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +37 -0
- package/plugins/runtime-modules/descriptor-compiler.js +8 -0
- package/plugins/runtime-modules/editor/presets.d.ts +1 -0
- package/plugins/runtime-modules/groups/definition.d.ts +1 -1
- package/plugins/runtime-modules/localization/presets.d.ts +1 -0
- package/plugins/runtime-modules/news/presets.d.ts +1 -0
- package/plugins/runtime-modules/resolver.js +2 -0
- package/plugins/runtime-modules/revisions/presets.d.ts +1 -0
- package/plugins/runtime-modules/theme/presets.d.ts +1 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +37 -1
- package/server-helpers/cms-page-record.d.ts +26 -0
- package/server-helpers/cms-page-record.js +42 -0
- package/server-helpers/cms-request.js +48 -4
- package/server-helpers/record-fields.d.ts +62 -0
- package/server-helpers/record-fields.js +87 -0
- package/server-helpers/record-samples.d.ts +21 -0
- package/server-helpers/record-samples.js +41 -0
- package/styles/builder-scaffold.css +19 -19
- package/styles/controls.css +121 -108
- package/styles/gradients.css +23 -23
- package/styles/layout-affordances.css +15 -15
- package/styles/layout-authoring-scaffold.css +20 -20
- package/styles/layout.css +9 -9
- package/styles/root.css +4 -4
- package/styles/shell.css +48 -17
- package/theme/antd-css-var-contract.d.ts +93 -78
- package/theme/antd-css-var-contract.js +99 -79
- package/theme/phi-container-breakpoints.d.ts +4 -1
- package/theme/phi-container-breakpoints.js +4 -1
- package/theme/phi-control-shape.d.ts +1 -1
- package/theme/phi-theme-gradients.d.ts +2 -2
- package/theme/phi-theme-gradients.js +14 -14
- package/theme/phi-theme-palette.d.ts +1 -1
- package/theme/phi-theme-palette.js +2 -2
- package/theme/phi-theme-tokens.d.ts +10 -4
- package/theme/phi-theme-tokens.js +78 -23
- package/theme/phi-theme.d.ts +14 -0
- package/theme/phi-theme.js +14 -0
- package/theme/phi-tokens.d.ts +6 -1
- package/theme/phi-tokens.js +22 -2
- package/theme.d.ts +1 -1
- package/theme.js +1 -1
- package/types/cms-module-descriptors.d.ts +6 -0
- package/types/cms-plugins.d.ts +19 -1
- package/types/core-widget-placements.d.ts +10 -0
- package/types/record-provider.d.ts +92 -0
- package/types/widget-runtime.d.ts +5 -0
- /package/plugins/runtime-modules/{asset/services/folder-images.server.d.ts → core/services/media-folder-images.server.d.ts} +0 -0
- /package/plugins/runtime-modules/{asset/services/folder-images.server.js → core/services/media-folder-images.server.js} +0 -0
|
@@ -20,6 +20,8 @@ export type PhiCmsImageWidgetConfig = PhiCmsWidgetConfigBase & PhiMediaImageSour
|
|
|
20
20
|
borderBottomLeftRadius?: number | string;
|
|
21
21
|
borderBottomRightRadius?: number | string;
|
|
22
22
|
mask?: PhiMaskConfig;
|
|
23
|
+
/** A picture field of the page record to show instead of the Widget's own picture. */
|
|
24
|
+
recordField?: string;
|
|
23
25
|
};
|
|
24
26
|
export declare function normalizePhiImageWidgetConfig(config: unknown): PhiCmsImageWidgetConfig;
|
|
25
27
|
declare function parsePhiCmsImageWidgetConfig(config: Record<string, unknown>): PhiCmsImageWidgetConfig;
|
|
@@ -34,6 +36,23 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
|
|
|
34
36
|
icon: string;
|
|
35
37
|
iconFamily: string;
|
|
36
38
|
fields: ({
|
|
39
|
+
key: string;
|
|
40
|
+
type: "record-field";
|
|
41
|
+
label: string;
|
|
42
|
+
description: string;
|
|
43
|
+
kinds: "picture"[];
|
|
44
|
+
options?: undefined;
|
|
45
|
+
visibleWhen?: undefined;
|
|
46
|
+
valueType?: undefined;
|
|
47
|
+
emptyOption?: undefined;
|
|
48
|
+
emptyValue?: undefined;
|
|
49
|
+
widthPlaceholder?: undefined;
|
|
50
|
+
heightPlaceholder?: undefined;
|
|
51
|
+
topLeftKey?: undefined;
|
|
52
|
+
topRightKey?: undefined;
|
|
53
|
+
bottomLeftKey?: undefined;
|
|
54
|
+
bottomRightKey?: undefined;
|
|
55
|
+
} | {
|
|
37
56
|
key: string;
|
|
38
57
|
type: "choice";
|
|
39
58
|
label: string;
|
|
@@ -41,6 +60,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
|
|
|
41
60
|
value: string;
|
|
42
61
|
label: string;
|
|
43
62
|
}[];
|
|
63
|
+
description?: undefined;
|
|
64
|
+
kinds?: undefined;
|
|
44
65
|
visibleWhen?: undefined;
|
|
45
66
|
valueType?: undefined;
|
|
46
67
|
emptyOption?: undefined;
|
|
@@ -59,6 +80,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
|
|
|
59
80
|
field: string;
|
|
60
81
|
equals: string;
|
|
61
82
|
};
|
|
83
|
+
description?: undefined;
|
|
84
|
+
kinds?: undefined;
|
|
62
85
|
options?: undefined;
|
|
63
86
|
valueType?: undefined;
|
|
64
87
|
emptyOption?: undefined;
|
|
@@ -84,6 +107,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
|
|
|
84
107
|
field: string;
|
|
85
108
|
equals: string;
|
|
86
109
|
};
|
|
110
|
+
description?: undefined;
|
|
111
|
+
kinds?: undefined;
|
|
87
112
|
widthPlaceholder?: undefined;
|
|
88
113
|
heightPlaceholder?: undefined;
|
|
89
114
|
topLeftKey?: undefined;
|
|
@@ -98,6 +123,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
|
|
|
98
123
|
field: string;
|
|
99
124
|
equals: string;
|
|
100
125
|
};
|
|
126
|
+
description?: undefined;
|
|
127
|
+
kinds?: undefined;
|
|
101
128
|
options?: undefined;
|
|
102
129
|
valueType?: undefined;
|
|
103
130
|
emptyOption?: undefined;
|
|
@@ -120,6 +147,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
|
|
|
120
147
|
value: string;
|
|
121
148
|
label: string;
|
|
122
149
|
}[];
|
|
150
|
+
description?: undefined;
|
|
151
|
+
kinds?: undefined;
|
|
123
152
|
valueType?: undefined;
|
|
124
153
|
emptyOption?: undefined;
|
|
125
154
|
emptyValue?: undefined;
|
|
@@ -133,6 +162,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
|
|
|
133
162
|
key: string;
|
|
134
163
|
type: "boolean";
|
|
135
164
|
label: string;
|
|
165
|
+
description?: undefined;
|
|
166
|
+
kinds?: undefined;
|
|
136
167
|
options?: undefined;
|
|
137
168
|
visibleWhen?: undefined;
|
|
138
169
|
valueType?: undefined;
|
|
@@ -150,6 +181,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
|
|
|
150
181
|
label: string;
|
|
151
182
|
widthPlaceholder: string;
|
|
152
183
|
heightPlaceholder: string;
|
|
184
|
+
description?: undefined;
|
|
185
|
+
kinds?: undefined;
|
|
153
186
|
options?: undefined;
|
|
154
187
|
visibleWhen?: undefined;
|
|
155
188
|
valueType?: undefined;
|
|
@@ -167,6 +200,8 @@ export declare const PHI_IMAGE_WIDGET_DEFINITION: {
|
|
|
167
200
|
topRightKey: string;
|
|
168
201
|
bottomLeftKey: string;
|
|
169
202
|
bottomRightKey: string;
|
|
203
|
+
description?: undefined;
|
|
204
|
+
kinds?: undefined;
|
|
170
205
|
options?: undefined;
|
|
171
206
|
visibleWhen?: undefined;
|
|
172
207
|
valueType?: undefined;
|
|
@@ -65,6 +65,7 @@ export function normalizePhiImageWidgetConfig(config) {
|
|
|
65
65
|
borderBottomLeftRadius: readCssSize(raw.borderBottomLeftRadius),
|
|
66
66
|
borderBottomRightRadius: readCssSize(raw.borderBottomRightRadius),
|
|
67
67
|
mask: readPhiMaskConfig(raw.mask),
|
|
68
|
+
recordField: readString(raw.recordField),
|
|
68
69
|
};
|
|
69
70
|
/*
|
|
70
71
|
* An Asset without a word about its variant gets the Card variant; `null` is a word -- the Inspector's
|
|
@@ -99,6 +100,13 @@ export const PHI_IMAGE_WIDGET_DEFINITION = {
|
|
|
99
100
|
icon: "antd:picture-outlined",
|
|
100
101
|
iconFamily: "content",
|
|
101
102
|
fields: [
|
|
103
|
+
{
|
|
104
|
+
key: "recordField",
|
|
105
|
+
type: "record-field",
|
|
106
|
+
label: "Record field",
|
|
107
|
+
description: "Shows a picture of the record this page is about instead of the picture chosen here, which stands in where the page has no record.",
|
|
108
|
+
kinds: ["picture"],
|
|
109
|
+
},
|
|
102
110
|
{
|
|
103
111
|
key: "sourceKind",
|
|
104
112
|
type: "choice",
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { definePhiPassiveWidgetRenderers } from "../../../../../plugins/factories/widget-renderers";
|
|
3
|
+
import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
|
|
3
4
|
import { PhiImageWidgetServer } from "./server";
|
|
4
5
|
import { PHI_IMAGE_WIDGET_DEFINITION, PHI_IMAGE_WIDGET_PLUGIN_TYPE } from "./config";
|
|
6
|
+
/**
|
|
7
|
+
* A picture field of the page record takes the Widget's own picture's place: by its address, with the
|
|
8
|
+
* record's own words for it, which are in the page's language already. A record without the picture
|
|
9
|
+
* leaves nothing to show; a Page about no record shows the picture chosen in the Widget.
|
|
10
|
+
*/
|
|
11
|
+
async function PhiImageWidgetSource({ widget, runtime, registry, config }) {
|
|
12
|
+
const recordField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.recordField, kinds: ["picture"] });
|
|
13
|
+
if (!recordField.bound) {
|
|
14
|
+
return _jsx(PhiImageWidgetServer, { runtime: runtime, widget: widget, config: config });
|
|
15
|
+
}
|
|
16
|
+
if (!recordField.field) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const { src, alt } = recordField.field.value;
|
|
20
|
+
const { assetId: _assetId, variantKey: _variantKey, variantVersion: _variantVersion, ...presentation } = config;
|
|
21
|
+
return (_jsx(PhiImageWidgetServer, { runtime: runtime, translate: false, config: { ...presentation, sourceKind: "url", sourceUrl: src, alt: alt ?? "", title: undefined } }));
|
|
22
|
+
}
|
|
5
23
|
export const PHI_IMAGE_WIDGET_PLUGIN = {
|
|
6
24
|
...PHI_IMAGE_WIDGET_DEFINITION,
|
|
7
|
-
...definePhiPassiveWidgetRenderers((
|
|
25
|
+
...definePhiPassiveWidgetRenderers((args) => _jsx(PhiImageWidgetSource, { ...args }, `widget-${args.widget.id}`)),
|
|
8
26
|
};
|
|
9
27
|
export { PHI_IMAGE_WIDGET_PLUGIN_TYPE };
|
|
@@ -4,5 +4,7 @@ export type PhiImageWidgetServerProps = {
|
|
|
4
4
|
runtime: Pick<PhiBlockRuntime, "locale" | "site">;
|
|
5
5
|
widget?: PhiCmsContentWidgetNode | null;
|
|
6
6
|
config?: PhiCmsImageWidgetConfig | null;
|
|
7
|
+
/** False for words that are in the page's language already -- a record's own. Absent, the Widget's flag decides. */
|
|
8
|
+
translate?: boolean;
|
|
7
9
|
};
|
|
8
|
-
export declare function PhiImageWidgetServer({ runtime, widget, config, }: PhiImageWidgetServerProps): Promise<import("react").JSX.Element>;
|
|
10
|
+
export declare function PhiImageWidgetServer({ runtime, widget, config, translate: translateWords, }: PhiImageWidgetServerProps): Promise<import("react").JSX.Element>;
|
|
@@ -10,7 +10,7 @@ import { trBulk, trBulkForLocale } from "../../../../../server-helpers/translate
|
|
|
10
10
|
async function resolveImageWidgetLabels(runtime) {
|
|
11
11
|
return getPhiImageWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
12
12
|
}
|
|
13
|
-
export async function PhiImageWidgetServer({ runtime, widget, config, }) {
|
|
13
|
+
export async function PhiImageWidgetServer({ runtime, widget, config, translate: translateWords, }) {
|
|
14
14
|
const labels = await resolveImageWidgetLabels(runtime);
|
|
15
15
|
const assetId = widget?.resolvedContent?.assetId ?? config?.assetId ?? null;
|
|
16
16
|
const resolvedAsset = config?.sourceKind === "asset" && typeof assetId === "number"
|
|
@@ -25,7 +25,7 @@ export async function PhiImageWidgetServer({ runtime, widget, config, }) {
|
|
|
25
25
|
* description from the Media library, or what the Widget's config states for an address -- is the Site's
|
|
26
26
|
* text and goes through the Site's translation, unless the Widget says not to translate.
|
|
27
27
|
*/
|
|
28
|
-
const translate = !hasPhiFlag(widget?.flags ?? 0, PhiCmsFlags.NoTranslate);
|
|
28
|
+
const translate = translateWords ?? !hasPhiFlag(widget?.flags ?? 0, PhiCmsFlags.NoTranslate);
|
|
29
29
|
const sourceTexts = [
|
|
30
30
|
recordAlt ? "" : (resolvedAsset?.altText ?? "").trim(),
|
|
31
31
|
recordTitle ? "" : (resolvedAsset?.title ?? "").trim(),
|
|
@@ -14,6 +14,8 @@ export type PhiCmsMarkdownWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
|
14
14
|
eyebrow?: string;
|
|
15
15
|
sourceMode?: "inline" | "url";
|
|
16
16
|
markdown?: string;
|
|
17
|
+
/** A Markdown or text field of the page record to show instead of the Widget's own text. */
|
|
18
|
+
recordField?: string;
|
|
17
19
|
widgetId?: string | number | null;
|
|
18
20
|
sourceUrl?: string;
|
|
19
21
|
sourceLocale?: string;
|
|
@@ -159,6 +161,17 @@ export declare const PHI_MARKDOWN_WIDGET_DEFINITION: {
|
|
|
159
161
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
160
162
|
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
161
163
|
heading?: string;
|
|
164
|
+
} & {
|
|
165
|
+
type: "record-field";
|
|
166
|
+
kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
|
|
167
|
+
}) | ({
|
|
168
|
+
key: string;
|
|
169
|
+
label: string;
|
|
170
|
+
description?: string;
|
|
171
|
+
required?: boolean;
|
|
172
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
173
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
174
|
+
heading?: string;
|
|
162
175
|
} & {
|
|
163
176
|
type: "dimension";
|
|
164
177
|
widthKey?: string;
|
|
@@ -47,6 +47,7 @@ export function parsePhiCmsMarkdownWidgetConfig(config) {
|
|
|
47
47
|
sourceMode: readMarkdownSourceMode(config.sourceMode) ?? (sourceUrl ? "url" : "inline"),
|
|
48
48
|
widgetId: typeof config.widgetId === "number" || typeof config.widgetId === "string" ? config.widgetId : undefined,
|
|
49
49
|
markdown: readString(config.markdown),
|
|
50
|
+
recordField: readString(config.recordField),
|
|
50
51
|
sourceUrl,
|
|
51
52
|
sourceLocale: readString(config.sourceLocale),
|
|
52
53
|
revalidateSeconds: readNumber(config.revalidateSeconds),
|
|
@@ -117,6 +118,13 @@ export const PHI_MARKDOWN_WIDGET_DEFINITION = {
|
|
|
117
118
|
],
|
|
118
119
|
},
|
|
119
120
|
{ key: "sourceUrl", type: "url", label: "Source URL", visibleWhen: { field: "sourceMode", equals: "url" } },
|
|
121
|
+
{
|
|
122
|
+
key: "recordField",
|
|
123
|
+
type: "record-field",
|
|
124
|
+
label: "Record field",
|
|
125
|
+
description: "Shows a field of the record this page is about instead of the text. The text stands in where the page has no record.",
|
|
126
|
+
kinds: ["markdown", "text"],
|
|
127
|
+
},
|
|
120
128
|
{
|
|
121
129
|
key: "sourceLocale",
|
|
122
130
|
type: "string",
|
|
@@ -76,7 +76,7 @@ export function PhiMarkdownWidgetEditor({ blockId, config, onChange, onSourceLoc
|
|
|
76
76
|
* leaves of a control's height. Stated, the clear button finds the first line by it, as it does in
|
|
77
77
|
* every field that states one; left to Ant Design it hung at its own offset, half a line above.
|
|
78
78
|
*/
|
|
79
|
-
paddingBlock: "calc((var(--
|
|
79
|
+
paddingBlock: "calc((var(--phi-control-height) - 1lh) / 2)",
|
|
80
80
|
}, style: {
|
|
81
81
|
/*
|
|
82
82
|
* As wide as the slot: the Widget fills its inline axis (`fill-inline`), so the frame decides the
|
|
@@ -86,14 +86,14 @@ export function PhiMarkdownWidgetEditor({ blockId, config, onChange, onSourceLoc
|
|
|
86
86
|
width: "100%",
|
|
87
87
|
height: MARKDOWN_EDITOR_HEIGHT,
|
|
88
88
|
minWidth: 0,
|
|
89
|
-
padding: "var(--
|
|
90
|
-
border: "1px solid var(--
|
|
89
|
+
padding: "var(--phi-padding-sm)",
|
|
90
|
+
border: "1px solid var(--phi-color-border-secondary)",
|
|
91
91
|
/*
|
|
92
|
-
* The Control shape, and not `--
|
|
92
|
+
* The Control shape, and not `--phi-border-radius`.
|
|
93
93
|
*
|
|
94
94
|
* The field is `borderless`, so this style is the box: it draws the border, the ground and the
|
|
95
95
|
* corner the Control would have drawn itself. The corner is the trap. On a Control element
|
|
96
|
-
* `--
|
|
96
|
+
* `--phi-border-radius` does not mean the surface radius -- Ant Design ships a component token in
|
|
97
97
|
* CSS variable mode as a LOCAL redefinition of the same variable on that element, so what is
|
|
98
98
|
* read here is the Control shape, and under `pill` that is the full radius. Inline, where no
|
|
99
99
|
* rule in `styles/control-shape.css` can reach it: a Markdown editor several rows tall came out
|
|
@@ -103,9 +103,9 @@ export function PhiMarkdownWidgetEditor({ blockId, config, onChange, onSourceLoc
|
|
|
103
103
|
* held at every height (THEME.md, "Control shape").
|
|
104
104
|
*/
|
|
105
105
|
borderRadius: "var(--phi-control-radius-grown-md)",
|
|
106
|
-
background: "var(--
|
|
106
|
+
background: "var(--phi-color-bg-container)",
|
|
107
107
|
resize: "none",
|
|
108
|
-
fontFamily: "var(--
|
|
108
|
+
fontFamily: "var(--phi-font-family-code, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace)",
|
|
109
109
|
lineHeight: 1.6,
|
|
110
110
|
} }));
|
|
111
111
|
}
|
|
@@ -4,6 +4,7 @@ import { resolveMarkdownRenderData } from "../../../../../components/widgets/sha
|
|
|
4
4
|
import { PhiCmsFlags } from "../../../../../constants/phi-cms";
|
|
5
5
|
import { hasPhiFlag } from "../../../../../helpers/flags";
|
|
6
6
|
import { readPhiMarkdownSearchText, translatePhiSearchWidgetTexts } from "../../../../../server-helpers/search-text";
|
|
7
|
+
import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
|
|
7
8
|
import { PhiMarkdownWidget } from "./server";
|
|
8
9
|
import { PHI_MARKDOWN_WIDGET_DEFINITION, PHI_MARKDOWN_WIDGET_PLUGIN_TYPE, } from "./config";
|
|
9
10
|
export const PHI_MARKDOWN_WIDGET_PLUGIN = {
|
|
@@ -27,13 +28,25 @@ export const PHI_MARKDOWN_WIDGET_PLUGIN = {
|
|
|
27
28
|
});
|
|
28
29
|
return [...eyebrow, ...readPhiMarkdownSearchText(data.blocks)];
|
|
29
30
|
},
|
|
30
|
-
render: ({ widget, config, runtime }) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
render: async ({ widget, config, runtime, registry }) => {
|
|
32
|
+
/*
|
|
33
|
+
* A field of the page record takes the text's place: inline, in the page's language already, and
|
|
34
|
+
* nothing where the record does not have it.
|
|
35
|
+
*/
|
|
36
|
+
const recordField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.recordField, kinds: ["markdown", "text"] });
|
|
37
|
+
if (recordField.bound) {
|
|
38
|
+
return recordField.field?.value.trim()
|
|
39
|
+
? (_jsx(PhiMarkdownWidget, { config: { ...config, widgetId: widget.id, sourceMode: "inline", markdown: recordField.field.value, resolvedContent: null, translate: false }, runtime: runtime }, `widget-${widget.id}`))
|
|
40
|
+
: null;
|
|
41
|
+
}
|
|
42
|
+
return (_jsx(PhiMarkdownWidget, { config: {
|
|
43
|
+
...config,
|
|
44
|
+
widgetId: widget.id,
|
|
45
|
+
resolvedContent: widget.resolvedContent ?? null,
|
|
46
|
+
preferSource: hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate),
|
|
47
|
+
translate: !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate),
|
|
48
|
+
}, runtime: runtime }, `widget-${widget.id}`));
|
|
49
|
+
},
|
|
37
50
|
renderPreview: ({ widget, config, runtime }) => (_jsx(PhiWidgetInertPreview, { children: _jsx(PhiMarkdownWidget, { config: {
|
|
38
51
|
...config,
|
|
39
52
|
widgetId: widget.id,
|
|
@@ -16,5 +16,5 @@ export const PHI_RECORD_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(
|
|
|
16
16
|
key: field.key,
|
|
17
17
|
label: field.label,
|
|
18
18
|
full: field.full,
|
|
19
|
-
value: _jsx("span", { style: { color: "var(--
|
|
19
|
+
value: _jsx("span", { style: { color: "var(--phi-color-text-tertiary)" }, children: field.fieldKey }),
|
|
20
20
|
})) })));
|
|
@@ -110,6 +110,17 @@ export declare const PHI_RESULT_WIDGET_DEFINITION: {
|
|
|
110
110
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
111
111
|
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
112
112
|
heading?: string;
|
|
113
|
+
} & {
|
|
114
|
+
type: "record-field";
|
|
115
|
+
kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
|
|
116
|
+
}) | ({
|
|
117
|
+
key: string;
|
|
118
|
+
label: string;
|
|
119
|
+
description?: string;
|
|
120
|
+
required?: boolean;
|
|
121
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
122
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
123
|
+
heading?: string;
|
|
113
124
|
} & {
|
|
114
125
|
type: "dimension";
|
|
115
126
|
widthKey?: string;
|
|
@@ -23,6 +23,8 @@ export type PhiCmsSimpleTextWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
|
23
23
|
disabled?: boolean;
|
|
24
24
|
/** `"preset"` while the words are a Preset's and translated globally (`helpers/text-source.ts`). */
|
|
25
25
|
textSource?: PhiTextSource;
|
|
26
|
+
/** A text, number or date field of the page record to show instead of the Widget's own text. */
|
|
27
|
+
recordField?: string;
|
|
26
28
|
};
|
|
27
29
|
declare function parsePhiCmsSimpleTextWidgetConfig(config: Record<string, unknown>): PhiCmsSimpleTextWidgetConfig;
|
|
28
30
|
export type PhiSimpleTextWidgetRenderableConfig = PhiCmsSimpleTextWidgetConfig & {
|
|
@@ -117,6 +119,17 @@ export declare const PHI_SIMPLE_TEXT_WIDGET_DEFINITION: {
|
|
|
117
119
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
118
120
|
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
119
121
|
heading?: string;
|
|
122
|
+
} & {
|
|
123
|
+
type: "record-field";
|
|
124
|
+
kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
|
|
125
|
+
}) | ({
|
|
126
|
+
key: string;
|
|
127
|
+
label: string;
|
|
128
|
+
description?: string;
|
|
129
|
+
required?: boolean;
|
|
130
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
131
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
132
|
+
heading?: string;
|
|
120
133
|
} & {
|
|
121
134
|
type: "dimension";
|
|
122
135
|
widthKey?: string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PHI_RECORD_TEXT_FIELD_KINDS } from "../../../../../helpers/record-fields";
|
|
1
2
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
2
3
|
import { readPhiTextSource } from "../../../../../helpers/text-source";
|
|
3
4
|
import { PHI_SIMPLE_TEXT_MARKS } from "../../../../../types/core-widget-placements";
|
|
@@ -32,6 +33,7 @@ function parsePhiCmsSimpleTextWidgetConfig(config) {
|
|
|
32
33
|
letterSpacing: readPhiLetterSpacingStep(config.letterSpacing),
|
|
33
34
|
disabled: readBoolean(config.disabled),
|
|
34
35
|
textSource: readPhiTextSource(config.textSource),
|
|
36
|
+
recordField: readString(config.recordField),
|
|
35
37
|
};
|
|
36
38
|
}
|
|
37
39
|
export const PHI_SIMPLE_TEXT_WIDGET_DEFINITION = {
|
|
@@ -52,6 +54,13 @@ export const PHI_SIMPLE_TEXT_WIDGET_DEFINITION = {
|
|
|
52
54
|
fields: [
|
|
53
55
|
...PHI_RENDERABLE_BLOCK_GEOMETRY_FIELDS,
|
|
54
56
|
{ key: "text", type: "string", label: "Text", required: true },
|
|
57
|
+
{
|
|
58
|
+
key: "recordField",
|
|
59
|
+
type: "record-field",
|
|
60
|
+
label: "Record field",
|
|
61
|
+
description: "Shows a field of the record this page is about instead of the text. The text stands in where the page has no record.",
|
|
62
|
+
kinds: PHI_RECORD_TEXT_FIELD_KINDS,
|
|
63
|
+
},
|
|
55
64
|
{ key: "href", type: "url", label: "Href" },
|
|
56
65
|
{ key: "icon", type: "icon", label: "Icon", editorPlacement: "toolbar" },
|
|
57
66
|
{ key: "color", type: "color", label: "Color", mode: "single", editorPlacement: "toolbar" },
|
|
@@ -122,7 +122,7 @@ export function PhiSimpleTextWidgetEditor({ text, config, onChangeText, }) {
|
|
|
122
122
|
* form and wrong here -- the Widget stands on whatever its Region is painted with. Code text is
|
|
123
123
|
* the exception, because there the fill is part of how the text reads.
|
|
124
124
|
*/
|
|
125
|
-
backgroundColor: hasPhiSimpleTextMark(config, "code") ? "var(--
|
|
125
|
+
backgroundColor: hasPhiSimpleTextMark(config, "code") ? "var(--phi-color-fill-secondary, rgba(0, 0, 0, 0.04))" : "transparent",
|
|
126
126
|
}, fitContent: true, style: {
|
|
127
127
|
minWidth: 0,
|
|
128
128
|
flex: "0 0 auto",
|
|
@@ -2,6 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { PhiCmsFlags } from "../../../../../constants/phi-cms";
|
|
3
3
|
import { hasPhiFlag } from "../../../../../helpers/flags";
|
|
4
4
|
import { translatePhiSearchWidgetTexts } from "../../../../../server-helpers/search-text";
|
|
5
|
+
import { formatPhiRecordFieldText, PHI_RECORD_TEXT_FIELD_KINDS } from "../../../../../helpers/record-fields";
|
|
6
|
+
import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
|
|
5
7
|
import { PhiSimpleTextWidget } from "./server";
|
|
6
8
|
import { PHI_SIMPLE_TEXT_WIDGET_DEFINITION, PHI_SIMPLE_TEXT_WIDGET_PLUGIN_TYPE, resolvePhiSimpleTextWidgetText, } from "./config";
|
|
7
9
|
export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN = {
|
|
@@ -16,10 +18,21 @@ export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN = {
|
|
|
16
18
|
textSource: config.textSource,
|
|
17
19
|
});
|
|
18
20
|
},
|
|
19
|
-
render: ({ widget, config, runtime }) => {
|
|
21
|
+
render: async ({ widget, config, runtime, registry }) => {
|
|
20
22
|
const noTranslate = hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate);
|
|
21
23
|
// A record's text is already translated; only the Widget's own still has to be.
|
|
22
24
|
const hasResolvedText = Boolean(widget.resolvedContent?.textFields.text);
|
|
25
|
+
/*
|
|
26
|
+
* A field of the page record takes the text's place, in the page's language already. A record
|
|
27
|
+
* without the field leaves nothing to show; a Page about no record shows the Widget's own text.
|
|
28
|
+
*/
|
|
29
|
+
const recordField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.recordField, kinds: PHI_RECORD_TEXT_FIELD_KINDS });
|
|
30
|
+
if (recordField.bound) {
|
|
31
|
+
const text = recordField.field ? formatPhiRecordFieldText(recordField.field, runtime.locale.current) : "";
|
|
32
|
+
return text
|
|
33
|
+
? _jsx(PhiSimpleTextWidget, { blockId: widget.id, translate: false, labels: { text }, config: config, runtime: runtime }, `widget-${widget.id}`)
|
|
34
|
+
: null;
|
|
35
|
+
}
|
|
23
36
|
return (_jsx(PhiSimpleTextWidget, { blockId: widget.id, translate: !noTranslate && !hasResolvedText, textSource: config.textSource, labels: {
|
|
24
37
|
text: resolvePhiSimpleTextWidgetText({
|
|
25
38
|
...config,
|
|
@@ -52,6 +52,6 @@ export function PhiSpacerWidget({ config, }) {
|
|
|
52
52
|
background: isEditor ? "rgba(71, 85, 105, 0.035)" : "transparent",
|
|
53
53
|
boxShadow: isEditor ? "inset 0 0 0 1px rgba(71, 85, 105, 0.18)" : "none",
|
|
54
54
|
border: isEditor ? "1px dashed rgba(71, 85, 105, 0.45)" : "0",
|
|
55
|
-
borderRadius: isEditor ? "var(--
|
|
55
|
+
borderRadius: isEditor ? "var(--phi-border-radius-lg)" : 0,
|
|
56
56
|
}, children: isEditor ? (_jsx("div", { "aria-hidden": "true", className: "phi-builder-spacer", children: _jsx(SpacerGlyph, { orientation: orientation }) })) : null }) }));
|
|
57
57
|
}
|
|
@@ -135,6 +135,17 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
135
135
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
136
136
|
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
137
137
|
heading?: string;
|
|
138
|
+
} & {
|
|
139
|
+
type: "record-field";
|
|
140
|
+
kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
|
|
141
|
+
}) | ({
|
|
142
|
+
key: string;
|
|
143
|
+
label: string;
|
|
144
|
+
description?: string;
|
|
145
|
+
required?: boolean;
|
|
146
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
147
|
+
visibleWhen?: import("../../../../../types").PhiCmsConfigFieldVisibilityRule | readonly import("../../../../../types").PhiCmsConfigFieldVisibilityRule[];
|
|
148
|
+
heading?: string;
|
|
138
149
|
} & {
|
|
139
150
|
type: "dimension";
|
|
140
151
|
widthKey?: string;
|
|
@@ -438,6 +449,19 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
438
449
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
439
450
|
heading?: string;
|
|
440
451
|
type: "video-provider";
|
|
452
|
+
} | {
|
|
453
|
+
visibleWhen: {
|
|
454
|
+
field: string;
|
|
455
|
+
notEquals: string;
|
|
456
|
+
};
|
|
457
|
+
key: string;
|
|
458
|
+
label: string;
|
|
459
|
+
description?: string;
|
|
460
|
+
required?: boolean;
|
|
461
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
462
|
+
heading?: string;
|
|
463
|
+
type: "record-field";
|
|
464
|
+
kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
|
|
441
465
|
} | {
|
|
442
466
|
visibleWhen: {
|
|
443
467
|
field: string;
|
|
@@ -804,6 +828,19 @@ export declare const PHI_TABLE_WIDGET_DEFINITION: {
|
|
|
804
828
|
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
805
829
|
heading?: string;
|
|
806
830
|
type: "video-provider";
|
|
831
|
+
} | {
|
|
832
|
+
visibleWhen: {
|
|
833
|
+
field: string;
|
|
834
|
+
equals: boolean;
|
|
835
|
+
};
|
|
836
|
+
key: string;
|
|
837
|
+
label: string;
|
|
838
|
+
description?: string;
|
|
839
|
+
required?: boolean;
|
|
840
|
+
editorPlacement?: "inspector" | "geometry" | "toolbar";
|
|
841
|
+
heading?: string;
|
|
842
|
+
type: "record-field";
|
|
843
|
+
kinds: readonly import("../../../../../constants/record-field-kinds").PhiRecordFieldKind[];
|
|
807
844
|
} | {
|
|
808
845
|
visibleWhen: {
|
|
809
846
|
field: string;
|
|
@@ -114,6 +114,14 @@ export function compilePhiCmsRoutePattern(descriptor) {
|
|
|
114
114
|
if (dynamicSegments.length > 1) {
|
|
115
115
|
throw new Error(`${descriptor.ownerModuleId}/${descriptor.presetKey}: a route may contain at most one dynamic segment.`);
|
|
116
116
|
}
|
|
117
|
+
// A page record is filled in from the address, so every route parameter it names has to be in the path.
|
|
118
|
+
if (descriptor.pageRecord) {
|
|
119
|
+
const routeParams = new Set(dynamicSegments.map((segment) => segment.slice(1)));
|
|
120
|
+
const named = Object.values(descriptor.pageRecord.params);
|
|
121
|
+
if (named.length === 0 || named.some((param) => !routeParams.has(param))) {
|
|
122
|
+
throw new Error(`${descriptor.ownerModuleId}/${descriptor.presetKey}: a page record's params must each name a parameter of the route path.`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
117
125
|
for (const segment of segments) {
|
|
118
126
|
if (segment.includes("*") ||
|
|
119
127
|
segment.includes("?") ||
|
|
@@ -43,5 +43,6 @@ export declare const PHI_EDITOR_RUNTIME_MODULE_ROUTES: (PhiCmsRoutePresetDescrip
|
|
|
43
43
|
activeModuleIds: ReadonlySet<import("../contracts").PhiRuntimeModuleId>;
|
|
44
44
|
params: Readonly<Record<string, string>>;
|
|
45
45
|
}) => import("../../../types").PhiResolvedCmsPageTree | Promise<import("../../../types").PhiResolvedCmsPageTree>;
|
|
46
|
+
pageRecord?: import("../../../types/record-provider").PhiCmsPageRecordDescriptor;
|
|
46
47
|
navigation?: readonly import("../../../types").PhiCmsNavigationInjectionDescriptor[];
|
|
47
48
|
})[];
|
|
@@ -250,7 +250,7 @@ export declare const PHI_GROUPS_RUNTIME_MODULE_DEFINITION: {
|
|
|
250
250
|
iconFamily: string;
|
|
251
251
|
mediaSpaces: {
|
|
252
252
|
group: {
|
|
253
|
-
kinds: ("image" | "
|
|
253
|
+
kinds: ("image" | "markdown" | "video" | "audio" | "pdf" | "document" | "archive")[];
|
|
254
254
|
};
|
|
255
255
|
};
|
|
256
256
|
threadKinds: ("group" | "crossGroup")[];
|
|
@@ -42,5 +42,6 @@ export declare const PHI_LOCALIZATION_RUNTIME_MODULE_ROUTES: (PhiCmsRoutePresetD
|
|
|
42
42
|
activeModuleIds: ReadonlySet<import("../contracts").PhiRuntimeModuleId>;
|
|
43
43
|
params: Readonly<Record<string, string>>;
|
|
44
44
|
}) => import("../../../types").PhiResolvedCmsPageTree | Promise<import("../../../types").PhiResolvedCmsPageTree>;
|
|
45
|
+
pageRecord?: import("../../../types/record-provider").PhiCmsPageRecordDescriptor;
|
|
45
46
|
navigation?: readonly import("../../../types").PhiCmsNavigationInjectionDescriptor[];
|
|
46
47
|
})[];
|
|
@@ -49,5 +49,6 @@ export declare const PHI_NEWS_RUNTIME_MODULE_ROUTES: ({
|
|
|
49
49
|
activeModuleIds: ReadonlySet<import("../contracts").PhiRuntimeModuleId>;
|
|
50
50
|
params: Readonly<Record<string, string>>;
|
|
51
51
|
}) => import("../../../types").PhiResolvedCmsPageTree | Promise<import("../../../types").PhiResolvedCmsPageTree>;
|
|
52
|
+
pageRecord?: import("../../../types/record-provider").PhiCmsPageRecordDescriptor;
|
|
52
53
|
navigation?: readonly import("../../../types").PhiCmsNavigationInjectionDescriptor[];
|
|
53
54
|
})[];
|
|
@@ -618,6 +618,8 @@ export async function resolvePhiRuntimeRenderRegistry({ catalog, moduleSet, tree
|
|
|
618
618
|
* binding names a Provider, not the Module whose Widget it sits in.
|
|
619
619
|
*/
|
|
620
620
|
recordProviderLoadersByKey: new Map([...moduleSet.moduleDefinitionsById.keys()].flatMap((moduleId) => (catalog.get(moduleId)?.recordProviders ?? []).map((provider) => [provider.key, provider.load]))),
|
|
621
|
+
recordFieldsLoadersByKey: new Map([...moduleSet.moduleDefinitionsById.keys()].flatMap((moduleId) => (catalog.get(moduleId)?.recordProviders ?? []).flatMap((provider) => provider.loadFields ? [[provider.key, provider.loadFields]] : []))),
|
|
622
|
+
recordSamplesLoadersByKey: new Map([...moduleSet.moduleDefinitionsById.keys()].flatMap((moduleId) => (catalog.get(moduleId)?.recordProviders ?? []).flatMap((provider) => provider.loadSamples ? [[provider.key, provider.loadSamples]] : []))),
|
|
621
623
|
dataProviderDescriptorsByKey,
|
|
622
624
|
formDefinitionsById: moduleSet.formDefinitionsById,
|
|
623
625
|
};
|
|
@@ -49,5 +49,6 @@ export declare const PHI_REVISIONS_RUNTIME_MODULE_ROUTES: {
|
|
|
49
49
|
activeModuleIds: ReadonlySet<import("../contracts").PhiRuntimeModuleId>;
|
|
50
50
|
params: Readonly<Record<string, string>>;
|
|
51
51
|
}) => import("../../../types").PhiResolvedCmsPageTree | Promise<import("../../../types").PhiResolvedCmsPageTree>;
|
|
52
|
+
pageRecord?: import("../../../types/record-provider").PhiCmsPageRecordDescriptor;
|
|
52
53
|
navigation?: readonly import("../../../types").PhiCmsNavigationInjectionDescriptor[];
|
|
53
54
|
}[];
|
|
@@ -80,5 +80,6 @@ export declare const PHI_THEME_RUNTIME_MODULE_ROUTES: {
|
|
|
80
80
|
activeModuleIds: ReadonlySet<import("../contracts").PhiRuntimeModuleId>;
|
|
81
81
|
params: Readonly<Record<string, string>>;
|
|
82
82
|
}) => import("../../../types").PhiResolvedCmsPageTree | Promise<import("../../../types").PhiResolvedCmsPageTree>;
|
|
83
|
+
pageRecord?: import("../../../types/record-provider").PhiCmsPageRecordDescriptor;
|
|
83
84
|
navigation?: readonly import("../../../types").PhiCmsNavigationInjectionDescriptor[];
|
|
84
85
|
}[];
|