@phis/ui 0.6.4 → 0.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-layout-renderer.js +11 -2
- package/components/controls/phi-image-control.js +9 -1
- package/components/controls/phi-multi-select-control.js +4 -2
- package/components/controls/phi-options-provider.d.ts +1 -0
- package/components/controls/phi-options-provider.js +1 -0
- package/components/controls/phi-select-control.d.ts +21 -0
- package/components/controls/phi-select-control.js +2 -2
- package/components/controls/phi-status-dot-control.d.ts +15 -0
- package/components/controls/phi-status-dot-control.js +25 -0
- package/components/controls/phi-table-control.js +8 -1
- package/components/controls/phi-tree-control.js +5 -4
- package/components/controls/phi-tree-select-control.js +1 -0
- package/components/forms/auth-admin-settings-labels.d.ts +4 -0
- package/components/forms/auth-admin-settings-labels.js +11 -3
- package/components/forms/form-provider-contract.d.ts +1 -1
- package/components/forms/form-provider-contract.js +1 -1
- package/components/layouts/clients/phi-split-card-half.d.ts +4 -1
- package/components/layouts/clients/phi-split-card-half.js +2 -2
- package/components/layouts/clients/phi-split-card-layout-client.d.ts +6 -3
- package/components/layouts/clients/phi-split-card-layout-client.js +5 -3
- package/components/layouts/clients/phi-three-column-layout-client.d.ts +20 -1
- package/components/layouts/clients/phi-three-column-layout-client.js +31 -15
- package/components/layouts/layout-definitions.d.ts +96 -0
- package/components/layouts/layout-definitions.js +40 -2
- package/components/layouts/plugins/split-card-layout-plugin.js +1 -1
- package/components/layouts/plugins/three-column-layout-plugin.js +1 -1
- package/components/layouts/split-card-geometry.d.ts +9 -4
- package/components/layouts/split-card-geometry.js +29 -13
- package/components/media/media-folder-options.d.ts +10 -0
- package/components/media/media-folder-options.js +14 -0
- package/components/navigation/phi-link.d.ts +7 -1
- package/components/navigation/phi-link.js +6 -2
- package/components/root/phi-root-theme-resolver.js +2 -0
- package/components/shell/phi-antd-icon.d.ts +1 -0
- package/components/shell/phi-antd-icon.js +3 -0
- package/components/widgets/client/shared/phi-rendered-value.js +1 -1
- package/components/widgets/inspector-field-row.js +4 -1
- package/components/widgets/label-sets/account.js +6 -2
- package/components/widgets/label-sets/admin-users.d.ts +3 -0
- package/components/widgets/label-sets/admin-users.js +8 -2
- package/components/widgets/label-sets/effects.js +5 -1
- package/components/widgets/label-sets/gallery.js +2 -2
- package/components/widgets/label-sets/inspector.js +4 -0
- package/components/widgets/label-sets/observability-logs.js +2 -2
- package/components/widgets/label-sets/profile.js +2 -1
- package/components/widgets/label-types/gallery.d.ts +2 -3
- package/components/widgets/label-types/gallery.js +1 -4
- package/components/widgets/label-types/inspector.d.ts +4 -0
- package/components/widgets/label-types/inspector.js +2 -0
- package/components/widgets/shared/markdown-body-client.js +1 -1
- package/components/widgets/shared/markdown-image-vocabulary.js +1 -1
- package/constants/cms-layout-proportions.d.ts +6 -0
- package/constants/cms-layout-proportions.js +17 -0
- package/constants/runtime-module-ownership.js +1 -0
- package/helpers/page-reference-tree.js +8 -0
- package/helpers/table-action-links.d.ts +11 -0
- package/helpers/table-action-links.js +14 -0
- package/helpers/table-action-row-link.d.ts +8 -0
- package/helpers/table-action-row-link.js +14 -0
- package/package.json +2 -2
- package/plugins/factories/widget-renderers.d.ts +7 -1
- package/plugins/factories/widget-renderers.js +12 -2
- package/plugins/runtime-modules/asset/authoring-widgets.js +2 -2
- package/plugins/runtime-modules/asset/data-providers.js +1 -1
- package/plugins/runtime-modules/asset/services/options.js +7 -11
- package/plugins/runtime-modules/asset/widgets/area-upload/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets/image-inspector/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets/media-picker/plugin.js +0 -2
- package/plugins/runtime-modules/asset/widgets.js +4 -4
- package/plugins/runtime-modules/auth/admin-settings-forms.js +47 -1
- package/plugins/runtime-modules/auth/authoring-widgets.js +4 -8
- package/plugins/runtime-modules/auth/data-providers.js +2 -0
- package/plugins/runtime-modules/auth/widgets/auth-workflow/plugin.js +0 -6
- package/plugins/runtime-modules/auth/widgets/logout/plugin.js +0 -2
- package/plugins/runtime-modules/auth/widgets/security/plugin.js +0 -2
- package/plugins/runtime-modules/auth/widgets.js +5 -3
- package/plugins/runtime-modules/avatar/authoring-widgets.js +2 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar/plugin.js +0 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/plugin.js +0 -2
- package/plugins/runtime-modules/avatar/widgets.js +2 -2
- package/plugins/runtime-modules/builder/authoring-widgets.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.d.ts +28 -0
- package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.js +98 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +27 -3
- package/plugins/runtime-modules/builder/clients/inspector-record-field-options.d.ts +17 -0
- package/plugins/runtime-modules/builder/clients/inspector-record-field-options.js +21 -0
- package/plugins/runtime-modules/builder/clients/inspector-translate-switch.d.ts +24 -0
- package/plugins/runtime-modules/builder/clients/inspector-translate-switch.js +29 -0
- package/plugins/runtime-modules/builder/clients/layout-inspector.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/layout-inspector.js +4 -2
- package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +6 -6
- package/plugins/runtime-modules/builder/plugin-meta-labels.js +17 -0
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +12 -2
- package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +0 -2
- package/plugins/runtime-modules/builder/widgets.js +3 -3
- package/plugins/runtime-modules/contracts.js +8 -4
- package/plugins/runtime-modules/core/authoring-widgets.js +2 -2
- package/plugins/runtime-modules/core/data-providers.d.ts +7 -3
- package/plugins/runtime-modules/core/data-providers.js +11 -1
- package/plugins/runtime-modules/core/definition.d.ts +8 -4
- package/plugins/runtime-modules/core/form-providers.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/cascader/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/draft-status/client.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/draft-status/client.js +4 -3
- package/plugins/runtime-modules/core/widgets/gallery/authoring.js +6 -8
- package/plugins/runtime-modules/core/widgets/gallery/client.js +4 -0
- package/plugins/runtime-modules/core/widgets/gallery/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -4
- package/plugins/runtime-modules/core/widgets/image/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +24 -22
- package/plugins/runtime-modules/core/widgets/record/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/client.d.ts +9 -5
- package/plugins/runtime-modules/core/widgets/simple-text/client.js +5 -7
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +63 -4
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +45 -11
- package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.d.ts +13 -0
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +23 -4
- package/plugins/runtime-modules/core/widgets/simple-text/server.d.ts +4 -2
- package/plugins/runtime-modules/core/widgets/simple-text/server.js +7 -6
- package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
- package/plugins/runtime-modules/core/widgets/table/config.js +12 -4
- package/plugins/runtime-modules/core/widgets/table/plugin.js +21 -1
- package/plugins/runtime-modules/core/widgets/thread-conversation/plugin.js +0 -2
- package/plugins/runtime-modules/core/widgets/tree/config.js +2 -1
- package/plugins/runtime-modules/core/widgets/tree/plugin.js +16 -1
- package/plugins/runtime-modules/core/widgets.js +1 -1
- package/plugins/runtime-modules/observability/data-providers.js +1 -1
- package/plugins/runtime-modules/theme/authoring-widgets.js +5 -5
- package/plugins/runtime-modules/theme/brand-theme-model.d.ts +4 -1
- package/plugins/runtime-modules/theme/brand-theme-model.js +6 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +0 -5
- package/plugins/runtime-modules/theme/widgets.js +4 -4
- package/plugins/runtime-modules/threads/labels.js +6 -2
- package/plugins/runtime-modules/user-management/addon-roles.d.ts +28 -7
- package/plugins/runtime-modules/user-management/addon-roles.js +42 -17
- package/plugins/runtime-modules/user-management/client-data-providers.js +6 -0
- package/plugins/runtime-modules/user-management/data-providers.js +11 -2
- package/plugins/runtime-modules/user-management/forms.js +40 -1
- package/plugins/runtime-modules/user-management/ids.d.ts +1 -0
- package/plugins/runtime-modules/user-management/ids.js +1 -0
- package/plugins/runtime-modules/user-management/services/options.d.ts +14 -3
- package/plugins/runtime-modules/user-management/services/options.js +52 -16
- package/plugins/runtime-modules/user-management/services/table.js +8 -24
- package/plugins/runtime-modules/user-management/services/users-query.d.ts +9 -0
- package/plugins/runtime-modules/user-management/services/users-query.js +29 -0
- package/plugins/runtime-modules/video/widgets/embed/plugin.js +0 -2
- package/plugins/runtime-modules/video/widgets.js +1 -1
- package/styles/controls.css +20 -0
- package/styles/layout.css +4 -4
- package/theme/phi-link-mark.d.ts +26 -0
- package/theme/phi-link-mark.js +26 -0
- package/theme/phi-theme-tokens.d.ts +3 -2
- package/theme/phi-theme-tokens.js +3 -1
- package/types/cms-config.d.ts +12 -4
- package/types/cms-config.js +3 -0
- package/types/cms-plugins.d.ts +26 -4
- package/types/core-widget-placements.d.ts +4 -4
- package/types/site-config.d.ts +3 -0
- package/types/table-widget.d.ts +17 -1
- package/types/tree.d.ts +2 -0
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.d.ts +0 -2
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.js +0 -6
- package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.d.ts +0 -2
- package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +0 -6
- package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.d.ts +0 -7
- package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.js +0 -12
- package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.d.ts +0 -7
- package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.js +0 -12
- package/plugins/runtime-modules/auth/widgets/logout/authoring.d.ts +0 -3
- package/plugins/runtime-modules/auth/widgets/logout/authoring.js +0 -8
- package/plugins/runtime-modules/auth/widgets/security/authoring.d.ts +0 -3
- package/plugins/runtime-modules/auth/widgets/security/authoring.js +0 -8
- package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.d.ts +0 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.js +0 -6
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.d.ts +0 -2
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.js +0 -6
- package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.d.ts +0 -22
- package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.js +0 -8
- package/plugins/runtime-modules/core/widgets/form-preview/authoring.d.ts +0 -10
- package/plugins/runtime-modules/core/widgets/form-preview/authoring.js +0 -15
- package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.d.ts +0 -3
- package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.js +0 -9
- package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.d.ts +0 -76
- package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.js +0 -30
|
@@ -4,7 +4,8 @@ import { readPhiTextSource } from "../../../../../helpers/text-source";
|
|
|
4
4
|
import { PHI_SIMPLE_TEXT_MARKS } from "../../../../../types/core-widget-placements";
|
|
5
5
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
6
6
|
import { PHI_RENDERABLE_BLOCK_GEOMETRY_FIELDS } from "../../../../../helpers/renderable-block-plugin-fields";
|
|
7
|
-
import {
|
|
7
|
+
import { readPhiLinkTarget } from "../../../../../types/references";
|
|
8
|
+
import { readRenderableBlockConfig, readString, } from "../../../../../components/widgets/config/parser-primitives";
|
|
8
9
|
import { PHI_WIDGET_FONT_FAMILY_OPTIONS, readPhiWidgetFontFamily, } from "../../../../../components/widgets/helpers/font-family";
|
|
9
10
|
import { PHI_WIDGET_FONT_SIZE_OPTIONS, readPhiWidgetFontSize, } from "../../../../../components/widgets/helpers/font-size";
|
|
10
11
|
import { PHI_LETTER_SPACING_FIELD_OPTIONS, PHI_TEXT_TRANSFORM_FIELD_OPTIONS, readPhiLetterSpacingStep, readPhiTextTransform, } from "../../../../../components/widgets/config/text-case-vocabulary";
|
|
@@ -20,18 +21,16 @@ function parsePhiCmsSimpleTextWidgetConfig(config) {
|
|
|
20
21
|
return {
|
|
21
22
|
...renderableBlockConfig,
|
|
22
23
|
text: readString(config.text),
|
|
23
|
-
|
|
24
|
+
linkTarget: readPhiLinkTarget(config.linkTarget) ?? undefined,
|
|
25
|
+
linkRecordField: readString(config.linkRecordField),
|
|
24
26
|
icon: readString(config.icon),
|
|
25
27
|
color: readString(config.color),
|
|
26
28
|
fontFamily: readPhiWidgetFontFamily(config.fontFamily),
|
|
27
29
|
fontSize: readPhiWidgetFontSize(config.fontSize),
|
|
28
|
-
external: readBoolean(config.external),
|
|
29
|
-
newTab: readBoolean(config.newTab),
|
|
30
30
|
tone: readPhiTextTone(config.tone),
|
|
31
31
|
marks: readSimpleTextMarks(config.marks),
|
|
32
32
|
textTransform: readPhiTextTransform(config.textTransform),
|
|
33
33
|
letterSpacing: readPhiLetterSpacingStep(config.letterSpacing),
|
|
34
|
-
disabled: readBoolean(config.disabled),
|
|
35
34
|
textSource: readPhiTextSource(config.textSource),
|
|
36
35
|
recordField: readString(config.recordField),
|
|
37
36
|
};
|
|
@@ -53,15 +52,18 @@ export const PHI_SIMPLE_TEXT_WIDGET_DEFINITION = {
|
|
|
53
52
|
},
|
|
54
53
|
fields: [
|
|
55
54
|
...PHI_RENDERABLE_BLOCK_GEOMETRY_FIELDS,
|
|
56
|
-
|
|
55
|
+
/*
|
|
56
|
+
* No `text` field: the words are written on the canvas, as a Card's and a Markdown's are. The Widget
|
|
57
|
+
* translates them itself (`translatesOwnText`), so nothing reads the field list to find them.
|
|
58
|
+
*/
|
|
57
59
|
{
|
|
58
60
|
key: "recordField",
|
|
59
61
|
type: "record-field",
|
|
60
|
-
|
|
62
|
+
heading: "Text",
|
|
63
|
+
label: "Record",
|
|
61
64
|
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
65
|
kinds: PHI_RECORD_TEXT_FIELD_KINDS,
|
|
63
66
|
},
|
|
64
|
-
{ key: "href", type: "url", label: "Href" },
|
|
65
67
|
{ key: "icon", type: "icon", label: "Icon", editorPlacement: "toolbar" },
|
|
66
68
|
{ key: "color", type: "color", label: "Color", mode: "single", editorPlacement: "toolbar" },
|
|
67
69
|
{
|
|
@@ -78,11 +80,31 @@ export const PHI_SIMPLE_TEXT_WIDGET_DEFINITION = {
|
|
|
78
80
|
editorPlacement: "toolbar",
|
|
79
81
|
options: [...PHI_WIDGET_FONT_SIZE_OPTIONS],
|
|
80
82
|
},
|
|
83
|
+
/*
|
|
84
|
+
* A tone and a colour of the author's own exclude each other: the colour is what draws while both
|
|
85
|
+
* are set, so choosing a tone takes the colour away, and the toolbar's colour takes the tone away
|
|
86
|
+
* (`editor.tsx`). The field is declared twice, each shown in one of the two states, because that is
|
|
87
|
+
* what the choice vocabulary can say without a property of its own: while a colour is set the select
|
|
88
|
+
* reads "Custom" -- its empty line, never stored -- and picking a tone from there clears the colour.
|
|
89
|
+
*/
|
|
90
|
+
{
|
|
91
|
+
key: "tone",
|
|
92
|
+
type: "choice",
|
|
93
|
+
label: "Tone",
|
|
94
|
+
visibleWhen: { field: "color", equals: null },
|
|
95
|
+
emptyOption: { value: "default", label: "Default" },
|
|
96
|
+
emptyValue: undefined,
|
|
97
|
+
options: [...PHI_TEXT_TONE_FIELD_OPTIONS],
|
|
98
|
+
},
|
|
81
99
|
{
|
|
82
100
|
key: "tone",
|
|
83
101
|
type: "choice",
|
|
84
102
|
label: "Tone",
|
|
103
|
+
visibleWhen: { field: "color", notEquals: null },
|
|
104
|
+
emptyOption: { value: "custom", label: "Custom" },
|
|
105
|
+
emptyValue: undefined,
|
|
85
106
|
options: [...PHI_TEXT_TONE_FIELD_OPTIONS],
|
|
107
|
+
patchOnChange: { color: undefined },
|
|
86
108
|
},
|
|
87
109
|
{
|
|
88
110
|
key: "textTransform",
|
|
@@ -96,10 +118,15 @@ export const PHI_SIMPLE_TEXT_WIDGET_DEFINITION = {
|
|
|
96
118
|
label: "Letter Spacing",
|
|
97
119
|
options: [...PHI_LETTER_SPACING_FIELD_OPTIONS],
|
|
98
120
|
},
|
|
99
|
-
{ key: "external", type: "boolean", label: "External" },
|
|
100
|
-
{ key: "newTab", type: "boolean", label: "Open In New Tab" },
|
|
101
121
|
{ key: "marks", type: "string", label: "Marks", editorPlacement: "toolbar" },
|
|
102
|
-
{ key: "
|
|
122
|
+
{ key: "linkTarget", type: "link-target", heading: "Link target", label: "Link target" },
|
|
123
|
+
{
|
|
124
|
+
key: "linkRecordField",
|
|
125
|
+
type: "record-field",
|
|
126
|
+
label: "Link from record",
|
|
127
|
+
description: "Leads where a field of the record this page is about leads, instead of the target above.",
|
|
128
|
+
kinds: ["link"],
|
|
129
|
+
},
|
|
103
130
|
],
|
|
104
131
|
defaultConfig: {
|
|
105
132
|
/*
|
|
@@ -125,3 +152,10 @@ export function resolvePhiSimpleTextWidgetText(config, options, fallbackText = "
|
|
|
125
152
|
return config?.text ?? config?.label ?? fallbackText;
|
|
126
153
|
}
|
|
127
154
|
export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN_TYPE = PhiCmsWidgetType.SimpleText;
|
|
155
|
+
/**
|
|
156
|
+
* The patch the toolbar's colour writes: a colour of the author's own replaces the tone, because the two
|
|
157
|
+
* exclude each other and the colour is what would draw. Taking the colour away leaves the default tone.
|
|
158
|
+
*/
|
|
159
|
+
export function applyPhiSimpleTextColor(color) {
|
|
160
|
+
return color ? { color, tone: undefined } : { color: undefined };
|
|
161
|
+
}
|
|
@@ -11,7 +11,7 @@ import { PhiWidgetColorToolButton, PhiWidgetIconToolButton, PhiWidgetTypographyT
|
|
|
11
11
|
import { usePhiWidgetScaffoldPopup } from "../../../../../components/widgets/client/shared/phi-widget-scaffold-popup";
|
|
12
12
|
import { usePhiAuthoringToolsLabels } from "../../../../../components/widgets/client/shared/phi-authoring-tools-labels";
|
|
13
13
|
import { PHI_SIMPLE_TEXT_MARKS } from "../../../../../types/core-widget-placements";
|
|
14
|
-
import { resolvePhiSimpleTextWidgetText, } from "./config";
|
|
14
|
+
import { applyPhiSimpleTextColor, resolvePhiSimpleTextWidgetText, } from "./config";
|
|
15
15
|
import { hasPhiSimpleTextMark } from "./marks";
|
|
16
16
|
import { resolvePhiWidgetFontFamily } from "../../../../../components/widgets/helpers/font-family";
|
|
17
17
|
import { resolvePhiWidgetFontSize } from "../../../../../components/widgets/helpers/font-size";
|
|
@@ -138,5 +138,5 @@ export function PhiSimpleTextWidgetEditorPluginBody({ label, config, onChange, }
|
|
|
138
138
|
}
|
|
139
139
|
export function PhiSimpleTextWidgetEditorPluginTools({ config, onChange, }) {
|
|
140
140
|
const labels = usePhiAuthoringToolsLabels();
|
|
141
|
-
return (_jsxs(_Fragment, { children: [_jsx(PhiWidgetIconToolButton, { value: config.icon ?? null, ariaLabel: labels.text.icon, onChange: (icon) => onChange({ icon: icon ?? undefined }) }), _jsx(PhiSimpleTextWidgetColorButton, { config: config, onChange: (color) => onChange(
|
|
141
|
+
return (_jsxs(_Fragment, { children: [_jsx(PhiWidgetIconToolButton, { value: config.icon ?? null, ariaLabel: labels.text.icon, onChange: (icon) => onChange({ icon: icon ?? undefined }) }), _jsx(PhiSimpleTextWidgetColorButton, { config: config, onChange: (color) => onChange(applyPhiSimpleTextColor(color)) }), _jsx(PhiSimpleTextWidgetTypographyButton, { config: config, onChange: onChange }), _jsx(PhiSimpleTextWidgetStyleButton, { config: config, onChange: onChange })] }));
|
|
142
142
|
}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import type { PhiCmsServerWidgetPlugin } from "../../../../../types";
|
|
2
|
+
import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
|
|
3
|
+
import type { PhiBlockRuntime } from "../../../../../types";
|
|
4
|
+
import type { PhiResolvedLinkTargets } from "../../../../../types/references";
|
|
5
|
+
import type { PhiSimpleTextWidgetLink } from "./client";
|
|
2
6
|
import { PHI_SIMPLE_TEXT_WIDGET_PLUGIN_TYPE, type PhiCmsSimpleTextWidgetConfig } from "./config";
|
|
7
|
+
/**
|
|
8
|
+
* Where the text leads, resolved here so the address travels and not the reference.
|
|
9
|
+
*
|
|
10
|
+
* A link field of the page record wins over the stored target, as on the Button. Where the record lacks
|
|
11
|
+
* that field the text stays and leads nowhere: unlike a Button, a text without its link still has its
|
|
12
|
+
* words to show. A Page target that did not resolve -- deleted, unpublished, its Module off -- is no
|
|
13
|
+
* link either (`REFERENCES.md`).
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolvePhiSimpleTextLink(config: Pick<PhiCmsSimpleTextWidgetConfig, "linkTarget" | "linkRecordField">, runtime: PhiBlockRuntime, registry: Parameters<typeof resolvePhiWidgetRecordField>[0]["registry"], links: PhiResolvedLinkTargets | null | undefined): Promise<PhiSimpleTextWidgetLink | null>;
|
|
3
16
|
export declare const PHI_SIMPLE_TEXT_WIDGET_PLUGIN: PhiCmsServerWidgetPlugin<PhiCmsSimpleTextWidgetConfig>;
|
|
4
17
|
export { PHI_SIMPLE_TEXT_WIDGET_PLUGIN_TYPE };
|
|
@@ -4,8 +4,26 @@ import { hasPhiFlag } from "../../../../../helpers/flags";
|
|
|
4
4
|
import { translatePhiSearchWidgetTexts } from "../../../../../server-helpers/search-text";
|
|
5
5
|
import { formatPhiRecordFieldText, PHI_RECORD_TEXT_FIELD_KINDS } from "../../../../../helpers/record-fields";
|
|
6
6
|
import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
|
|
7
|
+
import { isPhiExternalHref } from "../../../../../helpers/external-href";
|
|
8
|
+
import { resolvePhiLinkHref } from "../../../../../helpers/link-target";
|
|
7
9
|
import { PhiSimpleTextWidget } from "./server";
|
|
8
10
|
import { PHI_SIMPLE_TEXT_WIDGET_DEFINITION, PHI_SIMPLE_TEXT_WIDGET_PLUGIN_TYPE, resolvePhiSimpleTextWidgetText, } from "./config";
|
|
11
|
+
/**
|
|
12
|
+
* Where the text leads, resolved here so the address travels and not the reference.
|
|
13
|
+
*
|
|
14
|
+
* A link field of the page record wins over the stored target, as on the Button. Where the record lacks
|
|
15
|
+
* that field the text stays and leads nowhere: unlike a Button, a text without its link still has its
|
|
16
|
+
* words to show. A Page target that did not resolve -- deleted, unpublished, its Module off -- is no
|
|
17
|
+
* link either (`REFERENCES.md`).
|
|
18
|
+
*/
|
|
19
|
+
export async function resolvePhiSimpleTextLink(config, runtime, registry, links) {
|
|
20
|
+
const linkField = await resolvePhiWidgetRecordField({ registry, runtime, key: config.linkRecordField, kinds: ["link"] });
|
|
21
|
+
if (linkField.bound) {
|
|
22
|
+
const href = linkField.field?.value.href;
|
|
23
|
+
return href ? { href, newTab: false, external: isPhiExternalHref(href) } : null;
|
|
24
|
+
}
|
|
25
|
+
return resolvePhiLinkHref(config.linkTarget, links);
|
|
26
|
+
}
|
|
9
27
|
export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN = {
|
|
10
28
|
...PHI_SIMPLE_TEXT_WIDGET_DEFINITION,
|
|
11
29
|
// The text as the render shows it: a record's already in the page's language, the Widget's own translated here.
|
|
@@ -18,7 +36,8 @@ export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN = {
|
|
|
18
36
|
textSource: config.textSource,
|
|
19
37
|
});
|
|
20
38
|
},
|
|
21
|
-
render: async ({ widget, config, runtime, registry }) => {
|
|
39
|
+
render: async ({ widget, config, runtime, registry, links }) => {
|
|
40
|
+
const link = await resolvePhiSimpleTextLink(config, runtime, registry, links);
|
|
22
41
|
const noTranslate = hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate);
|
|
23
42
|
// A record's text is already translated; only the Widget's own still has to be.
|
|
24
43
|
const hasResolvedText = Boolean(widget.resolvedContent?.textFields.text);
|
|
@@ -30,10 +49,10 @@ export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN = {
|
|
|
30
49
|
if (recordField.bound) {
|
|
31
50
|
const text = recordField.field ? formatPhiRecordFieldText(recordField.field, runtime.locale.current, runtime.site.timeZone) : "";
|
|
32
51
|
return text
|
|
33
|
-
? _jsx(PhiSimpleTextWidget, { blockId: widget.id, translate: false, labels: { text }, config: config, runtime: runtime }, `widget-${widget.id}`)
|
|
52
|
+
? _jsx(PhiSimpleTextWidget, { blockId: widget.id, translate: false, labels: { text }, config: config, link: link, runtime: runtime }, `widget-${widget.id}`)
|
|
34
53
|
: null;
|
|
35
54
|
}
|
|
36
|
-
return (_jsx(PhiSimpleTextWidget, { blockId: widget.id, translate: !noTranslate && !hasResolvedText, textSource: config.textSource, labels: {
|
|
55
|
+
return (_jsx(PhiSimpleTextWidget, { blockId: widget.id, translate: !noTranslate && !hasResolvedText, textSource: config.textSource, link: link, labels: {
|
|
37
56
|
text: resolvePhiSimpleTextWidgetText({
|
|
38
57
|
...config,
|
|
39
58
|
label: widget.label ?? undefined,
|
|
@@ -44,7 +63,7 @@ export const PHI_SIMPLE_TEXT_WIDGET_PLUGIN = {
|
|
|
44
63
|
}, "Text"),
|
|
45
64
|
}, config: config, runtime: runtime }, `widget-${widget.id}`));
|
|
46
65
|
},
|
|
47
|
-
renderPreview: ({ widget, config, runtime }) => (_jsx(PhiSimpleTextWidget, { blockId: widget.id, labels: {
|
|
66
|
+
renderPreview: async ({ widget, config, runtime, registry, links }) => (_jsx(PhiSimpleTextWidget, { blockId: widget.id, link: await resolvePhiSimpleTextLink(config, runtime, registry, links), labels: {
|
|
48
67
|
text: resolvePhiSimpleTextWidgetText({
|
|
49
68
|
...config,
|
|
50
69
|
label: widget.label ?? undefined,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PhiTextSource } from "../../../../../helpers/text-source";
|
|
2
2
|
import type { PhiCmsInstanceId, PhiRenderableBlockBase, PhiServerBlockBaseProps } from "../../../../../types";
|
|
3
|
-
import type { PhiSimpleTextWidgetClientConfig } from "./client";
|
|
3
|
+
import type { PhiSimpleTextWidgetClientConfig, PhiSimpleTextWidgetLink } from "./client";
|
|
4
4
|
export type PhiSimpleTextWidgetLabels = {
|
|
5
5
|
text: string;
|
|
6
6
|
};
|
|
@@ -18,5 +18,7 @@ export type PhiSimpleTextWidgetProps = PhiServerBlockBaseProps<PhiSimpleTextWidg
|
|
|
18
18
|
* written in while the Description and Card Widgets beside it were translating theirs.
|
|
19
19
|
*/
|
|
20
20
|
translate?: boolean;
|
|
21
|
+
/** Where the text leads, resolved by the caller from the target or the record; absent, it leads nowhere. */
|
|
22
|
+
link?: PhiSimpleTextWidgetLink | null;
|
|
21
23
|
};
|
|
22
|
-
export declare function PhiSimpleTextWidget({ blockId, labels, config, translate, textSource, runtime, }: PhiSimpleTextWidgetProps): Promise<import("react").JSX.Element>;
|
|
24
|
+
export declare function PhiSimpleTextWidget({ blockId, labels, config, translate, textSource, link, runtime, }: PhiSimpleTextWidgetProps): Promise<import("react").JSX.Element>;
|
|
@@ -4,7 +4,7 @@ import { maskPhiTextPlaceholders, resolvePhiTextPlaceholders } from "../../../..
|
|
|
4
4
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
5
5
|
import { protectPhiMailHref } from "../../../../../helpers/protected-mail";
|
|
6
6
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
7
|
-
export async function PhiSimpleTextWidget({ blockId, labels, config, translate, textSource, runtime, }) {
|
|
7
|
+
export async function PhiSimpleTextWidget({ blockId, labels, config, translate, textSource, link = null, runtime, }) {
|
|
8
8
|
const locale = runtime?.locale.current;
|
|
9
9
|
/*
|
|
10
10
|
* Masked before the translation and filled after it.
|
|
@@ -21,15 +21,16 @@ export async function PhiSimpleTextWidget({ blockId, labels, config, translate,
|
|
|
21
21
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.SimpleText, componentProps: {
|
|
22
22
|
blockId,
|
|
23
23
|
labels: { text },
|
|
24
|
-
config:
|
|
24
|
+
config: config,
|
|
25
|
+
link: protectPhiSimpleTextMailLink(link, config),
|
|
25
26
|
} }));
|
|
26
27
|
}
|
|
27
28
|
/*
|
|
28
29
|
* Live, a `mailto:` target leaves protected (`helpers/protected-mail.ts`). In the Builder the config is
|
|
29
30
|
* the operator's to edit and goes as it is.
|
|
30
31
|
*/
|
|
31
|
-
function
|
|
32
|
-
if (!
|
|
33
|
-
return
|
|
34
|
-
return { ...
|
|
32
|
+
function protectPhiSimpleTextMailLink(link, config) {
|
|
33
|
+
if (!link || (config?.renderMode != null && config.renderMode !== "live"))
|
|
34
|
+
return link;
|
|
35
|
+
return { ...link, href: protectPhiMailHref(link.href) };
|
|
35
36
|
}
|
|
@@ -23,6 +23,7 @@ import { PhiSwitchControl } from "../../../../../components/controls/phi-switch-
|
|
|
23
23
|
import { readPhiTableControlValue, } from "../../../../../components/controls/phi-table-control";
|
|
24
24
|
import { PhiTextControl } from "../../../../../components/controls/phi-text-control";
|
|
25
25
|
import { PhiLink } from "../../../../../components/navigation/phi-link";
|
|
26
|
+
import { resolvePhiTableRowActionLink } from "../../../../../helpers/table-action-row-link";
|
|
26
27
|
import { PhiIcon } from "../../../../../components/shell/phi-icon";
|
|
27
28
|
import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
|
|
28
29
|
import { usePhiSignalListener } from "../../../../../components/runtime/runtime-signal-bus";
|
|
@@ -655,8 +656,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
655
656
|
if (!matchesAllConditions(row, action.visibleWhen, conditionSources))
|
|
656
657
|
return null;
|
|
657
658
|
const disabled = findMatchingCondition(row, action.disabledWhen, conditionSources);
|
|
658
|
-
|
|
659
|
-
return (_jsx(TableAction, { action: typeof rowHref === "string" ? { ...action, href: rowHref } : action, disabled: Boolean(disabled), disabledReason: disabled && "reason" in disabled ? disabled.reason : undefined, templateValue: resource ? readRowIdentity(row, resource.rowIdentityPath) : null, size: resolvedControlSize, onActivate: () => activateAction(action, row) }, action.key));
|
|
659
|
+
return (_jsx(TableAction, { action: resolvePhiTableRowActionLink(action, action.hrefPath ? readPhiTableControlValue(row, action.hrefPath) : undefined), disabled: Boolean(disabled), disabledReason: disabled && "reason" in disabled ? disabled.reason : undefined, templateValue: resource ? readRowIdentity(row, resource.rowIdentityPath) : null, size: resolvedControlSize, onActivate: () => activateAction(action, row) }, action.key));
|
|
660
660
|
});
|
|
661
661
|
return features.actions?.rowLayout === "spaced"
|
|
662
662
|
? _jsx(PhiFlexControl, { align: "center", gap: "small", style: { display: "inline-flex" }, children: renderedActions })
|
|
@@ -950,8 +950,8 @@ function TableAction({ action, disabled = false, disabledReason, templateValue,
|
|
|
950
950
|
if (!action.confirm)
|
|
951
951
|
onActivate();
|
|
952
952
|
} }) }));
|
|
953
|
-
if (action.execution === "link" && action.
|
|
954
|
-
return disabled ? content : _jsx(PhiLink, { href: action.href, external: action.
|
|
953
|
+
if (action.execution === "link" && action.link) {
|
|
954
|
+
return disabled ? content : _jsx(PhiLink, { href: action.link.href, external: action.link.external, newTab: action.link.newTab, children: content });
|
|
955
955
|
}
|
|
956
956
|
return action.confirm && !disabled ? (_jsx(PhiConfirmControl, { title: formatTableActionTemplate(action.confirm.title, templateValue), description: action.confirm.alert ? (_jsxs(PhiFlexControl, { vertical: true, gap: "small", children: [action.confirm.description ? (_jsx("span", { children: formatTableActionTemplate(action.confirm.description, templateValue) })) : null, _jsx(PhiAlertControl, { level: action.confirm.alert.level, title: formatTableActionTemplate(action.confirm.alert.title, templateValue), description: formatTableActionTemplate(action.confirm.alert.description, templateValue) })] })) : formatTableActionTemplate(action.confirm.description, templateValue), confirmLabel: action.confirm.okText, cancelLabel: action.confirm.cancelText, danger: danger, placement: "left", onConfirm: onActivate, children: content })) : content;
|
|
957
957
|
}
|
|
@@ -2,6 +2,7 @@ import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widge
|
|
|
2
2
|
import { readPhiProviderResourceSource } from "../../../../../types/runtime-data-provider";
|
|
3
3
|
import { PHI_TABLE_TAG_COLORS, PHI_TABLE_TAG_VARIANTS, readPhiTableQuery, } from "../../../../../types/table-widget";
|
|
4
4
|
import { PHI_SIGNAL_VALUE_SCHEMAS, readPhiSignalRouteSet } from "../../../../../types/signals";
|
|
5
|
+
import { readPhiLinkTarget } from "../../../../../types/references";
|
|
5
6
|
import { createPhiConfigReader } from "../../../../../components/widgets/config/strict-config-reader";
|
|
6
7
|
import { readPhiControlSize } from "../../../../../types/control";
|
|
7
8
|
import { PHI_CONTROL_SIZE_FIELD } from "../../../../../components/widgets/config/control-signal-config";
|
|
@@ -103,8 +104,15 @@ const PHI_TABLE_ACTION_CONFIG_FIELDS = [
|
|
|
103
104
|
{ value: "primary", label: "Primary" },
|
|
104
105
|
{ value: "danger", label: "Danger" },
|
|
105
106
|
] },
|
|
106
|
-
{ key: "
|
|
107
|
-
{
|
|
107
|
+
{ key: "linkTarget", type: "link-target", label: "Link target", visibleWhen: { field: "execution", equals: "link" } },
|
|
108
|
+
{
|
|
109
|
+
key: "hrefPath",
|
|
110
|
+
type: "string",
|
|
111
|
+
label: "Row Href Path",
|
|
112
|
+
description: "Leads to the address a row holds at this path, instead of the target above.",
|
|
113
|
+
visibleWhen: { field: "execution", equals: "link" },
|
|
114
|
+
},
|
|
115
|
+
/* For a row's own address only: an address chosen as the target says whether it opens a new tab itself. */
|
|
108
116
|
{ key: "newTab", type: "boolean", label: "Open In New Tab", visibleWhen: { field: "execution", equals: "link" } },
|
|
109
117
|
...buildPhiTableConditionExpressionConfigFields("visibleWhen", "Visible Conditions", "all", "Always visible"),
|
|
110
118
|
...buildPhiTableConditionExpressionConfigFields("disabledWhen", "Disabled Conditions", "any", "No disabled conditions"),
|
|
@@ -347,7 +355,7 @@ function readAction(reader) {
|
|
|
347
355
|
icon: reader.string("icon"),
|
|
348
356
|
display: reader.oneOf("display", ["icon", "label", "icon-label"]),
|
|
349
357
|
mode: reader.oneOf("mode", ["normal", "primary", "danger"]) ?? "normal",
|
|
350
|
-
|
|
358
|
+
linkTarget: reader.value("linkTarget", "a link target", (value) => readPhiLinkTarget(value) ?? undefined),
|
|
351
359
|
hrefPath: reader.string("hrefPath"),
|
|
352
360
|
newTab: reader.boolean("newTab"),
|
|
353
361
|
visibleWhen: readCondition(reader, "visibleWhen"),
|
|
@@ -645,7 +653,7 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
|
|
|
645
653
|
options: [
|
|
646
654
|
{ value: "outlined", label: "Outlined" },
|
|
647
655
|
{ value: "filled", label: "Filled" },
|
|
648
|
-
{ value: "solid", label: "Solid" },
|
|
656
|
+
{ value: "solid", label: "Solid color" },
|
|
649
657
|
],
|
|
650
658
|
},
|
|
651
659
|
{
|
|
@@ -4,8 +4,28 @@ import { phiRuntime } from "../../../../../server-helpers/phi-runtime";
|
|
|
4
4
|
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
5
5
|
import { PHI_TABLE_WIDGET_DEFINITION } from "./config";
|
|
6
6
|
import { PhiTableWidget } from "./server";
|
|
7
|
+
import { resolvePhiTableActionLinks } from "../../../../../helpers/table-action-links";
|
|
7
8
|
import { getPhiTableWidgetLabels } from "../../../../../components/widgets/label-sets/table";
|
|
8
|
-
|
|
9
|
+
/** The config with every action's link target resolved to the address it leads to now. */
|
|
10
|
+
function resolvePhiTableConfigLinks(config, links) {
|
|
11
|
+
const actions = config.features.actions;
|
|
12
|
+
if (!actions)
|
|
13
|
+
return config;
|
|
14
|
+
return {
|
|
15
|
+
...config,
|
|
16
|
+
features: {
|
|
17
|
+
...config.features,
|
|
18
|
+
actions: {
|
|
19
|
+
...actions,
|
|
20
|
+
toolbar: resolvePhiTableActionLinks(actions.toolbar, links),
|
|
21
|
+
row: resolvePhiTableActionLinks(actions.row, links),
|
|
22
|
+
bulk: resolvePhiTableActionLinks(actions.bulk, links),
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
async function PhiTableWidgetPluginServer({ widget, config: stored, runtime, links, }) {
|
|
28
|
+
const config = resolvePhiTableConfigLinks(stored, links);
|
|
9
29
|
const rt = phiRuntime(runtime);
|
|
10
30
|
const labels = await getPhiTableWidgetLabels({
|
|
11
31
|
apiBaseUrl: rt.apiBaseUrl,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
|
|
3
2
|
import { PHI_THREAD_CONVERSATION_WIDGET_DEFINITION } from "./config";
|
|
4
3
|
import { PhiThreadConversationWidget } from "./server";
|
|
5
4
|
export const PHI_THREAD_CONVERSATION_WIDGET_PLUGIN = {
|
|
6
5
|
...PHI_THREAD_CONVERSATION_WIDGET_DEFINITION,
|
|
7
6
|
render: ({ runtime, config }) => _jsx(PhiThreadConversationWidget, { runtime: runtime, config: config }),
|
|
8
|
-
renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
|
|
9
7
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
2
|
+
import { readPhiLinkTarget } from "../../../../../types/references";
|
|
2
3
|
import { isPhiRuntimeDataProviderKey } from "../../../../../types/runtime-data-provider";
|
|
3
4
|
import { PHI_SIGNAL_VALUE_SCHEMAS, readPhiSignalRouteSet } from "../../../../../types/signals";
|
|
4
5
|
import { readPhiLengthValue } from "../../../../../types/length";
|
|
@@ -25,7 +26,7 @@ function readActions(value) {
|
|
|
25
26
|
icon: readString(entry.icon),
|
|
26
27
|
display: entry.display === "icon" || entry.display === "icon-label" ? entry.display : "label",
|
|
27
28
|
mode: entry.mode === "primary" || entry.mode === "danger" ? entry.mode : "normal",
|
|
28
|
-
|
|
29
|
+
linkTarget: readPhiLinkTarget(entry.linkTarget) ?? undefined,
|
|
29
30
|
hrefPath: readString(entry.hrefPath),
|
|
30
31
|
newTab: readBoolean(entry.newTab),
|
|
31
32
|
confirm: confirmTitle ? {
|
|
@@ -4,8 +4,23 @@ import { phiRuntime } from "../../../../../server-helpers/phi-runtime";
|
|
|
4
4
|
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
5
5
|
import { PHI_TREE_WIDGET_DEFINITION } from "./config";
|
|
6
6
|
import { PhiTreeWidget } from "./server";
|
|
7
|
+
import { resolvePhiTableActionLinks } from "../../../../../helpers/table-action-links";
|
|
7
8
|
import { getPhiTreeWidgetLabels } from "../../../../../components/widgets/label-sets/tree";
|
|
8
|
-
async function PhiTreeWidgetPluginServer({ widget, config, runtime }) {
|
|
9
|
+
async function PhiTreeWidgetPluginServer({ widget, config: stored, runtime, links }) {
|
|
10
|
+
// Where each action's target leads, resolved here: a Page reference means nothing in a browser.
|
|
11
|
+
const actions = stored.features.actions;
|
|
12
|
+
const config = !actions ? stored : {
|
|
13
|
+
...stored,
|
|
14
|
+
features: {
|
|
15
|
+
...stored.features,
|
|
16
|
+
actions: {
|
|
17
|
+
...actions,
|
|
18
|
+
toolbar: resolvePhiTableActionLinks(actions.toolbar, links) ?? [],
|
|
19
|
+
node: resolvePhiTableActionLinks(actions.node, links) ?? [],
|
|
20
|
+
selection: resolvePhiTableActionLinks(actions.selection, links) ?? [],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
9
24
|
const rt = phiRuntime(runtime);
|
|
10
25
|
const labels = await getPhiTreeWidgetLabels({ apiBaseUrl: rt.apiBaseUrl, internalToken: rt.internalToken, locale: runtime.locale.current });
|
|
11
26
|
return _jsx(PhiTreeWidget, { config: config, labels: labels, renderMode: readPhiRuntimeTreeRenderMode(widget.config) });
|
|
@@ -395,7 +395,7 @@ export const PHI_RUNTIME_MODULE_WIDGETS = [
|
|
|
395
395
|
definePhiFirstPartyWidget({
|
|
396
396
|
definition: PHI_THREAD_CONVERSATION_WIDGET_DEFINITION,
|
|
397
397
|
ownerModuleId: PHI_CORE_RUNTIME_MODULE_ID,
|
|
398
|
-
renderPolicies: { runtime: "custom", preview: "
|
|
398
|
+
renderPolicies: { runtime: "custom", preview: "visualPlaceholder", authoring: "custom" },
|
|
399
399
|
loadRuntime: () => import("./widgets/thread-conversation/plugin").then((module) => module.PHI_THREAD_CONVERSATION_WIDGET_PLUGIN),
|
|
400
400
|
loadPreview: () => import("./widgets/thread-conversation/plugin").then((module) => module.PHI_THREAD_CONVERSATION_WIDGET_PLUGIN),
|
|
401
401
|
}),
|
|
@@ -17,7 +17,7 @@ export const PHI_OBSERVABILITY_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
17
17
|
{ key: "id", title: "ID", type: "string", required: true },
|
|
18
18
|
{ key: "ts", title: "Timestamp", type: "datetime" },
|
|
19
19
|
{ key: "level", title: "Level", type: "string" },
|
|
20
|
-
{ key: "service", title: "
|
|
20
|
+
{ key: "service", title: "Source", type: "string" },
|
|
21
21
|
{ key: "event", title: "Event", type: "string" },
|
|
22
22
|
{ key: "area", title: "Area", type: "string" },
|
|
23
23
|
{ key: "userId", title: "User ID", type: "string" },
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_THEME_PREVIEW_WIDGET_DEFINITION, } from "./widgets/brand-controls/config";
|
|
3
3
|
import { createPhiAuthoringWidgetModule, definePhiAuthoringWidgetModuleLoader, } from "../client-authoring-widget-module";
|
|
4
4
|
export default createPhiAuthoringWidgetModule([
|
|
5
|
-
definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_DEFINITION, () =>
|
|
6
|
-
definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_DEFINITION, () =>
|
|
7
|
-
definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_DEFINITION, () =>
|
|
8
|
-
definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_DEFINITION, () =>
|
|
9
|
-
definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_BRAND_THEME_PREVIEW_WIDGET_DEFINITION, () =>
|
|
5
|
+
definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_DEFINITION, () => Promise.resolve(PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_DEFINITION)),
|
|
6
|
+
definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_DEFINITION, () => Promise.resolve(PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_DEFINITION)),
|
|
7
|
+
definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_DEFINITION, () => Promise.resolve(PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_DEFINITION)),
|
|
8
|
+
definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_DEFINITION, () => Promise.resolve(PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_DEFINITION)),
|
|
9
|
+
definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_BRAND_THEME_PREVIEW_WIDGET_DEFINITION, () => Promise.resolve(PHI_BUILDER_BRAND_THEME_PREVIEW_WIDGET_DEFINITION)),
|
|
10
10
|
]);
|
|
@@ -129,7 +129,10 @@ export declare function resolveThemePayloadPreset(theme: ThemePayload, presets:
|
|
|
129
129
|
* the very thing they asked for.
|
|
130
130
|
*/
|
|
131
131
|
export declare function applyThemePreset(theme: ThemePayload, preset: PhiThemePresetPlugin): ThemePayload;
|
|
132
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Back to the blocks alone: the palette, the proportions, the Button shadows, the link marks and the
|
|
134
|
+
* component overrides all go.
|
|
135
|
+
*/
|
|
133
136
|
export declare function resetThemeToPreset(theme: ThemePayload, presets: readonly PhiThemePresetPlugin[], preset?: PhiThemePresetPlugin): ThemePayload;
|
|
134
137
|
export declare function buildThemeReviewHref({ area, revisionId, themeKey, }: {
|
|
135
138
|
area: PhiCmsAreaKey;
|
|
@@ -21,6 +21,7 @@ const PHI_THEME_HISTORY_PART_BY_FIELD = {
|
|
|
21
21
|
shape: "style",
|
|
22
22
|
style: "style",
|
|
23
23
|
buttons: "style",
|
|
24
|
+
links: "style",
|
|
24
25
|
fonts: "fonts",
|
|
25
26
|
typography: "fonts",
|
|
26
27
|
brand: "brand",
|
|
@@ -89,10 +90,13 @@ export function applyThemePreset(theme, preset) {
|
|
|
89
90
|
presetVersion: preset.version,
|
|
90
91
|
};
|
|
91
92
|
}
|
|
92
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Back to the blocks alone: the palette, the proportions, the Button shadows, the link marks and the
|
|
95
|
+
* component overrides all go.
|
|
96
|
+
*/
|
|
93
97
|
export function resetThemeToPreset(theme, presets, preset = resolveThemePayloadPreset(theme, presets)) {
|
|
94
98
|
return {
|
|
95
|
-
...omitThemeFields(theme, "palette", "style", "buttons", "components"),
|
|
99
|
+
...omitThemeFields(theme, "palette", "style", "buttons", "links", "components"),
|
|
96
100
|
preset: preset.key,
|
|
97
101
|
presetVersion: preset.version,
|
|
98
102
|
};
|
|
@@ -13,6 +13,7 @@ import { PHI_THEME_CUSTOM_COLOR_KEYS, isPhiThemePaletteModeSeedKey, mergePhiThem
|
|
|
13
13
|
import { PHI_THEME_COLOR_DERIVED_TOKEN_KEYS, PHI_THEME_COLOR_SEED_DERIVATIONS, } from "../../../../../theme/phi-theme-seed-derivation";
|
|
14
14
|
import { buildPhiThemeCustomColorPalette, buildPhiThemeCustomColorTokens, resolvePhiThemePaletteCustomColors, } from "../../../../../theme/phi-theme-palette";
|
|
15
15
|
import { buildPhiThemeGradientTokens, PHI_THEME_GRADIENT_KEYS, readPhiThemeGradient, readPhiThemeGradientTextTone, readPhiThemeGradientKey, resolvePhiThemeGradients, resolvePhiThemeGradientText, resolvePhiThemeGradientContrast, resolvePhiThemeGradientAutoTextTone, resolvePhiThemeGradientInks, PHI_GRADIENT_HOVER_FILTER, } from "../../../../../theme/phi-theme-gradients";
|
|
16
|
+
import { buildPhiThemeLinkTokens, readPhiThemeExternalLinkMark } from "../../../../../theme/phi-link-mark";
|
|
16
17
|
import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
|
|
17
18
|
import { usePhiThemeBlockCatalog } from "../../../../../components/root/phi-theme-block-catalog-provider";
|
|
18
19
|
import { resolvePhiThemeComposition, resolvePhiThemeEffectiveLogo, resolvePhiThemeEffectiveFonts, resolvePhiThemeEffectiveRoot, } from "../../../../../theme/phi-theme-composition";
|
|
@@ -270,6 +271,16 @@ function withThemeButtons(theme, buttons) {
|
|
|
270
271
|
const withoutButtons = omitThemeFields(theme, "buttons");
|
|
271
272
|
return Object.keys(buttons).length > 0 ? { ...withoutButtons, buttons } : withoutButtons;
|
|
272
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Links to other sites with or without their mark. On is the default, so turning it back on removes the
|
|
276
|
+
* entry rather than storing `true`.
|
|
277
|
+
*/
|
|
278
|
+
function mergeThemeExternalLinkMark(theme, shown) {
|
|
279
|
+
const { externalMark: _previous, ...otherLinks } = theme.links ?? {};
|
|
280
|
+
const links = shown ? otherLinks : { ...otherLinks, externalMark: false };
|
|
281
|
+
const withoutLinks = omitThemeFields(theme, "links");
|
|
282
|
+
return Object.keys(links).length > 0 ? { ...withoutLinks, links } : withoutLinks;
|
|
283
|
+
}
|
|
273
284
|
/** Every primary Button filled with a Theme gradient, or handed back to its one colour. */
|
|
274
285
|
function mergeThemePrimaryButtonGradient(theme, gradient) {
|
|
275
286
|
const { primaryGradient: _previous, ...otherButtons } = theme.buttons ?? {};
|
|
@@ -455,6 +466,7 @@ function resolveBrandDraftAliasTokens(resolvedTheme, preset, mode, fonts = {}) {
|
|
|
455
466
|
token: aliasTokens,
|
|
456
467
|
primaryButtonGradient: readPhiThemeGradientKey(resolvedTheme.buttons?.primaryGradient),
|
|
457
468
|
}),
|
|
469
|
+
...buildPhiThemeLinkTokens(resolvedTheme.links),
|
|
458
470
|
};
|
|
459
471
|
}
|
|
460
472
|
function readEffectiveTokenNumber(token, key, fallback) {
|
|
@@ -1300,6 +1312,11 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1300
1312
|
...PHI_THEME_GRADIENT_KEYS.map((key, index) => ({ value: key, label: `Gradient ${index + 1}` })),
|
|
1301
1313
|
], onChange: (choice) => publishDraft(mergeThemePrimaryButtonGradient(state.draft, choice === "none" ? null : choice)) })] })),
|
|
1302
1314
|
},
|
|
1315
|
+
{
|
|
1316
|
+
key: "externalLinks",
|
|
1317
|
+
label: _jsx(PhiTypographyControl, { strong: true, children: "External Links" }),
|
|
1318
|
+
children: (_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: clientToken.paddingSM, wrap: "wrap", children: [_jsx(PhiTypographyControl, { type: "secondary", children: "An arrow after a link in text that leads to another site" }), _jsx(PhiSwitchControl, { checked: readPhiThemeExternalLinkMark(state.draft.links), checkedLabel: "On", uncheckedLabel: "Off", onChange: (checked) => publishDraft(mergeThemeExternalLinkMark(state.draft, checked)) })] })),
|
|
1319
|
+
},
|
|
1303
1320
|
{
|
|
1304
1321
|
key: "radius",
|
|
1305
1322
|
label: _jsx(PhiTypographyControl, { strong: true, children: "Border Radius" }),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
3
|
-
import { PhiWidgetPreviewFallback } from "../../../../../components/widgets/built-in/widget-preview";
|
|
4
3
|
import { PhiBuilderBrandBackgroundControlsWidgetClient, PhiBuilderBrandIdentityControlsWidgetClient, PhiBuilderBrandStyleControlsWidgetClient, PhiBuilderBrandThemeControlsWidgetClient, PhiBuilderBrandThemePreviewWidgetClient, } from "./client";
|
|
5
4
|
import { PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_THEME_PREVIEW_WIDGET_DEFINITION, } from "./config";
|
|
6
5
|
import { getPhiColorPickerLabels } from "../../../../../components/widgets/label-sets/color-picker";
|
|
@@ -9,7 +8,6 @@ import { PhiMediaPickerLabelsProvider } from "../../../../../components/media/ph
|
|
|
9
8
|
export const PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_PLUGIN = {
|
|
10
9
|
...PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_DEFINITION,
|
|
11
10
|
render: async ({ runtime, config }) => (_jsx(PhiBuilderBrandThemeControlsWidgetClient, { runtime: runtime, config: config, colorPickerLabels: await getPhiColorPickerLabels(buildPhiWidgetLabelTranslatorOptions(runtime)) })),
|
|
12
|
-
renderPreview: ({ widget }) => (_jsx(PhiWidgetPreviewFallback, { widget: widget, pluginTitle: "Builder Brand Theme Controls", summary: "Brand theme controls are rendered live in the builder." })),
|
|
13
11
|
};
|
|
14
12
|
export const PHI_BUILDER_BRAND_THEME_PREVIEW_WIDGET_PLUGIN = {
|
|
15
13
|
...PHI_BUILDER_BRAND_THEME_PREVIEW_WIDGET_DEFINITION,
|
|
@@ -19,17 +17,14 @@ export const PHI_BUILDER_BRAND_THEME_PREVIEW_WIDGET_PLUGIN = {
|
|
|
19
17
|
export const PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_PLUGIN = {
|
|
20
18
|
...PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_DEFINITION,
|
|
21
19
|
render: ({ runtime, config }) => _jsx(PhiBuilderBrandStyleControlsWidgetClient, { runtime: runtime, config: config }),
|
|
22
|
-
renderPreview: ({ widget }) => (_jsx(PhiWidgetPreviewFallback, { widget: widget, pluginTitle: "Builder Brand Style Controls", summary: "Brand style controls are rendered live in the builder." })),
|
|
23
20
|
};
|
|
24
21
|
export const PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_PLUGIN = {
|
|
25
22
|
...PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_DEFINITION,
|
|
26
23
|
// The picker the Background Control opens says its words in the reader's language.
|
|
27
24
|
render: async ({ runtime, config }) => (_jsx(PhiMediaPickerLabelsProvider, { labels: await getPhiMediaWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)), children: _jsx(PhiBuilderBrandBackgroundControlsWidgetClient, { runtime: runtime, config: config }) })),
|
|
28
|
-
renderPreview: ({ widget }) => (_jsx(PhiWidgetPreviewFallback, { widget: widget, pluginTitle: "Builder Brand Background Controls", summary: "The Theme Root Background is authored live in the builder." })),
|
|
29
25
|
};
|
|
30
26
|
export const PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_PLUGIN = {
|
|
31
27
|
...PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_DEFINITION,
|
|
32
28
|
// The picker the Logo field opens says its words in the reader's language.
|
|
33
29
|
render: async ({ runtime, config }) => (_jsx(PhiMediaPickerLabelsProvider, { labels: await getPhiMediaWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)), children: _jsx(PhiBuilderBrandIdentityControlsWidgetClient, { runtime: runtime, config: config }) })),
|
|
34
|
-
renderPreview: ({ widget }) => (_jsx(PhiWidgetPreviewFallback, { widget: widget, pluginTitle: "Builder Brand Identity Controls", summary: "The Logo and the Wordmark are authored live in the builder." })),
|
|
35
30
|
};
|
|
@@ -5,28 +5,28 @@ export const PHI_RUNTIME_MODULE_WIDGETS = [
|
|
|
5
5
|
definePhiFirstPartyWidget({
|
|
6
6
|
definition: PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_DEFINITION,
|
|
7
7
|
ownerModuleId: PHI_THEME_RUNTIME_MODULE_ID,
|
|
8
|
-
renderPolicies: { "runtime": "custom", "preview": "
|
|
8
|
+
renderPolicies: { "runtime": "custom", "preview": "visualPlaceholder", "authoring": "custom" },
|
|
9
9
|
loadRuntime: () => import("./widgets/brand-controls/plugin").then((module) => module.PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_PLUGIN),
|
|
10
10
|
loadPreview: () => import("./widgets/brand-controls/plugin").then((module) => module.PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_PLUGIN),
|
|
11
11
|
}),
|
|
12
12
|
definePhiFirstPartyWidget({
|
|
13
13
|
definition: PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_DEFINITION,
|
|
14
14
|
ownerModuleId: PHI_THEME_RUNTIME_MODULE_ID,
|
|
15
|
-
renderPolicies: { "runtime": "custom", "preview": "
|
|
15
|
+
renderPolicies: { "runtime": "custom", "preview": "visualPlaceholder", "authoring": "custom" },
|
|
16
16
|
loadRuntime: () => import("./widgets/brand-controls/plugin").then((module) => module.PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_PLUGIN),
|
|
17
17
|
loadPreview: () => import("./widgets/brand-controls/plugin").then((module) => module.PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_PLUGIN),
|
|
18
18
|
}),
|
|
19
19
|
definePhiFirstPartyWidget({
|
|
20
20
|
definition: PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_DEFINITION,
|
|
21
21
|
ownerModuleId: PHI_THEME_RUNTIME_MODULE_ID,
|
|
22
|
-
renderPolicies: { "runtime": "custom", "preview": "
|
|
22
|
+
renderPolicies: { "runtime": "custom", "preview": "visualPlaceholder", "authoring": "custom" },
|
|
23
23
|
loadRuntime: () => import("./widgets/brand-controls/plugin").then((module) => module.PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_PLUGIN),
|
|
24
24
|
loadPreview: () => import("./widgets/brand-controls/plugin").then((module) => module.PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_PLUGIN),
|
|
25
25
|
}),
|
|
26
26
|
definePhiFirstPartyWidget({
|
|
27
27
|
definition: PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_DEFINITION,
|
|
28
28
|
ownerModuleId: PHI_THEME_RUNTIME_MODULE_ID,
|
|
29
|
-
renderPolicies: { "runtime": "custom", "preview": "
|
|
29
|
+
renderPolicies: { "runtime": "custom", "preview": "visualPlaceholder", "authoring": "custom" },
|
|
30
30
|
loadRuntime: () => import("./widgets/brand-controls/plugin").then((module) => module.PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_PLUGIN),
|
|
31
31
|
loadPreview: () => import("./widgets/brand-controls/plugin").then((module) => module.PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_PLUGIN),
|
|
32
32
|
}),
|