@phis/ui 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-root-layout.js +2 -0
- package/components/controls/phi-mask-picker-control.d.ts +7 -1
- package/components/controls/phi-mask-picker-control.js +18 -16
- package/components/controls/phi-media-picker-control.d.ts +30 -1
- package/components/controls/phi-media-picker-control.js +15 -2
- package/components/controls/phi-media-source-item-tile-control.d.ts +22 -0
- package/components/controls/phi-media-source-item-tile-control.js +65 -0
- package/components/forms/form-field-labels.d.ts +19 -0
- package/components/forms/form-field-labels.js +78 -0
- package/components/forms/form-provider-contract.d.ts +1 -17
- package/components/forms/form-provider-contract.js +4 -18
- package/components/forms/media-asset-field-keys.d.ts +27 -0
- package/components/forms/media-asset-field-keys.js +27 -0
- package/components/forms/phi-form-widget.js +5 -1
- package/components/forms/upload-field-keys.d.ts +27 -0
- package/components/forms/upload-field-keys.js +27 -0
- package/components/forms/upload-form-control.js +11 -5
- package/components/media/asset-controller-requirement.d.ts +9 -0
- package/components/media/asset-controller-requirement.js +42 -0
- package/components/media/label-sets/media-upload.d.ts +10 -0
- package/components/media/label-sets/media-upload.js +85 -0
- package/components/media/label-sets/media.js +31 -135
- package/components/media/media-upload-labels.d.ts +43 -0
- package/components/media/media-upload-labels.js +23 -0
- package/components/media/media-upload-refusals.d.ts +12 -0
- package/components/media/media-upload-refusals.js +28 -0
- package/components/media/media-widget-labels.d.ts +33 -26
- package/components/media/media-widget-labels.js +27 -36
- package/components/media/phi-area-upload-widget.js +3 -4
- package/components/media/phi-asset-inspector-section.d.ts +2 -2
- package/components/media/phi-image-inspector-widget.d.ts +2 -5
- package/components/media/phi-media-picker-binding.d.ts +17 -0
- package/components/media/phi-media-picker-binding.js +199 -4
- package/components/media/phi-media-picker-labels.d.ts +7 -0
- package/components/media/phi-media-picker-labels.js +25 -0
- package/components/media/phi-media-sources.d.ts +69 -0
- package/components/media/phi-media-sources.js +254 -0
- package/components/media/phi-media-upload.d.ts +1 -27
- package/components/media/phi-media-upload.js +4 -48
- package/components/runtime/runtime-controller-materialization.d.ts +5 -4
- package/components/runtime/runtime-controller-materialization.js +5 -4
- package/components/runtime/runtime-module-context.d.ts +5 -1
- package/components/runtime/runtime-module-context.js +4 -1
- package/components/runtime/runtime-module-media-source-client-manifest.d.ts +17 -0
- package/components/runtime/runtime-module-media-source-client-manifest.js +53 -0
- package/components/widgets/client/shared/phi-mask-picker.js +23 -13
- package/components/widgets/client/shared/phi-widget-image-tool-button.d.ts +7 -5
- package/components/widgets/client/shared/phi-widget-image-tool-button.js +11 -7
- package/components/widgets/client/shared/phi-widget-tool-buttons.js +2 -2
- package/components/widgets/config/mask.d.ts +6 -8
- package/components/widgets/config/mask.js +14 -12
- package/components/widgets/label-sets/authoring-tools.js +55 -1
- package/components/widgets/label-sets/history.js +0 -2
- package/components/widgets/label-sets/slot-upload.js +4 -4
- package/components/widgets/label-types/authoring-tools.d.ts +10 -0
- package/components/widgets/label-types/authoring-tools.js +6 -0
- package/components/widgets/label-types/history.d.ts +1 -1
- package/components/widgets/label-types/history.js +0 -1
- package/components/widgets/label-types/mask-picker.d.ts +31 -0
- package/components/widgets/label-types/mask-picker.js +30 -0
- package/components/widgets/label-types/slot-upload.d.ts +2 -2
- package/controls.d.ts +2 -0
- package/controls.js +1 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/module-client.d.ts +5 -1
- package/module-projection-client.js +1 -0
- package/next/areas/accounting-client.js +3 -2
- package/next/areas/admin-client.js +3 -2
- package/next/areas/app-client.js +3 -2
- package/next/areas/builder-client.js +3 -2
- package/next/areas/editor-client.js +3 -2
- package/next/areas/public-client.js +3 -2
- package/next/runtime-module-client-boundary.d.ts +3 -1
- package/next/runtime-module-client-boundary.js +3 -2
- package/package.json +7 -2
- package/plugins/runtime-modules/area-module-defaults.js +4 -3
- package/plugins/runtime-modules/asset/controller/definition.d.ts +2 -2
- package/plugins/runtime-modules/asset/controller/runtime.js +2 -2
- package/plugins/runtime-modules/asset/definition.d.ts +3 -2
- package/plugins/runtime-modules/asset/definition.js +11 -3
- package/plugins/runtime-modules/asset/ids.d.ts +8 -0
- package/plugins/runtime-modules/asset/ids.js +8 -0
- package/plugins/runtime-modules/asset/labels.d.ts +4 -0
- package/plugins/runtime-modules/asset/labels.js +94 -0
- package/plugins/runtime-modules/asset/media-asset-form-control.js +32 -7
- package/plugins/runtime-modules/asset/metadata-form.js +27 -18
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +14 -11
- package/plugins/runtime-modules/asset/widgets/area-upload/config.d.ts +2 -0
- package/plugins/runtime-modules/asset/widgets/area-upload/config.js +3 -0
- package/plugins/runtime-modules/asset/widgets/area-upload/server.js +3 -3
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.d.ts +2 -0
- package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.js +3 -0
- package/plugins/runtime-modules/asset/widgets/image-inspector/config.d.ts +2 -0
- package/plugins/runtime-modules/asset/widgets/image-inspector/config.js +3 -0
- package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -2
- package/plugins/runtime-modules/asset/widgets/media-picker/config.d.ts +1 -0
- package/plugins/runtime-modules/asset/widgets/media-picker/config.js +3 -0
- package/plugins/runtime-modules/auth/presets.d.ts +11 -0
- package/plugins/runtime-modules/auth/presets.js +17 -8
- package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +1 -4
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +2 -2
- package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +1 -3
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +4 -5
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -8
- package/plugins/runtime-modules/builder/clients/pages-header.js +2 -0
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +0 -1
- package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -1
- package/plugins/runtime-modules/builder/controller/page-controller.js +3 -3
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +4 -1
- package/plugins/runtime-modules/builder/inspector-section-widget.js +5 -2
- package/plugins/runtime-modules/builder/module-authoring-catalog.server.js +3 -1
- package/plugins/runtime-modules/builder/navigation-catalog.server.js +3 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +1 -1
- package/plugins/runtime-modules/builder/offered-page-catalog.js +8 -3
- package/plugins/runtime-modules/builder/options-providers.js +2 -2
- package/plugins/runtime-modules/builder/page-address-rule.d.ts +7 -0
- package/plugins/runtime-modules/builder/page-address-rule.js +12 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +4 -0
- package/plugins/runtime-modules/builder/persistence.js +2 -3
- package/plugins/runtime-modules/builder/public-route-collisions.d.ts +1 -1
- package/plugins/runtime-modules/builder/public-route-collisions.js +6 -1
- package/plugins/runtime-modules/builder/runtime-module-sandbox.server.js +8 -1
- package/plugins/runtime-modules/builder/runtime-module-selection.js +5 -5
- package/plugins/runtime-modules/builder/services/runtime-modules-table.js +24 -6
- package/plugins/runtime-modules/builder/signal-endpoints.js +2 -1
- package/plugins/runtime-modules/builder/use-offered-page-catalog.d.ts +2 -2
- package/plugins/runtime-modules/builder/use-offered-page-catalog.js +5 -3
- package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +19 -12
- package/plugins/runtime-modules/client-manifests/accounting.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/accounting.js +1 -0
- package/plugins/runtime-modules/client-manifests/admin.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/admin.js +1 -0
- package/plugins/runtime-modules/client-manifests/app.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/app.js +1 -0
- package/plugins/runtime-modules/client-manifests/builder.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/builder.js +1 -0
- package/plugins/runtime-modules/client-manifests/common.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/common.js +3 -0
- package/plugins/runtime-modules/client-manifests/editor.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/editor.js +1 -0
- package/plugins/runtime-modules/client-manifests/public.d.ts +1 -0
- package/plugins/runtime-modules/client-manifests/public.js +1 -0
- package/plugins/runtime-modules/contracts.js +61 -0
- package/plugins/runtime-modules/core/client-media-sources.d.ts +5 -0
- package/plugins/runtime-modules/core/client-media-sources.js +6 -0
- package/plugins/runtime-modules/core/messaging/forms.js +2 -15
- package/plugins/runtime-modules/core/messaging/labels.d.ts +0 -12
- package/plugins/runtime-modules/core/messaging/labels.js +0 -24
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -6
- package/plugins/runtime-modules/core/widgets/collection-view/config.d.ts +1 -0
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +7 -0
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +8 -2
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +14 -2
- package/plugins/runtime-modules/core/widgets/image/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/image/editor.d.ts +1 -4
- package/plugins/runtime-modules/core/widgets/image/editor.js +2 -2
- package/plugins/runtime-modules/core/widgets/slot-upload/client.js +2 -3
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +4 -25
- package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
- package/plugins/runtime-modules/preset-contracts/pub-area.js +0 -1
- package/plugins/runtime-modules/resolver.js +27 -1
- package/plugins/runtime-modules/settings.d.ts +20 -3
- package/plugins/runtime-modules/settings.js +35 -5
- package/plugins/runtime-modules/site-module-client-manifests.d.ts +2 -0
- package/plugins/runtime-modules/site-module-client-manifests.js +2 -0
- package/plugins/runtime-modules/site-modules-client.d.ts +5 -0
- package/plugins/runtime-modules/site-modules-client.js +1 -0
- package/plugins/runtime-modules/theme/brand-theme-model.js +0 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +97 -192
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +6 -2
- package/runtime-client-manifests-accounting.d.ts +1 -1
- package/runtime-client-manifests-accounting.js +1 -1
- package/runtime-client-manifests-admin.d.ts +1 -1
- package/runtime-client-manifests-admin.js +1 -1
- package/runtime-client-manifests-app.d.ts +1 -1
- package/runtime-client-manifests-app.js +1 -1
- package/runtime-client-manifests-builder.d.ts +1 -1
- package/runtime-client-manifests-builder.js +1 -1
- package/runtime-client-manifests-editor.d.ts +1 -1
- package/runtime-client-manifests-editor.js +1 -1
- package/runtime-client-manifests-public.d.ts +2 -1
- package/runtime-client-manifests-public.js +1 -1
- package/runtime-media-source-client.d.ts +3 -0
- package/runtime-media-source-client.js +2 -0
- package/server-helpers/cms-request.js +10 -4
- package/theme/phi-theme-presets.d.ts +13 -3
- package/theme/phi-theme-presets.js +20 -3
- package/theme/phi-theme-seed-derivation.d.ts +240 -0
- package/theme/phi-theme-seed-derivation.js +126 -0
- package/types/cms-plugins.d.ts +29 -0
- package/types/media-source.d.ts +48 -0
- package/types/media-source.js +1 -0
- package/types/site-config.d.ts +1 -2
- package/types/site-theme.d.ts +0 -6
- package/types.d.ts +1 -0
- package/components/media/asset-controller-routes.d.ts +0 -8
- package/components/media/asset-controller-routes.js +0 -31
- package/helpers/brand-contact.d.ts +0 -14
- package/helpers/brand-contact.js +0 -26
|
@@ -23,6 +23,35 @@ export function readPhiRuntimeModuleIds(value) {
|
|
|
23
23
|
}
|
|
24
24
|
return moduleIds;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Whether a Site chooses this Module per Area, or it is active without being chosen.
|
|
28
|
+
*
|
|
29
|
+
* Three kinds of Module are locked: the Platform Module, an Area's Base Module, and a Module declared
|
|
30
|
+
* `activation: "always"`. None of them is ever part of a stored selection -- each is added where the
|
|
31
|
+
* active set is built -- so this is the one question every reader and writer of a selection asks.
|
|
32
|
+
*/
|
|
33
|
+
export function isPhiRuntimeModuleSelectable(definition) {
|
|
34
|
+
return (definition.kind === "module" &&
|
|
35
|
+
definition.activation !== "always" &&
|
|
36
|
+
!isPhiRuntimeAreaBaseModuleId(definition.moduleId));
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The Modules declared `activation: "always"` that are active in an Area: every one eligible for it.
|
|
40
|
+
*
|
|
41
|
+
* In catalog order, so the active set a render builds is the same on every request. Whether its server
|
|
42
|
+
* part is there is not answered here; the callers that build an active set ask that of every Module
|
|
43
|
+
* they add, selected or not.
|
|
44
|
+
*/
|
|
45
|
+
export function listPhiAlwaysActiveRuntimeModuleIds(area, moduleDefinitions) {
|
|
46
|
+
const cmsArea = resolveSelectionArea(area);
|
|
47
|
+
const moduleIds = [];
|
|
48
|
+
for (const definition of moduleDefinitions) {
|
|
49
|
+
if (definition.activation === "always" && definition.eligibleAreas.includes(cmsArea)) {
|
|
50
|
+
moduleIds.push(definition.moduleId);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return moduleIds;
|
|
54
|
+
}
|
|
26
55
|
function resolveSelectionArea(area) {
|
|
27
56
|
const cmsArea = area === "public" ? "public" : area;
|
|
28
57
|
if (!isPhiCmsAreaKey(cmsArea)) {
|
|
@@ -41,7 +70,7 @@ export function assertPhiRuntimeModuleIdsAllowedForArea(area, moduleIds, moduleD
|
|
|
41
70
|
if (!definition.eligibleAreas.includes(cmsArea)) {
|
|
42
71
|
throw new Error(`Runtime module "${moduleId}" is not eligible for Area "${cmsArea}".`);
|
|
43
72
|
}
|
|
44
|
-
if (definition
|
|
73
|
+
if (!isPhiRuntimeModuleSelectable(definition)) {
|
|
45
74
|
throw new Error(`Locked runtime module "${moduleId}" must not be persisted in Area settings.`);
|
|
46
75
|
}
|
|
47
76
|
}
|
|
@@ -67,9 +96,10 @@ export function resolvePhiAuthUiProviderModuleId(moduleIds, moduleDefinitions) {
|
|
|
67
96
|
* `assertPhiRuntimeModuleIdsAllowedForArea` is what a Builder save still goes through, so nothing
|
|
68
97
|
* unresolvable is ever written back.
|
|
69
98
|
*
|
|
70
|
-
* The Area's own Base Module
|
|
71
|
-
*
|
|
72
|
-
*
|
|
99
|
+
* The Area's own Base Module, the Platform Module and a Module declared `activation: "always"` are not
|
|
100
|
+
* part of this at all. They are implicit and added where the active set is built
|
|
101
|
+
* (`listPhiAlwaysActiveRuntimeModuleIds` for the last); a build missing a Base or the Platform Module
|
|
102
|
+
* cannot serve the Area, and that is a failure rather than a selection to trim.
|
|
73
103
|
*/
|
|
74
104
|
export function readPhiRuntimeModuleIdsForArea(area, moduleIds, moduleDefinitions) {
|
|
75
105
|
const cmsArea = resolveSelectionArea(area);
|
|
@@ -85,7 +115,7 @@ export function readPhiRuntimeModuleIdsForArea(area, moduleIds, moduleDefinition
|
|
|
85
115
|
reading.unresolved.push({ moduleId, reason: "ineligible" });
|
|
86
116
|
continue;
|
|
87
117
|
}
|
|
88
|
-
if (definition
|
|
118
|
+
if (!isPhiRuntimeModuleSelectable(definition)) {
|
|
89
119
|
reading.unresolved.push({ moduleId, reason: "locked" });
|
|
90
120
|
continue;
|
|
91
121
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { PhiCmsAreaKey } from "../../constants/cms-areas";
|
|
2
2
|
import { type PhiRuntimeModuleCalendarAdapterClientManifest } from "../../components/runtime/runtime-module-calendar-adapter-client-manifest";
|
|
3
|
+
import { type PhiRuntimeModuleMediaSourceClientManifest } from "../../components/runtime/runtime-module-media-source-client-manifest";
|
|
3
4
|
import { type PhiRuntimeModuleDataProviderClientManifest } from "../../components/runtime/runtime-module-data-provider-client-manifest";
|
|
4
5
|
import { type PhiRuntimeModuleRenderClientManifest } from "../../components/runtime/runtime-module-render-client-manifest";
|
|
5
6
|
import type { PhiRuntimeModuleControllerClientManifest } from "../../components/runtime/runtime-module-controller-client-manifest";
|
|
@@ -25,6 +26,7 @@ export type PhiSiteModuleClientManifests = {
|
|
|
25
26
|
render: PhiRuntimeModuleRenderClientManifest;
|
|
26
27
|
dataProvider: PhiRuntimeModuleDataProviderClientManifest;
|
|
27
28
|
calendarAdapter: PhiRuntimeModuleCalendarAdapterClientManifest;
|
|
29
|
+
mediaSource: PhiRuntimeModuleMediaSourceClientManifest;
|
|
28
30
|
uiProvider: PhiRuntimeModuleUiProviderClientManifest;
|
|
29
31
|
};
|
|
30
32
|
export declare function extendWithPhiSiteModuleClientManifests(contributions: PhiSiteModuleClientContributions, area: PhiCmsAreaKey, base: PhiSiteModuleClientManifests): PhiSiteModuleClientManifests;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { extendPhiRuntimeModuleCalendarAdapterClientManifest, } from "../../components/runtime/runtime-module-calendar-adapter-client-manifest";
|
|
3
|
+
import { extendPhiRuntimeModuleMediaSourceClientManifest, } from "../../components/runtime/runtime-module-media-source-client-manifest";
|
|
3
4
|
import { extendPhiRuntimeModuleDataProviderClientManifest, } from "../../components/runtime/runtime-module-data-provider-client-manifest";
|
|
4
5
|
import { extendPhiRuntimeModuleRenderClientManifest, } from "../../components/runtime/runtime-module-render-client-manifest";
|
|
5
6
|
import { extendPhiRuntimeModuleUiProviderClientManifest, } from "../../components/runtime/runtime-module-ui-provider-client-manifest";
|
|
@@ -14,6 +15,7 @@ export function extendWithPhiSiteModuleClientManifests(contributions, area, base
|
|
|
14
15
|
render: extendPhiRuntimeModuleRenderClientManifest(base.render, areaContributions.renderClients ?? []),
|
|
15
16
|
dataProvider: extendPhiRuntimeModuleDataProviderClientManifest(base.dataProvider, areaContributions.dataProviders ?? []),
|
|
16
17
|
calendarAdapter: extendPhiRuntimeModuleCalendarAdapterClientManifest(base.calendarAdapter, contributions.calendarAdapters),
|
|
18
|
+
mediaSource: extendPhiRuntimeModuleMediaSourceClientManifest(base.mediaSource, contributions.mediaSources),
|
|
17
19
|
uiProvider: extendPhiRuntimeModuleUiProviderClientManifest(base.uiProvider, areaContributions.uiProviders ?? []),
|
|
18
20
|
};
|
|
19
21
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PhiCmsAreaKey } from "../../constants/cms-areas";
|
|
2
2
|
import type { PhiRuntimeModuleRenderClient } from "../../components/runtime/runtime-module-render-client-manifest";
|
|
3
3
|
import type { PhiRuntimeModuleCalendarAdapterClientDefinition, PhiRuntimeModuleDataProviderClientDefinition } from "../../types/cms-plugins";
|
|
4
|
+
import type { PhiMediaSourceClientDefinition } from "../../types/media-source";
|
|
4
5
|
import type { PhiRuntimeModuleControllerClientAreaContribution } from "./area-contributions-controller-client";
|
|
5
6
|
import type { PhiRuntimeModuleUiProviderClientDefinition } from "../../components/runtime/runtime-module-ui-provider-client-manifest";
|
|
6
7
|
/**
|
|
@@ -18,6 +19,9 @@ import type { PhiRuntimeModuleUiProviderClientDefinition } from "../../component
|
|
|
18
19
|
* their type when a Widget renders; an Area dimension would model a distinction the runtime does not
|
|
19
20
|
* make.
|
|
20
21
|
*
|
|
22
|
+
* Media sources are held flat for the same reason: the picker resolves them by key, and whether one is
|
|
23
|
+
* offered is decided by its Module being active in the Area, not by a list per Area.
|
|
24
|
+
*
|
|
21
25
|
* Authoring contributions are not here either, and for a stronger reason than shape: they live in
|
|
22
26
|
* `site-modules-authoring-client.tsx` and in a generated file of their own, so that importing this
|
|
23
27
|
* projection cannot drag a Builder implementation into a live Area's bundle.
|
|
@@ -34,6 +38,7 @@ export type PhiSiteModuleClientAreaContributions = {
|
|
|
34
38
|
export type PhiSiteModuleClientContributions = {
|
|
35
39
|
areas: Readonly<Partial<Record<PhiCmsAreaKey, PhiSiteModuleClientAreaContributions>>>;
|
|
36
40
|
calendarAdapters: readonly PhiRuntimeModuleCalendarAdapterClientDefinition[];
|
|
41
|
+
mediaSources: readonly PhiMediaSourceClientDefinition[];
|
|
37
42
|
};
|
|
38
43
|
/** A Site that installed no Modules of its own. */
|
|
39
44
|
export declare const PHI_NO_SITE_MODULE_CLIENT_CONTRIBUTIONS: PhiSiteModuleClientContributions;
|
|
@@ -9,7 +9,8 @@ import { usePhiControlSignalController } from "../../../../../components/widgets
|
|
|
9
9
|
import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../../types/signals";
|
|
10
10
|
import { createPhiThemeControllerAddress } from "../../../../../plugins/runtime-modules/theme/controller/address";
|
|
11
11
|
import { PHI_THEME_SIGNAL_CHANNELS } from "../../../../../plugins/runtime-modules/theme/controller/signals";
|
|
12
|
-
import { PHI_THEME_CUSTOM_COLOR_KEYS, isPhiThemePaletteModeSeedKey, mergePhiThemePalettes, resolvePhiThemeColorTokens, } from "../../../../../theme/phi-theme-presets";
|
|
12
|
+
import { PHI_THEME_CUSTOM_COLOR_KEYS, isPhiThemePaletteModeSeedKey, mergePhiThemePalettes, resolvePhiThemeColorTokens, resolvePhiThemePaletteTokens, } from "../../../../../theme/phi-theme-presets";
|
|
13
|
+
import { PHI_THEME_COLOR_DERIVED_TOKEN_KEYS, PHI_THEME_COLOR_SEED_DERIVATIONS, } from "../../../../../theme/phi-theme-seed-derivation";
|
|
13
14
|
import { buildPhiThemeCustomColorPalette, buildPhiThemeCustomColorTokens, resolvePhiThemePaletteCustomColors, } from "../../../../../theme/phi-theme-palette";
|
|
14
15
|
import { buildPhiThemeGradientTokens, PHI_THEME_GRADIENT_KEYS, readPhiThemeGradient, readPhiThemeGradientTextTone, readPhiThemeGradientKey, resolvePhiThemeGradients, resolvePhiThemeGradientText, resolvePhiThemeGradientContrast, resolvePhiThemeGradientAutoTextTone, resolvePhiThemeGradientInks, PHI_GRADIENT_HOVER_FILTER, } from "../../../../../theme/phi-theme-gradients";
|
|
15
16
|
import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
|
|
@@ -35,10 +36,9 @@ import { PHI_ROOT_BACKGROUND_BASE_KINDS, PHI_ROOT_BACKGROUND_IMAGE_SOURCE_KINDS,
|
|
|
35
36
|
import { PHI_SHELL_CHROME_OVERLAY_BASE_KINDS, PHI_SHELL_CHROME_OVERLAY_FILTERS, PHI_SHELL_CHROME_OVERLAY_IMAGE_SOURCE_KINDS, PHI_SHELL_CHROME_OVERLAY_MOTION_MODES, resolvePhiShellChromeOverlayConfig, resolvePhiShellChromePaneShadow, resolvePhiShellChromePaneShadows, resolvePhiShellChromeOverlayStyle, } from "../../../../../components/root/phi-shell-chrome-overlay";
|
|
36
37
|
import { normalizePhiBackgroundWidgetConfig } from "../../../../../components/widgets/config/background";
|
|
37
38
|
import { PhiMediaPickerBinding } from "../../../../../components/media/phi-media-picker-binding";
|
|
38
|
-
import {
|
|
39
|
+
import { usePhiMediaPickerLabels } from "../../../../../components/media/phi-media-picker-labels";
|
|
39
40
|
import { PHI_SEARCH_WIDGET_DEFAULT_LABELS } from "../../../../../components/widgets/label-types/search";
|
|
40
41
|
import { buildPhiMediaAssetContentDeliveryUrl, PhiMediaAssetFlags, PhiMediaKind, } from "../../../../../constants/media";
|
|
41
|
-
import { createPhiMediaPickerAssetControllerRoutes } from "../../../../../components/media/asset-controller-routes";
|
|
42
42
|
import { PhiPresetSizeControl } from "../../../../../components/controls/phi-preset-size-control";
|
|
43
43
|
import { PhiButtonControl } from "../../../../../components/controls/phi-button-control";
|
|
44
44
|
import { PhiCheckboxControl } from "../../../../../components/controls/phi-checkbox-control";
|
|
@@ -137,143 +137,21 @@ const PHI_STYLE_CONTROL_HEIGHT_PRESET_OPTIONS = PHI_STYLE_SIZE_PRESET_KEYS.map((
|
|
|
137
137
|
label: key,
|
|
138
138
|
value: PHI_STYLE_CONTROL_HEIGHT_PRESETS[key],
|
|
139
139
|
}));
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
{ key: "colorPrimaryTextActive", label: "Text Active" },
|
|
156
|
-
],
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
key: "colorInfo",
|
|
160
|
-
label: "Info",
|
|
161
|
-
fallback: "#1677ff",
|
|
162
|
-
presets: PHI_COLOR_PICKER_PRESETS,
|
|
163
|
-
derived: [
|
|
164
|
-
{ key: "colorInfoBg", label: "Bg" },
|
|
165
|
-
{ key: "colorInfoBgHover", label: "Bg Hover" },
|
|
166
|
-
{ key: "colorInfoBorder", label: "Border" },
|
|
167
|
-
{ key: "colorInfoBorderHover", label: "Border Hover" },
|
|
168
|
-
{ key: "colorInfoHover", label: "Hover" },
|
|
169
|
-
{ key: "colorInfoActive", label: "Active" },
|
|
170
|
-
{ key: "colorInfoText", label: "Text" },
|
|
171
|
-
{ key: "colorInfoTextHover", label: "Text Hover" },
|
|
172
|
-
{ key: "colorInfoTextActive", label: "Text Active" },
|
|
173
|
-
],
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
key: "colorSuccess",
|
|
177
|
-
label: "Success",
|
|
178
|
-
fallback: "#52c41a",
|
|
179
|
-
presets: PHI_COLOR_PICKER_PRESETS,
|
|
180
|
-
derived: [
|
|
181
|
-
{ key: "colorSuccessBg", label: "Bg" },
|
|
182
|
-
{ key: "colorSuccessBgHover", label: "Bg Hover" },
|
|
183
|
-
{ key: "colorSuccessBorder", label: "Border" },
|
|
184
|
-
{ key: "colorSuccessBorderHover", label: "Border Hover" },
|
|
185
|
-
{ key: "colorSuccessHover", label: "Hover" },
|
|
186
|
-
{ key: "colorSuccessActive", label: "Active" },
|
|
187
|
-
{ key: "colorSuccessText", label: "Text" },
|
|
188
|
-
{ key: "colorSuccessTextHover", label: "Text Hover" },
|
|
189
|
-
{ key: "colorSuccessTextActive", label: "Text Active" },
|
|
190
|
-
],
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
key: "colorWarning",
|
|
194
|
-
label: "Warning",
|
|
195
|
-
fallback: "#faad14",
|
|
196
|
-
presets: PHI_COLOR_PICKER_PRESETS,
|
|
197
|
-
derived: [
|
|
198
|
-
{ key: "colorWarningBg", label: "Bg" },
|
|
199
|
-
{ key: "colorWarningBgHover", label: "Bg Hover" },
|
|
200
|
-
{ key: "colorWarningBorder", label: "Border" },
|
|
201
|
-
{ key: "colorWarningBorderHover", label: "Border Hover" },
|
|
202
|
-
{ key: "colorWarningHover", label: "Hover" },
|
|
203
|
-
{ key: "colorWarningActive", label: "Active" },
|
|
204
|
-
{ key: "colorWarningText", label: "Text" },
|
|
205
|
-
{ key: "colorWarningTextHover", label: "Text Hover" },
|
|
206
|
-
{ key: "colorWarningTextActive", label: "Text Active" },
|
|
207
|
-
],
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
key: "colorError",
|
|
211
|
-
label: "Error",
|
|
212
|
-
fallback: "#ff4d4f",
|
|
213
|
-
presets: PHI_COLOR_PICKER_PRESETS,
|
|
214
|
-
derived: [
|
|
215
|
-
{ key: "colorErrorBg", label: "Bg" },
|
|
216
|
-
{ key: "colorErrorBgHover", label: "Bg Hover" },
|
|
217
|
-
{ key: "colorErrorBgFilledHover", label: "Bg Filled Hover" },
|
|
218
|
-
{ key: "colorErrorBgActive", label: "Bg Active" },
|
|
219
|
-
{ key: "colorErrorBorder", label: "Border" },
|
|
220
|
-
{ key: "colorErrorBorderHover", label: "Border Hover" },
|
|
221
|
-
{ key: "colorErrorHover", label: "Hover" },
|
|
222
|
-
{ key: "colorErrorActive", label: "Active" },
|
|
223
|
-
{ key: "colorErrorText", label: "Text" },
|
|
224
|
-
{ key: "colorErrorTextHover", label: "Text Hover" },
|
|
225
|
-
{ key: "colorErrorTextActive", label: "Text Active" },
|
|
226
|
-
],
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
key: "colorLink",
|
|
230
|
-
label: "Link",
|
|
231
|
-
fallback: "#1677ff",
|
|
232
|
-
presets: PHI_COLOR_PICKER_PRESETS,
|
|
233
|
-
derived: [
|
|
234
|
-
{ key: "colorLinkHover", label: "Hover" },
|
|
235
|
-
{ key: "colorLinkActive", label: "Active" },
|
|
236
|
-
],
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
key: "colorTextBase",
|
|
240
|
-
label: "Text Base",
|
|
241
|
-
fallback: "#000000",
|
|
242
|
-
presets: PHI_COLOR_PICKER_NEUTRAL_PRESETS,
|
|
243
|
-
derived: [
|
|
244
|
-
{ key: "colorText", label: "Text" },
|
|
245
|
-
{ key: "colorTextSecondary", label: "Secondary" },
|
|
246
|
-
{ key: "colorTextTertiary", label: "Tertiary" },
|
|
247
|
-
{ key: "colorTextQuaternary", label: "Quaternary" },
|
|
248
|
-
{ key: "colorTextHeading", label: "Heading" },
|
|
249
|
-
{ key: "colorTextLabel", label: "Label" },
|
|
250
|
-
{ key: "colorTextDescription", label: "Description" },
|
|
251
|
-
{ key: "colorTextDisabled", label: "Disabled" },
|
|
252
|
-
{ key: "colorTextPlaceholder", label: "Placeholder" },
|
|
253
|
-
{ key: "colorTextLightSolid", label: "Light Solid" },
|
|
254
|
-
],
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
key: "colorBgBase",
|
|
258
|
-
label: "Background Base",
|
|
259
|
-
fallback: "#ffffff",
|
|
260
|
-
presets: PHI_COLOR_PICKER_NEUTRAL_PRESETS,
|
|
261
|
-
derived: [
|
|
262
|
-
{ key: "colorBgLayout", label: "Layout" },
|
|
263
|
-
{ key: "colorBgContainer", label: "Container" },
|
|
264
|
-
{ key: "colorBgElevated", label: "Elevated" },
|
|
265
|
-
{ key: "colorBgSpotlight", label: "Spotlight" },
|
|
266
|
-
{ key: "colorBgContainerDisabled", label: "Container Disabled" },
|
|
267
|
-
{ key: "colorFill", label: "Fill" },
|
|
268
|
-
{ key: "colorFillSecondary", label: "Fill Secondary" },
|
|
269
|
-
{ key: "colorFillTertiary", label: "Fill Tertiary" },
|
|
270
|
-
{ key: "colorFillQuaternary", label: "Fill Quaternary" },
|
|
271
|
-
{ key: "colorBorder", label: "Border" },
|
|
272
|
-
{ key: "colorBorderSecondary", label: "Border Secondary" },
|
|
273
|
-
{ key: "colorBorderDisabled", label: "Border Disabled" },
|
|
274
|
-
],
|
|
275
|
-
},
|
|
276
|
-
];
|
|
140
|
+
/* What the Brand tab adds to each seed of the derivation table: its label, its fallback and its swatches. */
|
|
141
|
+
const THEME_COLOR_SEED_EDITING = {
|
|
142
|
+
colorPrimary: { label: "Primary", fallback: "#E05A2A", presets: PHI_COLOR_PICKER_PRESETS },
|
|
143
|
+
colorInfo: { label: "Info", fallback: "#1677ff", presets: PHI_COLOR_PICKER_PRESETS },
|
|
144
|
+
colorSuccess: { label: "Success", fallback: "#52c41a", presets: PHI_COLOR_PICKER_PRESETS },
|
|
145
|
+
colorWarning: { label: "Warning", fallback: "#faad14", presets: PHI_COLOR_PICKER_PRESETS },
|
|
146
|
+
colorError: { label: "Error", fallback: "#ff4d4f", presets: PHI_COLOR_PICKER_PRESETS },
|
|
147
|
+
colorLink: { label: "Link", fallback: "#1677ff", presets: PHI_COLOR_PICKER_PRESETS },
|
|
148
|
+
colorTextBase: { label: "Text Base", fallback: "#000000", presets: PHI_COLOR_PICKER_NEUTRAL_PRESETS },
|
|
149
|
+
colorBgBase: { label: "Background Base", fallback: "#ffffff", presets: PHI_COLOR_PICKER_NEUTRAL_PRESETS },
|
|
150
|
+
};
|
|
151
|
+
const THEME_COLOR_SEED_SECTIONS = PHI_THEME_COLOR_SEED_DERIVATIONS.map((seed) => ({
|
|
152
|
+
...seed,
|
|
153
|
+
...THEME_COLOR_SEED_EDITING[seed.key],
|
|
154
|
+
}));
|
|
277
155
|
/** The Collapse order of the colour panel, which decides which section an author finds open. */
|
|
278
156
|
const BRAND_THEME_COLOR_SECTION_KEYS = [
|
|
279
157
|
"custom",
|
|
@@ -309,27 +187,53 @@ function mergeThemePaletteMode(theme, mode, rewrite) {
|
|
|
309
187
|
});
|
|
310
188
|
}
|
|
311
189
|
/**
|
|
312
|
-
* A seed the author set
|
|
313
|
-
*
|
|
190
|
+
* A seed the author set, for the mode being edited: a primary that suits the light ground may be wrong on
|
|
191
|
+
* the dark one, so each mode holds its own. The two base seeds go where Ant Design reads mode seeds,
|
|
192
|
+
* every other seed is stated outright for the mode, which Ant Design reads as that mode's seed as well.
|
|
193
|
+
* Whatever the palette block states lies under it (`resolvePhiThemeColorTokens`). Setting a seed takes
|
|
314
194
|
* the section's derived overrides of that mode with it: they were tuned to the old seed.
|
|
315
195
|
*/
|
|
316
196
|
function mergeThemeSeedToken(theme, section, value, mode) {
|
|
317
197
|
const derivedTokenKeys = new Set(section.derived.map((item) => item.key));
|
|
318
|
-
|
|
198
|
+
return mergeThemePaletteMode(theme, mode, (current) => {
|
|
199
|
+
const overrides = Object.fromEntries(Object.entries(current.overrides ?? {}).filter(([key]) => !derivedTokenKeys.has(key)));
|
|
200
|
+
return isPhiThemePaletteModeSeedKey(section.key)
|
|
201
|
+
? { ...current, overrides, seed: { ...(current.seed ?? {}), [section.key]: value } }
|
|
202
|
+
: { ...current, overrides: { ...overrides, [section.key]: value } };
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/** Whether the Site's palette states this seed for the mode, on any level. */
|
|
206
|
+
function isThemeSeedAuthored(palette, key, mode) {
|
|
207
|
+
const own = (record) => Object.prototype.hasOwnProperty.call(record ?? {}, key);
|
|
208
|
+
return own(palette.seed) || own(palette.modes?.[mode]?.seed) || own(palette.modes?.[mode]?.overrides);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The seed handed back to the Theme in the mode being edited. The value this mode holds goes, and so
|
|
212
|
+
* does a shared one, which an older draft may still carry and which would otherwise show through; the
|
|
213
|
+
* other mode keeps that shared value as its own, so resetting one mode leaves the other as it looked.
|
|
214
|
+
*/
|
|
215
|
+
function omitThemeSeedToken(theme, section, mode) {
|
|
216
|
+
const without = (record) => Object.fromEntries(Object.entries(record ?? {}).filter(([key]) => key !== section.key));
|
|
217
|
+
const shared = theme.palette?.seed?.[section.key];
|
|
218
|
+
const otherMode = mode === "light" ? "dark" : "light";
|
|
219
|
+
let next = mergeThemePaletteMode(theme, mode, (current) => ({
|
|
319
220
|
...current,
|
|
320
|
-
|
|
221
|
+
seed: without(current.seed),
|
|
222
|
+
overrides: without(current.overrides),
|
|
321
223
|
}));
|
|
322
|
-
if (
|
|
323
|
-
return
|
|
324
|
-
...current,
|
|
325
|
-
seed: { ...(current.seed ?? {}), [section.key]: value },
|
|
326
|
-
}));
|
|
224
|
+
if (shared === undefined) {
|
|
225
|
+
return next;
|
|
327
226
|
}
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
227
|
+
const otherPalette = next.palette?.modes?.[otherMode] ?? {};
|
|
228
|
+
const otherStates = Object.prototype.hasOwnProperty.call(otherPalette.seed ?? {}, section.key)
|
|
229
|
+
|| Object.prototype.hasOwnProperty.call(otherPalette.overrides ?? {}, section.key);
|
|
230
|
+
if (!otherStates) {
|
|
231
|
+
next = mergeThemePaletteMode(next, otherMode, (current) => isPhiThemePaletteModeSeedKey(section.key)
|
|
232
|
+
? { ...current, seed: { ...(current.seed ?? {}), [section.key]: shared } }
|
|
233
|
+
: { ...current, overrides: { ...(current.overrides ?? {}), [section.key]: shared } });
|
|
234
|
+
}
|
|
235
|
+
const palette = next.palette ?? {};
|
|
236
|
+
return withThemePalette(next, { ...palette, seed: without(palette.seed) });
|
|
333
237
|
}
|
|
334
238
|
/** A derived colour stated outright for one mode: a hover tone that suits light is wrong in dark. */
|
|
335
239
|
function mergeThemeColorOverride(theme, tokenKey, value, mode) {
|
|
@@ -568,19 +472,22 @@ function readEffectiveTokenBoolean(token, key, fallback) {
|
|
|
568
472
|
const value = token[key];
|
|
569
473
|
return typeof value === "boolean" ? value : fallback;
|
|
570
474
|
}
|
|
571
|
-
|
|
572
|
-
*
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
* side and their four pickers were mounted at once -- two senders on one route are indistinguishable
|
|
576
|
-
* to anything that reads the route set. Only the mode being edited is mounted now, so the mode is a
|
|
577
|
-
* property of the value and not of the route. The Control is rebuilt when the mode changes, so a
|
|
578
|
-
* picker can never outlive the ground it was opened for.
|
|
475
|
+
/**
|
|
476
|
+
* The media picker a Background Control opens. A component and not the render function itself, because
|
|
477
|
+
* the picker's words are read from the context the server half of the Widget fills
|
|
478
|
+
* (`usePhiMediaPickerLabels`), and a hook cannot be called from a module-level render function.
|
|
579
479
|
*/
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
480
|
+
function PhiThemeRootBackgroundMediaPicker(props) {
|
|
481
|
+
const mediaPickerLabels = usePhiMediaPickerLabels();
|
|
482
|
+
return (_jsx(PhiMediaPickerBinding, { config: {
|
|
483
|
+
mediaType: PhiMediaKind.Image,
|
|
484
|
+
presentationFlags: PhiMediaAssetFlags.Background,
|
|
485
|
+
pageSize: 12,
|
|
486
|
+
showPagination: true,
|
|
487
|
+
showGroupFilter: true,
|
|
488
|
+
showSearchBar: true,
|
|
489
|
+
}, labels: mediaPickerLabels, searchLabels: PHI_SEARCH_WIDGET_DEFAULT_LABELS, value: props.value, open: props.open, trigger: props.trigger, onOpenChange: props.onOpenChange, onCommit: props.onCommit, onDiscard: props.onDiscard, onAssetSelect: props.onAssetSelect, onAssetClear: props.onAssetClear }));
|
|
490
|
+
}
|
|
584
491
|
/*
|
|
585
492
|
* The renderer a Background Control asks for its media picker.
|
|
586
493
|
*
|
|
@@ -589,15 +496,7 @@ const PHI_THEME_ROOT_BACKGROUND_MEDIA_ROUTES = {
|
|
|
589
496
|
* from the same Site library, and the picker has nothing in it that belongs to one surface.
|
|
590
497
|
*/
|
|
591
498
|
const renderPhiThemeRootBackgroundMediaPicker = function renderPhiThemeRootBackgroundMediaPicker(props) {
|
|
592
|
-
return
|
|
593
|
-
mediaType: PhiMediaKind.Image,
|
|
594
|
-
presentationFlags: PhiMediaAssetFlags.Background,
|
|
595
|
-
pageSize: 12,
|
|
596
|
-
showPagination: true,
|
|
597
|
-
showGroupFilter: true,
|
|
598
|
-
showSearchBar: true,
|
|
599
|
-
signalRoutes: PHI_THEME_ROOT_BACKGROUND_MEDIA_ROUTES[props.purpose],
|
|
600
|
-
}, labels: PHI_MEDIA_WIDGET_DEFAULT_LABELS, searchLabels: PHI_SEARCH_WIDGET_DEFAULT_LABELS, value: props.value, open: props.open, trigger: props.trigger, onOpenChange: props.onOpenChange, onCommit: props.onCommit, onDiscard: props.onDiscard, onAssetSelect: props.onAssetSelect, onAssetClear: props.onAssetClear }));
|
|
499
|
+
return _jsx(PhiThemeRootBackgroundMediaPicker, { ...props });
|
|
601
500
|
};
|
|
602
501
|
/** The Theme root's ground (`background`) or its chrome overlay (`chrome`) for one colour mode. */
|
|
603
502
|
function mergeThemeRootSurface(theme, surface, mode, value) {
|
|
@@ -1087,7 +986,7 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1087
986
|
* then redrew. Kept until the draft, the mode, the blocks or the presets change.
|
|
1088
987
|
*/
|
|
1089
988
|
const customLabel = colorPickerLabels?.custom ?? "Custom";
|
|
1090
|
-
const { themeComposition, selectedPreset, colorToken, ownPalette, ownOverrides, customPalette, customColorOptions, computedToken, gradients, gradientInks, ownGradients, } = useMemo(() => {
|
|
989
|
+
const { themeComposition, selectedPreset, colorToken, ownPalette, ownOverrides, customPalette, customColorOptions, computedToken, themeColorToken, themeStatedKeys, gradients, gradientInks, ownGradients, } = useMemo(() => {
|
|
1091
990
|
const themeComposition = resolvePhiThemeComposition(state.draft, themeBlocks);
|
|
1092
991
|
const selectedPreset = resolveThemePayloadPreset(state.draft, themePresets);
|
|
1093
992
|
/*
|
|
@@ -1103,7 +1002,20 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1103
1002
|
* what its "Reset override" hands back. Seeds stay in, so the algorithm derives from the author's
|
|
1104
1003
|
* seed.
|
|
1105
1004
|
*/
|
|
1106
|
-
const baseColorToken = resolvePhiThemeColorTokens(selectedPreset, mergeThemePaletteMode(state.draft, previewMode, (current) => ({
|
|
1005
|
+
const baseColorToken = resolvePhiThemeColorTokens(selectedPreset, mergeThemePaletteMode(state.draft, previewMode, (current) => ({
|
|
1006
|
+
...current,
|
|
1007
|
+
overrides: Object.fromEntries(Object.entries(current.overrides ?? {}).filter(([key]) => !PHI_THEME_COLOR_DERIVED_TOKEN_KEYS.has(key))),
|
|
1008
|
+
})).palette, previewMode);
|
|
1009
|
+
/*
|
|
1010
|
+
* The Theme alone, for the mode being edited: what a seed falls back to once the author hands it
|
|
1011
|
+
* back, and which colours the palette block states outright rather than leaving them to the
|
|
1012
|
+
* algorithm -- the ones the tab marks as the Theme's until the author sets the seed or the colour.
|
|
1013
|
+
*/
|
|
1014
|
+
const themeColorToken = resolvePhiAntdAliasTokens(previewMode, {
|
|
1015
|
+
...buildPhiEffectiveNonColorThemeTokens(state.draft),
|
|
1016
|
+
...resolvePhiThemeColorTokens(selectedPreset, null, previewMode),
|
|
1017
|
+
});
|
|
1018
|
+
const themeStatedKeys = new Set(Object.keys(resolvePhiThemePaletteTokens(selectedPreset.palette, previewMode)));
|
|
1107
1019
|
const customPalette = resolveThemeCustomPalette(state.draft, selectedPreset, previewMode);
|
|
1108
1020
|
const customColorOptions = PHI_THEME_CUSTOM_COLOR_KEYS.map((key, index) => ({
|
|
1109
1021
|
key,
|
|
@@ -1134,6 +1046,8 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1134
1046
|
customPalette,
|
|
1135
1047
|
customColorOptions,
|
|
1136
1048
|
computedToken,
|
|
1049
|
+
themeColorToken,
|
|
1050
|
+
themeStatedKeys,
|
|
1137
1051
|
gradients,
|
|
1138
1052
|
gradientInks,
|
|
1139
1053
|
ownGradients,
|
|
@@ -1248,9 +1162,8 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1248
1162
|
})] })),
|
|
1249
1163
|
},
|
|
1250
1164
|
...THEME_COLOR_SEED_SECTIONS.map((section) => {
|
|
1251
|
-
const seedAuthored =
|
|
1252
|
-
|
|
1253
|
-
const seedDefaultValue = readEffectiveTokenString(computedToken, section.key, section.fallback);
|
|
1165
|
+
const seedAuthored = isThemeSeedAuthored(ownPalette, section.key, previewMode);
|
|
1166
|
+
const seedDefaultValue = readEffectiveTokenString(themeColorToken, section.key, section.fallback);
|
|
1254
1167
|
const seedValue = seedAuthored
|
|
1255
1168
|
? readEffectiveTokenString(colorToken, section.key, seedDefaultValue)
|
|
1256
1169
|
: seedDefaultValue;
|
|
@@ -1262,7 +1175,7 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1262
1175
|
maxWidth: "100%",
|
|
1263
1176
|
}, children: _jsx(PhiColorFieldControl, { ...pickerTransaction, tokenKey: section.key, value: seedValue, defaultValue: seedDefaultValue, customColors: customColorOptions, labels: colorPickerLabels, presets: section.presets, onChange: (value) => {
|
|
1264
1177
|
publishDraft(mergeThemeSeedToken(draftRef.current, section, value, previewMode));
|
|
1265
|
-
} }) })] })),
|
|
1178
|
+
} }) }), seedAuthored ? (_jsx("div", { onClick: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), children: _jsx(PhiButtonControl, { size: "small", type: "link", style: { paddingInline: 0, height: clientToken.controlHeightSM }, onClick: () => publishDraft(omitThemeSeedToken(draftRef.current, section, previewMode)), label: "Reset to Theme" }) })) : null] })),
|
|
1266
1179
|
children: (_jsx(PhiFlexControl, { wrap: "wrap", style: { minWidth: 0, columnGap: clientToken.paddingXXS, rowGap: clientToken.paddingSM }, children: section.derived.map((item) => {
|
|
1267
1180
|
const overridden = Object.prototype.hasOwnProperty.call(ownOverrides, item.key);
|
|
1268
1181
|
const fallback = readEffectiveTokenString(computedToken, item.key, section.fallback);
|
|
@@ -1275,7 +1188,7 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1275
1188
|
return;
|
|
1276
1189
|
}
|
|
1277
1190
|
publishDraft(mergeThemeColorOverride(state.draft, tokenKey, value, previewMode));
|
|
1278
|
-
} }), 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));
|
|
1191
|
+
} }), 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" })) : !seedAuthored && themeStatedKeys.has(item.key) ? (_jsx(PhiTypographyControl, { type: "secondary", children: "Set by the Theme" })) : null] }) }, item.key));
|
|
1279
1192
|
}) })),
|
|
1280
1193
|
};
|
|
1281
1194
|
}),
|
|
@@ -1541,14 +1454,6 @@ function PhiBrandBlockPicker({ label, value, unavailable, options, onChange, })
|
|
|
1541
1454
|
function PhiBrandCopyModeButton({ mode, disabled, onCopy, }) {
|
|
1542
1455
|
return (_jsx(PhiButtonControl, { size: "small", style: { flexShrink: 0 }, disabled: disabled, onClick: onCopy, label: `Copy to ${mode === "dark" ? "light" : "dark"}` }));
|
|
1543
1456
|
}
|
|
1544
|
-
/*
|
|
1545
|
-
* The Logo's picker has a route set of its own.
|
|
1546
|
-
*
|
|
1547
|
-
* Two senders on one route are indistinguishable to whatever reads it, and the Identity panel can be
|
|
1548
|
-
* mounted while a Background picker still holds the Theme ground routes -- they live in different Stack
|
|
1549
|
-
* slots today, but a route set is cheap and a crossed picker is not.
|
|
1550
|
-
*/
|
|
1551
|
-
const PHI_THEME_BRAND_LOGO_MEDIA_ROUTES = createPhiMediaPickerAssetControllerRoutes("theme-brand-logo-media", "area");
|
|
1552
1457
|
/**
|
|
1553
1458
|
* The stored tracking as a number the control can hold.
|
|
1554
1459
|
*
|
|
@@ -1588,6 +1493,7 @@ const PHI_THEME_WORDMARK_WEIGHT_OPTIONS = [
|
|
|
1588
1493
|
*/
|
|
1589
1494
|
export function PhiBuilderBrandIdentityControlsWidgetClient({ runtime, config, }) {
|
|
1590
1495
|
const { presets: themePresets, token: clientToken } = usePhiConfig();
|
|
1496
|
+
const mediaPickerLabels = usePhiMediaPickerLabels();
|
|
1591
1497
|
const themeBlocks = usePhiThemeBlockCatalog();
|
|
1592
1498
|
const themeKey = resolveThemeKey(config);
|
|
1593
1499
|
const { state, publishDraft } = usePhiBrandThemeDraft(runtime, themeKey);
|
|
@@ -1701,8 +1607,7 @@ export function PhiBuilderBrandIdentityControlsWidgetClient({ runtime, config, }
|
|
|
1701
1607
|
showPagination: true,
|
|
1702
1608
|
showGroupFilter: true,
|
|
1703
1609
|
showSearchBar: true,
|
|
1704
|
-
|
|
1705
|
-
}, labels: PHI_MEDIA_WIDGET_DEFAULT_LABELS, searchLabels: PHI_SEARCH_WIDGET_DEFAULT_LABELS, value: logo?.sourceKind === "asset" ? logo.assetId : null, onAssetSelect: (asset) => publishDraft(mergeThemeBrandLogo(state.draft, mode, {
|
|
1610
|
+
}, labels: mediaPickerLabels, searchLabels: PHI_SEARCH_WIDGET_DEFAULT_LABELS, value: logo?.sourceKind === "asset" ? logo.assetId : null, onAssetSelect: (asset) => publishDraft(mergeThemeBrandLogo(state.draft, mode, {
|
|
1706
1611
|
sourceKind: "asset",
|
|
1707
1612
|
assetId: asset.id,
|
|
1708
1613
|
/*
|
|
@@ -4,6 +4,8 @@ import { PhiWidgetPreviewFallback } from "../../../../../components/widgets/buil
|
|
|
4
4
|
import { PhiBuilderBrandBackgroundControlsWidgetClient, PhiBuilderBrandIdentityControlsWidgetClient, PhiBuilderBrandStyleControlsWidgetClient, PhiBuilderBrandThemeControlsWidgetClient, PhiBuilderBrandThemePreviewWidgetClient, } from "./client";
|
|
5
5
|
import { PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_DEFINITION, PHI_BUILDER_BRAND_THEME_PREVIEW_WIDGET_DEFINITION, } from "./config";
|
|
6
6
|
import { getPhiColorPickerLabels } from "../../../../../components/widgets/label-sets/color-picker";
|
|
7
|
+
import { getPhiMediaWidgetLabels } from "../../../../../components/media/label-sets/media";
|
|
8
|
+
import { PhiMediaPickerLabelsProvider } from "../../../../../components/media/phi-media-picker-labels";
|
|
7
9
|
export const PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_PLUGIN = {
|
|
8
10
|
...PHI_BUILDER_BRAND_THEME_CONTROLS_WIDGET_DEFINITION,
|
|
9
11
|
render: async ({ runtime, config }) => (_jsx(PhiBuilderBrandThemeControlsWidgetClient, { runtime: runtime, config: config, colorPickerLabels: await getPhiColorPickerLabels(buildPhiWidgetLabelTranslatorOptions(runtime)) })),
|
|
@@ -21,11 +23,13 @@ export const PHI_BUILDER_BRAND_STYLE_CONTROLS_WIDGET_PLUGIN = {
|
|
|
21
23
|
};
|
|
22
24
|
export const PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_PLUGIN = {
|
|
23
25
|
...PHI_BUILDER_BRAND_BACKGROUND_CONTROLS_WIDGET_DEFINITION,
|
|
24
|
-
|
|
26
|
+
// The picker the Background Control opens says its words in the reader's language.
|
|
27
|
+
render: async ({ runtime, config }) => (_jsx(PhiMediaPickerLabelsProvider, { labels: await getPhiMediaWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)), children: _jsx(PhiBuilderBrandBackgroundControlsWidgetClient, { runtime: runtime, config: config }) })),
|
|
25
28
|
renderPreview: ({ widget }) => (_jsx(PhiWidgetPreviewFallback, { widget: widget, pluginTitle: "Builder Brand Background Controls", summary: "The Theme Root Background is authored live in the builder." })),
|
|
26
29
|
};
|
|
27
30
|
export const PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_PLUGIN = {
|
|
28
31
|
...PHI_BUILDER_BRAND_IDENTITY_CONTROLS_WIDGET_DEFINITION,
|
|
29
|
-
|
|
32
|
+
// The picker the Logo field opens says its words in the reader's language.
|
|
33
|
+
render: async ({ runtime, config }) => (_jsx(PhiMediaPickerLabelsProvider, { labels: await getPhiMediaWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime)), children: _jsx(PhiBuilderBrandIdentityControlsWidgetClient, { runtime: runtime, config: config }) })),
|
|
30
34
|
renderPreview: ({ widget }) => (_jsx(PhiWidgetPreviewFallback, { widget: widget, pluginTitle: "Builder Brand Identity Controls", summary: "The Logo and the Wordmark are authored live in the builder." })),
|
|
31
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PHI_ACCOUNTING_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/accounting";
|
|
1
|
+
export { PHI_ACCOUNTING_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/accounting";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PHI_ACCOUNTING_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/accounting";
|
|
1
|
+
export { PHI_ACCOUNTING_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/accounting";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PHI_ADMIN_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/admin";
|
|
1
|
+
export { PHI_ADMIN_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/admin";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PHI_ADMIN_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/admin";
|
|
1
|
+
export { PHI_ADMIN_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_ADMIN_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/admin";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PHI_APP_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/app";
|
|
1
|
+
export { PHI_APP_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/app";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PHI_APP_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/app";
|
|
1
|
+
export { PHI_APP_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_APP_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/app";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { PHI_BUILDER_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/builder";
|
|
1
|
+
export { PHI_BUILDER_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/builder";
|
|
2
2
|
export { PHI_BUILDER_TARGET_RUNTIME_MODULE_AUTHORING_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/builder-authoring";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { PHI_BUILDER_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/builder";
|
|
1
|
+
export { PHI_BUILDER_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_BUILDER_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/builder";
|
|
2
2
|
export { PHI_BUILDER_TARGET_RUNTIME_MODULE_AUTHORING_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/builder-authoring";
|