@phis/ui 0.6.4 → 0.6.5

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 (164) hide show
  1. package/components/cms/phi-cms-layout-renderer.js +11 -2
  2. package/components/controls/phi-multi-select-control.js +4 -2
  3. package/components/controls/phi-options-provider.d.ts +1 -0
  4. package/components/controls/phi-options-provider.js +1 -0
  5. package/components/controls/phi-select-control.d.ts +21 -0
  6. package/components/controls/phi-select-control.js +2 -2
  7. package/components/controls/phi-status-dot-control.d.ts +15 -0
  8. package/components/controls/phi-status-dot-control.js +25 -0
  9. package/components/controls/phi-table-control.js +8 -1
  10. package/components/controls/phi-tree-control.js +5 -4
  11. package/components/controls/phi-tree-select-control.js +1 -0
  12. package/components/layouts/clients/phi-split-card-half.d.ts +4 -1
  13. package/components/layouts/clients/phi-split-card-half.js +2 -2
  14. package/components/layouts/clients/phi-split-card-layout-client.d.ts +6 -3
  15. package/components/layouts/clients/phi-split-card-layout-client.js +5 -3
  16. package/components/layouts/clients/phi-three-column-layout-client.d.ts +20 -1
  17. package/components/layouts/clients/phi-three-column-layout-client.js +31 -15
  18. package/components/layouts/layout-definitions.d.ts +96 -0
  19. package/components/layouts/layout-definitions.js +40 -2
  20. package/components/layouts/plugins/split-card-layout-plugin.js +1 -1
  21. package/components/layouts/plugins/three-column-layout-plugin.js +1 -1
  22. package/components/layouts/split-card-geometry.d.ts +9 -4
  23. package/components/layouts/split-card-geometry.js +29 -13
  24. package/components/media/media-folder-options.d.ts +10 -0
  25. package/components/media/media-folder-options.js +14 -0
  26. package/components/shell/phi-antd-icon.d.ts +1 -0
  27. package/components/shell/phi-antd-icon.js +3 -0
  28. package/components/widgets/inspector-field-row.js +4 -1
  29. package/components/widgets/label-sets/admin-users.d.ts +3 -0
  30. package/components/widgets/label-sets/admin-users.js +8 -2
  31. package/components/widgets/label-sets/gallery.js +2 -2
  32. package/components/widgets/label-sets/inspector.js +4 -0
  33. package/components/widgets/label-sets/observability-logs.js +2 -2
  34. package/components/widgets/label-sets/profile.js +2 -1
  35. package/components/widgets/label-types/gallery.d.ts +2 -3
  36. package/components/widgets/label-types/gallery.js +1 -4
  37. package/components/widgets/label-types/inspector.d.ts +4 -0
  38. package/components/widgets/label-types/inspector.js +2 -0
  39. package/components/widgets/shared/markdown-image-vocabulary.js +1 -1
  40. package/constants/cms-layout-proportions.d.ts +6 -0
  41. package/constants/cms-layout-proportions.js +17 -0
  42. package/constants/runtime-module-ownership.js +1 -0
  43. package/helpers/page-reference-tree.js +8 -0
  44. package/helpers/table-action-links.d.ts +11 -0
  45. package/helpers/table-action-links.js +14 -0
  46. package/helpers/table-action-row-link.d.ts +8 -0
  47. package/helpers/table-action-row-link.js +14 -0
  48. package/package.json +2 -2
  49. package/plugins/factories/widget-renderers.d.ts +7 -1
  50. package/plugins/factories/widget-renderers.js +12 -2
  51. package/plugins/runtime-modules/asset/authoring-widgets.js +2 -2
  52. package/plugins/runtime-modules/asset/data-providers.js +1 -1
  53. package/plugins/runtime-modules/asset/services/options.js +7 -11
  54. package/plugins/runtime-modules/asset/widgets/area-upload/plugin.js +0 -2
  55. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/plugin.js +0 -2
  56. package/plugins/runtime-modules/asset/widgets/image-inspector/plugin.js +0 -2
  57. package/plugins/runtime-modules/asset/widgets/media-picker/plugin.js +0 -2
  58. package/plugins/runtime-modules/asset/widgets.js +4 -4
  59. package/plugins/runtime-modules/auth/authoring-widgets.js +4 -8
  60. package/plugins/runtime-modules/auth/widgets/auth-workflow/plugin.js +0 -6
  61. package/plugins/runtime-modules/auth/widgets/logout/plugin.js +0 -2
  62. package/plugins/runtime-modules/auth/widgets/security/plugin.js +0 -2
  63. package/plugins/runtime-modules/auth/widgets.js +5 -3
  64. package/plugins/runtime-modules/avatar/authoring-widgets.js +2 -2
  65. package/plugins/runtime-modules/avatar/widgets/account-avatar/plugin.js +0 -2
  66. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/plugin.js +0 -2
  67. package/plugins/runtime-modules/avatar/widgets.js +2 -2
  68. package/plugins/runtime-modules/builder/authoring-widgets.js +1 -1
  69. package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.d.ts +28 -0
  70. package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.js +98 -0
  71. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +27 -3
  72. package/plugins/runtime-modules/builder/clients/inspector-record-field-options.d.ts +17 -0
  73. package/plugins/runtime-modules/builder/clients/inspector-record-field-options.js +21 -0
  74. package/plugins/runtime-modules/builder/clients/inspector-translate-switch.d.ts +24 -0
  75. package/plugins/runtime-modules/builder/clients/inspector-translate-switch.js +29 -0
  76. package/plugins/runtime-modules/builder/clients/layout-inspector.d.ts +1 -1
  77. package/plugins/runtime-modules/builder/clients/layout-inspector.js +4 -2
  78. package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +1 -1
  79. package/plugins/runtime-modules/builder/clients/widget-inspector.js +6 -6
  80. package/plugins/runtime-modules/builder/plugin-meta-labels.js +17 -0
  81. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +12 -2
  82. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +0 -2
  83. package/plugins/runtime-modules/builder/widgets.js +3 -3
  84. package/plugins/runtime-modules/contracts.js +8 -4
  85. package/plugins/runtime-modules/core/authoring-widgets.js +2 -2
  86. package/plugins/runtime-modules/core/data-providers.d.ts +7 -3
  87. package/plugins/runtime-modules/core/data-providers.js +11 -1
  88. package/plugins/runtime-modules/core/definition.d.ts +7 -3
  89. package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +1 -1
  90. package/plugins/runtime-modules/core/widgets/draft-status/client.d.ts +2 -1
  91. package/plugins/runtime-modules/core/widgets/draft-status/client.js +4 -3
  92. package/plugins/runtime-modules/core/widgets/gallery/authoring.js +6 -8
  93. package/plugins/runtime-modules/core/widgets/gallery/client.js +4 -0
  94. package/plugins/runtime-modules/core/widgets/gallery/config.js +1 -1
  95. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -1
  96. package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -4
  97. package/plugins/runtime-modules/core/widgets/image/config.js +1 -1
  98. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +11 -0
  99. package/plugins/runtime-modules/core/widgets/markdown/config.js +24 -22
  100. package/plugins/runtime-modules/core/widgets/simple-text/client.d.ts +9 -5
  101. package/plugins/runtime-modules/core/widgets/simple-text/client.js +5 -7
  102. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +63 -4
  103. package/plugins/runtime-modules/core/widgets/simple-text/config.js +45 -11
  104. package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
  105. package/plugins/runtime-modules/core/widgets/simple-text/plugin.d.ts +13 -0
  106. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +23 -4
  107. package/plugins/runtime-modules/core/widgets/simple-text/server.d.ts +4 -2
  108. package/plugins/runtime-modules/core/widgets/simple-text/server.js +7 -6
  109. package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
  110. package/plugins/runtime-modules/core/widgets/table/config.js +11 -3
  111. package/plugins/runtime-modules/core/widgets/table/plugin.js +21 -1
  112. package/plugins/runtime-modules/core/widgets/thread-conversation/plugin.js +0 -2
  113. package/plugins/runtime-modules/core/widgets/tree/config.js +2 -1
  114. package/plugins/runtime-modules/core/widgets/tree/plugin.js +16 -1
  115. package/plugins/runtime-modules/core/widgets.js +1 -1
  116. package/plugins/runtime-modules/observability/data-providers.js +1 -1
  117. package/plugins/runtime-modules/theme/authoring-widgets.js +5 -5
  118. package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +0 -5
  119. package/plugins/runtime-modules/theme/widgets.js +4 -4
  120. package/plugins/runtime-modules/user-management/addon-roles.d.ts +28 -7
  121. package/plugins/runtime-modules/user-management/addon-roles.js +42 -17
  122. package/plugins/runtime-modules/user-management/client-data-providers.js +6 -0
  123. package/plugins/runtime-modules/user-management/data-providers.js +11 -2
  124. package/plugins/runtime-modules/user-management/forms.js +40 -1
  125. package/plugins/runtime-modules/user-management/ids.d.ts +1 -0
  126. package/plugins/runtime-modules/user-management/ids.js +1 -0
  127. package/plugins/runtime-modules/user-management/services/options.d.ts +14 -3
  128. package/plugins/runtime-modules/user-management/services/options.js +52 -16
  129. package/plugins/runtime-modules/user-management/services/table.js +8 -24
  130. package/plugins/runtime-modules/user-management/services/users-query.d.ts +9 -0
  131. package/plugins/runtime-modules/user-management/services/users-query.js +29 -0
  132. package/plugins/runtime-modules/video/widgets/embed/plugin.js +0 -2
  133. package/plugins/runtime-modules/video/widgets.js +1 -1
  134. package/styles/layout.css +4 -4
  135. package/types/cms-config.d.ts +12 -4
  136. package/types/cms-config.js +3 -0
  137. package/types/cms-plugins.d.ts +26 -4
  138. package/types/core-widget-placements.d.ts +4 -4
  139. package/types/table-widget.d.ts +17 -1
  140. package/types/tree.d.ts +2 -0
  141. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.d.ts +0 -2
  142. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.js +0 -6
  143. package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.d.ts +0 -2
  144. package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +0 -6
  145. package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.d.ts +0 -7
  146. package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.js +0 -12
  147. package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.d.ts +0 -7
  148. package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.js +0 -12
  149. package/plugins/runtime-modules/auth/widgets/logout/authoring.d.ts +0 -3
  150. package/plugins/runtime-modules/auth/widgets/logout/authoring.js +0 -8
  151. package/plugins/runtime-modules/auth/widgets/security/authoring.d.ts +0 -3
  152. package/plugins/runtime-modules/auth/widgets/security/authoring.js +0 -8
  153. package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.d.ts +0 -2
  154. package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.js +0 -6
  155. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.d.ts +0 -2
  156. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.js +0 -6
  157. package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.d.ts +0 -22
  158. package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.js +0 -8
  159. package/plugins/runtime-modules/core/widgets/form-preview/authoring.d.ts +0 -10
  160. package/plugins/runtime-modules/core/widgets/form-preview/authoring.js +0 -15
  161. package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.d.ts +0 -3
  162. package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.js +0 -9
  163. package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.d.ts +0 -76
  164. package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.js +0 -30
@@ -65,7 +65,7 @@ export const PHI_ASSET_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
65
65
  executionMode: "live",
66
66
  authoringMode: "none",
67
67
  title: "Media folder choices",
68
- description: "Every folder of the Site's media, by its path, for a setting that names one.",
68
+ description: "Every folder of the Site's media, under the folder it stands in, for a setting that names one.",
69
69
  // Named in a record binding's parameters, which the Builder edits on any page.
70
70
  availableToAuthoringChrome: true,
71
71
  },
@@ -5,7 +5,7 @@ import { PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
5
5
  import { readPhiMediaFolders } from "../../../../components/media/phi-image-preview-data";
6
6
  import { PHI_ASSET_CONTROLLER_STORE_KEY } from "../../../../components/media/asset-controller-signals";
7
7
  import { phiImagePreviewStore } from "../../../../components/media/phi-image-preview-store";
8
- import { buildPhiMediaFolderCascaderOptions, buildPhiMediaFolderNamesById, buildPhiMediaFolderValueById, } from "../../../../components/media/media-folder-options";
8
+ import { buildPhiMediaFolderCascaderOptions, buildPhiMediaFolderChoiceOptions, buildPhiMediaFolderNamesById, buildPhiMediaFolderValueById, } from "../../../../components/media/media-folder-options";
9
9
  import { isPhiMediaFolderLocked } from "../../../../components/media/media-folder-lock";
10
10
  export const PhiMediaFoldersOptionsProviderClient = createPhiControlOptionsProviderClient({
11
11
  key: PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS.mediaFolders,
@@ -62,10 +62,11 @@ export const PhiMediaFoldersOptionsProviderClient = createPhiControlOptionsProvi
62
62
  },
63
63
  });
64
64
  /**
65
- * Every Folder of the Site Space, by its path, for a setting that names one on a page that is not the
66
- * Media page. `PhiMediaFoldersOptionsProviderClient` reads the library's store, which only the Media
67
- * page fills; this asks the folders route itself and keeps the whole list, because the list is small
68
- * and a Gallery's author reads it once.
65
+ * Every Folder of the Site Space by its id, each under the Folder it stands in (`parentValue`), for a
66
+ * setting that names one on a page that is not the Media page -- a cascader shows the tree.
67
+ * `PhiMediaFoldersOptionsProviderClient` reads the library's store, which only the Media page fills;
68
+ * this asks the folders route itself and keeps the whole list, because the list is small and a
69
+ * Gallery's author reads it once.
69
70
  */
70
71
  const FOLDERS_PATH = "/api/site/media/folders";
71
72
  async function loadFolders() {
@@ -85,12 +86,7 @@ export const PhiMediaFolderChoicesOptionsProviderClient = createPhiControlOption
85
86
  resolveLoadKey: () => "site-media-folders",
86
87
  resolve: (context) => {
87
88
  const folders = Array.isArray(context.asyncData) ? context.asyncData : [];
88
- const pathOf = (folderId) => buildPhiMediaFolderNamesById(folders, folderId).join(" / ");
89
- return {
90
- options: [...folders]
91
- .sort((left, right) => pathOf(left.id).localeCompare(pathOf(right.id)))
92
- .map((folder) => ({ value: String(folder.id), label: pathOf(folder.id) })),
93
- };
89
+ return { options: buildPhiMediaFolderChoiceOptions(folders) };
94
90
  },
95
91
  });
96
92
  const STORAGE_SETTINGS_PATH = "/api/site/admin/media/storage";
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
3
2
  import { PhiAreaUploadWidgetServer } from "./server";
4
3
  import { PHI_AREA_UPLOAD_WIDGET_DEFINITION } from "./config";
5
4
  export const PHI_AREA_UPLOAD_WIDGET_PLUGIN = {
6
5
  ...PHI_AREA_UPLOAD_WIDGET_DEFINITION,
7
6
  render: ({ widget, runtime, config }) => (_jsx(PhiAreaUploadWidgetServer, { runtime: runtime, config: config }, `widget-${widget.id}`)),
8
- renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
9
7
  };
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
3
2
  import { PhiAssetFocalRectWidgetServer } from "./server";
4
3
  import { PHI_ASSET_FOCAL_RECT_WIDGET_DEFINITION, } from "./config";
5
4
  export const PHI_ASSET_FOCAL_RECT_WIDGET_PLUGIN = {
6
5
  ...PHI_ASSET_FOCAL_RECT_WIDGET_DEFINITION,
7
6
  render: ({ widget, runtime, config }) => (_jsx(PhiAssetFocalRectWidgetServer, { runtime: runtime, config: config }, `widget-${widget.id}`)),
8
- renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
9
7
  };
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
3
2
  import { PhiAssetConfigWidgetServer } from "./server";
4
3
  import { PHI_IMAGE_INSPECTOR_WIDGET_DEFINITION, } from "./config";
5
4
  export const PHI_IMAGE_INSPECTOR_WIDGET_PLUGIN = {
6
5
  ...PHI_IMAGE_INSPECTOR_WIDGET_DEFINITION,
7
6
  render: ({ widget, runtime, config }) => (_jsx(PhiAssetConfigWidgetServer, { runtime: runtime, config: config }, `widget-${widget.id}`)),
8
- renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
9
7
  };
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
3
2
  import { PhiMediaPickerWidgetServer } from "../../../../../components/media/phi-media-picker-server";
4
3
  import { PHI_MEDIA_PICKER_WIDGET_DEFINITION } from "./config";
5
4
  export const PHI_MEDIA_PICKER_WIDGET_PLUGIN = {
6
5
  ...PHI_MEDIA_PICKER_WIDGET_DEFINITION,
7
6
  render: ({ widget, runtime, config }) => (_jsx(PhiMediaPickerWidgetServer, { runtime: runtime, config: config }, `widget-${widget.id}`)),
8
- renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
9
7
  };
@@ -8,28 +8,28 @@ export const PHI_RUNTIME_MODULE_WIDGETS = [
8
8
  definePhiFirstPartyWidget({
9
9
  definition: PHI_AREA_UPLOAD_WIDGET_DEFINITION,
10
10
  ownerModuleId: PHI_ASSET_RUNTIME_MODULE_ID,
11
- renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
11
+ renderPolicies: { "runtime": "custom", "preview": "visualPlaceholder", "authoring": "custom" },
12
12
  loadRuntime: () => import("./widgets/area-upload/plugin").then((module) => module.PHI_AREA_UPLOAD_WIDGET_PLUGIN),
13
13
  loadPreview: () => import("./widgets/area-upload/plugin").then((module) => module.PHI_AREA_UPLOAD_WIDGET_PLUGIN),
14
14
  }),
15
15
  definePhiFirstPartyWidget({
16
16
  definition: PHI_IMAGE_INSPECTOR_WIDGET_DEFINITION,
17
17
  ownerModuleId: PHI_ASSET_RUNTIME_MODULE_ID,
18
- renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
18
+ renderPolicies: { "runtime": "custom", "preview": "visualPlaceholder", "authoring": "custom" },
19
19
  loadRuntime: () => import("./widgets/image-inspector/plugin").then((module) => module.PHI_IMAGE_INSPECTOR_WIDGET_PLUGIN),
20
20
  loadPreview: () => import("./widgets/image-inspector/plugin").then((module) => module.PHI_IMAGE_INSPECTOR_WIDGET_PLUGIN),
21
21
  }),
22
22
  definePhiFirstPartyWidget({
23
23
  definition: PHI_ASSET_FOCAL_RECT_WIDGET_DEFINITION,
24
24
  ownerModuleId: PHI_ASSET_RUNTIME_MODULE_ID,
25
- renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
25
+ renderPolicies: { "runtime": "custom", "preview": "visualPlaceholder", "authoring": "custom" },
26
26
  loadRuntime: () => import("./widgets/asset-focal-rect/plugin").then((module) => module.PHI_ASSET_FOCAL_RECT_WIDGET_PLUGIN),
27
27
  loadPreview: () => import("./widgets/asset-focal-rect/plugin").then((module) => module.PHI_ASSET_FOCAL_RECT_WIDGET_PLUGIN),
28
28
  }),
29
29
  definePhiFirstPartyWidget({
30
30
  definition: PHI_MEDIA_PICKER_WIDGET_DEFINITION,
31
31
  ownerModuleId: PHI_ASSET_RUNTIME_MODULE_ID,
32
- renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
32
+ renderPolicies: { "runtime": "custom", "preview": "visualPlaceholder", "authoring": "custom" },
33
33
  loadRuntime: () => import("./widgets/media-picker/plugin").then((module) => module.PHI_MEDIA_PICKER_WIDGET_PLUGIN),
34
34
  loadPreview: () => import("./widgets/media-picker/plugin").then((module) => module.PHI_MEDIA_PICKER_WIDGET_PLUGIN),
35
35
  }),
@@ -5,12 +5,8 @@ import { PHI_AUTH_WORKFLOW_WIDGET_DEFINITION } from "./widgets/auth-workflow/con
5
5
  import { PHI_AUTH_METHODS_WIDGET_DEFINITION } from "./widgets/auth-methods/config";
6
6
  import { createPhiAuthoringWidgetModule, definePhiAuthoringWidgetModuleLoader, } from "../client-authoring-widget-module";
7
7
  export default createPhiAuthoringWidgetModule([
8
- definePhiAuthoringWidgetModuleLoader(PHI_AUTH_LOGOUT_WIDGET_DEFINITION, () => import("./widgets/logout/authoring")
9
- .then((module) => module.PHI_AUTH_LOGOUT_WIDGET_BUILDER_PLUGIN)),
10
- definePhiAuthoringWidgetModuleLoader(PHI_AUTH_SECURITY_WIDGET_DEFINITION, () => import("./widgets/security/authoring")
11
- .then((module) => module.PHI_AUTH_SECURITY_WIDGET_BUILDER_PLUGIN)),
12
- definePhiAuthoringWidgetModuleLoader(PHI_AUTH_WORKFLOW_WIDGET_DEFINITION, () => import("./widgets/auth-workflow/authoring")
13
- .then((module) => module.PHI_AUTH_WORKFLOW_WIDGET_BUILDER_PLUGIN)),
14
- definePhiAuthoringWidgetModuleLoader(PHI_AUTH_METHODS_WIDGET_DEFINITION, () => import("./widgets/auth-methods/authoring")
15
- .then((module) => module.PHI_AUTH_METHODS_WIDGET_BUILDER_PLUGIN)),
8
+ definePhiAuthoringWidgetModuleLoader(PHI_AUTH_LOGOUT_WIDGET_DEFINITION, () => Promise.resolve(PHI_AUTH_LOGOUT_WIDGET_DEFINITION)),
9
+ definePhiAuthoringWidgetModuleLoader(PHI_AUTH_SECURITY_WIDGET_DEFINITION, () => Promise.resolve(PHI_AUTH_SECURITY_WIDGET_DEFINITION)),
10
+ definePhiAuthoringWidgetModuleLoader(PHI_AUTH_WORKFLOW_WIDGET_DEFINITION, () => Promise.resolve(PHI_AUTH_WORKFLOW_WIDGET_DEFINITION)),
11
+ definePhiAuthoringWidgetModuleLoader(PHI_AUTH_METHODS_WIDGET_DEFINITION, () => Promise.resolve(PHI_AUTH_METHODS_WIDGET_DEFINITION)),
16
12
  ]);
@@ -1,13 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
3
2
  import { PHI_AUTH_WORKFLOW_WIDGET_DEFINITION, } from "./config";
4
3
  import { PhiAuthWorkflowWidget } from "./server";
5
4
  export const PHI_AUTH_WORKFLOW_WIDGET_PLUGIN = {
6
5
  ...PHI_AUTH_WORKFLOW_WIDGET_DEFINITION,
7
6
  render: ({ runtime, config }) => (_jsx(PhiAuthWorkflowWidget, { runtime: runtime, signalRoutes: config.signalRoutes })),
8
- /*
9
- * A placeholder rather than the real body, as the account security Widget does: drawing it would start
10
- * an enrolment against Core from inside the Builder.
11
- */
12
- renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
13
7
  };
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
3
2
  import { PHI_AUTH_LOGOUT_WIDGET_DEFINITION } from "./config";
4
3
  import { PhiAuthLogoutWidget } from "./server";
5
4
  export const PHI_AUTH_LOGOUT_WIDGET_PLUGIN = {
6
5
  ...PHI_AUTH_LOGOUT_WIDGET_DEFINITION,
7
6
  render: ({ runtime, config }) => _jsx(PhiAuthLogoutWidget, { runtime: runtime, config: config }),
8
- renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
9
7
  };
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
3
2
  import { PHI_AUTH_SECURITY_WIDGET_DEFINITION } from "./config";
4
3
  import { PhiAuthSecurityWidget } from "./server";
5
4
  export const PHI_AUTH_SECURITY_WIDGET_PLUGIN = {
6
5
  ...PHI_AUTH_SECURITY_WIDGET_DEFINITION,
7
6
  render: ({ runtime, config }) => _jsx(PhiAuthSecurityWidget, { runtime: runtime, config: config }),
8
- renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
9
7
  };
@@ -8,7 +8,7 @@ export const PHI_AUTH_RUNTIME_MODULE_WIDGETS = [
8
8
  definePhiFirstPartyWidget({
9
9
  definition: PHI_AUTH_LOGOUT_WIDGET_DEFINITION,
10
10
  ownerModuleId: PHI_AUTH_RUNTIME_MODULE_ID,
11
- renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
11
+ renderPolicies: { runtime: "custom", preview: "visualPlaceholder", authoring: "custom" },
12
12
  loadRuntime: () => import("./widgets/logout/plugin")
13
13
  .then((module) => module.PHI_AUTH_LOGOUT_WIDGET_PLUGIN),
14
14
  loadPreview: () => import("./widgets/logout/plugin")
@@ -17,7 +17,7 @@ export const PHI_AUTH_RUNTIME_MODULE_WIDGETS = [
17
17
  definePhiFirstPartyWidget({
18
18
  definition: PHI_AUTH_SECURITY_WIDGET_DEFINITION,
19
19
  ownerModuleId: PHI_AUTH_RUNTIME_MODULE_ID,
20
- renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
20
+ renderPolicies: { runtime: "custom", preview: "visualPlaceholder", authoring: "custom" },
21
21
  loadRuntime: () => import("./widgets/security/plugin")
22
22
  .then((module) => module.PHI_AUTH_SECURITY_WIDGET_PLUGIN),
23
23
  loadPreview: () => import("./widgets/security/plugin")
@@ -26,7 +26,9 @@ export const PHI_AUTH_RUNTIME_MODULE_WIDGETS = [
26
26
  definePhiFirstPartyWidget({
27
27
  definition: PHI_AUTH_WORKFLOW_WIDGET_DEFINITION,
28
28
  ownerModuleId: PHI_AUTH_RUNTIME_MODULE_ID,
29
- renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
29
+ // The placeholder rather than the real body, as for account security: drawing it would start an
30
+ // enrolment against Core from inside the Builder.
31
+ renderPolicies: { runtime: "custom", preview: "visualPlaceholder", authoring: "custom" },
30
32
  loadRuntime: () => import("./widgets/auth-workflow/plugin")
31
33
  .then((module) => module.PHI_AUTH_WORKFLOW_WIDGET_PLUGIN),
32
34
  loadPreview: () => import("./widgets/auth-workflow/plugin")
@@ -3,6 +3,6 @@ import { PHI_ACCOUNT_AVATAR_WIDGET_DEFINITION, } from "./widgets/account-avatar/
3
3
  import { PHI_ACCOUNT_AVATAR_PICKER_WIDGET_DEFINITION, } from "./widgets/account-avatar-picker/config";
4
4
  import { createPhiAuthoringWidgetModule, definePhiAuthoringWidgetModuleLoader, } from "../client-authoring-widget-module";
5
5
  export default createPhiAuthoringWidgetModule([
6
- definePhiAuthoringWidgetModuleLoader(PHI_ACCOUNT_AVATAR_WIDGET_DEFINITION, () => import("./widgets/account-avatar/authoring").then((module) => module.PHI_ACCOUNT_AVATAR_WIDGET_BUILDER_PLUGIN)),
7
- definePhiAuthoringWidgetModuleLoader(PHI_ACCOUNT_AVATAR_PICKER_WIDGET_DEFINITION, () => import("./widgets/account-avatar-picker/authoring").then((module) => module.PHI_ACCOUNT_AVATAR_PICKER_WIDGET_BUILDER_PLUGIN)),
6
+ definePhiAuthoringWidgetModuleLoader(PHI_ACCOUNT_AVATAR_WIDGET_DEFINITION, () => Promise.resolve(PHI_ACCOUNT_AVATAR_WIDGET_DEFINITION)),
7
+ definePhiAuthoringWidgetModuleLoader(PHI_ACCOUNT_AVATAR_PICKER_WIDGET_DEFINITION, () => Promise.resolve(PHI_ACCOUNT_AVATAR_PICKER_WIDGET_DEFINITION)),
8
8
  ]);
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
3
2
  import { PHI_ACCOUNT_AVATAR_WIDGET_DEFINITION } from "./config";
4
3
  import { PhiAccountAvatarWidget } from "./server";
5
4
  export const PHI_ACCOUNT_AVATAR_WIDGET_PLUGIN = {
6
5
  ...PHI_ACCOUNT_AVATAR_WIDGET_DEFINITION,
7
6
  render: ({ runtime, config }) => _jsx(PhiAccountAvatarWidget, { runtime: runtime, config: config }),
8
- renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
9
7
  };
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
3
2
  import { PHI_ACCOUNT_AVATAR_PICKER_WIDGET_DEFINITION } from "./config";
4
3
  import { PhiAccountAvatarPickerWidget } from "./server";
5
4
  export const PHI_ACCOUNT_AVATAR_PICKER_WIDGET_PLUGIN = {
6
5
  ...PHI_ACCOUNT_AVATAR_PICKER_WIDGET_DEFINITION,
7
6
  render: ({ runtime, config }) => _jsx(PhiAccountAvatarPickerWidget, { runtime: runtime, config: config }),
8
- renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
9
7
  };
@@ -6,14 +6,14 @@ export const PHI_AVATAR_RUNTIME_MODULE_WIDGETS = [
6
6
  definePhiFirstPartyWidget({
7
7
  definition: PHI_ACCOUNT_AVATAR_WIDGET_DEFINITION,
8
8
  ownerModuleId: PHI_AVATAR_RUNTIME_MODULE_ID,
9
- renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
9
+ renderPolicies: { runtime: "custom", preview: "visualPlaceholder", authoring: "custom" },
10
10
  loadRuntime: () => import("./widgets/account-avatar/plugin").then((module) => module.PHI_ACCOUNT_AVATAR_WIDGET_PLUGIN),
11
11
  loadPreview: () => import("./widgets/account-avatar/plugin").then((module) => module.PHI_ACCOUNT_AVATAR_WIDGET_PLUGIN),
12
12
  }),
13
13
  definePhiFirstPartyWidget({
14
14
  definition: PHI_ACCOUNT_AVATAR_PICKER_WIDGET_DEFINITION,
15
15
  ownerModuleId: PHI_AVATAR_RUNTIME_MODULE_ID,
16
- renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
16
+ renderPolicies: { runtime: "custom", preview: "visualPlaceholder", authoring: "custom" },
17
17
  loadRuntime: () => import("./widgets/account-avatar-picker/plugin").then((module) => module.PHI_ACCOUNT_AVATAR_PICKER_WIDGET_PLUGIN),
18
18
  loadPreview: () => import("./widgets/account-avatar-picker/plugin").then((module) => module.PHI_ACCOUNT_AVATAR_PICKER_WIDGET_PLUGIN),
19
19
  }),
@@ -14,6 +14,6 @@ export default createPhiAuthoringWidgetModule([
14
14
  definePhiAuthoringWidgetModuleLoader(PHI_BUILDER_SHELLS_WORKSPACE_WIDGET_DEFINITION, () => import("./widgets/shells-workspace/authoring").then((module) => module.PHI_BUILDER_SHELLS_WORKSPACE_WIDGET_BUILDER_PLUGIN)),
15
15
  definePhiAuthoringWidgetModuleLoader(PHI_DEVELOPER_BUILDER_PAGES_HEADER_WIDGET_DEFINITION, () => import("./widgets/developer-builder-pages-header/authoring").then((module) => module.PHI_DEVELOPER_BUILDER_PAGES_HEADER_WIDGET_BUILDER_PLUGIN)),
16
16
  definePhiAuthoringWidgetModuleLoader(PHI_HELLO_WORLD_WIDGET_DEFINITION, () => import("./widgets/hello-world/authoring").then((module) => module.PHI_HELLO_WORLD_WIDGET_BUILDER_PLUGIN)),
17
- definePhiAuthoringWidgetModuleLoader(PHI_STRUCTURE_REGION_WIDGET_DEFINITION, () => import("./widgets/structure-region/internal-builder").then((module) => module.PHI_STRUCTURE_REGION_WIDGET_BUILDER_PLUGIN)),
17
+ definePhiAuthoringWidgetModuleLoader(PHI_STRUCTURE_REGION_WIDGET_DEFINITION, () => Promise.resolve(PHI_STRUCTURE_REGION_WIDGET_DEFINITION)),
18
18
  definePhiAuthoringWidgetModuleLoader(PHI_TEST_BLOCK_WIDGET_DEFINITION, () => import("./widgets/test-block/authoring").then((module) => module.PHI_TEST_BLOCK_WIDGET_BUILDER_PLUGIN)),
19
19
  ]);
@@ -0,0 +1,28 @@
1
+ import { type PhiCascaderOption } from "../../../../components/controls/phi-cascader-control";
2
+ import type { PhiControlOption } from "../../../../components/controls/phi-control-options";
3
+ export declare const PHI_INSPECTOR_CHOICE_CASCADER_SEPARATOR = "\u241F";
4
+ export declare const PHI_INSPECTOR_CHOICE_CASCADER_ROOT = "\u241E";
5
+ export type PhiInspectorChoiceCascader = {
6
+ /** The options as the Cascader takes them: each one's path as its value, parents before children. */
7
+ options: PhiCascaderOption[];
8
+ /** The path each option's value stands at. */
9
+ pathByValue: ReadonlyMap<string, string>;
10
+ /** The option behind each path, for writing back what was chosen. */
11
+ optionByPath: ReadonlyMap<string, PhiControlOption>;
12
+ };
13
+ /**
14
+ * The options as a tree, by `parentValue`. An option whose `parentValue` names no option in the list,
15
+ * or whose chain of parents leads back to itself, stands at the top level; the first of two options
16
+ * with the same value is the one offered.
17
+ */
18
+ export declare function buildPhiInspectorChoiceCascader(options: readonly PhiControlOption[]): PhiInspectorChoiceCascader;
19
+ /**
20
+ * What the Cascader is handed as its value: the stored value's path, or the stored value itself where no
21
+ * option has it -- shown as it is, the way a Select shows a value it has no option for.
22
+ */
23
+ export declare function readPhiInspectorChoiceCascaderPath(cascader: PhiInspectorChoiceCascader, value: string | null | undefined): string | undefined;
24
+ /**
25
+ * The value a chosen path writes back: the chosen option's own value. A path that names no option -- a
26
+ * search text, the empty root -- or a disabled option writes nothing.
27
+ */
28
+ export declare function readPhiInspectorChoiceCascaderValue(cascader: PhiInspectorChoiceCascader, path: string): string | null;
@@ -0,0 +1,98 @@
1
+ import { normalizePhiCascaderValue, } from "../../../../components/controls/phi-cascader-control";
2
+ /*
3
+ * A choice field shown as a cascader (`presentation: "cascader"`): the options stand in a hierarchy by
4
+ * their `parentValue`, and `PhiCascaderControl` builds its levels from path values. The paths are this
5
+ * file's own -- the values from the top down, joined -- and never leave it: the field stores the chosen
6
+ * option's `value`, as a Select would.
7
+ *
8
+ * The separator and the root are characters no option value carries, so a value that is itself a path
9
+ * (`/shop/cart`) stays one segment.
10
+ */
11
+ export const PHI_INSPECTOR_CHOICE_CASCADER_SEPARATOR = "␟";
12
+ export const PHI_INSPECTOR_CHOICE_CASCADER_ROOT = "␞";
13
+ function normalizePath(segments) {
14
+ return normalizePhiCascaderValue(segments.join(PHI_INSPECTOR_CHOICE_CASCADER_SEPARATOR), {
15
+ separator: PHI_INSPECTOR_CHOICE_CASCADER_SEPARATOR,
16
+ rootValue: PHI_INSPECTOR_CHOICE_CASCADER_ROOT,
17
+ normalize: "raw",
18
+ });
19
+ }
20
+ /**
21
+ * The options as a tree, by `parentValue`. An option whose `parentValue` names no option in the list,
22
+ * or whose chain of parents leads back to itself, stands at the top level; the first of two options
23
+ * with the same value is the one offered.
24
+ */
25
+ export function buildPhiInspectorChoiceCascader(options) {
26
+ const byValue = new Map();
27
+ for (const option of options) {
28
+ const value = String(option.value);
29
+ if (!byValue.has(value))
30
+ byValue.set(value, option);
31
+ }
32
+ const rawParentOf = (value) => {
33
+ const parentValue = byValue.get(value)?.parentValue;
34
+ if (parentValue == null)
35
+ return null;
36
+ const parent = String(parentValue);
37
+ return byValue.has(parent) ? parent : null;
38
+ };
39
+ // The parent an option keeps: none where following the parents from there comes back to the option.
40
+ const parentOf = new Map();
41
+ for (const value of byValue.keys()) {
42
+ const parent = rawParentOf(value);
43
+ let current = parent;
44
+ const seen = new Set();
45
+ while (current != null && current !== value && !seen.has(current)) {
46
+ seen.add(current);
47
+ current = rawParentOf(current);
48
+ }
49
+ parentOf.set(value, current === value ? null : parent);
50
+ }
51
+ const segmentsOf = (value) => {
52
+ const segments = [];
53
+ for (let current = value; current != null; current = parentOf.get(current) ?? null) {
54
+ segments.unshift(current);
55
+ }
56
+ return segments;
57
+ };
58
+ const entries = [...byValue.entries()].map(([value, option]) => {
59
+ const segments = segmentsOf(value);
60
+ return { value, option, depth: segments.length, path: normalizePath(segments) };
61
+ });
62
+ // The Cascader names a level after the option inserted at it first, so a parent goes in before its children.
63
+ const ordered = entries
64
+ .map((entry, index) => ({ entry, index }))
65
+ .sort((left, right) => left.entry.depth - right.entry.depth || left.index - right.index)
66
+ .map(({ entry }) => entry);
67
+ const pathByValue = new Map();
68
+ const optionByPath = new Map();
69
+ const cascaderOptions = [];
70
+ for (const { value, option, path } of ordered) {
71
+ pathByValue.set(value, path);
72
+ optionByPath.set(path, option);
73
+ cascaderOptions.push({
74
+ value: path,
75
+ label: option.label,
76
+ ...(option.description ? { description: option.description } : {}),
77
+ ...(option.icon ? { icon: option.icon } : {}),
78
+ });
79
+ }
80
+ return { options: cascaderOptions, pathByValue, optionByPath };
81
+ }
82
+ /**
83
+ * What the Cascader is handed as its value: the stored value's path, or the stored value itself where no
84
+ * option has it -- shown as it is, the way a Select shows a value it has no option for.
85
+ */
86
+ export function readPhiInspectorChoiceCascaderPath(cascader, value) {
87
+ if (value == null || value === "")
88
+ return undefined;
89
+ return cascader.pathByValue.get(value) ?? value;
90
+ }
91
+ /**
92
+ * The value a chosen path writes back: the chosen option's own value. A path that names no option -- a
93
+ * search text, the empty root -- or a disabled option writes nothing.
94
+ */
95
+ export function readPhiInspectorChoiceCascaderValue(cascader, path) {
96
+ const option = cascader.optionByPath.get(path);
97
+ return option && option.disabled !== true ? String(option.value) : null;
98
+ }
@@ -6,6 +6,7 @@ import { readPhiDotPath } from "../../../../helpers/dot-path";
6
6
  import { PhiCheckboxGroupControl } from "../../../../components/controls/phi-checkbox-group-control";
7
7
  import { PhiDividerControl } from "../../../../components/controls/phi-divider-control";
8
8
  import { usePhiConfig } from "../../../../components/root/phi-config-provider";
9
+ import { PHI_INSPECTOR_RECORD_FIELD_NONE, buildPhiInspectorRecordFieldOptions, readPhiInspectorRecordFieldChoice, } from "./inspector-record-field-options";
9
10
  import { readPhiLengthValue } from "../../../../types";
10
11
  import { normalizePhiPaddingWidgetConfig, } from "../../../../types/cms-config";
11
12
  import { PhiColorFieldControl } from "../../../../components/controls/phi-color-field-control";
@@ -16,6 +17,8 @@ import { PhiDimensionControl } from "../../../../components/controls/phi-dimensi
16
17
  import { PhiLengthControl } from "../../../../components/controls/phi-length-control";
17
18
  import { parsePhiControlOptionsProviderConfig, } from "../../../../components/controls/phi-control-options";
18
19
  import { usePhiControlOptionsProvider } from "../../../../components/controls/phi-options-provider";
20
+ import { PhiCascaderControl } from "../../../../components/controls/phi-cascader-control";
21
+ import { PHI_INSPECTOR_CHOICE_CASCADER_ROOT, PHI_INSPECTOR_CHOICE_CASCADER_SEPARATOR, buildPhiInspectorChoiceCascader, readPhiInspectorChoiceCascaderPath, readPhiInspectorChoiceCascaderValue, } from "./inspector-choice-cascader";
19
22
  import { PhiTextControl } from "../../../../components/controls/phi-text-control";
20
23
  import { PhiNumberControl } from "../../../../components/controls/phi-number-control";
21
24
  import { PhiMultiSelectControl } from "../../../../components/controls/phi-multi-select-control";
@@ -337,6 +340,7 @@ function PhiInspectorChoiceFieldControl({ field, config, value, defaultValue, di
337
340
  });
338
341
  const renderChoiceRow = (control) => renderPhiInspectorConfigFieldControl(field, _jsxs(PhiFlexControl, { vertical: true, gap: 4, style: { minWidth: 0, width: "100%" }, children: [control, providerResult.warning ? (_jsx(PhiTypographyControl, { type: "warning", children: providerResult.warning })) : null] }));
339
342
  const resolvedOptions = useMemo(() => resolveInspectorChoiceOptions(field, widgetReferenceOptions, providerResult.options), [field, providerResult.options, widgetReferenceOptions]);
343
+ const cascader = useMemo(() => field.presentation === "cascader" ? buildPhiInspectorChoiceCascader(resolvedOptions) : null, [field.presentation, resolvedOptions]);
340
344
  if (field.mode === "multiple" || field.valueType === "string[]") {
341
345
  const selectedValues = readInspectorChoiceMultiValue(value, defaultValue);
342
346
  const options = selectedValues.reduce((items, entry) => ensureInspectorChoiceOption(items, entry), resolvedOptions);
@@ -349,6 +353,28 @@ function PhiInspectorChoiceFieldControl({ field, config, value, defaultValue, di
349
353
  const selectedValue = value == null
350
354
  ? emptyOptionValue ?? readInspectorChoiceSingleValue(undefined, defaultValue)
351
355
  : readInspectorChoiceSingleValue(value, defaultValue);
356
+ /*
357
+ * The options as a hierarchy by their `parentValue`. Every level can be chosen -- a Folder that holds
358
+ * others is a Folder too -- and what is stored is the chosen option's own value. The empty option is
359
+ * the Cascader's clear, not a level.
360
+ */
361
+ if (cascader) {
362
+ const writeChoice = (next) => onChange?.({
363
+ [field.key]: next,
364
+ ...buildPhiInspectorOptionPresetPatch(field.optionPresets, value, next),
365
+ ...(field.patchOnChange ?? {}),
366
+ });
367
+ return renderChoiceRow(_jsx(PhiCascaderControl, { value: readPhiInspectorChoiceCascaderPath(cascader, emptyOptionValue != null && selectedValue === emptyOptionValue ? undefined : selectedValue), options: cascader.options, allowRoot: false, allowClear: field.emptyOption != null, select: "any", separator: PHI_INSPECTOR_CHOICE_CASCADER_SEPARATOR, rootValue: PHI_INSPECTOR_CHOICE_CASCADER_ROOT, placeholder: field.placeholder ?? field.emptyOption?.label ?? (cascader.options.length === 0 ? labels.noMatchingOptions : undefined), disabled: disabled || !onChange, style: { width: "100%" }, onChange: (path) => {
368
+ if (path === PHI_INSPECTOR_CHOICE_CASCADER_ROOT) {
369
+ if (field.emptyOption)
370
+ writeChoice(field.emptyValue);
371
+ return;
372
+ }
373
+ const next = readPhiInspectorChoiceCascaderValue(cascader, path);
374
+ if (next != null)
375
+ writeChoice(next);
376
+ } }));
377
+ }
352
378
  const options = ensureInspectorChoiceOption(field.emptyOption ? [field.emptyOption, ...resolvedOptions] : resolvedOptions, field.allowCustom ? selectedValue : null);
353
379
  return renderChoiceRow(_jsx(PhiSelectControl, { options: options, onSearch: providerResult.search.enabled ? setSearchDraft : undefined, filterOptionsLocally: providerResult.search.filterLocally, placeholder: field.placeholder
354
380
  ?? (field.presentation === "autocomplete" || field.allowCustom
@@ -617,9 +643,7 @@ function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config,
617
643
  if (pageRecordFields.length === 0 && typeof value !== "string") {
618
644
  return null;
619
645
  }
620
- return renderPhiInspectorConfigFieldControl(field, _jsx(PhiSelectControl, { allowClear: true, options: pageRecordFields
621
- .filter((recordField) => field.kinds.includes(recordField.kind))
622
- .map((recordField) => ({ value: recordField.key, label: recordField.label, description: recordField.description })), placeholder: fieldLabels.selectRecordField, value: typeof value === "string" ? value : undefined, disabled: disabled || !onChange, style: { width: "100%" }, onChange: (recordFieldKey) => onChange?.({ [field.key]: typeof recordFieldKey === "string" ? recordFieldKey : undefined }) }));
646
+ return renderPhiInspectorConfigFieldControl(field, _jsx(PhiSelectControl, { options: buildPhiInspectorRecordFieldOptions(field.kinds, pageRecordFields, fieldLabels.recordFieldNone), value: readPhiInspectorRecordFieldChoice(value) ?? PHI_INSPECTOR_RECORD_FIELD_NONE, disabled: disabled || !onChange, style: { width: "100%" }, onChange: (recordFieldKey) => onChange?.({ [field.key]: readPhiInspectorRecordFieldChoice(recordFieldKey) }) }));
623
647
  }
624
648
  if (field.type === "video-provider") {
625
649
  return renderPhiInspectorConfigFieldControl(field, _jsx(PhiSelectControl
@@ -0,0 +1,17 @@
1
+ import type { PhiRecordFieldDescriptor, PhiRecordFieldKind } from "../../../../types/record-provider";
2
+ /** The value the "None" entry stands under: a Widget bound to no field shows its own content. */
3
+ export declare const PHI_INSPECTOR_RECORD_FIELD_NONE = "";
4
+ /**
5
+ * The entries of a record-field select: "None" first, then the fields of the page's record a Widget of
6
+ * these kinds can draw.
7
+ *
8
+ * "None" is an entry rather than an empty select, because it is a choice with a meaning -- the Widget
9
+ * shows what it holds itself -- and an empty box with a placeholder read as a setting nobody had made.
10
+ */
11
+ export declare function buildPhiInspectorRecordFieldOptions(kinds: readonly PhiRecordFieldKind[], fields: readonly PhiRecordFieldDescriptor[], noneLabel: string): {
12
+ description?: string | undefined;
13
+ value: string;
14
+ label: string;
15
+ }[];
16
+ /** The stored key for a select value: "None" stores nothing. */
17
+ export declare function readPhiInspectorRecordFieldChoice(value: unknown): string | undefined;
@@ -0,0 +1,21 @@
1
+ /** The value the "None" entry stands under: a Widget bound to no field shows its own content. */
2
+ export const PHI_INSPECTOR_RECORD_FIELD_NONE = "";
3
+ /**
4
+ * The entries of a record-field select: "None" first, then the fields of the page's record a Widget of
5
+ * these kinds can draw.
6
+ *
7
+ * "None" is an entry rather than an empty select, because it is a choice with a meaning -- the Widget
8
+ * shows what it holds itself -- and an empty box with a placeholder read as a setting nobody had made.
9
+ */
10
+ export function buildPhiInspectorRecordFieldOptions(kinds, fields, noneLabel) {
11
+ return [
12
+ { value: PHI_INSPECTOR_RECORD_FIELD_NONE, label: noneLabel },
13
+ ...fields
14
+ .filter((field) => kinds.includes(field.kind))
15
+ .map((field) => ({ value: field.key, label: field.label, ...(field.description ? { description: field.description } : {}) })),
16
+ ];
17
+ }
18
+ /** The stored key for a select value: "None" stores nothing. */
19
+ export function readPhiInspectorRecordFieldChoice(value) {
20
+ return typeof value === "string" && value !== PHI_INSPECTOR_RECORD_FIELD_NONE ? value : undefined;
21
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Whether the Inspector offers "Translate text" for a node.
3
+ *
4
+ * Only a plugin that translates its own words has the switch at all: every other node's words go through
5
+ * the renderer's pass, which the switch does not govern. And not while the node names a field of the page
6
+ * record (`recordField`): the record's value arrives in the page's language and the render never sends it
7
+ * to a translator, so a switch there would be one that changes nothing.
8
+ */
9
+ export declare function isPhiInspectorTranslateSwitchShown(plugin: {
10
+ translatesOwnText?: boolean;
11
+ } | null | undefined, config: Readonly<Record<string, unknown>> | null | undefined): boolean;
12
+ /**
13
+ * Where among a Widget's visible settings fields "Translate text" stands, as the index it is inserted at.
14
+ *
15
+ * Right after the field that binds the Widget's words to the page record, where there is one: the two
16
+ * answer the same question -- where the words come from -- and the switch only shows while that field is
17
+ * None. Without one, it closes the Widget's own fields, before the next headed group: it is about the
18
+ * words above it, and a group under a heading -- the Badge, the Link target -- is a part of its own. A
19
+ * heading over the very first field names the Widget's own group rather than starting another.
20
+ */
21
+ export declare function resolvePhiInspectorTranslateSwitchIndex(fields: readonly {
22
+ key: string;
23
+ heading?: string;
24
+ }[]): number;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Whether the Inspector offers "Translate text" for a node.
3
+ *
4
+ * Only a plugin that translates its own words has the switch at all: every other node's words go through
5
+ * the renderer's pass, which the switch does not govern. And not while the node names a field of the page
6
+ * record (`recordField`): the record's value arrives in the page's language and the render never sends it
7
+ * to a translator, so a switch there would be one that changes nothing.
8
+ */
9
+ export function isPhiInspectorTranslateSwitchShown(plugin, config) {
10
+ if (!plugin?.translatesOwnText)
11
+ return false;
12
+ const recordField = config?.recordField;
13
+ return !(typeof recordField === "string" && recordField.trim().length > 0);
14
+ }
15
+ /**
16
+ * Where among a Widget's visible settings fields "Translate text" stands, as the index it is inserted at.
17
+ *
18
+ * Right after the field that binds the Widget's words to the page record, where there is one: the two
19
+ * answer the same question -- where the words come from -- and the switch only shows while that field is
20
+ * None. Without one, it closes the Widget's own fields, before the next headed group: it is about the
21
+ * words above it, and a group under a heading -- the Badge, the Link target -- is a part of its own. A
22
+ * heading over the very first field names the Widget's own group rather than starting another.
23
+ */
24
+ export function resolvePhiInspectorTranslateSwitchIndex(fields) {
25
+ const headed = fields.findIndex((field, index) => index > 0 && field.heading != null);
26
+ const ownGroupEnd = headed === -1 ? fields.length : headed;
27
+ const recordField = fields.findIndex((field) => field.key === "recordField");
28
+ return recordField !== -1 && recordField < ownGroupEnd ? recordField + 1 : ownGroupEnd;
29
+ }
@@ -1,6 +1,6 @@
1
1
  import type { PhiBackgroundControlProps } from "../../../../components/controls/phi-background-control";
2
2
  import type { PhiInspectorSurfaceLabels } from "./inspector-surface-labels";
3
- import type { PhiInspectorWidgetLabels } from "../../../../components/widgets/label-types/inspector";
3
+ import { type PhiInspectorWidgetLabels } from "../../../../components/widgets/label-types/inspector";
4
4
  import type { PhiBackgroundWidgetLabels } from "../../../../components/widgets/label-types/background";
5
5
  import type { PhiBorderWidgetLabels } from "../../../../components/widgets/label-types/border";
6
6
  import type { PhiPaddingWidgetLabels } from "../../../../components/widgets/label-types/padding";
@@ -3,6 +3,8 @@ 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
5
  import { PhiSurfaceControl } from "../../../../components/controls/phi-surface-control";
6
+ import { PHI_INSPECTOR_WIDGET_DEFAULT_LABELS } from "../../../../components/widgets/label-types/inspector";
7
+ import { isPhiInspectorTranslateSwitchShown } from "./inspector-translate-switch";
6
8
  import { PhiViewportVisibilityControl } from "../../../../components/controls/phi-viewport-visibility-control";
7
9
  import { PhiPlacementMatrixControl } from "../../../../components/controls/phi-placement-matrix-control";
8
10
  import { PhiInspectorSectionContent } from "./inspector-section-content";
@@ -165,10 +167,10 @@ export function PhiDeveloperBuilderLayoutInspectorWidgetClient({ section, builde
165
167
  slots: textSlots,
166
168
  disabled: isPreviewMode,
167
169
  onChange: onConfigPatch,
168
- })), selectedStructurePlugin?.translatesOwnText
170
+ })), isPhiInspectorTranslateSwitchShown(selectedStructurePlugin, currentDraftRecord)
169
171
  ? renderPhiInspectorSwitchRow({
170
172
  key: "translate-text",
171
- label: "Translate text",
173
+ label: (fieldLabels ?? PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields).translateText,
172
174
  checked: !hasPhiFlag(currentDraft?.node.flags ?? 0, PhiCmsFlags.NoTranslate),
173
175
  disabled: isPreviewMode,
174
176
  ...(onTranslateChange ? { onChange: onTranslateChange } : {}),
@@ -17,7 +17,7 @@ import type { PhiRecordFieldDescriptor } from "../../../../types/record-provider
17
17
  import type { PhiBuilderWidgetMeta } from "../../../../types/builder";
18
18
  import type { PhiSignalRoute } from "../../../../types/signals";
19
19
  import { type PhiInspectorWidgetReferenceOption } from "./inspector-config-field";
20
- import type { PhiInspectorWidgetLabels } from "../../../../components/widgets/label-types/inspector";
20
+ import { type PhiInspectorWidgetLabels } from "../../../../components/widgets/label-types/inspector";
21
21
  type PhiDeveloperBuilderWidgetInspectorWidgetClientProps = {
22
22
  section?: string;
23
23
  builderMode?: PhiDeveloperBuilderMode;