@phis/ui 0.4.8 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/components/cms/phi-cms-runtime-registry.d.ts +2 -1
  2. package/components/cms/phi-cms-runtime-registry.js +1 -1
  3. package/components/controls/phi-color-control.js +2 -1
  4. package/components/controls/phi-drawer-control-adapter.js +2 -3
  5. package/components/controls/phi-drawer-control.js +3 -3
  6. package/components/controls/phi-dropdown-control.js +2 -1
  7. package/components/controls/phi-float-button-control.js +3 -3
  8. package/components/controls/phi-modal-control-adapter.js +2 -2
  9. package/components/controls/phi-modal-control.js +3 -3
  10. package/components/controls/phi-ribbon-wrap-control.js +2 -1
  11. package/components/controls/phi-zoom-image-overlay.js +11 -5
  12. package/components/forms/content-entry-forms.js +1 -5
  13. package/components/forms/form-descriptor-runtime-client.js +2 -1
  14. package/components/forms/form-descriptor-text.d.ts +17 -0
  15. package/components/forms/form-descriptor-text.js +14 -0
  16. package/components/forms/runtime-form-controller-plugin.d.ts +0 -115
  17. package/components/forms/runtime-form-controller-plugin.js +1 -1
  18. package/components/forms/upload-form-control.d.ts +0 -7
  19. package/components/forms/upload-form-control.js +1 -1
  20. package/components/layouts/clients/phi-collapsible-layout-client.js +2 -1
  21. package/components/layouts/clients/phi-sequence-slot-editor.js +2 -1
  22. package/components/layouts/clients/phi-split-card-half.js +2 -1
  23. package/components/layouts/phi-base-layout.js +2 -1
  24. package/components/layouts/phi-layout-surface-box.js +2 -1
  25. package/components/media/phi-media-picker-server.js +3 -11
  26. package/components/navigation/use-phi-protected-mail.js +1 -9
  27. package/components/regions/presets/clients/sider-context.js +4 -2
  28. package/components/root/phi-config-provider.js +2 -1
  29. package/components/root/phi-dayjs-locale.d.ts +4 -1
  30. package/components/root/phi-dayjs-locale.js +2 -2
  31. package/components/root/phi-intl-locale.d.ts +7 -1
  32. package/components/root/phi-intl-locale.js +20 -15
  33. package/components/root/phi-root-layout.js +2 -1
  34. package/components/runtime/core-runtime-controller-plugin.d.ts +0 -84
  35. package/components/runtime/core-runtime-controller-plugin.js +1 -1
  36. package/components/runtime/runtime-signal-bus.js +39 -4
  37. package/components/state/use-phi-hydrated.d.ts +6 -0
  38. package/components/state/use-phi-hydrated.js +11 -0
  39. package/components/widgets/client/shared/phi-rendered-value.js +4 -3
  40. package/components/widgets/config/parser-primitives.d.ts +5 -0
  41. package/components/widgets/config/parser-primitives.js +11 -0
  42. package/components/widgets/label-sets/runtime-options.d.ts +1 -1
  43. package/components/widgets/server/builder-chrome.js +2 -6
  44. package/components/widgets/server/search.js +2 -6
  45. package/gateway/dashboard-cards-route.js +5 -7
  46. package/gateway/navigation-target-route.js +7 -9
  47. package/gateway/page-references-route.js +6 -8
  48. package/gateway/site-config.js +3 -0
  49. package/gateway/site-proxy.js +13 -2
  50. package/helpers/class-names.d.ts +7 -0
  51. package/helpers/class-names.js +10 -0
  52. package/helpers/cms-navigation-catalog.js +4 -2
  53. package/helpers/cms-page-catalog.js +35 -6
  54. package/helpers/cms-region-keys.d.ts +0 -1
  55. package/helpers/cms-region-keys.js +1 -1
  56. package/helpers/format-date-time.d.ts +14 -3
  57. package/helpers/format-date-time.js +27 -11
  58. package/helpers/region-page-scope.d.ts +1 -3
  59. package/helpers/region-page-scope.js +0 -4
  60. package/helpers/translation-format.d.ts +6 -0
  61. package/helpers/translation-format.js +15 -8
  62. package/package.json +2 -2
  63. package/plugins/runtime/phi-slot-child-frame-view.js +2 -1
  64. package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +1 -1
  65. package/plugins/runtime-modules/admin/forms.js +1 -1
  66. package/plugins/runtime-modules/admin/trees/phi-default-admin-settings-page-tree.js +2 -5
  67. package/plugins/runtime-modules/app/forms.js +1 -1
  68. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +2 -6
  69. package/plugins/runtime-modules/asset/metadata-form.js +2 -6
  70. package/plugins/runtime-modules/asset/settings-forms.js +1 -1
  71. package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +2 -5
  72. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -6
  73. package/plugins/runtime-modules/asset/widgets/area-upload/server.js +2 -6
  74. package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +1 -3
  75. package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -6
  76. package/plugins/runtime-modules/asset/widgets.js +5 -7
  77. package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
  78. package/plugins/runtime-modules/auth/ids.d.ts +7 -7
  79. package/plugins/runtime-modules/auth/ids.js +7 -7
  80. package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +2 -6
  81. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -5
  82. package/plugins/runtime-modules/auth/widgets.d.ts +1 -2
  83. package/plugins/runtime-modules/auth/widgets.js +5 -7
  84. package/plugins/runtime-modules/avatar/overlay-tree.server.js +2 -6
  85. package/plugins/runtime-modules/avatar/widgets/account-avatar/server.js +2 -6
  86. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/server.js +2 -6
  87. package/plugins/runtime-modules/avatar/widgets.js +3 -5
  88. package/plugins/runtime-modules/builder/clients/pages-workspace.d.ts +2 -3
  89. package/plugins/runtime-modules/builder/clients/pages-workspace.js +5 -18
  90. package/plugins/runtime-modules/builder/controller/draft-command-controller.js +1 -0
  91. package/plugins/runtime-modules/builder/controller/page-controller.js +1 -1
  92. package/plugins/runtime-modules/builder/controller/server-definition.js +3 -11
  93. package/plugins/runtime-modules/builder/controller/workspace-controller.js +2 -6
  94. package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +2 -8
  95. package/plugins/runtime-modules/builder/developer-workspace-store.js +24 -44
  96. package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +0 -5
  97. package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +2 -1
  98. package/plugins/runtime-modules/builder/inspector-section-widget.js +6 -31
  99. package/plugins/runtime-modules/builder/navigation-persistence.js +12 -3
  100. package/plugins/runtime-modules/builder/page-meta-form.js +4 -12
  101. package/plugins/runtime-modules/builder/page-presets.server.d.ts +0 -1
  102. package/plugins/runtime-modules/builder/page-presets.server.js +0 -24
  103. package/plugins/runtime-modules/builder/pages-workspace.js +6 -16
  104. package/plugins/runtime-modules/builder/persistence.d.ts +6 -4
  105. package/plugins/runtime-modules/builder/persistence.js +6 -7
  106. package/plugins/runtime-modules/builder/shells-workspace.js +3 -11
  107. package/plugins/runtime-modules/builder/signal-wiring-form.js +3 -7
  108. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +2 -6
  109. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -26
  110. package/plugins/runtime-modules/builder/trees/phi-default-builder-settings-page-tree.js +2 -6
  111. package/plugins/runtime-modules/builder/widgets/developer-builder-pages-header/plugin.js +2 -6
  112. package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.js +2 -6
  113. package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +3 -2
  114. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +1 -6
  115. package/plugins/runtime-modules/builder/widgets.js +10 -12
  116. package/plugins/runtime-modules/contracts.d.ts +15 -1
  117. package/plugins/runtime-modules/contracts.js +10 -0
  118. package/plugins/runtime-modules/core/messaging/forms.js +1 -1
  119. package/plugins/runtime-modules/core/widgets/description/server.js +12 -9
  120. package/plugins/runtime-modules/core/widgets/dimension/plugin.js +2 -6
  121. package/plugins/runtime-modules/core/widgets/draft-status/plugin.js +2 -6
  122. package/plugins/runtime-modules/core/widgets/entry-list/config.js +2 -9
  123. package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +1 -1
  124. package/plugins/runtime-modules/core/widgets/form-preview/client.js +2 -15
  125. package/plugins/runtime-modules/core/widgets/gallery/server.js +2 -6
  126. package/plugins/runtime-modules/core/widgets/image/server.js +2 -6
  127. package/plugins/runtime-modules/core/widgets/length/plugin.js +2 -6
  128. package/plugins/runtime-modules/core/widgets/markdown-toc/plugin.js +2 -6
  129. package/plugins/runtime-modules/core/widgets/page-title/server.js +2 -6
  130. package/plugins/runtime-modules/core/widgets/pagination/config.js +4 -8
  131. package/plugins/runtime-modules/core/widgets/search-results/config.js +2 -8
  132. package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.d.ts +2 -2
  133. package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.js +8 -13
  134. package/plugins/runtime-modules/core/widgets/theme-mode-switch/server.js +2 -6
  135. package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +16 -31
  136. package/plugins/runtime-modules/core/widgets/timeline/client.js +9 -4
  137. package/plugins/runtime-modules/core/widgets/tour-button/server.js +2 -6
  138. package/plugins/runtime-modules/core/widgets.js +59 -61
  139. package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +7 -5
  140. package/plugins/runtime-modules/dashboard/trees/phi-default-admin-dashboard-page-tree.js +2 -6
  141. package/plugins/runtime-modules/dashboard/trees/phi-default-area-dashboard-page-tree.js +2 -6
  142. package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +2 -6
  143. package/plugins/runtime-modules/descriptor-compiler.js +6 -6
  144. package/plugins/runtime-modules/groups/controller/client.d.ts +0 -56
  145. package/plugins/runtime-modules/groups/controller/client.js +1 -1
  146. package/plugins/runtime-modules/groups/forms.js +1 -5
  147. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +2 -6
  148. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -6
  149. package/plugins/runtime-modules/localization/forms.js +2 -6
  150. package/plugins/runtime-modules/localization/services/options.js +19 -9
  151. package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -11
  152. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -11
  153. package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +3 -11
  154. package/plugins/runtime-modules/revisions/forms.js +1 -1
  155. package/plugins/runtime-modules/revisions/services/table.js +6 -2
  156. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
  157. package/plugins/runtime-modules/theme/controller/server-definition.js +2 -6
  158. package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +2 -6
  159. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -21
  160. package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +0 -2
  161. package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +0 -8
  162. package/plugins/runtime-modules/theme/widgets.js +6 -8
  163. package/plugins/runtime-modules/threads/controller/client.d.ts +0 -78
  164. package/plugins/runtime-modules/threads/controller/client.js +1 -1
  165. package/plugins/runtime-modules/threads/forms.js +1 -1
  166. package/plugins/runtime-modules/threads/ids.d.ts +0 -1
  167. package/plugins/runtime-modules/threads/ids.js +0 -2
  168. package/plugins/runtime-modules/user-management/controller/client.d.ts +0 -73
  169. package/plugins/runtime-modules/user-management/controller/client.js +1 -1
  170. package/plugins/runtime-modules/user-management/forms.js +1 -5
  171. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +2 -6
  172. package/plugins/runtime-modules/video/widgets.js +2 -4
  173. package/server-helpers/cms-request.d.ts +19 -0
  174. package/server-helpers/cms-request.js +26 -8
  175. package/server-helpers/cms-root.js +6 -8
  176. package/server-helpers/public-login-route.js +6 -8
  177. package/server-helpers/runtime.js +1 -0
  178. package/server-helpers/search-index.js +34 -14
  179. package/types/length.js +8 -3
  180. package/types/site-config.d.ts +6 -0
  181. package/types/widget-runtime.d.ts +2 -0
  182. package/types.d.ts +5 -3
  183. package/types.js +3 -0
@@ -33,7 +33,7 @@ export function isPhiCmsShellOwnedRegion(regionKey) {
33
33
  export function isPhiCmsPageOwnedRegion(regionKey) {
34
34
  return PHI_CMS_PAGE_OWNED_REGION_KEYS.includes(regionKey);
35
35
  }
36
- export function resolvePhiCmsRegionOwnership(regionKey) {
36
+ function resolvePhiCmsRegionOwnership(regionKey) {
37
37
  if (!regionKey) {
38
38
  return undefined;
39
39
  }
@@ -1,7 +1,18 @@
1
- export declare function formatPhiDate(value: string | null | undefined, locale: string): string;
2
- export declare function formatPhiDateTime(value: string | null | undefined, locale: string): string;
1
+ export declare function formatPhiDate(value: string | null | undefined, locale: string, timeZone: string): string;
2
+ export declare function formatPhiDateTime(value: string | null | undefined, locale: string, timeZone: string): string;
3
+ /**
4
+ * The moment a server render happens, for the Root Layout to hand to `PhiIntlLocaleProvider`.
5
+ *
6
+ * A function and not `Date.now()` in the layout because a render is meant to be pure, and the lint says
7
+ * so; this is the one place the clock is read for a page, and every relative time on it is told this
8
+ * moment rather than its own.
9
+ */
10
+ export declare function readPhiRenderMoment(): number;
3
11
  /**
4
12
  * How long ago or how far ahead, in the locale the caller names: "3 days ago", "in 2 hours". The
5
13
  * largest unit the distance fills, so a moment reads in the words a person would use for it.
14
+ *
15
+ * `now` is the caller's, never read here: a Client component hands over the moment the server rendered
16
+ * the page (`usePhiIntlRenderedAt()`), so the words it hydrates with are the words the server wrote.
6
17
  */
7
- export declare function formatPhiRelativeTime(value: string | null | undefined, locale: string, now?: number): string;
18
+ export declare function formatPhiRelativeTime(value: string | null | undefined, locale: string, now: number): string;
@@ -1,14 +1,17 @@
1
1
  /*
2
- * Formatted in the locale the caller names, never `undefined`: that is the browser's locale in the
3
- * browser and the server's in the server render, and neither is the page's.
2
+ * Formatted in the locale and the time zone the caller names, never `undefined`: that is the browser's
3
+ * in the browser and the server's in the server render, and neither is the page's. The zone is the
4
+ * Site's (`runtime.site.timeZone`, or `usePhiIntlTimeZone()` in a Client component), so that the text
5
+ * the server wrote and the text the browser hydrates it with are one.
4
6
  */
5
7
  const dateFormatters = new Map();
6
8
  const dateTimeFormatters = new Map();
7
- function readFormatter(cache, locale, options) {
8
- let formatter = cache.get(locale);
9
+ function readFormatter(cache, locale, timeZone, options) {
10
+ const key = `${locale}\u0000${timeZone}`;
11
+ let formatter = cache.get(key);
9
12
  if (!formatter) {
10
- formatter = new Intl.DateTimeFormat(locale, options);
11
- cache.set(locale, formatter);
13
+ formatter = new Intl.DateTimeFormat(locale, { ...options, timeZone });
14
+ cache.set(key, formatter);
12
15
  }
13
16
  return formatter;
14
17
  }
@@ -22,16 +25,26 @@ function readPhiDate(value) {
22
25
  }
23
26
  return new Date(timestamp);
24
27
  }
25
- export function formatPhiDate(value, locale) {
28
+ export function formatPhiDate(value, locale, timeZone) {
26
29
  const date = readPhiDate(value);
27
- return date ? readFormatter(dateFormatters, locale, { dateStyle: "medium" }).format(date) : value || "—";
30
+ return date ? readFormatter(dateFormatters, locale, timeZone, { dateStyle: "medium" }).format(date) : value || "—";
28
31
  }
29
- export function formatPhiDateTime(value, locale) {
32
+ export function formatPhiDateTime(value, locale, timeZone) {
30
33
  const date = readPhiDate(value);
31
34
  return date
32
- ? readFormatter(dateTimeFormatters, locale, { dateStyle: "medium", timeStyle: "short" }).format(date)
35
+ ? readFormatter(dateTimeFormatters, locale, timeZone, { dateStyle: "medium", timeStyle: "short" }).format(date)
33
36
  : value || "—";
34
37
  }
38
+ /**
39
+ * The moment a server render happens, for the Root Layout to hand to `PhiIntlLocaleProvider`.
40
+ *
41
+ * A function and not `Date.now()` in the layout because a render is meant to be pure, and the lint says
42
+ * so; this is the one place the clock is read for a page, and every relative time on it is told this
43
+ * moment rather than its own.
44
+ */
45
+ export function readPhiRenderMoment() {
46
+ return Date.now();
47
+ }
35
48
  const relativeFormatters = new Map();
36
49
  const RELATIVE_UNITS = [
37
50
  ["year", 365 * 24 * 60 * 60 * 1000],
@@ -44,8 +57,11 @@ const RELATIVE_UNITS = [
44
57
  /**
45
58
  * How long ago or how far ahead, in the locale the caller names: "3 days ago", "in 2 hours". The
46
59
  * largest unit the distance fills, so a moment reads in the words a person would use for it.
60
+ *
61
+ * `now` is the caller's, never read here: a Client component hands over the moment the server rendered
62
+ * the page (`usePhiIntlRenderedAt()`), so the words it hydrates with are the words the server wrote.
47
63
  */
48
- export function formatPhiRelativeTime(value, locale, now = Date.now()) {
64
+ export function formatPhiRelativeTime(value, locale, now) {
49
65
  const date = readPhiDate(value);
50
66
  if (!date) {
51
67
  return value || "—";
@@ -1,5 +1,5 @@
1
1
  import { type PhiCmsRegionConfig, type PhiCmsRegionKey, type PhiCmsRegionPageScope, type PhiCmsRegionPageScopeEntry, type PhiCmsRegionReveal, type PhiCmsResolvedRegionPageScope } from "../types/cms-presets";
2
- import { type PhiPageReference, type PhiResolvedLinkTargets } from "../types/references";
2
+ import { type PhiResolvedLinkTargets } from "../types/references";
3
3
  /**
4
4
  * The Region's Page scope as stored, or null where it stands on every Page. Only a Shell Region has one:
5
5
  * a Page-owned Region belongs to a single Page already.
@@ -7,8 +7,6 @@ import { type PhiPageReference, type PhiResolvedLinkTargets } from "../types/ref
7
7
  export declare function readPhiCmsRegionPageScope(regionKey: PhiCmsRegionKey, config: PhiCmsRegionConfig | null | undefined): PhiCmsRegionPageScope | null;
8
8
  /** The entries a stored scope names, each read whole; an entry that names nothing is dropped. */
9
9
  export declare function readPhiCmsRegionPageScopeEntries(value: unknown): PhiCmsRegionPageScopeEntry[];
10
- /** The Pages a scope names by reference, for the render that resolves them. */
11
- export declare function collectPhiCmsRegionPageScopeReferences(scope: PhiCmsRegionPageScope | null): PhiPageReference[];
12
10
  /**
13
11
  * The scope as the browser asks it, with every reference turned into the address it leads to now.
14
12
  *
@@ -49,10 +49,6 @@ export function readPhiCmsRegionPageScopeEntries(value) {
49
49
  return folder == null ? [] : [{ folder }];
50
50
  });
51
51
  }
52
- /** The Pages a scope names by reference, for the render that resolves them. */
53
- export function collectPhiCmsRegionPageScopeReferences(scope) {
54
- return (scope?.entries ?? []).flatMap((entry) => "pageLinkTarget" in entry && entry.pageLinkTarget.kind === "page" ? [entry.pageLinkTarget.reference] : []);
55
- }
56
52
  /**
57
53
  * The scope as the browser asks it, with every reference turned into the address it leads to now.
58
54
  *
@@ -1,3 +1,9 @@
1
1
  export type PhiTranslationParamValue = string | number;
2
2
  export type PhiTranslationParams = Record<string, PhiTranslationParamValue> | PhiTranslationParamValue[] | PhiTranslationParamValue | 0 | undefined;
3
+ /**
4
+ * Read in one pass rather than token by token, as `resolvePhiTextPlaceholders` reads: `%1` is the start
5
+ * of `%10`, so replacing one token after another ate the tenth value's token with the first's, and a
6
+ * value that itself contained `%2` was replaced again by the next step. A token nothing answers stays
7
+ * as it is.
8
+ */
3
9
  export declare function formatPhiTranslation(input: string, params?: PhiTranslationParams): string;
@@ -1,18 +1,25 @@
1
+ /** `%1`, `%2`, … (one-based) and `{0}`, `{1}`, … (zero-based) name a position; `{key}` names a key. */
2
+ const INDEXED_TOKEN_PATTERN = /%(\d+)|\{(\d+)\}/g;
3
+ const NAMED_TOKEN_PATTERN = /\{([^{}]+)\}/g;
4
+ /**
5
+ * Read in one pass rather than token by token, as `resolvePhiTextPlaceholders` reads: `%1` is the start
6
+ * of `%10`, so replacing one token after another ate the tenth value's token with the first's, and a
7
+ * value that itself contained `%2` was replaced again by the next step. A token nothing answers stays
8
+ * as it is.
9
+ */
1
10
  export function formatPhiTranslation(input, params = 0) {
2
11
  if (!params) {
3
12
  return input;
4
13
  }
5
14
  const text = String(input);
6
15
  if (Array.isArray(params)) {
7
- return params.reduce((current, value, index) => {
8
- const tokenIndex = index + 1;
9
- return current
10
- .replaceAll(`%${tokenIndex}`, String(value))
11
- .replaceAll(`{${index}}`, String(value));
12
- }, text);
16
+ return text.replace(INDEXED_TOKEN_PATTERN, (token, position, index) => {
17
+ const at = position !== undefined ? Number(position) - 1 : Number(index);
18
+ return at >= 0 && at < params.length ? String(params[at]) : token;
19
+ });
13
20
  }
14
21
  if (typeof params === "object") {
15
- return Object.entries(params).reduce((current, [key, value]) => current.replaceAll(`{${key}}`, String(value)), text);
22
+ return text.replace(NAMED_TOKEN_PATTERN, (token, key) => Object.prototype.hasOwnProperty.call(params, key) ? String(params[key]) : token);
16
23
  }
17
- return text.replaceAll("%1", String(params)).replaceAll("{0}", String(params));
24
+ return text.replace(INDEXED_TOKEN_PATTERN, (token, position, index) => position === "1" || index === "0" ? String(params) : token);
18
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.4.8",
3
+ "version": "0.4.10",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -503,7 +503,7 @@
503
503
  "@lexical/rich-text": "0.50.0",
504
504
  "@lexical/selection": "0.50.0",
505
505
  "@lexical/utils": "0.50.0",
506
- "@phis/contracts": "^0.7.3",
506
+ "@phis/contracts": "^0.7.5",
507
507
  "dayjs": "^1.11.23",
508
508
  "dom-serializer": "^2.0.0",
509
509
  "htmlparser2": "^10.1.0",
@@ -6,6 +6,7 @@ import { PhiSurfaceGroundLayer } from "../../components/surface/phi-surface-grou
6
6
  import { PhiSurfaceTone } from "../../components/surface/phi-surface-tone";
7
7
  import { buildPhiSlotChildClassName, buildPhiSlotChildDataAttributes, resolvePhiEffectiveSlotSizePolicy, resolvePhiSlotChildBaseStyle, resolvePhiSlotChildExplicitAxes, resolvePhiSlotChildSizeConstraints, resolvePhiSlotChildSizeStyle, resolvePhiSlotSizePolicy, } from "./slot-size-policy";
8
8
  import { resolvePhiRenderableBlockGeometry } from "../../types/renderable-block-geometry";
9
+ import { joinPhiClassNames } from "../../helpers/class-names";
9
10
  export function requiresPhiSlotChildEffectsObserver(config, disableEffects = false) {
10
11
  if (disableEffects) {
11
12
  return false;
@@ -42,7 +43,7 @@ export function PhiSlotChildFrameView({ kind, slotSizePolicy, surfacePolicy, blo
42
43
  const surface = kind === "widget" && surfacePolicy === "frame"
43
44
  ? resolvePhiSurfaceStyle(resolvedConfig.surface, { cornerFallback: PHI_LAYOUT_SURFACE_RADIUS })
44
45
  : null;
45
- return (_jsxs("div", { ref: anchorRef, hidden: resolvedVisibility === "hidden", className: [buildPhiSlotChildClassName(policy), className, resolvedConfig.className, surface?.className].filter(Boolean).join(" "), "data-phi-slot-child-frame": "true", "data-phi-renderable-block": "true", "data-phi-slot-child-kind": kind, "data-phi-block-id": blockId ?? undefined, "data-phi-signal-receiver": receiver ?? undefined, "data-phi-block-render-mode": resolvedConfig.renderMode, "data-phi-block-visibility": resolvedVisibility, "data-phi-viewport-flags": resolvedConfig.viewportFlags || undefined, "data-phi-block-enabled": resolvedEnabled ? "true" : "false", "data-phi-debug-scaffold": resolvedConfig.debugMode ? "on" : undefined, "data-phi-builder-widget-title": builderWidgetTitle?.trim() || undefined, "data-phi-builder-widget-selected": builderWidgetSelected ? "true" : undefined, "data-phi-builder-popup-open": builderWidgetPopupOpen ? "true" : undefined, ...effectsAttributes, "data-phi-effects-state": effectsState ?? effectsAttributes?.["data-phi-effects-state"], ...buildPhiSlotChildDataAttributes(policy, {
46
+ return (_jsxs("div", { ref: anchorRef, hidden: resolvedVisibility === "hidden", className: joinPhiClassNames(buildPhiSlotChildClassName(policy), className, resolvedConfig.className, surface?.className), "data-phi-slot-child-frame": "true", "data-phi-renderable-block": "true", "data-phi-slot-child-kind": kind, "data-phi-block-id": blockId ?? undefined, "data-phi-signal-receiver": receiver ?? undefined, "data-phi-block-render-mode": resolvedConfig.renderMode, "data-phi-block-visibility": resolvedVisibility, "data-phi-viewport-flags": resolvedConfig.viewportFlags || undefined, "data-phi-block-enabled": resolvedEnabled ? "true" : "false", "data-phi-debug-scaffold": resolvedConfig.debugMode ? "on" : undefined, "data-phi-builder-widget-title": builderWidgetTitle?.trim() || undefined, "data-phi-builder-widget-selected": builderWidgetSelected ? "true" : undefined, "data-phi-builder-popup-open": builderWidgetPopupOpen ? "true" : undefined, ...effectsAttributes, "data-phi-effects-state": effectsState ?? effectsAttributes?.["data-phi-effects-state"], ...buildPhiSlotChildDataAttributes(policy, {
46
47
  explicitInlineSize: resolvedExplicitInlineSize,
47
48
  explicitBlockSize: resolvedExplicitBlockSize,
48
49
  ...resolvePhiSlotChildSizeConstraints(geometry),
@@ -153,7 +153,7 @@ export function PhiSlotChildViewportEffectsObserver({ effects, }) {
153
153
  }
154
154
  }, { rootMargin: "50% 50% 50% 50%", threshold: 0 });
155
155
  const handleScrollOrResize = () => scheduleUpdate();
156
- target.style.setProperty("--phi-stableEffects-viewport-scale", "1");
156
+ target.style.setProperty("--phi-effects-viewport-scale", "1");
157
157
  observer.observe(target);
158
158
  window.addEventListener("scroll", handleScrollOrResize, { passive: true });
159
159
  window.addEventListener("resize", handleScrollOrResize);
@@ -4,6 +4,7 @@ import { createPhiFormId } from "../../../types/form-id";
4
4
  import { PHI_SHARED_PACKAGE_NAME } from "../../../types/signals";
5
5
  import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS, createPhiSharedFormProviderKey, } from "../../../components/forms/form-provider-contract";
6
6
  import { definePhiRuntimeModuleForm } from "../../../components/forms/form-registry";
7
+ import { phiFormLabel as label } from "../../../components/forms/form-descriptor-text";
7
8
  export const PHI_ADMIN_SETTINGS_FORM_IDS = {
8
9
  general: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "admin/settings-general"),
9
10
  };
@@ -11,7 +12,6 @@ const PHI_ADMIN_SETTINGS_FORM_HANDLER_KEYS = {
11
12
  general: "site.admin.settings",
12
13
  };
13
14
  const LABEL_SET_KEY = "@phis/ui/modules/admin/labels/settings";
14
- const label = (key, fallback) => ({ kind: "label", key, fallback });
15
15
  const required = (key, fallback) => ({
16
16
  providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.required,
17
17
  message: label(key, fallback),
@@ -5,15 +5,12 @@ import { getPhiAdminSettingsWidgetLabels } from "../../../../components/widgets/
5
5
  import { getPhiAdminSettingsPageLabels } from "./admin-settings-label-set";
6
6
  import { buildPhiSettingsPageShellTree } from "../../../../components/regions/presets/phi-settings-page-shell-tree";
7
7
  import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
8
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
8
9
  const SYNTHETIC_ADMIN_SETTINGS_REGION_IDS = {
9
10
  regionContent: -471,
10
11
  };
11
12
  export async function buildPhiDefaultAdminSettingsPageTree({ page, runtime, }) {
12
- const labelOptions = {
13
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
14
- internalToken: readPhiServerApiCredentials().internalToken,
15
- locale: runtime.locale.current,
16
- };
13
+ const labelOptions = buildPhiWidgetLabelTranslatorOptions(runtime);
17
14
  const [pageLabels, labels, settings] = await Promise.all([
18
15
  getPhiAdminSettingsPageLabels(labelOptions),
19
16
  getPhiAdminSettingsWidgetLabels(labelOptions),
@@ -5,6 +5,7 @@ import { PHI_FORM_FIELD_PROVIDER_KEYS, createPhiSharedFormProviderKey, } from ".
5
5
  import { PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS } from "../../../constants/core-data-provider-keys";
6
6
  import { definePhiRuntimeModuleForm } from "../../../components/forms/form-registry";
7
7
  import { PHI_APP_RUNTIME_MODULE_ID } from "./ids";
8
+ import { phiFormLabel as label } from "../../../components/forms/form-descriptor-text";
8
9
  /**
9
10
  * What a signed-in person can settle about their own account, as Forms rather than as Widgets.
10
11
  *
@@ -33,7 +34,6 @@ const NAME_LABEL_SET_KEY = "@phis/ui/modules/app/labels/profile-name";
33
34
  const NEWSLETTER_LABEL_SET_KEY = "@phis/ui/modules/app/labels/profile-newsletter";
34
35
  const LOCALE_LABEL_SET_KEY = "@phis/ui/modules/app/labels/profile-locale";
35
36
  const THEME_LABEL_SET_KEY = "@phis/ui/modules/app/labels/profile-theme";
36
- const label = (key, fallback) => ({ kind: "label", key, fallback });
37
37
  const nameDescriptor = {
38
38
  schemaVersion: 1,
39
39
  key: PHI_APP_FORM_IDS.profileName,
@@ -5,7 +5,7 @@ import { getPhiProfilePageLabels } from "./profile-label-set";
5
5
  import { getPhiProfileLocaleWidgetLabels, getPhiProfileThemeWidgetLabels, } from "../../../../components/widgets/label-sets/profile";
6
6
  import { PHI_SITE_LOCALES_CONFIG_KEY } from "../../../../components/forms/site-locales-config";
7
7
  import { createPhiCoreRuntimeControllerAddress } from "../../../../components/runtime/core-runtime-controller-address";
8
- import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
8
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
9
9
  const REGION_CONTENT_ID = -286;
10
10
  /**
11
11
  * What the account says about itself, as Settings panels rather than as a page of Widgets.
@@ -24,11 +24,7 @@ const REGION_CONTENT_ID = -286;
24
24
  * the third answer lives -- "System", which no switch can state.
25
25
  */
26
26
  export async function buildPhiDefaultAppProfilePageTree({ page, runtime, }) {
27
- const labelOptions = {
28
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
29
- internalToken: readPhiServerApiCredentials().internalToken,
30
- locale: runtime.locale.current,
31
- };
27
+ const labelOptions = buildPhiWidgetLabelTranslatorOptions(runtime);
32
28
  const [labels, localeLabels, themeLabels] = await Promise.all([
33
29
  getPhiProfilePageLabels(labelOptions),
34
30
  getPhiProfileLocaleWidgetLabels(labelOptions),
@@ -3,21 +3,17 @@ import { PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS } from "./ids";
3
3
  import { PHI_ASSET_RUNTIME_MODULE_ID } from "./ids";
4
4
  import { createPhiFormId } from "../../../types/form-id";
5
5
  import { PHI_SHARED_PACKAGE_NAME } from "../../../types/signals";
6
- import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS, createPhiSharedFormProviderKey, } from "../../../components/forms/form-provider-contract";
6
+ import { PHI_FORM_FIELD_PROVIDER_KEYS, createPhiSharedFormProviderKey, } from "../../../components/forms/form-provider-contract";
7
7
  import { definePhiRuntimeModuleForm } from "../../../components/forms/form-registry";
8
8
  import { flattenPhiFormLabels } from "../../../components/forms/form-labels";
9
9
  import { PHI_ASSET_FOCAL_RECT_FORM_PROVIDER_KEY } from "./form-providers";
10
10
  import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
11
+ import { phiFormLabel as label, phiFormRequired as required } from "../../../components/forms/form-descriptor-text";
11
12
  export const PHI_ASSET_METADATA_FORM_ID = createPhiFormId(PHI_SHARED_PACKAGE_NAME, "asset/metadata");
12
13
  export const PHI_ASSET_FOLDER_FORM_ID = createPhiFormId(PHI_SHARED_PACKAGE_NAME, "asset/folder-create");
13
14
  const PHI_ASSET_METADATA_FORM_HANDLER_KEY = "site.asset.metadata.update";
14
15
  const PHI_ASSET_FOLDER_FORM_HANDLER_KEY = "site.asset.folder.create";
15
16
  const PHI_ASSET_FORM_LABEL_SET_KEY = "@phis/ui/modules/asset/labels/metadata";
16
- const label = (key, fallback) => ({ kind: "label", key, fallback });
17
- const required = (key, fallback) => [{
18
- providerKey: PHI_FORM_VALIDATION_PROVIDER_KEYS.required,
19
- message: label(key, fallback),
20
- }];
21
17
  const flagOptions = [
22
18
  [PhiMediaAssetFlags.Featured, "featuredFlagLabel", "Featured"],
23
19
  [PhiMediaAssetFlags.Locked, "lockedFlagLabel", "Locked"],
@@ -6,6 +6,7 @@ import { flattenPhiFormLabels } from "../../../components/forms/form-labels";
6
6
  import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS, createPhiSharedFormProviderKey, } from "../../../components/forms/form-provider-contract";
7
7
  import { definePhiRuntimeModuleForm } from "../../../components/forms/form-registry";
8
8
  import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
9
+ import { phiFormLabel as label } from "../../../components/forms/form-descriptor-text";
9
10
  export const PHI_MEDIA_SETTINGS_FORM_IDS = {
10
11
  general: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "asset/media-settings"),
11
12
  };
@@ -13,7 +14,6 @@ const PHI_MEDIA_SETTINGS_FORM_HANDLER_KEYS = {
13
14
  general: "site.admin.media-settings",
14
15
  };
15
16
  const LABEL_SET_KEY = "@phis/ui/modules/asset/labels/settings";
16
- const label = (key, fallback) => ({ kind: "label", key, fallback });
17
17
  const PHI_MEDIA_SETTINGS_FORM_DESCRIPTOR = {
18
18
  schemaVersion: 1,
19
19
  key: PHI_MEDIA_SETTINGS_FORM_IDS.general,
@@ -5,6 +5,7 @@ import { getResolvedSiteMediaSettings } from "../../../../gateway/site-media-set
5
5
  import { buildPhiSettingsPageShellTree } from "../../../../components/regions/presets/phi-settings-page-shell-tree";
6
6
  import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
7
7
  import { PHI_STORAGE_SIZE_UNIT_LABEL, phiBytesToStorageSize } from "../../../../components/forms/storage-size";
8
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
8
9
  function formatMegabytes(bytes) {
9
10
  const size = phiBytesToStorageSize(bytes);
10
11
  return size == null ? "—" : `${size} ${PHI_STORAGE_SIZE_UNIT_LABEL}`;
@@ -14,11 +15,7 @@ const SYNTHETIC_MEDIA_SETTINGS_REGION_IDS = {
14
15
  };
15
16
  export async function buildPhiDefaultAdminMediaSettingsPageTree({ page, runtime, }) {
16
17
  const [labels, settings] = await Promise.all([
17
- getPhiMediaSettingsPageLabels({
18
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
19
- internalToken: readPhiServerApiCredentials().internalToken,
20
- locale: runtime.locale.current,
21
- }),
18
+ getPhiMediaSettingsPageLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
22
19
  getResolvedSiteMediaSettings({
23
20
  apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
24
21
  internalToken: readPhiServerApiCredentials().internalToken,
@@ -3,7 +3,6 @@ import { PhiCmsFlags, PhiCmsRegionType, PhiCmsStatus } from "../../../../constan
3
3
  import { PhiMediaKind } from "../../../../constants/media";
4
4
  import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
5
5
  import { resolvePhiShellHeaderHeight } from "../../../../helpers/shell-region-style";
6
- import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
7
6
  import { PHI_SIGNAL_VALUE_SCHEMAS, createPhiSignalAddress, createPhiSignalSubcontrolAddress, } from "../../../../types";
8
7
  import { PHI_SPACE } from "../../../../theme/antd-css-var-contract";
9
8
  import { getPhiBuilderChromeWidgetLabels } from "../../../../components/widgets/label-sets/builder-chrome";
@@ -14,6 +13,7 @@ import { PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
14
13
  import { PHI_ASSET_FOLDER_FORM_ID, PHI_ASSET_METADATA_FORM_ID } from "../metadata-form";
15
14
  import { PHI_ASSET_INSPECTOR_LAYOUT_IDS, PHI_ASSET_INSPECTOR_OVERLAY_IDS, PHI_ASSET_INSPECTOR_WIDGET_IDS, PHI_ASSET_MEDIA_PAGE_LAYOUT_IDS, PHI_ASSET_MEDIA_PAGE_WIDGET_IDS, } from "../media-page-ids";
16
15
  import { PHI_DIALOG_BLEED_BODY_CONFIG, PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../../helpers/cms-dialog";
16
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
17
17
  const PHI_ASSET_MEDIA_PAGE_REGION_IDS = {
18
18
  regionHeaderBottom: -511,
19
19
  regionContent: -513,
@@ -29,11 +29,7 @@ const PHI_ASSET_MEDIA_PAGE_REGION_IDS = {
29
29
  */
30
30
  export async function buildPhiDefaultBuilderMediaPageTree({ page, runtime, }) {
31
31
  const nodes = createPhiCmsPresetNodes(page);
32
- const credentials = {
33
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
34
- internalToken: readPhiServerApiCredentials().internalToken,
35
- locale: runtime.locale.current,
36
- };
32
+ const credentials = buildPhiWidgetLabelTranslatorOptions(runtime);
37
33
  const [chromeLabels, mediaLabels] = await Promise.all([
38
34
  getPhiBuilderChromeWidgetLabels(credentials),
39
35
  getPhiMediaWidgetLabels(credentials),
@@ -2,12 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getPhiMediaWidgetLabels } from "../../../../../components/media/label-sets/media";
3
3
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
4
4
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
5
- import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
5
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
6
6
  export async function PhiAreaUploadWidgetServer({ runtime, config, }) {
7
- const labels = await getPhiMediaWidgetLabels({
8
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
9
- internalToken: readPhiServerApiCredentials().internalToken,
10
- locale: runtime.locale.current,
11
- });
7
+ const labels = await getPhiMediaWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
12
8
  return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.AreaUpload, componentProps: { labels: labels.upload, config } }));
13
9
  }
@@ -3,6 +3,4 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { createPhiCmsBuilderWidgetPlugin } from "../../../../../plugins/factories/widget-builder-plugin";
4
4
  import { PHI_IMAGE_INSPECTOR_WIDGET_DEFINITION } from "../../../../../plugins/runtime-modules/asset/widgets/image-inspector/config";
5
5
  import { PhiWidgetEditorPlaceholder } from "../../../../../components/widgets/builder/widget-editor-placeholder";
6
- export const PHI_IMAGE_INSPECTOR_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(PHI_IMAGE_INSPECTOR_WIDGET_DEFINITION, ({ widget, config }) => (_jsx(PhiWidgetEditorPlaceholder, { widget: widget, pluginTitle: PHI_IMAGE_INSPECTOR_WIDGET_DEFINITION.title, summary: config.scopeKey
7
- ? `Scope: ${config.scopeKey}`
8
- : "Builder preview for the asset inspector." })));
6
+ export const PHI_IMAGE_INSPECTOR_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(PHI_IMAGE_INSPECTOR_WIDGET_DEFINITION, ({ widget }) => (_jsx(PhiWidgetEditorPlaceholder, { widget: widget, pluginTitle: PHI_IMAGE_INSPECTOR_WIDGET_DEFINITION.title, summary: "Builder preview for the asset inspector." })));
@@ -2,13 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { getPhiMediaWidgetLabels } from "../../../../../components/media/label-sets/media";
3
3
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
4
4
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
5
- import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
5
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
6
6
  export async function PhiAssetConfigWidgetServer({ runtime, config, }) {
7
- const labels = await getPhiMediaWidgetLabels({
8
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
9
- internalToken: readPhiServerApiCredentials().internalToken,
10
- locale: runtime.locale.current,
11
- });
7
+ const labels = await getPhiMediaWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
12
8
  return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.ImageInspector, componentProps: {
13
9
  labels: { inspector: labels.inspector, editor: labels.editor },
14
10
  config,
@@ -3,32 +3,30 @@ import { PHI_AREA_UPLOAD_WIDGET_DEFINITION, } from "./widgets/area-upload/config
3
3
  import { PHI_IMAGE_INSPECTOR_WIDGET_DEFINITION, } from "./widgets/image-inspector/config";
4
4
  import { PHI_ASSET_FOCAL_RECT_WIDGET_DEFINITION, } from "./widgets/asset-focal-rect/config";
5
5
  import { PHI_MEDIA_PICKER_WIDGET_DEFINITION, } from "./widgets/media-picker/config";
6
- function defineFirstPartyWidget(options) {
7
- return options;
8
- }
6
+ import { definePhiFirstPartyWidget } from "../contracts";
9
7
  export const PHI_RUNTIME_MODULE_WIDGETS = [
10
- defineFirstPartyWidget({
8
+ definePhiFirstPartyWidget({
11
9
  definition: PHI_AREA_UPLOAD_WIDGET_DEFINITION,
12
10
  ownerModuleId: PHI_ASSET_RUNTIME_MODULE_ID,
13
11
  renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
14
12
  loadRuntime: () => import("./widgets/area-upload/plugin").then((module) => module.PHI_AREA_UPLOAD_WIDGET_PLUGIN),
15
13
  loadPreview: () => import("./widgets/area-upload/plugin").then((module) => module.PHI_AREA_UPLOAD_WIDGET_PLUGIN),
16
14
  }),
17
- defineFirstPartyWidget({
15
+ definePhiFirstPartyWidget({
18
16
  definition: PHI_IMAGE_INSPECTOR_WIDGET_DEFINITION,
19
17
  ownerModuleId: PHI_ASSET_RUNTIME_MODULE_ID,
20
18
  renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
21
19
  loadRuntime: () => import("./widgets/image-inspector/plugin").then((module) => module.PHI_IMAGE_INSPECTOR_WIDGET_PLUGIN),
22
20
  loadPreview: () => import("./widgets/image-inspector/plugin").then((module) => module.PHI_IMAGE_INSPECTOR_WIDGET_PLUGIN),
23
21
  }),
24
- defineFirstPartyWidget({
22
+ definePhiFirstPartyWidget({
25
23
  definition: PHI_ASSET_FOCAL_RECT_WIDGET_DEFINITION,
26
24
  ownerModuleId: PHI_ASSET_RUNTIME_MODULE_ID,
27
25
  renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
28
26
  loadRuntime: () => import("./widgets/asset-focal-rect/plugin").then((module) => module.PHI_ASSET_FOCAL_RECT_WIDGET_PLUGIN),
29
27
  loadPreview: () => import("./widgets/asset-focal-rect/plugin").then((module) => module.PHI_ASSET_FOCAL_RECT_WIDGET_PLUGIN),
30
28
  }),
31
- defineFirstPartyWidget({
29
+ definePhiFirstPartyWidget({
32
30
  definition: PHI_MEDIA_PICKER_WIDGET_DEFINITION,
33
31
  ownerModuleId: PHI_ASSET_RUNTIME_MODULE_ID,
34
32
  renderPolicies: { "runtime": "custom", "preview": "custom", "authoring": "custom" },
@@ -6,6 +6,7 @@ import { flattenPhiFormLabels } from "../../../components/forms/form-labels";
6
6
  import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS, } from "../../../components/forms/form-provider-contract";
7
7
  import { definePhiRuntimeModuleForm } from "../../../components/forms/form-registry";
8
8
  import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
9
+ import { phiFormLabel as label } from "../../../components/forms/form-descriptor-text";
9
10
  export const PHI_AUTH_ADMIN_SETTINGS_FORM_IDS = {
10
11
  policy: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "auth/admin-policy"),
11
12
  passwordMethod: createPhiFormId(PHI_SHARED_PACKAGE_NAME, "auth/admin-password-method"),
@@ -21,7 +22,6 @@ const PHI_AUTH_ADMIN_SETTINGS_FORM_HANDLER_KEYS = {
21
22
  installationUpdate: "auth.admin.installation-update",
22
23
  };
23
24
  const LABEL_SET_KEY = "@phis/ui/modules/auth/labels/admin-settings";
24
- const label = (key, fallback) => ({ kind: "label", key, fallback });
25
25
  const FORM_LAYOUT = {
26
26
  columns: { compact: 1, medium: 1, wide: 1 },
27
27
  gap: { compact: "sm", medium: "base" },
@@ -8,13 +8,6 @@ export declare const PHI_AUTH_RUNTIME_MODULE_ID: "@phis/ui/modules/auth";
8
8
  export declare const PHI_AUTH_RUNTIME_MODULE_IDENTITY: {
9
9
  readonly moduleId: "@phis/ui/modules/auth";
10
10
  };
11
- /**
12
- * The route preset the Public login Page is: what the Area access guard looks up in the active route
13
- * table to learn where signing in is answered on this Site. The identity lives in the Foundation
14
- * (`constants/public-login-route.ts`) because the guard may not import this Module; the key is read from
15
- * there so the Module's route and the guard's lookup are one statement. The path is the Site's to assign.
16
- */
17
- export declare const PHI_AUTH_PUBLIC_LOGIN_ROUTE_PRESET_KEY: "public-login-page";
18
11
  export declare const PHI_AUTH_RUNTIME_DATA_PROVIDER_KEYS: {
19
12
  readonly installations: `${string}/${string}`;
20
13
  };
@@ -25,3 +18,10 @@ export declare const PHI_AUTH_RUNTIME_DATA_PROVIDER_KEYS: {
25
18
  * namespace on every render and loads the resolver only where a page asks about it.
26
19
  */
27
20
  export declare const PHI_AUTH_RUNTIME_MODULE_FEATURE_NAMESPACE = "auth";
21
+ /**
22
+ * The route preset the Public login Page is: what the Area access guard looks up in the active route
23
+ * table to learn where signing in is answered on this Site. The identity lives in the Foundation
24
+ * (`constants/public-login-route.ts`) because the guard may not import this Module; the key is read from
25
+ * there so the Module's route and the guard's lookup are one statement. The path is the Site's to assign.
26
+ */
27
+ export declare const PHI_AUTH_PUBLIC_LOGIN_ROUTE_PRESET_KEY: "public-login-page";
@@ -11,13 +11,6 @@ export const PHI_AUTH_RUNTIME_MODULE_ID = `${PHI_SHARED_PACKAGE_NAME}/modules/au
11
11
  export const PHI_AUTH_RUNTIME_MODULE_IDENTITY = {
12
12
  moduleId: PHI_AUTH_RUNTIME_MODULE_ID,
13
13
  };
14
- /**
15
- * The route preset the Public login Page is: what the Area access guard looks up in the active route
16
- * table to learn where signing in is answered on this Site. The identity lives in the Foundation
17
- * (`constants/public-login-route.ts`) because the guard may not import this Module; the key is read from
18
- * there so the Module's route and the guard's lookup are one statement. The path is the Site's to assign.
19
- */
20
- export const PHI_AUTH_PUBLIC_LOGIN_ROUTE_PRESET_KEY = PHI_PUBLIC_LOGIN_ROUTE_IDENTITY.presetKey;
21
14
  export const PHI_AUTH_RUNTIME_DATA_PROVIDER_KEYS = {
22
15
  installations: createPhiSharedRuntimeDataProviderKey("tables", "auth-installations"),
23
16
  };
@@ -28,3 +21,10 @@ export const PHI_AUTH_RUNTIME_DATA_PROVIDER_KEYS = {
28
21
  * namespace on every render and loads the resolver only where a page asks about it.
29
22
  */
30
23
  export const PHI_AUTH_RUNTIME_MODULE_FEATURE_NAMESPACE = "auth";
24
+ /**
25
+ * The route preset the Public login Page is: what the Area access guard looks up in the active route
26
+ * table to learn where signing in is answered on this Site. The identity lives in the Foundation
27
+ * (`constants/public-login-route.ts`) because the guard may not import this Module; the key is read from
28
+ * there so the Module's route and the guard's lookup are one statement. The path is the Site's to assign.
29
+ */
30
+ export const PHI_AUTH_PUBLIC_LOGIN_ROUTE_PRESET_KEY = PHI_PUBLIC_LOGIN_ROUTE_IDENTITY.presetKey;
@@ -6,8 +6,8 @@ import { getPhiLoginFormLabels } from "../../../../components/widgets/label-sets
6
6
  import { createPhiAuthControllerAddress, PHI_AUTH_CONTROLLER_TYPE } from "../controller/address";
7
7
  import { createPhiRuntimeFormControllerAddress } from "../../../../components/forms/runtime-form-controller-address";
8
8
  import { PHI_AUTH_LOGIN_OVERLAY_IDS, } from "../overlay-ids";
9
- import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
10
9
  import { PHI_DIALOG_BODY_CONFIG } from "../../../../helpers/cms-dialog";
10
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
11
11
  export async function buildPhiAuthAreaLoginOverlayTree({ page, runtime, area, }) {
12
12
  const ids = PHI_AUTH_LOGIN_OVERLAY_IDS[area];
13
13
  const login = buildPhiLoginNodes({
@@ -18,11 +18,7 @@ export async function buildPhiAuthAreaLoginOverlayTree({ page, runtime, area, })
18
18
  locale: runtime.locale.current,
19
19
  authControllerAddress: createPhiAuthControllerAddress(),
20
20
  });
21
- const labels = await getPhiLoginFormLabels({
22
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
23
- internalToken: readPhiServerApiCredentials().internalToken,
24
- locale: runtime.locale.current,
25
- });
21
+ const labels = await getPhiLoginFormLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
26
22
  const nodes = createPhiCmsPresetNodes(page);
27
23
  const overlayAddress = createPhiSignalAddress("cms", ids.overlayLogin);
28
24
  return {
@@ -7,16 +7,13 @@ import { createPhiPresetCmsInstanceIdMap } from "../../../../types/cms-instance-
7
7
  import { PHI_SIGNAL_VALUE_SCHEMAS, createPhiSignalAddress } from "../../../../types/signals";
8
8
  import { buildPhiSettingsPageShellTree } from "../../../../components/regions/presets/phi-settings-page-shell-tree";
9
9
  import { readPhiServerApiCredentials } from "../../../../helpers/phis-server-credentials";
10
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
10
11
  const SYNTHETIC_AUTH_SETTINGS_REGION_IDS = {
11
12
  regionContent: -482,
12
13
  };
13
14
  export async function buildPhiDefaultAdminAuthSettingsPageTree({ page, runtime, }) {
14
15
  const [labels, settings] = await Promise.all([
15
- getPhiAuthAdminSettingsLabels({
16
- apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
17
- internalToken: readPhiServerApiCredentials().internalToken,
18
- locale: runtime.locale.current,
19
- }),
16
+ getPhiAuthAdminSettingsLabels(buildPhiWidgetLabelTranslatorOptions(runtime)),
20
17
  getResolvedSiteAuthAdminSettings({
21
18
  apiBaseUrl: readPhiServerApiCredentials().apiBaseUrl,
22
19
  internalToken: readPhiServerApiCredentials().internalToken,
@@ -1,2 +1 @@
1
- import type { PhiRuntimeModuleWidgetDefinition } from "../contracts";
2
- export declare const PHI_AUTH_RUNTIME_MODULE_WIDGETS: readonly [PhiRuntimeModuleWidgetDefinition, PhiRuntimeModuleWidgetDefinition, PhiRuntimeModuleWidgetDefinition, PhiRuntimeModuleWidgetDefinition];
1
+ export declare const PHI_AUTH_RUNTIME_MODULE_WIDGETS: readonly [import("../contracts").PhiRuntimeModuleWidgetDefinition, import("../contracts").PhiRuntimeModuleWidgetDefinition, import("../contracts").PhiRuntimeModuleWidgetDefinition, import("../contracts").PhiRuntimeModuleWidgetDefinition];