@phis/ui 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. package/components/cms/phi-cms-root-layout.js +2 -0
  2. package/components/controls/phi-mask-picker-control.d.ts +7 -1
  3. package/components/controls/phi-mask-picker-control.js +18 -16
  4. package/components/controls/phi-media-picker-control.d.ts +30 -1
  5. package/components/controls/phi-media-picker-control.js +15 -2
  6. package/components/controls/phi-media-source-item-tile-control.d.ts +22 -0
  7. package/components/controls/phi-media-source-item-tile-control.js +65 -0
  8. package/components/forms/form-field-labels.d.ts +19 -0
  9. package/components/forms/form-field-labels.js +78 -0
  10. package/components/forms/form-provider-contract.d.ts +1 -17
  11. package/components/forms/form-provider-contract.js +4 -18
  12. package/components/forms/media-asset-field-keys.d.ts +27 -0
  13. package/components/forms/media-asset-field-keys.js +27 -0
  14. package/components/forms/phi-form-widget.js +5 -1
  15. package/components/forms/upload-field-keys.d.ts +27 -0
  16. package/components/forms/upload-field-keys.js +27 -0
  17. package/components/forms/upload-form-control.js +11 -5
  18. package/components/media/asset-controller-requirement.d.ts +9 -0
  19. package/components/media/asset-controller-requirement.js +42 -0
  20. package/components/media/label-sets/media-upload.d.ts +10 -0
  21. package/components/media/label-sets/media-upload.js +85 -0
  22. package/components/media/label-sets/media.js +31 -135
  23. package/components/media/media-upload-labels.d.ts +43 -0
  24. package/components/media/media-upload-labels.js +23 -0
  25. package/components/media/media-upload-refusals.d.ts +12 -0
  26. package/components/media/media-upload-refusals.js +28 -0
  27. package/components/media/media-widget-labels.d.ts +33 -26
  28. package/components/media/media-widget-labels.js +27 -36
  29. package/components/media/phi-area-upload-widget.js +3 -4
  30. package/components/media/phi-asset-inspector-section.d.ts +2 -2
  31. package/components/media/phi-image-inspector-widget.d.ts +2 -5
  32. package/components/media/phi-media-picker-binding.d.ts +17 -0
  33. package/components/media/phi-media-picker-binding.js +199 -4
  34. package/components/media/phi-media-picker-labels.d.ts +7 -0
  35. package/components/media/phi-media-picker-labels.js +25 -0
  36. package/components/media/phi-media-sources.d.ts +69 -0
  37. package/components/media/phi-media-sources.js +254 -0
  38. package/components/media/phi-media-upload.d.ts +1 -27
  39. package/components/media/phi-media-upload.js +4 -48
  40. package/components/runtime/runtime-controller-materialization.d.ts +5 -4
  41. package/components/runtime/runtime-controller-materialization.js +5 -4
  42. package/components/runtime/runtime-module-context.d.ts +5 -1
  43. package/components/runtime/runtime-module-context.js +4 -1
  44. package/components/runtime/runtime-module-media-source-client-manifest.d.ts +17 -0
  45. package/components/runtime/runtime-module-media-source-client-manifest.js +53 -0
  46. package/components/widgets/client/shared/phi-mask-picker.js +23 -13
  47. package/components/widgets/client/shared/phi-widget-image-tool-button.d.ts +7 -5
  48. package/components/widgets/client/shared/phi-widget-image-tool-button.js +11 -7
  49. package/components/widgets/client/shared/phi-widget-tool-buttons.js +2 -2
  50. package/components/widgets/config/mask.d.ts +6 -8
  51. package/components/widgets/config/mask.js +14 -12
  52. package/components/widgets/label-sets/authoring-tools.js +55 -1
  53. package/components/widgets/label-sets/history.js +0 -2
  54. package/components/widgets/label-sets/slot-upload.js +4 -4
  55. package/components/widgets/label-types/authoring-tools.d.ts +10 -0
  56. package/components/widgets/label-types/authoring-tools.js +6 -0
  57. package/components/widgets/label-types/history.d.ts +1 -1
  58. package/components/widgets/label-types/history.js +0 -1
  59. package/components/widgets/label-types/mask-picker.d.ts +31 -0
  60. package/components/widgets/label-types/mask-picker.js +30 -0
  61. package/components/widgets/label-types/slot-upload.d.ts +2 -2
  62. package/controls.d.ts +2 -0
  63. package/controls.js +1 -0
  64. package/helpers/cms-region-keys.d.ts +1 -1
  65. package/module-client.d.ts +5 -1
  66. package/module-projection-client.js +1 -0
  67. package/next/areas/accounting-client.js +3 -2
  68. package/next/areas/admin-client.js +3 -2
  69. package/next/areas/app-client.js +3 -2
  70. package/next/areas/builder-client.js +3 -2
  71. package/next/areas/editor-client.js +3 -2
  72. package/next/areas/public-client.js +3 -2
  73. package/next/runtime-module-client-boundary.d.ts +3 -1
  74. package/next/runtime-module-client-boundary.js +3 -2
  75. package/package.json +7 -2
  76. package/plugins/runtime-modules/area-module-defaults.js +4 -3
  77. package/plugins/runtime-modules/asset/controller/definition.d.ts +2 -2
  78. package/plugins/runtime-modules/asset/controller/runtime.js +2 -2
  79. package/plugins/runtime-modules/asset/definition.d.ts +3 -2
  80. package/plugins/runtime-modules/asset/definition.js +11 -3
  81. package/plugins/runtime-modules/asset/ids.d.ts +8 -0
  82. package/plugins/runtime-modules/asset/ids.js +8 -0
  83. package/plugins/runtime-modules/asset/labels.d.ts +4 -0
  84. package/plugins/runtime-modules/asset/labels.js +94 -0
  85. package/plugins/runtime-modules/asset/media-asset-form-control.js +32 -7
  86. package/plugins/runtime-modules/asset/metadata-form.js +27 -18
  87. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +14 -11
  88. package/plugins/runtime-modules/asset/widgets/area-upload/config.d.ts +2 -0
  89. package/plugins/runtime-modules/asset/widgets/area-upload/config.js +3 -0
  90. package/plugins/runtime-modules/asset/widgets/area-upload/server.js +3 -3
  91. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.d.ts +2 -0
  92. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/config.js +3 -0
  93. package/plugins/runtime-modules/asset/widgets/image-inspector/config.d.ts +2 -0
  94. package/plugins/runtime-modules/asset/widgets/image-inspector/config.js +3 -0
  95. package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -2
  96. package/plugins/runtime-modules/asset/widgets/media-picker/config.d.ts +1 -0
  97. package/plugins/runtime-modules/asset/widgets/media-picker/config.js +3 -0
  98. package/plugins/runtime-modules/auth/presets.d.ts +11 -0
  99. package/plugins/runtime-modules/auth/presets.js +17 -8
  100. package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +1 -4
  101. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +2 -2
  102. package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +1 -3
  103. package/plugins/runtime-modules/builder/clients/inspector-image-field.js +4 -5
  104. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -8
  105. package/plugins/runtime-modules/builder/clients/pages-header.js +2 -0
  106. package/plugins/runtime-modules/builder/clients/pages-workspace.js +4 -4
  107. package/plugins/runtime-modules/builder/clients/widget-inspector.js +0 -1
  108. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +2 -2
  109. package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -1
  110. package/plugins/runtime-modules/builder/controller/page-controller.js +8 -8
  111. package/plugins/runtime-modules/builder/controller/workspace-controller.js +4 -1
  112. package/plugins/runtime-modules/builder/inspector-section-widget.js +5 -2
  113. package/plugins/runtime-modules/builder/module-authoring-catalog.server.js +3 -1
  114. package/plugins/runtime-modules/builder/navigation-catalog.server.js +3 -0
  115. package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +1 -1
  116. package/plugins/runtime-modules/builder/offered-page-catalog.js +8 -3
  117. package/plugins/runtime-modules/builder/options-providers.js +2 -2
  118. package/plugins/runtime-modules/builder/page-address-rule.d.ts +7 -0
  119. package/plugins/runtime-modules/builder/page-address-rule.js +12 -0
  120. package/plugins/runtime-modules/builder/page-presets.server.js +4 -0
  121. package/plugins/runtime-modules/builder/persistence.js +6 -7
  122. package/plugins/runtime-modules/builder/public-route-collisions.d.ts +1 -1
  123. package/plugins/runtime-modules/builder/public-route-collisions.js +6 -1
  124. package/plugins/runtime-modules/builder/region-keys.d.ts +10 -0
  125. package/plugins/runtime-modules/builder/region-keys.js +10 -0
  126. package/plugins/runtime-modules/builder/runtime-module-sandbox.server.js +8 -1
  127. package/plugins/runtime-modules/builder/runtime-module-selection.js +5 -5
  128. package/plugins/runtime-modules/builder/services/runtime-modules-table.js +24 -6
  129. package/plugins/runtime-modules/builder/signal-endpoints.js +2 -1
  130. package/plugins/runtime-modules/builder/use-offered-page-catalog.d.ts +2 -2
  131. package/plugins/runtime-modules/builder/use-offered-page-catalog.js +5 -3
  132. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +19 -12
  133. package/plugins/runtime-modules/client-manifests/accounting.d.ts +1 -0
  134. package/plugins/runtime-modules/client-manifests/accounting.js +1 -0
  135. package/plugins/runtime-modules/client-manifests/admin.d.ts +1 -0
  136. package/plugins/runtime-modules/client-manifests/admin.js +1 -0
  137. package/plugins/runtime-modules/client-manifests/app.d.ts +1 -0
  138. package/plugins/runtime-modules/client-manifests/app.js +1 -0
  139. package/plugins/runtime-modules/client-manifests/builder.d.ts +1 -0
  140. package/plugins/runtime-modules/client-manifests/builder.js +1 -0
  141. package/plugins/runtime-modules/client-manifests/common.d.ts +1 -0
  142. package/plugins/runtime-modules/client-manifests/common.js +3 -0
  143. package/plugins/runtime-modules/client-manifests/editor.d.ts +1 -0
  144. package/plugins/runtime-modules/client-manifests/editor.js +1 -0
  145. package/plugins/runtime-modules/client-manifests/public.d.ts +1 -0
  146. package/plugins/runtime-modules/client-manifests/public.js +1 -0
  147. package/plugins/runtime-modules/contracts.js +61 -0
  148. package/plugins/runtime-modules/core/client-media-sources.d.ts +5 -0
  149. package/plugins/runtime-modules/core/client-media-sources.js +6 -0
  150. package/plugins/runtime-modules/core/messaging/forms.js +2 -15
  151. package/plugins/runtime-modules/core/messaging/labels.d.ts +0 -12
  152. package/plugins/runtime-modules/core/messaging/labels.js +0 -24
  153. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -6
  154. package/plugins/runtime-modules/core/widgets/collection-view/config.d.ts +1 -0
  155. package/plugins/runtime-modules/core/widgets/collection-view/config.js +7 -0
  156. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +8 -2
  157. package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
  158. package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +1 -1
  159. package/plugins/runtime-modules/core/widgets/collection-view/server.js +14 -2
  160. package/plugins/runtime-modules/core/widgets/image/authoring.js +1 -1
  161. package/plugins/runtime-modules/core/widgets/image/editor.d.ts +1 -4
  162. package/plugins/runtime-modules/core/widgets/image/editor.js +2 -2
  163. package/plugins/runtime-modules/core/widgets/slot-upload/client.js +2 -3
  164. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +4 -25
  165. package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
  166. package/plugins/runtime-modules/preset-contracts/pub-area.js +0 -1
  167. package/plugins/runtime-modules/resolver.js +27 -1
  168. package/plugins/runtime-modules/settings.d.ts +20 -3
  169. package/plugins/runtime-modules/settings.js +35 -5
  170. package/plugins/runtime-modules/site-module-client-manifests.d.ts +2 -0
  171. package/plugins/runtime-modules/site-module-client-manifests.js +2 -0
  172. package/plugins/runtime-modules/site-modules-client.d.ts +5 -0
  173. package/plugins/runtime-modules/site-modules-client.js +1 -0
  174. package/plugins/runtime-modules/theme/brand-theme-model.js +0 -1
  175. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +97 -192
  176. package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +6 -2
  177. package/runtime-client-manifests-accounting.d.ts +1 -1
  178. package/runtime-client-manifests-accounting.js +1 -1
  179. package/runtime-client-manifests-admin.d.ts +1 -1
  180. package/runtime-client-manifests-admin.js +1 -1
  181. package/runtime-client-manifests-app.d.ts +1 -1
  182. package/runtime-client-manifests-app.js +1 -1
  183. package/runtime-client-manifests-builder.d.ts +1 -1
  184. package/runtime-client-manifests-builder.js +1 -1
  185. package/runtime-client-manifests-editor.d.ts +1 -1
  186. package/runtime-client-manifests-editor.js +1 -1
  187. package/runtime-client-manifests-public.d.ts +2 -1
  188. package/runtime-client-manifests-public.js +1 -1
  189. package/runtime-media-source-client.d.ts +3 -0
  190. package/runtime-media-source-client.js +2 -0
  191. package/server-helpers/cms-request.js +10 -4
  192. package/server-helpers/search-index.js +7 -6
  193. package/server-helpers/site-build-id.d.ts +25 -0
  194. package/server-helpers/site-build-id.js +27 -0
  195. package/theme/phi-theme-presets.d.ts +13 -3
  196. package/theme/phi-theme-presets.js +20 -3
  197. package/theme/phi-theme-seed-derivation.d.ts +240 -0
  198. package/theme/phi-theme-seed-derivation.js +126 -0
  199. package/types/cms-plugins.d.ts +29 -0
  200. package/types/media-source.d.ts +48 -0
  201. package/types/media-source.js +1 -0
  202. package/types/site-config.d.ts +1 -2
  203. package/types/site-theme.d.ts +0 -6
  204. package/types.d.ts +1 -0
  205. package/components/media/asset-controller-routes.d.ts +0 -8
  206. package/components/media/asset-controller-routes.js +0 -31
  207. package/helpers/brand-contact.d.ts +0 -14
  208. package/helpers/brand-contact.js +0 -26
@@ -6,17 +6,16 @@ import { normalizePhiImagePreviewTile } from "../../../media/phi-image-preview-d
6
6
  import { bumpPhiImagePreviewRefreshToken } from "../../../media/phi-image-preview-store";
7
7
  import { usePhiMediaPickerBinding } from "../../../media/phi-media-picker-binding";
8
8
  import { isPhiMediaUploadCancelled, runPhiMediaUploadSession } from "../../../media/media-upload-flow";
9
- import { PHI_MEDIA_UPLOAD_DEFAULT_LABELS, readPhiMediaUploadErrorMessage, } from "../../../media/phi-media-upload";
10
- import { PHI_MEDIA_WIDGET_DEFAULT_LABELS } from "../../../media/media-widget-labels";
9
+ import { readPhiMediaUploadErrorMessage } from "../../../media/phi-media-upload";
10
+ import { usePhiMediaPickerLabels } from "../../../media/phi-media-picker-labels";
11
11
  import { PHI_SEARCH_WIDGET_DEFAULT_LABELS } from "../../label-types/search";
12
+ import { formatPhiMaskPickerLabel } from "../../label-types/mask-picker";
12
13
  import { mergePhiMaskConfigPatch, } from "../../config/mask";
13
14
  import { PhiMaskPickerControl } from "../../../controls/phi-mask-picker-control";
14
15
  import { usePhiApplicationFeedback } from "../../../runtime/use-phi-application-feedback";
15
16
  import { usePhiWidgetScaffoldPopup } from "./phi-widget-scaffold-popup";
16
17
  import { usePhiAuthoringToolsLabels } from "./phi-authoring-tools-labels";
17
- import { createPhiMediaPickerAssetControllerRoutes } from "../../../media/asset-controller-routes";
18
18
  import { PhiIcon } from "../../../shell/phi-icon";
19
- const PHI_MASK_PICKER_MEDIA_ROUTES = createPhiMediaPickerAssetControllerRoutes("mask-picker-media", "area");
20
19
  const PHI_MASK_MEDIA_SCOPE_KEY = "image-mask-picker";
21
20
  function parseIconifyIcon(value) {
22
21
  if (!value?.startsWith("iconify:"))
@@ -42,7 +41,11 @@ export function PhiMaskPickerButton({ value, onChange, onCommit, onDiscard, butt
42
41
  const { showMessage } = usePhiApplicationFeedback();
43
42
  const popup = usePhiWidgetScaffoldPopup();
44
43
  const toolLabels = usePhiAuthoringToolsLabels();
44
+ const mediaPickerLabels = usePhiMediaPickerLabels();
45
45
  const iconifyRequiredMessage = toolLabels.mask.iconifyRequired;
46
+ const uploadRefusals = toolLabels.mask.uploadRefusals;
47
+ const uploadedTemplate = toolLabels.mask.uploaded;
48
+ const iconSelectedTemplate = toolLabels.mask.iconSelected;
46
49
  const [open, setOpen] = useState(false);
47
50
  const [mediaOpen, setMediaOpen] = useState(false);
48
51
  const [uploading, setUploading] = useState(false);
@@ -102,7 +105,7 @@ export function PhiMaskPickerButton({ value, onChange, onCommit, onDiscard, butt
102
105
  }));
103
106
  }, [onChange, value]);
104
107
  const mediaPickerProps = usePhiMediaPickerBinding({
105
- labels: PHI_MEDIA_WIDGET_DEFAULT_LABELS,
108
+ labels: mediaPickerLabels,
106
109
  searchLabels: PHI_SEARCH_WIDGET_DEFAULT_LABELS,
107
110
  config: {
108
111
  mediaType: PhiMediaKind.Image,
@@ -111,7 +114,6 @@ export function PhiMaskPickerButton({ value, onChange, onCommit, onDiscard, butt
111
114
  showPagination: true,
112
115
  showGroupFilter: true,
113
116
  showSearchBar: true,
114
- signalRoutes: PHI_MASK_PICKER_MEDIA_ROUTES,
115
117
  },
116
118
  open: mediaOpen,
117
119
  onOpenChange: setMediaOpen,
@@ -131,17 +133,17 @@ export function PhiMaskPickerButton({ value, onChange, onCommit, onDiscard, butt
131
133
  if (controller.signal.aborted)
132
134
  return;
133
135
  applyUploadedAsset(result.asset);
134
- showMessage({ level: "success", content: `Uploaded ${file.name}.` });
136
+ showMessage({ level: "success", content: formatPhiMaskPickerLabel(uploadedTemplate, file.name) });
135
137
  }).catch((error) => {
136
138
  if (controller.signal.aborted || isPhiMediaUploadCancelled(error))
137
139
  return;
138
140
  // One reading of every refusal, rather than whatever string the control plane happened to send.
139
141
  showMessage({
140
142
  level: "error",
141
- content: readPhiMediaUploadErrorMessage(error, PHI_MEDIA_UPLOAD_DEFAULT_LABELS),
143
+ content: readPhiMediaUploadErrorMessage(error, uploadRefusals),
142
144
  });
143
145
  }).finally(() => endUpload(controller));
144
- }, [applyUploadedAsset, beginUpload, endUpload, showMessage]);
146
+ }, [applyUploadedAsset, beginUpload, endUpload, showMessage, uploadRefusals, uploadedTemplate]);
145
147
  const uploadIconifyMask = useCallback((nextIconValue) => {
146
148
  setSelectedIcon(nextIconValue);
147
149
  const icon = parseIconifyIcon(nextIconValue);
@@ -176,17 +178,25 @@ export function PhiMaskPickerButton({ value, onChange, onCommit, onDiscard, butt
176
178
  if (controller.signal.aborted)
177
179
  return;
178
180
  applyUploadedAsset(result.asset);
179
- showMessage({ level: "success", content: `Selected ${icon.iconKey}.` });
181
+ showMessage({ level: "success", content: formatPhiMaskPickerLabel(iconSelectedTemplate, icon.iconKey) });
180
182
  })
181
183
  .catch((error) => {
182
184
  if (controller.signal.aborted || isPhiMediaUploadCancelled(error))
183
185
  return;
184
186
  showMessage({
185
187
  level: "error",
186
- content: readPhiMediaUploadErrorMessage(error, PHI_MEDIA_UPLOAD_DEFAULT_LABELS),
188
+ content: readPhiMediaUploadErrorMessage(error, uploadRefusals),
187
189
  });
188
190
  })
189
191
  .finally(() => endUpload(controller));
190
- }, [applyUploadedAsset, beginUpload, endUpload, iconifyRequiredMessage, showMessage]);
191
- return (_jsx(PhiMaskPickerControl, { value: value, open: open, placement: placement, buttonAriaLabel: buttonAriaLabel ?? toolLabels.mask.select, buttonIcon: buttonIcon, mediaPickerProps: mediaPickerProps, selectedIcon: selectedIcon, uploading: uploading, uploadProgress: uploadProgress, popupRootClassName: popup.rootClassName, getPopupContainer: popup.getPopupContainer, onUploadFile: uploadFile, onIconSelect: uploadIconifyMask, onChange: onChange, onCommit: onCommit, onDiscard: onDiscard, onOpenChange: updateOpen }));
192
+ }, [
193
+ applyUploadedAsset,
194
+ beginUpload,
195
+ endUpload,
196
+ iconSelectedTemplate,
197
+ iconifyRequiredMessage,
198
+ showMessage,
199
+ uploadRefusals,
200
+ ]);
201
+ return (_jsx(PhiMaskPickerControl, { value: value, open: open, placement: placement, buttonAriaLabel: buttonAriaLabel ?? toolLabels.mask.select, buttonIcon: buttonIcon, mediaPickerProps: mediaPickerProps, selectedIcon: selectedIcon, labels: toolLabels.mask.control, iconPickerLabels: toolLabels.iconPicker, uploading: uploading, uploadProgress: uploadProgress, popupRootClassName: popup.rootClassName, getPopupContainer: popup.getPopupContainer, onUploadFile: uploadFile, onIconSelect: uploadIconifyMask, onChange: onChange, onCommit: onCommit, onDiscard: onDiscard, onOpenChange: updateOpen }));
192
202
  }
@@ -1,5 +1,4 @@
1
1
  import type { PhiImageAssetVariantKeyValue, PhiMediaAssetTile } from "../../../../types/media";
2
- import type { PhiCmsInstanceId } from "../../../../types/cms-instance-id";
3
2
  type PhiWidgetImageToolButtonCommonPatch = {
4
3
  trusted?: boolean;
5
4
  /** Cleared when the image changes: a fixed size chosen for one image is no answer for the next. */
@@ -14,14 +13,17 @@ export type PhiWidgetImageToolButtonPatch = PhiWidgetImageToolButtonCommonPatch
14
13
  sourceKind: "url";
15
14
  sourceUrl?: string;
16
15
  });
17
- export declare function PhiInternalAssetReferencePickerButton({ blockId, ariaLabel, onSelect, onClear, }: {
18
- blockId: PhiCmsInstanceId;
16
+ /**
17
+ * A picker opened from authoring chrome keeps its own search, folder and page, and sends the Asset
18
+ * Controller nothing: that Controller belongs to the Media Page, and what a tool button searched for
19
+ * is no business of the gallery there.
20
+ */
21
+ export declare function PhiInternalAssetReferencePickerButton({ ariaLabel, onSelect, onClear, }: {
19
22
  ariaLabel?: string;
20
23
  onSelect: (asset: PhiMediaAssetTile) => void;
21
24
  onClear?: () => void;
22
25
  }): import("react").JSX.Element;
23
- export declare function PhiWidgetImageToolButton({ blockId, onChange, }: {
24
- blockId: PhiCmsInstanceId;
26
+ export declare function PhiWidgetImageToolButton({ onChange, }: {
25
27
  onChange: (patch: PhiWidgetImageToolButtonPatch) => void;
26
28
  }): import("react").JSX.Element;
27
29
  export {};
@@ -2,26 +2,30 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { PhiImageAssetVariantKey, PhiMediaKind, } from "../../../../constants/media";
4
4
  import { PhiMediaPickerBinding } from "../../../media/phi-media-picker-binding";
5
- import { PHI_MEDIA_WIDGET_DEFAULT_LABELS } from "../../../media/media-widget-labels";
5
+ import { usePhiMediaPickerLabels } from "../../../media/phi-media-picker-labels";
6
6
  import { PHI_SEARCH_WIDGET_DEFAULT_LABELS } from "../../label-types/search";
7
7
  import { usePhiWidgetScaffoldPopup } from "./phi-widget-scaffold-popup";
8
8
  import { usePhiAuthoringToolsLabels } from "./phi-authoring-tools-labels";
9
9
  import { PhiButtonControl } from "../../../controls/phi-button-control";
10
- import { createPhiMediaPickerAssetControllerRoutes } from "../../../media/asset-controller-routes";
11
10
  import { PhiIcon } from "../../../shell/phi-icon";
12
- export function PhiInternalAssetReferencePickerButton({ blockId, ariaLabel, onSelect, onClear, }) {
11
+ /**
12
+ * A picker opened from authoring chrome keeps its own search, folder and page, and sends the Asset
13
+ * Controller nothing: that Controller belongs to the Media Page, and what a tool button searched for
14
+ * is no business of the gallery there.
15
+ */
16
+ export function PhiInternalAssetReferencePickerButton({ ariaLabel, onSelect, onClear, }) {
13
17
  const labels = usePhiAuthoringToolsLabels();
18
+ const mediaLabels = usePhiMediaPickerLabels();
14
19
  const popup = usePhiWidgetScaffoldPopup();
15
- return (_jsx(PhiMediaPickerBinding, { labels: PHI_MEDIA_WIDGET_DEFAULT_LABELS, searchLabels: PHI_SEARCH_WIDGET_DEFAULT_LABELS, config: {
20
+ return (_jsx(PhiMediaPickerBinding, { labels: mediaLabels, searchLabels: PHI_SEARCH_WIDGET_DEFAULT_LABELS, config: {
16
21
  mediaType: PhiMediaKind.Image,
17
22
  pageSize: 12,
18
23
  showPagination: true,
19
24
  showGroupFilter: true,
20
25
  showSearchBar: true,
21
- signalRoutes: createPhiMediaPickerAssetControllerRoutes(`internal-asset-reference-${blockId}`, "area"),
22
26
  }, getPopupContainer: popup.getPopupContainer, popupRootClassName: popup.rootClassName, onPopupOpenChange: popup.setOpen, trigger: _jsx("span", { style: { display: "inline-flex" }, children: _jsx(PhiButtonControl, { type: "text", size: "small", icon: _jsx(PhiIcon, { name: "picture", size: "inherit" }), ariaLabel: ariaLabel ?? labels.fallbacks.selectImage, style: { width: 24, minWidth: 24, height: 24, padding: 0 }, onClick: () => undefined }) }), onAssetSelect: onSelect, onAssetClear: onClear }));
23
27
  }
24
- export function PhiWidgetImageToolButton({ blockId, onChange, }) {
28
+ export function PhiWidgetImageToolButton({ onChange, }) {
25
29
  const selectAsset = (asset) => {
26
30
  onChange({
27
31
  sourceKind: "asset",
@@ -32,7 +36,7 @@ export function PhiWidgetImageToolButton({ blockId, onChange, }) {
32
36
  imageSize: undefined,
33
37
  });
34
38
  };
35
- return (_jsx(PhiInternalAssetReferencePickerButton, { blockId: blockId, onSelect: selectAsset, onClear: () => {
39
+ return (_jsx(PhiInternalAssetReferencePickerButton, { onSelect: selectAsset, onClear: () => {
36
40
  onChange({
37
41
  sourceKind: "url",
38
42
  sourceUrl: undefined,
@@ -152,7 +152,7 @@ export function PhiHtmlWidgetToolbarTools({ blockId, }) {
152
152
  } }) }, toggle.key))) }), children: _jsx("span", { onMouseDown: preserveEditorSelectionMouseEvent, onClick: stopPhiOverlayEvent, onPointerDown: stopPhiOverlayEvent, style: { display: "inline-flex" }, children: _jsx(PhiButtonControl, { type: hasActiveTextStyle ? "primary" : "text", size: "small", ariaLabel: labels.richText.styles, icon: _jsx(PhiIcon, { name: "format-painter", size: "inherit" }), disabled: !bridge, onClick: () => undefined }) }) }), _jsx(PhiWidgetColorToolButton, { value: state?.textColor ?? null, ariaLabel: labels.richText.color, onChange: (color) => {
153
153
  bridge?.setTextColor(color);
154
154
  bridge?.focus();
155
- } }), _jsx(PhiInternalAssetReferencePickerButton, { blockId: blockId, ariaLabel: labels.richText.insertAsset, onSelect: (asset) => {
155
+ } }), _jsx(PhiInternalAssetReferencePickerButton, { ariaLabel: labels.richText.insertAsset, onSelect: (asset) => {
156
156
  bridge?.insertImage(createPhiAssetUri(asset.id), asset.altText?.trim() || asset.title?.trim() || asset.originalName);
157
157
  bridge?.focus();
158
158
  } }), _jsx(PhiPopoverControl, { open: linkPopoverOpen, trigger: "click", placement: "bottomRight", onOpenChange: handleLinkPopoverOpenChange, getPopupContainer: linkPopup.getPopupContainer, rootClassName: linkPopup.rootClassName, zIndex: PHI_WIDGET_OVERLAY_Z_INDEX, content: _jsxs(PhiFlexControl, { vertical: true, gap: 8, onClick: stopPhiOverlayEvent, onMouseDown: stopPhiOverlayEvent, onPointerDown: stopPhiOverlayEvent, children: [_jsx(PhiPageReferencePicker, { onSelect: (selection) => {
@@ -181,7 +181,7 @@ export function PhiMarkdownWidgetToolbarTools({ blockId, }) {
181
181
  return (_jsxs(_Fragment, { children: [_jsx(PhiPageReferencePicker, { onSelect: (selection) => {
182
182
  const label = selection.title.replaceAll("]", "\\]");
183
183
  bridge?.insert(`[${label}](${createPhiPageUri(selection.reference)})`);
184
- } }), _jsx(PhiInternalAssetReferencePickerButton, { blockId: blockId, ariaLabel: labels.richText.insertAsset, onSelect: (asset) => {
184
+ } }), _jsx(PhiInternalAssetReferencePickerButton, { ariaLabel: labels.richText.insertAsset, onSelect: (asset) => {
185
185
  const alt = (asset.altText?.trim() || asset.title?.trim() || asset.originalName)
186
186
  .replaceAll("]", "\\]");
187
187
  bridge?.insert(`![${alt}](${createPhiAssetUri(asset.id)})`);
@@ -1,8 +1,11 @@
1
1
  import type { CSSProperties } from "react";
2
2
  export type PhiMaskSource = "preset" | "asset";
3
- /** The preset shapes and their names, in the order a picker lists them. */
4
- declare const PHI_MASK_PRESET_ENTRIES: readonly [readonly ["circle", "Circle"], readonly ["ellipse", "Ellipse"], readonly ["triangle", "Triangle"], readonly ["diamond", "Diamond"], readonly ["hexagon", "Hexagon"], readonly ["star", "Star"], readonly ["cloud", "Cloud"], readonly ["blob", "Blob"]];
5
- export type PhiMaskPreset = (typeof PHI_MASK_PRESET_ENTRIES)[number][0];
3
+ /**
4
+ * The preset shapes, in the order a picker lists them. What each is called is the picker's to say, in
5
+ * the reader's language (`label-types/mask-picker.ts`), so no name stands here.
6
+ */
7
+ export declare const PHI_MASK_PRESET_VALUES: readonly ["circle", "ellipse", "triangle", "diamond", "hexagon", "star", "cloud", "blob"];
8
+ export type PhiMaskPreset = (typeof PHI_MASK_PRESET_VALUES)[number];
6
9
  export type PhiMaskRepeat = "no-repeat" | "repeat";
7
10
  export type PhiMaskMode = "alpha" | "luminance";
8
11
  export type PhiMaskConfig = {
@@ -19,10 +22,6 @@ export type PhiMaskConfig = {
19
22
  repeat?: PhiMaskRepeat;
20
23
  mode?: PhiMaskMode;
21
24
  };
22
- export declare const PHI_MASK_PRESET_OPTIONS: ReadonlyArray<{
23
- value: PhiMaskPreset;
24
- label: string;
25
- }>;
26
25
  export declare function resolvePhiMaskStyle(mask: PhiMaskConfig | null | undefined): CSSProperties | undefined;
27
26
  /**
28
27
  * A stored mask, read strictly (`strict-config-reader.ts`) before it is normalized: a field that is
@@ -33,4 +32,3 @@ export declare function readPhiMaskConfig(value: unknown, path?: string): PhiMas
33
32
  export declare function mergePhiMaskConfigDefaults(mask: PhiMaskConfig | null | undefined): PhiMaskConfig;
34
33
  /** A picker's change on top of the current mask: the defaults filled, the patch applied, the mask enabled. */
35
34
  export declare function mergePhiMaskConfigPatch(mask: PhiMaskConfig | null | undefined, patch: PhiMaskConfig): PhiMaskConfig;
36
- export {};
@@ -1,18 +1,21 @@
1
1
  import { isPhiRecord } from "../../../helpers/is-record";
2
2
  import { readBoolean, readCssSize, readNumber, readString } from "./parser-primitives";
3
3
  import { createPhiConfigReader } from "./strict-config-reader";
4
- /** The preset shapes and their names, in the order a picker lists them. */
5
- const PHI_MASK_PRESET_ENTRIES = [
6
- ["circle", "Circle"],
7
- ["ellipse", "Ellipse"],
8
- ["triangle", "Triangle"],
9
- ["diamond", "Diamond"],
10
- ["hexagon", "Hexagon"],
11
- ["star", "Star"],
12
- ["cloud", "Cloud"],
13
- ["blob", "Blob"],
4
+ /**
5
+ * The preset shapes, in the order a picker lists them. What each is called is the picker's to say, in
6
+ * the reader's language (`label-types/mask-picker.ts`), so no name stands here.
7
+ */
8
+ export const PHI_MASK_PRESET_VALUES = [
9
+ "circle",
10
+ "ellipse",
11
+ "triangle",
12
+ "diamond",
13
+ "hexagon",
14
+ "star",
15
+ "cloud",
16
+ "blob",
14
17
  ];
15
- const PHI_MASK_PRESETS = new Set(PHI_MASK_PRESET_ENTRIES.map(([preset]) => preset));
18
+ const PHI_MASK_PRESETS = new Set(PHI_MASK_PRESET_VALUES);
16
19
  const PHI_MASK_DEFAULT_CONFIG = {
17
20
  enabled: false,
18
21
  source: "preset",
@@ -25,7 +28,6 @@ const PHI_MASK_DEFAULT_CONFIG = {
25
28
  repeat: "no-repeat",
26
29
  mode: "alpha",
27
30
  };
28
- export const PHI_MASK_PRESET_OPTIONS = PHI_MASK_PRESET_ENTRIES.map(([value, label]) => ({ value, label }));
29
31
  const PHI_MASK_PRESET_SVG_PATHS = {
30
32
  circle: '<circle cx="50" cy="50" r="48" fill="white"/>',
31
33
  ellipse: '<ellipse cx="50" cy="50" rx="48" ry="34" fill="white"/>',
@@ -2,6 +2,7 @@ import "server-only";
2
2
  import { PHI_TR_CTX_WEB_UI_LABEL, } from "../../../gateway/tr";
3
3
  import { definePhiLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../gateway/label-set";
4
4
  import { PHI_AUTHORING_TOOLS_DEFAULT_LABELS, } from "../label-types/authoring-tools";
5
+ import { getPhiMediaUploadLabels } from "../../media/label-sets/media-upload";
5
6
  import { getPhiIconPickerLabels } from "./icon-picker";
6
7
  /**
7
8
  * Every one of these is a caption on a button, so none of them is a message label: they name what the
@@ -29,6 +30,29 @@ const PHI_AUTHORING_TOOLS_LABEL_SET = definePhiLabelSet({
29
30
  rich_text_code: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.richText.code,
30
31
  mask_select: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.select,
31
32
  mask_iconify_required: definePhiMessageLabel(PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.iconifyRequired),
33
+ mask_uploaded: definePhiMessageLabel(PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.uploaded),
34
+ mask_icon_selected: definePhiMessageLabel(PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.iconSelected),
35
+ mask_title: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.title,
36
+ mask_clear: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.clear,
37
+ mask_mode_presets: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.modePresets,
38
+ mask_mode_media: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.modeMedia,
39
+ mask_select_asset: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.selectAsset,
40
+ mask_upload: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.upload,
41
+ mask_uploading: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.uploading,
42
+ mask_select_iconify: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.selectIconify,
43
+ mask_iconify_button: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.iconifyButton,
44
+ mask_scale: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.scale,
45
+ mask_offset_x: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.offsetX,
46
+ mask_offset_y: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.offsetY,
47
+ mask_rotation: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.rotation,
48
+ mask_preset_circle: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.presets.circle,
49
+ mask_preset_ellipse: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.presets.ellipse,
50
+ mask_preset_triangle: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.presets.triangle,
51
+ mask_preset_diamond: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.presets.diamond,
52
+ mask_preset_hexagon: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.presets.hexagon,
53
+ mask_preset_star: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.presets.star,
54
+ mask_preset_cloud: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.presets.cloud,
55
+ mask_preset_blob: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.mask.control.presets.blob,
32
56
  rich_text_alignment: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.richText.alignment,
33
57
  rich_text_styles: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.richText.styles,
34
58
  rich_text_color: PHI_AUTHORING_TOOLS_DEFAULT_LABELS.richText.color,
@@ -89,9 +113,10 @@ const PHI_AUTHORING_TOOLS_LABEL_SET = definePhiLabelSet({
89
113
  },
90
114
  });
91
115
  export async function getPhiAuthoringToolsLabels(options) {
92
- const [labels, iconPicker] = await Promise.all([
116
+ const [labels, iconPicker, upload] = await Promise.all([
93
117
  getPhiLabelSet(options, PHI_AUTHORING_TOOLS_LABEL_SET),
94
118
  getPhiIconPickerLabels(options),
119
+ getPhiMediaUploadLabels(options),
95
120
  ]);
96
121
  return {
97
122
  text: {
@@ -124,6 +149,35 @@ export async function getPhiAuthoringToolsLabels(options) {
124
149
  mask: {
125
150
  select: labels.mask_select,
126
151
  iconifyRequired: labels.mask_iconify_required,
152
+ uploaded: labels.mask_uploaded,
153
+ iconSelected: labels.mask_icon_selected,
154
+ control: {
155
+ button: labels.mask_select,
156
+ title: labels.mask_title,
157
+ clear: labels.mask_clear,
158
+ modePresets: labels.mask_mode_presets,
159
+ modeMedia: labels.mask_mode_media,
160
+ selectAsset: labels.mask_select_asset,
161
+ upload: labels.mask_upload,
162
+ uploading: labels.mask_uploading,
163
+ selectIconify: labels.mask_select_iconify,
164
+ iconifyButton: labels.mask_iconify_button,
165
+ scale: labels.mask_scale,
166
+ offsetX: labels.mask_offset_x,
167
+ offsetY: labels.mask_offset_y,
168
+ rotation: labels.mask_rotation,
169
+ presets: {
170
+ circle: labels.mask_preset_circle,
171
+ ellipse: labels.mask_preset_ellipse,
172
+ triangle: labels.mask_preset_triangle,
173
+ diamond: labels.mask_preset_diamond,
174
+ hexagon: labels.mask_preset_hexagon,
175
+ star: labels.mask_preset_star,
176
+ cloud: labels.mask_preset_cloud,
177
+ blob: labels.mask_preset_blob,
178
+ },
179
+ },
180
+ uploadRefusals: upload.refusals,
127
181
  },
128
182
  descriptions: {
129
183
  items: labels.descriptions_items,
@@ -42,7 +42,6 @@ const PHI_HISTORY_LABEL_SET = definePhiLabelSet({
42
42
  theme_part_fonts: D.themeParts.fonts,
43
43
  theme_part_style: D.themeParts.style,
44
44
  theme_part_brand: D.themeParts.brand,
45
- theme_part_contact: D.themeParts.contact,
46
45
  theme_part_shell: D.themeParts.shell,
47
46
  theme_part_root: D.themeParts.root,
48
47
  theme_part_widgets: D.themeParts.widgets,
@@ -85,7 +84,6 @@ export async function getPhiHistoryLabels(options) {
85
84
  fonts: labels.theme_part_fonts,
86
85
  style: labels.theme_part_style,
87
86
  brand: labels.theme_part_brand,
88
- contact: labels.theme_part_contact,
89
87
  shell: labels.theme_part_shell,
90
88
  root: labels.theme_part_root,
91
89
  widgets: labels.theme_part_widgets,
@@ -1,7 +1,7 @@
1
1
  import "server-only";
2
2
  import { definePhiLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../gateway/label-set";
3
3
  import { PHI_TR_CTX_WEB_UI_LABEL } from "../../../gateway/tr";
4
- import { getPhiMediaWidgetLabels } from "../../media/label-sets/media";
4
+ import { getPhiMediaUploadLabels } from "../../media/label-sets/media-upload";
5
5
  import { PHI_SLOT_UPLOAD_WIDGET_DEFAULT_LABELS, } from "../label-types/slot-upload";
6
6
  const DEFAULTS = PHI_SLOT_UPLOAD_WIDGET_DEFAULT_LABELS;
7
7
  const PHI_SLOT_UPLOAD_WIDGET_LABEL_SET = definePhiLabelSet({
@@ -20,9 +20,9 @@ const PHI_SLOT_UPLOAD_WIDGET_LABEL_SET = definePhiLabelSet({
20
20
  },
21
21
  });
22
22
  export async function getPhiSlotUploadWidgetLabels(options) {
23
- const [labels, media] = await Promise.all([
23
+ const [labels, upload] = await Promise.all([
24
24
  getPhiLabelSet(options, PHI_SLOT_UPLOAD_WIDGET_LABEL_SET),
25
- getPhiMediaWidgetLabels(options),
25
+ getPhiMediaUploadLabels(options),
26
26
  ]);
27
27
  return {
28
28
  unconfigured: labels.unconfigured,
@@ -34,6 +34,6 @@ export async function getPhiSlotUploadWidgetLabels(options) {
34
34
  serverAnswered: labels.server_answered,
35
35
  unreachable: labels.unreachable,
36
36
  removeFailed: labels.remove_failed,
37
- upload: media.upload,
37
+ upload: upload.upload,
38
38
  };
39
39
  }
@@ -1,4 +1,6 @@
1
+ import { type PhiMediaUploadLabels } from "../../media/media-upload-labels";
1
2
  import { type PhiIconPickerControlLabels } from "./icon-picker";
3
+ import { type PhiMaskPickerControlLabels } from "./mask-picker";
2
4
  /**
3
5
  * What the Builder's authoring tools say -- the buttons in a Widget's scaffold, not the Widget.
4
6
  *
@@ -41,6 +43,14 @@ export type PhiAuthoringToolsLabels = {
41
43
  mask: {
42
44
  select: string;
43
45
  iconifyRequired: string;
46
+ /** A mask file that arrived; `%1` is its name. */
47
+ uploaded: string;
48
+ /** An Iconify icon taken as the mask; `%1` is its key. */
49
+ iconSelected: string;
50
+ /** What the picker itself says. */
51
+ control: PhiMaskPickerControlLabels;
52
+ /** The upload's own refusals, which are Core's `widget:upload` texts and not the picker's. */
53
+ uploadRefusals: PhiMediaUploadLabels;
44
54
  };
45
55
  descriptions: {
46
56
  items: string;
@@ -1,4 +1,6 @@
1
+ import { PHI_MEDIA_UPLOAD_DEFAULT_LABELS, } from "../../media/media-upload-labels";
1
2
  import { PHI_ICON_PICKER_CONTROL_DEFAULT_LABELS, } from "./icon-picker";
3
+ import { PHI_MASK_PICKER_CONTROL_DEFAULT_LABELS, } from "./mask-picker";
2
4
  export const PHI_AUTHORING_TOOLS_DEFAULT_LABELS = {
3
5
  text: {
4
6
  styles: "Text styles",
@@ -30,6 +32,10 @@ export const PHI_AUTHORING_TOOLS_DEFAULT_LABELS = {
30
32
  mask: {
31
33
  select: "Select mask",
32
34
  iconifyRequired: "Select an Iconify icon for mask uploads.",
35
+ uploaded: "Uploaded %1.",
36
+ iconSelected: "Selected %1.",
37
+ control: PHI_MASK_PICKER_CONTROL_DEFAULT_LABELS,
38
+ uploadRefusals: PHI_MEDIA_UPLOAD_DEFAULT_LABELS,
33
39
  },
34
40
  descriptions: {
35
41
  items: "Description items",
@@ -20,7 +20,7 @@ export type PhiHistoryAction = {
20
20
  regionKey?: string | null;
21
21
  };
22
22
  /** The parts of a Theme an edit can change, as the Theme step names them. */
23
- export type PhiHistoryThemePartKey = "palette" | "mode" | "fonts" | "style" | "brand" | "contact" | "shell" | "root" | "widgets" | "components";
23
+ export type PhiHistoryThemePartKey = "palette" | "mode" | "fonts" | "style" | "brand" | "shell" | "root" | "widgets" | "components";
24
24
  export type PhiHistoryLabels = {
25
25
  /** The message after an undo; `{action}` is the step's sentence. */
26
26
  undone: string;
@@ -36,7 +36,6 @@ export const PHI_HISTORY_DEFAULT_LABELS = {
36
36
  fonts: "fonts",
37
37
  style: "style",
38
38
  brand: "brand",
39
- contact: "contact",
40
39
  shell: "shell",
41
40
  root: "page background",
42
41
  widgets: "widgets",
@@ -0,0 +1,31 @@
1
+ import type { PhiMaskPreset } from "../config/mask";
2
+ /**
3
+ * What the Builder's mask picker says: its heading, its two modes, the ways to bring a mask in, the four
4
+ * sliders and the name of each preset shape.
5
+ *
6
+ * Carried by the authoring tools (`label-sets/authoring-tools.ts`), which is where the picker is drawn:
7
+ * it is the Image Widget's tool and Core's, so its words are translated in Core and not by whoever places
8
+ * an Image.
9
+ */
10
+ export type PhiMaskPickerControlLabels = {
11
+ /** The tool button that opens the picker, as its accessible name. */
12
+ button: string;
13
+ title: string;
14
+ clear: string;
15
+ modePresets: string;
16
+ modeMedia: string;
17
+ selectAsset: string;
18
+ upload: string;
19
+ /** While a mask is on its way; `%1` is the percentage. */
20
+ uploading: string;
21
+ selectIconify: string;
22
+ iconifyButton: string;
23
+ scale: string;
24
+ offsetX: string;
25
+ offsetY: string;
26
+ rotation: string;
27
+ presets: Record<PhiMaskPreset, string>;
28
+ };
29
+ export declare const PHI_MASK_PICKER_CONTROL_DEFAULT_LABELS: PhiMaskPickerControlLabels;
30
+ /** Fills the `%1` of a mask picker template. */
31
+ export declare function formatPhiMaskPickerLabel(template: string, value: string | number): string;
@@ -0,0 +1,30 @@
1
+ export const PHI_MASK_PICKER_CONTROL_DEFAULT_LABELS = {
2
+ button: "Select mask",
3
+ title: "Mask",
4
+ clear: "Clear mask",
5
+ modePresets: "Presets",
6
+ modeMedia: "Media",
7
+ selectAsset: "Select mask asset",
8
+ upload: "Upload SVG or PNG mask",
9
+ uploading: "Uploading %1%",
10
+ selectIconify: "Select Iconify mask",
11
+ iconifyButton: "Select Iconify icon",
12
+ scale: "Scale",
13
+ offsetX: "Offset X",
14
+ offsetY: "Offset Y",
15
+ rotation: "Rotation",
16
+ presets: {
17
+ circle: "Circle",
18
+ ellipse: "Ellipse",
19
+ triangle: "Triangle",
20
+ diamond: "Diamond",
21
+ hexagon: "Hexagon",
22
+ star: "Star",
23
+ cloud: "Cloud",
24
+ blob: "Blob",
25
+ },
26
+ };
27
+ /** Fills the `%1` of a mask picker template. */
28
+ export function formatPhiMaskPickerLabel(template, value) {
29
+ return template.replace("%1", String(value));
30
+ }
@@ -4,8 +4,8 @@ import { type PhiAreaUploadWidgetLabels } from "../../media/media-widget-labels"
4
4
  * reading of `PHI_MEDIA_UPLOAD_DEFAULT_LABELS`, the same as on every other Media upload surface.
5
5
  *
6
6
  * The drop area's title and hint, the state of an upload and its retry are not written a second time
7
- * either: `upload` is the Media folder's own set (`label-sets/media.ts`), so the two surfaces share one
8
- * wording and one translation key per text.
7
+ * either: `upload` is the Media upload surface's own texts, which are Core's `widget:upload` set
8
+ * (`label-sets/media-upload.ts`), so the two surfaces share one wording and one translation key per text.
9
9
  */
10
10
  export type PhiSlotUploadWidgetLabels = {
11
11
  /** The field names no Add-on, table or slot, so there is nowhere to put a file. */
package/controls.d.ts CHANGED
@@ -40,6 +40,8 @@ export { PhiCollectionViewControl } from "./components/controls/phi-collection-v
40
40
  export type { PhiCollectionViewControlProps } from "./components/controls/phi-collection-view-control";
41
41
  export { PhiMediaAssetCollectionSkeletonControl, PhiMediaAssetTileControl, } from "./components/controls/phi-media-asset-tile-control";
42
42
  export type { PhiMediaAssetCollectionSkeletonControlProps, PhiMediaAssetTileControlProps, } from "./components/controls/phi-media-asset-tile-control";
43
+ export { PhiMediaSourceItemTileControl } from "./components/controls/phi-media-source-item-tile-control";
44
+ export type { PhiMediaSourceItemTileControlProps } from "./components/controls/phi-media-source-item-tile-control";
43
45
  export { PhiVideoEmbedControl } from "./components/controls/phi-video-embed-control";
44
46
  export type { PhiVideoEmbedControlLabels, PhiVideoEmbedControlProps, } from "./components/controls/phi-video-embed-control";
45
47
  export { PhiMaskPickerControl } from "./components/controls/phi-mask-picker-control";
package/controls.js CHANGED
@@ -20,6 +20,7 @@ export { PhiCollectionLayoutControl } from "./components/controls/phi-collection
20
20
  export { PhiCollectionHeaderControl } from "./components/controls/phi-collection-header-control";
21
21
  export { PhiCollectionViewControl } from "./components/controls/phi-collection-view-control";
22
22
  export { PhiMediaAssetCollectionSkeletonControl, PhiMediaAssetTileControl, } from "./components/controls/phi-media-asset-tile-control";
23
+ export { PhiMediaSourceItemTileControl } from "./components/controls/phi-media-source-item-tile-control";
23
24
  export { PhiVideoEmbedControl } from "./components/controls/phi-video-embed-control";
24
25
  export { PhiMaskPickerControl } from "./components/controls/phi-mask-picker-control";
25
26
  export { PhiColorControl } from "./components/controls/phi-color-control";
@@ -32,5 +32,5 @@ export type PhiCmsRegionOwnership = "shell" | "page";
32
32
  * know is not a placement anybody chose -- refusing it would hide Widgets over a typo.
33
33
  */
34
34
  export declare function phiCmsRegionAcceptsWidget(regionKey: string | null | undefined, required: PhiCmsRegionOwnership | null | undefined): boolean;
35
- export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined): 10 | 40 | 12 | 50 | 11 | 20 | 21 | 25 | 30 | 39 | 41;
35
+ export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined): 11 | 10 | 12 | 40 | 50 | 20 | 21 | 25 | 30 | 39 | 41;
36
36
  export declare function resolvePhiCmsRegionKey(regionType: number | null | undefined): "content" | "header_top" | "header_main" | "header_bottom" | "sider_left" | "sider_right" | "hero" | "footer_top" | "footer_main" | "footer_bottom" | "drawer_right" | undefined;
@@ -1,6 +1,7 @@
1
1
  import type { PhiRuntimeModuleControllerClient } from "./components/runtime/runtime-module-controller-client-manifest";
2
2
  import type { PhiRuntimeModuleRenderClient } from "./components/runtime/runtime-module-render-client-manifest";
3
3
  import type { PhiRuntimeModuleId } from "./types/cms-module-descriptors";
4
+ import type { PhiMediaSourceClientDefinition } from "./types/media-source";
4
5
  import type { PhiRuntimeModuleCalendarAdapterClientDefinition, PhiRuntimeModuleDataProviderClientDefinition, PhiRuntimeModuleUiProvider } from "./types/cms-plugins";
5
6
  /**
6
7
  * The live Client contributions of a Module package, exported as `phiModuleClientContributions`.
@@ -15,7 +16,8 @@ import type { PhiRuntimeModuleCalendarAdapterClientDefinition, PhiRuntimeModuleD
15
16
  *
16
17
  * Calendar adapters sit beside the Modules rather than inside them: they are resolved by their type
17
18
  * wherever a Widget renders, and no Area holds a different set. They are stated here so a package has one
18
- * Client entrypoint, and the projection flattens them.
19
+ * Client entrypoint, and the projection flattens them. Media sources are held the same way: the Media
20
+ * picker lists those whose Module is active in the Area it is open in.
19
21
  */
20
22
  export type PhiModuleClientContribution = {
21
23
  moduleId: PhiRuntimeModuleId;
@@ -32,5 +34,7 @@ export type PhiModuleClientContribution = {
32
34
  export type PhiModuleClientContributions = {
33
35
  modules: readonly PhiModuleClientContribution[];
34
36
  calendarAdapters?: readonly PhiRuntimeModuleCalendarAdapterClientDefinition[];
37
+ /** Media sources, beside the Calendar adapters for the same reason: the picker resolves them by key. */
38
+ mediaSources?: readonly PhiMediaSourceClientDefinition[];
35
39
  };
36
40
  export declare function definePhiModuleClientContributions(contributions: PhiModuleClientContributions): PhiModuleClientContributions;
@@ -36,5 +36,6 @@ export function collectPhiSiteModuleClientContributions(input) {
36
36
  return {
37
37
  areas: Object.fromEntries(collected),
38
38
  calendarAdapters: input.clients.flatMap((client) => [...(client.calendarAdapters ?? [])]),
39
+ mediaSources: input.clients.flatMap((client) => [...(client.mediaSources ?? [])]),
39
40
  };
40
41
  }
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "../../plugins/runtime-modules/client-manifests/accounting";
3
+ import { PHI_ACCOUNTING_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, PHI_ACCOUNTING_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, } from "../../plugins/runtime-modules/client-manifests/accounting";
4
4
  import { PhiNextRuntimeModuleClientBoundary } from "../runtime-module-client-boundary";
5
5
  import { extendWithPhiSiteModuleClientManifests, } from "../../plugins/runtime-modules/site-module-client-manifests";
6
6
  import { PHI_NO_SITE_MODULE_CLIENT_CONTRIBUTIONS, } from "../../plugins/runtime-modules/site-modules-client";
@@ -16,10 +16,11 @@ export function createPhiAccountingRuntimeModuleClientBoundary(siteModules = PHI
16
16
  render: PHI_ACCOUNTING_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST,
17
17
  dataProvider: PHI_ACCOUNTING_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST,
18
18
  calendarAdapter: PHI_ACCOUNTING_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST,
19
+ mediaSource: PHI_ACCOUNTING_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST,
19
20
  uiProvider: PHI_ACCOUNTING_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST,
20
21
  });
21
22
  return function PhiAccountingRuntimeModuleClientBoundary({ children, }) {
22
- return (_jsx(PhiNextRuntimeModuleClientBoundary, { calendarAdapterManifest: manifests.calendarAdapter, controllerManifest: manifests.controller, dataProviderManifest: manifests.dataProvider, renderManifest: manifests.render, uiProviderManifest: manifests.uiProvider, children: children }));
23
+ return (_jsx(PhiNextRuntimeModuleClientBoundary, { calendarAdapterManifest: manifests.calendarAdapter, mediaSourceManifest: manifests.mediaSource, controllerManifest: manifests.controller, dataProviderManifest: manifests.dataProvider, renderManifest: manifests.render, uiProviderManifest: manifests.uiProvider, children: children }));
23
24
  };
24
25
  }
25
26
  export const PhiAccountingRuntimeModuleClientBoundary = createPhiAccountingRuntimeModuleClientBoundary();