@phis/ui 0.4.8 → 0.4.10
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-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/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-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-signal-bus.js +39 -4
- package/components/state/use-phi-hydrated.d.ts +6 -0
- package/components/state/use-phi-hydrated.js +11 -0
- 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/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/ids.d.ts +7 -7
- package/plugins/runtime-modules/auth/ids.js +7 -7
- 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 +2 -5
- 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/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/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/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/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/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.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/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/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 +2 -6
- 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 +6 -8
- package/server-helpers/public-login-route.js +6 -8
- package/server-helpers/runtime.js +1 -0
- package/server-helpers/search-index.js +34 -14
- package/types/length.js +8 -3
- package/types/site-config.d.ts +6 -0
- package/types/widget-runtime.d.ts +2 -0
- package/types.d.ts +5 -3
- package/types.js +3 -0
|
@@ -1,57 +1 @@
|
|
|
1
|
-
import { type PhiGroupsControllerConfig } from "../controller/definition";
|
|
2
|
-
export declare const PHI_GROUPS_RUNTIME_CONTROLLER_PLUGIN: {
|
|
3
|
-
renderController: ({ key, address, config }: import("../../../../types").PhiRuntimeControllerRenderArgs<PhiGroupsControllerConfig, unknown>) => import("react").JSX.Element;
|
|
4
|
-
kind: "controller";
|
|
5
|
-
pluginKey: string;
|
|
6
|
-
key: string;
|
|
7
|
-
title: string;
|
|
8
|
-
description: string;
|
|
9
|
-
iconFamily: string;
|
|
10
|
-
allowedMountScopes: "page"[];
|
|
11
|
-
runtimeSignals: {
|
|
12
|
-
emits: ({
|
|
13
|
-
id: string;
|
|
14
|
-
action: "change";
|
|
15
|
-
valueType: "json";
|
|
16
|
-
valueSchema: `${string}/signals/${string}`;
|
|
17
|
-
} | {
|
|
18
|
-
id: string;
|
|
19
|
-
action: "activate";
|
|
20
|
-
valueType: "none";
|
|
21
|
-
valueSchema?: undefined;
|
|
22
|
-
} | {
|
|
23
|
-
id: string;
|
|
24
|
-
action: "close";
|
|
25
|
-
valueType: "none";
|
|
26
|
-
valueSchema?: undefined;
|
|
27
|
-
})[];
|
|
28
|
-
listens: ({
|
|
29
|
-
id: string;
|
|
30
|
-
channel: string;
|
|
31
|
-
action: "change";
|
|
32
|
-
valueType: "json";
|
|
33
|
-
valueSchema: `${string}/signals/${string}`;
|
|
34
|
-
} | {
|
|
35
|
-
id: string;
|
|
36
|
-
channel: string;
|
|
37
|
-
action: "reload";
|
|
38
|
-
valueType: "none";
|
|
39
|
-
valueSchema?: undefined;
|
|
40
|
-
} | {
|
|
41
|
-
id: string;
|
|
42
|
-
channel: string;
|
|
43
|
-
action: "activate";
|
|
44
|
-
valueType: "json";
|
|
45
|
-
valueSchema: `${string}/signals/${string}`;
|
|
46
|
-
} | {
|
|
47
|
-
id: string;
|
|
48
|
-
channel: string;
|
|
49
|
-
action: "activate";
|
|
50
|
-
valueType: "string";
|
|
51
|
-
valueSchema?: undefined;
|
|
52
|
-
})[];
|
|
53
|
-
};
|
|
54
|
-
defaultConfig: {};
|
|
55
|
-
parseConfig: (raw: Record<string, unknown>) => PhiGroupsControllerConfig;
|
|
56
|
-
};
|
|
57
1
|
export declare const PhiGroupsRuntimeControllerClient: (props: import("../../contracts").PhiRuntimeModuleControllerClientProps) => import("react").JSX.Element;
|
|
@@ -90,7 +90,7 @@ function PhiGroupsControllerView({ address, config, }) {
|
|
|
90
90
|
});
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
|
-
|
|
93
|
+
const PHI_GROUPS_RUNTIME_CONTROLLER_PLUGIN = {
|
|
94
94
|
...PHI_GROUPS_RUNTIME_CONTROLLER_DEFINITION,
|
|
95
95
|
renderController: ({ key, address, config }) => _jsx(PhiGroupsControllerView, { address: address, config: config }, key),
|
|
96
96
|
};
|
|
@@ -6,6 +6,7 @@ import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS, create
|
|
|
6
6
|
import { definePhiRuntimeModuleForm } from "../../../components/forms/form-registry";
|
|
7
7
|
import { PHI_GROUPS_RUNTIME_DATA_PROVIDER_KEYS } from "./ids";
|
|
8
8
|
import { PhiGroupMembershipFlags } from "../../../constants/site-groups";
|
|
9
|
+
import { phiFormLabel as label, phiFormRequired as required } from "../../../components/forms/form-descriptor-text";
|
|
9
10
|
export const PHI_GROUPS_FORM_IDS = {
|
|
10
11
|
create: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "groups/create"),
|
|
11
12
|
membership: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "groups/membership"),
|
|
@@ -17,11 +18,6 @@ const PHI_GROUPS_FORM_HANDLER_KEYS = {
|
|
|
17
18
|
myMembership: "site.groups.my-membership",
|
|
18
19
|
};
|
|
19
20
|
const LABEL_SET_KEY = "@phis/ui/modules/groups/labels/forms";
|
|
20
|
-
const label = (key, fallback) => ({ kind: "label", key, fallback });
|
|
21
|
-
const required = (key, fallback) => [{
|
|
22
|
-
providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.required,
|
|
23
|
-
message: label(key, fallback),
|
|
24
|
-
}];
|
|
25
21
|
/**
|
|
26
22
|
* Creating a group is Site administration, not group membership: a group is an authorization unit that
|
|
27
23
|
* Pages, Navigation, and Assets refer to. The Core route this relays to enforces that -- the form only
|
|
@@ -9,7 +9,7 @@ import { PHI_GROUPS_PAGE_LAYOUT_IDS, PHI_GROUPS_PAGE_OVERLAY_IDS, PHI_GROUPS_PAG
|
|
|
9
9
|
import { buildPhiBasePageContentScaffold, PHI_BASE_PAGE_LAYOUT_NODE_ID } from "../../../../components/regions/presets/phi-base-page-layout";
|
|
10
10
|
import { getPhiGroupFormLabels } from "../labels";
|
|
11
11
|
import { PHI_GROUPS_FORM_IDS } from "../forms";
|
|
12
|
-
import {
|
|
12
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
13
13
|
const SYNTHETIC_ADMIN_GROUPS_REGION_IDS = {
|
|
14
14
|
regionContent: -451,
|
|
15
15
|
};
|
|
@@ -25,11 +25,7 @@ const SYNTHETIC_ADMIN_GROUPS_REGION_IDS = {
|
|
|
25
25
|
* lists and closes the dialog.
|
|
26
26
|
*/
|
|
27
27
|
export async function buildPhiDefaultAdminGroupsPageTree({ page, runtime, }) {
|
|
28
|
-
const labels = await getPhiGroupFormLabels(
|
|
29
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
30
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
31
|
-
locale: runtime.locale.current,
|
|
32
|
-
});
|
|
28
|
+
const labels = await getPhiGroupFormLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
33
29
|
const controllerAddress = createPhiGroupsControllerAddress();
|
|
34
30
|
const membersTableAddress = createPhiSignalAddress("cms", PHI_GROUPS_PAGE_WIDGET_IDS.widgetMembersTable);
|
|
35
31
|
const createFormAddress = createPhiSignalAddress("cms", PHI_GROUPS_PAGE_WIDGET_IDS.widgetCreateForm);
|
|
@@ -11,7 +11,7 @@ import { getPhiGroupFormLabels } from "../labels";
|
|
|
11
11
|
import { canPhiViewerManageSomeGroup } from "../page-visibility";
|
|
12
12
|
import { canPhiViewerAccess, PHI_VIEWER_ACCESS_DEVELOPER_TOOLS } from "../../../../types/access";
|
|
13
13
|
import { PHI_GROUPS_FORM_IDS } from "../forms";
|
|
14
|
-
import {
|
|
14
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
15
15
|
const SYNTHETIC_APP_GROUPS_REGION_IDS = {
|
|
16
16
|
regionContent: -452,
|
|
17
17
|
};
|
|
@@ -24,11 +24,7 @@ const SYNTHETIC_APP_GROUPS_REGION_IDS = {
|
|
|
24
24
|
* possible later. Managing a group happens in Site administration.
|
|
25
25
|
*/
|
|
26
26
|
export async function buildPhiDefaultAppGroupsPageTree({ page, runtime, }) {
|
|
27
|
-
const labels = await getPhiGroupFormLabels(
|
|
28
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
29
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
30
|
-
locale: runtime.locale.current,
|
|
31
|
-
});
|
|
27
|
+
const labels = await getPhiGroupFormLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
32
28
|
const controllerAddress = createPhiGroupsControllerAddress();
|
|
33
29
|
const myGroupsTableAddress = createPhiSignalAddress("cms", PHI_APP_GROUPS_PAGE_WIDGET_IDS.widgetMyGroupsTable);
|
|
34
30
|
const membersTableAddress = createPhiSignalAddress("cms", PHI_APP_GROUPS_PAGE_WIDGET_IDS.widgetMembersTable);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createPhiFormLabelSetLoader } from "../../../components/forms/shared-form-loaders";
|
|
2
2
|
import { definePhiRuntimeModuleForm } from "../../../components/forms/form-registry";
|
|
3
|
-
import { PHI_FORM_FIELD_PROVIDER_KEYS,
|
|
3
|
+
import { PHI_FORM_FIELD_PROVIDER_KEYS, createPhiSharedFormProviderKey, } from "../../../components/forms/form-provider-contract";
|
|
4
4
|
import { createPhiFormId } from "../../../types/form-id";
|
|
5
5
|
import { PHI_LOCALIZATION_RUNTIME_MODULE_ID } from "../../../plugins/runtime-modules/localization/ids";
|
|
6
6
|
import { PHI_SHARED_PACKAGE_NAME } from "../../../types/signals";
|
|
7
7
|
import { PHI_LOCALIZATION_RUNTIME_DATA_PROVIDER_KEYS } from "./ids";
|
|
8
|
+
import { phiFormLabel as label, phiFormRequired as required } from "../../../components/forms/form-descriptor-text";
|
|
8
9
|
export const PHI_LOCALIZATION_FORM_IDS = {
|
|
9
10
|
siteLocales: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "localization/site-locales"),
|
|
10
11
|
editorTranslation: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "localization/editor-translation"),
|
|
@@ -23,11 +24,6 @@ const PHI_LOCALIZATION_FORM_HANDLER_LEAVES = {
|
|
|
23
24
|
editorTranslation: "editor-translation",
|
|
24
25
|
};
|
|
25
26
|
const LABEL_SET_KEY = "@phis/ui/modules/localization/labels/forms";
|
|
26
|
-
const label = (key, fallback) => ({ kind: "label", key, fallback });
|
|
27
|
-
const required = (key, fallback) => [{
|
|
28
|
-
providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.required,
|
|
29
|
-
message: label(key, fallback),
|
|
30
|
-
}];
|
|
31
27
|
const translationFields = [
|
|
32
28
|
{ key: "action", fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.hidden, initialValue: "translation" },
|
|
33
29
|
{ key: "msgId", fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.hidden },
|
|
@@ -54,16 +54,26 @@ function readContextOptions(value) {
|
|
|
54
54
|
value: "all",
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
/**
|
|
58
|
+
* One request for the two providers below. Each provider deduplicates its own loads, not another's, and
|
|
59
|
+
* both read this endpoint when a page with both controls builds; the one in flight answers both.
|
|
60
|
+
*/
|
|
61
|
+
let platformLocalesInFlight = null;
|
|
62
|
+
function loadPlatformLocales() {
|
|
63
|
+
platformLocalesInFlight ??= (async () => {
|
|
64
|
+
const response = await fetch("/api/site/admin/locales?page=1&pageSize=1", {
|
|
65
|
+
cache: "no-store",
|
|
66
|
+
credentials: "include",
|
|
67
|
+
headers: { accept: "application/json" },
|
|
68
|
+
});
|
|
69
|
+
const payload = await response.json().catch(() => null);
|
|
70
|
+
if (!response.ok)
|
|
71
|
+
throw new Error("Failed to load available locales.");
|
|
72
|
+
return payload;
|
|
73
|
+
})().finally(() => {
|
|
74
|
+
platformLocalesInFlight = null;
|
|
62
75
|
});
|
|
63
|
-
|
|
64
|
-
if (!response.ok)
|
|
65
|
-
throw new Error("Failed to load available locales.");
|
|
66
|
-
return payload;
|
|
76
|
+
return platformLocalesInFlight;
|
|
67
77
|
}
|
|
68
78
|
function resolveAdminSiteLocales(context) {
|
|
69
79
|
return readSiteLocaleOptions(context.asyncData, "targetLocales");
|
|
@@ -10,7 +10,7 @@ import { getPhiAdminLocalesWidgetLabels } from "../../../../components/widgets/l
|
|
|
10
10
|
import { PHI_SPACE } from "../../../../theme/antd-css-var-contract";
|
|
11
11
|
import { PHI_LOCALIZATION_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
|
|
12
12
|
import { PHI_LOCALIZATION_FORM_IDS } from "../forms";
|
|
13
|
-
import {
|
|
13
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
14
14
|
const SYNTHETIC_ADMIN_LOCALES_REGION_IDS = {
|
|
15
15
|
regionContent: -461,
|
|
16
16
|
};
|
|
@@ -30,16 +30,8 @@ export const SYNTHETIC_ADMIN_LOCALES_WIDGET_IDS = createPhiPresetCmsInstanceIdMa
|
|
|
30
30
|
"widgetSiteLocalesForm",
|
|
31
31
|
]);
|
|
32
32
|
export async function buildPhiDefaultAdminLocalesPageTree({ page, runtime, }) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
36
|
-
locale: runtime.locale.current,
|
|
37
|
-
});
|
|
38
|
-
const widgetLabels = await getPhiAdminLocalesWidgetLabels({
|
|
39
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
40
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
41
|
-
locale: runtime.locale.current,
|
|
42
|
-
});
|
|
33
|
+
const translator = buildPhiWidgetLabelTranslatorOptions(runtime);
|
|
34
|
+
const [labels, widgetLabels] = await Promise.all([getPhiAdminLocalesPageLabels(translator), getPhiAdminLocalesWidgetLabels(translator)]);
|
|
43
35
|
const scaffold = buildPhiBasePageContentScaffold({
|
|
44
36
|
page,
|
|
45
37
|
regionId: SYNTHETIC_ADMIN_LOCALES_REGION_IDS.regionContent,
|
package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js
CHANGED
|
@@ -10,20 +10,12 @@ import { PHI_LOCALIZATION_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
|
|
|
10
10
|
import { PHI_LOCALIZATION_FORM_IDS } from "../forms";
|
|
11
11
|
import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../types/signals";
|
|
12
12
|
import { PHI_LOCALIZATION_CONTROLLER_INSTANCE_KEY, PHI_LOCALIZATION_CONTROLLER_TYPE, createPhiLocalizationControllerAddress, } from "../controller/address";
|
|
13
|
-
import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
|
|
14
13
|
import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../../helpers/cms-dialog";
|
|
14
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
15
15
|
const SYNTHETIC_EDITOR_TRANSLATIONS_REGION_IDS = { regionContent: -561 };
|
|
16
16
|
export async function buildPhiDefaultEditorTranslationsPageTree({ page, runtime, }) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
20
|
-
locale: runtime.locale.current,
|
|
21
|
-
});
|
|
22
|
-
const widgetLabels = await getPhiEditorTranslationsWidgetLabels({
|
|
23
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
24
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
25
|
-
locale: runtime.locale.current,
|
|
26
|
-
});
|
|
17
|
+
const translator = buildPhiWidgetLabelTranslatorOptions(runtime);
|
|
18
|
+
const [labels, widgetLabels] = await Promise.all([getPhiEditorTranslationsPageLabels(translator), getPhiEditorTranslationsWidgetLabels(translator)]);
|
|
27
19
|
const scaffold = buildPhiBasePageContentScaffold({
|
|
28
20
|
page,
|
|
29
21
|
regionId: SYNTHETIC_EDITOR_TRANSLATIONS_REGION_IDS.regionContent,
|
|
@@ -8,8 +8,8 @@ import { getPhiAdminLogsPageLabels } from "./admin-logs-label-set";
|
|
|
8
8
|
import { getPhiObservabilityLogsWidgetLabels } from "../../../../components/widgets/label-sets/observability-logs";
|
|
9
9
|
import { PHI_OBSERVABILITY_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
|
|
10
10
|
import { createPhiSignalAddress, PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../types/signals";
|
|
11
|
-
import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
|
|
12
11
|
import { PHI_DIALOG_BODY_CONFIG } from "../../../../helpers/cms-dialog";
|
|
12
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
13
13
|
const SYNTHETIC_ADMIN_LOGS_REGION_IDS = {
|
|
14
14
|
regionContent: -441,
|
|
15
15
|
};
|
|
@@ -36,16 +36,8 @@ const SYNTHETIC_ADMIN_LOGS_WIDGET_IDS = createPhiPresetCmsInstanceIdMap({
|
|
|
36
36
|
"widgetDetail",
|
|
37
37
|
]);
|
|
38
38
|
export async function buildPhiDefaultAdminLogsPageTree({ page, runtime, }) {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
42
|
-
locale: runtime.locale.current,
|
|
43
|
-
});
|
|
44
|
-
const widgetLabels = await getPhiObservabilityLogsWidgetLabels({
|
|
45
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
46
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
47
|
-
locale: runtime.locale.current,
|
|
48
|
-
});
|
|
39
|
+
const translator = buildPhiWidgetLabelTranslatorOptions(runtime);
|
|
40
|
+
const [labels, widgetLabels] = await Promise.all([getPhiAdminLogsPageLabels(translator), getPhiObservabilityLogsWidgetLabels(translator)]);
|
|
49
41
|
const scaffold = buildPhiBasePageContentScaffold({
|
|
50
42
|
page,
|
|
51
43
|
regionId: SYNTHETIC_ADMIN_LOGS_REGION_IDS.regionContent,
|
|
@@ -4,11 +4,11 @@ import { PHI_SHARED_PACKAGE_NAME } from "../../../types/signals";
|
|
|
4
4
|
import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS, } from "../../../components/forms/form-provider-contract";
|
|
5
5
|
import { definePhiRuntimeModuleForm } from "../../../components/forms/form-registry";
|
|
6
6
|
import { PHI_REVISIONS_RUNTIME_MODULE_ID } from "./ids";
|
|
7
|
+
import { phiFormLabel as label } from "../../../components/forms/form-descriptor-text";
|
|
7
8
|
export const PHI_REVISIONS_FORM_IDS = {
|
|
8
9
|
deleteArea: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "revisions/delete-area"),
|
|
9
10
|
};
|
|
10
11
|
const LABEL_SET_KEY = "@phis/ui/modules/revisions/labels/forms";
|
|
11
|
-
const label = (key, fallback) => ({ kind: "label", key, fallback });
|
|
12
12
|
/**
|
|
13
13
|
* The typed confirmation for deleting an Area's own shell.
|
|
14
14
|
*
|
|
@@ -41,10 +41,12 @@ function readRevisionScope(value) {
|
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
function readParams(value) {
|
|
44
|
-
if (!isPhiRecord(value) || !isPhiRecord(value.labels) || typeof value.locale !== "string"
|
|
44
|
+
if (!isPhiRecord(value) || !isPhiRecord(value.labels) || typeof value.locale !== "string"
|
|
45
|
+
|| typeof value.timeZone !== "string") {
|
|
45
46
|
throw new Error("Revisions table parameters are missing.");
|
|
46
47
|
}
|
|
47
48
|
const locale = value.locale;
|
|
49
|
+
const timeZone = value.timeZone;
|
|
48
50
|
if (!isPhiRecord(value.scope) && typeof window !== "undefined") {
|
|
49
51
|
const state = getPhiWorkspaceCatalogSnapshot();
|
|
50
52
|
const search = new URLSearchParams(window.location.search);
|
|
@@ -94,6 +96,7 @@ function readParams(value) {
|
|
|
94
96
|
navScopeKey,
|
|
95
97
|
labels: value.labels,
|
|
96
98
|
locale,
|
|
99
|
+
timeZone,
|
|
97
100
|
};
|
|
98
101
|
}
|
|
99
102
|
const scope = readRevisionScope(value.scope);
|
|
@@ -111,6 +114,7 @@ function readParams(value) {
|
|
|
111
114
|
navScopeKey: value.navScopeKey,
|
|
112
115
|
labels: value.labels,
|
|
113
116
|
locale,
|
|
117
|
+
timeZone,
|
|
114
118
|
};
|
|
115
119
|
}
|
|
116
120
|
async function readJson(response) {
|
|
@@ -267,7 +271,7 @@ function formatRevisionMessageWithLastSave(params, row) {
|
|
|
267
271
|
const message = formatRevisionMessage(params.labels, row);
|
|
268
272
|
if (!row.savedAt)
|
|
269
273
|
return message;
|
|
270
|
-
return formatTemplate(params.labels.messages.lastSaved, message, formatPhiDateTime(row.savedAt, params.locale), row.savedByLabel ?? params.labels.systemLabel);
|
|
274
|
+
return formatTemplate(params.labels.messages.lastSaved, message, formatPhiDateTime(row.savedAt, params.locale, params.timeZone), row.savedByLabel ?? params.labels.systemLabel);
|
|
271
275
|
}
|
|
272
276
|
function formatRevisionMessage(labels, row) {
|
|
273
277
|
const meta = isPhiRecord(row.meta) ? row.meta : null;
|
|
@@ -32,7 +32,7 @@ export async function buildPhiDefaultBuilderRevisionsPageTree({ page, runtime, }
|
|
|
32
32
|
const credentials = {
|
|
33
33
|
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
34
34
|
internalToken: readPhiServerApiCredentials().internalToken,
|
|
35
|
-
locale: runtime.locale.current,
|
|
35
|
+
locale: runtime.locale.current, timeZone: runtime.site.timeZone,
|
|
36
36
|
};
|
|
37
37
|
const [chromeLabels, revisionsLabels] = await Promise.all([
|
|
38
38
|
getPhiBuilderChromeWidgetLabels(credentials),
|
|
@@ -399,7 +399,7 @@ export async function buildPhiDefaultBuilderRevisionsPageTree({ page, runtime, }
|
|
|
399
399
|
source: {
|
|
400
400
|
providerKey: PHI_REVISIONS_RUNTIME_DATA_PROVIDER_KEYS.table,
|
|
401
401
|
resourceKey: "history",
|
|
402
|
-
params: { labels: revisionsLabels, locale: runtime.locale.current },
|
|
402
|
+
params: { labels: revisionsLabels, locale: runtime.locale.current, timeZone: runtime.site.timeZone },
|
|
403
403
|
},
|
|
404
404
|
presentation: {
|
|
405
405
|
borders: true,
|
|
@@ -2,16 +2,12 @@ import "server-only";
|
|
|
2
2
|
import { resolvePhiCmsDescriptorCatalog } from "../../descriptor-compiler";
|
|
3
3
|
import { buildPhiThemeSetSelectOptions } from "../set-options";
|
|
4
4
|
import { getPhiHistoryLabels } from "../../../../components/widgets/label-sets/history";
|
|
5
|
-
import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
|
|
6
5
|
import { PHI_THEME_RUNTIME_CONTROLLER_DEFINITION, } from "./definition";
|
|
6
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
7
7
|
export const PHI_THEME_RUNTIME_CONTROLLER_SERVER_DEFINITION = {
|
|
8
8
|
...PHI_THEME_RUNTIME_CONTROLLER_DEFINITION,
|
|
9
9
|
serverPreload: async ({ runtime, runtimeModuleCatalog }) => ({
|
|
10
10
|
setOptions: buildPhiThemeSetSelectOptions(resolvePhiCmsDescriptorCatalog(runtimeModuleCatalog)),
|
|
11
|
-
historyLabels: await getPhiHistoryLabels(
|
|
12
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
13
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
14
|
-
locale: runtime.locale.current,
|
|
15
|
-
}),
|
|
11
|
+
historyLabels: await getPhiHistoryLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
|
|
16
12
|
}),
|
|
17
13
|
};
|
|
@@ -2,7 +2,6 @@ import { PHI_CMS_DEFAULT_SLOT_INDEX, PHI_CMS_SEQUENTIAL_LAYOUT_SLOTS, PHI_CMS_TH
|
|
|
2
2
|
import { PhiCmsFlags, PhiCmsRegionType, PhiCmsStatus } from "../../../../constants/phi-cms";
|
|
3
3
|
import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
|
|
4
4
|
import { resolvePhiShellHeaderHeight } from "../../../../helpers/shell-region-style";
|
|
5
|
-
import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
|
|
6
5
|
import { PHI_SIGNAL_VALUE_SCHEMAS, createPhiSignalAddress, createPhiSignalSubcontrolAddress, } from "../../../../types";
|
|
7
6
|
import { PHI_SPACE } from "../../../../theme/antd-css-var-contract";
|
|
8
7
|
import { buildPhiSiteThemeSelectOptions, resolvePhiThemeSelectionValue, } from "../../../../theme/phi-theme-selection";
|
|
@@ -13,6 +12,7 @@ import { PHI_THEME_SIGNAL_CHANNELS } from "../controller/signals";
|
|
|
13
12
|
import { PHI_THEME_RUNTIME_MODULE_ID } from "../ids";
|
|
14
13
|
import { buildPhiThemeSetSelectOptions } from "../set-options";
|
|
15
14
|
import { PHI_THEME_PAGE_LAYOUT_IDS, PHI_THEME_PAGE_WIDGET_IDS } from "../page-ids";
|
|
15
|
+
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
16
16
|
/**
|
|
17
17
|
* A Theme panel's way to hear the preview mode switch: the switch broadcasts on the Page, and every panel
|
|
18
18
|
* that draws in that mode takes it through this route, as any Widget takes an input.
|
|
@@ -146,11 +146,7 @@ function buildThemeControllerSettings(toolbarId) {
|
|
|
146
146
|
*/
|
|
147
147
|
export async function buildPhiDefaultBuilderThemePageTree({ page, runtime, registry, }) {
|
|
148
148
|
const nodes = createPhiCmsPresetNodes(page);
|
|
149
|
-
const labels = await getPhiBuilderChromeWidgetLabels(
|
|
150
|
-
apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
|
|
151
|
-
internalToken: readPhiServerApiCredentials().internalToken,
|
|
152
|
-
locale: runtime.locale.current,
|
|
153
|
-
});
|
|
149
|
+
const labels = await getPhiBuilderChromeWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
154
150
|
const themeToolbarId = createPhiCommandToolbarId(PHI_THEME_RUNTIME_MODULE_ID, PHI_THEME_PAGE_PRESET_KEY);
|
|
155
151
|
return {
|
|
156
152
|
page: nodes.page(),
|
|
@@ -1057,8 +1057,6 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1057
1057
|
const themeKey = resolveThemeKey(config);
|
|
1058
1058
|
const { state, draftRef, publishDraft, pickerTransaction } = usePhiBrandThemeDraft(runtime, themeKey);
|
|
1059
1059
|
const previewMode = usePhiBrandPreviewMode(resolveThemePayloadMode(state.draft), config?.signalRoutes);
|
|
1060
|
-
const loading = false;
|
|
1061
|
-
const saving = false;
|
|
1062
1060
|
const [activeColorSection, changeActiveColorSection] = usePhiBrandAccordionSection(BRAND_THEME_COLOR_COLLAPSE_STORAGE_KEY, BRAND_THEME_COLOR_SECTION_KEYS);
|
|
1063
1061
|
/*
|
|
1064
1062
|
* Everything the panel derives from the draft, derived once per draft and mode. The panel renders
|
|
@@ -1119,7 +1117,7 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1119
1117
|
ownGradients,
|
|
1120
1118
|
};
|
|
1121
1119
|
}, [customLabel, previewMode, state.draft, themeBlocks, themePresets]);
|
|
1122
|
-
return (_jsx(PhiFlexControl, { vertical: true, gap: clientToken.padding, style: { width: "100%", minWidth: 0
|
|
1120
|
+
return (_jsx(PhiFlexControl, { vertical: true, gap: clientToken.padding, style: { width: "100%", minWidth: 0 }, children: _jsx(PhiCardControl, { size: "small", children: _jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingSM, children: [_jsx(PhiBrandBlockPicker, { label: "Palette", value: themeComposition.palette.key, unavailable: themeComposition.unavailable.palette, options: themeBlocks.palettes, onChange: (key) => {
|
|
1123
1121
|
const palette = themeBlocks.palettes.find((candidate) => candidate.key === key);
|
|
1124
1122
|
if (!palette)
|
|
1125
1123
|
return;
|
|
@@ -1131,7 +1129,7 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1131
1129
|
flex: `0 1 min(100%, ${colorControlWidth}px)`,
|
|
1132
1130
|
minWidth: 0,
|
|
1133
1131
|
maxWidth: "100%",
|
|
1134
|
-
}, children: _jsx(PhiColorFieldControl, { ...pickerTransaction, tokenKey: "custom6", value: customPalette.custom6, defaultValue: resolvePhiThemePaletteCustomColors(selectedPreset.palette, previewMode).custom6,
|
|
1132
|
+
}, children: _jsx(PhiColorFieldControl, { ...pickerTransaction, tokenKey: "custom6", value: customPalette.custom6, defaultValue: resolvePhiThemePaletteCustomColors(selectedPreset.palette, previewMode).custom6, customColors: customColorOptions, presets: PHI_COLOR_PICKER_PRESETS, labels: colorPickerLabels, onChange: (value) => {
|
|
1135
1133
|
publishDraft(mergeThemeCustomColors(state.draft, buildPhiThemeCustomColorPalette(value), previewMode));
|
|
1136
1134
|
} }) })] })),
|
|
1137
1135
|
children: (_jsx(PhiFlexControl, { wrap: "wrap", style: { minWidth: 0, columnGap: clientToken.paddingXXS, rowGap: clientToken.paddingSM }, children: customColorOptions
|
|
@@ -1140,7 +1138,7 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1140
1138
|
flex: `1 1 calc((100% - ${clientToken.paddingXXS}) / 2)`,
|
|
1141
1139
|
minWidth: 0,
|
|
1142
1140
|
maxWidth: "100%",
|
|
1143
|
-
}, children: _jsx(PhiColorFieldControl, { ...pickerTransaction, label: item.label, tokenKey: item.key, value: item.value, defaultValue: resolvePhiThemePaletteCustomColors(selectedPreset.palette, previewMode)[item.key],
|
|
1141
|
+
}, children: _jsx(PhiColorFieldControl, { ...pickerTransaction, label: item.label, tokenKey: item.key, value: item.value, defaultValue: resolvePhiThemePaletteCustomColors(selectedPreset.palette, previewMode)[item.key], customColors: customColorOptions, presets: PHI_COLOR_PICKER_PRESETS, labels: colorPickerLabels, onChange: (value, tokenKey) => {
|
|
1144
1142
|
if (!tokenKey || !PHI_THEME_CUSTOM_COLOR_KEYS.includes(tokenKey)) {
|
|
1145
1143
|
return;
|
|
1146
1144
|
}
|
|
@@ -1176,7 +1174,7 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1176
1174
|
const contrastLevel = own || (ownTone && !neitherReads) ? "error" : "info";
|
|
1177
1175
|
const paint = `linear-gradient(${gradient.direction}, ${gradient.stops
|
|
1178
1176
|
.map((stop) => `${stop.color} ${stop.percent}%`).join(", ")})`;
|
|
1179
|
-
return (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: [_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: clientToken.paddingXS, children: [_jsx(PhiTypographyControl, { strong: true, children: `Gradient ${index + 1}` }), own || ownTone ? (_jsx(PhiButtonControl, { size: "small", type: "link",
|
|
1177
|
+
return (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: [_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: clientToken.paddingXS, children: [_jsx(PhiTypographyControl, { strong: true, children: `Gradient ${index + 1}` }), own || ownTone ? (_jsx(PhiButtonControl, { size: "small", type: "link", style: { paddingInline: 0, height: clientToken.controlHeightSM }, onClick: () => publishDraft(mergeThemeGradient(draftRef.current, key, null, previewMode)), label: "Reset to palette" })) : null] }), _jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "wrap", "aria-hidden": true, children: [[false, true].map((hover) => (_jsx("span", { style: {
|
|
1180
1178
|
display: "inline-flex",
|
|
1181
1179
|
alignItems: "center",
|
|
1182
1180
|
height: clientToken.controlHeight,
|
|
@@ -1200,12 +1198,12 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1200
1198
|
lineHeight: 2,
|
|
1201
1199
|
}, children: "Badge" })] }), _jsx(PhiBackgroundControl, { value: normalizePhiBackgroundWidgetConfig({
|
|
1202
1200
|
base: { kind: "gradient", direction: gradient.direction, stops: gradient.stops },
|
|
1203
|
-
}), baseKinds: ["gradient"], overlay: false, filters: [], motionModes: [], imageSourceKinds: [],
|
|
1201
|
+
}), baseKinds: ["gradient"], overlay: false, filters: [], motionModes: [], imageSourceKinds: [], onChange: (value) => {
|
|
1204
1202
|
const base = normalizePhiBackgroundWidgetConfig(value).base;
|
|
1205
1203
|
if (base.kind !== "gradient")
|
|
1206
1204
|
return;
|
|
1207
1205
|
publishDraft(mergeThemeGradient(draftRef.current, key, { direction: base.direction, stops: base.stops, ...(ownTone ? { text: ownTone } : {}) }, previewMode));
|
|
1208
|
-
} }, `${key}-${previewMode}`), _jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXXS, children: [_jsx(PhiTypographyControl, { type: "secondary", children: "Label colour" }), _jsx(PhiSegmentedControl, { block: true,
|
|
1206
|
+
} }, `${key}-${previewMode}`), _jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXXS, children: [_jsx(PhiTypographyControl, { type: "secondary", children: "Label colour" }), _jsx(PhiSegmentedControl, { block: true, value: ownTone ?? "auto", options: [
|
|
1209
1207
|
{ value: "auto", label: "Automatic" },
|
|
1210
1208
|
{ value: "light", label: "Light text" },
|
|
1211
1209
|
{ value: "dark", label: "Dark text" },
|
|
@@ -1240,7 +1238,7 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1240
1238
|
flex: `0 1 min(100%, ${colorControlWidth}px)`,
|
|
1241
1239
|
minWidth: 0,
|
|
1242
1240
|
maxWidth: "100%",
|
|
1243
|
-
}, children: _jsx(PhiColorFieldControl, { ...pickerTransaction, tokenKey: section.key, value: seedValue, defaultValue: seedDefaultValue,
|
|
1241
|
+
}, children: _jsx(PhiColorFieldControl, { ...pickerTransaction, tokenKey: section.key, value: seedValue, defaultValue: seedDefaultValue, customColors: customColorOptions, labels: colorPickerLabels, presets: section.presets, onChange: (value) => {
|
|
1244
1242
|
publishDraft(mergeThemeSeedToken(draftRef.current, section, value, previewMode));
|
|
1245
1243
|
} }) })] })),
|
|
1246
1244
|
children: (_jsx(PhiFlexControl, { wrap: "wrap", style: { minWidth: 0, columnGap: clientToken.paddingXXS, rowGap: clientToken.paddingSM }, children: section.derived.map((item) => {
|
|
@@ -1250,12 +1248,12 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1250
1248
|
flex: `1 1 calc((100% - ${clientToken.paddingXXS}) / 2)`,
|
|
1251
1249
|
minWidth: 0,
|
|
1252
1250
|
maxWidth: "100%",
|
|
1253
|
-
}, children: _jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXXS, children: [_jsx(PhiColorFieldControl, { ...pickerTransaction, label: item.label, tokenKey: item.key, value: overridden ? readEffectiveTokenString(colorToken, item.key, fallback) : fallback, defaultValue: fallback,
|
|
1251
|
+
}, children: _jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXXS, children: [_jsx(PhiColorFieldControl, { ...pickerTransaction, label: item.label, tokenKey: item.key, value: overridden ? readEffectiveTokenString(colorToken, item.key, fallback) : fallback, defaultValue: fallback, customColors: customColorOptions, labels: colorPickerLabels, onChange: (value, tokenKey) => {
|
|
1254
1252
|
if (!tokenKey) {
|
|
1255
1253
|
return;
|
|
1256
1254
|
}
|
|
1257
1255
|
publishDraft(mergeThemeColorOverride(state.draft, tokenKey, value, previewMode));
|
|
1258
|
-
} }), overridden ? (_jsx(PhiButtonControl, { size: "small", type: "link",
|
|
1256
|
+
} }), overridden ? (_jsx(PhiButtonControl, { size: "small", type: "link", style: { alignSelf: "flex-start", paddingInline: 0, height: clientToken.controlHeightSM }, onClick: () => publishDraft(omitThemeColorOverride(state.draft, item.key, previewMode)), label: "Reset override" })) : null] }) }, item.key));
|
|
1259
1257
|
}) })),
|
|
1260
1258
|
};
|
|
1261
1259
|
}),
|
|
@@ -1267,8 +1265,6 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1267
1265
|
const fieldLabelWidth = clientToken.controlHeight * 4;
|
|
1268
1266
|
const themeKey = resolveThemeKey(config);
|
|
1269
1267
|
const { state, publishDraft } = usePhiBrandThemeDraft(runtime, themeKey);
|
|
1270
|
-
const loading = false;
|
|
1271
|
-
const saving = false;
|
|
1272
1268
|
const [activeStyleSection, changeActiveStyleSection] = usePhiBrandAccordionSection(BRAND_THEME_STYLE_COLLAPSE_STORAGE_KEY, BRAND_THEME_STYLE_SECTION_KEYS);
|
|
1273
1269
|
const token = stripEmptyTokenValues(state.draft.style?.token ?? {});
|
|
1274
1270
|
const styleTokenInput = {
|
|
@@ -1286,7 +1282,7 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1286
1282
|
controlHeightLG: readEffectiveTokenNumber(styleTokenInput, "controlHeightLG", PHI_CONTROL_HEIGHTS.lg),
|
|
1287
1283
|
};
|
|
1288
1284
|
/** One row per size step: a label and the preset picker; Border Radius and Control Height share it. */
|
|
1289
|
-
const renderPresetSizeRows = (items, options) => (_jsx(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: items.map((item) => (_jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: item.label }), _jsx(PhiPresetSizeControl, {
|
|
1285
|
+
const renderPresetSizeRows = (items, options) => (_jsx(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: items.map((item) => (_jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: item.label }), _jsx(PhiPresetSizeControl, { value: item.value, fallbackKey: item.fallbackPreset, options: options, onChange: (value) => updateToken({ [item.key]: value }) })] }, item.key))) }));
|
|
1290
1286
|
const wireframe = readEffectiveTokenBoolean(styleTokenInput, "wireframe", true);
|
|
1291
1287
|
const baseFontSize = readEffectiveTokenNumber(styleTokenInput, "fontSize", 12);
|
|
1292
1288
|
function updateToken(tokenPatch) {
|
|
@@ -1339,7 +1335,7 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1339
1335
|
},
|
|
1340
1336
|
})),
|
|
1341
1337
|
], [fontFamilies, resolvedCatalogueFamilies, siteFontAssets.options]);
|
|
1342
|
-
return (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.padding, style: { width: "100%", minWidth: 0
|
|
1338
|
+
return (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.padding, style: { width: "100%", minWidth: 0 }, children: [siteFontFaceCss ? (_jsx("style", { href: "phi-theme-font-picker-faces", precedence: "default", dangerouslySetInnerHTML: { __html: siteFontFaceCss } })) : null, siteFontAssets.error ? (_jsx(PhiAlertControl, { level: "error", title: "The Site's own typefaces could not be read.", description: siteFontAssets.error })) : null, _jsx(PhiCardControl, { size: "small", children: _jsx(PhiAccordionControl, { openSection: activeStyleSection, onOpenSectionChange: changeActiveStyleSection, sections: [
|
|
1343
1339
|
{
|
|
1344
1340
|
key: "shapes",
|
|
1345
1341
|
label: _jsx(PhiTypographyControl, { strong: true, children: "Shapes" }),
|
|
@@ -1350,17 +1346,17 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1350
1346
|
description: `${themeComposition.style.title}: ${formatShapeLabel(resolvePhiUniformControlShape(themeComposition.style.shape.controls))}`,
|
|
1351
1347
|
},
|
|
1352
1348
|
...PHI_CONTROL_SHAPES.map((value) => ({ value, label: formatShapeLabel(value) })),
|
|
1353
|
-
], block: true,
|
|
1349
|
+
], block: true, onChange: (value) => publishDraft(value === "theme"
|
|
1354
1350
|
? clearThemeShapeScale(state.draft)
|
|
1355
1351
|
: mergeThemeControlShape(state.draft, createPhiControlShapeCorners(value))) }) })),
|
|
1356
1352
|
},
|
|
1357
1353
|
{
|
|
1358
1354
|
key: "buttonShadow",
|
|
1359
1355
|
label: _jsx(PhiTypographyControl, { strong: true, children: "Button Shadow" }),
|
|
1360
|
-
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingSM, children: [_jsx(PhiTypographyControl, { type: "secondary", children: "Under each kind of Button. Theme keeps the tinted line; applies to both modes." }), PHI_THEME_BUTTON_SHADOW_KINDS.map((item) => (_jsx(PhiSegmentedControl, { label: item.label, value: readThemeButtonShadowChoice(state.draft, item.key), options: PHI_THEME_BUTTON_SHADOW_OPTIONS, block: true,
|
|
1356
|
+
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingSM, children: [_jsx(PhiTypographyControl, { type: "secondary", children: "Under each kind of Button. Theme keeps the tinted line; applies to both modes." }), PHI_THEME_BUTTON_SHADOW_KINDS.map((item) => (_jsx(PhiSegmentedControl, { label: item.label, value: readThemeButtonShadowChoice(state.draft, item.key), options: PHI_THEME_BUTTON_SHADOW_OPTIONS, block: true, onChange: (choice) => publishDraft(mergeThemeButtonShadow(state.draft, item.key, choice)) }, item.key))), _jsx(PhiDividerControl, { style: { marginBlock: 0 } }), _jsx(PhiTypographyControl, { type: "secondary", children: "Fills every primary Button with one of the Theme's gradients (Color tab). A Button can still choose its own with the Gradient variant." }), _jsx(PhiSelectControl, { label: "Primary fill", value: readPhiThemeGradientKey(state.draft.buttons?.primaryGradient) ?? "none", options: [
|
|
1361
1357
|
{ value: "none", label: "Colour" },
|
|
1362
1358
|
...PHI_THEME_GRADIENT_KEYS.map((key, index) => ({ value: key, label: `Gradient ${index + 1}` })),
|
|
1363
|
-
],
|
|
1359
|
+
], onChange: (choice) => publishDraft(mergeThemePrimaryButtonGradient(state.draft, choice === "none" ? null : choice)) })] })),
|
|
1364
1360
|
},
|
|
1365
1361
|
{
|
|
1366
1362
|
key: "radius",
|
|
@@ -1383,9 +1379,9 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1383
1379
|
{
|
|
1384
1380
|
key: "fontFamily",
|
|
1385
1381
|
label: _jsx(PhiTypographyControl, { strong: true, children: "Font Family" }),
|
|
1386
|
-
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: [fontSlots.map((item) => (_jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: item.label }), _jsx(PhiSelectControl, { ariaLabel: `${item.label} font`, value: item.authored ?? undefined, placeholder: item.inherited || "Not installed", options: fontOptions, allowClear: true,
|
|
1382
|
+
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: [fontSlots.map((item) => (_jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: item.label }), _jsx(PhiSelectControl, { ariaLabel: `${item.label} font`, value: item.authored ?? undefined, placeholder: item.inherited || "Not installed", options: fontOptions, allowClear: true, size: "medium", style: { minWidth: 0, flex: "1 1 auto" }, onChange: (value) => publishDraft(
|
|
1387
1383
|
// A cleared select reports nothing, which hands the slot back to the Set.
|
|
1388
|
-
mergeThemeFontSlot(state.draft, item.key, value ?? null)) })] }, item.key))), _jsx(PhiDividerControl, { style: { marginBlock: clientToken.paddingXXS } }), _jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: "Headings" }), _jsx(PhiSegmentedControl, { value: readPhiThemeHeadingFont(state.draft.typography), options: PHI_THEME_HEADING_FONT_OPTIONS,
|
|
1384
|
+
mergeThemeFontSlot(state.draft, item.key, value ?? null)) })] }, item.key))), _jsx(PhiDividerControl, { style: { marginBlock: clientToken.paddingXXS } }), _jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "nowrap", children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${fieldLabelWidth}px` }, children: "Headings" }), _jsx(PhiSegmentedControl, { value: readPhiThemeHeadingFont(state.draft.typography), options: PHI_THEME_HEADING_FONT_OPTIONS, size: "small", onChange: (heading) => publishDraft(mergeThemeHeadingFont(state.draft, heading)) })] })] })),
|
|
1389
1385
|
},
|
|
1390
1386
|
{
|
|
1391
1387
|
key: "fontSize",
|
|
@@ -1395,7 +1391,7 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1395
1391
|
{
|
|
1396
1392
|
key: "wireframe",
|
|
1397
1393
|
label: _jsx(PhiTypographyControl, { strong: true, children: "Wireframe" }),
|
|
1398
|
-
children: (_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: clientToken.paddingSM, wrap: "wrap", children: [_jsx(PhiTypographyControl, { type: "secondary", children: "Dividing lines in dialogs and popovers, outlined steps and radios" }), _jsx(PhiSwitchControl, { checked: wireframe,
|
|
1394
|
+
children: (_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: clientToken.paddingSM, wrap: "wrap", children: [_jsx(PhiTypographyControl, { type: "secondary", children: "Dividing lines in dialogs and popovers, outlined steps and radios" }), _jsx(PhiSwitchControl, { checked: wireframe, checkedLabel: "On", uncheckedLabel: "Off", onChange: (checked) => updateToken({ wireframe: checked }) })] })),
|
|
1399
1395
|
},
|
|
1400
1396
|
] }) })] }));
|
|
1401
1397
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type { PhiCmsWidgetPlugin } from "../../../../../types";
|
|
2
|
-
import { type PhiCmsAreaKey } from "../../../../../constants/cms-areas";
|
|
3
2
|
import { type PhiControlSignalConfig } from "../../../../../components/widgets/config/control-signal-config";
|
|
4
3
|
export type PhiBuilderBrandWidgetConfig = Pick<PhiControlSignalConfig, "key" | "signalRoutes"> & {
|
|
5
4
|
themeKey?: string;
|
|
6
|
-
reviewArea?: PhiCmsAreaKey;
|
|
7
5
|
};
|
|
8
6
|
type PhiBuilderBrandWidgetDefinition = Pick<PhiCmsWidgetPlugin<PhiBuilderBrandWidgetConfig>, "kind" | "pluginKey" | "typeKey" | "title" | "description" | "category" | "iconFamily" | "runtimeSignals" | "requiredDataProviders" | "slotSizePolicy" | "fields" | "parseConfig">;
|
|
9
7
|
export declare const PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_DEFINITION: PhiBuilderBrandWidgetDefinition;
|