@phis/ui 0.6.1 → 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.
Files changed (208) 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/forms/form-field-labels.d.ts +19 -0
  9. package/components/forms/form-field-labels.js +78 -0
  10. package/components/forms/form-provider-contract.d.ts +1 -17
  11. package/components/forms/form-provider-contract.js +4 -18
  12. package/components/forms/media-asset-field-keys.d.ts +27 -0
  13. package/components/forms/media-asset-field-keys.js +27 -0
  14. package/components/forms/phi-form-widget.js +5 -1
  15. package/components/forms/upload-field-keys.d.ts +27 -0
  16. package/components/forms/upload-field-keys.js +27 -0
  17. package/components/forms/upload-form-control.js +11 -5
  18. package/components/media/asset-controller-requirement.d.ts +9 -0
  19. package/components/media/asset-controller-requirement.js +42 -0
  20. package/components/media/label-sets/media-upload.d.ts +10 -0
  21. package/components/media/label-sets/media-upload.js +85 -0
  22. package/components/media/label-sets/media.js +31 -135
  23. package/components/media/media-upload-labels.d.ts +43 -0
  24. package/components/media/media-upload-labels.js +23 -0
  25. package/components/media/media-upload-refusals.d.ts +12 -0
  26. package/components/media/media-upload-refusals.js +28 -0
  27. package/components/media/media-widget-labels.d.ts +33 -26
  28. package/components/media/media-widget-labels.js +27 -36
  29. package/components/media/phi-area-upload-widget.js +3 -4
  30. package/components/media/phi-asset-inspector-section.d.ts +2 -2
  31. package/components/media/phi-image-inspector-widget.d.ts +2 -5
  32. package/components/media/phi-media-picker-binding.d.ts +17 -0
  33. package/components/media/phi-media-picker-binding.js +199 -4
  34. package/components/media/phi-media-picker-labels.d.ts +7 -0
  35. package/components/media/phi-media-picker-labels.js +25 -0
  36. package/components/media/phi-media-sources.d.ts +69 -0
  37. package/components/media/phi-media-sources.js +254 -0
  38. package/components/media/phi-media-upload.d.ts +1 -27
  39. package/components/media/phi-media-upload.js +4 -48
  40. package/components/runtime/runtime-controller-materialization.d.ts +5 -4
  41. package/components/runtime/runtime-controller-materialization.js +5 -4
  42. package/components/runtime/runtime-module-context.d.ts +5 -1
  43. package/components/runtime/runtime-module-context.js +4 -1
  44. package/components/runtime/runtime-module-media-source-client-manifest.d.ts +17 -0
  45. package/components/runtime/runtime-module-media-source-client-manifest.js +53 -0
  46. package/components/widgets/client/shared/phi-mask-picker.js +23 -13
  47. package/components/widgets/client/shared/phi-widget-image-tool-button.d.ts +7 -5
  48. package/components/widgets/client/shared/phi-widget-image-tool-button.js +11 -7
  49. package/components/widgets/client/shared/phi-widget-tool-buttons.js +2 -2
  50. package/components/widgets/config/mask.d.ts +6 -8
  51. package/components/widgets/config/mask.js +14 -12
  52. package/components/widgets/label-sets/authoring-tools.js +55 -1
  53. package/components/widgets/label-sets/history.js +0 -2
  54. package/components/widgets/label-sets/slot-upload.js +4 -4
  55. package/components/widgets/label-types/authoring-tools.d.ts +10 -0
  56. package/components/widgets/label-types/authoring-tools.js +6 -0
  57. package/components/widgets/label-types/history.d.ts +1 -1
  58. package/components/widgets/label-types/history.js +0 -1
  59. package/components/widgets/label-types/mask-picker.d.ts +31 -0
  60. package/components/widgets/label-types/mask-picker.js +30 -0
  61. package/components/widgets/label-types/slot-upload.d.ts +2 -2
  62. package/controls.d.ts +2 -0
  63. package/controls.js +1 -0
  64. package/helpers/cms-region-keys.d.ts +1 -1
  65. package/module-client.d.ts +5 -1
  66. package/module-projection-client.js +1 -0
  67. package/next/areas/accounting-client.js +3 -2
  68. package/next/areas/admin-client.js +3 -2
  69. package/next/areas/app-client.js +3 -2
  70. package/next/areas/builder-client.js +3 -2
  71. package/next/areas/editor-client.js +3 -2
  72. package/next/areas/public-client.js +3 -2
  73. package/next/runtime-module-client-boundary.d.ts +3 -1
  74. package/next/runtime-module-client-boundary.js +3 -2
  75. package/package.json +7 -2
  76. package/plugins/runtime-modules/area-module-defaults.js +4 -3
  77. package/plugins/runtime-modules/asset/controller/definition.d.ts +2 -2
  78. package/plugins/runtime-modules/asset/controller/runtime.js +2 -2
  79. package/plugins/runtime-modules/asset/definition.d.ts +3 -2
  80. package/plugins/runtime-modules/asset/definition.js +11 -3
  81. package/plugins/runtime-modules/asset/ids.d.ts +8 -0
  82. package/plugins/runtime-modules/asset/ids.js +8 -0
  83. package/plugins/runtime-modules/asset/labels.d.ts +4 -0
  84. package/plugins/runtime-modules/asset/labels.js +94 -0
  85. package/plugins/runtime-modules/asset/media-asset-form-control.js +32 -7
  86. package/plugins/runtime-modules/asset/metadata-form.js +27 -18
  87. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +14 -11
  88. package/plugins/runtime-modules/asset/widgets/area-upload/config.d.ts +2 -0
  89. package/plugins/runtime-modules/asset/widgets/area-upload/config.js +3 -0
  90. package/plugins/runtime-modules/asset/widgets/area-upload/server.js +3 -3
  91. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.d.ts +2 -0
  92. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.js +3 -0
  93. package/plugins/runtime-modules/asset/widgets/image-inspector/config.d.ts +2 -0
  94. package/plugins/runtime-modules/asset/widgets/image-inspector/config.js +3 -0
  95. package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -2
  96. package/plugins/runtime-modules/asset/widgets/media-picker/config.d.ts +1 -0
  97. package/plugins/runtime-modules/asset/widgets/media-picker/config.js +3 -0
  98. package/plugins/runtime-modules/auth/presets.d.ts +11 -0
  99. package/plugins/runtime-modules/auth/presets.js +17 -8
  100. package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +1 -4
  101. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +2 -2
  102. package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +1 -3
  103. package/plugins/runtime-modules/builder/clients/inspector-image-field.js +4 -5
  104. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -8
  105. package/plugins/runtime-modules/builder/clients/pages-header.js +2 -0
  106. package/plugins/runtime-modules/builder/clients/pages-workspace.js +4 -4
  107. package/plugins/runtime-modules/builder/clients/widget-inspector.js +0 -1
  108. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +2 -2
  109. package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -1
  110. package/plugins/runtime-modules/builder/controller/page-controller.js +8 -8
  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 +6 -7
  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/region-keys.d.ts +10 -0
  125. package/plugins/runtime-modules/builder/region-keys.js +10 -0
  126. package/plugins/runtime-modules/builder/runtime-module-sandbox.server.js +8 -1
  127. package/plugins/runtime-modules/builder/runtime-module-selection.js +5 -5
  128. package/plugins/runtime-modules/builder/services/runtime-modules-table.js +24 -6
  129. package/plugins/runtime-modules/builder/signal-endpoints.js +2 -1
  130. package/plugins/runtime-modules/builder/use-offered-page-catalog.d.ts +2 -2
  131. package/plugins/runtime-modules/builder/use-offered-page-catalog.js +5 -3
  132. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +19 -12
  133. package/plugins/runtime-modules/client-manifests/accounting.d.ts +1 -0
  134. package/plugins/runtime-modules/client-manifests/accounting.js +1 -0
  135. package/plugins/runtime-modules/client-manifests/admin.d.ts +1 -0
  136. package/plugins/runtime-modules/client-manifests/admin.js +1 -0
  137. package/plugins/runtime-modules/client-manifests/app.d.ts +1 -0
  138. package/plugins/runtime-modules/client-manifests/app.js +1 -0
  139. package/plugins/runtime-modules/client-manifests/builder.d.ts +1 -0
  140. package/plugins/runtime-modules/client-manifests/builder.js +1 -0
  141. package/plugins/runtime-modules/client-manifests/common.d.ts +1 -0
  142. package/plugins/runtime-modules/client-manifests/common.js +3 -0
  143. package/plugins/runtime-modules/client-manifests/editor.d.ts +1 -0
  144. package/plugins/runtime-modules/client-manifests/editor.js +1 -0
  145. package/plugins/runtime-modules/client-manifests/public.d.ts +1 -0
  146. package/plugins/runtime-modules/client-manifests/public.js +1 -0
  147. package/plugins/runtime-modules/contracts.js +61 -0
  148. package/plugins/runtime-modules/core/client-media-sources.d.ts +5 -0
  149. package/plugins/runtime-modules/core/client-media-sources.js +6 -0
  150. package/plugins/runtime-modules/core/messaging/forms.js +2 -15
  151. package/plugins/runtime-modules/core/messaging/labels.d.ts +0 -12
  152. package/plugins/runtime-modules/core/messaging/labels.js +0 -24
  153. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -6
  154. package/plugins/runtime-modules/core/widgets/collection-view/config.d.ts +1 -0
  155. package/plugins/runtime-modules/core/widgets/collection-view/config.js +7 -0
  156. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +8 -2
  157. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
  158. package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +1 -1
  159. package/plugins/runtime-modules/core/widgets/collection-view/server.js +14 -2
  160. package/plugins/runtime-modules/core/widgets/image/authoring.js +1 -1
  161. package/plugins/runtime-modules/core/widgets/image/editor.d.ts +1 -4
  162. package/plugins/runtime-modules/core/widgets/image/editor.js +2 -2
  163. package/plugins/runtime-modules/core/widgets/slot-upload/client.js +2 -3
  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/runtime-client-manifests-accounting.d.ts +1 -1
  178. package/runtime-client-manifests-accounting.js +1 -1
  179. package/runtime-client-manifests-admin.d.ts +1 -1
  180. package/runtime-client-manifests-admin.js +1 -1
  181. package/runtime-client-manifests-app.d.ts +1 -1
  182. package/runtime-client-manifests-app.js +1 -1
  183. package/runtime-client-manifests-builder.d.ts +1 -1
  184. package/runtime-client-manifests-builder.js +1 -1
  185. package/runtime-client-manifests-editor.d.ts +1 -1
  186. package/runtime-client-manifests-editor.js +1 -1
  187. package/runtime-client-manifests-public.d.ts +2 -1
  188. package/runtime-client-manifests-public.js +1 -1
  189. package/runtime-media-source-client.d.ts +3 -0
  190. package/runtime-media-source-client.js +2 -0
  191. package/server-helpers/cms-request.js +10 -4
  192. package/server-helpers/search-index.js +7 -6
  193. package/server-helpers/site-build-id.d.ts +25 -0
  194. package/server-helpers/site-build-id.js +27 -0
  195. package/theme/phi-theme-presets.d.ts +13 -3
  196. package/theme/phi-theme-presets.js +20 -3
  197. package/theme/phi-theme-seed-derivation.d.ts +240 -0
  198. package/theme/phi-theme-seed-derivation.js +126 -0
  199. package/types/cms-plugins.d.ts +29 -0
  200. package/types/media-source.d.ts +48 -0
  201. package/types/media-source.js +1 -0
  202. package/types/site-config.d.ts +1 -2
  203. package/types/site-theme.d.ts +0 -6
  204. package/types.d.ts +1 -0
  205. package/components/media/asset-controller-routes.d.ts +0 -8
  206. package/components/media/asset-controller-routes.js +0 -31
  207. package/helpers/brand-contact.d.ts +0 -14
  208. package/helpers/brand-contact.js +0 -26
@@ -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
  };
@@ -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";
@@ -1 +1 @@
1
- export { PHI_EDITOR_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/editor";
1
+ export { PHI_EDITOR_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/editor";
@@ -1 +1 @@
1
- export { PHI_EDITOR_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/editor";
1
+ export { PHI_EDITOR_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_EDITOR_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/editor";
@@ -1,5 +1,6 @@
1
- export { PHI_PUBLIC_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/public";
1
+ export { PHI_PUBLIC_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/public";
2
2
  export type { PhiRuntimeModuleControllerClientManifest } from "./components/runtime/runtime-module-controller-client-manifest";
3
3
  export type { PhiRuntimeModuleRenderClientManifest } from "./components/runtime/runtime-module-render-client-manifest";
4
4
  export type { PhiRuntimeModuleDataProviderClientManifest } from "./components/runtime/runtime-module-data-provider-client-manifest";
5
5
  export type { PhiRuntimeModuleCalendarAdapterClientManifest } from "./components/runtime/runtime-module-calendar-adapter-client-manifest";
6
+ export type { PhiRuntimeModuleMediaSourceClientManifest } from "./components/runtime/runtime-module-media-source-client-manifest";
@@ -1 +1 @@
1
- export { PHI_PUBLIC_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/public";
1
+ export { PHI_PUBLIC_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_PUBLIC_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "./plugins/runtime-modules/client-manifests/public";
@@ -0,0 +1,3 @@
1
+ export { createPhiRuntimeModuleMediaSourceClientManifest, extendPhiRuntimeModuleMediaSourceClientManifest, PhiRuntimeModuleMediaSourceClientManifestProvider, usePhiMediaSourceClientDefinitions, } from "./components/runtime/runtime-module-media-source-client-manifest";
2
+ export type { PhiRuntimeModuleMediaSourceClientManifest, } from "./components/runtime/runtime-module-media-source-client-manifest";
3
+ export type { PhiMediaSourceClient, PhiMediaSourceClientDefinition, PhiMediaSourceDescriptor, PhiMediaSourceKey, PhiMediaSourceTakenFile, } from "./types/media-source";
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { createPhiRuntimeModuleMediaSourceClientManifest, extendPhiRuntimeModuleMediaSourceClientManifest, PhiRuntimeModuleMediaSourceClientManifestProvider, usePhiMediaSourceClientDefinitions, } from "./components/runtime/runtime-module-media-source-client-manifest";
@@ -4,7 +4,7 @@ import { notFound } from "next/navigation";
4
4
  import { resolvePhiCmsAreaKey, resolvePhiCmsAreaMask, } from "../constants/cms-areas";
5
5
  import { canPhiViewerAccess } from "../types/access";
6
6
  import { compilePhiCmsActiveRouteTable, instantiatePhiCmsRoutePreset, normalizePhiCmsRoutePath, resolvePhiCmsAreaShellPresetBinding, resolvePhiCmsDescriptorCatalog, resolvePhiCmsModuleNavigationFolderTargets, resolvePhiCmsRoutePreset, } from "../plugins/runtime-modules/descriptor-compiler";
7
- import { resolvePhiRuntimeModuleIdsForArea } from "../plugins/runtime-modules/settings";
7
+ import { listPhiAlwaysActiveRuntimeModuleIds, resolvePhiRuntimeModuleIdsForArea, } from "../plugins/runtime-modules/settings";
8
8
  import { composePhiCmsPagePresetOverlays } from "../plugins/runtime-modules/page-preset-overlays";
9
9
  import { resolvePhiCmsRoutePage } from "../plugins/runtime-modules/route-page-resolution";
10
10
  import { PhiCmsFlags } from "../constants/phi-cms";
@@ -96,18 +96,24 @@ export function resolveActivePresetModuleKeys(runtimeModuleCatalog, area, areaPr
96
96
  }
97
97
  activeModuleKeys.add(areaDefinition.baseModuleId);
98
98
  const configuredModuleKeys = readPhiAreaPresetRuntimeModuleIds(areaPreset?.preset, area);
99
- for (const moduleKey of resolvePhiRuntimeModuleIdsForArea(area, configuredModuleKeys, [...runtimeModuleCatalog.values()].map((entry) => entry.definition))) {
99
+ const moduleDefinitions = [...runtimeModuleCatalog.values()].map((entry) => entry.definition);
100
+ // The Modules declared `activation: "always"` come first and on the same terms as the selected ones:
101
+ // the active set here has to be the one `resolvePhiRuntimeModuleSet` builds for the render.
102
+ for (const moduleKey of [
103
+ ...listPhiAlwaysActiveRuntimeModuleIds(area, moduleDefinitions),
104
+ ...resolvePhiRuntimeModuleIdsForArea(area, configuredModuleKeys, moduleDefinitions),
105
+ ]) {
100
106
  const definition = runtimeModuleCatalog.get(moduleKey)?.definition;
101
107
  if (definition) {
102
108
  // A Module is on for an Area or it is not. It is never switched off for one reader (ACCESS.md):
103
109
  // what its Widgets show may differ per person, that it is loaded may not.
104
110
  const bindingResolution = resolvePhiRuntimeModuleServerBinding(definition.serverBinding, serverCapabilities);
105
111
  if (!bindingResolution.available) {
106
- // The Module is selected and installed, and the server half it needs is not there. It stays off
112
+ // The Module is active and installed, and the server half it needs is not there. It stays off
107
113
  // for the whole Area -- and the log names it, because the page it leaves looks like a page the
108
114
  // Site chose.
109
115
  logRuntimeEvent("warn", "runtime_modules.server_capability.unavailable", {
110
- message: "A selected Module is off: its server capability requirement is unavailable.",
116
+ message: "An active Module is off: its server capability requirement is unavailable.",
111
117
  area,
112
118
  pluginKey: moduleKey,
113
119
  meta: {
@@ -18,6 +18,7 @@ import { resolvePhiCmsLookup } from "./cms-lookup";
18
18
  import { resolvePhiAreaRouteScope } from "./cms-request";
19
19
  import { runWithPhiRequestRuntime } from "./request-runtime";
20
20
  import { loadPhiSiteRequestContext } from "./runtime";
21
+ import { getPhiSiteBuildId } from "./site-build-id";
21
22
  import { joinPhiSearchText } from "./search-text";
22
23
  /**
23
24
  * The Site's half of its search (SEARCH.md): the documents phis indexes, built from the published Pages.
@@ -47,11 +48,6 @@ const PHI_SEARCH_RUNTIME_MODULE_ID = createPhiRuntimeModuleId(PHI_SHARED_PACKAGE
47
48
  const PHI_SEARCH_INDEX_RESOLVE_CONCURRENCY = 4;
48
49
  /** How long after the marker moved the run starts, so a burst of publishes is one run. */
49
50
  const PHI_SEARCH_INDEX_DEBOUNCE_MS = 2_000;
50
- /**
51
- * What the extraction is, named in the fingerprint: a change in how documents are built reindexes every
52
- * Site on its next start, which the published revisions alone would not do.
53
- */
54
- const PHI_SEARCH_INDEX_FORMAT = 2;
55
51
  const REGISTRY_KEY = Symbol.for("phis-ui.search-index");
56
52
  function readRegistry() {
57
53
  const holder = globalThis;
@@ -205,9 +201,14 @@ async function indexArea({ area, bridge, credentials, heldFingerprint, failures,
205
201
  * translated. Publishing content moves the read marker (the Site's publish triggers), correcting a
206
202
  * translation moves a translation marker, and without them here either left the old words in the
207
203
  * index. The price is a run per published change, which is what SEARCH.md promises.
204
+ *
205
+ * The build is in here because what a document contains depends on the code that builds it (phis-ui,
206
+ * the Site package, the Modules), and no list of inputs can name that. A new build of the Site is
207
+ * therefore a reason to write again, and the build's id says exactly that. The consequence is one run
208
+ * per Area and language after every rollout, and none between.
208
209
  */
209
210
  const fingerprint = createHash("sha256").update(JSON.stringify({
210
- format: PHI_SEARCH_INDEX_FORMAT,
211
+ build: getPhiSiteBuildId(),
211
212
  area,
212
213
  publishedPages,
213
214
  areaPreset: areaPreset?.preset ?? null,
@@ -0,0 +1,25 @@
1
+ import "server-only";
2
+ /**
3
+ * The identity of the Site's build: the token Next writes to `BUILD_ID` in its output directory on every
4
+ * `next build`. It is the one thing that says "different code is running" without anyone keeping a number
5
+ * (SEARCH.md, "When the index is written").
6
+ *
7
+ * Next has no public runtime API for it, and phis-ui names no output directory anywhere else, so this
8
+ * assumes the default: `.next` under the working directory, which for a Site's service is the directory of
9
+ * its release. A Site that sets `distDir` gets the fallback below, which re-indexes on every start --
10
+ * correct, only more often than needed. It deliberately does not read the Core's `release.json`: that file
11
+ * exists only for Sites the phis CLI built.
12
+ *
13
+ * Read once per process. Without the file (`next dev`, tests) the id is made once per process, so a
14
+ * development start indexes anew and nothing fails. A read failure other than "no such file" is logged
15
+ * once and treated the same way.
16
+ */
17
+ export type PhiSiteBuildIdOptions = {
18
+ /** The Next output directory; defaults to `.next` under the working directory. */
19
+ directory?: string;
20
+ /** Reads the file's text; defaults to `node:fs`. Throws as `readFileSync` does. */
21
+ readFile?: (filePath: string) => string;
22
+ };
23
+ export declare function readPhiSiteBuildId(options?: PhiSiteBuildIdOptions): string;
24
+ /** The build id of this process, read on first use and kept (also across duplicate module instances). */
25
+ export declare function getPhiSiteBuildId(): string;