@phis/ui 0.4.1 → 0.4.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 (246) hide show
  1. package/components/cms/phi-cms-layout-renderer.js +4 -3
  2. package/components/cms/phi-cms-page-render-scope.d.ts +4 -5
  3. package/components/cms/phi-cms-page-render-scope.js +43 -22
  4. package/components/cms/phi-cms-render-diagnostic-client.js +7 -3
  5. package/components/cms/phi-cms-render-error-boundary.js +2 -1
  6. package/components/controls/phi-bullet-list-control.js +31 -2
  7. package/components/controls/phi-ribbon-control.d.ts +29 -0
  8. package/components/controls/phi-ribbon-control.js +53 -0
  9. package/components/controls/phi-table-control.d.ts +3 -0
  10. package/components/controls/phi-table-control.js +13 -1
  11. package/components/controls/phi-tree-control.js +3 -3
  12. package/components/forms/shared-form-provider-registry.js +1 -4
  13. package/components/media/asset-collection-runtime.js +6 -16
  14. package/components/media/media-font-metrics.d.ts +3 -0
  15. package/components/media/media-font-metrics.js +43 -0
  16. package/components/media/phi-area-upload-widget.js +53 -97
  17. package/components/media/phi-image-preview-data.d.ts +13 -0
  18. package/components/media/phi-image-preview-data.js +184 -9
  19. package/components/media/phi-media-picker-binding.js +16 -13
  20. package/components/media/phi-media-upload.d.ts +15 -8
  21. package/components/media/phi-media-upload.js +18 -9
  22. package/components/media/phi-site-font-assets.js +7 -8
  23. package/components/overlays/phi-overlay-container-client.js +16 -1
  24. package/components/regions/presets/phi-settings-page-shell-tree.js +48 -1
  25. package/components/runtime/runtime-controller-materialization.js +12 -1
  26. package/components/state/scoped-state-store.js +20 -3
  27. package/components/tables/client/phi-table-binding.d.ts +2 -1
  28. package/components/tables/client/phi-table-binding.js +45 -21
  29. package/components/trees/client/phi-tree-binding.js +19 -11
  30. package/components/widgets/client/bullet-list-entries-editor.d.ts +26 -0
  31. package/components/widgets/client/bullet-list-entries-editor.js +103 -0
  32. package/components/widgets/config/choice-shared.js +12 -13
  33. package/components/widgets/config/command-buttons.d.ts +5 -1
  34. package/components/widgets/config/command-buttons.js +38 -81
  35. package/components/widgets/config/control-signal-config.d.ts +3 -1
  36. package/components/widgets/config/control-signal-config.js +19 -17
  37. package/components/widgets/config/image-source-parser.d.ts +1 -0
  38. package/components/widgets/config/image-source-parser.js +7 -8
  39. package/components/widgets/config/mask.d.ts +6 -1
  40. package/components/widgets/config/mask.js +24 -1
  41. package/components/widgets/config/parser-primitives.js +72 -0
  42. package/components/widgets/config/stack-tabs.d.ts +1 -1
  43. package/components/widgets/config/stack-tabs.js +2 -3
  44. package/components/widgets/config/strict-config-reader.d.ts +40 -0
  45. package/components/widgets/config/strict-config-reader.js +174 -0
  46. package/components/widgets/label-sets/effects.js +2 -0
  47. package/components/widgets/label-types/effects.d.ts +1 -0
  48. package/components/widgets/label-types/effects.js +1 -0
  49. package/components/widgets/navigation-descriptor-resolver.server.js +20 -8
  50. package/components/widgets/shared/bullet-list-vocabulary.d.ts +17 -1
  51. package/components/widgets/shared/bullet-list-vocabulary.js +19 -2
  52. package/components/widgets/shared/card-body-client.d.ts +16 -4
  53. package/components/widgets/shared/card-body-client.js +81 -24
  54. package/components/widgets/shared/card-vocabulary.d.ts +21 -4
  55. package/components/widgets/shared/card-vocabulary.js +28 -2
  56. package/components/widgets/shared/markdown-body-client.d.ts +2 -1
  57. package/components/widgets/shared/markdown-body-client.js +3 -1
  58. package/components/widgets/shared/markdown-render.js +8 -1
  59. package/components/widgets/signals/control-signal-capabilities.d.ts +0 -18
  60. package/components/widgets/signals/control-signal-capabilities.js +10 -22
  61. package/components/workspace/catalog-store.d.ts +4 -3
  62. package/components/workspace/catalog-store.js +6 -5
  63. package/gateway/dashboard-cards-route.js +1 -0
  64. package/gateway/internal-references.d.ts +6 -1
  65. package/gateway/internal-references.js +48 -23
  66. package/gateway/site-cms-write-validation.d.ts +9 -0
  67. package/gateway/site-cms-write-validation.js +78 -0
  68. package/gateway/site-proxy.js +19 -3
  69. package/helpers/renderable-block-serialization.js +1 -1
  70. package/next/config.d.mts +3 -0
  71. package/next/config.mjs +28 -1
  72. package/package.json +2 -2
  73. package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +5 -1
  74. package/plugins/runtime-modules/accounting/presets.d.ts +9 -0
  75. package/plugins/runtime-modules/accounting/presets.js +37 -0
  76. package/plugins/runtime-modules/accounting/server.d.ts +1 -4
  77. package/plugins/runtime-modules/accounting/server.js +4 -7
  78. package/plugins/runtime-modules/app/presets.d.ts +18 -0
  79. package/plugins/runtime-modules/app/presets.js +67 -0
  80. package/plugins/runtime-modules/app/server.d.ts +1 -4
  81. package/plugins/runtime-modules/app/server.js +4 -7
  82. package/plugins/runtime-modules/asset/controller/runtime.js +2 -2
  83. package/plugins/runtime-modules/asset/services/collection.js +9 -1
  84. package/plugins/runtime-modules/asset/services/options.js +2 -2
  85. package/plugins/runtime-modules/builder/area-settings-answer.js +2 -1
  86. package/plugins/runtime-modules/builder/authoring-canvas.js +6 -6
  87. package/plugins/runtime-modules/builder/cards.js +3 -5
  88. package/plugins/runtime-modules/builder/clients/builder-region-overrides.js +3 -3
  89. package/plugins/runtime-modules/builder/clients/canvas-widget.js +15 -54
  90. package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +4 -1
  91. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +5 -34
  92. package/plugins/runtime-modules/builder/clients/inspector-link-target-field.js +1 -1
  93. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +8 -8
  94. package/plugins/runtime-modules/builder/clients/inspector-title.js +6 -6
  95. package/plugins/runtime-modules/builder/clients/layout-inspector.d.ts +1 -1
  96. package/plugins/runtime-modules/builder/clients/layout-inspector.js +11 -25
  97. package/plugins/runtime-modules/builder/clients/mode-switch.js +1 -1
  98. package/plugins/runtime-modules/builder/clients/pages-header.js +11 -11
  99. package/plugins/runtime-modules/builder/clients/pages-workspace.js +1 -1
  100. package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
  101. package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
  102. package/plugins/runtime-modules/builder/clients/shells-workspace.js +15 -31
  103. package/plugins/runtime-modules/builder/clients/structure-canvas.js +1 -1
  104. package/plugins/runtime-modules/builder/clients/use-region-draft-hydration.d.ts +26 -0
  105. package/plugins/runtime-modules/builder/clients/use-region-draft-hydration.js +36 -0
  106. package/plugins/runtime-modules/builder/clients/widget-effects-editor.js +1 -1
  107. package/plugins/runtime-modules/builder/clients/widget-inspector.js +1 -0
  108. package/plugins/runtime-modules/builder/clients/workspace-scope-boundary.js +2 -2
  109. package/plugins/runtime-modules/builder/cms-instance-allocator.js +8 -28
  110. package/plugins/runtime-modules/builder/controller/client.d.ts +0 -15
  111. package/plugins/runtime-modules/builder/controller/definition.d.ts +0 -15
  112. package/plugins/runtime-modules/builder/controller/definition.js +0 -8
  113. package/plugins/runtime-modules/builder/controller/draft-command-controller.d.ts +1 -2
  114. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +11 -30
  115. package/plugins/runtime-modules/builder/controller/draft-status-controller.js +15 -2
  116. package/plugins/runtime-modules/builder/controller/inspector-controller.d.ts +1 -2
  117. package/plugins/runtime-modules/builder/controller/inspector-controller.js +4 -7
  118. package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -2
  119. package/plugins/runtime-modules/builder/controller/page-controller.js +16 -68
  120. package/plugins/runtime-modules/builder/controller/server-definition.d.ts +0 -15
  121. package/plugins/runtime-modules/builder/controller/signal-wiring-controller.d.ts +2 -5
  122. package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +6 -50
  123. package/plugins/runtime-modules/builder/controller/workspace-controller.d.ts +2 -3
  124. package/plugins/runtime-modules/builder/controller/workspace-controller.js +89 -153
  125. package/plugins/runtime-modules/builder/data-providers.d.ts +1 -0
  126. package/plugins/runtime-modules/builder/data-providers.js +1 -0
  127. package/plugins/runtime-modules/builder/definition.d.ts +1 -0
  128. package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +64 -30
  129. package/plugins/runtime-modules/builder/developer-workspace-store.js +255 -61
  130. package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +1 -1
  131. package/plugins/runtime-modules/builder/history.d.ts +3 -1
  132. package/plugins/runtime-modules/builder/options-providers.js +3 -2
  133. package/plugins/runtime-modules/builder/page-catalog-client.js +19 -7
  134. package/plugins/runtime-modules/builder/page-meta-form.js +1 -0
  135. package/plugins/runtime-modules/builder/page-references-provider.js +1 -1
  136. package/plugins/runtime-modules/builder/persistence.js +33 -69
  137. package/plugins/runtime-modules/builder/public-route-collisions.d.ts +2 -2
  138. package/plugins/runtime-modules/builder/public-route-collisions.js +6 -19
  139. package/plugins/runtime-modules/builder/render-root-node-preview.server.js +20 -3
  140. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +3 -3
  141. package/plugins/runtime-modules/builder/runtime-module-selection.d.ts +2 -12
  142. package/plugins/runtime-modules/builder/runtime-module-selection.js +16 -42
  143. package/plugins/runtime-modules/builder/services/navigation-table.js +9 -15
  144. package/plugins/runtime-modules/builder/services/page-source-tree.js +8 -8
  145. package/plugins/runtime-modules/builder/services/runtime-modules-table.js +10 -10
  146. package/plugins/runtime-modules/builder/services/signal-routes-table.js +3 -3
  147. package/plugins/runtime-modules/builder/signal-route-selection.d.ts +1 -2
  148. package/plugins/runtime-modules/builder/signal-route-selection.js +2 -2
  149. package/plugins/runtime-modules/builder/signal-wiring-options.js +3 -2
  150. package/plugins/runtime-modules/builder/structure-dnd.js +8 -61
  151. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +13 -10
  152. package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +12 -18
  153. package/plugins/runtime-modules/builder/workspace-catalog-actions.d.ts +55 -0
  154. package/plugins/runtime-modules/builder/workspace-catalog-actions.js +142 -0
  155. package/plugins/runtime-modules/client-manifests/common.js +1 -1
  156. package/plugins/runtime-modules/{runtime-calendar-adapters.js → core/calendar-adapters.js} +2 -2
  157. package/plugins/runtime-modules/{client-calendar-adapters/core.js → core/client-calendar-adapters.js} +1 -1
  158. package/plugins/runtime-modules/core/content-entries/table.js +1 -1
  159. package/plugins/runtime-modules/core/data-providers.d.ts +3 -0
  160. package/plugins/runtime-modules/core/data-providers.js +2 -1
  161. package/plugins/runtime-modules/core/definition.d.ts +3 -0
  162. package/plugins/runtime-modules/core/definition.js +1 -1
  163. package/plugins/runtime-modules/core/messaging/data-providers.d.ts +1 -0
  164. package/plugins/runtime-modules/core/messaging/data-providers.js +1 -0
  165. package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +1 -1
  166. package/plugins/runtime-modules/core/server.js +1 -1
  167. package/plugins/runtime-modules/core/themes.d.ts +44 -0
  168. package/plugins/runtime-modules/core/themes.js +12 -0
  169. package/plugins/runtime-modules/core/widgets/card/collection-view-binding.js +25 -9
  170. package/plugins/runtime-modules/core/widgets/card/config.d.ts +296 -254
  171. package/plugins/runtime-modules/core/widgets/card/config.js +52 -3
  172. package/plugins/runtime-modules/core/widgets/card/editor.js +30 -3
  173. package/plugins/runtime-modules/core/widgets/card/server.d.ts +3 -0
  174. package/plugins/runtime-modules/core/widgets/card/server.js +31 -3
  175. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +7 -6
  176. package/plugins/runtime-modules/core/widgets/collection-view/config.js +9 -2
  177. package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -25
  178. package/plugins/runtime-modules/core/widgets/description/editor.js +4 -61
  179. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -25
  180. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -25
  181. package/plugins/runtime-modules/core/widgets/image/config.js +2 -2
  182. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +3 -1
  183. package/plugins/runtime-modules/core/widgets/markdown/config.js +14 -0
  184. package/plugins/runtime-modules/core/widgets/markdown/editor.js +2 -3
  185. package/plugins/runtime-modules/core/widgets/result/config.d.ts +4 -25
  186. package/plugins/runtime-modules/core/widgets/result/config.js +2 -0
  187. package/plugins/runtime-modules/core/widgets/result/server.js +25 -19
  188. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -25
  189. package/plugins/runtime-modules/core/widgets/slot-upload/client.js +11 -2
  190. package/plugins/runtime-modules/core/widgets/table/client.js +8 -4
  191. package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -83
  192. package/plugins/runtime-modules/core/widgets/table/config.js +302 -452
  193. package/plugins/runtime-modules/core/widgets/tree/config.js +5 -2
  194. package/plugins/runtime-modules/dashboard/card-rows.d.ts +5 -0
  195. package/plugins/runtime-modules/dashboard/card-rows.js +59 -0
  196. package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +4 -6
  197. package/plugins/runtime-modules/dashboard/services/collection.js +17 -7
  198. package/plugins/runtime-modules/groups/data-providers.d.ts +2 -0
  199. package/plugins/runtime-modules/groups/data-providers.js +3 -3
  200. package/plugins/runtime-modules/groups/definition.d.ts +2 -0
  201. package/plugins/runtime-modules/localization/data-providers.d.ts +3 -0
  202. package/plugins/runtime-modules/localization/data-providers.js +2 -0
  203. package/plugins/runtime-modules/localization/definition.d.ts +3 -0
  204. package/plugins/runtime-modules/localization/services/table.js +3 -7
  205. package/plugins/runtime-modules/observability/data-providers.d.ts +1 -0
  206. package/plugins/runtime-modules/observability/data-providers.js +1 -0
  207. package/plugins/runtime-modules/observability/definition.d.ts +1 -0
  208. package/plugins/runtime-modules/observability/module.d.ts +1 -0
  209. package/plugins/runtime-modules/observability/services/table.js +1 -1
  210. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +2 -105
  211. package/plugins/runtime-modules/public/presets.d.ts +115 -0
  212. package/plugins/runtime-modules/{area-base-presets.js → public/presets.js} +19 -119
  213. package/plugins/runtime-modules/public/server.d.ts +1 -4
  214. package/plugins/runtime-modules/public/server.js +4 -7
  215. package/plugins/runtime-modules/public/trees/phi-default-pub-error-page-tree.js +7 -8
  216. package/plugins/runtime-modules/public-base-page-references.d.ts +1 -1
  217. package/plugins/runtime-modules/public-base-page-references.js +1 -1
  218. package/plugins/runtime-modules/revisions/controller/client.js +11 -11
  219. package/plugins/runtime-modules/revisions/services/table.js +3 -3
  220. package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +22 -0
  221. package/plugins/runtime-modules/theme/widgets/brand-controls/client.d.ts +2 -1
  222. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +93 -58
  223. package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +2 -1
  224. package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +23 -22
  225. package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +1 -1
  226. package/plugins/runtime-modules/theme-descriptors.js +1 -1
  227. package/plugins/runtime-modules/user-management/data-providers.d.ts +2 -0
  228. package/plugins/runtime-modules/user-management/data-providers.js +1 -0
  229. package/plugins/runtime-modules/user-management/definition.d.ts +2 -0
  230. package/styles/control-shape.css +11 -11
  231. package/styles/controls.css +29 -3
  232. package/styles/layout.css +16 -7
  233. package/types/cms-config.js +142 -185
  234. package/types/cms-plugins.d.ts +4 -11
  235. package/types/core-widget-placements.d.ts +17 -3
  236. package/types/dashboard-cards.d.ts +9 -0
  237. package/types/media.d.ts +0 -3
  238. package/types/renderable-block.d.ts +6 -1
  239. package/types/table-widget.d.ts +9 -0
  240. package/types/table-widget.js +20 -0
  241. package/types.d.ts +1 -1
  242. package/widget-config.d.ts +2 -0
  243. package/widget-config.js +6 -0
  244. package/plugins/runtime-modules/area-base-presets.d.ts +0 -139
  245. /package/plugins/runtime-modules/{runtime-calendar-adapters.d.ts → core/calendar-adapters.d.ts} +0 -0
  246. /package/plugins/runtime-modules/{client-calendar-adapters/core.d.ts → core/client-calendar-adapters.d.ts} +0 -0
@@ -2,6 +2,7 @@
2
2
  import { isPhiRecord } from "../../../../helpers/is-record";
3
3
  import { createPhiControlOptionsProviderClient, } from "../../../../components/controls/phi-options-provider";
4
4
  import { PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
5
+ import { readPhiMediaFolders } from "../../../../components/media/phi-image-preview-data";
5
6
  import { PHI_ASSET_CONTROLLER_STORE_KEY } from "../../../../components/media/asset-controller-signals";
6
7
  import { phiImagePreviewStore } from "../../../../components/media/phi-image-preview-store";
7
8
  import { buildPhiMediaFolderCascaderOptions, buildPhiMediaFolderNamesById, buildPhiMediaFolderValueById, } from "../../../../components/media/media-folder-options";
@@ -59,8 +60,7 @@ async function loadFolders() {
59
60
  const payload = await response.json().catch(() => null);
60
61
  if (!response.ok)
61
62
  throw new Error("Failed to load the Site's media folders.");
62
- const folders = isPhiRecord(payload) && Array.isArray(payload.folders) ? payload.folders : [];
63
- return folders.filter(isPhiRecord);
63
+ return readPhiMediaFolders(isPhiRecord(payload) ? payload.folders : undefined, "The media folders route");
64
64
  }
65
65
  export const PhiMediaFolderChoicesOptionsProviderClient = createPhiControlOptionsProviderClient({
66
66
  key: PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS.mediaFolderChoices,
@@ -1,3 +1,4 @@
1
+ import { PHI_WORKSPACE_CATALOG_SCOPE } from "../../../components/workspace/catalog-store";
1
2
  import { PHI_AREA_META_PUBLIC_DEFAULTS, } from "../../../helpers/cms-area-config";
2
3
  import { isPhiRecord } from "../../../helpers/is-record";
3
4
  import { builderWorkspaceStore, readPhiBuilderEffectiveAreaMeta, readPhiBuilderEffectiveAreaRootRoute, restorePhiDeveloperBuilderAreaMeta, setPhiDeveloperBuilderAreaRootRoute, } from "./developer-workspace-store";
@@ -54,7 +55,7 @@ function isSamePhiBuilderAreaAnswer(left, right) {
54
55
  * unsaved. `rootRoute` is `undefined` when the dialog did not ask it.
55
56
  */
56
57
  export function applyPhiBuilderAreaSettingsAnswer({ area, historyContext, rootRoute, meta, }) {
57
- const current = builderWorkspaceStore.getSnapshot("public");
58
+ const current = builderWorkspaceStore.getSnapshot(PHI_WORKSPACE_CATALOG_SCOPE);
58
59
  const before = [];
59
60
  const after = [];
60
61
  if (rootRoute !== undefined && !isSamePhiBuilderAreaAnswer(readPhiBuilderEffectiveAreaRootRoute(current, area), rootRoute)) {
@@ -13,12 +13,12 @@ import { getPhiBuilderNavigationDraftSnapshot } from "./navigation-store";
13
13
  * learn which Area they are being edited in.
14
14
  */
15
15
  export function usePhiBuilderAuthoringCanvas() {
16
- const area = usePhiDeveloperBuilderStateValue("public", (state) => state.area);
17
- const catalogHydrated = usePhiDeveloperBuilderStateValue("public", (state) => state.catalogHydrated);
18
- const navigationSurfaces = usePhiDeveloperBuilderStateValue("public", (state) => state.navigationSurfacesByArea[state.area] ?? null);
19
- const modulePresetPagesByArea = usePhiDeveloperBuilderStateValue("public", (state) => state.modulePresetPagesByArea);
20
- const customPages = usePhiDeveloperBuilderStateValue("public", (state) => state.customPages);
21
- const persistedPageCatalogByArea = usePhiDeveloperBuilderStateValue("public", (state) => state.persistedPageCatalogByArea);
16
+ const area = usePhiDeveloperBuilderStateValue((state) => state.area);
17
+ const catalogHydrated = usePhiDeveloperBuilderStateValue((state) => state.catalogHydrated);
18
+ const navigationSurfaces = usePhiDeveloperBuilderStateValue((state) => state.navigationSurfacesByArea[state.area] ?? null);
19
+ const modulePresetPagesByArea = usePhiDeveloperBuilderStateValue((state) => state.modulePresetPagesByArea);
20
+ const customPages = usePhiDeveloperBuilderStateValue((state) => state.customPages);
21
+ const persistedPageCatalogByArea = usePhiDeveloperBuilderStateValue((state) => state.persistedPageCatalogByArea);
22
22
  return useMemo(() => ({
23
23
  area,
24
24
  catalogHydrated,
@@ -2,7 +2,6 @@ import "server-only";
2
2
  import { PHI_TR_CTX_WEB_UI_LABEL } from "../../../gateway/tr";
3
3
  import { definePhiRuntimeModuleLabelSet, getPhiLabelSet } from "../../../gateway/label-set";
4
4
  import { getPhiBuilderModulesPageLabels } from "../../../components/widgets/label-sets/builder-modules";
5
- import { PHI_FIRST_PARTY_RUNTIME_MODULE_CATALOG } from "../catalog";
6
5
  import { createPhiDashboardCardId, } from "../../../types/dashboard-cards";
7
6
  import { readPhiBuilderAreasWithOpenDraft } from "./area-shell-presets.server";
8
7
  import { PHI_BUILDER_RUNTIME_MODULE_ID, PHI_BUILDER_RUNTIME_MODULE_IDENTITY } from "./ids";
@@ -12,9 +11,8 @@ import { PHI_BUILDER_RUNTIME_MODULE_ID, PHI_BUILDER_RUNTIME_MODULE_IDENTITY } fr
12
11
  * The first `list` card. A structure author opening the Builder wants to know where they left off,
13
12
  * which is a set of names rather than a count -- "Public and App" says where to go, "2" does not.
14
13
  *
15
- * The Area shells are read from the first-party catalog. A provider is handed no catalog, and every
16
- * Area's shell is contributed by its first-party base Module, so the Builder's catalog and this one name
17
- * the same shell sources; a Site's own Modules add Pages, not Areas.
14
+ * The Area shells are read from the catalog of the Area the Dashboard stands in -- the Builder's, which
15
+ * carries every Area's base Module, because the Builder edits them all.
18
16
  */
19
17
  const PHI_BUILDER_DASHBOARD_CARD_LABEL_SET = definePhiRuntimeModuleLabelSet(PHI_BUILDER_RUNTIME_MODULE_IDENTITY, {
20
18
  key: "cards:builder-drafts",
@@ -59,7 +57,7 @@ export const PHI_BUILDER_RUNTIME_MODULE_DASHBOARD_CARDS = {
59
57
  const [labels, areaLabels, drafted] = await Promise.all([
60
58
  getPhiLabelSet(options, PHI_BUILDER_DASHBOARD_CARD_LABEL_SET),
61
59
  getPhiBuilderModulesPageLabels(options).then((page) => page.areas),
62
- readPhiBuilderAreasWithOpenDraft(PHI_FIRST_PARTY_RUNTIME_MODULE_CATALOG, {
60
+ readPhiBuilderAreasWithOpenDraft(context.runtimeModuleCatalog, {
63
61
  siteKey: context.siteKey,
64
62
  locale: context.locale,
65
63
  apiBaseUrl: context.apiBaseUrl,
@@ -8,9 +8,9 @@ import { PhiAuthoringRegionOverridesProvider } from "../../../../components/runt
8
8
  import { getDefaultRegionDraft, resolveRegionDraftKey } from "../developer-region-drafts";
9
9
  import { usePhiDeveloperBuilderStateValue, usePhiDeveloperRegionDrafts } from "../developer-workspace-store";
10
10
  export function PhiBuilderCanvasRegionOverrides({ children }) {
11
- const builderMode = usePhiDeveloperBuilderStateValue("public", (state) => state.builderMode);
12
- const area = usePhiDeveloperBuilderStateValue("public", (state) => state.area);
13
- const pageKey = usePhiDeveloperBuilderStateValue("public", (state) => state.pageKey);
11
+ const builderMode = usePhiDeveloperBuilderStateValue((state) => state.builderMode);
12
+ const area = usePhiDeveloperBuilderStateValue((state) => state.area);
13
+ const pageKey = usePhiDeveloperBuilderStateValue((state) => state.pageKey);
14
14
  const regionDrafts = usePhiDeveloperRegionDrafts();
15
15
  const value = useMemo(() => {
16
16
  const siderRight = resolveRegionDraftKey(regionDrafts, area, "sider_right", pageKey) ?? getDefaultRegionDraft("sider_right");
@@ -1,75 +1,36 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useCallback, useEffect, useMemo } from "react";
3
+ import { useMemo } from "react";
4
4
  import { PhiDeveloperBuilderStructureCanvas, } from "./structure-canvas";
5
- import { getPhiDeveloperRegionDraftsSnapshot, mergePhiDeveloperRegionDrafts, usePhiDeveloperBuilderStateValue, usePhiDeveloperRegionDraftsValue, } from "../developer-workspace-store";
5
+ import { usePhiDeveloperBuilderStateValue } from "../developer-workspace-store";
6
+ import { usePhiBuilderRegionDraftHydration } from "./use-region-draft-hydration";
6
7
  import { getPhiBuilderRegionDraftKey, PHI_BUILDER_PAGE_REGION_KEYS, PHI_BUILDER_SHELL_REGION_KEYS, } from "../region-keys";
7
8
  import { usePhiBuilderModuleMetas } from "../plugin-meta-store";
8
9
  import { buildPhiStructureRegionPickItems } from "../structure-region-pick-items";
9
10
  export function PhiDeveloperBuilderCanvasWidgetClient({ workspace, serverPreviewRegions, structureShellDraftsByArea, pageDraftsByScope, previewRegionDrafts = null, shellTheme, disabled: _disabled = false, targetArea, regionLabels, pickerLabels, }) {
10
11
  void _disabled;
11
- const area = usePhiDeveloperBuilderStateValue("public", (state) => state.area);
12
- const pageKey = usePhiDeveloperBuilderStateValue("public", (state) => state.pageKey);
13
- const builderMode = usePhiDeveloperBuilderStateValue("public", (state) => state.builderMode);
12
+ const area = usePhiDeveloperBuilderStateValue((state) => state.area);
13
+ const pageKey = usePhiDeveloperBuilderStateValue((state) => state.pageKey);
14
+ const builderMode = usePhiDeveloperBuilderStateValue((state) => state.builderMode);
14
15
  const builderModuleMetas = usePhiBuilderModuleMetas(targetArea);
15
16
  const pickItems = useMemo(() => buildPhiStructureRegionPickItems(builderModuleMetas.plugins), [builderModuleMetas.plugins]);
16
17
  const isStructureWorkspace = workspace === "structure";
17
18
  const isPagesWorkspace = workspace === "pages";
18
- /*
19
- * Which of this workspace's drafts are not in the store, as one string. The Canvas used to subscribe
20
- * to the whole draft map for this question, so every write to any draft re-rendered it and, below it,
21
- * every Region scaffold on the canvas with its whole tree. The Regions read their own draft now
22
- * (`structure-canvas.tsx`); this widget renders when the set of missing drafts changes and not before.
23
- */
24
19
  const hydrationDraftKeys = useMemo(() => (isStructureWorkspace
25
20
  ? PHI_BUILDER_SHELL_REGION_KEYS.map((regionKey) => getPhiBuilderRegionDraftKey(area, regionKey, pageKey))
26
21
  : isPagesWorkspace
27
22
  ? PHI_BUILDER_PAGE_REGION_KEYS.map((regionKey) => getPhiBuilderRegionDraftKey(area, regionKey, pageKey))
28
23
  : []), [area, isPagesWorkspace, isStructureWorkspace, pageKey]);
29
- const missingDraftKeys = usePhiDeveloperRegionDraftsValue(useCallback((drafts) => hydrationDraftKeys.filter((draftKey) => drafts[draftKey] == null).join("\u0000"), [hydrationDraftKeys]));
30
- useEffect(() => {
31
- if (!isStructureWorkspace && !isPagesWorkspace) {
32
- return;
33
- }
34
- if (builderMode === "preview" && previewRegionDrafts && Object.keys(previewRegionDrafts).length > 0) {
35
- mergePhiDeveloperRegionDrafts(previewRegionDrafts);
36
- }
37
- const regionDrafts = getPhiDeveloperRegionDraftsSnapshot();
38
- const shellDraftKeys = PHI_BUILDER_SHELL_REGION_KEYS
39
- .map((regionKey) => getPhiBuilderRegionDraftKey(area, regionKey, pageKey));
40
- const pageDraftKeys = PHI_BUILDER_PAGE_REGION_KEYS
41
- .map((regionKey) => getPhiBuilderRegionDraftKey(area, regionKey, pageKey));
42
- const needsShellHydration = isStructureWorkspace && shellDraftKeys.some((draftKey) => regionDrafts[draftKey] == null);
43
- const needsPageHydration = isPagesWorkspace &&
44
- pageDraftKeys.some((draftKey) => regionDrafts[draftKey] == null);
45
- if (needsShellHydration) {
46
- const nextShellDrafts = structureShellDraftsByArea?.[area] ?? {};
47
- const missingShellDrafts = Object.fromEntries(Object.entries(nextShellDrafts).filter(([draftKey]) => regionDrafts[draftKey] == null));
48
- if (Object.keys(missingShellDrafts).length > 0) {
49
- mergePhiDeveloperRegionDrafts(missingShellDrafts);
50
- }
51
- }
52
- if (!needsPageHydration) {
53
- return;
54
- }
55
- const nextPageDrafts = pageDraftsByScope?.[area]?.[pageKey] ?? {};
56
- const missingPageDrafts = Object.fromEntries(Object.entries(nextPageDrafts).filter(([draftKey]) => regionDrafts[draftKey] == null));
57
- if (Object.keys(missingPageDrafts).length > 0) {
58
- mergePhiDeveloperRegionDrafts(missingPageDrafts);
59
- return;
60
- }
61
- // `missingDraftKeys` is the reason to run again; the snapshot inside is what is read.
62
- }, [
63
- isPagesWorkspace,
64
- isStructureWorkspace,
65
- missingDraftKeys,
66
- pageDraftsByScope,
67
- previewRegionDrafts,
68
- area,
24
+ usePhiBuilderRegionDraftHydration({
25
+ draftKeys: hydrationDraftKeys,
26
+ serverDrafts: isStructureWorkspace
27
+ ? structureShellDraftsByArea?.[area]
28
+ : isPagesWorkspace
29
+ ? pageDraftsByScope?.[area]?.[pageKey] ?? undefined
30
+ : undefined,
69
31
  builderMode,
70
- pageKey,
71
- structureShellDraftsByArea,
72
- ]);
32
+ previewRegionDrafts: isStructureWorkspace || isPagesWorkspace ? previewRegionDrafts : null,
33
+ });
73
34
  if (isStructureWorkspace) {
74
35
  return (_jsx(PhiDeveloperBuilderStructureCanvas, { workspace: "structure", builderMode: builderMode, area: area, pageKey: pageKey, shellTheme: shellTheme, pageDraftsByScope: pageDraftsByScope, serverPreviewRegions: serverPreviewRegions, pickItems: pickItems, regionLabels: regionLabels, pickerLabels: pickerLabels }));
75
36
  }
@@ -1,4 +1,5 @@
1
1
  import { type ReactNode } from "react";
2
+ import type { PhiBackgroundControlProps } from "../../../../components/controls/phi-background-control";
2
3
  import type { PhiCmsConfigField, PhiRuntimeModuleDataProviderDescriptor } from "../../../../types/cms-plugins";
3
4
  import type { PhiCalendarAdapterDescriptor } from "../../../../types/calendar";
4
5
  import type { PhiVideoProviderDescriptor } from "../../../../types/video";
@@ -69,7 +70,7 @@ export declare function renderPhiInspectorPaddingConfigControl({ field, config,
69
70
  onChange?: (nextPadding: PhiCmsPaddingWidgetConfig | null, patch: Record<string, unknown>) => void;
70
71
  }): import("react").JSX.Element;
71
72
  export declare function renderPhiInspectorConfigField(args: Parameters<typeof renderPhiInspectorConfigFieldBody>[0]): import("react").JSX.Element | null;
72
- declare function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config, defaultConfig, disabled, onChange, widgetReferenceOptions, paddingLabels, backgroundLabels, borderLabels, colorPickerLabels, iconPickerLabels, fieldLabels, dataProviderDescriptors, calendarAdapterDescriptors, videoProviderDescriptors, blockId, }: {
73
+ declare function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config, defaultConfig, disabled, onChange, widgetReferenceOptions, paddingLabels, backgroundLabels, borderLabels, renderMediaPicker, colorPickerLabels, iconPickerLabels, fieldLabels, dataProviderDescriptors, calendarAdapterDescriptors, videoProviderDescriptors, blockId, }: {
73
74
  field: PhiCmsConfigField;
74
75
  value: unknown;
75
76
  defaultValue: unknown;
@@ -82,6 +83,8 @@ declare function renderPhiInspectorConfigFieldBody({ field, value, defaultValue,
82
83
  paddingLabels?: PhiPaddingWidgetLabels;
83
84
  backgroundLabels?: PhiBackgroundWidgetLabels;
84
85
  borderLabels?: PhiBorderWidgetLabels;
86
+ /** The Media library's picker, so a Surface field can take a background image like a block's own. */
87
+ renderMediaPicker?: PhiBackgroundControlProps["renderMediaPicker"];
85
88
  colorPickerLabels?: PhiColorPickerLabels;
86
89
  iconPickerLabels?: PhiIconPickerControlLabels;
87
90
  /** The Inspector's own words in its field controls, from the `widget:inspector` label set. */
@@ -7,8 +7,6 @@ import { PhiDividerControl } from "../../../../components/controls/phi-divider-c
7
7
  import { usePhiConfig } from "../../../../components/root/phi-config-provider";
8
8
  import { readPhiLengthValue } from "../../../../types";
9
9
  import { normalizePhiPaddingWidgetConfig, } from "../../../../types/cms-config";
10
- import { PhiBackgroundControl } from "../../../../components/controls/phi-background-control";
11
- import { PhiBorderControl } from "../../../../components/controls/phi-border-control";
12
10
  import { PhiColorFieldControl } from "../../../../components/controls/phi-color-field-control";
13
11
  import { PhiInspectorLinkTargetFieldControl, } from "./inspector-link-target-field";
14
12
  import { PhiInspectorImageFieldControl } from "./inspector-image-field";
@@ -30,10 +28,8 @@ import { PhiDialogControl } from "../../../../components/controls/phi-dialog-con
30
28
  import { PhiIcon } from "../../../../components/shell/phi-icon";
31
29
  import { PhiPaddingControl } from "../../../../components/controls/phi-padding-control";
32
30
  import { PHI_INSPECTOR_FIELD_LABEL_WIDTH, PhiInspectorFieldRow } from "../../../../components/widgets/inspector-field-row";
33
- import { PhiShadowControl } from "../../../../components/controls/phi-shadow-control";
34
31
  import { PhiSurfaceControl } from "../../../../components/controls/phi-surface-control";
35
32
  import { readPhiSurface } from "../../../../types/surface";
36
- import { readPhiShadow } from "../../../../types/layout-style";
37
33
  import { readInspectorChoiceMultiValue, readInspectorChoiceSingleValue, } from "./inspector-choice-values";
38
34
  import { PhiFlexControl } from "../../../../components/controls/phi-flex-control";
39
35
  import { PhiTypographyControl } from "../../../../components/controls/phi-typography-control";
@@ -248,12 +244,6 @@ function resolveInspectorColorMode(mode) {
248
244
  }
249
245
  return "single";
250
246
  }
251
- function normalizeInspectorBorderValue(value) {
252
- if (!isPhiRecord(value)) {
253
- return null;
254
- }
255
- return value;
256
- }
257
247
  function readPhiInspectorCollectionItems(value) {
258
248
  return Array.isArray(value)
259
249
  ? value.filter(isPhiRecord)
@@ -377,7 +367,7 @@ function PhiInspectorChoiceFieldControl({ field, config, value, defaultValue, di
377
367
  });
378
368
  } }));
379
369
  }
380
- function PhiInspectorCollectionFieldControl({ field, config, labels, value, defaultValue, disabled, widgetReferenceOptions, paddingLabels, backgroundLabels, borderLabels, colorPickerLabels, iconPickerLabels, dataProviderDescriptors, calendarAdapterDescriptors, videoProviderDescriptors, onChange, }) {
370
+ function PhiInspectorCollectionFieldControl({ field, config, labels, value, defaultValue, disabled, widgetReferenceOptions, paddingLabels, backgroundLabels, borderLabels, renderMediaPicker, colorPickerLabels, iconPickerLabels, dataProviderDescriptors, calendarAdapterDescriptors, videoProviderDescriptors, onChange, }) {
381
371
  const { token } = usePhiConfig();
382
372
  const popup = usePhiWidgetScaffoldPopup();
383
373
  const [overlayOpen, setOverlayOpen] = useState(false);
@@ -440,6 +430,7 @@ function PhiInspectorCollectionFieldControl({ field, config, labels, value, defa
440
430
  paddingLabels,
441
431
  backgroundLabels,
442
432
  borderLabels,
433
+ renderMediaPicker,
443
434
  colorPickerLabels,
444
435
  iconPickerLabels,
445
436
  fieldLabels: labels,
@@ -521,7 +512,7 @@ export function renderPhiInspectorConfigField(args) {
521
512
  return body;
522
513
  return (_jsxs(Fragment, { children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: args.field.heading }), body] }, args.field.key));
523
514
  }
524
- function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config, defaultConfig, disabled, onChange, widgetReferenceOptions, paddingLabels, backgroundLabels, borderLabels, colorPickerLabels, iconPickerLabels, fieldLabels = PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields, dataProviderDescriptors = [], calendarAdapterDescriptors = [], videoProviderDescriptors = [], blockId, }) {
515
+ function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config, defaultConfig, disabled, onChange, widgetReferenceOptions, paddingLabels, backgroundLabels, borderLabels, renderMediaPicker, colorPickerLabels, iconPickerLabels, fieldLabels = PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields, dataProviderDescriptors = [], calendarAdapterDescriptors = [], videoProviderDescriptors = [], blockId, }) {
525
516
  if (field.type === "readonly") {
526
517
  const displayValue = value ?? defaultValue;
527
518
  return renderPhiInspectorConfigFieldControl(field, _jsx(PhiTextControl, { value: displayValue == null ? "" : String(displayValue), readOnly: true, allowClear: false, style: { width: "100%" } }));
@@ -720,35 +711,15 @@ function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config,
720
711
  return (_jsx(PhiInspectorChoiceFieldControl, { field: field, config: config, value: value, defaultValue: defaultValue, disabled: disabled || !onChange, widgetReferenceOptions: widgetReferenceOptions ?? [], labels: fieldLabels, onChange: onChange }, field.key));
721
712
  }
722
713
  if (field.type === "collection") {
723
- return (_jsx(PhiInspectorCollectionFieldControl, { field: field, config: config, labels: fieldLabels, value: value, defaultValue: defaultValue, disabled: disabled || !onChange, widgetReferenceOptions: widgetReferenceOptions ?? [], paddingLabels: paddingLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, dataProviderDescriptors: dataProviderDescriptors, calendarAdapterDescriptors: calendarAdapterDescriptors, videoProviderDescriptors: videoProviderDescriptors, onChange: onChange }, field.key));
714
+ return (_jsx(PhiInspectorCollectionFieldControl, { field: field, config: config, labels: fieldLabels, value: value, defaultValue: defaultValue, disabled: disabled || !onChange, widgetReferenceOptions: widgetReferenceOptions ?? [], paddingLabels: paddingLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, renderMediaPicker: renderMediaPicker, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, dataProviderDescriptors: dataProviderDescriptors, calendarAdapterDescriptors: calendarAdapterDescriptors, videoProviderDescriptors: videoProviderDescriptors, onChange: onChange }, field.key));
724
715
  }
725
716
  if (field.type === "color") {
726
717
  return renderPhiInspectorConfigFieldControl(field, _jsx(PhiColorFieldControl, { value: value, defaultValue: defaultValue, ...(field.defaultToken ? { defaultToken: field.defaultToken } : {}), disabled: disabled || !onChange, mode: resolveInspectorColorMode(field.mode), placement: "left", labels: colorPickerLabels, onChange: (nextValue) => onChange?.({ [field.key]: nextValue || undefined }) }));
727
718
  }
728
- if (field.type === "background") {
729
- const usesSelfStorage = field.storage === "self";
730
- const currentValue = (usesSelfStorage ? config : value);
731
- const currentDefaultValue = (usesSelfStorage ? defaultConfig : defaultValue);
732
- return renderPhiInspectorConfigFieldControl(field, _jsx(PhiBackgroundControl, { mode: "control", disabled: disabled || !onChange, value: currentValue ?? null, config: currentDefaultValue ?? null, labels: backgroundLabels, colorPickerLabels: colorPickerLabels, colorPickerPlacement: "left", onChange: (nextValue) => usesSelfStorage
733
- ? onChange?.(nextValue)
734
- : onChange?.({ [field.key]: nextValue }) }));
735
- }
736
- if (field.type === "border") {
737
- const usesSelfStorage = field.storage === "self";
738
- const currentValue = normalizeInspectorBorderValue(usesSelfStorage ? config : value);
739
- const currentDefaultValue = normalizeInspectorBorderValue(usesSelfStorage ? defaultConfig : defaultValue);
740
- return renderPhiInspectorConfigFieldControl(field, _jsx(PhiBorderControl, { mode: "control", disabled: disabled || !onChange, value: currentValue, config: currentDefaultValue, labels: borderLabels, colorPickerLabels: colorPickerLabels, colorPickerPlacement: "left", onChange: (nextValue) => usesSelfStorage
741
- ? onChange?.(nextValue)
742
- : onChange?.({ [field.key]: nextValue }) }));
743
- }
744
719
  if (field.type === "surface") {
745
720
  return renderPhiInspectorConfigFieldBlock(field, _jsx(PhiSurfaceControl, { disabled: disabled || !onChange, value: value === null ? null : readPhiSurface(value) ?? readPhiSurface(defaultValue), tone: field.tone !== false,
746
721
  // A box inside a Widget has no layer of its own to blur.
747
- backgroundFilters: ["glass", "haze"], backgroundLabels: backgroundLabels, borderLabels: borderLabels, colorPickerLabels: colorPickerLabels, onChange: (nextValue) => onChange?.({ [field.key]: nextValue }) }));
748
- }
749
- if (field.type === "shadow") {
750
- const currentValue = readPhiShadow(value) ?? readPhiShadow(defaultValue) ?? null;
751
- return renderPhiInspectorConfigFieldControl(field, _jsx(PhiShadowControl, { mode: "control", disabled: disabled || !onChange, value: currentValue, onChange: (nextValue) => onChange?.({ [field.key]: nextValue }) }));
722
+ backgroundFilters: ["glass", "haze"], backgroundLabels: backgroundLabels, borderLabels: borderLabels, colorPickerLabels: colorPickerLabels, renderMediaPicker: renderMediaPicker, onChange: (nextValue) => onChange?.({ [field.key]: nextValue }) }));
752
723
  }
753
724
  if (field.type === "icon") {
754
725
  const iconValue = typeof value === "string"
@@ -13,7 +13,7 @@ import { PHI_INSPECTOR_WIDGET_DEFAULT_LABELS, } from "../../../../components/wid
13
13
  * of the Area the Builder is working on.
14
14
  */
15
15
  export function PhiInspectorLinkTargetFieldControl({ value, disabled, labels = PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.linkTarget, onChange, }) {
16
- const state = usePhiDeveloperBuilderStateValue("public", (current) => current);
16
+ const state = usePhiDeveloperBuilderStateValue((current) => current);
17
17
  const pages = usePhiBuilderOfferedPageCatalog(state, state.area);
18
18
  const options = useMemo(() => buildPhiBuilderPageReferenceTree(state.area, pages, pages, { landing: labels.landingPage }), [labels.landingPage, pages, state.area]);
19
19
  return (_jsx(PhiLinkTargetControl, { value: value, options: options, labels: labels, disabled: disabled, onChange: onChange,
@@ -76,14 +76,14 @@ function resolveDraftFromLayoutNode(node, meta) {
76
76
  }
77
77
  function usePhiBuilderInspectorSectionState(signalRoutes) {
78
78
  const dispatchSignal = usePhiSignalDispatcher();
79
- const area = usePhiDeveloperBuilderStateValue("public", (state) => state.area);
80
- const pageKey = usePhiDeveloperBuilderStateValue("public", (state) => state.pageKey);
81
- const builderMode = usePhiDeveloperBuilderStateValue("public", (state) => state.builderMode);
82
- const nodeId = usePhiDeveloperBuilderStateValue("public", (state) => state.nodeId);
83
- const nodeKey = usePhiDeveloperBuilderStateValue("public", (state) => state.nodeKey);
84
- const nodeKind = usePhiDeveloperBuilderStateValue("public", (state) => state.nodeKind);
85
- const selectedLayoutAnchor = usePhiDeveloperBuilderStateValue("public", (state) => state.selectedLayoutAnchor);
86
- const selectedRootRegionKey = usePhiDeveloperBuilderStateValue("public", (state) => state.selectedRootRegionKey);
79
+ const area = usePhiDeveloperBuilderStateValue((state) => state.area);
80
+ const pageKey = usePhiDeveloperBuilderStateValue((state) => state.pageKey);
81
+ const builderMode = usePhiDeveloperBuilderStateValue((state) => state.builderMode);
82
+ const nodeId = usePhiDeveloperBuilderStateValue((state) => state.nodeId);
83
+ const nodeKey = usePhiDeveloperBuilderStateValue((state) => state.nodeKey);
84
+ const nodeKind = usePhiDeveloperBuilderStateValue((state) => state.nodeKind);
85
+ const selectedLayoutAnchor = usePhiDeveloperBuilderStateValue((state) => state.selectedLayoutAnchor);
86
+ const selectedRootRegionKey = usePhiDeveloperBuilderStateValue((state) => state.selectedRootRegionKey);
87
87
  const activeModuleMetas = usePhiBuilderModuleMetas(area);
88
88
  const activeBuilderPlugins = activeModuleMetas.plugins;
89
89
  const activeDataProviderDescriptors = activeModuleMetas.dataProviders;
@@ -8,12 +8,12 @@ import { findPhiBuilderLayoutNodeById, findPhiBuilderWidgetNodeByIdInLayouts, }
8
8
  import { resolveRegionDraftKey } from "../developer-region-drafts";
9
9
  import { usePhiDeveloperBuilderStateValue, usePhiDeveloperRegionDrafts, } from "../developer-workspace-store";
10
10
  export function PhiBuilderInspectorTitleWidgetClient({ inspectorLabels, regionLabels, }) {
11
- const area = usePhiDeveloperBuilderStateValue("public", (state) => state.area);
12
- const pageKey = usePhiDeveloperBuilderStateValue("public", (state) => state.pageKey);
13
- const nodeId = usePhiDeveloperBuilderStateValue("public", (state) => state.nodeId);
14
- const nodeKey = usePhiDeveloperBuilderStateValue("public", (state) => state.nodeKey);
15
- const nodeKind = usePhiDeveloperBuilderStateValue("public", (state) => state.nodeKind);
16
- const selectedRootRegionKey = usePhiDeveloperBuilderStateValue("public", (state) => state.selectedRootRegionKey);
11
+ const area = usePhiDeveloperBuilderStateValue((state) => state.area);
12
+ const pageKey = usePhiDeveloperBuilderStateValue((state) => state.pageKey);
13
+ const nodeId = usePhiDeveloperBuilderStateValue((state) => state.nodeId);
14
+ const nodeKey = usePhiDeveloperBuilderStateValue((state) => state.nodeKey);
15
+ const nodeKind = usePhiDeveloperBuilderStateValue((state) => state.nodeKind);
16
+ const selectedRootRegionKey = usePhiDeveloperBuilderStateValue((state) => state.selectedRootRegionKey);
17
17
  const regionDrafts = usePhiDeveloperRegionDrafts();
18
18
  const plugins = usePhiBuilderModuleMetas(area).plugins;
19
19
  const title = useMemo(() => {
@@ -1,4 +1,4 @@
1
- import { type PhiBackgroundControlProps } from "../../../../components/controls/phi-background-control";
1
+ import type { PhiBackgroundControlProps } from "../../../../components/controls/phi-background-control";
2
2
  import type { PhiInspectorSurfaceLabels } from "./inspector-surface-labels";
3
3
  import type { PhiInspectorWidgetLabels } from "../../../../components/widgets/label-types/inspector";
4
4
  import type { PhiBackgroundWidgetLabels } from "../../../../components/widgets/label-types/background";
@@ -2,30 +2,22 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useEffect } from "react";
4
4
  import { usePhiBaseLayoutOwnSlotController } from "../../../../components/layouts/phi-layout-slot-state";
5
- import { PhiBackgroundControl } from "../../../../components/controls/phi-background-control";
6
- import { PhiBorderControl } from "../../../../components/controls/phi-border-control";
7
5
  import { PhiSurfaceControl } from "../../../../components/controls/phi-surface-control";
8
- import { PhiShadowControl } from "../../../../components/controls/phi-shadow-control";
9
6
  import { PhiViewportVisibilityControl } from "../../../../components/controls/phi-viewport-visibility-control";
10
7
  import { PhiPlacementMatrixControl } from "../../../../components/controls/phi-placement-matrix-control";
11
8
  import { PhiInspectorSectionContent } from "./inspector-section-content";
12
9
  import { PhiGridPlacementSettings } from "./grid-placement-settings";
13
10
  import { resolvePhiLayoutSignalEndpoints, resolvePhiSignalEndpointCapabilities, } from "../../../../components/widgets/signals/signal-endpoints";
14
- import { readPhiShadow } from "../../../../types/layout-style";
15
11
  import { normalizePhiPaddingWidgetConfig } from "../../../../types/cms-config";
16
12
  import {} from "../developer-workspace-types";
17
13
  import { isPhiInspectorConfigFieldVisible, renderPhiInspectorPaddingConfigControl, renderPhiInspectorConfigField, renderPhiInspectorSlotTextsField, renderPhiInspectorSwitchRow, } from "./inspector-config-field";
18
14
  import { hasPhiFlag } from "../../../../helpers/flags";
19
15
  import { PhiCmsFlags } from "../../../../constants/phi-cms";
20
16
  import { PhiInspectorSignalSection, } from "./inspector-signal-section";
21
- import { PhiFlexControl } from "../../../../components/controls/phi-flex-control";
22
17
  import { PhiTypographyControl } from "../../../../components/controls/phi-typography-control";
23
18
  const PHI_GAP_SM = "var(--ant-padding-sm)";
24
19
  function isPhiCmsChromeConfigField(field) {
25
20
  return (field.type === "padding"
26
- || field.type === "background"
27
- || field.type === "border"
28
- || field.type === "shadow"
29
21
  || field.type === "grid-placement"
30
22
  || field.type === "column-count");
31
23
  }
@@ -70,7 +62,7 @@ export function PhiDeveloperBuilderLayoutInspectorWidgetClient({ section, builde
70
62
  const chromeFields = declaredFields
71
63
  .filter(isPhiCmsChromeConfigField)
72
64
  .filter((field) => isPhiInspectorConfigFieldVisible(field, currentLayoutConfigRecord))
73
- .filter((field) => field.type !== "grid-placement" && field.type !== "column-count");
65
+ .filter((field) => field.type === "padding");
74
66
  const gridPlacementField = declaredFields
75
67
  .filter(isPhiCmsChromeConfigField)
76
68
  .filter((field) => isPhiInspectorConfigFieldVisible(field, currentLayoutConfigRecord))
@@ -89,8 +81,7 @@ export function PhiDeveloperBuilderLayoutInspectorWidgetClient({ section, builde
89
81
  const settingsHasContent = !settingsAnswerIsKnown || !isTargetKind || section !== "settings"
90
82
  || settingsFields.length > 0 || gridPlacementField != null
91
83
  || (slotTextsFields.length > 0 && textSlots.length > 0)
92
- || selectedStructurePlugin?.translatesOwnText === true
93
- || chromeFields.some((field) => field.type !== "padding");
84
+ || selectedStructurePlugin?.translatesOwnText === true;
94
85
  const ownSlot = usePhiBaseLayoutOwnSlotController();
95
86
  useEffect(() => {
96
87
  if (!ownSlot)
@@ -118,16 +109,13 @@ export function PhiDeveloperBuilderLayoutInspectorWidgetClient({ section, builde
118
109
  routeScope: signalRouteScope,
119
110
  });
120
111
  const signalCapabilities = resolvePhiSignalEndpointCapabilities(signalEndpoints);
121
- /*
122
- * The chrome fields a layout declares itself: its own padding, which has the Drawer's Paddings panel,
123
- * and anything else -- Split Card's two cards -- which lives in Settings with the layout's other fields.
124
- */
112
+ // The padding fields a layout declares itself, each with its own panel in the Drawer.
125
113
  const declaredChromeSections = chromeFields.map((field) => ({
126
114
  field,
127
115
  section: {
128
116
  key: field.section ?? field.key,
129
117
  title: field.label,
130
- children: (_jsx("div", { style: { display: "grid", gap: PHI_GAP_SM, width: "100%" }, children: field.type === "padding" ? (renderPhiInspectorPaddingConfigControl({
118
+ children: (_jsx("div", { style: { display: "grid", gap: PHI_GAP_SM, width: "100%" }, children: renderPhiInspectorPaddingConfigControl({
131
119
  field,
132
120
  disabled: isPreviewMode || (!onPaddingChange && !onConfigPatch),
133
121
  config: isCanonicalPaddingField(field)
@@ -144,14 +132,11 @@ export function PhiDeveloperBuilderLayoutInspectorWidgetClient({ section, builde
144
132
  }
145
133
  onConfigPatch?.(Object.fromEntries(Object.entries(patch).map(([key, value]) => [key, value ?? null])));
146
134
  },
147
- })) : field.type === "background" ? (_jsx(PhiBackgroundControl, { mode: "control", disabled: isPreviewMode || !onConfigPatch, value: currentDraftRecord?.[field.key] ?? null, config: layoutDefaultConfigRecord?.[field.key] ?? null, onChange: (background) => onConfigPatch?.({ [field.key]: background }), labels: backgroundLabels, colorPickerLabels: colorPickerLabels, colorPickerPlacement: "left", renderMediaPicker: renderMediaPicker })) : field.type === "border" ? (_jsx(PhiBorderControl, { mode: "control", disabled: isPreviewMode || !onConfigPatch, value: currentDraftRecord?.[field.key] ?? null, config: layoutDefaultConfigRecord?.[field.key] ?? null, onChange: (border) => onConfigPatch?.({ [field.key]: border }), labels: borderLabels, colorPickerLabels: colorPickerLabels, colorPickerPlacement: "left" })) : (_jsx(PhiShadowControl, { mode: "control", disabled: isPreviewMode || !onConfigPatch, value: readPhiShadow(currentDraftRecord?.[field.key]) ??
148
- readPhiShadow(layoutDefaultConfigRecord?.[field.key]) ??
149
- null, onChange: (shadow) => onConfigPatch?.({ [field.key]: shadow }) })) })),
135
+ }) })),
150
136
  },
151
137
  }));
152
- const declaredCardSections = declaredChromeSections.filter((entry) => entry.field.type !== "padding");
153
138
  return (_jsx("div", { style: { display: "grid", gap: PHI_GAP_SM, width: "100%" }, children: !isTargetKind ? (_jsx(PhiTypographyControl, { type: "secondary", children: "Select a layout to edit its geometry." })) : (_jsx("div", { style: { display: "grid", gap: PHI_GAP_SM, width: "100%" }, children: _jsx(PhiInspectorSectionContent, { sectionKey: section ?? "settings", sections: [
154
- ...(settingsFields.length > 0 || gridPlacementField || declaredCardSections.length > 0 ||
139
+ ...(settingsFields.length > 0 || gridPlacementField ||
155
140
  selectedStructurePlugin?.translatesOwnText || (slotTextsFields.length > 0 && textSlots.length > 0)
156
141
  ? [
157
142
  {
@@ -164,6 +149,9 @@ export function PhiDeveloperBuilderLayoutInspectorWidgetClient({ section, builde
164
149
  config: currentDraftRecord ?? {},
165
150
  defaultConfig: layoutDefaultConfigRecord,
166
151
  disabled: isPreviewMode,
152
+ backgroundLabels,
153
+ borderLabels,
154
+ renderMediaPicker,
167
155
  colorPickerLabels,
168
156
  iconPickerLabels,
169
157
  fieldLabels,
@@ -185,7 +173,7 @@ export function PhiDeveloperBuilderLayoutInspectorWidgetClient({ section, builde
185
173
  disabled: isPreviewMode,
186
174
  ...(onTranslateChange ? { onChange: onTranslateChange } : {}),
187
175
  })
188
- : null, gridPlacementField ? (_jsx(PhiGridPlacementSettings, { config: currentDraftRecord ?? {}, defaultConfig: layoutDefaultConfigRecord, occupiedSlotIndices: gridOccupiedSlotIndices, labels: gridLabels, withDistribution: gridPlacementField.type === "grid-placement", disabled: isPreviewMode, onConfigChange: onConfigPatch ? (key, value) => onConfigPatch({ [key]: value }) : undefined })) : null, declaredCardSections.map((entry) => (_jsxs(PhiFlexControl, { vertical: true, gap: 8, style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiTypographyControl, { children: entry.section.title }), entry.section.children] }, entry.section.key)))] })),
176
+ : null, gridPlacementField ? (_jsx(PhiGridPlacementSettings, { config: currentDraftRecord ?? {}, defaultConfig: layoutDefaultConfigRecord, occupiedSlotIndices: gridOccupiedSlotIndices, labels: gridLabels, withDistribution: gridPlacementField.type === "grid-placement", disabled: isPreviewMode, onConfigChange: onConfigPatch ? (key, value) => onConfigPatch({ [key]: value }) : undefined })) : null] })),
189
177
  },
190
178
  ]
191
179
  : []),
@@ -207,9 +195,7 @@ export function PhiDeveloperBuilderLayoutInspectorWidgetClient({ section, builde
207
195
  title: surfaceLabels?.section ?? "Surface",
208
196
  children: (_jsx(PhiSurfaceControl, { disabled: isPreviewMode, value: currentDraft?.surface ?? null, onChange: (surface) => onSurfaceChange?.(surface), labels: surfaceLabels?.parts, backgroundLabels: backgroundLabels, borderLabels: borderLabels, colorPickerLabels: colorPickerLabels, renderMediaPicker: renderMediaPicker })),
209
197
  },
210
- ...declaredChromeSections
211
- .filter((entry) => entry.field.type === "padding")
212
- .map((entry) => entry.section),
198
+ ...declaredChromeSections.map((entry) => entry.section),
213
199
  ],
214
200
  {
215
201
  key: "signals",
@@ -8,7 +8,7 @@ import { usePhiConfig } from "../../../../components/root/phi-config-provider";
8
8
  import { PhiFlexControl } from "../../../../components/controls/phi-flex-control";
9
9
  export function PhiBuilderModeSwitchWidgetClient({ disabled = false, labels = PHI_BUILDER_CHROME_WIDGET_DEFAULT_LABELS, }) {
10
10
  const { token } = usePhiConfig();
11
- const builderMode = usePhiDeveloperBuilderStateValue("public", (state) => state.builderMode);
11
+ const builderMode = usePhiDeveloperBuilderStateValue((state) => state.builderMode);
12
12
  const isDisabled = disabled;
13
13
  const controlSignals = usePhiControlSignalController({
14
14
  key: "builderMode",
@@ -35,22 +35,22 @@ function PhiDeveloperBuilderPagesHeaderTitleField({ area, path, disabled, initia
35
35
  }
36
36
  export function PhiDeveloperBuilderPagesHeaderSection({ mode, pageTitle, disabled = false, labels = PHI_PAGE_TITLE_WIDGET_DEFAULT_LABELS, }) {
37
37
  const searchParams = useSearchParams();
38
- const currentArea = usePhiDeveloperBuilderStateValue("public", (state) => state.area);
39
- const currentPageKey = usePhiDeveloperBuilderStateValue("public", (state) => state.pageKey);
40
- const builderMode = usePhiDeveloperBuilderStateValue("public", (state) => state.builderMode);
41
- const customPages = usePhiDeveloperBuilderStateValue("public", (state) => state.customPages);
42
- const modulePresetPagesByArea = usePhiDeveloperBuilderStateValue("public", (state) => state.modulePresetPagesByArea);
43
- const catalogHydrated = usePhiDeveloperBuilderStateValue("public", (state) => state.catalogHydrated);
44
- const persistedPageCatalogByArea = usePhiDeveloperBuilderStateValue("public", (state) => state.persistedPageCatalogByArea);
38
+ const currentArea = usePhiDeveloperBuilderStateValue((state) => state.area);
39
+ const currentPageKey = usePhiDeveloperBuilderStateValue((state) => state.pageKey);
40
+ const builderMode = usePhiDeveloperBuilderStateValue((state) => state.builderMode);
41
+ const customPages = usePhiDeveloperBuilderStateValue((state) => state.customPages);
42
+ const modulePresetPagesByArea = usePhiDeveloperBuilderStateValue((state) => state.modulePresetPagesByArea);
43
+ const catalogHydrated = usePhiDeveloperBuilderStateValue((state) => state.catalogHydrated);
44
+ const persistedPageCatalogByArea = usePhiDeveloperBuilderStateValue((state) => state.persistedPageCatalogByArea);
45
45
  /*
46
46
  * What the Select is allowed to name, which is narrower than what is installed: the Pages the Area
47
47
  * answers with. The three fields below are what that narrowing is read from -- which Modules are
48
48
  * switched on, and what the Area said about its root.
49
49
  */
50
- const navigationSurfacesByArea = usePhiDeveloperBuilderStateValue("public", (state) => state.navigationSurfacesByArea);
51
- const runtimeModuleIdsByArea = usePhiDeveloperBuilderStateValue("public", (state) => state.runtimeModuleIdsByArea);
52
- const areaRootRoutes = usePhiDeveloperBuilderStateValue("public", (state) => state.areaRootRoutes);
53
- const pageCatalogHydratedByArea = usePhiDeveloperBuilderStateValue("public", (state) => state.pageCatalogHydratedByArea);
50
+ const navigationSurfacesByArea = usePhiDeveloperBuilderStateValue((state) => state.navigationSurfacesByArea);
51
+ const runtimeModuleIdsByArea = usePhiDeveloperBuilderStateValue((state) => state.runtimeModuleIdsByArea);
52
+ const areaRootRoutes = usePhiDeveloperBuilderStateValue((state) => state.areaRootRoutes);
53
+ const pageCatalogHydratedByArea = usePhiDeveloperBuilderStateValue((state) => state.pageCatalogHydratedByArea);
54
54
  const resolvedCustomPages = customPages ?? {};
55
55
  const titleModeEnabled = mode === "full" || mode === "title";
56
56
  const searchArea = normalizePhiBuilderAreaSearchParam(searchParams.get(PHI_BUILDER_AREA_SEARCH_PARAM));
@@ -19,7 +19,7 @@ export function PhiDeveloperBuilderPagesWorkspaceWidgetClient({ pageDraftsByScop
19
19
  * Empty drafts rather than no drafts, because the merge below is a merge: leaving the keys out would
20
20
  * let the Preset's regions stand from before the Builder answered.
21
21
  */
22
- const constructedRoot = usePhiDeveloperBuilderStateValue("public", (state) => isPhiBuilderConstructedRootPage(state, pageMetaArea, pageMetaPageKey));
22
+ const constructedRoot = usePhiDeveloperBuilderStateValue((state) => isPhiBuilderConstructedRootPage(state, pageMetaArea, pageMetaPageKey));
23
23
  const emptyPresetDrafts = useMemo(() => buildPhiDeveloperBuilderRegionDraftsFromTree({ regions: [], layoutNodes: [], contentWidgets: [] }, pageMetaArea, pageMetaPageKey, PHI_BUILDER_PAGE_REGION_KEYS), [pageMetaArea, pageMetaPageKey]);
24
24
  useEffect(() => {
25
25
  mergePhiDeveloperPagePresetDrafts(constructedRoot ? emptyPresetDrafts : pagePresetDrafts);
@@ -67,7 +67,7 @@ function collectNodesWithChildren(nodes, into = new Set()) {
67
67
  * field is, offered from the Pages the Area actually answers.
68
68
  */
69
69
  export function PhiRegionVisibilityFields({ regionKey, regionConfig, disabled, labels, onChange, }) {
70
- const state = usePhiDeveloperBuilderStateValue("public", (current) => current);
70
+ const state = usePhiDeveloperBuilderStateValue((current) => current);
71
71
  const pages = usePhiBuilderOfferedPageCatalog(state, state.area);
72
72
  const tree = useMemo(() => buildPhiBuilderPageScopeTree(state.area, pages, pages, { landing: labels.landing }), [labels.landing, pages, state.area]);
73
73
  const subtreeValues = useMemo(() => collectNodesWithChildren(tree), [tree]);
@@ -8,7 +8,7 @@ import { PhiRuntimeModuleProvider } from "../../../../components/runtime/runtime
8
8
  import { setPhiBuilderModuleMetas } from "../plugin-meta-store";
9
9
  import { usePhiDeveloperBuilderStateValue } from "../developer-workspace-store";
10
10
  export function PhiBuilderRuntimeModuleAuthoringBoundary({ targetArea, catalog, pickerDataProviderKeys, children, }) {
11
- const selectedModuleIds = usePhiDeveloperBuilderStateValue("public", (state) => state.runtimeModuleIdsByArea[targetArea]);
11
+ const selectedModuleIds = usePhiDeveloperBuilderStateValue((state) => state.runtimeModuleIdsByArea[targetArea]);
12
12
  const activeEntries = useMemo(() => {
13
13
  if (selectedModuleIds == null) {
14
14
  return catalog;