@phis/ui 0.6.2 → 0.6.4

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.
Files changed (206) hide show
  1. package/components/cms/phi-cms-root-layout.js +2 -0
  2. package/components/controls/phi-mask-picker-control.d.ts +7 -1
  3. package/components/controls/phi-mask-picker-control.js +18 -16
  4. package/components/controls/phi-media-picker-control.d.ts +30 -1
  5. package/components/controls/phi-media-picker-control.js +15 -2
  6. package/components/controls/phi-media-source-item-tile-control.d.ts +22 -0
  7. package/components/controls/phi-media-source-item-tile-control.js +65 -0
  8. package/components/controls/phi-segmented-control.js +15 -1
  9. package/components/forms/form-field-labels.d.ts +19 -0
  10. package/components/forms/form-field-labels.js +78 -0
  11. package/components/forms/form-provider-contract.d.ts +1 -17
  12. package/components/forms/form-provider-contract.js +4 -18
  13. package/components/forms/media-asset-field-keys.d.ts +27 -0
  14. package/components/forms/media-asset-field-keys.js +27 -0
  15. package/components/forms/phi-form-widget.js +5 -1
  16. package/components/forms/upload-field-keys.d.ts +27 -0
  17. package/components/forms/upload-field-keys.js +27 -0
  18. package/components/forms/upload-form-control.js +11 -5
  19. package/components/media/asset-controller-requirement.d.ts +9 -0
  20. package/components/media/asset-controller-requirement.js +42 -0
  21. package/components/media/label-sets/media-upload.d.ts +10 -0
  22. package/components/media/label-sets/media-upload.js +85 -0
  23. package/components/media/label-sets/media.js +31 -135
  24. package/components/media/media-upload-labels.d.ts +43 -0
  25. package/components/media/media-upload-labels.js +23 -0
  26. package/components/media/media-upload-refusals.d.ts +12 -0
  27. package/components/media/media-upload-refusals.js +28 -0
  28. package/components/media/media-widget-labels.d.ts +33 -26
  29. package/components/media/media-widget-labels.js +27 -36
  30. package/components/media/phi-area-upload-widget.js +3 -4
  31. package/components/media/phi-asset-inspector-section.d.ts +2 -2
  32. package/components/media/phi-image-inspector-widget.d.ts +2 -5
  33. package/components/media/phi-media-picker-binding.d.ts +17 -0
  34. package/components/media/phi-media-picker-binding.js +199 -4
  35. package/components/media/phi-media-picker-labels.d.ts +7 -0
  36. package/components/media/phi-media-picker-labels.js +25 -0
  37. package/components/media/phi-media-sources.d.ts +69 -0
  38. package/components/media/phi-media-sources.js +254 -0
  39. package/components/media/phi-media-upload.d.ts +1 -27
  40. package/components/media/phi-media-upload.js +4 -48
  41. package/components/runtime/runtime-controller-materialization.d.ts +5 -4
  42. package/components/runtime/runtime-controller-materialization.js +5 -4
  43. package/components/runtime/runtime-module-context.d.ts +5 -1
  44. package/components/runtime/runtime-module-context.js +4 -1
  45. package/components/runtime/runtime-module-media-source-client-manifest.d.ts +17 -0
  46. package/components/runtime/runtime-module-media-source-client-manifest.js +53 -0
  47. package/components/widgets/client/shared/phi-mask-picker.js +23 -13
  48. package/components/widgets/client/shared/phi-widget-image-tool-button.d.ts +7 -5
  49. package/components/widgets/client/shared/phi-widget-image-tool-button.js +11 -7
  50. package/components/widgets/client/shared/phi-widget-tool-buttons.js +2 -2
  51. package/components/widgets/config/mask.d.ts +6 -8
  52. package/components/widgets/config/mask.js +14 -12
  53. package/components/widgets/label-sets/authoring-tools.js +55 -1
  54. package/components/widgets/label-sets/history.js +0 -2
  55. package/components/widgets/label-sets/slot-upload.js +4 -4
  56. package/components/widgets/label-types/authoring-tools.d.ts +10 -0
  57. package/components/widgets/label-types/authoring-tools.js +6 -0
  58. package/components/widgets/label-types/history.d.ts +1 -1
  59. package/components/widgets/label-types/history.js +0 -1
  60. package/components/widgets/label-types/mask-picker.d.ts +31 -0
  61. package/components/widgets/label-types/mask-picker.js +30 -0
  62. package/components/widgets/label-types/slot-upload.d.ts +2 -2
  63. package/controls.d.ts +2 -0
  64. package/controls.js +1 -0
  65. package/helpers/cms-region-keys.d.ts +1 -1
  66. package/module-client.d.ts +5 -1
  67. package/module-projection-client.js +1 -0
  68. package/next/areas/accounting-client.js +3 -2
  69. package/next/areas/admin-client.js +3 -2
  70. package/next/areas/app-client.js +3 -2
  71. package/next/areas/builder-client.js +3 -2
  72. package/next/areas/editor-client.js +3 -2
  73. package/next/areas/public-client.js +3 -2
  74. package/next/runtime-module-client-boundary.d.ts +3 -1
  75. package/next/runtime-module-client-boundary.js +3 -2
  76. package/package.json +7 -2
  77. package/plugins/runtime-modules/area-module-defaults.js +4 -3
  78. package/plugins/runtime-modules/asset/controller/definition.d.ts +2 -2
  79. package/plugins/runtime-modules/asset/controller/runtime.js +2 -2
  80. package/plugins/runtime-modules/asset/definition.d.ts +3 -2
  81. package/plugins/runtime-modules/asset/definition.js +11 -3
  82. package/plugins/runtime-modules/asset/ids.d.ts +8 -0
  83. package/plugins/runtime-modules/asset/ids.js +8 -0
  84. package/plugins/runtime-modules/asset/labels.d.ts +4 -0
  85. package/plugins/runtime-modules/asset/labels.js +94 -0
  86. package/plugins/runtime-modules/asset/media-asset-form-control.js +32 -7
  87. package/plugins/runtime-modules/asset/metadata-form.js +27 -18
  88. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +14 -11
  89. package/plugins/runtime-modules/asset/widgets/area-upload/config.d.ts +2 -0
  90. package/plugins/runtime-modules/asset/widgets/area-upload/config.js +3 -0
  91. package/plugins/runtime-modules/asset/widgets/area-upload/server.js +3 -3
  92. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.d.ts +2 -0
  93. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.js +3 -0
  94. package/plugins/runtime-modules/asset/widgets/image-inspector/config.d.ts +2 -0
  95. package/plugins/runtime-modules/asset/widgets/image-inspector/config.js +3 -0
  96. package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -2
  97. package/plugins/runtime-modules/asset/widgets/media-picker/config.d.ts +1 -0
  98. package/plugins/runtime-modules/asset/widgets/media-picker/config.js +3 -0
  99. package/plugins/runtime-modules/auth/presets.d.ts +11 -0
  100. package/plugins/runtime-modules/auth/presets.js +17 -8
  101. package/plugins/runtime-modules/auth/services/installations-table.js +3 -1
  102. package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +1 -4
  103. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +2 -2
  104. package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +1 -3
  105. package/plugins/runtime-modules/builder/clients/inspector-image-field.js +4 -5
  106. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -8
  107. package/plugins/runtime-modules/builder/clients/pages-header.js +2 -0
  108. package/plugins/runtime-modules/builder/clients/widget-inspector.js +0 -1
  109. package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -1
  110. package/plugins/runtime-modules/builder/controller/page-controller.js +3 -3
  111. package/plugins/runtime-modules/builder/controller/workspace-controller.js +4 -1
  112. package/plugins/runtime-modules/builder/inspector-section-widget.js +5 -2
  113. package/plugins/runtime-modules/builder/module-authoring-catalog.server.js +3 -1
  114. package/plugins/runtime-modules/builder/navigation-catalog.server.js +3 -0
  115. package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +1 -1
  116. package/plugins/runtime-modules/builder/offered-page-catalog.js +8 -3
  117. package/plugins/runtime-modules/builder/options-providers.js +2 -2
  118. package/plugins/runtime-modules/builder/page-address-rule.d.ts +7 -0
  119. package/plugins/runtime-modules/builder/page-address-rule.js +12 -0
  120. package/plugins/runtime-modules/builder/page-presets.server.js +4 -0
  121. package/plugins/runtime-modules/builder/persistence.js +2 -3
  122. package/plugins/runtime-modules/builder/public-route-collisions.d.ts +1 -1
  123. package/plugins/runtime-modules/builder/public-route-collisions.js +6 -1
  124. package/plugins/runtime-modules/builder/runtime-module-sandbox.server.js +8 -1
  125. package/plugins/runtime-modules/builder/runtime-module-selection.js +5 -5
  126. package/plugins/runtime-modules/builder/services/runtime-modules-table.js +24 -6
  127. package/plugins/runtime-modules/builder/signal-endpoints.js +2 -1
  128. package/plugins/runtime-modules/builder/use-offered-page-catalog.d.ts +2 -2
  129. package/plugins/runtime-modules/builder/use-offered-page-catalog.js +5 -3
  130. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +19 -12
  131. package/plugins/runtime-modules/client-manifests/accounting.d.ts +1 -0
  132. package/plugins/runtime-modules/client-manifests/accounting.js +1 -0
  133. package/plugins/runtime-modules/client-manifests/admin.d.ts +1 -0
  134. package/plugins/runtime-modules/client-manifests/admin.js +1 -0
  135. package/plugins/runtime-modules/client-manifests/app.d.ts +1 -0
  136. package/plugins/runtime-modules/client-manifests/app.js +1 -0
  137. package/plugins/runtime-modules/client-manifests/builder.d.ts +1 -0
  138. package/plugins/runtime-modules/client-manifests/builder.js +1 -0
  139. package/plugins/runtime-modules/client-manifests/common.d.ts +1 -0
  140. package/plugins/runtime-modules/client-manifests/common.js +3 -0
  141. package/plugins/runtime-modules/client-manifests/editor.d.ts +1 -0
  142. package/plugins/runtime-modules/client-manifests/editor.js +1 -0
  143. package/plugins/runtime-modules/client-manifests/public.d.ts +1 -0
  144. package/plugins/runtime-modules/client-manifests/public.js +1 -0
  145. package/plugins/runtime-modules/contracts.js +61 -0
  146. package/plugins/runtime-modules/core/client-media-sources.d.ts +5 -0
  147. package/plugins/runtime-modules/core/client-media-sources.js +6 -0
  148. package/plugins/runtime-modules/core/messaging/forms.js +2 -15
  149. package/plugins/runtime-modules/core/messaging/labels.d.ts +0 -12
  150. package/plugins/runtime-modules/core/messaging/labels.js +0 -24
  151. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -6
  152. package/plugins/runtime-modules/core/widgets/collection-view/config.d.ts +1 -0
  153. package/plugins/runtime-modules/core/widgets/collection-view/config.js +7 -0
  154. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +8 -2
  155. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
  156. package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +1 -1
  157. package/plugins/runtime-modules/core/widgets/collection-view/server.js +14 -2
  158. package/plugins/runtime-modules/core/widgets/image/authoring.js +1 -1
  159. package/plugins/runtime-modules/core/widgets/image/editor.d.ts +1 -4
  160. package/plugins/runtime-modules/core/widgets/image/editor.js +2 -2
  161. package/plugins/runtime-modules/core/widgets/slot-upload/client.js +2 -3
  162. package/plugins/runtime-modules/editor/services/releases-table.js +4 -1
  163. package/plugins/runtime-modules/observability/services/table.js +3 -1
  164. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +4 -25
  165. package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
  166. package/plugins/runtime-modules/preset-contracts/pub-area.js +0 -1
  167. package/plugins/runtime-modules/resolver.js +27 -1
  168. package/plugins/runtime-modules/settings.d.ts +20 -3
  169. package/plugins/runtime-modules/settings.js +35 -5
  170. package/plugins/runtime-modules/site-module-client-manifests.d.ts +2 -0
  171. package/plugins/runtime-modules/site-module-client-manifests.js +2 -0
  172. package/plugins/runtime-modules/site-modules-client.d.ts +5 -0
  173. package/plugins/runtime-modules/site-modules-client.js +1 -0
  174. package/plugins/runtime-modules/theme/brand-theme-model.js +0 -1
  175. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +97 -192
  176. package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +6 -2
  177. package/plugins/runtime-modules/user-management/services/table.js +3 -1
  178. package/runtime-client-manifests-accounting.d.ts +1 -1
  179. package/runtime-client-manifests-accounting.js +1 -1
  180. package/runtime-client-manifests-admin.d.ts +1 -1
  181. package/runtime-client-manifests-admin.js +1 -1
  182. package/runtime-client-manifests-app.d.ts +1 -1
  183. package/runtime-client-manifests-app.js +1 -1
  184. package/runtime-client-manifests-builder.d.ts +1 -1
  185. package/runtime-client-manifests-builder.js +1 -1
  186. package/runtime-client-manifests-editor.d.ts +1 -1
  187. package/runtime-client-manifests-editor.js +1 -1
  188. package/runtime-client-manifests-public.d.ts +2 -1
  189. package/runtime-client-manifests-public.js +1 -1
  190. package/runtime-media-source-client.d.ts +3 -0
  191. package/runtime-media-source-client.js +2 -0
  192. package/server-helpers/cms-request.js +10 -4
  193. package/theme/phi-theme-presets.d.ts +13 -3
  194. package/theme/phi-theme-presets.js +20 -3
  195. package/theme/phi-theme-seed-derivation.d.ts +240 -0
  196. package/theme/phi-theme-seed-derivation.js +126 -0
  197. package/types/cms-plugins.d.ts +29 -0
  198. package/types/media-source.d.ts +48 -0
  199. package/types/media-source.js +1 -0
  200. package/types/site-config.d.ts +1 -2
  201. package/types/site-theme.d.ts +0 -6
  202. package/types.d.ts +1 -0
  203. package/components/media/asset-controller-routes.d.ts +0 -8
  204. package/components/media/asset-controller-routes.js +0 -31
  205. package/helpers/brand-contact.d.ts +0 -14
  206. package/helpers/brand-contact.js +0 -26
@@ -3,6 +3,22 @@ import type { PhisDeclarableThreadKind } from "../../types/threads";
3
3
  import type { PhiDeclaredModuleSeed } from "../../types/seed";
4
4
  import type { PhiRuntimeModuleDefinition, PhiRuntimeModuleId } from "./contracts";
5
5
  export declare function readPhiRuntimeModuleIds(value: unknown): PhiRuntimeModuleId[] | null;
6
+ /**
7
+ * Whether a Site chooses this Module per Area, or it is active without being chosen.
8
+ *
9
+ * Three kinds of Module are locked: the Platform Module, an Area's Base Module, and a Module declared
10
+ * `activation: "always"`. None of them is ever part of a stored selection -- each is added where the
11
+ * active set is built -- so this is the one question every reader and writer of a selection asks.
12
+ */
13
+ export declare function isPhiRuntimeModuleSelectable(definition: Pick<PhiRuntimeModuleDefinition, "moduleId" | "kind" | "activation">): boolean;
14
+ /**
15
+ * The Modules declared `activation: "always"` that are active in an Area: every one eligible for it.
16
+ *
17
+ * In catalog order, so the active set a render builds is the same on every request. Whether its server
18
+ * part is there is not answered here; the callers that build an active set ask that of every Module
19
+ * they add, selected or not.
20
+ */
21
+ export declare function listPhiAlwaysActiveRuntimeModuleIds(area: string, moduleDefinitions: Iterable<Pick<PhiRuntimeModuleDefinition, "moduleId" | "activation" | "eligibleAreas">>): PhiRuntimeModuleId[];
6
22
  export declare function assertPhiRuntimeModuleIdsAllowedForArea(area: string, moduleIds: readonly PhiRuntimeModuleId[], moduleDefinitions: readonly PhiRuntimeModuleDefinition[]): void;
7
23
  export declare function resolvePhiAuthUiProviderModuleId(moduleIds: readonly PhiRuntimeModuleId[], moduleDefinitions: readonly PhiRuntimeModuleDefinition[]): PhiRuntimeModuleId | null;
8
24
  /** Why a stored Module id is not part of the selection this build can serve. */
@@ -27,9 +43,10 @@ export type PhiRuntimeModuleSelectionReading = {
27
43
  * `assertPhiRuntimeModuleIdsAllowedForArea` is what a Builder save still goes through, so nothing
28
44
  * unresolvable is ever written back.
29
45
  *
30
- * The Area's own Base Module and the Platform Module are not part of this at all. They are implicit and
31
- * added elsewhere; a build missing one of those cannot serve the Area, and that is a failure rather
32
- * than a selection to trim.
46
+ * The Area's own Base Module, the Platform Module and a Module declared `activation: "always"` are not
47
+ * part of this at all. They are implicit and added where the active set is built
48
+ * (`listPhiAlwaysActiveRuntimeModuleIds` for the last); a build missing a Base or the Platform Module
49
+ * cannot serve the Area, and that is a failure rather than a selection to trim.
33
50
  */
34
51
  export declare function readPhiRuntimeModuleIdsForArea(area: string, moduleIds: readonly PhiRuntimeModuleId[] | null | undefined, moduleDefinitions: readonly PhiRuntimeModuleDefinition[]): PhiRuntimeModuleSelectionReading;
35
52
  /**
@@ -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.kind === "platform" || isPhiRuntimeAreaBaseModuleId(moduleId)) {
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 and the Platform Module are not part of this at all. They are implicit and
71
- * added elsewhere; a build missing one of those cannot serve the Area, and that is a failure rather
72
- * than a selection to trim.
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.kind === "platform" || isPhiRuntimeAreaBaseModuleId(moduleId)) {
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;
@@ -3,4 +3,5 @@
3
3
  export const PHI_NO_SITE_MODULE_CLIENT_CONTRIBUTIONS = {
4
4
  areas: {},
5
5
  calendarAdapters: [],
6
+ mediaSources: [],
6
7
  };
@@ -23,7 +23,6 @@ const PHI_THEME_HISTORY_PART_BY_FIELD = {
23
23
  buttons: "style",
24
24
  fonts: "fonts",
25
25
  typography: "fonts",
26
- contact: "contact",
27
26
  brand: "brand",
28
27
  widgets: "widgets",
29
28
  shell: "shell",
@@ -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 { PHI_MEDIA_WIDGET_DEFAULT_LABELS } from "../../../../../components/media/media-widget-labels";
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
- const THEME_COLOR_SEED_SECTIONS = [
141
- {
142
- key: "colorPrimary",
143
- label: "Primary",
144
- fallback: "#E05A2A",
145
- presets: PHI_COLOR_PICKER_PRESETS,
146
- derived: [
147
- { key: "colorPrimaryBg", label: "Bg" },
148
- { key: "colorPrimaryBgHover", label: "Bg Hover" },
149
- { key: "colorPrimaryBorder", label: "Border" },
150
- { key: "colorPrimaryBorderHover", label: "Border Hover" },
151
- { key: "colorPrimaryHover", label: "Hover" },
152
- { key: "colorPrimaryActive", label: "Active" },
153
- { key: "colorPrimaryText", label: "Text" },
154
- { key: "colorPrimaryTextHover", label: "Text Hover" },
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. The two base seeds belong to the mode being edited, every other seed to the
313
- * palette as a whole, because Ant Design derives both modes from the one value. Setting a seed takes
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
- const withoutDerived = mergeThemePaletteMode(theme, mode, (current) => ({
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
- overrides: Object.fromEntries(Object.entries(current.overrides ?? {}).filter(([key]) => !derivedTokenKeys.has(key))),
221
+ seed: without(current.seed),
222
+ overrides: without(current.overrides),
321
223
  }));
322
- if (isPhiThemePaletteModeSeedKey(section.key)) {
323
- return mergeThemePaletteMode(withoutDerived, mode, (current) => ({
324
- ...current,
325
- seed: { ...(current.seed ?? {}), [section.key]: value },
326
- }));
224
+ if (shared === undefined) {
225
+ return next;
327
226
  }
328
- const palette = withoutDerived.palette ?? {};
329
- return withThemePalette(withoutDerived, {
330
- ...palette,
331
- seed: { ...(palette.seed ?? {}), [section.key]: value },
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
- * One route set per purpose: the preview swatch and the image field each open their own picker.
573
- *
574
- * There used to be a set per mode as well, because the light and the dark ground were edited side by
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
- const PHI_THEME_ROOT_BACKGROUND_MEDIA_ROUTES = {
581
- preview: createPhiMediaPickerAssetControllerRoutes("theme-root-background-preview-media", "area"),
582
- field: createPhiMediaPickerAssetControllerRoutes("theme-root-background-field-media", "area"),
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 (_jsx(PhiMediaPickerBinding, { config: {
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) => ({ ...current, overrides: {} })).palette, previewMode);
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 = Object.prototype.hasOwnProperty.call(ownPalette.seed ?? {}, section.key) ||
1252
- Object.prototype.hasOwnProperty.call(ownPalette.modes?.[previewMode]?.seed ?? {}, section.key);
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
- signalRoutes: PHI_THEME_BRAND_LOGO_MEDIA_ROUTES,
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
- render: ({ runtime, config }) => _jsx(PhiBuilderBrandBackgroundControlsWidgetClient, { runtime: runtime, config: config }),
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
- render: ({ runtime, config }) => _jsx(PhiBuilderBrandIdentityControlsWidgetClient, { runtime: runtime, config: config }),
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
  };
@@ -165,7 +165,9 @@ async function mutateUser(request) {
165
165
  }
166
166
  return { status: "accepted", invalidation: "view" };
167
167
  }
168
- const resources = PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_DESCRIPTORS[0].resources ?? [];
168
+ // Its own descriptor by key: the list holds the Module's other Providers too, in no promised order.
169
+ const resources = PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_DESCRIPTORS
170
+ .find((descriptor) => descriptor.key === PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.table)?.resources ?? [];
169
171
  export const PhiUserManagementTableProviderClient = createPhiTableProviderClient({
170
172
  key: PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.table,
171
173
  resources,