@phis/ui 0.8.0 → 0.8.2
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.
- package/README.md +9 -2
- package/components/cms/phi-cms-layout-renderer.js +15 -7
- package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
- package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
- package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
- package/components/cms/phi-cms-render-diagnostic.js +12 -2
- package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
- package/components/cms/phi-cms-render-error-boundary.js +1 -1
- package/components/cms/phi-cms-root-layout.js +3 -1
- package/components/controls/phi-media-picker-control.d.ts +9 -0
- package/components/controls/phi-media-picker-control.js +1 -1
- package/components/controls/phi-popover-control.js +4 -1
- package/components/controls/phi-table-control.d.ts +7 -1
- package/components/controls/phi-table-control.js +26 -11
- package/components/forms/form-descriptor-field-check.d.ts +18 -0
- package/components/forms/form-descriptor-field-check.js +41 -0
- package/components/forms/form-descriptor-runtime-client.js +11 -10
- package/components/forms/form-record-source.d.ts +38 -0
- package/components/forms/form-record-source.js +48 -0
- package/components/forms/shared-form-descriptors.d.ts +0 -34
- package/components/forms/shared-form-descriptors.js +0 -6
- package/components/forms/shared-form-ids.d.ts +1 -1
- package/components/forms/shared-form-ids.js +1 -1
- package/components/media/media-settings-labels.d.ts +1 -0
- package/components/media/media-settings-labels.js +2 -0
- package/components/media/media-upload-flow.d.ts +62 -5
- package/components/media/media-upload-flow.js +62 -24
- package/components/media/phi-area-upload-widget.d.ts +44 -1
- package/components/media/phi-area-upload-widget.js +32 -7
- package/components/media/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- package/components/media/phi-media-upload.d.ts +10 -3
- package/components/media/phi-media-upload.js +11 -8
- package/components/media/use-media-library-add-picker.d.ts +33 -32
- package/components/overlays/phi-overlay-container-client.js +11 -9
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +7 -0
- package/components/regions/presets/phi-settings-page-shell-tree.js +3 -3
- package/components/shell/phi-icon-names.d.ts +3 -0
- package/components/shell/phi-icon-names.js +3 -0
- package/components/shell/phi-icon.d.ts +5 -7
- package/components/shell/phi-icon.js +8 -21
- package/components/shell/phi-widget-icon.js +1 -0
- package/components/tables/client/phi-table-binding-params.d.ts +24 -0
- package/components/tables/client/phi-table-binding-params.js +39 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -3
- package/components/tables/client/phi-table-binding.js +5 -9
- package/components/widgets/client/html-editor-link-node.d.ts +12 -0
- package/components/widgets/client/html-editor-link-node.js +60 -0
- package/components/widgets/client/html-editor.js +10 -6
- package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
- package/components/widgets/client/shared/phi-button-icons.js +8 -12
- package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
- package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
- package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
- package/components/widgets/client/shared/phi-collection-provider.js +5 -0
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +33 -26
- package/components/widgets/client/shared/phi-command-buttons.d.ts +16 -0
- package/components/widgets/client/shared/phi-command-buttons.js +9 -1
- package/components/widgets/label-sets/admin-users.d.ts +1 -0
- package/components/widgets/label-sets/admin-users.js +2 -0
- package/components/widgets/label-sets/builder-modules.js +4 -0
- package/components/widgets/label-sets/profile.d.ts +0 -16
- package/components/widgets/label-sets/profile.js +0 -37
- package/components/widgets/label-sets/registration.d.ts +0 -1
- package/components/widgets/label-sets/registration.js +0 -2
- package/components/widgets/label-sets/revisions.js +2 -0
- package/components/widgets/label-sets/signals.js +2 -0
- package/components/widgets/label-types/builder-modules.d.ts +4 -0
- package/components/widgets/label-types/builder-modules.js +2 -0
- package/components/widgets/label-types/revisions.d.ts +2 -0
- package/components/widgets/label-types/revisions.js +2 -1
- package/components/widgets/label-types/signals.d.ts +2 -0
- package/components/widgets/label-types/signals.js +1 -0
- package/components/widgets/shared/widget-failure-audience.d.ts +7 -0
- package/components/widgets/shared/widget-failure-audience.js +21 -0
- package/components/widgets/shared/widget-failure-client.js +5 -2
- package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice-client.js +10 -0
- package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice.js +17 -0
- package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
- package/components/widgets/shared/widget-failure-staff.js +18 -0
- package/components/widgets/shared/widget-failure.d.ts +9 -6
- package/components/widgets/shared/widget-failure.js +0 -9
- package/components/widgets/shared/widget-failure.server.d.ts +4 -2
- package/components/widgets/shared/widget-failure.server.js +8 -3
- package/constants/cms-widget-types.d.ts +1 -0
- package/constants/cms-widget-types.js +3 -0
- package/constants/customer-file.d.ts +12 -3
- package/constants/customer-file.js +12 -3
- package/constants/runtime-module-ownership.js +5 -3
- package/constants/site-address.d.ts +9 -0
- package/constants/site-address.js +10 -0
- package/constants/table-loading.d.ts +14 -0
- package/constants/table-loading.js +14 -0
- package/constants.d.ts +2 -1
- package/constants.js +3 -1
- package/gateway/site-cms-write-validation.js +19 -3
- package/gateway/site-proxy.d.ts +12 -0
- package/gateway/site-proxy.js +20 -0
- package/helpers/announced-action.d.ts +17 -0
- package/helpers/announced-action.js +29 -0
- package/helpers/phi-metadata.d.ts +0 -8
- package/helpers/phi-metadata.js +1 -10
- package/helpers/phi-site-description.d.ts +11 -0
- package/helpers/phi-site-description.js +13 -0
- package/helpers/preset-form-check.d.ts +14 -0
- package/helpers/preset-form-check.js +12 -0
- package/helpers/preset-table-check.d.ts +19 -15
- package/helpers/preset-table-check.js +33 -39
- package/helpers/record-widget-binding.d.ts +10 -0
- package/helpers/record-widget-binding.js +35 -0
- package/helpers/record-widget.d.ts +1 -10
- package/helpers/record-widget.js +4 -33
- package/helpers/table-widget-binding.d.ts +12 -0
- package/helpers/table-widget-binding.js +296 -0
- package/helpers/tree-widget-binding.d.ts +19 -0
- package/helpers/tree-widget-binding.js +72 -0
- package/helpers/typed-confirmation.d.ts +9 -0
- package/helpers/typed-confirmation.js +13 -0
- package/helpers/widget-binding-check.d.ts +22 -0
- package/helpers/widget-binding-check.js +91 -0
- package/module-page-check.d.ts +2 -0
- package/module-page-check.js +2 -0
- package/net/phi-next-proxy.d.ts +7 -0
- package/net/phi-next-proxy.js +1 -1
- package/next/root-route.js +2 -1
- package/package.json +27 -14
- package/plugins/runtime-modules/accounting/ids.d.ts +7 -4
- package/plugins/runtime-modules/accounting/ids.js +14 -3
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +21 -9
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +29 -15
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +11 -8
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +206 -137
- package/plugins/runtime-modules/app/client-data-providers.js +1 -1
- package/plugins/runtime-modules/app/data-providers.d.ts +14 -69
- package/plugins/runtime-modules/app/data-providers.js +19 -54
- package/plugins/runtime-modules/app/definition.d.ts +8 -80
- package/plugins/runtime-modules/app/forms.d.ts +1 -16
- package/plugins/runtime-modules/app/forms.js +0 -59
- package/plugins/runtime-modules/app/ids.d.ts +2 -1
- package/plugins/runtime-modules/app/ids.js +3 -2
- package/plugins/runtime-modules/app/module.d.ts +8 -80
- package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
- package/plugins/runtime-modules/app/services/{addresses-table.js → addresses-collection.js} +23 -19
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +10 -6
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +37 -73
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +0 -5
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +2 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +1 -17
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +0 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.js +2 -14
- package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
- package/plugins/runtime-modules/area-contributions/admin.js +2 -0
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
- package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
- package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +5 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -1
- package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
- package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
- package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
- package/plugins/runtime-modules/cdn/authoring.js +8 -0
- package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
- package/plugins/runtime-modules/cdn/bytes.js +17 -0
- package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
- package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
- package/plugins/runtime-modules/cdn/data-providers.js +117 -0
- package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
- package/plugins/runtime-modules/cdn/definition.js +23 -0
- package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
- package/plugins/runtime-modules/cdn/ids.js +20 -0
- package/plugins/runtime-modules/cdn/module.d.ts +131 -0
- package/plugins/runtime-modules/cdn/module.js +4 -0
- package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
- package/plugins/runtime-modules/cdn/platform.js +73 -0
- package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/presets.js +20 -0
- package/plugins/runtime-modules/cdn/server.d.ts +1 -0
- package/plugins/runtime-modules/cdn/server.js +14 -0
- package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
- package/plugins/runtime-modules/cdn/services/table.js +296 -0
- package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
- package/plugins/runtime-modules/cdn/services/upload.js +146 -0
- package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
- package/plugins/runtime-modules/cdn/table-params.js +10 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +479 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
- package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/widgets.js +13 -0
- package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
- package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
- package/plugins/runtime-modules/client-manifests/admin.js +11 -1
- package/plugins/runtime-modules/client-manifests/common.js +6 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +5 -2
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +175 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +2 -6
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +36 -52
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
- package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
- package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.d.ts +2 -0
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -0
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +5 -0
- package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
- package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
- package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/client.js +74 -50
- package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
- package/plugins/runtime-modules/revisions/forms.js +1 -1
- package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
- package/plugins/runtime-modules/revisions/page-ids.js +4 -1
- package/plugins/runtime-modules/revisions/services/options.js +14 -4
- package/plugins/runtime-modules/revisions/services/table.js +41 -21
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +76 -3
- package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +39 -13
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/client.js +62 -2
- package/plugins/runtime-modules/threads/controller/definition.js +48 -0
- package/plugins/runtime-modules/threads/data-providers.d.ts +22 -37
- package/plugins/runtime-modules/threads/data-providers.js +35 -24
- package/plugins/runtime-modules/threads/definition.d.ts +22 -37
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +2 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +14 -80
- package/plugins/runtime-modules/threads/services/customer-file-table.js +27 -112
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +4 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +4 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +15 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -0
- package/server-helpers/runtime.js +0 -1
- package/styles/controls.css +4 -2
- package/styles/layout.css +7 -0
- package/theme/phi-antd-token-resolver.d.ts +8 -0
- package/theme/phi-antd-token-resolver.js +10 -0
- package/theme/phi-theme-color.d.ts +19 -0
- package/theme/phi-theme-color.js +42 -0
- package/theme/phi-theme-gradients.js +4 -22
- package/theme/phi-theme-palette-defaults.d.ts +16 -0
- package/theme/phi-theme-palette-defaults.js +103 -0
- package/types/cms-plugins.d.ts +6 -1
- package/types/collection-provider.d.ts +27 -0
- package/types/collection-signal-values.d.ts +2 -0
- package/types/collection-signal-values.js +23 -0
- package/types/collection-view-widget.d.ts +9 -0
- package/types/core-widget-placements.d.ts +6 -0
- package/types/signals.d.ts +2 -0
- package/types/signals.js +2 -0
- package/types/table-widget.d.ts +17 -3
- package/types/table-widget.js +0 -282
- package/types/tree-widget.d.ts +0 -1
- package/types/tree-widget.js +0 -60
- package/types/widget-runtime.d.ts +0 -1
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +0 -135
|
@@ -1,25 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { isPhiRecord } from "../../../../helpers/is-record";
|
|
3
|
-
import {
|
|
4
|
-
import { buildPhiTablePageParams, createPhiTableProviderRequestInit, readPhiPositiveInteger, readPhiTableRows, } from "../../../../components/widgets/client/shared/phi-table-provider-request";
|
|
5
|
-
import { readPhiTableProviderResponse, } from "../../../../components/widgets/client/shared/phi-table-provider-response";
|
|
3
|
+
import { buildPhiTablePageParams, readPhiPositiveInteger, readPhiTableRows, } from "../../../../components/widgets/client/shared/phi-table-provider-request";
|
|
6
4
|
import { createPhiTableProviderClient, } from "../../../../components/widgets/client/shared/phi-table-provider";
|
|
7
5
|
import { PhiTableProviderError } from "../../../../types/table-widget";
|
|
8
|
-
import { PhisThreadKind, PhisThreadStatus } from "../../../../constants/threads";
|
|
9
|
-
import { toPhiSiteAddressRow } from "../../../../helpers/site-address-row";
|
|
10
6
|
import { readPhiThreadInboxRow } from "../../../../helpers/thread-inbox-row";
|
|
11
7
|
import { PHI_THREADS_RUNTIME_DATA_PROVIDER_DESCRIPTORS } from "../data-providers";
|
|
12
|
-
import { PHI_CUSTOMER_FILE_OWN_FILE_PARAM, PHI_CUSTOMER_FILE_RESOURCE_KEYS as RESOURCES,
|
|
8
|
+
import { PHI_CUSTOMER_FILE_OWN_FILE_PARAM, PHI_CUSTOMER_FILE_RESOURCE_KEYS as RESOURCES, } from "../../../../constants/customer-file";
|
|
13
9
|
import { PHI_TABLE_PROVIDER_REFUSED_CODE } from "../../../../components/widgets/client/shared/phi-table-provider-refusal";
|
|
14
10
|
import { PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS } from "../ids";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const THREADS_PAGE_SIZE = 25;
|
|
18
|
-
/** The member's file, a page of the threads they take part in included. */
|
|
19
|
-
export function buildPhiCustomerFilePath(userId, page) {
|
|
20
|
-
const path = `/api/site/members/${userId}/file`;
|
|
21
|
-
return page ? `${path}?${page}` : path;
|
|
22
|
-
}
|
|
11
|
+
import { buildPhiCustomerFilePath, PHI_CUSTOMER_FILE_THREADS_PAGE_SIZE, PhiCustomerFileOwnFileRefusal, readPhiCustomerFile, } from "./customer-file-read";
|
|
12
|
+
export { buildPhiCustomerFilePath } from "./customer-file-read";
|
|
23
13
|
function text(value) {
|
|
24
14
|
return typeof value === "string" ? value.trim() : "";
|
|
25
15
|
}
|
|
@@ -38,102 +28,31 @@ export function toPhiCustomerFilePersonRow(person) {
|
|
|
38
28
|
};
|
|
39
29
|
}
|
|
40
30
|
/**
|
|
41
|
-
* The
|
|
42
|
-
* its id beside the list,
|
|
43
|
-
*
|
|
31
|
+
* The person's conversations as the listing shows them, read as the inbox reads its rows. Their file is
|
|
32
|
+
* not one of them: Core answers its id beside the list, and the Page reads the file in a panel of its own
|
|
33
|
+
* (THREADS.md, section 10), so a row of it that the list carries is left out.
|
|
44
34
|
*/
|
|
45
|
-
export function toPhiCustomerFileThreadRows(result
|
|
35
|
+
export function toPhiCustomerFileThreadRows(result) {
|
|
46
36
|
const fileThreadId = readPhiPositiveInteger(result.fileThreadId);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return [{
|
|
51
|
-
id: fileThreadId,
|
|
52
|
-
subject: fileSubject,
|
|
53
|
-
kind: String(PhisThreadKind.File),
|
|
54
|
-
status: String(PhisThreadStatus.Open),
|
|
55
|
-
archived: false,
|
|
56
|
-
locked: false,
|
|
57
|
-
state: "open",
|
|
58
|
-
latestMessageAt: null,
|
|
59
|
-
}, ...threads.filter((row) => row.id !== fileThreadId)];
|
|
60
|
-
}
|
|
61
|
-
/*
|
|
62
|
-
* Core's refusal of the reader's own file (`403`): the route answers that and nothing else to someone who
|
|
63
|
-
* may open files at all, and nobody else reaches this Page or its member picker.
|
|
64
|
-
*/
|
|
65
|
-
class PhiCustomerFileOwnFileRefusal extends Error {
|
|
66
|
-
}
|
|
67
|
-
/*
|
|
68
|
-
* The reads of one route in flight, by its path. The Page's three Tables ask for the same member at the
|
|
69
|
-
* same time -- the person Table's choice reaches the other two as their query -- and one request answers
|
|
70
|
-
* them all, so one choice is one entry in the access log. Nothing outlives the request: once it settles
|
|
71
|
-
* its entry is gone, and the next read, a reload or another member asks again.
|
|
72
|
-
*/
|
|
73
|
-
const customerFileReads = new Map();
|
|
74
|
-
function abortReason(signal) {
|
|
75
|
-
return signal.reason ?? new DOMException("The read was aborted.", "AbortError");
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* The route's answer for this caller. A caller that aborts leaves the request to the others; the request
|
|
79
|
-
* itself is aborted only when the last of them has gone, and is then no longer joined.
|
|
80
|
-
*/
|
|
81
|
-
function readCustomerFile(path, signal) {
|
|
82
|
-
if (signal?.aborted)
|
|
83
|
-
return Promise.reject(abortReason(signal));
|
|
84
|
-
let read = customerFileReads.get(path);
|
|
85
|
-
if (!read) {
|
|
86
|
-
const controller = new AbortController();
|
|
87
|
-
const entry = {
|
|
88
|
-
controller,
|
|
89
|
-
waiters: 0,
|
|
90
|
-
promise: (async () => {
|
|
91
|
-
const response = await fetch(path, createPhiTableProviderRequestInit(controller.signal));
|
|
92
|
-
if (response.status === 403) {
|
|
93
|
-
const refused = await readPhiJsonPayload(response);
|
|
94
|
-
throw new PhiCustomerFileOwnFileRefusal(readPhiJsonError(refused, "Nobody reaches their own file."));
|
|
95
|
-
}
|
|
96
|
-
return readPhiTableProviderResponse(response, RESPONSE_OPTIONS);
|
|
97
|
-
})().finally(() => {
|
|
98
|
-
if (customerFileReads.get(path) === entry)
|
|
99
|
-
customerFileReads.delete(path);
|
|
100
|
-
}),
|
|
101
|
-
};
|
|
102
|
-
// A request every caller left rejects with nobody listening.
|
|
103
|
-
entry.promise.catch(() => undefined);
|
|
104
|
-
customerFileReads.set(path, entry);
|
|
105
|
-
read = entry;
|
|
106
|
-
}
|
|
107
|
-
const shared = read;
|
|
108
|
-
shared.waiters += 1;
|
|
109
|
-
if (!signal)
|
|
110
|
-
return shared.promise;
|
|
111
|
-
return new Promise((resolve, reject) => {
|
|
112
|
-
const leave = () => {
|
|
113
|
-
shared.waiters -= 1;
|
|
114
|
-
reject(abortReason(signal));
|
|
115
|
-
if (shared.waiters > 0)
|
|
116
|
-
return;
|
|
117
|
-
if (customerFileReads.get(path) === shared)
|
|
118
|
-
customerFileReads.delete(path);
|
|
119
|
-
shared.controller.abort(abortReason(signal));
|
|
120
|
-
};
|
|
121
|
-
signal.addEventListener("abort", leave, { once: true });
|
|
122
|
-
shared.promise.then(resolve, reject).finally(() => signal.removeEventListener("abort", leave));
|
|
123
|
-
});
|
|
37
|
+
return readPhiTableRows(result.threads)
|
|
38
|
+
.map(readPhiThreadInboxRow)
|
|
39
|
+
.filter((row) => row.id !== fileThreadId);
|
|
124
40
|
}
|
|
125
41
|
async function queryCustomerFile({ resourceKey, query, params, signal }) {
|
|
126
|
-
if (
|
|
42
|
+
if (resourceKey !== RESOURCES.person && resourceKey !== RESOURCES.threads) {
|
|
127
43
|
throw new PhiTableProviderError("resource-not-found", `Unknown customer file resource "${resourceKey}".`);
|
|
128
44
|
}
|
|
129
45
|
// Nobody chosen yet: nothing is asked for, so nothing is written to the access log.
|
|
130
46
|
const userId = readPhiPositiveInteger(query.filters?.userId);
|
|
131
|
-
if (!userId)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
47
|
+
if (!userId) {
|
|
48
|
+
if (resourceKey === RESOURCES.threads)
|
|
49
|
+
return { rows: [] };
|
|
50
|
+
return { rows: [], total: 0, summary: { userId: null } };
|
|
51
|
+
}
|
|
52
|
+
// The person is the same on every page; it asks for the first, as the conversations Table, the
|
|
53
|
+
// addresses Collection and the Controller opening the file do on a choice, so the reads are one route.
|
|
54
|
+
const paged = buildPhiTablePageParams(resourceKey === RESOURCES.threads ? query : {}, PHI_CUSTOMER_FILE_THREADS_PAGE_SIZE);
|
|
55
|
+
const result = await readPhiCustomerFile(buildPhiCustomerFilePath(userId, paged), signal).catch((error) => {
|
|
137
56
|
if (!(error instanceof PhiCustomerFileOwnFileRefusal))
|
|
138
57
|
throw error;
|
|
139
58
|
// Said where the rows would be, in the Page's words where it gave them, and the picker stays.
|
|
@@ -144,18 +63,14 @@ async function queryCustomerFile({ resourceKey, query, params, signal }) {
|
|
|
144
63
|
throw new PhiTableProviderError("invalid-response", "The customer file answer is invalid.");
|
|
145
64
|
}
|
|
146
65
|
if (resourceKey === RESOURCES.person) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if (resourceKey === RESOURCES.addresses) {
|
|
150
|
-
const rows = readPhiTableRows(result.person.addresses).map(toPhiSiteAddressRow);
|
|
151
|
-
return { rows, total: rows.length };
|
|
66
|
+
const row = toPhiCustomerFilePersonRow(result.person);
|
|
67
|
+
return { rows: [row], total: 1, summary: { userId: typeof row.userId === "number" ? row.userId : null } };
|
|
152
68
|
}
|
|
153
|
-
|
|
154
|
-
const subject = typeof params?.[PHI_CUSTOMER_FILE_SUBJECT_PARAM] === "string" ? params[PHI_CUSTOMER_FILE_SUBJECT_PARAM] : "";
|
|
155
|
-
return { rows: toPhiCustomerFileThreadRows(result, page, subject) };
|
|
69
|
+
return { rows: toPhiCustomerFileThreadRows(result) };
|
|
156
70
|
}
|
|
157
|
-
const
|
|
158
|
-
.find((
|
|
71
|
+
const descriptor = PHI_THREADS_RUNTIME_DATA_PROVIDER_DESCRIPTORS
|
|
72
|
+
.find((candidate) => candidate.key === PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS.customerFile);
|
|
73
|
+
const resources = descriptor?.kind === "table" ? descriptor.resources : [];
|
|
159
74
|
export const PHI_THREADS_CUSTOMER_FILE_TABLE_PROVIDER_REGISTRATION = {
|
|
160
75
|
key: PHI_THREADS_RUNTIME_DATA_PROVIDER_KEYS.customerFile,
|
|
161
76
|
resources,
|
|
@@ -60,6 +60,9 @@ const PHI_ADMIN_USERS_ACCESS_LABEL_SET = definePhiRuntimeModuleLabelSet(PHI_USER
|
|
|
60
60
|
cancel: "Cancel",
|
|
61
61
|
addons_empty: definePhiMessageLabel("No installed Add-on reads people."),
|
|
62
62
|
log_empty: definePhiMessageLabel("Nothing was read, or the filters leave nothing."),
|
|
63
|
+
addons_footer: "%1 Add-ons",
|
|
64
|
+
// The log pages without a count: what a page holds, and which page it is.
|
|
65
|
+
log_footer: "%1 entries on page %2",
|
|
63
66
|
filter_subject: "Person",
|
|
64
67
|
filter_subject_placeholder: "Subject",
|
|
65
68
|
filter_addon: "Add-on",
|
|
@@ -108,6 +111,7 @@ export async function getPhiAdminUsersAccessLabels(options) {
|
|
|
108
111
|
revoke: { title: labels.revoke_title, text: labels.revoke_text, ok: labels.confirm_revoke },
|
|
109
112
|
cancel: labels.cancel,
|
|
110
113
|
empty: { addons: labels.addons_empty, log: labels.log_empty },
|
|
114
|
+
footers: { addons: labels.addons_footer, log: labels.log_footer },
|
|
111
115
|
filters: {
|
|
112
116
|
subject: labels.filter_subject,
|
|
113
117
|
subjectPlaceholder: labels.filter_subject_placeholder,
|
package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js
CHANGED
|
@@ -53,6 +53,11 @@ export async function buildPhiDefaultAdminUsersAccessPageTree({ page, runtime, }
|
|
|
53
53
|
{ key: "grantedAt", fieldKey: "grantedAt", title: labels.columns.grantedAt, renderer: "datetime", sizing: { mode: "content" } },
|
|
54
54
|
],
|
|
55
55
|
emptyState: { title: labels.empty.addons },
|
|
56
|
+
footer: {
|
|
57
|
+
template: labels.footers.addons,
|
|
58
|
+
values: [{ key: "addons", value: { source: "core", fieldKey: "totalRows" } }],
|
|
59
|
+
align: "start",
|
|
60
|
+
},
|
|
56
61
|
},
|
|
57
62
|
features: {
|
|
58
63
|
pagination: { enabled: false },
|
|
@@ -97,6 +102,8 @@ export async function buildPhiDefaultAdminUsersAccessPageTree({ page, runtime, }
|
|
|
97
102
|
source: { providerKey: PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_KEYS.usersAccess, resourceKey: RESOURCES.retention },
|
|
98
103
|
presentation: {
|
|
99
104
|
controlSize: "small",
|
|
105
|
+
// The heading names the one value; the panel says what it is for.
|
|
106
|
+
footerOmitted: "One setting edited in its cell: there is nothing to count.",
|
|
100
107
|
layout: { mode: "auto", overflowX: "auto" },
|
|
101
108
|
columns: [{
|
|
102
109
|
key: "days",
|
|
@@ -140,6 +147,14 @@ export async function buildPhiDefaultAdminUsersAccessPageTree({ page, runtime, }
|
|
|
140
147
|
{ key: "fields", fieldKey: "fields", title: labels.columns.logFields, ...fieldTags },
|
|
141
148
|
],
|
|
142
149
|
emptyState: { title: labels.empty.log },
|
|
150
|
+
footer: {
|
|
151
|
+
template: labels.footers.log,
|
|
152
|
+
values: [
|
|
153
|
+
{ key: "entries", value: { source: "core", fieldKey: "pageRows" } },
|
|
154
|
+
{ key: "page", value: { source: "core", fieldKey: "page" } },
|
|
155
|
+
],
|
|
156
|
+
align: "start",
|
|
157
|
+
},
|
|
143
158
|
},
|
|
144
159
|
features: {
|
|
145
160
|
pagination: { enabled: true, pageSize: 25, pageSizes: [25, 50, 100] },
|
|
@@ -619,6 +619,11 @@ export async function buildPhiDefaultAdminUsersPageTree({ page, runtime, }) {
|
|
|
619
619
|
{ key: "userAgent", fieldKey: "userAgent", title: widgetLabels.columns.userAgent, sizing: { mode: "fill" } },
|
|
620
620
|
],
|
|
621
621
|
emptyState: { title: widgetLabels.history.empty, description: "" },
|
|
622
|
+
footer: {
|
|
623
|
+
template: widgetLabels.history.footer,
|
|
624
|
+
values: [{ key: "logins", value: { source: "core", fieldKey: "totalRows" } }],
|
|
625
|
+
align: "start",
|
|
626
|
+
},
|
|
622
627
|
},
|
|
623
628
|
features: {
|
|
624
629
|
pagination: { enabled: false, pageSize: 25 },
|
|
@@ -156,7 +156,6 @@ async function getPhiCmsRuntimeInfo({ apiBaseUrl, internalToken, siteKey, cookie
|
|
|
156
156
|
(payload.user?.authorizationRevision ?? 0) >= 0
|
|
157
157
|
? payload.user?.authorizationRevision
|
|
158
158
|
: 0,
|
|
159
|
-
newsletterOptIn: payload.user?.newsletterOptIn ?? null,
|
|
160
159
|
themeMode: viewerThemeMode,
|
|
161
160
|
userName: payload.user?.name ?? null,
|
|
162
161
|
userEmail: payload.user?.email ?? null,
|
package/styles/controls.css
CHANGED
|
@@ -594,9 +594,11 @@ h5.phi-typography, .phi-typography h5 {
|
|
|
594
594
|
* Not while the table is empty. With no rows Ant Design has measured nothing and leaves the header's
|
|
595
595
|
* `<colgroup>` without widths, so fixed layout took them from the header cells instead: every `content`
|
|
596
596
|
* column got its 1% -- a dozen pixels, its title cut to one letter -- and the `fill` column the rest.
|
|
597
|
-
* Without rows there is nothing to line up with, and `auto` gives each title its own width.
|
|
597
|
+
* Without rows there is nothing to line up with, and `auto` gives each title its own width. The same
|
|
598
|
+
* holds while the skeleton rows stand in for the rows (`--loading`): Ant Design measures no column of
|
|
599
|
+
* them either, and the header kept one title of a dozen.
|
|
598
600
|
*/
|
|
599
|
-
.phi-table-control.phi-table-control--sticky-header:not(.phi-table-control--empty) [class~="ant-table-sticky-holder"] > table {
|
|
601
|
+
.phi-table-control.phi-table-control--sticky-header:not(.phi-table-control--empty):not(.phi-table-control--loading) [class~="ant-table-sticky-holder"] > table {
|
|
600
602
|
table-layout: fixed !important;
|
|
601
603
|
}
|
|
602
604
|
|
package/styles/layout.css
CHANGED
|
@@ -353,11 +353,18 @@
|
|
|
353
353
|
min-width: 0;
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
/*
|
|
357
|
+
* A label breaks inside a word rather than run past its cell. The cell keeps to its tracks (`min-width:
|
|
358
|
+
* 0`), but the label's words are a flex item of their own, which is never narrower than its longest
|
|
359
|
+
* word: in the label column of a one-column dialog -- a third of 377px -- "Type the Area key to
|
|
360
|
+
* confirm" left the input a few pixels, and a longer word of a translation ran under the input.
|
|
361
|
+
*/
|
|
356
362
|
.phi-form-cell--label {
|
|
357
363
|
display: flex;
|
|
358
364
|
align-items: center;
|
|
359
365
|
min-height: var(--phi-form-label-slot-height-compact);
|
|
360
366
|
padding-inline-end: var(--phi-form-label-pad-compact);
|
|
367
|
+
overflow-wrap: anywhere;
|
|
361
368
|
}
|
|
362
369
|
|
|
363
370
|
.phi-form-cell--control {
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { AliasToken } from "antd/es/theme/interface";
|
|
2
2
|
import type { PhiThemeMode } from "./phi-theme-presets";
|
|
3
3
|
export declare function createPhiAntdThemeCssVarKey(scope: string, identity: unknown): string;
|
|
4
|
+
/**
|
|
5
|
+
* Ant Design's default seed for a token key, or `undefined` where the key is no seed. What a seed is put
|
|
6
|
+
* in place of when nobody states it, read here so the deep import into Ant Design's theme stays in this
|
|
7
|
+
* file.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readPhiAntdDefaultSeedToken(key: string): {
|
|
10
|
+
value: unknown;
|
|
11
|
+
} | undefined;
|
|
4
12
|
export declare function resolvePhiAntdAliasTokens(mode: PhiThemeMode, token: Record<string, unknown>): AliasToken & Record<string, unknown>;
|
|
@@ -53,6 +53,16 @@ function withPhiDarkHoverSteps(seed, derived) {
|
|
|
53
53
|
...(seed.colorInfo ? { colorInfoHover: generateDarkColorPalettes(seed.colorInfo)[5] } : {}),
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Ant Design's default seed for a token key, or `undefined` where the key is no seed. What a seed is put
|
|
58
|
+
* in place of when nobody states it, read here so the deep import into Ant Design's theme stays in this
|
|
59
|
+
* file.
|
|
60
|
+
*/
|
|
61
|
+
export function readPhiAntdDefaultSeedToken(key) {
|
|
62
|
+
return Object.prototype.hasOwnProperty.call(seedToken, key)
|
|
63
|
+
? { value: seedToken[key] }
|
|
64
|
+
: undefined;
|
|
65
|
+
}
|
|
56
66
|
export function resolvePhiAntdAliasTokens(mode, token) {
|
|
57
67
|
const mergedSeedToken = {
|
|
58
68
|
...seedToken,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A colour as a palette states it, read into numbers so two spellings of one colour compare equal.
|
|
3
|
+
*
|
|
4
|
+
* A palette is written by hand, by a picker and by a Module, and each spells a colour its own way:
|
|
5
|
+
* `#1677FF` and `#1677ff`, `#fff` and `#ffffff`, `rgb(22, 119, 255)`. Comparing the strings told the
|
|
6
|
+
* Theme workspace that a colour the author had not changed was theirs.
|
|
7
|
+
*/
|
|
8
|
+
export type PhiThemeRgba = {
|
|
9
|
+
r: number;
|
|
10
|
+
g: number;
|
|
11
|
+
b: number;
|
|
12
|
+
a: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function parsePhiThemeColor(value: string): PhiThemeRgba | null;
|
|
15
|
+
/**
|
|
16
|
+
* Whether two values name the same colour: the same channels to the unit and the same alpha to the step
|
|
17
|
+
* an eight-digit hex can say. What does not read as a colour compares as text.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isSamePhiThemeColor(left: unknown, right: unknown): boolean;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A colour as a palette states it, read into numbers so two spellings of one colour compare equal.
|
|
3
|
+
*
|
|
4
|
+
* A palette is written by hand, by a picker and by a Module, and each spells a colour its own way:
|
|
5
|
+
* `#1677FF` and `#1677ff`, `#fff` and `#ffffff`, `rgb(22, 119, 255)`. Comparing the strings told the
|
|
6
|
+
* Theme workspace that a colour the author had not changed was theirs.
|
|
7
|
+
*/
|
|
8
|
+
/* Enough of CSS colour for what a palette states: hex in its four lengths and `rgb()`/`rgba()`. */
|
|
9
|
+
export function parsePhiThemeColor(value) {
|
|
10
|
+
const text = value.trim().toLowerCase();
|
|
11
|
+
const hex = /^#([0-9a-f]{3,8})$/.exec(text)?.[1];
|
|
12
|
+
if (hex) {
|
|
13
|
+
const full = hex.length <= 4 ? [...hex].map((digit) => digit + digit).join("") : hex;
|
|
14
|
+
return {
|
|
15
|
+
r: Number.parseInt(full.slice(0, 2), 16),
|
|
16
|
+
g: Number.parseInt(full.slice(2, 4), 16),
|
|
17
|
+
b: Number.parseInt(full.slice(4, 6), 16),
|
|
18
|
+
a: full.length >= 8 ? Number.parseInt(full.slice(6, 8), 16) / 255 : 1,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+)(%?))?/.exec(text);
|
|
22
|
+
if (!rgb)
|
|
23
|
+
return null;
|
|
24
|
+
const alpha = rgb[4] == null ? 1 : Number(rgb[4]) / (rgb[5] ? 100 : 1);
|
|
25
|
+
return { r: Number(rgb[1]), g: Number(rgb[2]), b: Number(rgb[3]), a: Math.min(1, Math.max(0, alpha)) };
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Whether two values name the same colour: the same channels to the unit and the same alpha to the step
|
|
29
|
+
* an eight-digit hex can say. What does not read as a colour compares as text.
|
|
30
|
+
*/
|
|
31
|
+
export function isSamePhiThemeColor(left, right) {
|
|
32
|
+
if (typeof left !== "string" || typeof right !== "string")
|
|
33
|
+
return left === right;
|
|
34
|
+
const first = parsePhiThemeColor(left);
|
|
35
|
+
const second = parsePhiThemeColor(right);
|
|
36
|
+
if (!first || !second)
|
|
37
|
+
return left.trim().toLowerCase() === right.trim().toLowerCase();
|
|
38
|
+
return Math.round(first.r) === Math.round(second.r)
|
|
39
|
+
&& Math.round(first.g) === Math.round(second.g)
|
|
40
|
+
&& Math.round(first.b) === Math.round(second.b)
|
|
41
|
+
&& Math.abs(first.a - second.a) < 0.5 / 255;
|
|
42
|
+
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* Theme workspace's preview writes the draft's, so a control that reads the property is in the right mode
|
|
14
14
|
* wherever it stands without asking which one that is.
|
|
15
15
|
*/
|
|
16
|
+
import { parsePhiThemeColor } from "./phi-theme-color";
|
|
16
17
|
export const PHI_THEME_GRADIENT_KEYS = ["gradient1", "gradient2", "gradient3"];
|
|
17
18
|
export const PHI_THEME_GRADIENT_TEXT_TONES = ["light", "dark"];
|
|
18
19
|
function isPhiThemeGradientKey(value) {
|
|
@@ -84,25 +85,6 @@ const PHI_PRIMARY_BUTTON_GRADIENT_TOKENS = {
|
|
|
84
85
|
/** A run a little lighter under the pointer, a little darker while it is pressed. */
|
|
85
86
|
export const PHI_GRADIENT_HOVER_FILTER = "brightness(1.18) saturate(1.15)";
|
|
86
87
|
const PHI_GRADIENT_ACTIVE_FILTER = "brightness(0.88)";
|
|
87
|
-
/* Enough of CSS colour for what a palette states: hex in its four lengths and `rgb()`/`rgba()`. */
|
|
88
|
-
function parseColor(value) {
|
|
89
|
-
const text = value.trim().toLowerCase();
|
|
90
|
-
const hex = /^#([0-9a-f]{3,8})$/.exec(text)?.[1];
|
|
91
|
-
if (hex) {
|
|
92
|
-
const full = hex.length <= 4 ? [...hex].map((digit) => digit + digit).join("") : hex;
|
|
93
|
-
return {
|
|
94
|
-
r: Number.parseInt(full.slice(0, 2), 16),
|
|
95
|
-
g: Number.parseInt(full.slice(2, 4), 16),
|
|
96
|
-
b: Number.parseInt(full.slice(4, 6), 16),
|
|
97
|
-
a: full.length >= 8 ? Number.parseInt(full.slice(6, 8), 16) / 255 : 1,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
const rgb = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)(?:[\s,/]+([\d.]+)(%?))?/.exec(text);
|
|
101
|
-
if (!rgb)
|
|
102
|
-
return null;
|
|
103
|
-
const alpha = rgb[4] == null ? 1 : Number(rgb[4]) / (rgb[5] ? 100 : 1);
|
|
104
|
-
return { r: Number(rgb[1]), g: Number(rgb[2]), b: Number(rgb[3]), a: Math.min(1, Math.max(0, alpha)) };
|
|
105
|
-
}
|
|
106
88
|
/** A translucent text colour as it lands on its ground: the near-black `0.88` text is not black. */
|
|
107
89
|
function composite(top, ground) {
|
|
108
90
|
const mix = (front, back) => front * top.a + back * (1 - top.a);
|
|
@@ -133,7 +115,7 @@ export function resolvePhiThemeGradientInks(token) {
|
|
|
133
115
|
const light = tokenColor(token, "colorTextLightSolid", PHI_GRADIENT_LIGHT_TEXT);
|
|
134
116
|
const candidates = [tokenColor(token, "colorText", PHI_GRADIENT_DARK_TEXT), tokenColor(token, "colorBgBase", PHI_GRADIENT_DARK_TEXT)];
|
|
135
117
|
const darkness = (colour) => {
|
|
136
|
-
const parsed =
|
|
118
|
+
const parsed = parsePhiThemeColor(colour);
|
|
137
119
|
return parsed ? relativeLuminance(composite(parsed, { r: 255, g: 255, b: 255 })) : Number.POSITIVE_INFINITY;
|
|
138
120
|
};
|
|
139
121
|
const dark = candidates.reduce((darkest, next) => (darkness(next) < darkness(darkest) ? next : darkest));
|
|
@@ -146,12 +128,12 @@ export function resolvePhiThemeGradientInks(token) {
|
|
|
146
128
|
* (`hsl()`, a variable): the Theme workspace then says nothing rather than something wrong.
|
|
147
129
|
*/
|
|
148
130
|
export function resolvePhiThemeGradientContrast(gradient, text) {
|
|
149
|
-
const words =
|
|
131
|
+
const words = parsePhiThemeColor(text);
|
|
150
132
|
if (!words)
|
|
151
133
|
return null;
|
|
152
134
|
let worst = null;
|
|
153
135
|
for (const [stopIndex, stop] of gradient.stops.entries()) {
|
|
154
|
-
const ground =
|
|
136
|
+
const ground = parsePhiThemeColor(stop.color);
|
|
155
137
|
if (!ground)
|
|
156
138
|
return null;
|
|
157
139
|
for (const hover of [false, true]) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type PhiThemePalette, type PhiThemePresetPlugin } from "./phi-theme-presets";
|
|
2
|
+
/**
|
|
3
|
+
* A Site's palette without the colours that change nothing over the palette block it follows.
|
|
4
|
+
*
|
|
5
|
+
* A palette entry is what an author decided differently from the Theme, and the Theme workspace offers
|
|
6
|
+
* to hand it back ("Reset to Theme", "Reset override"). An entry with the very colour the Theme gives
|
|
7
|
+
* anyway is no decision: the workspace showed a reset for it all the same, and every Site that saved a
|
|
8
|
+
* Module's Theme had one under every seed, because the save takes the Module's palette over
|
|
9
|
+
* (`adoptPhiThemeModulePalette`). The workspace reads ownership off this, and the save stores this, ahead
|
|
10
|
+
* of the takeover, so a Module's palette is still copied in whole and a core palette is simply followed.
|
|
11
|
+
*
|
|
12
|
+
* Entries are taken out one by one, each against what is left, so two entries that only together equal
|
|
13
|
+
* the Theme are both dropped and one that matters keeps the other where it is needed. Custom colours and
|
|
14
|
+
* gradient slots are not looked at here. `baseTokens` are the non-colour tokens the render derives with.
|
|
15
|
+
*/
|
|
16
|
+
export declare function omitPhiThemePaletteDefaults(preset: PhiThemePresetPlugin, palette: PhiThemePalette | null | undefined, baseTokens?: Record<string, unknown>): PhiThemePalette;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { readPhiAntdDefaultSeedToken, resolvePhiAntdAliasTokens } from "./phi-antd-token-resolver";
|
|
2
|
+
import { isSamePhiThemeColor } from "./phi-theme-color";
|
|
3
|
+
import { resolvePhiThemeColorTokens, } from "./phi-theme-presets";
|
|
4
|
+
const PHI_THEME_MODES = ["light", "dark"];
|
|
5
|
+
function listPhiThemePaletteEntries(palette) {
|
|
6
|
+
return [
|
|
7
|
+
...Object.keys(palette.seed ?? {}).map((key) => ({ level: "seed", key })),
|
|
8
|
+
...PHI_THEME_MODES.flatMap((mode) => [
|
|
9
|
+
...Object.keys(palette.modes?.[mode]?.seed ?? {})
|
|
10
|
+
.map((key) => ({ level: "modeSeed", mode, key })),
|
|
11
|
+
...Object.keys(palette.modes?.[mode]?.overrides ?? {})
|
|
12
|
+
.map((key) => ({ level: "modeOverride", mode, key })),
|
|
13
|
+
]),
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
function readPhiThemePaletteEntry(palette, entry) {
|
|
17
|
+
if (entry.level === "seed")
|
|
18
|
+
return palette.seed?.[entry.key];
|
|
19
|
+
const mode = palette.modes?.[entry.mode];
|
|
20
|
+
return entry.level === "modeSeed" ? mode?.seed?.[entry.key] : mode?.overrides?.[entry.key];
|
|
21
|
+
}
|
|
22
|
+
/** The palette without the one entry; an emptied record or mode goes with it. */
|
|
23
|
+
function omitPhiThemePaletteEntry(palette, entry) {
|
|
24
|
+
const without = (record) => {
|
|
25
|
+
const next = Object.fromEntries(Object.entries(record ?? {}).filter(([key]) => key !== entry.key));
|
|
26
|
+
return Object.keys(next).length > 0 ? next : undefined;
|
|
27
|
+
};
|
|
28
|
+
if (entry.level === "seed") {
|
|
29
|
+
const seed = without(palette.seed);
|
|
30
|
+
const { seed: _seed, ...rest } = palette;
|
|
31
|
+
return seed ? { ...rest, seed } : rest;
|
|
32
|
+
}
|
|
33
|
+
const current = palette.modes?.[entry.mode] ?? {};
|
|
34
|
+
const part = entry.level === "modeSeed" ? "seed" : "overrides";
|
|
35
|
+
const nextMode = { ...current, [part]: without(current[part]) };
|
|
36
|
+
if (nextMode[part] === undefined)
|
|
37
|
+
delete nextMode[part];
|
|
38
|
+
const modes = { ...(palette.modes ?? {}), [entry.mode]: nextMode };
|
|
39
|
+
if (Object.keys(nextMode).length === 0)
|
|
40
|
+
delete modes[entry.mode];
|
|
41
|
+
const { modes: _modes, ...rest } = palette;
|
|
42
|
+
return Object.keys(modes).length > 0 ? { ...rest, modes } : rest;
|
|
43
|
+
}
|
|
44
|
+
function isSamePhiThemeTokenInput(left, right) {
|
|
45
|
+
const keys = new Set([...Object.keys(left), ...Object.keys(right)]);
|
|
46
|
+
return [...keys].every((key) => isSamePhiThemeColor(left[key], right[key]));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether the palette renders the same in this mode without the entry.
|
|
50
|
+
*
|
|
51
|
+
* First on the token input, which is what decides the render and costs nothing to compare: a value the
|
|
52
|
+
* block below states the same way, a Module palette taken over on save above all. Where the entry is the
|
|
53
|
+
* only one to state its key, the input differs by that key alone, and the entry changes nothing if it is
|
|
54
|
+
* what Ant Design derives in its place -- a seed equal to the default seed, a hover equal to the hover
|
|
55
|
+
* the seed yields. A seed that releases derived colours the block states outright changes the input in
|
|
56
|
+
* more keys than its own and stays.
|
|
57
|
+
*/
|
|
58
|
+
function phiThemePaletteEntryChangesNothing(preset, palette, candidate, entry, mode, baseTokens) {
|
|
59
|
+
const stated = resolvePhiThemeColorTokens(preset, palette, mode);
|
|
60
|
+
const left = resolvePhiThemeColorTokens(preset, candidate, mode);
|
|
61
|
+
if (isSamePhiThemeTokenInput(stated, left))
|
|
62
|
+
return true;
|
|
63
|
+
const differing = [...new Set([...Object.keys(stated), ...Object.keys(left)])]
|
|
64
|
+
.filter((key) => !isSamePhiThemeColor(stated[key], left[key]));
|
|
65
|
+
if (differing.length !== 1 || differing[0] !== entry.key || entry.key in left)
|
|
66
|
+
return false;
|
|
67
|
+
/*
|
|
68
|
+
* A seed goes into the derivation as Ant Design's default seed, which is what to compare with: the
|
|
69
|
+
* alias token of the same name is a colour derived from it, and in the dark mode not the seed itself.
|
|
70
|
+
*/
|
|
71
|
+
const defaultSeed = readPhiAntdDefaultSeedToken(entry.key);
|
|
72
|
+
const inPlace = defaultSeed
|
|
73
|
+
? defaultSeed.value
|
|
74
|
+
: resolvePhiAntdAliasTokens(mode, { ...baseTokens, ...left })[entry.key];
|
|
75
|
+
return isSamePhiThemeColor(stated[entry.key], inPlace);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A Site's palette without the colours that change nothing over the palette block it follows.
|
|
79
|
+
*
|
|
80
|
+
* A palette entry is what an author decided differently from the Theme, and the Theme workspace offers
|
|
81
|
+
* to hand it back ("Reset to Theme", "Reset override"). An entry with the very colour the Theme gives
|
|
82
|
+
* anyway is no decision: the workspace showed a reset for it all the same, and every Site that saved a
|
|
83
|
+
* Module's Theme had one under every seed, because the save takes the Module's palette over
|
|
84
|
+
* (`adoptPhiThemeModulePalette`). The workspace reads ownership off this, and the save stores this, ahead
|
|
85
|
+
* of the takeover, so a Module's palette is still copied in whole and a core palette is simply followed.
|
|
86
|
+
*
|
|
87
|
+
* Entries are taken out one by one, each against what is left, so two entries that only together equal
|
|
88
|
+
* the Theme are both dropped and one that matters keeps the other where it is needed. Custom colours and
|
|
89
|
+
* gradient slots are not looked at here. `baseTokens` are the non-colour tokens the render derives with.
|
|
90
|
+
*/
|
|
91
|
+
export function omitPhiThemePaletteDefaults(preset, palette, baseTokens = {}) {
|
|
92
|
+
let current = palette ?? {};
|
|
93
|
+
for (const entry of listPhiThemePaletteEntries(current)) {
|
|
94
|
+
if (readPhiThemePaletteEntry(current, entry) === undefined)
|
|
95
|
+
continue;
|
|
96
|
+
const candidate = omitPhiThemePaletteEntry(current, entry);
|
|
97
|
+
const modes = entry.level === "seed" ? PHI_THEME_MODES : [entry.mode];
|
|
98
|
+
if (modes.every((mode) => phiThemePaletteEntryChangesNothing(preset, current, candidate, entry, mode, baseTokens))) {
|
|
99
|
+
current = candidate;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return current;
|
|
103
|
+
}
|
package/types/cms-plugins.d.ts
CHANGED
|
@@ -147,7 +147,12 @@ export type PhiCmsConfigField = (PhiCmsConfigFieldBase & {
|
|
|
147
147
|
type: "readonly";
|
|
148
148
|
}) | (PhiCmsConfigFieldBase & {
|
|
149
149
|
type: "data-provider";
|
|
150
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Which kind of Provider the binding names, or the kinds it takes: a record-bound Form reads a Table
|
|
152
|
+
* resource's row or a Collection resource's item, whichever declares `recordRead`. The resource is
|
|
153
|
+
* chosen the way the chosen Provider's kind chooses one.
|
|
154
|
+
*/
|
|
155
|
+
providerKind?: PhiRuntimeDataProviderKind | readonly PhiRuntimeDataProviderKind[];
|
|
151
156
|
/**
|
|
152
157
|
* The one record Provider this binding names, for a Widget that can only read one: a Gallery
|
|
153
158
|
* reads a Folder, an entry header an entry. The Inspector then offers no choice of Provider -- a list
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PhiSignalValueSchema } from "./signals";
|
|
2
|
+
import type { PhiTableProviderRecordRequest } from "./table-widget";
|
|
2
3
|
/**
|
|
3
4
|
* A renderer a Module offers for Collection items, its own or somebody else's.
|
|
4
5
|
*
|
|
@@ -51,6 +52,13 @@ export type PhiCollectionProviderResourceDescriptor = {
|
|
|
51
52
|
* Absent means this resource announces no selection, and the Builder offers no route for one.
|
|
52
53
|
*/
|
|
53
54
|
selectionValueSchema?: PhiSignalValueSchema;
|
|
55
|
+
/**
|
|
56
|
+
* Whether one item can be read on its own, by its key, as a Table resource's `recordRead` says it of a
|
|
57
|
+
* row: the Provider Client then has `readRecord`, and a record-bound Form opened from one of the
|
|
58
|
+
* View's items reads the item through it (FORMS.md, "A record opened from a Collection View"). Absent
|
|
59
|
+
* is no record read, and a Form bound to the resource fails with the reason rather than open empty.
|
|
60
|
+
*/
|
|
61
|
+
recordRead?: boolean;
|
|
54
62
|
defaultForWidget?: boolean;
|
|
55
63
|
query: {
|
|
56
64
|
search?: boolean;
|
|
@@ -107,6 +115,25 @@ export type PhiCollectionProviderActionRequest = {
|
|
|
107
115
|
params?: Record<string, unknown>;
|
|
108
116
|
signal: AbortSignal;
|
|
109
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* One item read on its own (`readRecord` on the Provider Client), the shape a Table Provider's record
|
|
120
|
+
* read already has: the resource, the item's key as `rowIdentity`, the binding's params, the reader's
|
|
121
|
+
* language and the Site's time zone, and the abort. One shape for both kinds, so a record-bound Form
|
|
122
|
+
* asks either the same way and a Provider that serves both writes one function.
|
|
123
|
+
*/
|
|
124
|
+
export type PhiCollectionProviderRecordRequest = PhiTableProviderRecordRequest;
|
|
125
|
+
/**
|
|
126
|
+
* What a Collection View announces on its `actionActivate` output (`collection-action`): which action,
|
|
127
|
+
* and for an item action the item's key, as the resource's `itemIdentityPath` reads it. A toolbar action
|
|
128
|
+
* names no item. `query` is the View's query as it stood, for a Controller that acts in its context (the
|
|
129
|
+
* Media library's new Folder in the open one). Read with `readPhiCollectionActionSignalValue`
|
|
130
|
+
* (`types/collection-signal-values.ts`).
|
|
131
|
+
*/
|
|
132
|
+
export type PhiCollectionActionSignalValue = {
|
|
133
|
+
actionKey: string;
|
|
134
|
+
itemKey?: string | number | null;
|
|
135
|
+
query?: PhiCollectionProviderQuery;
|
|
136
|
+
};
|
|
110
137
|
export type PhiCollectionViewBindingModel = {
|
|
111
138
|
query: PhiCollectionProviderQuery;
|
|
112
139
|
data: PhiCollectionProviderData | null;
|