@phis/ui 0.6.5 → 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 (32) hide show
  1. package/components/controls/phi-image-control.js +9 -1
  2. package/components/forms/auth-admin-settings-labels.d.ts +4 -0
  3. package/components/forms/auth-admin-settings-labels.js +11 -3
  4. package/components/forms/form-provider-contract.d.ts +1 -1
  5. package/components/forms/form-provider-contract.js +1 -1
  6. package/components/navigation/phi-link.d.ts +7 -1
  7. package/components/navigation/phi-link.js +6 -2
  8. package/components/root/phi-root-theme-resolver.js +2 -0
  9. package/components/widgets/client/shared/phi-rendered-value.js +1 -1
  10. package/components/widgets/label-sets/account.js +6 -2
  11. package/components/widgets/label-sets/effects.js +5 -1
  12. package/components/widgets/shared/markdown-body-client.js +1 -1
  13. package/package.json +1 -1
  14. package/plugins/runtime-modules/auth/admin-settings-forms.js +47 -1
  15. package/plugins/runtime-modules/auth/data-providers.js +2 -0
  16. package/plugins/runtime-modules/core/definition.d.ts +1 -1
  17. package/plugins/runtime-modules/core/form-providers.d.ts +1 -1
  18. package/plugins/runtime-modules/core/widgets/breadcrumb/config.js +1 -1
  19. package/plugins/runtime-modules/core/widgets/cascader/config.js +1 -1
  20. package/plugins/runtime-modules/core/widgets/record/config.js +1 -1
  21. package/plugins/runtime-modules/core/widgets/simple-text/client.js +1 -1
  22. package/plugins/runtime-modules/core/widgets/table/config.js +1 -1
  23. package/plugins/runtime-modules/theme/brand-theme-model.d.ts +4 -1
  24. package/plugins/runtime-modules/theme/brand-theme-model.js +6 -2
  25. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -0
  26. package/plugins/runtime-modules/threads/labels.js +6 -2
  27. package/styles/controls.css +20 -0
  28. package/theme/phi-link-mark.d.ts +26 -0
  29. package/theme/phi-link-mark.js +26 -0
  30. package/theme/phi-theme-tokens.d.ts +3 -2
  31. package/theme/phi-theme-tokens.js +3 -1
  32. package/types/site-config.d.ts +3 -0
@@ -34,10 +34,18 @@ export function PhiImageControl({ presentation, source, alt, title, width, heigh
34
34
  const drawnHeight = height ?? presentation.height;
35
35
  const blur = source === "asset" ? blurDataUrl ?? null : null;
36
36
  const loaded = loadedUrl === url;
37
+ /*
38
+ * A box of two numbers keeps their proportion rather than their height: where its column is narrower
39
+ * than the width and `maxWidth` takes it in, the height comes down with it. A fixed height would stay
40
+ * and leave the picture a tall strip, with air above and below what stands beside it.
41
+ */
42
+ const proportion = typeof drawnWidth === "number" && typeof drawnHeight === "number" && drawnWidth > 0 && drawnHeight > 0
43
+ ? `${drawnWidth} / ${drawnHeight}`
44
+ : undefined;
37
45
  const boxStyle = {
38
46
  position: presentation.simulatedCropStyle ? "relative" : undefined,
39
47
  width: toCssSize(drawnWidth) ?? "100%",
40
- height: toCssSize(drawnHeight),
48
+ ...(proportion ? { height: "auto", aspectRatio: proportion } : { height: toCssSize(drawnHeight) }),
41
49
  maxWidth: "100%",
42
50
  lineHeight: 0,
43
51
  overflow: presentation.simulatedCropStyle ? "hidden" : undefined,
@@ -122,6 +122,10 @@ export declare function getPhiAuthAdminSettingsLabels(options: PhiGlobalTranslat
122
122
  clientIdRequired: string;
123
123
  tenant: string;
124
124
  tenantPlaceholder: string;
125
+ teamId: string;
126
+ teamIdHint: string;
127
+ keyId: string;
128
+ keyIdHint: string;
125
129
  clientSecret: string;
126
130
  secretStatusConfigured: string;
127
131
  secretStatusMissing: string;
@@ -48,16 +48,20 @@ const PHI_AUTH_ADMIN_SETTINGS_LABEL_SET = definePhiLabelSet({
48
48
  provider_client_secret_label: "Client secret",
49
49
  provider_secret_status_configured: "configured",
50
50
  provider_secret_status_missing: "missing",
51
- provider_secret_hint: definePhiMessageLabel("Leave empty to keep the currently stored secret."),
51
+ provider_secret_hint: definePhiMessageLabel("Leave empty to keep the currently stored secret. For Apple, the contents of the .p8 key file."),
52
+ provider_team_id_label: "Team ID",
53
+ provider_team_id_hint: definePhiMessageLabel("The ten characters shown at the top right of the Apple Developer account."),
54
+ provider_key_id_label: "Key ID",
55
+ provider_key_id_hint: definePhiMessageLabel("The ten characters of the Sign in with Apple key under Keys."),
52
56
  provider_enabled_label: "Installation enabled",
53
57
  provider_login_enabled_label: "Offer on login",
54
58
  provider_sort_order_label: "Order",
55
59
  provider_scopes_label: "Scopes",
56
- provider_scopes_hint: definePhiMessageLabel("Space separated. Empty asks the provider for the login defaults: read:user user:email at GitHub, openid email profile elsewhere."),
60
+ provider_scopes_hint: definePhiMessageLabel("Space separated. Empty asks the provider for the login defaults: read:user user:email at GitHub, openid email at Apple, openid email profile elsewhere."),
57
61
  provider_restrictions_label: "Restrict sign-in to",
58
62
  provider_restrictions_hint: definePhiMessageLabel("Space separated, and empty admits everyone the provider admits. GitHub organizations for GitHub, hosted domains for Google; an organization needs read:org in the scopes as well."),
59
63
  provider_prompt_label: "Prompt",
60
- provider_prompt_hint: definePhiMessageLabel("OpenID providers only: login, consent, or select_account. GitHub has no such setting."),
64
+ provider_prompt_hint: definePhiMessageLabel("Google and Microsoft only: login, consent, or select_account."),
61
65
  provider_trusted_email_link_label: "Trust for email linking",
62
66
  provider_trusted_email_link_hint: definePhiMessageLabel("Lets a verified address from this provider join an existing account without a further proof, where the site policy allows it. Only for a provider that verifies addresses itself."),
63
67
  provider_save_label: "Save",
@@ -197,6 +201,10 @@ export async function getPhiAuthAdminSettingsLabels(options) {
197
201
  clientIdRequired: labels.provider_client_id_required,
198
202
  tenant: labels.provider_tenant_label,
199
203
  tenantPlaceholder: labels.provider_tenant_placeholder,
204
+ teamId: labels.provider_team_id_label,
205
+ teamIdHint: labels.provider_team_id_hint,
206
+ keyId: labels.provider_key_id_label,
207
+ keyIdHint: labels.provider_key_id_hint,
200
208
  clientSecret: labels.provider_client_secret_label,
201
209
  secretStatusConfigured: labels.provider_secret_status_configured,
202
210
  secretStatusMissing: labels.provider_secret_status_missing,
@@ -299,7 +299,7 @@ export declare const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS: readonly [
299
299
  }, {
300
300
  readonly key: "separator";
301
301
  readonly type: "string";
302
- readonly label: "Separator";
302
+ readonly label: "Separator character";
303
303
  }, {
304
304
  readonly key: "rootValue";
305
305
  readonly type: "string";
@@ -166,7 +166,7 @@ export const PHI_SHARED_FORM_FIELD_TYPE_PROVIDER_DESCRIPTORS = [
166
166
  presentation: "control",
167
167
  settingsFields: [
168
168
  { key: "allowRoot", type: "boolean", label: "Allow Root" },
169
- { key: "separator", type: "string", label: "Separator" },
169
+ { key: "separator", type: "string", label: "Separator character" },
170
170
  { key: "rootValue", type: "string", label: "Root Value" },
171
171
  {
172
172
  key: "normalize",
@@ -14,8 +14,14 @@ export type PhiLinkProps = {
14
14
  * prefetched.
15
15
  */
16
16
  prefetch?: boolean;
17
+ /**
18
+ * Whether this link, where it leads to another site, wears the external mark (theme/phi-link-mark.ts).
19
+ * Said by a link in running text -- Markdown, Simple Text, a link cell -- and left out by a link that
20
+ * is a button, a logo or a picture. The Theme can still turn every mark off.
21
+ */
22
+ markExternal?: boolean;
17
23
  className?: string;
18
24
  style?: CSSProperties;
19
25
  onClick?: MouseEventHandler<HTMLAnchorElement>;
20
26
  };
21
- export declare function PhiLink({ href, children, external, newTab, prefetch, className, style, onClick, }: PhiLinkProps): import("react").JSX.Element;
27
+ export declare function PhiLink({ href, children, external, newTab, prefetch, markExternal, className, style, onClick, }: PhiLinkProps): import("react").JSX.Element;
@@ -3,10 +3,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useMemo, useState } from "react";
4
4
  import Link from "next/link";
5
5
  import { isPhiExternalHref } from "../../helpers/external-href";
6
+ import { PHI_LINK_EXTERNAL_MARK_ATTRIBUTE, isPhiMarkableExternalHref } from "../../theme/phi-link-mark";
6
7
  import { isPhiProtectedMail } from "../../helpers/protected-mail";
7
8
  import { usePhiConfig } from "../root/phi-config-provider";
8
9
  import { usePhiRevealedHref } from "./use-phi-protected-mail";
9
- export function PhiLink({ href, children, external, newTab, prefetch, className, style, onClick, }) {
10
+ export function PhiLink({ href, children, external, newTab, prefetch, markExternal, className, style, onClick, }) {
10
11
  const { token } = usePhiConfig();
11
12
  const [hovered, setHovered] = useState(false);
12
13
  const [active, setActive] = useState(false);
@@ -14,6 +15,9 @@ export function PhiLink({ href, children, external, newTab, prefetch, className,
14
15
  const useAnchor = isPhiProtectedMail(href) || (external ?? isPhiExternalHref(href));
15
16
  // A protected address (`helpers/protected-mail.ts`) is written into the anchor once mounted.
16
17
  const anchorHref = usePhiRevealedHref(href);
18
+ const markProps = markExternal && useAnchor && isPhiMarkableExternalHref(href)
19
+ ? { [PHI_LINK_EXTERNAL_MARK_ATTRIBUTE]: "" }
20
+ : {};
17
21
  const linkStyle = useMemo(() => ({
18
22
  textDecoration: "none",
19
23
  cursor: "pointer",
@@ -36,7 +40,7 @@ export function PhiLink({ href, children, external, newTab, prefetch, className,
36
40
  onBlur: () => setActive(false),
37
41
  };
38
42
  if (useAnchor) {
39
- return (_jsx("a", { href: anchorHref, target: newTab ? "_blank" : undefined, rel: newTab ? "noreferrer noopener" : undefined, className: className, style: linkStyle, onClick: onClick, ...interactionProps, children: children }));
43
+ return (_jsx("a", { href: anchorHref, target: newTab ? "_blank" : undefined, rel: newTab ? "noreferrer noopener" : undefined, className: className, style: linkStyle, onClick: onClick, ...markProps, ...interactionProps, children: children }));
40
44
  }
41
45
  return (_jsx(Link, { href: href, ...(prefetch === undefined ? {} : { prefetch }), className: className, style: linkStyle, onClick: onClick, ...interactionProps, children: children }));
42
46
  }
@@ -6,6 +6,7 @@ import { mergePhiThemePalettes, PHI_THEME_PALETTE_MODE_SEED_KEYS, resolvePhiThem
6
6
  import { assertPhiThemeVocabulary } from "../../theme/phi-theme-tokens";
7
7
  import { applyPhiButtonShadowComponentTokens } from "../../theme/phi-button-shadow";
8
8
  import { buildPhiThemeGradientTokens, readPhiThemeGradientKey } from "../../theme/phi-theme-gradients";
9
+ import { buildPhiThemeLinkTokens } from "../../theme/phi-link-mark";
9
10
  import { buildPhiThemeCustomColorTokens } from "../../theme/phi-theme-palette";
10
11
  import { applyPhiControlShapeComponentTokens, applyPhiSurfaceShapeComponentTokens, resolvePhiControlShape, } from "../../theme/phi-control-shape";
11
12
  const PHI_DEFAULT_DARK_NAV_BACKGROUND = "#001529";
@@ -96,6 +97,7 @@ export function resolvePhiRootTheme({ siteTheme, mode, fonts, presets, }) {
96
97
  token: effectiveThemeTokens,
97
98
  primaryButtonGradient: readPhiThemeGradientKey(siteTheme?.buttons?.primaryGradient),
98
99
  }),
100
+ ...buildPhiThemeLinkTokens(siteTheme?.links),
99
101
  };
100
102
  return {
101
103
  mode,
@@ -65,7 +65,7 @@ export function renderPhiValueContent(value, definition, labels, presentation =
65
65
  const displayValue = definition.valueMap?.[normalizedValue] ?? normalizedValue;
66
66
  if (definition.renderer === "email" || definition.renderer === "link") {
67
67
  const href = String(value);
68
- return _jsx(PhiLink, { href: definition.renderer === "email" ? `mailto:${href}` : href, children: displayValue });
68
+ return _jsx(PhiLink, { href: definition.renderer === "email" ? `mailto:${href}` : href, markExternal: true, children: displayValue });
69
69
  }
70
70
  if (definition.renderer === "tags") {
71
71
  const values = Array.isArray(value) ? value : [value];
@@ -6,7 +6,11 @@ const PHI_ACCOUNT_MENU_LABEL_SET = definePhiLabelSet({
6
6
  ctx: PHI_TR_CTX_WEB_UI_LABEL,
7
7
  labels: {
8
8
  account: "Account",
9
- login: "Login",
9
+ /*
10
+ * The action, not the column head: "Login" in this register is a table's, so the button and the
11
+ * dialog it opens name their own.
12
+ */
13
+ login: { text: "Login", ctx: "Web UI label, action" },
10
14
  register: "Register",
11
15
  // The Areas, named here because the menu is where a person reads them rather than routes by them.
12
16
  areas_title: "Go to",
@@ -21,7 +25,7 @@ const PHI_LOGIN_MODAL_LABEL_SET = definePhiLabelSet({
21
25
  key: "widget:login-modal",
22
26
  ctx: PHI_TR_CTX_WEB_UI_LABEL,
23
27
  labels: {
24
- title: "Login",
28
+ title: { text: "Login", ctx: "Web UI label, action" },
25
29
  submit_label: "Sign in",
26
30
  email_label: "Email",
27
31
  password_label: "Password",
@@ -82,7 +82,11 @@ const PHI_EFFECTS_WIDGET_LABEL_SET = definePhiLabelSet({
82
82
  viewport_x: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.viewport.x,
83
83
  viewport_y: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.viewport.y,
84
84
  viewport_z: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.viewport.z,
85
- viewport_translate: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.viewport.translate,
85
+ /*
86
+ * Moving an element, not putting it into another language: "Translate" in this register is the
87
+ * Messaging button's, so the motion property names its own.
88
+ */
89
+ viewport_translate: { text: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.viewport.translate, ctx: "Web UI label, motion" },
86
90
  viewport_opacity: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.viewport.opacity,
87
91
  viewport_rotate: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.viewport.rotate,
88
92
  viewport_scale: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.viewport.scale,
@@ -77,7 +77,7 @@ function renderInlineNodes(inlines) {
77
77
  case "inline_code":
78
78
  return (_jsx(PhiTypographyControl, { code: true, children: inline.text }, key));
79
79
  case "link":
80
- return (_jsx(PhiLink, { href: inline.href || "#", external: inline.external, newTab: inline.external, children: renderInlineNodes(inline.children) }, key));
80
+ return (_jsx(PhiLink, { href: inline.href || "#", external: inline.external, newTab: inline.external, markExternal: true, children: renderInlineNodes(inline.children) }, key));
81
81
  case "image":
82
82
  return (_jsx("img", { src: inline.src, alt: inline.alt, title: inline.title || undefined, style: { maxWidth: "100%", height: "auto" } }, key));
83
83
  case "break":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -133,6 +133,23 @@ const PROVIDER_OPTIONS = [
133
133
  { value: "github", label: label("providerGithub", "GitHub") },
134
134
  { value: "microsoft", label: label("providerMicrosoft", "Microsoft") },
135
135
  ];
136
+ /*
137
+ * Which settings a provider has, as the Form shows them: a field the chosen provider does not read is
138
+ * not drawn. The provider is the create Form's own select and a hidden field of the edit Form, filled
139
+ * from the row. The server refuses a setting a provider has no use for either way
140
+ * (`buildAuthInstallationConfig`); this only keeps the Form from offering it.
141
+ */
142
+ function forProviders(...providerKeys) {
143
+ return {
144
+ match: "any",
145
+ conditions: providerKeys.map((value) => ({
146
+ source: "form",
147
+ valuePath: "providerKey",
148
+ operator: "equals",
149
+ value,
150
+ })),
151
+ };
152
+ }
136
153
  const INSTALLATION_SHARED_FIELDS = [
137
154
  {
138
155
  key: "clientId",
@@ -148,7 +165,7 @@ const INSTALLATION_SHARED_FIELDS = [
148
165
  key: "clientSecret",
149
166
  fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.password,
150
167
  label: label("installationClientSecret", "Client secret"),
151
- description: label("installationClientSecretHint", "Leave empty to keep the currently stored secret."),
168
+ description: label("installationClientSecretHint", "Leave empty to keep the currently stored secret. For Apple, the contents of the .p8 key file."),
152
169
  autoComplete: "new-password",
153
170
  },
154
171
  {
@@ -158,6 +175,27 @@ const INSTALLATION_SHARED_FIELDS = [
158
175
  description: label("installationTenantHint", "Microsoft only: common, organizations, consumers, or a tenant UUID."),
159
176
  placeholder: label("installationTenantPlaceholder", "common"),
160
177
  autoComplete: "off",
178
+ visibleWhen: forProviders("microsoft"),
179
+ },
180
+ /*
181
+ * Apple issues a signing key instead of a client secret; the client secret is signed from the key,
182
+ * the developer team and the key's id for every token request.
183
+ */
184
+ {
185
+ key: "teamId",
186
+ fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.text,
187
+ label: label("installationTeamId", "Team ID"),
188
+ description: label("installationTeamIdHint", "The ten characters shown at the top right of the Apple Developer account."),
189
+ autoComplete: "off",
190
+ visibleWhen: forProviders("apple"),
191
+ },
192
+ {
193
+ key: "keyId",
194
+ fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.text,
195
+ label: label("installationKeyId", "Key ID"),
196
+ description: label("installationKeyIdHint", "The ten characters of the Sign in with Apple key under Keys."),
197
+ autoComplete: "off",
198
+ visibleWhen: forProviders("apple"),
161
199
  },
162
200
  /*
163
201
  * The provider's own settings, in one field each.
@@ -186,6 +224,7 @@ const INSTALLATION_SHARED_FIELDS = [
186
224
  label: label("installationRestrictions", "Restrict sign-in to"),
187
225
  description: label("installationRestrictionsHint", "Space separated, and empty admits everyone the provider admits. GitHub organizations for GitHub, hosted domains for Google."),
188
226
  autoComplete: "off",
227
+ visibleWhen: forProviders("google", "github"),
189
228
  },
190
229
  {
191
230
  key: "prompt",
@@ -193,6 +232,7 @@ const INSTALLATION_SHARED_FIELDS = [
193
232
  label: label("installationPrompt", "Prompt"),
194
233
  description: label("installationPromptHint", "OpenID providers only: login, consent, or select_account."),
195
234
  autoComplete: "off",
235
+ visibleWhen: forProviders("google", "microsoft"),
196
236
  },
197
237
  {
198
238
  key: "trustedEmailLink",
@@ -255,6 +295,8 @@ const INSTALLATION_EDIT_FORM_DESCRIPTOR = {
255
295
  labelSetKey: LABEL_SET_KEY,
256
296
  fields: [
257
297
  { key: "installationKey", fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.hidden },
298
+ // Read by the fields' conditions only; an installation keeps its provider.
299
+ { key: "providerKey", fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.hidden },
258
300
  ...INSTALLATION_SHARED_FIELDS,
259
301
  {
260
302
  key: "loginEnabled",
@@ -324,6 +366,10 @@ async function loadLabels(context) {
324
366
  installationTenant: labels.providers.tenant,
325
367
  installationTenantHint: labels.installations.tenantHint,
326
368
  installationTenantPlaceholder: labels.providers.tenantPlaceholder,
369
+ installationTeamId: labels.providers.teamId,
370
+ installationTeamIdHint: labels.providers.teamIdHint,
371
+ installationKeyId: labels.providers.keyId,
372
+ installationKeyIdHint: labels.providers.keyIdHint,
327
373
  installationScopes: labels.providers.scopes,
328
374
  installationScopesHint: labels.providers.scopesHint,
329
375
  installationRestrictions: labels.providers.restrictions,
@@ -23,6 +23,8 @@ export const PHI_AUTH_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
23
23
  { key: "providerKey", title: "Provider", type: "string", required: true },
24
24
  { key: "clientId", title: "Client ID", type: "string" },
25
25
  { key: "tenant", title: "Tenant", type: "string" },
26
+ { key: "teamId", title: "Team ID", type: "string" },
27
+ { key: "keyId", title: "Key ID", type: "string" },
26
28
  { key: "enabled", title: "Installation enabled", type: "boolean", mutable: true },
27
29
  { key: "loginEnabled", title: "Offer on login", type: "boolean", mutable: true },
28
30
  { key: "sortOrder", title: "Order", type: "number" },
@@ -619,7 +619,7 @@ export declare const PHI_CORE_RUNTIME_MODULE_DEFINITION: {
619
619
  }, {
620
620
  readonly key: "separator";
621
621
  readonly type: "string";
622
- readonly label: "Separator";
622
+ readonly label: "Separator character";
623
623
  }, {
624
624
  readonly key: "rootValue";
625
625
  readonly type: "string";
@@ -223,7 +223,7 @@ export declare const PHI_CORE_FORM_PROVIDER_DESCRIPTORS: {
223
223
  }, {
224
224
  readonly key: "separator";
225
225
  readonly type: "string";
226
- readonly label: "Separator";
226
+ readonly label: "Separator character";
227
227
  }, {
228
228
  readonly key: "rootValue";
229
229
  readonly type: "string";
@@ -18,7 +18,7 @@ export const PHI_BREADCRUMB_WIDGET_DEFINITION = {
18
18
  { key: "showArea", type: "boolean", label: "Show Area" },
19
19
  { key: "showPath", type: "boolean", label: "Show Path" },
20
20
  { key: "pathLabel", type: "string", label: "Path Label" },
21
- { key: "separator", type: "string", label: "Separator" },
21
+ { key: "separator", type: "string", label: "Separator character" },
22
22
  ],
23
23
  parseConfig: parsePhiCmsBreadcrumbWidgetConfig,
24
24
  };
@@ -42,7 +42,7 @@ export const PHI_CASCADER_WIDGET_DEFINITION = {
42
42
  { key: "placeholder", type: "string", label: "Placeholder" },
43
43
  ...buildPhiChoiceControlOptionFields("toolbar"),
44
44
  { key: "allowRoot", type: "boolean", label: "Allow Root" },
45
- { key: "separator", type: "string", label: "Separator" },
45
+ { key: "separator", type: "string", label: "Separator character" },
46
46
  { key: "rootValue", type: "string", label: "Root Value" },
47
47
  {
48
48
  key: "normalize",
@@ -193,7 +193,7 @@ export const PHI_RECORD_WIDGET_DEFINITION = {
193
193
  options: [
194
194
  { value: "outlined", label: "Outlined" },
195
195
  { value: "filled", label: "Filled" },
196
- { value: "solid", label: "Solid" },
196
+ { value: "solid", label: "Solid color" },
197
197
  ],
198
198
  },
199
199
  {
@@ -128,7 +128,7 @@ export function PhiSimpleTextWidgetClient({ blockId, labels, config, link = null
128
128
  if (!link) {
129
129
  return contentNode;
130
130
  }
131
- return (_jsx(PhiLink, { href: link.href, external: link.external, newTab: link.newTab, onClick: isLiveMode
131
+ return (_jsx(PhiLink, { href: link.href, external: link.external, newTab: link.newTab, markExternal: true, onClick: isLiveMode
132
132
  ? undefined
133
133
  : (event) => {
134
134
  event.preventDefault();
@@ -653,7 +653,7 @@ export const PHI_TABLE_WIDGET_DEFINITION = {
653
653
  options: [
654
654
  { value: "outlined", label: "Outlined" },
655
655
  { value: "filled", label: "Filled" },
656
- { value: "solid", label: "Solid" },
656
+ { value: "solid", label: "Solid color" },
657
657
  ],
658
658
  },
659
659
  {
@@ -129,7 +129,10 @@ export declare function resolveThemePayloadPreset(theme: ThemePayload, presets:
129
129
  * the very thing they asked for.
130
130
  */
131
131
  export declare function applyThemePreset(theme: ThemePayload, preset: PhiThemePresetPlugin): ThemePayload;
132
- /** Back to the blocks alone: the palette, the proportions, the Button shadows and the component overrides all go. */
132
+ /**
133
+ * Back to the blocks alone: the palette, the proportions, the Button shadows, the link marks and the
134
+ * component overrides all go.
135
+ */
133
136
  export declare function resetThemeToPreset(theme: ThemePayload, presets: readonly PhiThemePresetPlugin[], preset?: PhiThemePresetPlugin): ThemePayload;
134
137
  export declare function buildThemeReviewHref({ area, revisionId, themeKey, }: {
135
138
  area: PhiCmsAreaKey;
@@ -21,6 +21,7 @@ const PHI_THEME_HISTORY_PART_BY_FIELD = {
21
21
  shape: "style",
22
22
  style: "style",
23
23
  buttons: "style",
24
+ links: "style",
24
25
  fonts: "fonts",
25
26
  typography: "fonts",
26
27
  brand: "brand",
@@ -89,10 +90,13 @@ export function applyThemePreset(theme, preset) {
89
90
  presetVersion: preset.version,
90
91
  };
91
92
  }
92
- /** Back to the blocks alone: the palette, the proportions, the Button shadows and the component overrides all go. */
93
+ /**
94
+ * Back to the blocks alone: the palette, the proportions, the Button shadows, the link marks and the
95
+ * component overrides all go.
96
+ */
93
97
  export function resetThemeToPreset(theme, presets, preset = resolveThemePayloadPreset(theme, presets)) {
94
98
  return {
95
- ...omitThemeFields(theme, "palette", "style", "buttons", "components"),
99
+ ...omitThemeFields(theme, "palette", "style", "buttons", "links", "components"),
96
100
  preset: preset.key,
97
101
  presetVersion: preset.version,
98
102
  };
@@ -13,6 +13,7 @@ import { PHI_THEME_CUSTOM_COLOR_KEYS, isPhiThemePaletteModeSeedKey, mergePhiThem
13
13
  import { PHI_THEME_COLOR_DERIVED_TOKEN_KEYS, PHI_THEME_COLOR_SEED_DERIVATIONS, } from "../../../../../theme/phi-theme-seed-derivation";
14
14
  import { buildPhiThemeCustomColorPalette, buildPhiThemeCustomColorTokens, resolvePhiThemePaletteCustomColors, } from "../../../../../theme/phi-theme-palette";
15
15
  import { buildPhiThemeGradientTokens, PHI_THEME_GRADIENT_KEYS, readPhiThemeGradient, readPhiThemeGradientTextTone, readPhiThemeGradientKey, resolvePhiThemeGradients, resolvePhiThemeGradientText, resolvePhiThemeGradientContrast, resolvePhiThemeGradientAutoTextTone, resolvePhiThemeGradientInks, PHI_GRADIENT_HOVER_FILTER, } from "../../../../../theme/phi-theme-gradients";
16
+ import { buildPhiThemeLinkTokens, readPhiThemeExternalLinkMark } from "../../../../../theme/phi-link-mark";
16
17
  import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
17
18
  import { usePhiThemeBlockCatalog } from "../../../../../components/root/phi-theme-block-catalog-provider";
18
19
  import { resolvePhiThemeComposition, resolvePhiThemeEffectiveLogo, resolvePhiThemeEffectiveFonts, resolvePhiThemeEffectiveRoot, } from "../../../../../theme/phi-theme-composition";
@@ -270,6 +271,16 @@ function withThemeButtons(theme, buttons) {
270
271
  const withoutButtons = omitThemeFields(theme, "buttons");
271
272
  return Object.keys(buttons).length > 0 ? { ...withoutButtons, buttons } : withoutButtons;
272
273
  }
274
+ /**
275
+ * Links to other sites with or without their mark. On is the default, so turning it back on removes the
276
+ * entry rather than storing `true`.
277
+ */
278
+ function mergeThemeExternalLinkMark(theme, shown) {
279
+ const { externalMark: _previous, ...otherLinks } = theme.links ?? {};
280
+ const links = shown ? otherLinks : { ...otherLinks, externalMark: false };
281
+ const withoutLinks = omitThemeFields(theme, "links");
282
+ return Object.keys(links).length > 0 ? { ...withoutLinks, links } : withoutLinks;
283
+ }
273
284
  /** Every primary Button filled with a Theme gradient, or handed back to its one colour. */
274
285
  function mergeThemePrimaryButtonGradient(theme, gradient) {
275
286
  const { primaryGradient: _previous, ...otherButtons } = theme.buttons ?? {};
@@ -455,6 +466,7 @@ function resolveBrandDraftAliasTokens(resolvedTheme, preset, mode, fonts = {}) {
455
466
  token: aliasTokens,
456
467
  primaryButtonGradient: readPhiThemeGradientKey(resolvedTheme.buttons?.primaryGradient),
457
468
  }),
469
+ ...buildPhiThemeLinkTokens(resolvedTheme.links),
458
470
  };
459
471
  }
460
472
  function readEffectiveTokenNumber(token, key, fallback) {
@@ -1300,6 +1312,11 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
1300
1312
  ...PHI_THEME_GRADIENT_KEYS.map((key, index) => ({ value: key, label: `Gradient ${index + 1}` })),
1301
1313
  ], onChange: (choice) => publishDraft(mergeThemePrimaryButtonGradient(state.draft, choice === "none" ? null : choice)) })] })),
1302
1314
  },
1315
+ {
1316
+ key: "externalLinks",
1317
+ label: _jsx(PhiTypographyControl, { strong: true, children: "External Links" }),
1318
+ children: (_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: clientToken.paddingSM, wrap: "wrap", children: [_jsx(PhiTypographyControl, { type: "secondary", children: "An arrow after a link in text that leads to another site" }), _jsx(PhiSwitchControl, { checked: readPhiThemeExternalLinkMark(state.draft.links), checkedLabel: "On", uncheckedLabel: "Off", onChange: (checked) => publishDraft(mergeThemeExternalLinkMark(state.draft, checked)) })] })),
1319
+ },
1303
1320
  {
1304
1321
  key: "radius",
1305
1322
  label: _jsx(PhiTypographyControl, { strong: true, children: "Border Radius" }),
@@ -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",
@@ -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
+ }
@@ -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",
@@ -6,6 +6,7 @@ import type { PhiThemeBlockSelection } from "../theme/phi-theme-composition";
6
6
  import type { PhiThemeDerivation } from "../theme/phi-theme-selection";
7
7
  import type { PhiControlShapeCorners } from "../theme/phi-control-shape";
8
8
  import type { PhiThemeButtons } from "../theme/phi-button-shadow";
9
+ import type { PhiThemeLinks } from "../theme/phi-link-mark";
9
10
  import type { PhiThemeTypography } from "../theme/phi-theme-typography";
10
11
  export type PhiSiteTheme = {
11
12
  mode?: "light" | "dark" | null;
@@ -50,6 +51,8 @@ export type PhiSiteTheme = {
50
51
  } | null;
51
52
  /** The shadow under each kind of Button, as a step the root theme turns into CSS per mode. */
52
53
  buttons?: PhiThemeButtons | null;
54
+ /** Whether a link to another site wears its mark (theme/phi-link-mark.ts); absent is on. */
55
+ links?: PhiThemeLinks | null;
53
56
  /** Which font slot the page's headings take; body unless stated (theme/phi-theme-typography.ts). */
54
57
  typography?: PhiThemeTypography | null;
55
58
  /** Site-level component overrides, merged per component over the shared component defaults. */