@phis/ui 0.4.8 → 0.4.12
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-area-access-guard.js +9 -1
- package/components/cms/phi-cms-area-render-scope.d.ts +8 -4
- package/components/cms/phi-cms-area-render-scope.js +26 -11
- package/components/cms/phi-cms-root-layout.js +4 -2
- package/components/cms/phi-cms-runtime-registry.d.ts +2 -1
- package/components/cms/phi-cms-runtime-registry.js +1 -1
- package/components/controls/phi-color-control.js +2 -1
- package/components/controls/phi-drawer-control-adapter.js +2 -3
- package/components/controls/phi-drawer-control.js +3 -3
- package/components/controls/phi-dropdown-control.js +2 -1
- package/components/controls/phi-float-button-control.js +3 -3
- package/components/controls/phi-modal-control-adapter.js +2 -2
- package/components/controls/phi-modal-control.js +3 -3
- package/components/controls/phi-ribbon-wrap-control.js +2 -1
- package/components/controls/phi-zoom-image-overlay.js +11 -5
- package/components/forms/auth-admin-settings-labels.d.ts +35 -0
- package/components/forms/auth-admin-settings-labels.js +27 -0
- package/components/forms/content-entry-forms.js +1 -5
- package/components/forms/form-descriptor-runtime-client.js +2 -1
- package/components/forms/form-descriptor-text.d.ts +17 -0
- package/components/forms/form-descriptor-text.js +14 -0
- package/components/forms/runtime-form-controller-plugin.d.ts +0 -115
- package/components/forms/runtime-form-controller-plugin.js +1 -1
- package/components/forms/upload-form-control.d.ts +0 -7
- package/components/forms/upload-form-control.js +1 -1
- package/components/layouts/clients/phi-collapsible-layout-client.js +2 -1
- package/components/layouts/clients/phi-flex-layout-client.js +7 -1
- package/components/layouts/clients/phi-sequence-slot-editor.js +2 -1
- package/components/layouts/clients/phi-split-card-half.js +2 -1
- package/components/layouts/phi-base-layout.js +2 -1
- package/components/layouts/phi-layout-surface-box.js +2 -1
- package/components/media/phi-media-picker-server.js +3 -11
- package/components/navigation/use-phi-protected-mail.js +1 -9
- package/components/regions/presets/clients/sider-context.js +4 -2
- package/components/root/phi-config-provider.js +2 -1
- package/components/root/phi-dayjs-locale.d.ts +4 -1
- package/components/root/phi-dayjs-locale.js +2 -2
- package/components/root/phi-intl-locale.d.ts +7 -1
- package/components/root/phi-intl-locale.js +20 -15
- package/components/root/phi-root-layout.js +2 -1
- package/components/runtime/core-runtime-controller-plugin.d.ts +0 -84
- package/components/runtime/core-runtime-controller-plugin.js +1 -1
- package/components/runtime/runtime-controller-server-host.js +20 -9
- package/components/runtime/runtime-signal-bus.js +39 -4
- package/components/shell/phi-antd-icon.d.ts +3 -0
- package/components/shell/phi-antd-icon.js +9 -0
- package/components/state/use-phi-hydrated.d.ts +6 -0
- package/components/state/use-phi-hydrated.js +11 -0
- package/components/tables/phi-plain-table.d.ts +4 -0
- package/components/tables/phi-plain-table.js +1 -1
- package/components/widgets/client/shared/phi-rendered-value.js +4 -3
- package/components/widgets/config/parser-primitives.d.ts +5 -0
- package/components/widgets/config/parser-primitives.js +11 -0
- package/components/widgets/label-sets/runtime-options.d.ts +1 -1
- package/components/widgets/server/builder-chrome.js +2 -6
- package/components/widgets/server/search.js +2 -6
- package/components/widgets/shared/markdown-body-client.d.ts +7 -0
- package/components/widgets/shared/markdown-body-client.js +2 -0
- package/components/widgets/shared/markdown-render.js +48 -1
- package/controls.d.ts +2 -0
- package/controls.js +3 -0
- package/gateway/dashboard-cards-route.js +5 -7
- package/gateway/navigation-target-route.js +7 -9
- package/gateway/page-references-route.js +6 -8
- package/gateway/site-config.js +3 -0
- package/gateway/site-proxy.js +13 -2
- package/helpers/class-names.d.ts +7 -0
- package/helpers/class-names.js +10 -0
- package/helpers/cms-navigation-catalog.js +4 -2
- package/helpers/cms-page-catalog.js +35 -6
- package/helpers/cms-region-keys.d.ts +0 -1
- package/helpers/cms-region-keys.js +1 -1
- package/helpers/format-date-time.d.ts +14 -3
- package/helpers/format-date-time.js +27 -11
- package/helpers/region-page-scope.d.ts +1 -3
- package/helpers/region-page-scope.js +0 -4
- package/helpers/translation-format.d.ts +6 -0
- package/helpers/translation-format.js +15 -8
- package/package.json +2 -2
- package/plugins/runtime/phi-slot-child-frame-view.js +2 -1
- package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +1 -1
- package/plugins/runtime-modules/admin/forms.js +1 -1
- package/plugins/runtime-modules/admin/trees/phi-default-admin-settings-page-tree.js +2 -5
- package/plugins/runtime-modules/app/forms.js +1 -1
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +2 -6
- package/plugins/runtime-modules/asset/metadata-form.js +2 -6
- package/plugins/runtime-modules/asset/settings-forms.js +1 -1
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +2 -5
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -6
- package/plugins/runtime-modules/asset/widgets/area-upload/server.js +2 -6
- package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +1 -3
- package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -6
- package/plugins/runtime-modules/asset/widgets.js +5 -7
- package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
- package/plugins/runtime-modules/auth/data-providers.d.ts +5 -0
- package/plugins/runtime-modules/auth/data-providers.js +3 -0
- package/plugins/runtime-modules/auth/definition.d.ts +5 -0
- package/plugins/runtime-modules/auth/ids.d.ts +7 -7
- package/plugins/runtime-modules/auth/ids.js +7 -7
- package/plugins/runtime-modules/auth/services/installations-table.js +3 -1
- package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +2 -6
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +26 -14
- package/plugins/runtime-modules/auth/widgets/security/client.js +5 -1
- package/plugins/runtime-modules/auth/widgets.d.ts +1 -2
- package/plugins/runtime-modules/auth/widgets.js +5 -7
- package/plugins/runtime-modules/avatar/overlay-tree.server.js +2 -6
- package/plugins/runtime-modules/avatar/widgets/account-avatar/server.js +2 -6
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/server.js +2 -6
- package/plugins/runtime-modules/avatar/widgets.js +3 -5
- package/plugins/runtime-modules/builder/clients/pages-workspace.d.ts +2 -3
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +5 -18
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +1 -0
- package/plugins/runtime-modules/builder/controller/page-controller.js +1 -1
- package/plugins/runtime-modules/builder/controller/server-definition.js +3 -11
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +2 -6
- package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +2 -8
- package/plugins/runtime-modules/builder/developer-workspace-store.js +24 -44
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +0 -5
- package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +2 -1
- package/plugins/runtime-modules/builder/inspector-section-widget.js +6 -31
- package/plugins/runtime-modules/builder/navigation-persistence.js +12 -3
- package/plugins/runtime-modules/builder/page-meta-form.js +4 -12
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +0 -1
- package/plugins/runtime-modules/builder/page-presets.server.js +0 -24
- package/plugins/runtime-modules/builder/pages-workspace.js +6 -16
- package/plugins/runtime-modules/builder/persistence.d.ts +6 -4
- package/plugins/runtime-modules/builder/persistence.js +6 -7
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +0 -1
- package/plugins/runtime-modules/builder/shells-workspace.js +3 -11
- package/plugins/runtime-modules/builder/signal-wiring-form.js +3 -7
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +2 -6
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -26
- package/plugins/runtime-modules/builder/trees/phi-default-builder-settings-page-tree.js +2 -6
- package/plugins/runtime-modules/builder/widgets/developer-builder-pages-header/plugin.js +2 -6
- package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.js +2 -6
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +3 -2
- package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +1 -6
- package/plugins/runtime-modules/builder/widgets.js +10 -12
- package/plugins/runtime-modules/client-authoring-module.js +18 -1
- package/plugins/runtime-modules/contracts.d.ts +15 -1
- package/plugins/runtime-modules/contracts.js +10 -0
- package/plugins/runtime-modules/core/messaging/forms.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
- package/plugins/runtime-modules/core/widgets/description/server.js +12 -9
- package/plugins/runtime-modules/core/widgets/dimension/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/draft-status/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/entry-list/config.js +2 -9
- package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +1 -1
- package/plugins/runtime-modules/core/widgets/form-preview/client.js +2 -15
- package/plugins/runtime-modules/core/widgets/gallery/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/image/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/length/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/markdown-toc/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/page-title/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/pagination/config.js +4 -8
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/result/config.js +15 -10
- package/plugins/runtime-modules/core/widgets/result/server.js +1 -1
- package/plugins/runtime-modules/core/widgets/search-results/config.js +2 -8
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.js +8 -13
- package/plugins/runtime-modules/core/widgets/table/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/theme-mode-switch/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +16 -31
- package/plugins/runtime-modules/core/widgets/timeline/client.js +9 -4
- package/plugins/runtime-modules/core/widgets/tour-button/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/tree/client.js +1 -1
- package/plugins/runtime-modules/core/widgets.js +59 -61
- package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +7 -5
- package/plugins/runtime-modules/dashboard/trees/phi-default-admin-dashboard-page-tree.js +2 -6
- package/plugins/runtime-modules/dashboard/trees/phi-default-area-dashboard-page-tree.js +2 -6
- package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +2 -6
- package/plugins/runtime-modules/descriptor-compiler.js +6 -6
- package/plugins/runtime-modules/groups/controller/client.d.ts +0 -56
- package/plugins/runtime-modules/groups/controller/client.js +1 -1
- package/plugins/runtime-modules/groups/forms.js +1 -5
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +2 -6
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -6
- package/plugins/runtime-modules/localization/forms.js +2 -6
- package/plugins/runtime-modules/localization/services/options.js +19 -9
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -11
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -11
- package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +3 -11
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +4 -109
- package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +2 -2
- package/plugins/runtime-modules/preset-contracts/pub-area.js +0 -4
- package/plugins/runtime-modules/pub-area-preset.js +0 -20
- package/plugins/runtime-modules/public/trees/phi-default-pub-error-page-tree.js +5 -5
- package/plugins/runtime-modules/revisions/forms.js +1 -1
- package/plugins/runtime-modules/revisions/services/table.js +6 -2
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
- package/plugins/runtime-modules/theme/controller/server-definition.js +2 -6
- package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +2 -6
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -21
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +0 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +0 -8
- package/plugins/runtime-modules/theme/widgets.js +6 -8
- package/plugins/runtime-modules/threads/controller/client.d.ts +0 -78
- package/plugins/runtime-modules/threads/controller/client.js +1 -1
- package/plugins/runtime-modules/threads/forms.js +1 -1
- package/plugins/runtime-modules/threads/ids.d.ts +0 -1
- package/plugins/runtime-modules/threads/ids.js +0 -2
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +8 -6
- package/plugins/runtime-modules/user-management/controller/client.d.ts +0 -73
- package/plugins/runtime-modules/user-management/controller/client.js +1 -1
- package/plugins/runtime-modules/user-management/forms.js +1 -5
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +3 -7
- package/plugins/runtime-modules/video/widgets.js +2 -4
- package/server-helpers/cms-request.d.ts +19 -0
- package/server-helpers/cms-request.js +26 -8
- package/server-helpers/cms-root.js +27 -21
- package/server-helpers/public-login-route.js +6 -8
- package/server-helpers/runtime.js +1 -1
- package/server-helpers/search-index.js +34 -14
- package/styles/controls.css +11 -0
- package/styles/shell.css +11 -1
- package/types/length.js +8 -3
- package/types/site-config.d.ts +6 -4
- package/types/widget-runtime.d.ts +2 -3
- package/types.d.ts +5 -3
- package/types.js +3 -0
|
@@ -37,15 +37,18 @@ function resolveDescriptionToneColor(tone) {
|
|
|
37
37
|
}
|
|
38
38
|
export async function PhiDescriptionWidget({ labels, config, runtime, translate, }) {
|
|
39
39
|
const locale = runtime?.locale.current;
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
// Six translations of one Widget, asked together rather than one after another.
|
|
41
|
+
const [eyebrow, title, description, asideTitle, footer, asideEntries] = await Promise.all([
|
|
42
|
+
translateLabel(locale, labels.eyebrow ?? config?.eyebrow, runtime, translate, config?.textSource),
|
|
43
|
+
translateLabel(locale, labels.title ?? config?.title, runtime, translate, config?.textSource),
|
|
44
|
+
translateLabel(locale, labels.description ?? config?.description, runtime, translate, config?.textSource),
|
|
45
|
+
translateLabel(locale, labels.asideTitle ?? config?.asideTitle, runtime, translate, config?.textSource),
|
|
46
|
+
translateLabel(locale, labels.footer ?? config?.footer, runtime, translate, config?.textSource),
|
|
47
|
+
Promise.all((labels.asideItems ?? config?.asideItems ?? []).map(async (entry) => ({
|
|
48
|
+
...entry,
|
|
49
|
+
text: await translateLabel(locale, entry.text, runtime, translate, config?.textSource, entry.values),
|
|
50
|
+
}))),
|
|
51
|
+
]);
|
|
49
52
|
const resolvedAsideItems = buildPhiBulletListTree(asideEntries.filter((entry) => Boolean(entry.text)), (entry) => entry.text);
|
|
50
53
|
const stackStyle = {
|
|
51
54
|
display: "grid",
|
|
@@ -3,13 +3,9 @@ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
4
|
import { PHI_DIMENSION_WIDGET_DEFINITION, PHI_DIMENSION_WIDGET_PLUGIN_TYPE, } from "./config";
|
|
5
5
|
import { getPhiDimensionWidgetLabels } from "../../../../../components/widgets/label-sets/dimension";
|
|
6
|
-
import {
|
|
6
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
7
7
|
async function renderDimensionWidget(config, runtime, signalsEnabled) {
|
|
8
|
-
const labels = await getPhiDimensionWidgetLabels(
|
|
9
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
10
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
11
|
-
locale: runtime.locale.current,
|
|
12
|
-
});
|
|
8
|
+
const labels = await getPhiDimensionWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
13
9
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Dimension, componentProps: { config, labels, signalsEnabled } }));
|
|
14
10
|
}
|
|
15
11
|
export const PHI_DIMENSION_WIDGET_PLUGIN = {
|
|
@@ -2,14 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
4
|
import { getPhiDraftStatusWidgetLabels } from "../../../../../components/widgets/label-sets/draft-status";
|
|
5
|
-
import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
|
|
6
5
|
import { PHI_DRAFT_STATUS_WIDGET_DEFINITION } from "./config";
|
|
6
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
7
7
|
async function loadLabels(runtime) {
|
|
8
|
-
return getPhiDraftStatusWidgetLabels(
|
|
9
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
10
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
11
|
-
locale: runtime.locale.current,
|
|
12
|
-
});
|
|
8
|
+
return getPhiDraftStatusWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
13
9
|
}
|
|
14
10
|
export const PHI_DRAFT_STATUS_WIDGET_PLUGIN = {
|
|
15
11
|
...PHI_DRAFT_STATUS_WIDGET_DEFINITION,
|
|
@@ -7,7 +7,7 @@ import { PHI_CONTENT_ENTRY_CURATION_NONE_CONFIG_KEYS } from "../../../../../comp
|
|
|
7
7
|
import { isPhiContentEntryKind, PHI_CONTENT_ENTRY_KINDS, } from "../../../../../constants/content-entry-kinds";
|
|
8
8
|
import { readPhiLinkTarget } from "../../../../../types/references";
|
|
9
9
|
import { PHI_ENTRY_LIST_DEFAULT_PARTS, phiContentEntryPartOptions, PhiContentEntryPart, readPhiContentEntryParts, } from "../../../../../constants/content-entry-parts";
|
|
10
|
-
import {
|
|
10
|
+
import { readClampedPositiveInteger, readRenderableBlockConfig } from "../../../../../components/widgets/config/parser-primitives";
|
|
11
11
|
/**
|
|
12
12
|
* How the entries stand on the page (`CONTENT_ENTRIES.md`): `stack` is each entry whole, one under the
|
|
13
13
|
* next; `cards` a grid of cards, each leading to its entry's detail Page; `compact` one line of date and
|
|
@@ -38,13 +38,6 @@ function readCategories(value) {
|
|
|
38
38
|
.filter((entry) => typeof entry === "string" && (entry === PHI_ENTRY_LIST_UNCATEGORIZED || /^[1-9][0-9]{0,9}$/u.test(entry)));
|
|
39
39
|
return [...new Set(categories)];
|
|
40
40
|
}
|
|
41
|
-
function readLimit(value) {
|
|
42
|
-
const limit = readInteger(value);
|
|
43
|
-
if (!limit || limit <= 0) {
|
|
44
|
-
return PHI_ENTRY_LIST_DEFAULT_LIMIT;
|
|
45
|
-
}
|
|
46
|
-
return Math.min(limit, PHI_ENTRY_LIST_MAX_LIMIT);
|
|
47
|
-
}
|
|
48
41
|
function failSequence(key, value, expected) {
|
|
49
42
|
throw new Error(`Invalid Entries ${key} ${JSON.stringify(value)}. Expected ${expected}.`);
|
|
50
43
|
}
|
|
@@ -68,7 +61,7 @@ export function normalizePhiEntryListWidgetConfig(config) {
|
|
|
68
61
|
presentation: PHI_ENTRY_LIST_PRESENTATIONS.includes(raw.presentation)
|
|
69
62
|
? raw.presentation
|
|
70
63
|
: "stack",
|
|
71
|
-
limit:
|
|
64
|
+
limit: readClampedPositiveInteger(raw.limit, PHI_ENTRY_LIST_DEFAULT_LIMIT, PHI_ENTRY_LIST_MAX_LIMIT),
|
|
72
65
|
// Absent means the default parts: a Site that never opened the Inspector gets the entry as it was
|
|
73
66
|
// published, tags and link included, rather than a list quietly missing half of what was written.
|
|
74
67
|
show: readPhiContentEntryParts(raw.show, PHI_ENTRY_LIST_PARTS, PHI_ENTRY_LIST_DEFAULT_PARTS),
|
|
@@ -91,7 +91,7 @@ export async function buildPhiEntryViews({ kind, entries, runtime, parts, detail
|
|
|
91
91
|
subtitle: entry.subtitle,
|
|
92
92
|
blocks: bodyMode === "full" && !("error" in body) ? body.blocks : [],
|
|
93
93
|
teaser: readTeaser(entry.subtitle, "error" in body ? [] : body.blocks),
|
|
94
|
-
date: formatPhiDate(entry.created, locale),
|
|
94
|
+
date: formatPhiDate(entry.created, locale, runtime.site.timeZone),
|
|
95
95
|
machineDate: entry.created,
|
|
96
96
|
link: settings.showLinks ? resolvePhiLinkHref(entry.link, resolvedLinks) : null,
|
|
97
97
|
// The kind's detail route with this entry's slug; no route that resolves, no link on the title.
|
|
@@ -3,8 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { isPhiRecord } from "../../../../../helpers/is-record";
|
|
4
4
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
5
|
import { buildPhiDataSourceUrl } from "../../../../../gateway/data-source";
|
|
6
|
-
import {
|
|
7
|
-
import { usePhiSignalEmitter, usePhiSignalIdentity } from "../../../../../components/runtime/runtime-signal-identity";
|
|
6
|
+
import { emitPhiSignalCapability, usePhiSignalEmitter, usePhiSignalIdentity } from "../../../../../components/runtime/runtime-signal-identity";
|
|
8
7
|
import { usePhiRuntimePageConditionState } from "../../../../../components/runtime/runtime-page-condition-state";
|
|
9
8
|
import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
|
|
10
9
|
import { PhiDescriptionListControl } from "../../../../../components/controls/phi-description-list-control";
|
|
@@ -36,19 +35,7 @@ export function PhiFormPreviewWidgetClient({ blockId, formId, tokenParam, dataSo
|
|
|
36
35
|
const state = answer?.token === token ? answer.state : null;
|
|
37
36
|
const loading = token.length > 0 && state === null;
|
|
38
37
|
const emitCapability = useCallback((capabilityId, value) => {
|
|
39
|
-
|
|
40
|
-
if (route.receiver == null || (route.valueType === "json" && !route.valueSchema))
|
|
41
|
-
continue;
|
|
42
|
-
emitSignal({
|
|
43
|
-
scope: route.scope,
|
|
44
|
-
channel: route.channel,
|
|
45
|
-
action: route.action,
|
|
46
|
-
value: route.valueType === "none" ? null : value,
|
|
47
|
-
valueType: route.valueType,
|
|
48
|
-
valueSchema: route.valueSchema ?? null,
|
|
49
|
-
receiver: route.receiver,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
38
|
+
emitPhiSignalCapability(emitSignal, emitRoutes, capabilityId, value);
|
|
52
39
|
}, [emitRoutes, emitSignal]);
|
|
53
40
|
useEffect(() => {
|
|
54
41
|
if (!token)
|
|
@@ -4,9 +4,9 @@ import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runt
|
|
|
4
4
|
import { getPhiGalleryWidgetLabels } from "../../../../../components/widgets/label-sets/gallery";
|
|
5
5
|
import { PhiWidgetFailureServer } from "../../../../../components/widgets/shared/widget-failure.server";
|
|
6
6
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
7
|
-
import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
|
|
8
7
|
import { resolvePhiRecordSource } from "../../../../../server-helpers/record-source";
|
|
9
8
|
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
9
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
10
10
|
function isPublicAssetReference(value) {
|
|
11
11
|
return typeof value === "object" && value !== null &&
|
|
12
12
|
typeof value.id === "number" &&
|
|
@@ -19,11 +19,7 @@ function isPublicAssetReference(value) {
|
|
|
19
19
|
* read and is nothing on a live page, rather than an empty gallery anywhere.
|
|
20
20
|
*/
|
|
21
21
|
export async function PhiGalleryWidgetServer({ runtime, registry, config, widgetId }) {
|
|
22
|
-
const labels = await getPhiGalleryWidgetLabels(
|
|
23
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
24
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
25
|
-
locale: runtime.locale.current,
|
|
26
|
-
});
|
|
22
|
+
const labels = await getPhiGalleryWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
27
23
|
const renderMode = readPhiRuntimeTreeRenderMode(config);
|
|
28
24
|
const result = registry && config.source
|
|
29
25
|
? await resolvePhiRecordSource({ registry, runtime, binding: config.source })
|
|
@@ -3,13 +3,9 @@ import { resolvePhiPublicAssetReference } from "../../../../../components/widget
|
|
|
3
3
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
4
4
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
5
5
|
import { getPhiImageWidgetLabels } from "../../../../../components/widgets/label-sets/image";
|
|
6
|
-
import {
|
|
6
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
7
7
|
async function resolveImageWidgetLabels(runtime) {
|
|
8
|
-
return getPhiImageWidgetLabels(
|
|
9
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
10
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
11
|
-
locale: runtime.locale.current,
|
|
12
|
-
});
|
|
8
|
+
return getPhiImageWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
13
9
|
}
|
|
14
10
|
export async function PhiImageWidgetServer({ runtime, widget, config, }) {
|
|
15
11
|
const labels = await resolveImageWidgetLabels(runtime);
|
|
@@ -3,13 +3,9 @@ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
4
|
import { PHI_LENGTH_WIDGET_DEFINITION, PHI_LENGTH_WIDGET_PLUGIN_TYPE, } from "./config";
|
|
5
5
|
import { getPhiLengthWidgetLabels } from "../../../../../components/widgets/label-sets/length";
|
|
6
|
-
import {
|
|
6
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
7
7
|
async function renderLengthWidget(config, runtime, signalsEnabled) {
|
|
8
|
-
const labels = await getPhiLengthWidgetLabels(
|
|
9
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
10
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
11
|
-
locale: runtime.locale.current,
|
|
12
|
-
});
|
|
8
|
+
const labels = await getPhiLengthWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
13
9
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Length, componentProps: { config, labels, signalsEnabled } }));
|
|
14
10
|
}
|
|
15
11
|
export const PHI_LENGTH_WIDGET_PLUGIN = {
|
|
@@ -3,13 +3,9 @@ import { PhiWidgetInertPreview } from "../../../../../components/widgets/built-i
|
|
|
3
3
|
import { PHI_MARKDOWN_TOC_WIDGET_DEFINITION, } from "./config";
|
|
4
4
|
import { PhiMarkdownTocWidget } from "./server";
|
|
5
5
|
import { getPhiMarkdownTocWidgetDefaultLabels } from "../../../../../components/widgets/label-sets/markdown-toc";
|
|
6
|
-
import {
|
|
6
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
7
7
|
async function loadDefaultLabels(runtime) {
|
|
8
|
-
return getPhiMarkdownTocWidgetDefaultLabels(
|
|
9
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
10
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
11
|
-
locale: runtime.locale.current,
|
|
12
|
-
});
|
|
8
|
+
return getPhiMarkdownTocWidgetDefaultLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
13
9
|
}
|
|
14
10
|
export const PHI_MARKDOWN_TOC_WIDGET_PLUGIN = {
|
|
15
11
|
...PHI_MARKDOWN_TOC_WIDGET_DEFINITION,
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
4
|
import { getPhiPageTitleWidgetLabels } from "../../../../../components/widgets/label-sets/page-title";
|
|
5
|
-
import {
|
|
5
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
6
6
|
function PhiPageTitleWidget({ labels, runtime, }) {
|
|
7
7
|
const title = runtime.page?.title?.trim() || labels.emptyTitle;
|
|
8
8
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.PageTitle, componentProps: {
|
|
@@ -11,10 +11,6 @@ function PhiPageTitleWidget({ labels, runtime, }) {
|
|
|
11
11
|
} }));
|
|
12
12
|
}
|
|
13
13
|
export async function PhiPageTitleWidgetServer({ runtime, }) {
|
|
14
|
-
const labels = await getPhiPageTitleWidgetLabels(
|
|
15
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
16
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
17
|
-
locale: runtime.locale.current,
|
|
18
|
-
});
|
|
14
|
+
const labels = await getPhiPageTitleWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
19
15
|
return _jsx(PhiPageTitleWidget, { labels: labels, runtime: runtime, config: {} });
|
|
20
16
|
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
2
2
|
import { PHI_PAGINATION_CONTROL_SIGNALS } from "../../../../../components/widgets/signals/control-signal-capabilities";
|
|
3
|
-
import { readBoolean,
|
|
3
|
+
import { readBoolean, readClampedPositiveInteger, readString } from "../../../../../components/widgets/config/parser-primitives";
|
|
4
4
|
import { PHI_CONTROL_PRESENTATION_FIELDS, PHI_CONTROL_STATE_FIELDS, parsePhiControlConfig, } from "../../../../../components/widgets/config/control-signal-config";
|
|
5
|
-
function readPositiveInteger(value, fallback) {
|
|
6
|
-
const parsed = readInteger(value);
|
|
7
|
-
return parsed != null && parsed > 0 ? parsed : fallback;
|
|
8
|
-
}
|
|
9
5
|
function parsePhiPaginationWidgetConfig(config) {
|
|
10
6
|
const controlState = parsePhiControlConfig(config, {
|
|
11
7
|
key: "pagination",
|
|
@@ -13,9 +9,9 @@ function parsePhiPaginationWidgetConfig(config) {
|
|
|
13
9
|
return {
|
|
14
10
|
...controlState,
|
|
15
11
|
label: readString(config.label),
|
|
16
|
-
page:
|
|
17
|
-
pageSize:
|
|
18
|
-
total:
|
|
12
|
+
page: readClampedPositiveInteger(config.page, 1),
|
|
13
|
+
pageSize: readClampedPositiveInteger(config.pageSize, 20),
|
|
14
|
+
total: readClampedPositiveInteger(config.total, 0),
|
|
19
15
|
showSizeChanger: readBoolean(config.showSizeChanger),
|
|
20
16
|
simple: readBoolean(config.simple),
|
|
21
17
|
};
|
|
@@ -8,6 +8,8 @@ export type PhiCmsResultWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
|
8
8
|
subTitle?: string;
|
|
9
9
|
homeLink?: boolean;
|
|
10
10
|
homeLinkLabel?: string;
|
|
11
|
+
/** Where the link goes: the root of the Area the result renders in, or the Site's public home. */
|
|
12
|
+
homeLinkTarget?: PhiResultHomeLinkTarget;
|
|
11
13
|
/** Whose words `title`, `subTitle` and `homeLinkLabel` are (`helpers/text-source.ts`). */
|
|
12
14
|
textSource?: PhiTextSource;
|
|
13
15
|
};
|
|
@@ -22,6 +24,7 @@ export type PhiCmsResultWidgetConfig = PhiCmsWidgetConfigBase & {
|
|
|
22
24
|
* On by default. A Result ends something, and a page that ends something should say where to go next;
|
|
23
25
|
* the presets that want silence say so, which is the rarer case and the one worth spelling out.
|
|
24
26
|
*/
|
|
27
|
+
export type PhiResultHomeLinkTarget = "area" | "site";
|
|
25
28
|
export declare const PHI_RESULT_HOME_LINK_SOURCE_LABEL: "Back to homepage";
|
|
26
29
|
declare function parsePhiCmsResultWidgetConfig(config: Record<string, unknown>): PhiCmsResultWidgetConfig;
|
|
27
30
|
export declare const PHI_RESULT_WIDGET_DEFINITION: {
|
|
@@ -2,17 +2,12 @@ import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widge
|
|
|
2
2
|
import { PHI_RENDERABLE_BLOCK_GEOMETRY_FIELDS } from "../../../../../helpers/renderable-block-plugin-fields";
|
|
3
3
|
import { readPhiTextSource } from "../../../../../helpers/text-source";
|
|
4
4
|
import { readBoolean, readRenderableBlockConfig, readString, } from "../../../../../components/widgets/config/parser-primitives";
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* left on a page with nothing to press. The target is not configured because there is only one sensible
|
|
10
|
-
* answer -- the root of the Area the result was rendered in -- and asking a Site to state it would
|
|
11
|
-
* invite a broken one.
|
|
12
|
-
*
|
|
13
|
-
* On by default. A Result ends something, and a page that ends something should say where to go next;
|
|
14
|
-
* the presets that want silence say so, which is the rarer case and the one worth spelling out.
|
|
5
|
+
/*
|
|
6
|
+
* Two answers, both resolved rather than typed: the Area's own root, or the Site's public home. A refusal
|
|
7
|
+
* needs the second -- the root of the Area that refused is the same door again -- and the public home is
|
|
8
|
+
* the one page every visitor may open.
|
|
15
9
|
*/
|
|
10
|
+
const PHI_RESULT_HOME_LINK_TARGETS = ["area", "site"];
|
|
16
11
|
export const PHI_RESULT_HOME_LINK_SOURCE_LABEL = "Back to homepage";
|
|
17
12
|
const PHI_RESULT_STATUS_OPTIONS = [
|
|
18
13
|
{ value: "success", label: "Success" },
|
|
@@ -37,6 +32,7 @@ function parsePhiCmsResultWidgetConfig(config) {
|
|
|
37
32
|
subTitle: readString(config.subTitle),
|
|
38
33
|
homeLink: readBoolean(config.homeLink) ?? true,
|
|
39
34
|
homeLinkLabel: readString(config.homeLinkLabel),
|
|
35
|
+
homeLinkTarget: PHI_RESULT_HOME_LINK_TARGETS.find((target) => target === config.homeLinkTarget) ?? "area",
|
|
40
36
|
textSource: readPhiTextSource(config.textSource),
|
|
41
37
|
};
|
|
42
38
|
}
|
|
@@ -71,6 +67,15 @@ export const PHI_RESULT_WIDGET_DEFINITION = {
|
|
|
71
67
|
{ key: "subTitle", type: "string", label: "Subtitle" },
|
|
72
68
|
{ key: "homeLink", type: "boolean", label: "Show Home Link" },
|
|
73
69
|
{ key: "homeLinkLabel", type: "string", label: "Home Link Label" },
|
|
70
|
+
{
|
|
71
|
+
key: "homeLinkTarget",
|
|
72
|
+
type: "choice",
|
|
73
|
+
label: "Home Link Target",
|
|
74
|
+
options: [
|
|
75
|
+
{ value: "area", label: "This Area's start" },
|
|
76
|
+
{ value: "site", label: "The site's homepage" },
|
|
77
|
+
],
|
|
78
|
+
},
|
|
74
79
|
],
|
|
75
80
|
defaultConfig: {
|
|
76
81
|
status: "info",
|
|
@@ -47,7 +47,7 @@ export async function PhiResultWidget({ config, runtime, translate }) {
|
|
|
47
47
|
* locale it was rendered for. `localizeAreaPath` is the same answer the navigation gives.
|
|
48
48
|
*/
|
|
49
49
|
const homeHref = config?.homeLink
|
|
50
|
-
? localizeAreaPath(runtime.locale.current, runtime.area, "/")
|
|
50
|
+
? localizeAreaPath(runtime.locale.current, config.homeLinkTarget === "site" ? "public" : runtime.area, "/")
|
|
51
51
|
: undefined;
|
|
52
52
|
return (_jsx(PhiResultWidgetBody, { config: config, code: code, title: title, subTitle: subTitle, homeHref: homeHref, homeLinkLabel: homeLinkLabel }));
|
|
53
53
|
}
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import { PHI_SEARCH_DEFAULT_LIMIT, PHI_SEARCH_MAX_LIMIT } from "@phis/contracts/search";
|
|
2
2
|
import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
|
|
3
|
-
import {
|
|
4
|
-
function readLimit(value) {
|
|
5
|
-
const limit = readInteger(value);
|
|
6
|
-
if (!limit || limit <= 0)
|
|
7
|
-
return PHI_SEARCH_DEFAULT_LIMIT;
|
|
8
|
-
return Math.min(limit, PHI_SEARCH_MAX_LIMIT);
|
|
9
|
-
}
|
|
3
|
+
import { readClampedPositiveInteger, readRenderableBlockConfig, readString } from "../../../../../components/widgets/config/parser-primitives";
|
|
10
4
|
function normalizePhiSearchResultsWidgetConfig(raw) {
|
|
11
5
|
return {
|
|
12
6
|
...readRenderableBlockConfig(raw),
|
|
13
|
-
limit:
|
|
7
|
+
limit: readClampedPositiveInteger(raw.limit, PHI_SEARCH_DEFAULT_LIMIT, PHI_SEARCH_MAX_LIMIT),
|
|
14
8
|
title: readString(raw.title)?.trim() ?? "",
|
|
15
9
|
};
|
|
16
10
|
}
|
|
@@ -4,5 +4,5 @@ export type PhiSidebarNavigationWidgetProps = Pick<PhiSidebarNavigationWidgetCli
|
|
|
4
4
|
runtime: Pick<PhiBlockRuntime, "site" | "locale" | "area" | "viewer" | "request">;
|
|
5
5
|
navKey?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare function PhiSidebarNavigationWidget(
|
|
8
|
-
export declare function PhiSidebarNavigationWidgetPreview(
|
|
7
|
+
export declare function PhiSidebarNavigationWidget(props: PhiSidebarNavigationWidgetProps): Promise<import("react").JSX.Element | null>;
|
|
8
|
+
export declare function PhiSidebarNavigationWidgetPreview(props: PhiSidebarNavigationWidgetProps): Promise<import("react").JSX.Element | null>;
|
|
@@ -3,27 +3,22 @@ import { resolvePhiNavigationItems } from "../../../../../components/widgets/ser
|
|
|
3
3
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
4
4
|
import { PhiRuntimeRenderClientType } from "../../../../../constants/runtime-render-client-types";
|
|
5
5
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
6
|
-
|
|
6
|
+
/** The Widget and its preview differ in nothing but the Client type the host mounts. */
|
|
7
|
+
async function renderSidebarNavigation({ runtime, navKey, config, menuTheme }, type) {
|
|
7
8
|
const resolvedItems = await resolvePhiNavigationItems(runtime, navKey?.trim() || `${runtime.area}:sidebar`);
|
|
8
9
|
if (resolvedItems == null || resolvedItems.length === 0) {
|
|
9
10
|
return null;
|
|
10
11
|
}
|
|
11
|
-
return (_jsx(PhiRuntimeModuleRenderClientHost, { type:
|
|
12
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: type, componentProps: {
|
|
12
13
|
runtime: { site: runtime.site, locale: runtime.locale, area: runtime.area },
|
|
13
14
|
config,
|
|
14
15
|
items: resolvedItems,
|
|
15
16
|
menuTheme,
|
|
16
17
|
} }));
|
|
17
18
|
}
|
|
18
|
-
export async function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiRuntimeRenderClientType.SidebarNavigationPreview, componentProps: {
|
|
24
|
-
runtime: { site: runtime.site, locale: runtime.locale, area: runtime.area },
|
|
25
|
-
config,
|
|
26
|
-
items: resolvedItems,
|
|
27
|
-
menuTheme,
|
|
28
|
-
} }));
|
|
19
|
+
export async function PhiSidebarNavigationWidget(props) {
|
|
20
|
+
return renderSidebarNavigation(props, PhiCmsWidgetType.SidebarNavigation);
|
|
21
|
+
}
|
|
22
|
+
export async function PhiSidebarNavigationWidgetPreview(props) {
|
|
23
|
+
return renderSidebarNavigation(props, PhiRuntimeRenderClientType.SidebarNavigationPreview);
|
|
29
24
|
}
|
|
@@ -781,7 +781,7 @@ export function PhiTableWidgetClient({ config: inputConfig, renderMode, external
|
|
|
781
781
|
return null;
|
|
782
782
|
const disabled = findMatchingCondition(null, action.disabledWhen, conditionSources);
|
|
783
783
|
return _jsx(TableAction, { action: action, size: resolvedControlSize, disabled: selectedRowIdentities.length === 0 || Boolean(disabled), disabledReason: disabled && "reason" in disabled ? disabled.reason : undefined, templateValue: selectedRowIdentities.length, onActivate: () => activateAction(action, undefined, selectedRowIdentities) }, action.key);
|
|
784
|
-
}), hasQueryTools && features.tools?.reset !== false ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "
|
|
784
|
+
}), hasQueryTools && features.tools?.reset !== false ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "clear-outlined", size: "inherit" }), ariaLabel: labels.reset, tooltip: labels.reset, size: resolvedControlSize, onClick: resetQuery })) : null, features.tools?.reload ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "reload", size: "inherit" }), ariaLabel: labels.reload, tooltip: labels.reload, size: resolvedControlSize, onClick: reload })) : null] })) : null;
|
|
785
785
|
/*
|
|
786
786
|
* The source's failures end the Table here: a binding that does not hold, a resource the
|
|
787
787
|
* configuration does not fit, a read that failed. A refused edit is not one of them -- it stays in
|
|
@@ -2,14 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
4
|
import { getPhiThemeModeSwitchWidgetLabels } from "../../../../../components/widgets/label-sets/theme-mode-switch";
|
|
5
|
-
import {
|
|
5
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
6
6
|
/** The labels are the button's accessible name, translated here because a Widget client has no translation. */
|
|
7
7
|
export async function PhiThemeModeSwitchWidgetServer({ blockId, config, runtime, preview = false, }) {
|
|
8
|
-
const labels = await getPhiThemeModeSwitchWidgetLabels(
|
|
9
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
10
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
11
|
-
locale: runtime.locale.current,
|
|
12
|
-
});
|
|
8
|
+
const labels = await getPhiThemeModeSwitchWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
13
9
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.ThemeModeSwitch, componentProps: {
|
|
14
10
|
blockId,
|
|
15
11
|
config,
|
|
@@ -10,8 +10,7 @@ import { PhiDividerControl } from "../../../../../components/controls/phi-divide
|
|
|
10
10
|
import { PhiTagControl } from "../../../../../components/controls/phi-tag-control";
|
|
11
11
|
import { PhiIcon } from "../../../../../components/shell/phi-icon";
|
|
12
12
|
import { usePhiSignalListener } from "../../../../../components/runtime/runtime-signal-bus";
|
|
13
|
-
import { usePhiSignalEmitter, usePhiSignalIdentity
|
|
14
|
-
import { findPhiSignalRoutesByCapabilityId } from "../../../../../types/signals";
|
|
13
|
+
import { emitPhiSignalCapability, usePhiSignalEmitter, usePhiSignalIdentity } from "../../../../../components/runtime/runtime-signal-identity";
|
|
15
14
|
import { readPhiThreadSignalValue } from "../../../../../types/thread-widget";
|
|
16
15
|
import { buildPhiThreadListenFilter, findPhiThreadListenRoute, readPhiThreadAddressId, } from "../thread-widget-config";
|
|
17
16
|
import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
|
|
@@ -79,6 +78,11 @@ export function PhiThreadConversationWidgetClient({ runtime, labels, config, })
|
|
|
79
78
|
const listenRoutes = config?.signalRoutes?.listens;
|
|
80
79
|
const addressedThreadId = readPhiThreadAddressId(searchParams.get("thread"));
|
|
81
80
|
const [threadId, setThreadId] = useState(addressedThreadId);
|
|
81
|
+
// What is chosen now, for an answer that arrives after the choice moved on (see `refresh`).
|
|
82
|
+
const chosenThreadId = useRef(threadId);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
chosenThreadId.current = threadId;
|
|
85
|
+
}, [threadId]);
|
|
82
86
|
/*
|
|
83
87
|
* What loaded, and what failed, each tagged with the conversation it belongs to.
|
|
84
88
|
*
|
|
@@ -142,6 +146,14 @@ export function PhiThreadConversationWidgetClient({ runtime, labels, config, })
|
|
|
142
146
|
*/
|
|
143
147
|
const refresh = useCallback(async (id) => {
|
|
144
148
|
const result = await fetchPhiThreadDetail(id);
|
|
149
|
+
/*
|
|
150
|
+
* Chosen A, then B before A answered: A's late answer used to replace B's conversation, which was
|
|
151
|
+
* already on screen, and B stayed in its loading state until chosen again. An answer for a
|
|
152
|
+
* conversation no longer chosen is nobody's any more.
|
|
153
|
+
*/
|
|
154
|
+
if (chosenThreadId.current !== id) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
145
157
|
if (!result.ok) {
|
|
146
158
|
receive(id, result);
|
|
147
159
|
return;
|
|
@@ -259,20 +271,7 @@ export function PhiThreadConversationWidgetClient({ runtime, labels, config, })
|
|
|
259
271
|
return;
|
|
260
272
|
}
|
|
261
273
|
announcedThreadId.current = openedThreadId;
|
|
262
|
-
|
|
263
|
-
if (route.receiver == null) {
|
|
264
|
-
continue;
|
|
265
|
-
}
|
|
266
|
-
emitSignal({
|
|
267
|
-
scope: route.scope,
|
|
268
|
-
channel: route.channel,
|
|
269
|
-
action: route.action,
|
|
270
|
-
value: route.valueType === "none" ? null : { threadId: openedThreadId },
|
|
271
|
-
valueType: route.valueType,
|
|
272
|
-
valueSchema: route.valueSchema ?? null,
|
|
273
|
-
receiver: route.receiver,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
274
|
+
emitPhiSignalCapability(emitSignal, config?.signalRoutes?.emits, "opened", { threadId: openedThreadId });
|
|
276
275
|
}, [config?.signalRoutes?.emits, emitSignal, openedThreadId]);
|
|
277
276
|
/*
|
|
278
277
|
* Reply, said as a row action: the open thread is the row. Whoever listens -- a dialog with Core's Reply
|
|
@@ -281,21 +280,7 @@ export function PhiThreadConversationWidgetClient({ runtime, labels, config, })
|
|
|
281
280
|
const reply = useCallback(() => {
|
|
282
281
|
if (threadId == null)
|
|
283
282
|
return;
|
|
284
|
-
|
|
285
|
-
if (route.receiver == null)
|
|
286
|
-
continue;
|
|
287
|
-
emitSignal({
|
|
288
|
-
scope: route.scope,
|
|
289
|
-
channel: route.channel,
|
|
290
|
-
action: route.action,
|
|
291
|
-
value: route.valueType === "none"
|
|
292
|
-
? null
|
|
293
|
-
: { actionKey: "reply", rowIdentity: threadId, selectedRowIdentities: [threadId] },
|
|
294
|
-
valueType: route.valueType,
|
|
295
|
-
valueSchema: route.valueSchema ?? null,
|
|
296
|
-
receiver: route.receiver,
|
|
297
|
-
});
|
|
298
|
-
}
|
|
283
|
+
emitPhiSignalCapability(emitSignal, config?.signalRoutes?.emits, "reply", { actionKey: "reply", rowIdentity: threadId, selectedRowIdentities: [threadId] });
|
|
299
284
|
}, [config?.signalRoutes?.emits, emitSignal, threadId]);
|
|
300
285
|
const newestMessageId = detail?.messages.at(-1)?.id ?? null;
|
|
301
286
|
useEffect(() => {
|
|
@@ -8,23 +8,28 @@ import { PhiTimelineControl } from "../../../../../components/controls/phi-timel
|
|
|
8
8
|
import { usePhiControlSignalController } from "../../../../../components/widgets/client/shared/phi-control-signals";
|
|
9
9
|
import { usePhiTimelineProviderEntries } from "../../../../../components/widgets/client/shared/phi-timeline-provider";
|
|
10
10
|
import { PhiWidgetFailure } from "../../../../../components/widgets/shared/widget-failure-client";
|
|
11
|
+
import { usePhiIntlRenderedAt, usePhiIntlTimeZone } from "../../../../../components/root/phi-intl-locale";
|
|
11
12
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
12
13
|
import { readPhiRuntimeTreeRenderMode } from "../../../render-mode";
|
|
13
|
-
function formatEntryTime(entry, format, locale) {
|
|
14
|
+
function formatEntryTime(entry, format, locale, timeZone, renderedAt) {
|
|
14
15
|
/* Words the entry states are shown as written; a date is formatted for the reader. */
|
|
15
16
|
if (entry.time)
|
|
16
17
|
return entry.time;
|
|
17
18
|
if (!entry.at)
|
|
18
19
|
return undefined;
|
|
19
20
|
if (format === "relative")
|
|
20
|
-
return formatPhiRelativeTime(entry.at, locale);
|
|
21
|
-
return format === "datetime"
|
|
21
|
+
return formatPhiRelativeTime(entry.at, locale, renderedAt);
|
|
22
|
+
return format === "datetime"
|
|
23
|
+
? formatPhiDateTime(entry.at, locale, timeZone)
|
|
24
|
+
: formatPhiDate(entry.at, locale, timeZone);
|
|
22
25
|
}
|
|
23
26
|
export function PhiTimelineWidget({ config, blockId, locale = "en", }) {
|
|
24
27
|
/*
|
|
25
28
|
* Params a signal chose, over the stored ones. Kept with the binding they were chosen for, so a
|
|
26
29
|
* Provider changed in the Inspector starts from its own stored params again.
|
|
27
30
|
*/
|
|
31
|
+
const timeZone = usePhiIntlTimeZone();
|
|
32
|
+
const renderedAt = usePhiIntlRenderedAt();
|
|
28
33
|
const storedBinding = config?.entriesProvider ?? null;
|
|
29
34
|
const [chosen, setChosen] = useState(null);
|
|
30
35
|
const binding = useMemo(() => storedBinding
|
|
@@ -68,7 +73,7 @@ export function PhiTimelineWidget({ config, blockId, locale = "en", }) {
|
|
|
68
73
|
key: entry.key,
|
|
69
74
|
title: entry.title,
|
|
70
75
|
content: entry.content,
|
|
71
|
-
time: formatEntryTime(entry, format, locale),
|
|
76
|
+
time: formatEntryTime(entry, format, locale, timeZone, renderedAt),
|
|
72
77
|
icon: entry.icon,
|
|
73
78
|
tone: entry.tone,
|
|
74
79
|
pending: entry.pending,
|
|
@@ -2,13 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
|
|
3
3
|
import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
|
|
4
4
|
import { getPhiTourWidgetLabels } from "../../../../../components/widgets/label-sets/tour";
|
|
5
|
-
import {
|
|
5
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
|
|
6
6
|
/** The label is the button's accessible name, translated here because a Widget client has no translation. */
|
|
7
7
|
export async function PhiTourButtonWidgetServer({ config, runtime, preview = false, }) {
|
|
8
|
-
const labels = await getPhiTourWidgetLabels(
|
|
9
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
10
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
11
|
-
locale: runtime.locale.current,
|
|
12
|
-
});
|
|
8
|
+
const labels = await getPhiTourWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
13
9
|
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.TourButton, componentProps: { config, labels, ...(preview ? { signalsEnabled: false } : {}) } }));
|
|
14
10
|
}
|
|
@@ -184,7 +184,7 @@ export function PhiTreeWidgetClient({ config, labels, renderMode }) {
|
|
|
184
184
|
const toolbar = selfContained && ((config.features.actions?.selection?.length ?? 0) > 0 ||
|
|
185
185
|
(config.features.actions?.toolbar?.length ?? 0) > 0 ||
|
|
186
186
|
hasResettableQuery && tools?.reset !== false ||
|
|
187
|
-
tools?.reload === true) ? (_jsxs(PhiToolbarControl, { size: controlSize, compact: true, children: [(config.features.actions?.toolbar ?? []).map((action) => (_jsx(PhiTreeActionButton, { action: action, size: controlSize, onActivate: () => activate(action) }, action.key))), (config.features.actions?.selection ?? []).map((action) => (_jsx(PhiTreeActionButton, { action: action, size: controlSize, disabled: binding.selectedNodeIdentities.length === 0, onActivate: () => activate(action) }, action.key))), hasResettableQuery && tools?.reset !== false ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "
|
|
187
|
+
tools?.reload === true) ? (_jsxs(PhiToolbarControl, { size: controlSize, compact: true, children: [(config.features.actions?.toolbar ?? []).map((action) => (_jsx(PhiTreeActionButton, { action: action, size: controlSize, onActivate: () => activate(action) }, action.key))), (config.features.actions?.selection ?? []).map((action) => (_jsx(PhiTreeActionButton, { action: action, size: controlSize, disabled: binding.selectedNodeIdentities.length === 0, onActivate: () => activate(action) }, action.key))), hasResettableQuery && tools?.reset !== false ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "clear-outlined", size: "inherit" }), ariaLabel: labels.reset, tooltip: labels.reset, size: controlSize, onClick: resetTools })) : null, tools?.reload ? (_jsx(PhiButtonControl, { icon: _jsx(PhiIcon, { name: "reload", size: "inherit" }), ariaLabel: labels.reload, tooltip: labels.reload, size: controlSize, onClick: binding.reload })) : null] })) : null;
|
|
188
188
|
/*
|
|
189
189
|
* The source's failures end the Tree here: a binding that does not hold, a resource the configuration
|
|
190
190
|
* does not fit, a read that failed. A refused change stays in `binding.error` alone, said above the
|