@phis/ui 0.6.4 → 0.6.6

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 (192) hide show
  1. package/components/cms/phi-cms-layout-renderer.js +11 -2
  2. package/components/controls/phi-image-control.js +9 -1
  3. package/components/controls/phi-multi-select-control.js +4 -2
  4. package/components/controls/phi-options-provider.d.ts +1 -0
  5. package/components/controls/phi-options-provider.js +1 -0
  6. package/components/controls/phi-select-control.d.ts +21 -0
  7. package/components/controls/phi-select-control.js +2 -2
  8. package/components/controls/phi-status-dot-control.d.ts +15 -0
  9. package/components/controls/phi-status-dot-control.js +25 -0
  10. package/components/controls/phi-table-control.js +8 -1
  11. package/components/controls/phi-tree-control.js +5 -4
  12. package/components/controls/phi-tree-select-control.js +1 -0
  13. package/components/forms/auth-admin-settings-labels.d.ts +4 -0
  14. package/components/forms/auth-admin-settings-labels.js +11 -3
  15. package/components/forms/form-provider-contract.d.ts +1 -1
  16. package/components/forms/form-provider-contract.js +1 -1
  17. package/components/layouts/clients/phi-split-card-half.d.ts +4 -1
  18. package/components/layouts/clients/phi-split-card-half.js +2 -2
  19. package/components/layouts/clients/phi-split-card-layout-client.d.ts +6 -3
  20. package/components/layouts/clients/phi-split-card-layout-client.js +5 -3
  21. package/components/layouts/clients/phi-three-column-layout-client.d.ts +20 -1
  22. package/components/layouts/clients/phi-three-column-layout-client.js +31 -15
  23. package/components/layouts/layout-definitions.d.ts +96 -0
  24. package/components/layouts/layout-definitions.js +40 -2
  25. package/components/layouts/plugins/split-card-layout-plugin.js +1 -1
  26. package/components/layouts/plugins/three-column-layout-plugin.js +1 -1
  27. package/components/layouts/split-card-geometry.d.ts +9 -4
  28. package/components/layouts/split-card-geometry.js +29 -13
  29. package/components/media/media-folder-options.d.ts +10 -0
  30. package/components/media/media-folder-options.js +14 -0
  31. package/components/navigation/phi-link.d.ts +7 -1
  32. package/components/navigation/phi-link.js +6 -2
  33. package/components/root/phi-root-theme-resolver.js +2 -0
  34. package/components/shell/phi-antd-icon.d.ts +1 -0
  35. package/components/shell/phi-antd-icon.js +3 -0
  36. package/components/widgets/client/shared/phi-rendered-value.js +1 -1
  37. package/components/widgets/inspector-field-row.js +4 -1
  38. package/components/widgets/label-sets/account.js +6 -2
  39. package/components/widgets/label-sets/admin-users.d.ts +3 -0
  40. package/components/widgets/label-sets/admin-users.js +8 -2
  41. package/components/widgets/label-sets/effects.js +5 -1
  42. package/components/widgets/label-sets/gallery.js +2 -2
  43. package/components/widgets/label-sets/inspector.js +4 -0
  44. package/components/widgets/label-sets/observability-logs.js +2 -2
  45. package/components/widgets/label-sets/profile.js +2 -1
  46. package/components/widgets/label-types/gallery.d.ts +2 -3
  47. package/components/widgets/label-types/gallery.js +1 -4
  48. package/components/widgets/label-types/inspector.d.ts +4 -0
  49. package/components/widgets/label-types/inspector.js +2 -0
  50. package/components/widgets/shared/markdown-body-client.js +1 -1
  51. package/components/widgets/shared/markdown-image-vocabulary.js +1 -1
  52. package/constants/cms-layout-proportions.d.ts +6 -0
  53. package/constants/cms-layout-proportions.js +17 -0
  54. package/constants/runtime-module-ownership.js +1 -0
  55. package/helpers/page-reference-tree.js +8 -0
  56. package/helpers/table-action-links.d.ts +11 -0
  57. package/helpers/table-action-links.js +14 -0
  58. package/helpers/table-action-row-link.d.ts +8 -0
  59. package/helpers/table-action-row-link.js +14 -0
  60. package/package.json +2 -2
  61. package/plugins/factories/widget-renderers.d.ts +7 -1
  62. package/plugins/factories/widget-renderers.js +12 -2
  63. package/plugins/runtime-modules/asset/authoring-widgets.js +2 -2
  64. package/plugins/runtime-modules/asset/data-providers.js +1 -1
  65. package/plugins/runtime-modules/asset/services/options.js +7 -11
  66. package/plugins/runtime-modules/asset/widgets/area-upload/plugin.js +0 -2
  67. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/plugin.js +0 -2
  68. package/plugins/runtime-modules/asset/widgets/image-inspector/plugin.js +0 -2
  69. package/plugins/runtime-modules/asset/widgets/media-picker/plugin.js +0 -2
  70. package/plugins/runtime-modules/asset/widgets.js +4 -4
  71. package/plugins/runtime-modules/auth/admin-settings-forms.js +47 -1
  72. package/plugins/runtime-modules/auth/authoring-widgets.js +4 -8
  73. package/plugins/runtime-modules/auth/data-providers.js +2 -0
  74. package/plugins/runtime-modules/auth/widgets/auth-workflow/plugin.js +0 -6
  75. package/plugins/runtime-modules/auth/widgets/logout/plugin.js +0 -2
  76. package/plugins/runtime-modules/auth/widgets/security/plugin.js +0 -2
  77. package/plugins/runtime-modules/auth/widgets.js +5 -3
  78. package/plugins/runtime-modules/avatar/authoring-widgets.js +2 -2
  79. package/plugins/runtime-modules/avatar/widgets/account-avatar/plugin.js +0 -2
  80. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/plugin.js +0 -2
  81. package/plugins/runtime-modules/avatar/widgets.js +2 -2
  82. package/plugins/runtime-modules/builder/authoring-widgets.js +1 -1
  83. package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.d.ts +28 -0
  84. package/plugins/runtime-modules/builder/clients/inspector-choice-cascader.js +98 -0
  85. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +27 -3
  86. package/plugins/runtime-modules/builder/clients/inspector-record-field-options.d.ts +17 -0
  87. package/plugins/runtime-modules/builder/clients/inspector-record-field-options.js +21 -0
  88. package/plugins/runtime-modules/builder/clients/inspector-translate-switch.d.ts +24 -0
  89. package/plugins/runtime-modules/builder/clients/inspector-translate-switch.js +29 -0
  90. package/plugins/runtime-modules/builder/clients/layout-inspector.d.ts +1 -1
  91. package/plugins/runtime-modules/builder/clients/layout-inspector.js +4 -2
  92. package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +1 -1
  93. package/plugins/runtime-modules/builder/clients/widget-inspector.js +6 -6
  94. package/plugins/runtime-modules/builder/plugin-meta-labels.js +17 -0
  95. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +12 -2
  96. package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +0 -2
  97. package/plugins/runtime-modules/builder/widgets.js +3 -3
  98. package/plugins/runtime-modules/contracts.js +8 -4
  99. package/plugins/runtime-modules/core/authoring-widgets.js +2 -2
  100. package/plugins/runtime-modules/core/data-providers.d.ts +7 -3
  101. package/plugins/runtime-modules/core/data-providers.js +11 -1
  102. package/plugins/runtime-modules/core/definition.d.ts +8 -4
  103. package/plugins/runtime-modules/core/form-providers.d.ts +1 -1
  104. package/plugins/runtime-modules/core/widgets/breadcrumb/config.js +1 -1
  105. package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +1 -1
  106. package/plugins/runtime-modules/core/widgets/cascader/config.js +1 -1
  107. package/plugins/runtime-modules/core/widgets/draft-status/client.d.ts +2 -1
  108. package/plugins/runtime-modules/core/widgets/draft-status/client.js +4 -3
  109. package/plugins/runtime-modules/core/widgets/gallery/authoring.js +6 -8
  110. package/plugins/runtime-modules/core/widgets/gallery/client.js +4 -0
  111. package/plugins/runtime-modules/core/widgets/gallery/config.js +1 -1
  112. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -1
  113. package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -4
  114. package/plugins/runtime-modules/core/widgets/image/config.js +1 -1
  115. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +11 -0
  116. package/plugins/runtime-modules/core/widgets/markdown/config.js +24 -22
  117. package/plugins/runtime-modules/core/widgets/record/config.js +1 -1
  118. package/plugins/runtime-modules/core/widgets/simple-text/client.d.ts +9 -5
  119. package/plugins/runtime-modules/core/widgets/simple-text/client.js +5 -7
  120. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +63 -4
  121. package/plugins/runtime-modules/core/widgets/simple-text/config.js +45 -11
  122. package/plugins/runtime-modules/core/widgets/simple-text/editor.js +2 -2
  123. package/plugins/runtime-modules/core/widgets/simple-text/plugin.d.ts +13 -0
  124. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +23 -4
  125. package/plugins/runtime-modules/core/widgets/simple-text/server.d.ts +4 -2
  126. package/plugins/runtime-modules/core/widgets/simple-text/server.js +7 -6
  127. package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
  128. package/plugins/runtime-modules/core/widgets/table/config.js +12 -4
  129. package/plugins/runtime-modules/core/widgets/table/plugin.js +21 -1
  130. package/plugins/runtime-modules/core/widgets/thread-conversation/plugin.js +0 -2
  131. package/plugins/runtime-modules/core/widgets/tree/config.js +2 -1
  132. package/plugins/runtime-modules/core/widgets/tree/plugin.js +16 -1
  133. package/plugins/runtime-modules/core/widgets.js +1 -1
  134. package/plugins/runtime-modules/observability/data-providers.js +1 -1
  135. package/plugins/runtime-modules/theme/authoring-widgets.js +5 -5
  136. package/plugins/runtime-modules/theme/brand-theme-model.d.ts +4 -1
  137. package/plugins/runtime-modules/theme/brand-theme-model.js +6 -2
  138. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -0
  139. package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +0 -5
  140. package/plugins/runtime-modules/theme/widgets.js +4 -4
  141. package/plugins/runtime-modules/threads/labels.js +6 -2
  142. package/plugins/runtime-modules/user-management/addon-roles.d.ts +28 -7
  143. package/plugins/runtime-modules/user-management/addon-roles.js +42 -17
  144. package/plugins/runtime-modules/user-management/client-data-providers.js +6 -0
  145. package/plugins/runtime-modules/user-management/data-providers.js +11 -2
  146. package/plugins/runtime-modules/user-management/forms.js +40 -1
  147. package/plugins/runtime-modules/user-management/ids.d.ts +1 -0
  148. package/plugins/runtime-modules/user-management/ids.js +1 -0
  149. package/plugins/runtime-modules/user-management/services/options.d.ts +14 -3
  150. package/plugins/runtime-modules/user-management/services/options.js +52 -16
  151. package/plugins/runtime-modules/user-management/services/table.js +8 -24
  152. package/plugins/runtime-modules/user-management/services/users-query.d.ts +9 -0
  153. package/plugins/runtime-modules/user-management/services/users-query.js +29 -0
  154. package/plugins/runtime-modules/video/widgets/embed/plugin.js +0 -2
  155. package/plugins/runtime-modules/video/widgets.js +1 -1
  156. package/styles/controls.css +20 -0
  157. package/styles/layout.css +4 -4
  158. package/theme/phi-link-mark.d.ts +26 -0
  159. package/theme/phi-link-mark.js +26 -0
  160. package/theme/phi-theme-tokens.d.ts +3 -2
  161. package/theme/phi-theme-tokens.js +3 -1
  162. package/types/cms-config.d.ts +12 -4
  163. package/types/cms-config.js +3 -0
  164. package/types/cms-plugins.d.ts +26 -4
  165. package/types/core-widget-placements.d.ts +4 -4
  166. package/types/site-config.d.ts +3 -0
  167. package/types/table-widget.d.ts +17 -1
  168. package/types/tree.d.ts +2 -0
  169. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.d.ts +0 -2
  170. package/plugins/runtime-modules/asset/widgets/asset-focal-rect/authoring.js +0 -6
  171. package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.d.ts +0 -2
  172. package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +0 -6
  173. package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.d.ts +0 -7
  174. package/plugins/runtime-modules/auth/widgets/auth-methods/authoring.js +0 -12
  175. package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.d.ts +0 -7
  176. package/plugins/runtime-modules/auth/widgets/auth-workflow/authoring.js +0 -12
  177. package/plugins/runtime-modules/auth/widgets/logout/authoring.d.ts +0 -3
  178. package/plugins/runtime-modules/auth/widgets/logout/authoring.js +0 -8
  179. package/plugins/runtime-modules/auth/widgets/security/authoring.d.ts +0 -3
  180. package/plugins/runtime-modules/auth/widgets/security/authoring.js +0 -8
  181. package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.d.ts +0 -2
  182. package/plugins/runtime-modules/avatar/widgets/account-avatar/authoring.js +0 -6
  183. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.d.ts +0 -2
  184. package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/authoring.js +0 -6
  185. package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.d.ts +0 -22
  186. package/plugins/runtime-modules/builder/widgets/structure-region/internal-builder.js +0 -8
  187. package/plugins/runtime-modules/core/widgets/form-preview/authoring.d.ts +0 -10
  188. package/plugins/runtime-modules/core/widgets/form-preview/authoring.js +0 -15
  189. package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.d.ts +0 -3
  190. package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.js +0 -9
  191. package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.d.ts +0 -76
  192. package/plugins/runtime-modules/theme/widgets/brand-controls/authoring.js +0 -30
@@ -38,7 +38,11 @@ const PHI_THREAD_PAGE_LABEL_SET = definePhiRuntimeModuleLabelSet(PHI_THREADS_RUN
38
38
  column_state: "State",
39
39
  column_activity: "Last activity",
40
40
  state_unread: "New",
41
- state_open: "Open",
41
+ /*
42
+ * A conversation that is open, not the action that opens one: "Open" in this register is the
43
+ * button's, so the state names its own.
44
+ */
45
+ state_open: { text: "Open", ctx: "Web UI label, state" },
42
46
  state_archived: "Archived",
43
47
  state_locked: "Locked",
44
48
  kind_direct: "Direct",
@@ -47,7 +51,7 @@ const PHI_THREAD_PAGE_LABEL_SET = definePhiRuntimeModuleLabelSet(PHI_THREADS_RUN
47
51
  kind_support: "Support",
48
52
  filter_unread_label: "Unread only",
49
53
  filter_status_label: "Status",
50
- filter_status_open: "Open",
54
+ filter_status_open: { text: "Open", ctx: "Web UI label, state" },
51
55
  filter_status_archived: "Archived",
52
56
  archive_label: "Archive",
53
57
  reopen_label: "Reopen",
@@ -1,5 +1,8 @@
1
1
  export type PhiAddonRole = {
2
2
  name: string;
3
+ description?: string;
4
+ /** Whether the acting person may hand this role out, as the Core decided it for this request. */
5
+ grantable: boolean;
3
6
  };
4
7
  export type PhiAddonRoleCatalogEntry = {
5
8
  addonId: string;
@@ -23,13 +26,31 @@ export declare const PHI_USER_MANAGEMENT_ADDON_ALL_ROLES_TAG = "all";
23
26
  * are not listed (they apply when the person is no longer one; the dialog shows them).
24
27
  */
25
28
  export declare function buildPhiAddonRoleTags(row: Record<string, unknown>): string[];
26
- /** The filter's options: each Add-on (any role), then each of its roles. Values are `<addonId>` and `<addonId>:<role>`. */
27
- export declare function buildPhiAddonRoleFilterOptions(catalog: readonly PhiAddonRoleCatalogEntry[]): {
29
+ /**
30
+ * The users Table filter's options: one per Add-on, never a single role -- choosing one finds whoever holds
31
+ * any of its roles (the Core's `addonId` filter). The label is the Add-on's title; the id is the description,
32
+ * left out while the title is the id itself, so the list does not say everything twice.
33
+ */
34
+ export declare function buildPhiAddonFilterOptions(catalog: readonly PhiAddonRoleCatalogEntry[]): {
35
+ description?: string | undefined;
36
+ value: string;
37
+ label: string;
38
+ }[];
39
+ /**
40
+ * The edit form's Add-on role choices, under one heading per Add-on: every role the acting person may grant,
41
+ * and the ones the person edited holds that the actor may not grant, disabled.
42
+ *
43
+ * The save takes the whole list of roles the person is to hold afterwards and checks every difference to
44
+ * what is stored against the actor. A held role missing from the choices would be a value with no option,
45
+ * which the control lets anyone remove -- and the save would then ask to take back a role the actor has no
46
+ * standing over. As a disabled option it stays in the value as a tag nobody can remove, and the save sends it
47
+ * unchanged. `held` is null where the Core did not say what the person holds; every role the actor may not
48
+ * grant is listed disabled then, so whichever of them the person holds is kept the same way.
49
+ */
50
+ export declare function buildPhiAddonRoleChoiceOptions(catalog: readonly PhiAddonRoleCatalogEntry[], held: readonly PhiAddonRoleAssignment[] | null): {
51
+ disabled?: boolean | undefined;
52
+ group: string;
53
+ description?: string | undefined;
28
54
  value: string;
29
55
  label: string;
30
56
  }[];
31
- /** The Core's `addonId` and optional `addonRole` filters from the one value the Table filter holds. */
32
- export declare function parsePhiAddonRoleFilter(value: string): {
33
- addonId: string;
34
- addonRole: string | null;
35
- } | null;
@@ -18,7 +18,8 @@ export function readPhiAddonRoleCatalog(payload) {
18
18
  const name = readString(role.name);
19
19
  if (!name || !ROLE_NAME.test(name))
20
20
  return [];
21
- return [{ name }];
21
+ const description = readString(role.description);
22
+ return [{ name, ...(description ? { description } : {}), grantable: role.grantable === true }];
22
23
  });
23
24
  return roles.length > 0 ? [{ addonId, title: readString(addon.title) ?? addonId, roles }] : [];
24
25
  });
@@ -56,21 +57,45 @@ export function buildPhiAddonRoleTags(row) {
56
57
  }
57
58
  return [...byAddon].map(([addonId, roles]) => `${addonId}: ${roles.join(", ")}`);
58
59
  }
59
- /** The filter's options: each Add-on (any role), then each of its roles. Values are `<addonId>` and `<addonId>:<role>`. */
60
- export function buildPhiAddonRoleFilterOptions(catalog) {
61
- return catalog.flatMap((entry) => [
62
- { value: entry.addonId, label: entry.title },
63
- ...entry.roles.map((role) => ({ value: `${entry.addonId}:${role.name}`, label: `${entry.title}: ${role.name}` })),
64
- ]);
60
+ /**
61
+ * The users Table filter's options: one per Add-on, never a single role -- choosing one finds whoever holds
62
+ * any of its roles (the Core's `addonId` filter). The label is the Add-on's title; the id is the description,
63
+ * left out while the title is the id itself, so the list does not say everything twice.
64
+ */
65
+ export function buildPhiAddonFilterOptions(catalog) {
66
+ return catalog.map((entry) => ({
67
+ value: entry.addonId,
68
+ label: entry.title,
69
+ ...(entry.title === entry.addonId ? {} : { description: entry.addonId }),
70
+ }));
71
+ }
72
+ /** One role as the user save names it: `"<addonId>:<role>"`, which the Core splits at the last colon. */
73
+ function formatPhiAddonRoleValue(addonId, role) {
74
+ return `${addonId}:${role}`;
65
75
  }
66
- /** The Core's `addonId` and optional `addonRole` filters from the one value the Table filter holds. */
67
- export function parsePhiAddonRoleFilter(value) {
68
- const trimmed = value.trim();
69
- if (!trimmed)
70
- return null;
71
- const cut = trimmed.lastIndexOf(":");
72
- const role = cut > 0 ? trimmed.slice(cut + 1) : null;
73
- if (role !== null && ROLE_NAME.test(role))
74
- return { addonId: trimmed.slice(0, cut), addonRole: role };
75
- return { addonId: trimmed, addonRole: null };
76
+ /**
77
+ * The edit form's Add-on role choices, under one heading per Add-on: every role the acting person may grant,
78
+ * and the ones the person edited holds that the actor may not grant, disabled.
79
+ *
80
+ * The save takes the whole list of roles the person is to hold afterwards and checks every difference to
81
+ * what is stored against the actor. A held role missing from the choices would be a value with no option,
82
+ * which the control lets anyone remove -- and the save would then ask to take back a role the actor has no
83
+ * standing over. As a disabled option it stays in the value as a tag nobody can remove, and the save sends it
84
+ * unchanged. `held` is null where the Core did not say what the person holds; every role the actor may not
85
+ * grant is listed disabled then, so whichever of them the person holds is kept the same way.
86
+ */
87
+ export function buildPhiAddonRoleChoiceOptions(catalog, held) {
88
+ const heldValues = held ? new Set(held.map(({ addonId, role }) => formatPhiAddonRoleValue(addonId, role))) : null;
89
+ return catalog.flatMap((entry) => entry.roles.flatMap((role) => {
90
+ const value = formatPhiAddonRoleValue(entry.addonId, role.name);
91
+ if (!role.grantable && heldValues && !heldValues.has(value))
92
+ return [];
93
+ return [{
94
+ value,
95
+ label: role.name,
96
+ ...(role.description ? { description: role.description } : {}),
97
+ group: entry.title,
98
+ ...(role.grantable ? {} : { disabled: true }),
99
+ }];
100
+ }));
76
101
  }
@@ -8,6 +8,12 @@ export const PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS = [
8
8
  loadLive: async () => (await import("../../../plugins/runtime-modules/user-management/services/options"))
9
9
  .PhiUserManagementAddonRoleOptionsProviderClient,
10
10
  },
11
+ {
12
+ key: PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.addonRoleChoiceOptions,
13
+ ownerModuleId: PHI_USER_MANAGEMENT_RUNTIME_MODULE_ID,
14
+ loadLive: async () => (await import("../../../plugins/runtime-modules/user-management/services/options"))
15
+ .PhiUserManagementAddonRoleChoiceOptionsProviderClient,
16
+ },
11
17
  {
12
18
  key: PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.table,
13
19
  ownerModuleId: PHI_USER_MANAGEMENT_RUNTIME_MODULE_ID,
@@ -8,8 +8,17 @@ export const PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
8
8
  kind: "options",
9
9
  executionMode: "live",
10
10
  authoringMode: "none",
11
- title: "Add-on roles",
12
- description: "The Add-ons enabled for the Site and their declared roles, for filtering users by them.",
11
+ title: "Add-ons with roles",
12
+ description: "The Add-ons enabled for the Site that declare roles, for filtering users by them.",
13
+ },
14
+ {
15
+ key: PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.addonRoleChoiceOptions,
16
+ ownerModuleId: PHI_USER_MANAGEMENT_RUNTIME_MODULE_ID,
17
+ kind: "options",
18
+ executionMode: "live",
19
+ authoringMode: "none",
20
+ title: "Add-on roles to grant",
21
+ description: "The Add-on roles the acting user may grant, and the ones the edited user holds, for assigning them.",
13
22
  },
14
23
  {
15
24
  key: PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.table,
@@ -1,6 +1,6 @@
1
1
  import { createPhiFormLabelSetLoader } from "../../../components/forms/shared-form-loaders";
2
2
  import { PHI_BASE_ROLE_OPTIONS } from "../../../constants/phi-base-role-metadata";
3
- import { PHI_USER_MANAGEMENT_RUNTIME_MODULE_ID } from "../../../plugins/runtime-modules/user-management/ids";
3
+ import { PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS, PHI_USER_MANAGEMENT_RUNTIME_MODULE_ID, } from "../../../plugins/runtime-modules/user-management/ids";
4
4
  import { createPhiFormId } from "../../../types/form-id";
5
5
  import { PHI_SHARED_PACKAGE_NAME } from "../../../types/signals";
6
6
  import { PHI_FORM_FIELD_PROVIDER_KEYS, PHI_FORM_VALIDATION_PROVIDER_KEYS, createPhiSharedFormProviderKey, } from "../../../components/forms/form-provider-contract";
@@ -31,6 +31,17 @@ const selfRoleCondition = {
31
31
  operator: "truthy",
32
32
  reason: "Your own roles cannot be changed here.",
33
33
  };
34
+ /*
35
+ * A Site Admin holds every Add-on role whatever is stored, so choosing some says nothing. Read off the form's
36
+ * own Core roles rather than the record: whoever takes `admin` away in the same dialog may then choose.
37
+ */
38
+ const siteAdminTargetCondition = {
39
+ source: "form",
40
+ valuePath: "roles",
41
+ operator: "contains",
42
+ value: "admin",
43
+ reason: "A Site Admin holds every Add-on role.",
44
+ };
34
45
  const selfEnabledCondition = {
35
46
  source: "controller",
36
47
  controllerAddress,
@@ -111,7 +122,32 @@ function descriptor(formId, mode) {
111
122
  ? { match: "any", conditions: [readOnlyCondition, selfRoleCondition] }
112
123
  : readOnlyCondition,
113
124
  },
125
+ /*
126
+ * Edit only: the Core's create takes no Add-on roles. The value is the whole list the person is to hold
127
+ * afterwards; a held role the actor may not grant is a disabled option, so it stays in the value and is
128
+ * sent unchanged (`buildPhiAddonRoleChoiceOptions`).
129
+ */
114
130
  ...(edit ? [
131
+ {
132
+ key: "addonRoles",
133
+ fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.multiSelect,
134
+ label: label("addonRoles", "Add-on roles"),
135
+ placeholder: label("addonRolesPlaceholder", "Choose Add-on roles"),
136
+ description: label("addonRolesHint", "A Site Admin holds every Add-on role. Your own Add-on roles cannot be changed here."),
137
+ optionsProvider: {
138
+ providerKey: PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.addonRoleChoiceOptions,
139
+ /*
140
+ * Which roles the person holds decides which ones the actor may not grant are still listed. Required,
141
+ * so the catalog is asked once the record has filled the form, not once before it as well.
142
+ */
143
+ dependencies: [{ param: "userId", source: "form", valuePath: "userId", required: true }],
144
+ },
145
+ initialValue: [],
146
+ disabledWhen: {
147
+ match: "any",
148
+ conditions: [readOnlyCondition, selfRoleCondition, siteAdminTargetCondition],
149
+ },
150
+ },
115
151
  {
116
152
  key: "enabled",
117
153
  fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.switch,
@@ -145,6 +181,9 @@ const loadLabels = createPhiFormLabelSetLoader(() => import("../../../components
145
181
  roles: labels.editor.roles,
146
182
  rolesPlaceholder: labels.editor.rolesPlaceholder,
147
183
  rolesHint: labels.editor.selfRoleHint,
184
+ addonRoles: labels.editor.addonRoles,
185
+ addonRolesPlaceholder: labels.editor.addonRolesPlaceholder,
186
+ addonRolesHint: labels.editor.addonRolesHint,
148
187
  authOnlyHint: labels.editor.authOnlyHint,
149
188
  createPasswordHint: labels.editor.createPasswordHint,
150
189
  enabled: labels.columns.enabled,
@@ -11,4 +11,5 @@ export declare const PHI_USER_MANAGEMENT_RUNTIME_MODULE_IDENTITY: {
11
11
  export declare const PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS: {
12
12
  readonly table: `${string}/${string}`;
13
13
  readonly addonRoleOptions: `${string}/${string}`;
14
+ readonly addonRoleChoiceOptions: `${string}/${string}`;
14
15
  };
@@ -13,4 +13,5 @@ export const PHI_USER_MANAGEMENT_RUNTIME_MODULE_IDENTITY = {
13
13
  export const PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS = {
14
14
  table: createPhiSharedRuntimeDataProviderKey("tables", "user-management"),
15
15
  addonRoleOptions: createPhiSharedRuntimeDataProviderKey("options", "user-management-addon-roles"),
16
+ addonRoleChoiceOptions: createPhiSharedRuntimeDataProviderKey("options", "user-management-addon-role-choices"),
16
17
  };
@@ -1,8 +1,19 @@
1
1
  /**
2
- * The Add-ons enabled for the Site and their roles, as one filter's options: an Add-on (any role) and each
3
- * role of it. The Core answers every signed-in caller (`GET /api/site/addon-roles`); who may see the users
4
- * list at all is settled by the users route itself.
2
+ * The Add-ons enabled for the Site that declare roles, as the users Table filter's options: one per Add-on,
3
+ * matching whoever holds any of its roles. The Core answers every signed-in caller
4
+ * (`GET /api/site/addon-roles`); who may see the users list at all is settled by the users route itself.
5
5
  */
6
6
  export declare const PhiUserManagementAddonRoleOptionsProviderClient: import("react").ComponentType<{
7
7
  children: import("react").ReactNode;
8
8
  }>;
9
+ /**
10
+ * The Add-on roles the edit form offers one user (`buildPhiAddonRoleChoiceOptions`): the catalog with what
11
+ * the person holds, from `GET /api/site/addon-roles?userId=`, asked once per user the form is opened on.
12
+ *
13
+ * The Core refuses that question to an actor who may grant no role at all; such an actor is offered nothing,
14
+ * and the plain catalog lists every role disabled, which keeps whatever the person holds. So does an answer
15
+ * without a user to ask about.
16
+ */
17
+ export declare const PhiUserManagementAddonRoleChoiceOptionsProviderClient: import("react").ComponentType<{
18
+ children: import("react").ReactNode;
19
+ }>;
@@ -1,25 +1,61 @@
1
1
  "use client";
2
2
  import { createPhiControlOptionsProviderClient } from "../../../../components/controls/phi-options-provider";
3
- import { buildPhiAddonRoleFilterOptions, readPhiAddonRoleCatalog } from "../addon-roles";
3
+ import { isPhiRecord } from "../../../../helpers/is-record";
4
+ import { buildPhiAddonFilterOptions, buildPhiAddonRoleChoiceOptions, readPhiAddonRoleAssignments, readPhiAddonRoleCatalog, } from "../addon-roles";
4
5
  import { PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
6
+ const ADDON_ROLES_PATH = "/api/site/addon-roles";
7
+ async function fetchAddonRoles(query) {
8
+ return await fetch(`${ADDON_ROLES_PATH}${query}`, {
9
+ cache: "no-store",
10
+ credentials: "include",
11
+ headers: { accept: "application/json" },
12
+ });
13
+ }
14
+ async function readAddonRolesAnswer(response) {
15
+ const payload = await response.json().catch(() => null);
16
+ if (!response.ok)
17
+ throw new Error("Failed to load the Add-on roles.");
18
+ return payload;
19
+ }
5
20
  /**
6
- * The Add-ons enabled for the Site and their roles, as one filter's options: an Add-on (any role) and each
7
- * role of it. The Core answers every signed-in caller (`GET /api/site/addon-roles`); who may see the users
8
- * list at all is settled by the users route itself.
21
+ * The Add-ons enabled for the Site that declare roles, as the users Table filter's options: one per Add-on,
22
+ * matching whoever holds any of its roles. The Core answers every signed-in caller
23
+ * (`GET /api/site/addon-roles`); who may see the users list at all is settled by the users route itself.
9
24
  */
10
25
  export const PhiUserManagementAddonRoleOptionsProviderClient = createPhiControlOptionsProviderClient({
11
26
  key: PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.addonRoleOptions,
12
- load: async () => {
13
- const response = await fetch("/api/site/addon-roles", {
14
- cache: "no-store",
15
- credentials: "include",
16
- headers: { accept: "application/json" },
17
- });
18
- const payload = await response.json().catch(() => null);
19
- if (!response.ok)
20
- throw new Error("Failed to load the Add-on roles.");
21
- return payload;
22
- },
27
+ load: async () => await readAddonRolesAnswer(await fetchAddonRoles("")),
23
28
  resolveLoadKey: () => "user-management-addon-roles",
24
- resolve: (context) => ({ options: buildPhiAddonRoleFilterOptions(readPhiAddonRoleCatalog(context.asyncData)) }),
29
+ resolve: (context) => ({ options: buildPhiAddonFilterOptions(readPhiAddonRoleCatalog(context.asyncData)) }),
30
+ });
31
+ function readUserId(value) {
32
+ const text = typeof value === "number" ? String(value) : typeof value === "string" ? value.trim() : "";
33
+ return /^[1-9][0-9]*$/u.test(text) ? text : null;
34
+ }
35
+ /**
36
+ * The Add-on roles the edit form offers one user (`buildPhiAddonRoleChoiceOptions`): the catalog with what
37
+ * the person holds, from `GET /api/site/addon-roles?userId=`, asked once per user the form is opened on.
38
+ *
39
+ * The Core refuses that question to an actor who may grant no role at all; such an actor is offered nothing,
40
+ * and the plain catalog lists every role disabled, which keeps whatever the person holds. So does an answer
41
+ * without a user to ask about.
42
+ */
43
+ export const PhiUserManagementAddonRoleChoiceOptionsProviderClient = createPhiControlOptionsProviderClient({
44
+ key: PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.addonRoleChoiceOptions,
45
+ load: async ({ dependencies }) => {
46
+ const userId = readUserId(dependencies.userId);
47
+ if (userId) {
48
+ const response = await fetchAddonRoles(`?${new URLSearchParams({ userId }).toString()}`);
49
+ if (response.status !== 403)
50
+ return await readAddonRolesAnswer(response);
51
+ }
52
+ return await readAddonRolesAnswer(await fetchAddonRoles(""));
53
+ },
54
+ resolveLoadKey: () => "user-management-addon-role-choices",
55
+ resolve: (context) => {
56
+ const held = isPhiRecord(context.asyncData) && Array.isArray(context.asyncData.held)
57
+ ? readPhiAddonRoleAssignments(context.asyncData.held)
58
+ : null;
59
+ return { options: buildPhiAddonRoleChoiceOptions(readPhiAddonRoleCatalog(context.asyncData), held) };
60
+ },
25
61
  });
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  import { isPhiRecord } from "../../../../helpers/is-record";
3
3
  import { PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
4
- import { buildPhiAddonRoleTags, parsePhiAddonRoleFilter } from "../addon-roles";
5
- import { buildPhiTablePageParams, createPhiTableProviderRequestInit, readPhiPositiveInteger, readPhiTableRows, readPhiTableStringFilter, } from "../../../../components/widgets/client/shared/phi-table-provider-request";
4
+ import { buildPhiAddonRoleTags } from "../addon-roles";
5
+ import { createPhiTableProviderRequestInit, readPhiPositiveInteger, readPhiTableRows, } from "../../../../components/widgets/client/shared/phi-table-provider-request";
6
+ import { buildPhiUserManagementUsersQueryParams } from "./users-query";
6
7
  import { PhiTableProviderError, } from "../../../../types/table-widget";
7
8
  import { createPhiTableProviderClient } from "../../../../components/widgets/client/shared/phi-table-provider";
8
9
  import { PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_DESCRIPTORS } from "../../../../plugins/runtime-modules/user-management/data-providers";
@@ -10,28 +11,7 @@ import { readPhiTableProviderResponse, } from "../../../../components/widgets/cl
10
11
  const API_PATH = "/api/site/admin/users";
11
12
  const RESPONSE_OPTIONS = { subject: "User Management" };
12
13
  async function loadUsers({ query, signal, }) {
13
- const params = buildPhiTablePageParams(query, 20);
14
- const search = query.search?.trim() ?? "";
15
- const accountType = readPhiTableStringFilter(query, "accountType");
16
- const addonRole = parsePhiAddonRoleFilter(readPhiTableStringFilter(query, "addonRole"));
17
- const enabled = readPhiTableStringFilter(query, "enabled");
18
- if (search)
19
- params.set("search", search);
20
- if (accountType)
21
- params.set("accountType", accountType);
22
- // The Core's two filters: an Add-on, and optionally one of its roles (`addonRole` needs `addonId`).
23
- if (addonRole) {
24
- params.set("addonId", addonRole.addonId);
25
- if (addonRole.addonRole)
26
- params.set("addonRole", addonRole.addonRole);
27
- }
28
- if (enabled)
29
- params.set("enabled", enabled);
30
- const primarySort = query.sorts?.[0];
31
- if (primarySort) {
32
- params.set("sortKey", primarySort.key);
33
- params.set("sortOrder", primarySort.direction === "descending" ? "descend" : "ascend");
34
- }
14
+ const params = buildPhiUserManagementUsersQueryParams(query);
35
15
  const result = await readPhiTableProviderResponse(await fetch(`${API_PATH}?${params.toString()}`, createPhiTableProviderRequestInit(signal)), RESPONSE_OPTIONS);
36
16
  const rows = readPhiTableRows(result?.rows).map((row) => ({ ...row, addonRoleTags: buildPhiAddonRoleTags(row) }));
37
17
  if (typeof result?.siteTotal !== "number" || !Number.isFinite(result.siteTotal) || result.siteTotal < 0) {
@@ -87,6 +67,10 @@ async function readUserRecord({ rowIdentity, signal }) {
87
67
  ...user,
88
68
  userId: String(userId),
89
69
  roles: Array.isArray(user.roleTags) ? user.roleTags : [],
70
+ // `"<addonId>:<role>"`, the form the save takes back.
71
+ addonRoles: Array.isArray(user.addonRoles)
72
+ ? user.addonRoles.filter((entry) => typeof entry === "string")
73
+ : [],
90
74
  changePassword: false,
91
75
  };
92
76
  }
@@ -0,0 +1,9 @@
1
+ import type { PhiTableQuery } from "../../../../types/table-widget";
2
+ /**
3
+ * The users route's query for one Table page: the page, the search, the filters and the sort. Apart from
4
+ * the Provider so what the Table asks the Core can be read without a request.
5
+ *
6
+ * The Add-on role filter holds an Add-on id and is sent as the Core's `addonId` alone: whoever holds any role
7
+ * of that Add-on. The Core's `addonRole` is not asked for.
8
+ */
9
+ export declare function buildPhiUserManagementUsersQueryParams(query: PhiTableQuery): URLSearchParams;
@@ -0,0 +1,29 @@
1
+ import { buildPhiTablePageParams, readPhiTableStringFilter, } from "../../../../components/widgets/client/shared/phi-table-provider-request";
2
+ /**
3
+ * The users route's query for one Table page: the page, the search, the filters and the sort. Apart from
4
+ * the Provider so what the Table asks the Core can be read without a request.
5
+ *
6
+ * The Add-on role filter holds an Add-on id and is sent as the Core's `addonId` alone: whoever holds any role
7
+ * of that Add-on. The Core's `addonRole` is not asked for.
8
+ */
9
+ export function buildPhiUserManagementUsersQueryParams(query) {
10
+ const params = buildPhiTablePageParams(query, 20);
11
+ const search = query.search?.trim() ?? "";
12
+ const accountType = readPhiTableStringFilter(query, "accountType");
13
+ const addonId = readPhiTableStringFilter(query, "addonRole");
14
+ const enabled = readPhiTableStringFilter(query, "enabled");
15
+ if (search)
16
+ params.set("search", search);
17
+ if (accountType)
18
+ params.set("accountType", accountType);
19
+ if (addonId)
20
+ params.set("addonId", addonId);
21
+ if (enabled)
22
+ params.set("enabled", enabled);
23
+ const primarySort = query.sorts?.[0];
24
+ if (primarySort) {
25
+ params.set("sortKey", primarySort.key);
26
+ params.set("sortOrder", primarySort.direction === "descending" ? "descend" : "ascend");
27
+ }
28
+ return params;
29
+ }
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { renderPhiWidgetPreviewPlaceholder } from "../../../../../plugins/factories/widget-renderers";
3
2
  import { PHI_VIDEO_EMBED_WIDGET_DEFINITION } from "./config";
4
3
  import { PhiVideoEmbedWidgetServer } from "./server";
5
4
  export const PHI_VIDEO_EMBED_WIDGET_PLUGIN = {
6
5
  ...PHI_VIDEO_EMBED_WIDGET_DEFINITION,
7
6
  render: ({ runtime, config }) => _jsx(PhiVideoEmbedWidgetServer, { runtime: runtime, config: config }),
8
- renderPreview: ({ widget }) => renderPhiWidgetPreviewPlaceholder(widget),
9
7
  };
@@ -5,7 +5,7 @@ export const PHI_VIDEO_RUNTIME_MODULE_WIDGETS = [
5
5
  definePhiFirstPartyWidget({
6
6
  definition: PHI_VIDEO_EMBED_WIDGET_DEFINITION,
7
7
  ownerModuleId: PHI_VIDEO_RUNTIME_MODULE_ID,
8
- renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
8
+ renderPolicies: { runtime: "custom", preview: "visualPlaceholder", authoring: "custom" },
9
9
  loadRuntime: () => import("./widgets/embed/plugin").then((module) => module.PHI_VIDEO_EMBED_WIDGET_PLUGIN),
10
10
  loadPreview: () => import("./widgets/embed/plugin").then((module) => module.PHI_VIDEO_EMBED_WIDGET_PLUGIN),
11
11
  }),
@@ -1003,3 +1003,23 @@ input.ant-input.ant-input-lg {
1003
1003
  margin-inline-start: var(--phi-markdown-float-gap);
1004
1004
  }
1005
1005
  }
1006
+
1007
+ /* --- External link mark --------------------------------------------------------------------------- */
1008
+
1009
+ /*
1010
+ * The arrow after a link in running text that leads to another site (theme/phi-link-mark.ts). `PhiLink`
1011
+ * sets the attribute where its caller asks for the mark; the Theme's `--phi-link-external-mark` is the
1012
+ * mark's `display`, `none` where the Theme turned marks off. Drawn in the link's own colour, so it follows
1013
+ * hover and press with the words.
1014
+ */
1015
+ a[data-phi-external-mark]::after {
1016
+ content: "";
1017
+ display: var(--phi-link-external-mark, inline-block);
1018
+ width: 0.7em;
1019
+ height: 0.7em;
1020
+ margin-inline-start: 0.2em;
1021
+ vertical-align: baseline;
1022
+ background-color: currentColor;
1023
+ -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 2h8v8h-2V5.4l-8.3 8.3-1.4-1.4L10.6 4H6z'/%3E%3C/svg%3E") center / contain no-repeat;
1024
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 2h8v8h-2V5.4l-8.3 8.3-1.4-1.4L10.6 4H6z'/%3E%3C/svg%3E") center / contain no-repeat;
1025
+ }
package/styles/layout.css CHANGED
@@ -783,10 +783,10 @@
783
783
  }
784
784
 
785
785
  /*
786
- * The Split Card's grid (`phi-split-card-layout-client.tsx`): the two cards side by side in the golden
787
- * ratio, and one above the other where the Split Card itself is narrower than 36rem -- its own width,
788
- * not the screen's, so it stacks in a narrow column on a wide screen as well. Stacked, each card shows
789
- * the whole shared Background (`resolvePhiSplitCardGroundFrame`).
786
+ * The Split Card's grid (`phi-split-card-layout-client.tsx`): the two cards side by side in their ratio
787
+ * (`--phi-split-card-columns`), and one above the other where the Split Card itself is narrower than
788
+ * 36rem -- its own width, not the screen's, so it stacks in a narrow column on a wide screen as well.
789
+ * Stacked, each card shows the whole shared Background (`resolvePhiSplitCardGroundFrame`).
790
790
  */
791
791
  .phi-split-card__grid {
792
792
  display: grid;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The mark behind a link that leaves the Site.
3
+ *
4
+ * A link in running text that goes to another site carries a small arrow after its words, so a reader
5
+ * knows before following it that it leaves this Site. The mark is drawn by CSS
6
+ * (`styles/controls.css`, `a[data-phi-external-mark]::after`) on links whose caller asks for it --
7
+ * `PhiLink` with `markExternal`, said by Markdown, Simple Text and a link cell -- and never on a link
8
+ * that is a button, a logo or a picture, where an arrow after the content would be noise.
9
+ *
10
+ * The Theme decides whether marks are shown at all (`links.externalMark`, on unless stated `false`).
11
+ * It rides as a token of this package's own, so Ant Design writes it as `--phi-link-external-mark` under
12
+ * the Theme's class like every other token, and the Theme workspace previews it the same way.
13
+ */
14
+ export type PhiThemeLinks = {
15
+ /** Whether a link to another site wears the mark; absent is on. */
16
+ externalMark?: boolean | null;
17
+ };
18
+ export declare const PHI_LINK_EXTERNAL_MARK_ATTRIBUTE = "data-phi-external-mark";
19
+ /** Whether the Theme shows the mark: on unless it says `false`. */
20
+ export declare function readPhiThemeExternalLinkMark(links: PhiThemeLinks | null | undefined): boolean;
21
+ /** The token the stylesheet reads: the mark's `display`, `none` where the Theme turned it off. */
22
+ export declare function buildPhiThemeLinkTokens(links: PhiThemeLinks | null | undefined): {
23
+ linkExternalMark: string;
24
+ };
25
+ /** Whether an address leaves the Site over the web; a mail or phone link is not marked. */
26
+ export declare function isPhiMarkableExternalHref(href: string): boolean;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The mark behind a link that leaves the Site.
3
+ *
4
+ * A link in running text that goes to another site carries a small arrow after its words, so a reader
5
+ * knows before following it that it leaves this Site. The mark is drawn by CSS
6
+ * (`styles/controls.css`, `a[data-phi-external-mark]::after`) on links whose caller asks for it --
7
+ * `PhiLink` with `markExternal`, said by Markdown, Simple Text and a link cell -- and never on a link
8
+ * that is a button, a logo or a picture, where an arrow after the content would be noise.
9
+ *
10
+ * The Theme decides whether marks are shown at all (`links.externalMark`, on unless stated `false`).
11
+ * It rides as a token of this package's own, so Ant Design writes it as `--phi-link-external-mark` under
12
+ * the Theme's class like every other token, and the Theme workspace previews it the same way.
13
+ */
14
+ export const PHI_LINK_EXTERNAL_MARK_ATTRIBUTE = "data-phi-external-mark";
15
+ /** Whether the Theme shows the mark: on unless it says `false`. */
16
+ export function readPhiThemeExternalLinkMark(links) {
17
+ return links?.externalMark !== false;
18
+ }
19
+ /** The token the stylesheet reads: the mark's `display`, `none` where the Theme turned it off. */
20
+ export function buildPhiThemeLinkTokens(links) {
21
+ return { linkExternalMark: readPhiThemeExternalLinkMark(links) ? "inline-block" : "none" };
22
+ }
23
+ /** Whether an address leaves the Site over the web; a mail or phone link is not marked. */
24
+ export function isPhiMarkableExternalHref(href) {
25
+ return /^(https?:)?\/\//i.test(href.trim());
26
+ }
@@ -41,9 +41,10 @@ export declare const PHI_THEME_TOKEN_KEYS: readonly ["colorBgContainer", "colorB
41
41
  * The `gradient*` names are the Theme's gradient slots and the primary Buttons' run
42
42
  * (theme/phi-theme-gradients.ts): tokens of this package's own, laid over the resolved ones so Ant
43
43
  * Design writes them per mode and per Surface tone like every other. The `custom*` names are the
44
- * palette's custom colours, laid over the same way (theme/phi-theme-palette.ts).
44
+ * palette's custom colours, laid over the same way (theme/phi-theme-palette.ts). `linkExternalMark` is
45
+ * the `display` of the mark behind a link that leaves the Site (theme/phi-link-mark.ts).
45
46
  */
46
- export declare const PHI_THEME_OWN_TOKEN_KEYS: readonly ["paddingXXL", "pageMax", "pagePaddingTopPhone", "pagePaddingRightPhone", "pagePaddingBottomPhone", "pagePaddingLeftPhone", "pagePaddingTopTablet", "pagePaddingRightTablet", "pagePaddingBottomTablet", "pagePaddingLeftTablet", "pagePaddingTopDesktop", "pagePaddingRightDesktop", "pagePaddingBottomDesktop", "pagePaddingLeftDesktop", "gradient1", "gradient1Text", "gradient2", "gradient2Text", "gradient3", "gradient3Text", "primaryButtonGradient", "primaryButtonGradientHover", "primaryButtonGradientActive", "primaryButtonGradientText", "custom1", "custom2", "custom3", "custom4", "custom5", "custom6", "custom7", "custom8", "custom9", "custom10"];
47
+ export declare const PHI_THEME_OWN_TOKEN_KEYS: readonly ["paddingXXL", "pageMax", "pagePaddingTopPhone", "pagePaddingRightPhone", "pagePaddingBottomPhone", "pagePaddingLeftPhone", "pagePaddingTopTablet", "pagePaddingRightTablet", "pagePaddingBottomTablet", "pagePaddingLeftTablet", "pagePaddingTopDesktop", "pagePaddingRightDesktop", "pagePaddingBottomDesktop", "pagePaddingLeftDesktop", "gradient1", "gradient1Text", "gradient2", "gradient2Text", "gradient3", "gradient3Text", "primaryButtonGradient", "primaryButtonGradientHover", "primaryButtonGradientActive", "primaryButtonGradientText", "linkExternalMark", "custom1", "custom2", "custom3", "custom4", "custom5", "custom6", "custom7", "custom8", "custom9", "custom10"];
47
48
  /** The Page inset's names, per band and side (`PHI_LAYOUT.pagePadding`, `PHI_PAGE.padding`). */
48
49
  export declare const PHI_THEME_PAGE_PADDING_BANDS: readonly ["Phone", "Tablet", "Desktop"];
49
50
  export declare const PHI_THEME_PAGE_PADDING_SIDES: readonly ["Top", "Right", "Bottom", "Left"];
@@ -173,7 +173,8 @@ export const PHI_THEME_TOKEN_KEYS = [
173
173
  * The `gradient*` names are the Theme's gradient slots and the primary Buttons' run
174
174
  * (theme/phi-theme-gradients.ts): tokens of this package's own, laid over the resolved ones so Ant
175
175
  * Design writes them per mode and per Surface tone like every other. The `custom*` names are the
176
- * palette's custom colours, laid over the same way (theme/phi-theme-palette.ts).
176
+ * palette's custom colours, laid over the same way (theme/phi-theme-palette.ts). `linkExternalMark` is
177
+ * the `display` of the mark behind a link that leaves the Site (theme/phi-link-mark.ts).
177
178
  */
178
179
  export const PHI_THEME_OWN_TOKEN_KEYS = [
179
180
  "paddingXXL",
@@ -200,6 +201,7 @@ export const PHI_THEME_OWN_TOKEN_KEYS = [
200
201
  "primaryButtonGradientHover",
201
202
  "primaryButtonGradientActive",
202
203
  "primaryButtonGradientText",
204
+ "linkExternalMark",
203
205
  "custom1",
204
206
  "custom2",
205
207
  "custom3",