@phis/ui 0.4.10 → 0.4.12

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 (45) hide show
  1. package/components/cms/phi-cms-area-access-guard.js +9 -1
  2. package/components/cms/phi-cms-area-render-scope.d.ts +8 -4
  3. package/components/cms/phi-cms-area-render-scope.js +26 -11
  4. package/components/cms/phi-cms-root-layout.js +4 -2
  5. package/components/forms/auth-admin-settings-labels.d.ts +35 -0
  6. package/components/forms/auth-admin-settings-labels.js +27 -0
  7. package/components/layouts/clients/phi-flex-layout-client.js +7 -1
  8. package/components/runtime/runtime-controller-server-host.js +20 -9
  9. package/components/shell/phi-antd-icon.d.ts +3 -0
  10. package/components/shell/phi-antd-icon.js +9 -0
  11. package/components/tables/phi-plain-table.d.ts +4 -0
  12. package/components/tables/phi-plain-table.js +1 -1
  13. package/components/widgets/shared/markdown-body-client.d.ts +7 -0
  14. package/components/widgets/shared/markdown-body-client.js +2 -0
  15. package/components/widgets/shared/markdown-render.js +48 -1
  16. package/controls.d.ts +2 -0
  17. package/controls.js +3 -0
  18. package/package.json +2 -2
  19. package/plugins/runtime-modules/auth/data-providers.d.ts +5 -0
  20. package/plugins/runtime-modules/auth/data-providers.js +3 -0
  21. package/plugins/runtime-modules/auth/definition.d.ts +5 -0
  22. package/plugins/runtime-modules/auth/services/installations-table.js +3 -1
  23. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +24 -9
  24. package/plugins/runtime-modules/auth/widgets/security/client.js +5 -1
  25. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +0 -1
  26. package/plugins/runtime-modules/client-authoring-module.js +18 -1
  27. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
  28. package/plugins/runtime-modules/core/widgets/result/config.d.ts +3 -0
  29. package/plugins/runtime-modules/core/widgets/result/config.js +15 -10
  30. package/plugins/runtime-modules/core/widgets/result/server.js +1 -1
  31. package/plugins/runtime-modules/core/widgets/table/client.js +1 -1
  32. package/plugins/runtime-modules/core/widgets/tree/client.js +1 -1
  33. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +4 -109
  34. package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +2 -2
  35. package/plugins/runtime-modules/preset-contracts/pub-area.js +0 -4
  36. package/plugins/runtime-modules/pub-area-preset.js +0 -20
  37. package/plugins/runtime-modules/public/trees/phi-default-pub-error-page-tree.js +5 -5
  38. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +8 -6
  39. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +1 -1
  40. package/server-helpers/cms-root.js +21 -13
  41. package/server-helpers/runtime.js +0 -1
  42. package/styles/controls.css +11 -0
  43. package/styles/shell.css +11 -1
  44. package/types/site-config.d.ts +0 -4
  45. package/types/widget-runtime.d.ts +0 -3
@@ -4,6 +4,7 @@ import { canPhiViewerAccess } from "../../types/access";
4
4
  import { resolvePhiCmsDescriptorCatalog } from "../../plugins/runtime-modules/descriptor-compiler";
5
5
  import { resolvePhiPublicLoginHref } from "../../server-helpers/public-login-route";
6
6
  import { localizeAreaPath } from "../../helpers/locale";
7
+ import { PHI_ALL_RUNTIME_AREA_DEFINITIONS } from "../../plugins/runtime-modules/area-definitions";
7
8
  /**
8
9
  * Refuses an Area root the viewer may not enter, and returns only when they may.
9
10
  *
@@ -37,7 +38,14 @@ export async function guardPhiCmsAreaAccess({ cmsBridge, resolvedRoute, viewer,
37
38
  * until they disagree: a claim this side cannot read, an Area switched off. Then the home Area is
38
39
  * as closed as this one, and forwarding there is a loop rather than a way out.
39
40
  */
40
- const homeDefinition = areaDefinitions.get(viewer.resolvedArea);
41
+ /*
42
+ * The catalog in hand is this Area's own and declares no other Area, so the home Area's policy is
43
+ * read from the Core's list of Areas. Looked up in the catalog alone, every home but this Area was
44
+ * missing, and every viewer without the roles for it was refused rather than sent home -- a member
45
+ * signing in from an Admin address landed on 403 instead of the App.
46
+ */
47
+ const homeDefinition = areaDefinitions.get(viewer.resolvedArea)
48
+ ?? PHI_ALL_RUNTIME_AREA_DEFINITIONS.find((definition) => definition.area === viewer.resolvedArea);
41
49
  if (viewer.resolvedArea === resolvedRoute.area ||
42
50
  !homeDefinition ||
43
51
  !canPhiViewerAccess(viewer, homeDefinition.accessPolicy)) {
@@ -1,10 +1,15 @@
1
1
  import "server-only";
2
2
  import type { PhiCmsSiteBridge } from "../../types/cms-plugins";
3
- export declare function loadPhiCmsAreaRenderScope({ root, path, cmsBridge, }: {
3
+ type PhiCmsAreaRenderScopeInput = {
4
4
  root: string;
5
5
  path?: string[];
6
6
  cmsBridge: PhiCmsSiteBridge;
7
- }): Promise<{
7
+ };
8
+ export declare function loadPhiCmsAreaRenderControllers({ root, path, cmsBridge }: PhiCmsAreaRenderScopeInput): Promise<{
9
+ registeredControllerSettings: import("../../types").PhiRuntimeControllerSetting[] | null;
10
+ controllerDefinitionsByType: Map<any, any>;
11
+ }>;
12
+ export declare function loadPhiCmsAreaRenderScope({ root, path, cmsBridge }: PhiCmsAreaRenderScopeInput): Promise<{
8
13
  rootScope: {
9
14
  resolvedRoute: import("../../server-helpers/cms-route").PhiResolvedRootRoute;
10
15
  request: {
@@ -58,6 +63,5 @@ export declare function loadPhiCmsAreaRenderScope({ root, path, cmsBridge, }: {
58
63
  };
59
64
  filteredLayoutTree: import("../../types").PhiResolvedCmsAreaPresetTree | null;
60
65
  runtimeRegistry: import("../../types/cms-plugins").PhiCmsRuntimeRenderRegistry;
61
- registeredControllerSettings: import("../../types").PhiRuntimeControllerSetting[] | null;
62
- controllerDefinitionsByType: Map<any, any>;
63
66
  }>;
67
+ export {};
@@ -44,6 +44,23 @@ const loadPhiCmsAreaRenderScopeCached = cache(async function loadPhiCmsAreaRende
44
44
  moduleScope: runtimeModuleScope,
45
45
  trees: filteredLayoutTree ? [filteredLayoutTree] : [],
46
46
  });
47
+ return {
48
+ rootScope,
49
+ runtime,
50
+ runtimeModuleScope,
51
+ filteredLayoutTree,
52
+ runtimeRegistry,
53
+ };
54
+ });
55
+ /**
56
+ * The Controllers the Area's own render mounts, and the code that runs them.
57
+ *
58
+ * Kept apart from the scope above because only the Layout that draws the Area needs them. An Overlay
59
+ * opened later asks for the same scope from a request of its own and mounts its own Controllers; it
60
+ * would otherwise load every Area Controller's module to throw the result away.
61
+ */
62
+ const loadPhiCmsAreaRenderControllersCached = cache(async function loadPhiCmsAreaRenderControllersCached(root, pathKey, cmsBridge) {
63
+ const { filteredLayoutTree, runtimeModuleScope } = await loadPhiCmsAreaRenderScopeCached(root, pathKey, cmsBridge);
47
64
  const registeredControllerSettings = filteredLayoutTree
48
65
  ? materializePhiRuntimeControllerSettings({
49
66
  tree: filteredLayoutTree,
@@ -64,16 +81,14 @@ const loadPhiCmsAreaRenderScopeCached = cache(async function loadPhiCmsAreaRende
64
81
  settings: registeredControllerSettings,
65
82
  })
66
83
  : new Map();
67
- return {
68
- rootScope,
69
- runtime,
70
- runtimeModuleScope,
71
- filteredLayoutTree,
72
- runtimeRegistry,
73
- registeredControllerSettings,
74
- controllerDefinitionsByType,
75
- };
84
+ return { registeredControllerSettings, controllerDefinitionsByType };
76
85
  });
77
- export async function loadPhiCmsAreaRenderScope({ root, path, cmsBridge, }) {
78
- return loadPhiCmsAreaRenderScopeCached(root, path?.length ? path.join(PATH_KEY_SEPARATOR) : "", cmsBridge);
86
+ function areaRenderScopePathKey(path) {
87
+ return path?.length ? path.join(PATH_KEY_SEPARATOR) : "";
88
+ }
89
+ export async function loadPhiCmsAreaRenderControllers({ root, path, cmsBridge }) {
90
+ return loadPhiCmsAreaRenderControllersCached(root, areaRenderScopePathKey(path), cmsBridge);
91
+ }
92
+ export async function loadPhiCmsAreaRenderScope({ root, path, cmsBridge }) {
93
+ return loadPhiCmsAreaRenderScopeCached(root, areaRenderScopePathKey(path), cmsBridge);
79
94
  }
@@ -8,7 +8,7 @@ import { PHI_SHELL_HEADER_TOP_EXTENT_PROPERTY, PHI_SHELL_HEADER_TOP_STACK_PROPER
8
8
  import { PhiCmsLayoutRenderer, PhiCmsOverlayRenderer } from "./phi-cms-layout-renderer";
9
9
  import { phiCmsRegionPageScopeIncludes, readPhiCmsRegionPageScope, readPhiCmsRegionReveal, resolvePhiCmsRegionPageScope, } from "../../helpers/region-page-scope";
10
10
  import { hasRenderableRegionRoot } from "./phi-cms-region-helpers";
11
- import { loadPhiCmsAreaRenderScope } from "./phi-cms-area-render-scope";
11
+ import { loadPhiCmsAreaRenderControllers, loadPhiCmsAreaRenderScope } from "./phi-cms-area-render-scope";
12
12
  import { hasPhiCmsRevisionPreview } from "../../server-helpers/cms-root";
13
13
  import { performPhiCmsPageRedirect, resolvePhiCmsPageRedirect } from "./phi-cms-page-redirect";
14
14
  import { rememberPhiAreaRootDoor } from "../../gateway/area-root-door";
@@ -159,13 +159,15 @@ export async function PhiCmsAreaBoundary({ root, cmsBridge, children, path, page
159
159
  activeModuleIds: runtimeModuleScope.moduleSet.activeModuleIds,
160
160
  });
161
161
  }
162
+ // After the guards and the forward: a request that is refused or sent elsewhere loads no Controller.
163
+ const areaControllers = await loadPhiCmsAreaRenderControllers({ root, path: path ?? pagePath, cmsBridge });
162
164
  return (_jsx(PhiSignalRuntimePartitionProvider, { id: `area:${runtime.site.key}:${runtime.area}`, kind: "area", context: { siteKey: runtime.site.key, area: runtime.area }, children: _jsx(PhiRuntimeModuleProvider, { moduleIds: [...runtimeModuleScope.moduleSet.activeModuleIds], widgetTypes: [...runtimeModuleScope.moduleSet.widgetDefinitionsByType.keys()], layoutTypes: [...runtimeModuleScope.moduleSet.layoutDefinitionsByType.keys()], dataProviderDescriptors: runtime.area === "builder"
163
165
  ? [...runtimeModuleScope.moduleSet.dataProviderDescriptorsByKey.values()]
164
166
  : [], calendarAdapterDescriptors: [
165
167
  ...runtimeModuleScope.moduleSet.calendarAdapterDescriptorsByKey.values(),
166
168
  ], videoProviderDescriptors: [
167
169
  ...runtimeModuleScope.moduleSet.videoProviderDescriptorsByKey.values(),
168
- ], children: _jsxs(PhiRuntimeModuleDataProviderHost, { providerKeys: [...scope.runtimeRegistry.dataProviderDescriptorsByKey.keys()], children: [scope.registeredControllerSettings && scope.registeredControllerSettings.length > 0 ? (_jsx(PhiRuntimeControllerServerHost, { controllers: scope.registeredControllerSettings, runtime: runtime, registry: scope.controllerDefinitionsByType, controllerModuleIdsByType: runtimeModuleScope.moduleSet.ownerModuleIdByControllerType, runtimeModuleCatalog: scope.runtimeRegistry.runtimeModuleCatalog, serverCapabilities: scope.runtimeRegistry.serverCapabilities })) : null, children, filteredLayoutTree ? (_jsx(PhiCmsOverlayRenderer, { tree: filteredLayoutTree, runtime: runtime, registry: scope.runtimeRegistry, signalScope: "area", deferredOrigin: { area: runtime.area, root, path: path ?? pagePath ?? null } })) : null] }) }) }));
170
+ ], children: _jsxs(PhiRuntimeModuleDataProviderHost, { providerKeys: [...scope.runtimeRegistry.dataProviderDescriptorsByKey.keys()], children: [areaControllers.registeredControllerSettings && areaControllers.registeredControllerSettings.length > 0 ? (_jsx(PhiRuntimeControllerServerHost, { controllers: areaControllers.registeredControllerSettings, runtime: runtime, registry: areaControllers.controllerDefinitionsByType, controllerModuleIdsByType: runtimeModuleScope.moduleSet.ownerModuleIdByControllerType, runtimeModuleCatalog: scope.runtimeRegistry.runtimeModuleCatalog, serverCapabilities: scope.runtimeRegistry.serverCapabilities })) : null, children, filteredLayoutTree ? (_jsx(PhiCmsOverlayRenderer, { tree: filteredLayoutTree, runtime: runtime, registry: scope.runtimeRegistry, signalScope: "area", deferredOrigin: { area: runtime.area, root, path: path ?? pagePath ?? null } })) : null] }) }) }));
169
171
  }
170
172
  /**
171
173
  * The Area-owned Regions around a Page, or nothing but the grid they share.
@@ -59,6 +59,41 @@ export declare function getPhiAuthAdminSettingsLabels(options: PhiGlobalTranslat
59
59
  installations: {
60
60
  tableLabel: string;
61
61
  empty: string;
62
+ footer: string;
63
+ columns: {
64
+ key: {
65
+ title: string;
66
+ hint: string;
67
+ };
68
+ enabled: {
69
+ title: string;
70
+ hint: string;
71
+ };
72
+ login: {
73
+ title: string;
74
+ hint: string;
75
+ };
76
+ order: {
77
+ title: string;
78
+ hint: string;
79
+ };
80
+ secret: {
81
+ title: string;
82
+ hint: string;
83
+ };
84
+ validation: {
85
+ title: string;
86
+ hint: string;
87
+ };
88
+ linked: {
89
+ title: string;
90
+ hint: string;
91
+ };
92
+ callback: {
93
+ title: string;
94
+ hint: string;
95
+ };
96
+ };
62
97
  installationKey: string;
63
98
  installationKeyHint: string;
64
99
  installationKeyInvalid: string;
@@ -67,6 +67,22 @@ const PHI_AUTH_ADMIN_SETTINGS_LABEL_SET = definePhiLabelSet({
67
67
  provider_success_title: definePhiMessageLabel("Authentication settings saved."),
68
68
  installations_table_label: "Provider installations",
69
69
  installations_empty: definePhiMessageLabel("No provider installations yet."),
70
+ installations_footer: "%1 installations, %2 offered on login",
71
+ installation_column_key: "Key",
72
+ installation_column_key_hint: definePhiMessageLabel("The installation key: a slug that stays the same, unique on this site."),
73
+ installation_column_enabled: "Active",
74
+ installation_column_enabled_hint: definePhiMessageLabel("Whether the installation may be used at all. Off keeps it configured but refuses every login through it."),
75
+ installation_column_login: "Login",
76
+ installation_column_login_hint: definePhiMessageLabel("Whether the sign-in page offers this provider as a button."),
77
+ installation_column_order: "Order",
78
+ installation_column_order_hint: definePhiMessageLabel("The position of the button among the sign-in methods, lowest first."),
79
+ installation_column_secret_hint: definePhiMessageLabel("Whether a client secret is stored. It is never shown again."),
80
+ installation_column_validation: "Check",
81
+ installation_column_validation_hint: definePhiMessageLabel("The result of the last Test. GitHub offers nothing to test against."),
82
+ installation_column_linked: "Linked",
83
+ installation_column_linked_hint: definePhiMessageLabel("Site members who have signed in through this provider."),
84
+ installation_column_callback: "Callback",
85
+ installation_column_callback_hint: definePhiMessageLabel("The address to register with the provider as its callback URL."),
70
86
  installation_key_label: "Installation key",
71
87
  installation_key_hint: definePhiMessageLabel("Stable lowercase slug, unique per site (for example google-workspace)."),
72
88
  installation_key_invalid: definePhiMessageLabel("Use a lowercase slug of letters, digits, and dashes."),
@@ -142,6 +158,17 @@ export async function getPhiAuthAdminSettingsLabels(options) {
142
158
  installations: {
143
159
  tableLabel: labels.installations_table_label,
144
160
  empty: labels.installations_empty,
161
+ footer: labels.installations_footer,
162
+ columns: {
163
+ key: { title: labels.installation_column_key, hint: labels.installation_column_key_hint },
164
+ enabled: { title: labels.installation_column_enabled, hint: labels.installation_column_enabled_hint },
165
+ login: { title: labels.installation_column_login, hint: labels.installation_column_login_hint },
166
+ order: { title: labels.installation_column_order, hint: labels.installation_column_order_hint },
167
+ secret: { title: labels.installation_secret_label, hint: labels.installation_column_secret_hint },
168
+ validation: { title: labels.installation_column_validation, hint: labels.installation_column_validation_hint },
169
+ linked: { title: labels.installation_column_linked, hint: labels.installation_column_linked_hint },
170
+ callback: { title: labels.installation_column_callback, hint: labels.installation_column_callback_hint },
171
+ },
145
172
  installationKey: labels.installation_key_label,
146
173
  installationKeyHint: labels.installation_key_hint,
147
174
  installationKeyInvalid: labels.installation_key_invalid,
@@ -129,7 +129,13 @@ export function PhiFlexLayout({ slots, ...layoutProps }) {
129
129
  flexBasis: "auto",
130
130
  ...collapsedStyle,
131
131
  width: shouldFillCrossAxis ? "100%" : undefined,
132
- height: shouldFillMainAxis ? "100%" : undefined,
132
+ /*
133
+ * No `height: 100%` on the main axis: filling it is `flex-grow`'s job. A percentage here is
134
+ * the flex basis, and once the column's height is known -- the sum of its slots' content,
135
+ * from the intrinsic pass -- every filling slot would start at the whole column and be
136
+ * shrunk back in equal shares, cutting each below its content so it ran into the next.
137
+ * From content, a slot only grows into room that is left over.
138
+ */
133
139
  minWidth: 0,
134
140
  minHeight: 0,
135
141
  alignSelf: shouldFillCrossAxis ? "stretch" : undefined,
@@ -7,6 +7,8 @@ export async function resolvePhiRuntimeControllerPreloads({ controllers, runtime
7
7
  const activeControllers = [];
8
8
  const preloadDataByAddress = {};
9
9
  const seenAddresses = new Set();
10
+ // Started only once every mount has been checked, so a refused mount leaves no preload running.
11
+ const preloads = [];
10
12
  for (const setting of controllers ?? []) {
11
13
  const definition = registry.get(setting.type);
12
14
  if (!definition) {
@@ -29,18 +31,27 @@ export async function resolvePhiRuntimeControllerPreloads({ controllers, runtime
29
31
  continue;
30
32
  }
31
33
  const parsedConfig = parsePhiRuntimeControllerConfig(definition, setting.config);
32
- preloadDataByAddress[address] = await definition.serverPreload({
33
- key: definition.key,
34
- instanceKey,
34
+ const serverPreload = definition.serverPreload;
35
+ preloads.push({
35
36
  address,
36
- mountScope: setting.mountScope,
37
- runtime,
38
- runtimeModuleCatalog,
39
- serverCapabilities,
40
- setting: resolvedSetting,
41
- config: parsedConfig,
37
+ load: () => serverPreload({
38
+ key: definition.key,
39
+ instanceKey,
40
+ address,
41
+ mountScope: setting.mountScope,
42
+ runtime,
43
+ runtimeModuleCatalog,
44
+ serverCapabilities,
45
+ setting: resolvedSetting,
46
+ config: parsedConfig,
47
+ }),
42
48
  });
43
49
  }
50
+ // Controllers do not read each other's preload, so the reads run together; the map keeps mount order.
51
+ const loaded = await Promise.all(preloads.map((entry) => entry.load()));
52
+ preloads.forEach((entry, index) => {
53
+ preloadDataByAddress[entry.address] = loaded[index];
54
+ });
44
55
  return {
45
56
  controllers: activeControllers,
46
57
  preloadDataByAddress,
@@ -16,6 +16,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
16
16
  readonly BranchesOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/BranchesOutlined")>;
17
17
  readonly CalendarOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CalendarOutlined")>;
18
18
  readonly CheckOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CheckOutlined")>;
19
+ readonly ClearOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ClearOutlined")>;
19
20
  readonly CloseOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CloseOutlined")>;
20
21
  readonly CloudDownloadOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CloudDownloadOutlined")>;
21
22
  readonly CloudUploadOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/CloudUploadOutlined")>;
@@ -54,6 +55,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
54
55
  readonly HolderOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/HolderOutlined")>;
55
56
  readonly HomeOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/HomeOutlined")>;
56
57
  readonly IdcardOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/IdcardOutlined")>;
58
+ readonly InboxOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/InboxOutlined")>;
57
59
  readonly InfoCircleOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/InfoCircleOutlined")>;
58
60
  readonly LayoutOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LayoutOutlined")>;
59
61
  readonly LeftOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/LeftOutlined")>;
@@ -80,6 +82,7 @@ declare const PHI_ANTD_ICON_LOADERS: {
80
82
  readonly RedoOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/RedoOutlined")>;
81
83
  readonly ReloadOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/ReloadOutlined")>;
82
84
  readonly RightOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/RightOutlined")>;
85
+ readonly RollbackOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/RollbackOutlined")>;
83
86
  readonly SafetyCertificateOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/SafetyCertificateOutlined")>;
84
87
  readonly SaveOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/SaveOutlined")>;
85
88
  readonly SearchOutlined: () => Promise<typeof import("@ant-design/icons-svg/es/asn/SearchOutlined")>;
@@ -37,6 +37,7 @@ const PHI_ANTD_ICON_LOADERS = {
37
37
  BranchesOutlined: () => import("@ant-design/icons-svg/es/asn/BranchesOutlined"),
38
38
  CalendarOutlined: () => import("@ant-design/icons-svg/es/asn/CalendarOutlined"),
39
39
  CheckOutlined: () => import("@ant-design/icons-svg/es/asn/CheckOutlined"),
40
+ ClearOutlined: () => import("@ant-design/icons-svg/es/asn/ClearOutlined"),
40
41
  CloseOutlined: () => import("@ant-design/icons-svg/es/asn/CloseOutlined"),
41
42
  CloudDownloadOutlined: () => import("@ant-design/icons-svg/es/asn/CloudDownloadOutlined"),
42
43
  CloudUploadOutlined: () => import("@ant-design/icons-svg/es/asn/CloudUploadOutlined"),
@@ -75,6 +76,7 @@ const PHI_ANTD_ICON_LOADERS = {
75
76
  HolderOutlined: () => import("@ant-design/icons-svg/es/asn/HolderOutlined"),
76
77
  HomeOutlined: () => import("@ant-design/icons-svg/es/asn/HomeOutlined"),
77
78
  IdcardOutlined: () => import("@ant-design/icons-svg/es/asn/IdcardOutlined"),
79
+ InboxOutlined: () => import("@ant-design/icons-svg/es/asn/InboxOutlined"),
78
80
  InfoCircleOutlined: () => import("@ant-design/icons-svg/es/asn/InfoCircleOutlined"),
79
81
  LayoutOutlined: () => import("@ant-design/icons-svg/es/asn/LayoutOutlined"),
80
82
  LeftOutlined: () => import("@ant-design/icons-svg/es/asn/LeftOutlined"),
@@ -101,6 +103,7 @@ const PHI_ANTD_ICON_LOADERS = {
101
103
  RedoOutlined: () => import("@ant-design/icons-svg/es/asn/RedoOutlined"),
102
104
  ReloadOutlined: () => import("@ant-design/icons-svg/es/asn/ReloadOutlined"),
103
105
  RightOutlined: () => import("@ant-design/icons-svg/es/asn/RightOutlined"),
106
+ RollbackOutlined: () => import("@ant-design/icons-svg/es/asn/RollbackOutlined"),
104
107
  SafetyCertificateOutlined: () => import("@ant-design/icons-svg/es/asn/SafetyCertificateOutlined"),
105
108
  SaveOutlined: () => import("@ant-design/icons-svg/es/asn/SaveOutlined"),
106
109
  SearchOutlined: () => import("@ant-design/icons-svg/es/asn/SearchOutlined"),
@@ -200,6 +203,8 @@ export const PHI_ANTD_ICON_NAMES = {
200
203
  "branches-outlined": "BranchesOutlined",
201
204
  check: "CheckOutlined",
202
205
  "check-outlined": "CheckOutlined",
206
+ // Only the long name: a bare `clear` already means the close mark on a Button (phi-button-icons.tsx).
207
+ "clear-outlined": "ClearOutlined",
203
208
  close: "CloseOutlined",
204
209
  "close-outlined": "CloseOutlined",
205
210
  code: "CodeOutlined",
@@ -342,10 +347,14 @@ export const PHI_ANTD_ICON_NAMES = {
342
347
  "link-outlined": "LinkOutlined",
343
348
  minus: "MinusOutlined",
344
349
  "minus-outlined": "MinusOutlined",
350
+ inbox: "InboxOutlined",
351
+ "inbox-outlined": "InboxOutlined",
345
352
  redo: "RedoOutlined",
346
353
  "redo-outlined": "RedoOutlined",
347
354
  reload: "ReloadOutlined",
348
355
  "reload-outlined": "ReloadOutlined",
356
+ rollback: "RollbackOutlined",
357
+ "rollback-outlined": "RollbackOutlined",
349
358
  save: "SaveOutlined",
350
359
  "save-outlined": "SaveOutlined",
351
360
  search: "SearchOutlined",
@@ -4,6 +4,10 @@ export type PhiPlainTableColumn = {
4
4
  key: string;
5
5
  title: ReactNode;
6
6
  align?: PhiPlainTableAlign;
7
+ /** The column's width, a CSS length such as `30%`; absent, the browser shares the row out by content. */
8
+ width?: string;
9
+ /** Keep the column's cells on one line; the column then takes the width of its longest entry. */
10
+ nowrap?: boolean;
7
11
  };
8
12
  export type PhiPlainTableRow = {
9
13
  key: string;
@@ -12,5 +12,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  * variants are to be shared with the Table Control once that has them.
13
13
  */
14
14
  export function PhiPlainTable({ columns, rows, }) {
15
- return (_jsx("div", { className: "phi-plain-table__scroll", children: _jsxs("table", { className: "phi-plain-table", children: [_jsx("thead", { children: _jsx("tr", { children: columns.map((column) => (_jsx("th", { scope: "col", style: column.align ? { textAlign: column.align } : undefined, children: column.title }, column.key))) }) }), _jsx("tbody", { children: rows.map((row) => (_jsx("tr", { children: columns.map((column, columnIndex) => (_jsx("td", { style: column.align ? { textAlign: column.align } : undefined, children: row.cells[columnIndex] ?? null }, column.key))) }, row.key))) })] }) }));
15
+ return (_jsx("div", { className: "phi-plain-table__scroll", children: _jsxs("table", { className: "phi-plain-table", children: [columns.some((column) => column.width) ? (_jsx("colgroup", { children: columns.map((column) => (_jsx("col", { style: column.width ? { width: column.width } : undefined }, column.key))) })) : null, _jsx("thead", { children: _jsx("tr", { children: columns.map((column) => (_jsx("th", { scope: "col", className: column.nowrap ? "phi-plain-table__nowrap" : undefined, style: column.align ? { textAlign: column.align } : undefined, children: column.title }, column.key))) }) }), _jsx("tbody", { children: rows.map((row) => (_jsx("tr", { children: columns.map((column, columnIndex) => (_jsx("td", { className: column.nowrap ? "phi-plain-table__nowrap" : undefined, style: column.align ? { textAlign: column.align } : undefined, children: row.cells[columnIndex] ?? null }, column.key))) }, row.key))) })] }) }));
16
16
  }
@@ -87,6 +87,13 @@ export type PhiMarkdownBlock = {
87
87
  rows: PhiMarkdownInline[][][];
88
88
  /** One entry per column, from the GFM delimiter row; `null` where the column states none. */
89
89
  align: PhiMarkdownTableAlign[];
90
+ /**
91
+ * Each column's share of the width in percent, from the lengths of the delimiter row's dashes, or
92
+ * `null` when they are all equal and the browser decides.
93
+ */
94
+ widths: number[] | null;
95
+ /** One entry per column: kept on one line because every text in it is short. */
96
+ nowrap: boolean[];
90
97
  } | {
91
98
  kind: "divider";
92
99
  } | {
@@ -143,6 +143,8 @@ function renderBlocks(blocks, token, paragraphStyle, headingStyle, lists, atStar
143
143
  key: `column-${columnIndex}`,
144
144
  title: renderInlineNodes(header),
145
145
  align: block.align[columnIndex] ?? null,
146
+ width: block.widths?.[columnIndex] != null ? `${block.widths[columnIndex]}%` : undefined,
147
+ nowrap: block.nowrap[columnIndex] ?? false,
146
148
  })), rows: block.rows.map((cells, rowIndex) => ({
147
149
  key: `row-${rowIndex}`,
148
150
  cells: cells.map((cell) => renderInlineNodes(cell)),
@@ -516,7 +516,11 @@ function mapBlockNodes(nodes, context, inlineMap) {
516
516
  const cells = tableRows.map((row) => (row.children ?? []).map((cell) => inlineMap.get(cell) ?? mapInlineNodes(cell.children)));
517
517
  const header = cells[0] ?? [];
518
518
  const align = header.map((_, columnIndex) => readMarkdownTableAlign(node.align?.[columnIndex]));
519
- blocks.push({ kind: "table", header, rows: cells.slice(1), align });
519
+ const widths = readMarkdownTableWidths(node, context.sourceLines, header.length);
520
+ const nowrap = widths
521
+ ? header.map(() => false)
522
+ : header.map((_, columnIndex) => isMarkdownTableColumnShort(cells, columnIndex));
523
+ blocks.push({ kind: "table", header, rows: cells.slice(1), align, widths, nowrap });
520
524
  break;
521
525
  }
522
526
  }
@@ -606,6 +610,7 @@ async function resolveMarkdownRenderDataFromSource(markdown, translate, headingI
606
610
  figures = await projectInternalMarkdownNodes(tree, runtime);
607
611
  }
608
612
  const context = {
613
+ sourceLines: markdown.split(/\r?\n/),
609
614
  headings: [],
610
615
  headingIdCounts: new Map(),
611
616
  headingIdPrefix,
@@ -615,6 +620,48 @@ async function resolveMarkdownRenderDataFromSource(markdown, translate, headingI
615
620
  const blocks = promoteMarkdownFigures(protectMarkdownMail(mapBlockNodes(tree.children, context, inlineMap)), figures, imageDefaults);
616
621
  return { blocks, headings: context.headings };
617
622
  }
623
+ /*
624
+ * How wide a table's columns are, when the text says so.
625
+ *
626
+ * Markdown has no syntax for a column's width, and GFM asks only for at least three dashes per cell of
627
+ * the delimiter row. Their number is free, so it carries the width here: `|---|------|` is one part to
628
+ * two, and every other renderer still reads an ordinary table. Equal dashes say nothing -- the way almost
629
+ * every table is written -- and leave the widths to the browser, as before.
630
+ *
631
+ * The tree keeps no dashes, so the row is read from the source: the line after the table's first. A
632
+ * quote's or a list's markers before it are stepped over; a row that does not read as one cell per
633
+ * column gives no widths rather than wrong ones.
634
+ */
635
+ function readMarkdownTableWidths(node, sourceLines, columnCount) {
636
+ const startLine = node.position?.start.line;
637
+ if (!startLine || columnCount < 2)
638
+ return null;
639
+ const line = sourceLines[startLine];
640
+ if (line === undefined)
641
+ return null;
642
+ const row = line.replace(/^\s*(?:>\s*)*(?:(?:[-*+]|\d+[.)])\s+)?/, "").trim().replace(/^\|/, "").replace(/\|$/, "");
643
+ const cells = row.split("|").map((cell) => cell.trim());
644
+ if (cells.length !== columnCount || !cells.every((cell) => /^:?-{3,}:?$/.test(cell)))
645
+ return null;
646
+ const dashes = cells.map((cell) => cell.replace(/:/g, "").length);
647
+ if (dashes.every((count) => count === dashes[0]))
648
+ return null;
649
+ const total = dashes.reduce((sum, count) => sum + count, 0);
650
+ return dashes.map((count) => Math.round((count / total) * 1000) / 10);
651
+ }
652
+ /**
653
+ * The longest text a column may hold and still be kept on one line. Names, versions, commands and short
654
+ * labels fit; a sentence does not, and wraps as before.
655
+ */
656
+ const MARKDOWN_TABLE_SHORT_COLUMN_CHARACTERS = 24;
657
+ /*
658
+ * Whether a column holds only short texts, heading included, so it is set without a line break: it then
659
+ * takes the width of its longest entry and leaves the rest of the row to the columns that need it.
660
+ * Measured on the text as shown, after translation.
661
+ */
662
+ function isMarkdownTableColumnShort(cells, columnIndex) {
663
+ return cells.every((row) => getInlineText(row[columnIndex] ?? []).trim().length <= MARKDOWN_TABLE_SHORT_COLUMN_CHARACTERS);
664
+ }
618
665
  /** remark-gfm states `left`, `center`, `right` or nothing; nothing else can come out of its parser. */
619
666
  function readMarkdownTableAlign(value) {
620
667
  if (value === "left" || value === "center" || value === "right") {
package/controls.d.ts CHANGED
@@ -47,6 +47,8 @@ export { PhiSurfaceControl } from "./components/controls/phi-surface-control";
47
47
  export type { PhiSurfaceControlLabels, PhiSurfaceControlProps } from "./components/controls/phi-surface-control";
48
48
  export { PhiImageControl } from "./components/controls/phi-image-control";
49
49
  export type { PhiImageControlProps, PhiImageControlSource } from "./components/controls/phi-image-control";
50
+ export { resolvePhiImagePresentation } from "./components/media/image-presentation";
51
+ export type { PhiImagePresentation, PhiImagePresentationFit, PhiImagePresentationInput, } from "./components/media/image-presentation";
50
52
  export { PhiGeometryControl } from "./components/controls/phi-geometry-control";
51
53
  export type { PhiGeometryControlProps } from "./components/controls/phi-geometry-control";
52
54
  export { PhiSliderControl } from "./components/controls/phi-slider-control";
package/controls.js CHANGED
@@ -23,6 +23,9 @@ export { PhiPaddingControl } from "./components/controls/phi-padding-control";
23
23
  export { PhiShadowControl } from "./components/controls/phi-shadow-control";
24
24
  export { PhiSurfaceControl } from "./components/controls/phi-surface-control";
25
25
  export { PhiImageControl } from "./components/controls/phi-image-control";
26
+ // The answer `PhiImageControl` draws: a Module showing a picture of its own asks the same resolver the
27
+ // Image and Card Widgets ask, instead of composing an address and a framing of its own.
28
+ export { resolvePhiImagePresentation } from "./components/media/image-presentation";
26
29
  export { PhiGeometryControl } from "./components/controls/phi-geometry-control";
27
30
  export { PhiSliderControl } from "./components/controls/phi-slider-control";
28
31
  export { PhiRateControl } from "./components/controls/phi-rate-control";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
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.5",
506
+ "@phis/contracts": "^0.7.6",
507
507
  "dayjs": "^1.11.23",
508
508
  "dom-serializer": "^2.0.0",
509
509
  "htmlparser2": "^10.1.0",
@@ -11,6 +11,11 @@ export declare const PHI_AUTH_RUNTIME_DATA_PROVIDER_DESCRIPTORS: {
11
11
  title: string;
12
12
  rowIdentityPath: string;
13
13
  recordRead: true;
14
+ summaryFields: {
15
+ key: string;
16
+ title: string;
17
+ type: "number";
18
+ }[];
14
19
  fields: ({
15
20
  key: string;
16
21
  title: string;
@@ -15,6 +15,9 @@ export const PHI_AUTH_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
15
15
  title: "Provider installations",
16
16
  rowIdentityPath: "installationKey",
17
17
  recordRead: true,
18
+ summaryFields: [
19
+ { key: "loginEnabledCount", title: "Offered on login", type: "number" },
20
+ ],
18
21
  fields: [
19
22
  { key: "installationKey", title: "Installation", type: "string", required: true },
20
23
  { key: "providerKey", title: "Provider", type: "string", required: true },
@@ -269,6 +269,11 @@ export declare const PHI_AUTH_RUNTIME_MODULE_DEFINITION: {
269
269
  title: string;
270
270
  rowIdentityPath: string;
271
271
  recordRead: true;
272
+ summaryFields: {
273
+ key: string;
274
+ title: string;
275
+ type: "number";
276
+ }[];
272
277
  fields: ({
273
278
  key: string;
274
279
  title: string;
@@ -44,7 +44,9 @@ async function queryInstallations({ resourceKey, signal, }) {
44
44
  throw new PhiTableProviderError("resource-not-found", `Unknown Auth resource "${resourceKey}".`);
45
45
  }
46
46
  const rows = await loadInstallations(signal);
47
- return { rows, total: rows.length };
47
+ // What the footer counts beside the rows: the installations the sign-in page actually offers.
48
+ const loginEnabledCount = rows.filter((row) => row.loginEnabled === true).length;
49
+ return { rows, total: rows.length, summary: { loginEnabledCount } };
48
50
  }
49
51
  async function readInstallationRecord({ rowIdentity, signal }) {
50
52
  const installationKey = typeof rowIdentity === "string" ? rowIdentity.trim() : "";