@phis/ui 0.4.8 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/components/cms/phi-cms-runtime-registry.d.ts +2 -1
  2. package/components/cms/phi-cms-runtime-registry.js +1 -1
  3. package/components/controls/phi-color-control.js +2 -1
  4. package/components/controls/phi-drawer-control-adapter.js +2 -3
  5. package/components/controls/phi-drawer-control.js +3 -3
  6. package/components/controls/phi-dropdown-control.js +2 -1
  7. package/components/controls/phi-float-button-control.js +3 -3
  8. package/components/controls/phi-modal-control-adapter.js +2 -2
  9. package/components/controls/phi-modal-control.js +3 -3
  10. package/components/controls/phi-ribbon-wrap-control.js +2 -1
  11. package/components/controls/phi-zoom-image-overlay.js +11 -5
  12. package/components/forms/content-entry-forms.js +1 -5
  13. package/components/forms/form-descriptor-runtime-client.js +2 -1
  14. package/components/forms/form-descriptor-text.d.ts +17 -0
  15. package/components/forms/form-descriptor-text.js +14 -0
  16. package/components/forms/runtime-form-controller-plugin.d.ts +0 -115
  17. package/components/forms/runtime-form-controller-plugin.js +1 -1
  18. package/components/forms/upload-form-control.d.ts +0 -7
  19. package/components/forms/upload-form-control.js +1 -1
  20. package/components/layouts/clients/phi-collapsible-layout-client.js +2 -1
  21. package/components/layouts/clients/phi-sequence-slot-editor.js +2 -1
  22. package/components/layouts/clients/phi-split-card-half.js +2 -1
  23. package/components/layouts/phi-base-layout.js +2 -1
  24. package/components/layouts/phi-layout-surface-box.js +2 -1
  25. package/components/media/phi-media-picker-server.js +3 -11
  26. package/components/navigation/use-phi-protected-mail.js +1 -9
  27. package/components/regions/presets/clients/sider-context.js +4 -2
  28. package/components/root/phi-config-provider.js +2 -1
  29. package/components/root/phi-dayjs-locale.d.ts +4 -1
  30. package/components/root/phi-dayjs-locale.js +2 -2
  31. package/components/root/phi-intl-locale.d.ts +7 -1
  32. package/components/root/phi-intl-locale.js +20 -15
  33. package/components/root/phi-root-layout.js +2 -1
  34. package/components/runtime/core-runtime-controller-plugin.d.ts +0 -84
  35. package/components/runtime/core-runtime-controller-plugin.js +1 -1
  36. package/components/runtime/runtime-signal-bus.js +39 -4
  37. package/components/state/use-phi-hydrated.d.ts +6 -0
  38. package/components/state/use-phi-hydrated.js +11 -0
  39. package/components/widgets/client/shared/phi-rendered-value.js +4 -3
  40. package/components/widgets/config/parser-primitives.d.ts +5 -0
  41. package/components/widgets/config/parser-primitives.js +11 -0
  42. package/components/widgets/label-sets/runtime-options.d.ts +1 -1
  43. package/components/widgets/server/builder-chrome.js +2 -6
  44. package/components/widgets/server/search.js +2 -6
  45. package/gateway/dashboard-cards-route.js +5 -7
  46. package/gateway/navigation-target-route.js +7 -9
  47. package/gateway/page-references-route.js +6 -8
  48. package/gateway/site-config.js +3 -0
  49. package/gateway/site-proxy.js +13 -2
  50. package/helpers/class-names.d.ts +7 -0
  51. package/helpers/class-names.js +10 -0
  52. package/helpers/cms-navigation-catalog.js +4 -2
  53. package/helpers/cms-page-catalog.js +35 -6
  54. package/helpers/cms-region-keys.d.ts +0 -1
  55. package/helpers/cms-region-keys.js +1 -1
  56. package/helpers/format-date-time.d.ts +14 -3
  57. package/helpers/format-date-time.js +27 -11
  58. package/helpers/region-page-scope.d.ts +1 -3
  59. package/helpers/region-page-scope.js +0 -4
  60. package/helpers/translation-format.d.ts +6 -0
  61. package/helpers/translation-format.js +15 -8
  62. package/package.json +2 -2
  63. package/plugins/runtime/phi-slot-child-frame-view.js +2 -1
  64. package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +1 -1
  65. package/plugins/runtime-modules/admin/forms.js +1 -1
  66. package/plugins/runtime-modules/admin/trees/phi-default-admin-settings-page-tree.js +2 -5
  67. package/plugins/runtime-modules/app/forms.js +1 -1
  68. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +2 -6
  69. package/plugins/runtime-modules/asset/metadata-form.js +2 -6
  70. package/plugins/runtime-modules/asset/settings-forms.js +1 -1
  71. package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +2 -5
  72. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -6
  73. package/plugins/runtime-modules/asset/widgets/area-upload/server.js +2 -6
  74. package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +1 -3
  75. package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -6
  76. package/plugins/runtime-modules/asset/widgets.js +5 -7
  77. package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
  78. package/plugins/runtime-modules/auth/ids.d.ts +7 -7
  79. package/plugins/runtime-modules/auth/ids.js +7 -7
  80. package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +2 -6
  81. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -5
  82. package/plugins/runtime-modules/auth/widgets.d.ts +1 -2
  83. package/plugins/runtime-modules/auth/widgets.js +5 -7
  84. package/plugins/runtime-modules/avatar/overlay-tree.server.js +2 -6
  85. package/plugins/runtime-modules/avatar/widgets/account-avatar/server.js +2 -6
  86. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/server.js +2 -6
  87. package/plugins/runtime-modules/avatar/widgets.js +3 -5
  88. package/plugins/runtime-modules/builder/clients/pages-workspace.d.ts +2 -3
  89. package/plugins/runtime-modules/builder/clients/pages-workspace.js +5 -18
  90. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +1 -0
  91. package/plugins/runtime-modules/builder/controller/page-controller.js +1 -1
  92. package/plugins/runtime-modules/builder/controller/server-definition.js +3 -11
  93. package/plugins/runtime-modules/builder/controller/workspace-controller.js +2 -6
  94. package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +2 -8
  95. package/plugins/runtime-modules/builder/developer-workspace-store.js +24 -44
  96. package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +0 -5
  97. package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +2 -1
  98. package/plugins/runtime-modules/builder/inspector-section-widget.js +6 -31
  99. package/plugins/runtime-modules/builder/navigation-persistence.js +12 -3
  100. package/plugins/runtime-modules/builder/page-meta-form.js +4 -12
  101. package/plugins/runtime-modules/builder/page-presets.server.d.ts +0 -1
  102. package/plugins/runtime-modules/builder/page-presets.server.js +0 -24
  103. package/plugins/runtime-modules/builder/pages-workspace.js +6 -16
  104. package/plugins/runtime-modules/builder/persistence.d.ts +6 -4
  105. package/plugins/runtime-modules/builder/persistence.js +6 -7
  106. package/plugins/runtime-modules/builder/shells-workspace.js +3 -11
  107. package/plugins/runtime-modules/builder/signal-wiring-form.js +3 -7
  108. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +2 -6
  109. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -26
  110. package/plugins/runtime-modules/builder/trees/phi-default-builder-settings-page-tree.js +2 -6
  111. package/plugins/runtime-modules/builder/widgets/developer-builder-pages-header/plugin.js +2 -6
  112. package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.js +2 -6
  113. package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +3 -2
  114. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +1 -6
  115. package/plugins/runtime-modules/builder/widgets.js +10 -12
  116. package/plugins/runtime-modules/contracts.d.ts +15 -1
  117. package/plugins/runtime-modules/contracts.js +10 -0
  118. package/plugins/runtime-modules/core/messaging/forms.js +1 -1
  119. package/plugins/runtime-modules/core/widgets/description/server.js +12 -9
  120. package/plugins/runtime-modules/core/widgets/dimension/plugin.js +2 -6
  121. package/plugins/runtime-modules/core/widgets/draft-status/plugin.js +2 -6
  122. package/plugins/runtime-modules/core/widgets/entry-list/config.js +2 -9
  123. package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +1 -1
  124. package/plugins/runtime-modules/core/widgets/form-preview/client.js +2 -15
  125. package/plugins/runtime-modules/core/widgets/gallery/server.js +2 -6
  126. package/plugins/runtime-modules/core/widgets/image/server.js +2 -6
  127. package/plugins/runtime-modules/core/widgets/length/plugin.js +2 -6
  128. package/plugins/runtime-modules/core/widgets/markdown-toc/plugin.js +2 -6
  129. package/plugins/runtime-modules/core/widgets/page-title/server.js +2 -6
  130. package/plugins/runtime-modules/core/widgets/pagination/config.js +4 -8
  131. package/plugins/runtime-modules/core/widgets/search-results/config.js +2 -8
  132. package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.d.ts +2 -2
  133. package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.js +8 -13
  134. package/plugins/runtime-modules/core/widgets/theme-mode-switch/server.js +2 -6
  135. package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +16 -31
  136. package/plugins/runtime-modules/core/widgets/timeline/client.js +9 -4
  137. package/plugins/runtime-modules/core/widgets/tour-button/server.js +2 -6
  138. package/plugins/runtime-modules/core/widgets.js +59 -61
  139. package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +7 -5
  140. package/plugins/runtime-modules/dashboard/trees/phi-default-admin-dashboard-page-tree.js +2 -6
  141. package/plugins/runtime-modules/dashboard/trees/phi-default-area-dashboard-page-tree.js +2 -6
  142. package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +2 -6
  143. package/plugins/runtime-modules/descriptor-compiler.js +6 -6
  144. package/plugins/runtime-modules/groups/controller/client.d.ts +0 -56
  145. package/plugins/runtime-modules/groups/controller/client.js +1 -1
  146. package/plugins/runtime-modules/groups/forms.js +1 -5
  147. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +2 -6
  148. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -6
  149. package/plugins/runtime-modules/localization/forms.js +2 -6
  150. package/plugins/runtime-modules/localization/services/options.js +19 -9
  151. package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -11
  152. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -11
  153. package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +3 -11
  154. package/plugins/runtime-modules/revisions/forms.js +1 -1
  155. package/plugins/runtime-modules/revisions/services/table.js +6 -2
  156. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
  157. package/plugins/runtime-modules/theme/controller/server-definition.js +2 -6
  158. package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +2 -6
  159. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -21
  160. package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +0 -2
  161. package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +0 -8
  162. package/plugins/runtime-modules/theme/widgets.js +6 -8
  163. package/plugins/runtime-modules/threads/controller/client.d.ts +0 -78
  164. package/plugins/runtime-modules/threads/controller/client.js +1 -1
  165. package/plugins/runtime-modules/threads/forms.js +1 -1
  166. package/plugins/runtime-modules/threads/ids.d.ts +0 -1
  167. package/plugins/runtime-modules/threads/ids.js +0 -2
  168. package/plugins/runtime-modules/user-management/controller/client.d.ts +0 -73
  169. package/plugins/runtime-modules/user-management/controller/client.js +1 -1
  170. package/plugins/runtime-modules/user-management/forms.js +1 -5
  171. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +2 -6
  172. package/plugins/runtime-modules/video/widgets.js +2 -4
  173. package/server-helpers/cms-request.d.ts +19 -0
  174. package/server-helpers/cms-request.js +26 -8
  175. package/server-helpers/cms-root.js +6 -8
  176. package/server-helpers/public-login-route.js +6 -8
  177. package/server-helpers/runtime.js +1 -0
  178. package/server-helpers/search-index.js +34 -14
  179. package/types/length.js +8 -3
  180. package/types/site-config.d.ts +6 -0
  181. package/types/widget-runtime.d.ts +2 -0
  182. package/types.d.ts +5 -3
  183. package/types.js +3 -0
@@ -4,7 +4,7 @@ import type { PhiCmsSiteBridge, PhiRuntimeModuleCatalog, PhiRuntimeModuleId } fr
4
4
  import type { PhiCmsAreaKey } from "../../constants/cms-areas";
5
5
  import type { PhiCapabilitySnapshot } from "../../types/server-capabilities";
6
6
  import { readPhiAreaPresetRuntimeModuleIds } from "../../helpers/cms-area-config";
7
- export declare function resolvePhiCmsRuntimeModuleScope({ cmsBridge, moduleIds, area, serverCapabilities, }: {
7
+ declare function resolvePhiCmsRuntimeModuleScope({ cmsBridge, moduleIds, area, serverCapabilities, }: {
8
8
  cmsBridge: PhiCmsSiteBridge;
9
9
  moduleIds?: readonly PhiRuntimeModuleId[] | null;
10
10
  area: PhiCmsAreaKey;
@@ -36,3 +36,4 @@ export declare function resolvePhiCmsTreeRuntimeRegistry({ moduleScope, trees, }
36
36
  moduleScope: Awaited<ReturnType<typeof resolvePhiCmsRuntimeModuleScope>>;
37
37
  trees: readonly PhiResolvedCmsRenderableTree[];
38
38
  }): Promise<import("../../types/cms-plugins").PhiCmsRuntimeRenderRegistry>;
39
+ export {};
@@ -20,7 +20,7 @@ const resolvePhiCmsRuntimeModuleScopeForRequest = cache(async (catalog, area, mo
20
20
  widgetDefinitionsByType,
21
21
  };
22
22
  });
23
- export function resolvePhiCmsRuntimeModuleScope({ cmsBridge, moduleIds, area, serverCapabilities, }) {
23
+ function resolvePhiCmsRuntimeModuleScope({ cmsBridge, moduleIds, area, serverCapabilities, }) {
24
24
  return resolvePhiCmsRuntimeModuleScopeForRequest(cmsBridge.runtimeModuleCatalog, area, JSON.stringify(moduleIds ?? []), JSON.stringify(serverCapabilities));
25
25
  }
26
26
  /**
@@ -6,6 +6,7 @@ import { PhiLabeledControl } from "./phi-labeled-control";
6
6
  import { PhiSelectControl } from "./phi-select-control";
7
7
  import { usePhiImmediatePicker } from "./use-phi-immediate-picker";
8
8
  import { readPhiCssLinearGradient } from "../../helpers/css-linear-gradient";
9
+ import { joinPhiClassNames } from "../../helpers/class-names";
9
10
  const PHI_COLOR_PICKER_CONTENT_WIDTH = 234;
10
11
  /*
11
12
  * A gradient the picker may edit is one a Background can hold: read by the Background's own reader, so
@@ -69,7 +70,7 @@ export function PhiColorControl({ value = null, defaultValue = "#f0f0f0", disabl
69
70
  colors: [...preset.colors],
70
71
  defaultOpen: preset.defaultOpen,
71
72
  }));
72
- return (_jsx(ColorPicker, { mode: resolveAntdMode(mode), value: resolveAntdColorValue(picker.value, defaultValue), open: picker.open, disabled: disabled, allowClear: allowClear, trigger: trigger, placement: placement === "auto" ? undefined : placement, size: size, showText: resolvedShowText, presets: antdPresets, getPopupContainer: getPopupContainer, classNames: { popup: { root: ["phi-color-widget-popup", popupClassName].filter(Boolean).join(" ") } }, styles: {
73
+ return (_jsx(ColorPicker, { mode: resolveAntdMode(mode), value: resolveAntdColorValue(picker.value, defaultValue), open: picker.open, disabled: disabled, allowClear: allowClear, trigger: trigger, placement: placement === "auto" ? undefined : placement, size: size, showText: resolvedShowText, presets: antdPresets, getPopupContainer: getPopupContainer, classNames: { popup: { root: joinPhiClassNames("phi-color-widget-popup", popupClassName) } }, styles: {
73
74
  root: {
74
75
  display: "inline-flex",
75
76
  alignItems: "center",
@@ -4,16 +4,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  * The Drawer itself, behind `PhiDrawerControl`, which loads this file the first time an Overlay opens --
5
5
  * the same split as the Modal, for the same reason.
6
6
  */
7
- import { useSyncExternalStore } from "react";
8
7
  import { Drawer } from "antd";
9
8
  import { PHI_FONT_SIZE, PHI_SPACE } from "../../theme/antd-css-var-contract";
10
9
  import { PHI_OVERLAY_DEFAULT_MASK, resolvePhiOverlayDismissSource, resolvePhiOverlayMaskPresentation, } from "./phi-overlay-control-contract";
11
- const subscribeHydration = () => () => undefined;
10
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
12
11
  const PHI_DRAWER_HEADER_MIN_BLOCK_SIZE = `calc(var(--ant-control-height) + ${PHI_SPACE.xs} + ${PHI_SPACE.xs})`;
13
12
  /** Where a title starts when the close button stands before it: past the button, not beneath it. */
14
13
  const PHI_DRAWER_TITLE_AFTER_CLOSE = `calc(${PHI_SPACE.sm} + var(--ant-control-height) + ${PHI_SPACE.xs})`;
15
14
  export function PhiDrawerControlAdapter({ open, title, header, body, footer, closable = true, keyboard = true, mask = PHI_OVERLAY_DEFAULT_MASK, mountPolicy = "remount", placement = "right", size, maxSize, resizable = false, push = false, zIndex, containerStyle, onDismiss, afterOpenChange, panelRef, }) {
16
- const hydrated = useSyncExternalStore(subscribeHydration, () => true, () => false);
15
+ const hydrated = usePhiHydrated();
17
16
  const resolvedMask = resolvePhiOverlayMaskPresentation(mask);
18
17
  const closeAtInlineStart = placement === "right";
19
18
  // A drawer with nothing to say in its header draws none: no title, no header content, no close button.
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import dynamic from "next/dynamic";
4
- import { useState, useSyncExternalStore } from "react";
4
+ import { useState } from "react";
5
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
5
6
  const PhiDrawerControlAdapter = dynamic(() => import("./phi-drawer-control-adapter").then((module) => module.PhiDrawerControlAdapter));
6
- const subscribeHydration = () => () => undefined;
7
7
  /**
8
8
  * The Drawer shell, loaded the first time it has something to show.
9
9
  *
@@ -12,7 +12,7 @@ const subscribeHydration = () => () => undefined;
12
12
  * its content hidden after hydration. Once loaded it stays, so closing plays the shell's own exit.
13
13
  */
14
14
  export function PhiDrawerControl(props) {
15
- const hydrated = useSyncExternalStore(subscribeHydration, () => true, () => false);
15
+ const hydrated = usePhiHydrated();
16
16
  const wanted = props.open || (hydrated && props.mountPolicy === "eager");
17
17
  const [loaded, setLoaded] = useState(wanted);
18
18
  if (wanted && !loaded) {
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import { cloneElement, isValidElement, useCallback, useRef, useState, } from "react";
4
4
  import { Dropdown } from "antd";
5
5
  import { toPhiAntdMenuItems } from "./phi-menu-control";
6
+ import { joinPhiClassNames } from "../../helpers/class-names";
6
7
  /**
7
8
  * Ant Design reopens a hover-and-click dropdown when the click that should close it lands on the
8
9
  * trigger: the click reopens what the outside-click already closed. Suppressing the close for this
@@ -68,7 +69,7 @@ export function PhiPillDropdownControl({ items, selectedKeys, open, onOpenChange
68
69
  const canOpen = items.length > 0;
69
70
  const chevron = showChevron && canOpen ? _jsx("span", { className: "phi-dropdown-control__chevron", "aria-hidden": true }) : null;
70
71
  const hasLabel = label != null && label !== false && label !== "";
71
- return (_jsx(PhiDropdownControl, { items: items, selectedKeys: selectedKeys, open: open, onOpenChange: onOpenChange, children: _jsxs("button", { ref: triggerRef, type: "button", className: ["phi-dropdown-control", className].filter(Boolean).join(" "), style: {
72
+ return (_jsx(PhiDropdownControl, { items: items, selectedKeys: selectedKeys, open: open, onOpenChange: onOpenChange, children: _jsxs("button", { ref: triggerRef, type: "button", className: joinPhiClassNames("phi-dropdown-control", className), style: {
72
73
  display: "inline-flex",
73
74
  alignItems: "center",
74
75
  gap: "var(--ant-padding-xs)",
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useSyncExternalStore } from "react";
3
+ import {} from "react";
4
4
  import { createPortal } from "react-dom";
5
5
  import { FloatButton } from "antd";
6
6
  import { PhiIcon } from "../shell/phi-icon";
7
- const subscribeNever = () => () => { };
7
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
8
8
  /**
9
9
  * Where a fixed button is drawn: on `document.body`, outside every box of the page.
10
10
  *
@@ -16,7 +16,7 @@ const subscribeNever = () => () => { };
16
16
  * to portal into, and a fixed button needs none of the page's flow.
17
17
  */
18
18
  function PhiFloatButtonPortal({ children }) {
19
- const mounted = useSyncExternalStore(subscribeNever, () => true, () => false);
19
+ const mounted = usePhiHydrated();
20
20
  return mounted ? createPortal(children, document.body) : null;
21
21
  }
22
22
  /* Ant Design's own corner distance (`floatButtonInsetInlineEnd`, `floatButtonInsetBlockEnd`). */
@@ -11,7 +11,7 @@ import { PHI_CONTROL, PHI_SPACE } from "../../theme/antd-css-var-contract";
11
11
  import { resolvePhiMotionDurationMs } from "../../helpers/motion";
12
12
  import { usePhiConfig } from "../root/phi-config-provider";
13
13
  import { PHI_MODAL_RESPONSIVE_MIN_WIDTH, PHI_OVERLAY_DEFAULT_MASK, resolvePhiModalResponsiveMode, resolvePhiModalWidth, resolvePhiOverlayDismissSource, resolvePhiOverlayMaskPresentation, } from "./phi-overlay-control-contract";
14
- const subscribeHydration = () => () => undefined;
14
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
15
15
  const PHI_MODAL_MODE_QUERIES = [
16
16
  `(min-width: ${PHI_MODAL_RESPONSIVE_MIN_WIDTH.medium}px)`,
17
17
  `(min-width: ${PHI_MODAL_RESPONSIVE_MIN_WIDTH.wide}px)`,
@@ -58,7 +58,7 @@ const PHI_MODAL_FIRST_FIELD_MAX_FRAMES = 60;
58
58
  const PHI_MODAL_HEADER_MIN_BLOCK_SIZE = `calc(${PHI_CONTROL.md} + ${PHI_SPACE.xs} + ${PHI_SPACE.xs})`;
59
59
  export function PhiModalControlAdapter({ open, title, header, body, footer, closable = true, keyboard = true, mask = PHI_OVERLAY_DEFAULT_MASK, mountPolicy = "remount", centered = false, controlSize, size, width, rootClassName, containerStyle, onDismiss, afterOpenChange, panelRef, }) {
60
60
  const { token } = usePhiConfig();
61
- const hydrated = useSyncExternalStore(subscribeHydration, () => true, () => false);
61
+ const hydrated = usePhiHydrated();
62
62
  const mode = useSyncExternalStore(subscribeModalMode, readModalMode, readServerModalMode);
63
63
  const bodyMeasureRef = useRef(null);
64
64
  const bodyContentRef = useRef(null);
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import dynamic from "next/dynamic";
4
- import { useState, useSyncExternalStore } from "react";
4
+ import { useState } from "react";
5
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
5
6
  const PhiModalControlAdapter = dynamic(() => import("./phi-modal-control-adapter").then((module) => module.PhiModalControlAdapter));
6
- const subscribeHydration = () => () => undefined;
7
7
  /**
8
8
  * The Modal shell, loaded the first time it has something to show.
9
9
  *
@@ -16,7 +16,7 @@ const subscribeHydration = () => () => undefined;
16
16
  * Opened during the server render, the shell renders there too, and Next ships its code with the page.
17
17
  */
18
18
  export function PhiModalControl(props) {
19
- const hydrated = useSyncExternalStore(subscribeHydration, () => true, () => false);
19
+ const hydrated = usePhiHydrated();
20
20
  const wanted = props.open || (hydrated && props.mountPolicy === "eager");
21
21
  const [loaded, setLoaded] = useState(wanted);
22
22
  if (wanted && !loaded) {
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import Ribbon from "antd/es/badge/Ribbon";
4
4
  import { PHI_THEME_GRADIENT_CSS_VARS } from "../../theme/phi-theme-gradients";
5
+ import { joinPhiClassNames } from "../../helpers/class-names";
5
6
  /**
6
7
  * A ribbon that hangs over a box's end edge, with a fold behind it: Ant Design's `Badge.Ribbon`.
7
8
  *
@@ -27,5 +28,5 @@ export function PhiRibbonWrapControl({ children, text, color, gradient, interact
27
28
  * empty, both were nothing, and only the fold showed. Room for a word, as the inner band keeps it.
28
29
  */
29
30
  const content = interactive ? { display: "inline-block", minWidth: "6em" } : undefined;
30
- return (_jsx(Ribbon, { text: text, ...(color ? { color } : {}), rootClassName: ["phi-ribbon-wrap-control", className].filter(Boolean).join(" "), styles: { indicator, ...(content ? { content } : {}) }, children: children }));
31
+ return (_jsx(Ribbon, { text: text, ...(color ? { color } : {}), rootClassName: joinPhiClassNames("phi-ribbon-wrap-control", className), styles: { indicator, ...(content ? { content } : {}) }, children: children }));
31
32
  }
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useEffect, useRef, useSyncExternalStore } from "react";
3
+ import { useEffect, useEffectEvent, useRef } from "react";
4
4
  import { createPortal } from "react-dom";
5
5
  import { usePhiConfig } from "../root/phi-config-provider";
6
- const subscribeNever = () => () => { };
6
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
7
7
  /** Ant Design's `zIndexPopupBase`, the layer its Modal stands on; the Phi token set does not carry it. */
8
8
  const PHI_ZOOM_OVERLAY_Z_INDEX = 1000;
9
9
  /**
@@ -17,8 +17,14 @@ const PHI_ZOOM_OVERLAY_Z_INDEX = 1000;
17
17
  */
18
18
  export function PhiZoomImageOverlay({ open, src, alt, title, onClose }) {
19
19
  const { token } = usePhiConfig();
20
- const mounted = useSyncExternalStore(subscribeNever, () => true, () => false);
20
+ const mounted = usePhiHydrated();
21
21
  const overlayRef = useRef(null);
22
+ /*
23
+ * `onClose` is an event, not a dependency: a caller hands over a new closure each render, and keyed on
24
+ * it the effect ran again on every render of the open overlay, took the overlay itself as the element
25
+ * to return focus to, and so never gave focus back to the picture that was clicked.
26
+ */
27
+ const close = useEffectEvent(() => onClose());
22
28
  useEffect(() => {
23
29
  if (!open)
24
30
  return undefined;
@@ -26,14 +32,14 @@ export function PhiZoomImageOverlay({ open, src, alt, title, onClose }) {
26
32
  overlayRef.current?.focus();
27
33
  const closeOnEscape = (event) => {
28
34
  if (event.key === "Escape")
29
- onClose();
35
+ close();
30
36
  };
31
37
  document.addEventListener("keydown", closeOnEscape);
32
38
  return () => {
33
39
  document.removeEventListener("keydown", closeOnEscape);
34
40
  previousFocus?.focus();
35
41
  };
36
- }, [onClose, open]);
42
+ }, [open]);
37
43
  if (!mounted || !open)
38
44
  return null;
39
45
  return createPortal(_jsx("div", { ref: overlayRef, role: "dialog", "aria-modal": "true", "aria-label": alt || title, tabIndex: -1,
@@ -4,13 +4,9 @@ import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_LINK_TARGET_LABEL_KEYS, PHI_FORM
4
4
  import { readPhiServerApiCredentials } from "../../helpers/phis-server-credentials";
5
5
  import { resolvePhiContentEntryEditorApiPaths, } from "../../constants/content-entry-kinds";
6
6
  import { PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS } from "../../constants/core-data-provider-keys";
7
+ import { phiFormLabel as label, phiFormRequired as required } from "./form-descriptor-text";
7
8
  /** Where the page that places the entry Form names the Site's source language, for the empty "Written in". */
8
9
  export const PHI_CONTENT_ENTRY_SOURCE_LOCALE_PLACEHOLDER_CONFIG_KEY = "sourceLocalePlaceholder";
9
- const label = (key, fallback) => ({ kind: "label", key, fallback });
10
- const required = (key, fallback) => [{
11
- providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.required,
12
- message: label(key, fallback),
13
- }];
14
10
  function entryFields(kind) {
15
11
  return [
16
12
  /*
@@ -111,9 +111,10 @@ export function PhiFormDescriptorRuntimeClient({ descriptor, labels, loadedIniti
111
111
  .flatMap((condition) => condition.source === "controller" && condition.controllerAddress
112
112
  ? [condition.controllerAddress]
113
113
  : [])), [descriptor.fields]);
114
+ const fieldKeys = useMemo(() => descriptor.fields.map((field) => field.key), [descriptor.fields]);
114
115
  const runtimeBinding = usePhiRuntimeFormBinding({
115
116
  formRef,
116
- fieldKeys: descriptor.fields.map((field) => field.key),
117
+ fieldKeys,
117
118
  controllerAddress: formControllerAddress,
118
119
  scope: identity.scope ?? "page",
119
120
  });
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The two words every Module's Form descriptor writes a hundred times: a translated label, and the
3
+ * `required` rule carrying one. Fourteen Modules each declared these two lines for themselves.
4
+ */
5
+ export declare function phiFormLabel(key: string, fallback: string): {
6
+ readonly kind: "label";
7
+ readonly key: string;
8
+ readonly fallback: string;
9
+ };
10
+ export declare function phiFormRequired(key: string, fallback: string): readonly [{
11
+ readonly providerKey: `${string}/${string}`;
12
+ readonly message: {
13
+ readonly kind: "label";
14
+ readonly key: string;
15
+ readonly fallback: string;
16
+ };
17
+ }];
@@ -0,0 +1,14 @@
1
+ import { PHI_FORM_VALIDATION_PROVIDER_KEYS } from "./form-provider-contract";
2
+ /**
3
+ * The two words every Module's Form descriptor writes a hundred times: a translated label, and the
4
+ * `required` rule carrying one. Fourteen Modules each declared these two lines for themselves.
5
+ */
6
+ export function phiFormLabel(key, fallback) {
7
+ return { kind: "label", key, fallback };
8
+ }
9
+ export function phiFormRequired(key, fallback) {
10
+ return [{
11
+ providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.required,
12
+ message: phiFormLabel(key, fallback),
13
+ }];
14
+ }
@@ -1,116 +1 @@
1
- import { type PhiRuntimeFormControllerConfig } from "./runtime-form-controller-definition";
2
- export declare const PHI_RUNTIME_FORM_CONTROLLER_PLUGIN: {
3
- renderController: ({ address, instanceKey }: import("../../types").PhiRuntimeControllerRenderArgs<PhiRuntimeFormControllerConfig, unknown>) => import("react").FunctionComponentElement<import("./runtime-form-controller-mount").PhiRuntimeFormControllerMountProps>;
4
- kind: "controller";
5
- pluginKey: string;
6
- key: string;
7
- title: string;
8
- description: string;
9
- iconFamily: string;
10
- flags: "multiInstance"[];
11
- allowedMountScopes: ("area" | "page" | "site")[];
12
- runtimeSignals: {
13
- emits: ({
14
- readonly id: "values";
15
- readonly action: "change";
16
- readonly valueType: "json";
17
- readonly valueSchema: `${string}/signals/${string}`;
18
- } | {
19
- readonly id: "field";
20
- readonly action: "change";
21
- readonly valueType: "json";
22
- readonly valueSchema: `${string}/signals/${string}`;
23
- } | {
24
- readonly id: "validity";
25
- readonly action: "change";
26
- readonly valueType: "json";
27
- readonly valueSchema: `${string}/signals/${string}`;
28
- } | {
29
- readonly id: "touched";
30
- readonly action: "change";
31
- readonly valueType: "json";
32
- readonly valueSchema: `${string}/signals/${string}`;
33
- } | {
34
- readonly id: "dirty";
35
- readonly action: "change";
36
- readonly valueType: "boolean";
37
- } | {
38
- readonly id: "submitting";
39
- readonly action: "change";
40
- readonly valueType: "boolean";
41
- } | {
42
- readonly id: "result";
43
- readonly action: "change";
44
- readonly valueType: "json";
45
- readonly valueSchema: `${string}/signals/${string}`;
46
- } | {
47
- readonly id: "error";
48
- readonly action: "change";
49
- readonly valueType: "json";
50
- readonly valueSchema: `${string}/signals/${string}`;
51
- } | {
52
- readonly id: "reset";
53
- readonly action: "activate";
54
- readonly valueType: "none";
55
- } | {
56
- readonly id: "clear";
57
- readonly action: "clear";
58
- readonly valueType: "none";
59
- })[];
60
- listens: ({
61
- readonly id: "values";
62
- readonly channel: "values";
63
- readonly action: "change";
64
- readonly valueType: "json";
65
- readonly valueSchema: `${string}/signals/${string}`;
66
- } | {
67
- readonly id: "field";
68
- readonly channel: "field";
69
- readonly action: "change";
70
- readonly valueType: "json";
71
- readonly valueSchema: `${string}/signals/${string}`;
72
- } | {
73
- readonly id: "validity";
74
- readonly channel: "validity";
75
- readonly action: "change";
76
- readonly valueType: "json";
77
- readonly valueSchema: `${string}/signals/${string}`;
78
- } | {
79
- readonly id: "touched";
80
- readonly channel: "touched";
81
- readonly action: "change";
82
- readonly valueType: "json";
83
- readonly valueSchema: `${string}/signals/${string}`;
84
- } | {
85
- readonly id: "dirty";
86
- readonly channel: "dirty";
87
- readonly action: "change";
88
- readonly valueType: "boolean";
89
- } | {
90
- readonly id: "submit";
91
- readonly channel: "submit";
92
- readonly action: "activate";
93
- readonly valueType: "json";
94
- readonly valueSchema: `${string}/signals/${string}`;
95
- } | {
96
- readonly id: "confirm";
97
- readonly channel: "confirm";
98
- readonly action: "activate";
99
- readonly valueType: "json";
100
- readonly valueSchema: `${string}/signals/${string}`;
101
- } | {
102
- readonly id: "reset";
103
- readonly channel: "reset";
104
- readonly action: "activate";
105
- readonly valueType: "none";
106
- } | {
107
- readonly id: "clear";
108
- readonly channel: "clear";
109
- readonly action: "clear";
110
- readonly valueType: "none";
111
- })[];
112
- };
113
- defaultConfig: {};
114
- parseConfig: typeof import("./runtime-form-controller-definition").parsePhiRuntimeFormControllerConfig;
115
- };
116
1
  export declare const PhiRuntimeFormControllerClient: (props: import("../../types").PhiRuntimeModuleControllerClientProps) => import("react").JSX.Element;
@@ -3,7 +3,7 @@ import { createElement } from "react";
3
3
  import { createPhiRuntimeControllerClient } from "../runtime/runtime-controller-client-factory";
4
4
  import { PHI_RUNTIME_FORM_CONTROLLER_DEFINITION, } from "./runtime-form-controller-definition";
5
5
  import { PhiRuntimeFormControllerMount } from "./runtime-form-controller-mount";
6
- export const PHI_RUNTIME_FORM_CONTROLLER_PLUGIN = {
6
+ const PHI_RUNTIME_FORM_CONTROLLER_PLUGIN = {
7
7
  ...PHI_RUNTIME_FORM_CONTROLLER_DEFINITION,
8
8
  renderController: ({ address, instanceKey }) => createElement(PhiRuntimeFormControllerMount, {
9
9
  address,
@@ -1,11 +1,4 @@
1
1
  import type { PhiFormFieldProviderProps } from "./form-provider-registry";
2
- /**
3
- * What the Form value is: the Media Asset ids the finished uploads left behind.
4
- *
5
- * Exported because a handler and a test read the same shape, and because the one thing a caller must not
6
- * do is guess it from a sample payload.
7
- */
8
- export declare function readPhiFormUploadAssetIds(value: unknown): readonly number[];
9
2
  /**
10
3
  * The shared upload field Control: attach a file, watch it arrive, take it back out again.
11
4
  *
@@ -22,7 +22,7 @@ const MEDIA_KINDS = new Set(Object.values(PhiMediaKind));
22
22
  * Exported because a handler and a test read the same shape, and because the one thing a caller must not
23
23
  * do is guess it from a sample payload.
24
24
  */
25
- export function readPhiFormUploadAssetIds(value) {
25
+ function readPhiFormUploadAssetIds(value) {
26
26
  if (!Array.isArray(value)) {
27
27
  return [];
28
28
  }
@@ -17,6 +17,7 @@ import { PhiSurfaceGroundLayer } from "../../surface/phi-surface-ground";
17
17
  import { usePhiLayoutSignalSurface } from "../phi-layout-signal-surface";
18
18
  import { PhiSurfaceTone } from "../../surface/phi-surface-tone";
19
19
  import { resolvePhiSurfaceToneClassName } from "../../../types/surface";
20
+ import { joinPhiClassNames } from "../../../helpers/class-names";
20
21
  function isRenderableSlotChild(child) {
21
22
  return child !== null && child !== undefined && child !== false;
22
23
  }
@@ -402,7 +403,7 @@ function PhiCollapsibleLayoutBody({ blockId, slots, slotKeys, slotMeta, panelMin
402
403
  };
403
404
  })
404
405
  .filter((item) => item !== null);
405
- return (_jsx(PhiSurfaceTone, { tone: surface?.tone, children: _jsxs("div", { "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: ["phi-layout", resolvePhiSurfaceToneClassName(surface?.tone)].filter(Boolean).join(" "), style: resolvedStyle, children: [_jsx(PhiSurfaceGroundLayer, { ground: ground }), _jsx("div", {
406
+ return (_jsx(PhiSurfaceTone, { tone: surface?.tone, children: _jsxs("div", { "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: joinPhiClassNames("phi-layout", resolvePhiSurfaceToneClassName(surface?.tone)), style: resolvedStyle, children: [_jsx(PhiSurfaceGroundLayer, { ground: ground }), _jsx("div", {
406
407
  /*
407
408
  * The grounds inside follow the corner outside.
408
409
  *
@@ -12,6 +12,7 @@ import { PhiIcon } from "../../shell/phi-icon";
12
12
  import { PhiSurfaceGroundLayer } from "../../surface/phi-surface-ground";
13
13
  import { PhiSurfaceTone } from "../../surface/phi-surface-tone";
14
14
  import { resolvePhiSurfaceToneClassName } from "../../../types/surface";
15
+ import { joinPhiClassNames } from "../../../helpers/class-names";
15
16
  export function PhiSequenceSlotEditor({ slots, slotKeys, slotLabels, slotCount, activeIndex, onActiveIndexChange, slotNoun, layoutKind, renderMode, authoring, chrome, editSlotAction, editRenderInsertControl, editSlotAnchor = "center", style, }) {
16
17
  const isAuthoringRender = isPhiLayoutAuthoringRender({ ...authoring, renderMode });
17
18
  const editableSlotCount = Math.max(slotCount, 1);
@@ -24,7 +25,7 @@ export function PhiSequenceSlotEditor({ slots, slotKeys, slotLabels, slotCount,
24
25
  const hasNextSlot = currentIndex < editableSlotCount - 1;
25
26
  const { style: resolvedLayoutStyle, ground, hasExplicitLayoutBackground, } = resolvePhiBaseLayoutChrome(chrome);
26
27
  const resolvedLayoutInset = resolvePhiLayoutInset(chrome);
27
- return (_jsx(PhiSurfaceTone, { tone: chrome.surface?.tone, children: _jsxs("div", { "data-layout-kind": layoutKind, "data-phi-block-render-mode": renderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: ["phi-layout", resolvePhiSurfaceToneClassName(chrome.surface?.tone)].filter(Boolean).join(" "), style: {
28
+ return (_jsx(PhiSurfaceTone, { tone: chrome.surface?.tone, children: _jsxs("div", { "data-layout-kind": layoutKind, "data-phi-block-render-mode": renderMode, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: joinPhiClassNames("phi-layout", resolvePhiSurfaceToneClassName(chrome.surface?.tone)), style: {
28
29
  position: "relative",
29
30
  display: "flex",
30
31
  flexDirection: "column",
@@ -7,6 +7,7 @@ import { resolvePhiSplitCardGroundFrame } from "../split-card-geometry";
7
7
  import { PhiSurfaceTone } from "../../surface/phi-surface-tone";
8
8
  import { PHI_LAYOUT_SURFACE_RADIUS } from "../phi-layout-contract";
9
9
  import { usePhiLayoutSignalSurface } from "../phi-layout-signal-surface";
10
+ import { joinPhiClassNames } from "../../../helpers/class-names";
10
11
  /**
11
12
  * One of the Split Card's two cards.
12
13
  *
@@ -29,5 +30,5 @@ export function PhiSplitCardHalf({ blockId, surface, side, gap, swapped, style,
29
30
  forceGroundLayer: true,
30
31
  });
31
32
  const toneClassName = resolvePhiSurfaceToneClassName(still?.tone);
32
- return (_jsxs("div", { ...attributes, className: [className, toneClassName].filter(Boolean).join(" ") || undefined, style: { ...card.style, ...style }, children: [_jsx(PhiSurfaceGroundLayer, { ground: card.ground, frame: resolvePhiSplitCardGroundFrame(side, gap, swapped) }), toneClassName ? _jsx(PhiSurfaceTone, { tone: still?.tone, children: children }) : children] }));
33
+ return (_jsxs("div", { ...attributes, className: joinPhiClassNames(className, toneClassName), style: { ...card.style, ...style }, children: [_jsx(PhiSurfaceGroundLayer, { ground: card.ground, frame: resolvePhiSplitCardGroundFrame(side, gap, swapped) }), toneClassName ? _jsx(PhiSurfaceTone, { tone: still?.tone, children: children }) : children] }));
33
34
  }
@@ -4,6 +4,7 @@ import { resolvePhiLayoutBoxStyle } from "./phi-layout-contract";
4
4
  import { resolvePhiBaseLayoutSlotStates, resolvePhiBaseLayoutChrome, } from "./phi-layout-view-model";
5
5
  import { isPhiLayoutAuthoringRender, phiLayoutDebugLayerMarker, } from "../../helpers/layout-authoring-markers";
6
6
  import { PhiLayoutSurfaceBox } from "./phi-layout-surface-box";
7
+ import { joinPhiClassNames } from "../../helpers/class-names";
7
8
  function resolvePhiRenderableBlockStyleValue(value) {
8
9
  return value == null || value === 0 || value === "0" || value === "0px" ? undefined : value;
9
10
  }
@@ -94,5 +95,5 @@ export function PhiBaseLayout({ slots, editSlotLabels, layoutKind, labelEnd, pad
94
95
  overflow: resolvedVisibility === "collapsed" ? "hidden" : undefined,
95
96
  ...style,
96
97
  };
97
- return (_jsxs(PhiLayoutSurfaceBox, { blockId: blockId, surface: surface, ground: ground, "data-phi-block-id": blockId ?? undefined, "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-block-visibility": resolvedVisibility, "data-phi-block-enabled": resolvedEnabled ? "true" : "false", "data-phi-block-selectable": capabilities?.selectable ? "true" : undefined, "data-phi-block-draggable": capabilities?.draggable ? "true" : undefined, "data-phi-block-hoverable": capabilities?.hoverable ? "true" : undefined, "data-phi-block-activatable": capabilities?.activatable ? "true" : undefined, "data-phi-block-focusable": capabilities?.focusable ? "true" : undefined, "data-phi-block-droppable": capabilities?.droppable ? "true" : undefined, "data-phi-block-selected": runtime?.selected ? "true" : undefined, "data-phi-block-hovered": runtime?.hovered ? "true" : undefined, "data-phi-block-dragging": runtime?.dragging ? "true" : undefined, "data-phi-block-focused": runtime?.focused ? "true" : undefined, "data-phi-block-active": runtime?.active ? "true" : undefined, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-debug-scaffold": resolvedDebugMode ? "on" : undefined, "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: ["phi-layout", className].filter(Boolean).join(" "), style: resolvedContainerStyle, children: [underlay, resolvedSlots] }));
98
+ return (_jsxs(PhiLayoutSurfaceBox, { blockId: blockId, surface: surface, ground: ground, "data-phi-block-id": blockId ?? undefined, "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-block-visibility": resolvedVisibility, "data-phi-block-enabled": resolvedEnabled ? "true" : "false", "data-phi-block-selectable": capabilities?.selectable ? "true" : undefined, "data-phi-block-draggable": capabilities?.draggable ? "true" : undefined, "data-phi-block-hoverable": capabilities?.hoverable ? "true" : undefined, "data-phi-block-activatable": capabilities?.activatable ? "true" : undefined, "data-phi-block-focusable": capabilities?.focusable ? "true" : undefined, "data-phi-block-droppable": capabilities?.droppable ? "true" : undefined, "data-phi-block-selected": runtime?.selected ? "true" : undefined, "data-phi-block-hovered": runtime?.hovered ? "true" : undefined, "data-phi-block-dragging": runtime?.dragging ? "true" : undefined, "data-phi-block-focused": runtime?.focused ? "true" : undefined, "data-phi-block-active": runtime?.active ? "true" : undefined, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-debug-scaffold": resolvedDebugMode ? "on" : undefined, "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", className: joinPhiClassNames("phi-layout", className), style: resolvedContainerStyle, children: [underlay, resolvedSlots] }));
98
99
  }
@@ -6,6 +6,7 @@ import { PhiSurfaceTone } from "../surface/phi-surface-tone";
6
6
  import { resolvePhiSurfaceToneClassName } from "../../types/surface";
7
7
  import { PHI_LAYOUT_SURFACE_RADIUS } from "./phi-layout-contract";
8
8
  import { usePhiLayoutSignalSurface } from "./phi-layout-signal-surface";
9
+ import { joinPhiClassNames } from "../../helpers/class-names";
9
10
  /*
10
11
  * Kept where a Signal replaces the Surface: the Layout states them for its topology as well, and a box
11
12
  * that lost its own `position` would let its overlays escape it.
@@ -37,5 +38,5 @@ export function PhiLayoutSurfaceBox({ blockId, surface, ground, style, children,
37
38
  const signalled = usePhiLayoutSignalSurface(blockId, surface);
38
39
  const next = signalled === surface ? { style, ground } : resolvePhiLayoutSignalledSurfaceStyle(style, surface, signalled);
39
40
  const toneClassName = resolvePhiSurfaceToneClassName(signalled?.tone);
40
- return (_jsxs("div", { ...attributes, className: [attributes.className, toneClassName].filter(Boolean).join(" ") || undefined, style: next.style, children: [_jsx(PhiSurfaceGroundLayer, { ground: next.ground }), toneClassName ? _jsx(PhiSurfaceTone, { tone: signalled?.tone, children: children }) : children] }));
41
+ return (_jsxs("div", { ...attributes, className: joinPhiClassNames(attributes.className, toneClassName), style: next.style, children: [_jsx(PhiSurfaceGroundLayer, { ground: next.ground }), toneClassName ? _jsx(PhiSurfaceTone, { tone: signalled?.tone, children: children }) : children] }));
41
42
  }
@@ -3,17 +3,9 @@ import { getPhiSearchWidgetLabels } from "../widgets/label-sets/search";
3
3
  import { getPhiMediaWidgetLabels } from "./label-sets/media";
4
4
  import { PhiCmsWidgetType } from "../../constants/cms-widget-types";
5
5
  import { PhiRuntimeModuleRenderClientHost } from "../runtime/runtime-module-render-client-manifest";
6
- import { readPhiServerApiCredentials } from "../../helpers/phis-server-credentials";
6
+ import { buildPhiWidgetLabelTranslatorOptions } from "../widgets/label-sets/runtime-options";
7
7
  export async function PhiMediaPickerWidgetServer({ runtime, config, }) {
8
- const labels = await getPhiMediaWidgetLabels({
9
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
10
- internalToken: readPhiServerApiCredentials().internalToken,
11
- locale: runtime.locale.current,
12
- });
13
- const searchLabels = await getPhiSearchWidgetLabels({
14
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
15
- internalToken: readPhiServerApiCredentials().internalToken,
16
- locale: runtime.locale.current,
17
- });
8
+ const labels = await getPhiMediaWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
9
+ const searchLabels = await getPhiSearchWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
18
10
  return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.MediaPicker, componentProps: { labels, searchLabels, config } }));
19
11
  }
@@ -1,15 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useSyncExternalStore } from "react";
4
3
  import { decodePhiProtectedMail, isPhiProtectedMail } from "../../helpers/protected-mail";
5
- const subscribeNever = () => () => { };
6
- /**
7
- * Whether this render runs in a hydrated browser. False on the server and during hydration -- the HTML a
8
- * crawler reads -- and true in the render that follows.
9
- */
10
- function usePhiHydrated() {
11
- return useSyncExternalStore(subscribeNever, () => true, () => false);
12
- }
4
+ import { usePhiHydrated } from "../state/use-phi-hydrated";
13
5
  /**
14
6
  * The href a link may show: a protected address only once the page is hydrated, everything else at once.
15
7
  *
@@ -1,9 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { createContext, useContext } from "react";
3
+ import { createContext, useContext, useMemo } from "react";
4
4
  const PhiSiderContext = createContext(null);
5
5
  export function PhiSiderContextProvider({ value, children, }) {
6
- return _jsx(PhiSiderContext.Provider, { value: value, children: children });
6
+ // One object while its two fields hold, whatever object the caller wrote: the readers render for a change, not for a render.
7
+ const held = useMemo(() => ({ collapsed: value.collapsed, collapsedWidth: value.collapsedWidth }), [value.collapsed, value.collapsedWidth]);
8
+ return _jsx(PhiSiderContext.Provider, { value: held, children: children });
7
9
  }
8
10
  export function usePhiSiderContext() {
9
11
  return useContext(PhiSiderContext);
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { ConfigProvider as AntdConfigProvider, theme as antdTheme, } from "antd";
4
4
  import { createContext, useContext, useEffect, useMemo, } from "react";
5
5
  import { buildPhiControlShapeCssVars, PHI_SURFACE_SHAPE_CSS_VAR, resolvePhiSurfaceShapeRadius, } from "../../theme/phi-control-shape";
6
+ import { joinPhiClassNames } from "../../helpers/class-names";
6
7
  const PhiConfigContext = createContext(null);
7
8
  function PhiConfigValueProvider({ children, customColors, fonts, fontFamilies, heroHeight, mode, controlShape, presets, rootClassName, rootStyle, themeCssVarKey, }) {
8
9
  const { token, cssVar } = antdTheme.useToken();
@@ -63,7 +64,7 @@ function PhiConfigValueProvider({ children, customColors, fonts, fontFamilies, h
63
64
  presets,
64
65
  token,
65
66
  }), [controlShape, customColors, fonts, fontFamilies, heroHeight, mode, presets, token]);
66
- return (_jsx(PhiConfigContext.Provider, { value: value, children: _jsx("div", { className: [themeCssVarKey, rootClassName].filter(Boolean).join(" "), style: {
67
+ return (_jsx(PhiConfigContext.Provider, { value: value, children: _jsx("div", { className: joinPhiClassNames(themeCssVarKey, rootClassName), style: {
67
68
  ...rootStyle,
68
69
  ...controlShapeVars,
69
70
  fontSize: cssVar.fontSize,
@@ -5,8 +5,11 @@ import type { ReactNode } from "react";
5
5
  * Both sit in this one Client reference because the root layout is under every route, and each Client
6
6
  * reference it reaches is paid for by every page (`validate-area-client-reach.mjs`).
7
7
  */
8
- export declare function PhiDayjsLocale({ locale, intlLocale, children, }: {
8
+ export declare function PhiDayjsLocale({ locale, intlLocale, timeZone, renderedAt, children, }: {
9
9
  locale?: string | null;
10
10
  intlLocale: string;
11
+ /** The Site's time zone and the moment of this render (components/root/phi-intl-locale.tsx). */
12
+ timeZone: string;
13
+ renderedAt: number;
11
14
  children: ReactNode;
12
15
  }): import("react").JSX.Element;