@phis/ui 0.8.0 → 0.8.1
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/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 +23 -8
- 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/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- 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/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/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-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/customer-file.d.ts +12 -3
- package/constants/customer-file.js +12 -3
- package/constants/runtime-module-ownership.js +4 -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/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/next/root-route.js +2 -1
- package/package.json +1 -1
- 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/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
- 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/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/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 +173 -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 +30 -48
- 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 +15 -1
- 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
|
@@ -10,15 +10,24 @@ import { createPhiSharedRuntimeDataProviderKey } from "./runtime-data-provider-k
|
|
|
10
10
|
*/
|
|
11
11
|
export const PHI_CUSTOMER_FILE_DATA_PROVIDER_KEYS = {
|
|
12
12
|
table: createPhiSharedRuntimeDataProviderKey("tables", "threads-customer-file"),
|
|
13
|
+
/**
|
|
14
|
+
* The member's addresses as tiles (a Collection drawn by `PHI_SITE_ADDRESS_ITEM_RENDERER_KEY`), read-only,
|
|
15
|
+
* from the same read: the member arrives as the binding param `userId` (`PHI_CUSTOMER_FILE_MEMBER_PARAM`),
|
|
16
|
+
* which the Conversations Controller forwards from the person Table's choice.
|
|
17
|
+
*/
|
|
18
|
+
addresses: createPhiSharedRuntimeDataProviderKey("collections", "threads-customer-file-addresses"),
|
|
13
19
|
};
|
|
14
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* The resources, each one answer of the same route read for one member: the Table Provider's person and
|
|
22
|
+
* threads, and the addresses Collection's addresses.
|
|
23
|
+
*/
|
|
15
24
|
export const PHI_CUSTOMER_FILE_RESOURCE_KEYS = {
|
|
16
25
|
person: "person",
|
|
17
26
|
addresses: "addresses",
|
|
18
27
|
threads: "threads",
|
|
19
28
|
};
|
|
20
|
-
/** The binding param
|
|
21
|
-
export const
|
|
29
|
+
/** The binding param the addresses Collection reads its member from: `{ params: { userId } }`. */
|
|
30
|
+
export const PHI_CUSTOMER_FILE_MEMBER_PARAM = "userId";
|
|
22
31
|
/**
|
|
23
32
|
* The binding param a customer file Page writes its sentence for the reader's own file into, already in the
|
|
24
33
|
* reader's language: Core refuses that file (`403`), and each Table says this where its rows would be.
|
|
@@ -14,10 +14,13 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
|
|
|
14
14
|
"background-patterns/grid": ["core", "grid"],
|
|
15
15
|
"background-patterns/stripes": ["core", "stripes"],
|
|
16
16
|
"calendars/gregory": ["core", "gregory"],
|
|
17
|
+
"collections/app-addresses": ["app", "addresses"],
|
|
17
18
|
"collections/dashboard-cards": ["dashboard", "cards"],
|
|
18
19
|
"collections/media": ["asset", "media"],
|
|
20
|
+
"collections/threads-customer-file-addresses": ["threads", "customer-file-addresses"],
|
|
19
21
|
"renderers/dashboard-card": ["dashboard", "card"],
|
|
20
22
|
"renderers/media-asset": ["asset", "media-asset"],
|
|
23
|
+
"renderers/site-address": ["core", "site-address"],
|
|
21
24
|
"controller/accounting-base": ["accounting", "base"],
|
|
22
25
|
"controller/admin": ["admin", "default"],
|
|
23
26
|
"controller/app-base": ["app", "base"],
|
|
@@ -75,7 +78,6 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
|
|
|
75
78
|
"form-handler/app-address-create": ["app", "address-create"],
|
|
76
79
|
"form-handler/app-address-edit": ["app", "address-edit"],
|
|
77
80
|
"form-handler/app-profile-locale": ["app", "profile-locale"],
|
|
78
|
-
"form-handler/app-profile-newsletter": ["app", "profile-newsletter"],
|
|
79
81
|
"form-handler/app-profile-theme": ["app", "profile-theme"],
|
|
80
82
|
"form-handler/asset-folder-create": ["asset", "folder-create"],
|
|
81
83
|
"form-handler/asset-media-settings": ["asset", "media-settings"],
|
|
@@ -132,7 +134,6 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
|
|
|
132
134
|
"forms/app/address-create": ["app", "address-create"],
|
|
133
135
|
"forms/app/address-edit": ["app", "address-edit"],
|
|
134
136
|
"forms/app/profile-locale": ["app", "profile-locale"],
|
|
135
|
-
"forms/app/profile-newsletter": ["app", "profile-newsletter"],
|
|
136
137
|
"forms/app/profile-theme": ["app", "profile-theme"],
|
|
137
138
|
"forms/asset/folder-create": ["asset", "folder-create"],
|
|
138
139
|
"forms/asset/media-settings": ["asset", "media-settings"],
|
|
@@ -213,7 +214,6 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
|
|
|
213
214
|
"options/translation-contexts": ["localization", "translation-contexts"],
|
|
214
215
|
"tables/auth-installations": ["auth", "installations"],
|
|
215
216
|
"tables/threads-customer-file": ["threads", "customer-file"],
|
|
216
|
-
"tables/app-addresses": ["app", "addresses"],
|
|
217
217
|
"signals/auth-workflow-state": ["auth", "workflow-state"],
|
|
218
218
|
"signals/background-config": ["core", "background-config"],
|
|
219
219
|
"signals/border-config": ["core", "border-config"],
|
|
@@ -224,6 +224,7 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
|
|
|
224
224
|
"signals/builder-navigation": ["builder", "navigation"],
|
|
225
225
|
"signals/builder-node-selection": ["builder", "node-selection"],
|
|
226
226
|
"signals/collection-action": ["core", "collection-action"],
|
|
227
|
+
"signals/site-address-selection": ["core", "site-address-selection"],
|
|
227
228
|
"signals/control-options": ["core", "control-options"],
|
|
228
229
|
"signals/drag-drop": ["core", "drag-drop"],
|
|
229
230
|
"signals/form-error": ["core", "form-error"],
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The address tiles: a Collection's items as the addresses of a Site's book (`PhisSiteAddress`), drawn by
|
|
3
|
+
* Core's renderer (COLLECTIONS.md, "The address renderer"). A resource whose items are addresses in the
|
|
4
|
+
* shape `toPhiSiteAddressRow` gives them (`helpers/site-address-row.ts`) names this key as its
|
|
5
|
+
* `itemRendererKey`, and draws no tiles of its own: the account's own addresses on the App profile and
|
|
6
|
+
* staff's customer file both do. The Foundation names it, so a Module cites it without importing Core's
|
|
7
|
+
* Widget.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PHI_SITE_ADDRESS_ITEM_RENDERER_KEY: `${string}/${string}`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createPhiSharedRuntimeItemRendererKey } from "./runtime-data-provider-key";
|
|
2
|
+
/**
|
|
3
|
+
* The address tiles: a Collection's items as the addresses of a Site's book (`PhisSiteAddress`), drawn by
|
|
4
|
+
* Core's renderer (COLLECTIONS.md, "The address renderer"). A resource whose items are addresses in the
|
|
5
|
+
* shape `toPhiSiteAddressRow` gives them (`helpers/site-address-row.ts`) names this key as its
|
|
6
|
+
* `itemRendererKey`, and draws no tiles of its own: the account's own addresses on the App profile and
|
|
7
|
+
* staff's customer file both do. The Foundation names it, so a Module cites it without importing Core's
|
|
8
|
+
* Widget.
|
|
9
|
+
*/
|
|
10
|
+
export const PHI_SITE_ADDRESS_ITEM_RENDERER_KEY = createPhiSharedRuntimeItemRendererKey("site-address");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many skeleton rows a loading Table draws (TABLES.md, "Loading").
|
|
3
|
+
*
|
|
4
|
+
* Few on purpose: most Tables hold a handful of rows, and a Table that loads as a page of ten and then
|
|
5
|
+
* shows two shrinks under the reader's eyes and takes the Page below it up with it. Three rows grow into
|
|
6
|
+
* what arrives. A Table that is known to be long -- a paged listing that fills its page -- may state its
|
|
7
|
+
* own count in `presentation.loadingRows`, up to the most a Table may ask for.
|
|
8
|
+
*
|
|
9
|
+
* Imports nothing, so the Table Control and the Widget's config reader share it without the weight of
|
|
10
|
+
* either.
|
|
11
|
+
*/
|
|
12
|
+
export declare const PHI_TABLE_LOADING_ROWS = 3;
|
|
13
|
+
/** The most skeleton rows a Table may ask for: a page of 25, the usual page. */
|
|
14
|
+
export declare const PHI_TABLE_LOADING_ROWS_MAX = 25;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How many skeleton rows a loading Table draws (TABLES.md, "Loading").
|
|
3
|
+
*
|
|
4
|
+
* Few on purpose: most Tables hold a handful of rows, and a Table that loads as a page of ten and then
|
|
5
|
+
* shows two shrinks under the reader's eyes and takes the Page below it up with it. Three rows grow into
|
|
6
|
+
* what arrives. A Table that is known to be long -- a paged listing that fills its page -- may state its
|
|
7
|
+
* own count in `presentation.loadingRows`, up to the most a Table may ask for.
|
|
8
|
+
*
|
|
9
|
+
* Imports nothing, so the Table Control and the Widget's config reader share it without the weight of
|
|
10
|
+
* either.
|
|
11
|
+
*/
|
|
12
|
+
export const PHI_TABLE_LOADING_ROWS = 3;
|
|
13
|
+
/** The most skeleton rows a Table may ask for: a page of 25, the usual page. */
|
|
14
|
+
export const PHI_TABLE_LOADING_ROWS_MAX = 25;
|
package/constants.d.ts
CHANGED
|
@@ -5,12 +5,13 @@ export { buildPhiCmsWidgetNamespacedTypeKey, splitPhiCmsWidgetNamespacedTypeKey,
|
|
|
5
5
|
export * from "./constants/cms-plugin-categories";
|
|
6
6
|
export * from "./constants/runtime-module-categories";
|
|
7
7
|
export { PHI_THREAD_LIBRARY_DATA_PROVIDER_KEYS } from "./constants/thread-library-provider-keys";
|
|
8
|
-
export { PHI_CUSTOMER_FILE_DATA_PROVIDER_KEYS, PHI_CUSTOMER_FILE_RESOURCE_KEYS,
|
|
8
|
+
export { PHI_CUSTOMER_FILE_DATA_PROVIDER_KEYS, PHI_CUSTOMER_FILE_RESOURCE_KEYS, } from "./constants/customer-file";
|
|
9
9
|
export { PHIS_AREA_HEADER, PHIS_FORM_RELAY_HEADER, PHIS_REQUEST_PATH_HEADER, PHIS_REQUEST_SEARCH_HEADER, PHIS_SITE_KEY_HEADER, PHIS_TOKEN_HEADER, } from "./constants/http-headers";
|
|
10
10
|
export { buildPhiFontSubsetDeliveryUrl, buildPhiImageAssetVariantDeliveryUrl, buildPhiMediaAssetContentDeliveryUrl, isPhiMediaAssetOriginalOptimizable, isPhiMediaAssetPublic, isPhiMediaSvgContentType, normalizePhiImageAssetVariantKey, normalizePhiMediaKind, PhiImageAssetVariantKey, PhiImageAssetVariantKeyName, type PhiImageAssetVariantSpec, type PhiMediaAssetFlag, PhiMediaAssetFlags, PhiMediaDeliveryPolicy, PhiMediaFolderFlags, PhiMediaKind, PhiMediaLifecycleStatus, resolvePhiImageAssetVariantKeyName, resolvePhiImageAssetVariantSpec, resolvePhiMediaKindFromContentType, } from "./constants/media";
|
|
11
11
|
export * from "./constants/support";
|
|
12
12
|
export * from "./constants/threads";
|
|
13
13
|
export * from "./constants/user-state";
|
|
14
14
|
export * from "./constants/media-library-provider-keys";
|
|
15
|
+
export * from "./constants/site-address";
|
|
15
16
|
export * from "./constants/module-identity";
|
|
16
17
|
export { PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS } from "./constants/core-data-provider-keys";
|
package/constants.js
CHANGED
|
@@ -7,12 +7,14 @@ export * from "./constants/runtime-module-categories";
|
|
|
7
7
|
// The conversations a viewer is in, for every Module that lists its own kind of them (`fixedFilters`).
|
|
8
8
|
export { PHI_THREAD_LIBRARY_DATA_PROVIDER_KEYS } from "./constants/thread-library-provider-keys";
|
|
9
9
|
// Staff's customer file on one member, for a Module's own file Page over the same Core route (THREADS.md, 10).
|
|
10
|
-
export { PHI_CUSTOMER_FILE_DATA_PROVIDER_KEYS, PHI_CUSTOMER_FILE_RESOURCE_KEYS,
|
|
10
|
+
export { PHI_CUSTOMER_FILE_DATA_PROVIDER_KEYS, PHI_CUSTOMER_FILE_RESOURCE_KEYS, } from "./constants/customer-file";
|
|
11
11
|
export { PHIS_AREA_HEADER, PHIS_FORM_RELAY_HEADER, PHIS_REQUEST_PATH_HEADER, PHIS_REQUEST_SEARCH_HEADER, PHIS_SITE_KEY_HEADER, PHIS_TOKEN_HEADER, } from "./constants/http-headers";
|
|
12
12
|
export { buildPhiFontSubsetDeliveryUrl, buildPhiImageAssetVariantDeliveryUrl, buildPhiMediaAssetContentDeliveryUrl, isPhiMediaAssetOriginalOptimizable, isPhiMediaAssetPublic, isPhiMediaSvgContentType, normalizePhiImageAssetVariantKey, normalizePhiMediaKind, PhiImageAssetVariantKey, PhiImageAssetVariantKeyName, PhiMediaAssetFlags, PhiMediaDeliveryPolicy, PhiMediaFolderFlags, PhiMediaKind, PhiMediaLifecycleStatus, resolvePhiImageAssetVariantKeyName, resolvePhiImageAssetVariantSpec, resolvePhiMediaKindFromContentType, } from "./constants/media";
|
|
13
13
|
export * from "./constants/support";
|
|
14
14
|
export * from "./constants/threads";
|
|
15
15
|
export * from "./constants/user-state";
|
|
16
16
|
export * from "./constants/media-library-provider-keys";
|
|
17
|
+
// The address tiles, for any Module whose Collection's items are addresses of a Site's book (COLLECTIONS.md).
|
|
18
|
+
export * from "./constants/site-address";
|
|
17
19
|
export * from "./constants/module-identity";
|
|
18
20
|
export { PHI_CORE_RUNTIME_DATA_PROVIDER_KEYS } from "./constants/core-data-provider-keys";
|
|
@@ -3,7 +3,16 @@ import { isPhiCmsAreaKey } from "../constants/cms-areas";
|
|
|
3
3
|
import { isPhiRecord } from "../helpers/is-record";
|
|
4
4
|
import { buildPhiRuntimeModuleWidgetType } from "../plugins/runtime-modules/contracts";
|
|
5
5
|
import { isPhiConfigError } from "../components/widgets/config/strict-config-reader";
|
|
6
|
+
import { checkPhiWidgetBinding, checkPhiWidgetConfigIcons, } from "../helpers/widget-binding-check";
|
|
6
7
|
import { jsonResponse } from "./route-handler-helpers";
|
|
8
|
+
function buildDataProvidersByKey(catalog) {
|
|
9
|
+
const providers = new Map();
|
|
10
|
+
for (const entry of catalog.values()) {
|
|
11
|
+
for (const provider of entry.definition.dataProviders ?? [])
|
|
12
|
+
providers.set(provider.key, provider);
|
|
13
|
+
}
|
|
14
|
+
return providers;
|
|
15
|
+
}
|
|
7
16
|
function buildWidgetDefinitionsByType(catalog) {
|
|
8
17
|
const definitions = new Map();
|
|
9
18
|
for (const entry of catalog.values()) {
|
|
@@ -13,7 +22,7 @@ function buildWidgetDefinitionsByType(catalog) {
|
|
|
13
22
|
}
|
|
14
23
|
return definitions;
|
|
15
24
|
}
|
|
16
|
-
function findConfigIssue(body, definitions) {
|
|
25
|
+
function findConfigIssue(body, definitions, providers) {
|
|
17
26
|
const pending = [body];
|
|
18
27
|
while (pending.length > 0) {
|
|
19
28
|
const value = pending.pop();
|
|
@@ -28,8 +37,9 @@ function findConfigIssue(body, definitions) {
|
|
|
28
37
|
if (typeof widgetType === "string" && isPhiRecord(config)) {
|
|
29
38
|
const definition = definitions.get(widgetType);
|
|
30
39
|
if (definition) {
|
|
40
|
+
let parsed;
|
|
31
41
|
try {
|
|
32
|
-
definition.parseConfig(config);
|
|
42
|
+
parsed = definition.parseConfig(config);
|
|
33
43
|
}
|
|
34
44
|
catch (error) {
|
|
35
45
|
/*
|
|
@@ -44,6 +54,12 @@ function findConfigIssue(body, definitions) {
|
|
|
44
54
|
message: error instanceof Error ? error.message : String(error),
|
|
45
55
|
};
|
|
46
56
|
}
|
|
57
|
+
const [icon] = checkPhiWidgetConfigIcons(definition.fields, config);
|
|
58
|
+
const [binding] = checkPhiWidgetBinding(widgetType, isPhiRecord(parsed) ? parsed : config, providers);
|
|
59
|
+
const message = binding ?? icon;
|
|
60
|
+
if (message) {
|
|
61
|
+
return { widgetType, nodeId: value.id ?? null, path: null, message };
|
|
62
|
+
}
|
|
47
63
|
}
|
|
48
64
|
}
|
|
49
65
|
pending.push(...Object.values(value));
|
|
@@ -65,7 +81,7 @@ export async function validatePhiCmsStructureWrite(request, loadAreaBridge) {
|
|
|
65
81
|
const bridge = await loadAreaBridge(area);
|
|
66
82
|
if (!bridge)
|
|
67
83
|
return null;
|
|
68
|
-
const issue = findConfigIssue(body, buildWidgetDefinitionsByType(bridge.runtimeModuleCatalog));
|
|
84
|
+
const issue = findConfigIssue(body, buildWidgetDefinitionsByType(bridge.runtimeModuleCatalog), buildDataProvidersByKey(bridge.runtimeModuleCatalog));
|
|
69
85
|
if (!issue)
|
|
70
86
|
return null;
|
|
71
87
|
return jsonResponse({
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type PhiSignalValueSchema } from "../types/signals";
|
|
2
|
+
/**
|
|
3
|
+
* An action announced on the action channel, by whichever of the two announcers said it: a Table's
|
|
4
|
+
* `table-action` (`{ actionKey, rowIdentity }`) or a Collection View's `collection-action`
|
|
5
|
+
* (`{ actionKey, itemKey }`). Both name the action in the message, so every listener decides by its own
|
|
6
|
+
* `openActionKey` whether it was meant, and the record either names is `recordKey` -- a row's identity, an
|
|
7
|
+
* item's key, `null` for a toolbar action.
|
|
8
|
+
*
|
|
9
|
+
* `undefined` for a route of any other schema: not an announcement at all, and the caller treats it as it
|
|
10
|
+
* always did. `null` for an announcement that cannot be read.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readPhiAnnouncedAction(valueSchema: PhiSignalValueSchema | null | undefined, value: unknown): {
|
|
13
|
+
actionKey: string;
|
|
14
|
+
recordKey: string | number | null;
|
|
15
|
+
} | null | undefined;
|
|
16
|
+
/** Whether a route carries an announced action, a Table's or a Collection View's. */
|
|
17
|
+
export declare function isPhiAnnouncedActionSchema(valueSchema: PhiSignalValueSchema | null | undefined): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PHI_SIGNAL_VALUE_SCHEMAS } from "../types/signals";
|
|
2
|
+
import { readPhiTableActionSignalValue } from "../types/table-signal-values";
|
|
3
|
+
import { readPhiCollectionActionSignalValue } from "../types/collection-signal-values";
|
|
4
|
+
/**
|
|
5
|
+
* An action announced on the action channel, by whichever of the two announcers said it: a Table's
|
|
6
|
+
* `table-action` (`{ actionKey, rowIdentity }`) or a Collection View's `collection-action`
|
|
7
|
+
* (`{ actionKey, itemKey }`). Both name the action in the message, so every listener decides by its own
|
|
8
|
+
* `openActionKey` whether it was meant, and the record either names is `recordKey` -- a row's identity, an
|
|
9
|
+
* item's key, `null` for a toolbar action.
|
|
10
|
+
*
|
|
11
|
+
* `undefined` for a route of any other schema: not an announcement at all, and the caller treats it as it
|
|
12
|
+
* always did. `null` for an announcement that cannot be read.
|
|
13
|
+
*/
|
|
14
|
+
export function readPhiAnnouncedAction(valueSchema, value) {
|
|
15
|
+
if (valueSchema === PHI_SIGNAL_VALUE_SCHEMAS.tableAction) {
|
|
16
|
+
const action = readPhiTableActionSignalValue(value);
|
|
17
|
+
return action ? { actionKey: action.actionKey, recordKey: action.rowIdentity ?? null } : null;
|
|
18
|
+
}
|
|
19
|
+
if (valueSchema === PHI_SIGNAL_VALUE_SCHEMAS.collectionAction) {
|
|
20
|
+
const action = readPhiCollectionActionSignalValue(value);
|
|
21
|
+
return action ? { actionKey: action.actionKey, recordKey: action.itemKey ?? null } : null;
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
/** Whether a route carries an announced action, a Table's or a Collection View's. */
|
|
26
|
+
export function isPhiAnnouncedActionSchema(valueSchema) {
|
|
27
|
+
return valueSchema === PHI_SIGNAL_VALUE_SCHEMAS.tableAction ||
|
|
28
|
+
valueSchema === PHI_SIGNAL_VALUE_SCHEMAS.collectionAction;
|
|
29
|
+
}
|
|
@@ -3,14 +3,6 @@ import type { PhiCmsAreaKey } from "../constants/cms-areas";
|
|
|
3
3
|
import { type PhiAreaMeta } from "./cms-area-config";
|
|
4
4
|
import type { PhiSignetHead } from "./phi-signet-head";
|
|
5
5
|
import { type PhiPublicPageAddress } from "./phi-seo";
|
|
6
|
-
/**
|
|
7
|
-
* What the head says of a Site that has said nothing: neither the Page's description nor the Theme's
|
|
8
|
-
* slogan. Worded as the placeholder it is, so a link shared before anybody replaced it tells the operator
|
|
9
|
-
* where to.
|
|
10
|
-
*/
|
|
11
|
-
export declare const PHI_DEFAULT_SITE_DESCRIPTION = "Default description of the phis starter. Set your own in the Page meta or as the Theme's slogan.";
|
|
12
|
-
/** The Site's description: the Theme's slogan, else the starter's placeholder. */
|
|
13
|
-
export declare function resolvePhiSiteDescription(slogan: string | null | undefined): string;
|
|
14
6
|
/** The picture of a link preview, resolved: its absolute address, its exact size and what it shows. */
|
|
15
7
|
export type PhiLinkPreviewImage = {
|
|
16
8
|
url: string;
|
package/helpers/phi-metadata.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import { PHI_AREA_META_PUBLIC_DEFAULTS, PHI_AREA_TITLE_TEMPLATE_PLACEHOLDER, } from "./cms-area-config";
|
|
2
2
|
import { buildPhiPublicPageAlternates } from "./phi-seo";
|
|
3
3
|
import { readPhiXAccount } from "../types/link-preview";
|
|
4
|
-
|
|
5
|
-
* What the head says of a Site that has said nothing: neither the Page's description nor the Theme's
|
|
6
|
-
* slogan. Worded as the placeholder it is, so a link shared before anybody replaced it tells the operator
|
|
7
|
-
* where to.
|
|
8
|
-
*/
|
|
9
|
-
export const PHI_DEFAULT_SITE_DESCRIPTION = "Default description of the phis starter. Set your own in the Page meta or as the Theme's slogan.";
|
|
10
|
-
/** The Site's description: the Theme's slogan, else the starter's placeholder. */
|
|
11
|
-
export function resolvePhiSiteDescription(slogan) {
|
|
12
|
-
return slogan?.trim() || PHI_DEFAULT_SITE_DESCRIPTION;
|
|
13
|
-
}
|
|
4
|
+
import { resolvePhiSiteDescription } from "./phi-site-description";
|
|
14
5
|
/** A Site locale as Open Graph spells it: `pt-BR` is `pt_BR`. */
|
|
15
6
|
function toPhiOpenGraphLocale(locale) {
|
|
16
7
|
return locale.replaceAll("-", "_");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the head says of a Site that has said nothing: neither the Page's description nor the Theme's
|
|
3
|
+
* slogan. Worded as the placeholder it is, so a link shared before anybody replaced it tells the operator
|
|
4
|
+
* where to.
|
|
5
|
+
*
|
|
6
|
+
* A file of its own, apart from `phi-metadata.ts`, because the Theme workspace's link card shows the same
|
|
7
|
+
* words in the browser and the head builder would bring the whole route metadata along with them.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PHI_DEFAULT_SITE_DESCRIPTION = "Default description of the phis starter. Set your own in the Page meta or as the Theme's slogan.";
|
|
10
|
+
/** The Site's description: the Theme's slogan, else the starter's placeholder. */
|
|
11
|
+
export declare function resolvePhiSiteDescription(slogan: string | null | undefined): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the head says of a Site that has said nothing: neither the Page's description nor the Theme's
|
|
3
|
+
* slogan. Worded as the placeholder it is, so a link shared before anybody replaced it tells the operator
|
|
4
|
+
* where to.
|
|
5
|
+
*
|
|
6
|
+
* A file of its own, apart from `phi-metadata.ts`, because the Theme workspace's link card shows the same
|
|
7
|
+
* words in the browser and the head builder would bring the whole route metadata along with them.
|
|
8
|
+
*/
|
|
9
|
+
export const PHI_DEFAULT_SITE_DESCRIPTION = "Default description of the phis starter. Set your own in the Page meta or as the Theme's slogan.";
|
|
10
|
+
/** The Site's description: the Theme's slogan, else the starter's placeholder. */
|
|
11
|
+
export function resolvePhiSiteDescription(slogan) {
|
|
12
|
+
return slogan?.trim() || PHI_DEFAULT_SITE_DESCRIPTION;
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PhiFormDescriptor } from "@phis/contracts/forms";
|
|
2
|
+
import type { PhiPresetTreeContractFinding } from "./preset-tree-contract-check";
|
|
3
|
+
/**
|
|
4
|
+
* Every Form a package ships, held to the rules its fields' Controls read them by
|
|
5
|
+
* (`checkPhiFormDescriptorFields`: a money field's currency and `currencyField`, a flags field's bits),
|
|
6
|
+
* as findings whose `node` is the Form id (THIRD_PARTY_MODULES.md, "Checking a Page preset").
|
|
7
|
+
*
|
|
8
|
+
* Verify-time only, from `@phis/ui/module/page-check`: a package runs it in its own tests over its Form
|
|
9
|
+
* definitions (`definePhiRuntimeModuleForm`), as phis-ui runs it over its own, and a Site never loads it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function checkPhiPresetForms(forms: Iterable<{
|
|
12
|
+
formId: string;
|
|
13
|
+
descriptor: Pick<PhiFormDescriptor, "fields">;
|
|
14
|
+
}>): PhiPresetTreeContractFinding[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { checkPhiFormDescriptorFields } from "../components/forms/form-descriptor-field-check";
|
|
2
|
+
/**
|
|
3
|
+
* Every Form a package ships, held to the rules its fields' Controls read them by
|
|
4
|
+
* (`checkPhiFormDescriptorFields`: a money field's currency and `currencyField`, a flags field's bits),
|
|
5
|
+
* as findings whose `node` is the Form id (THIRD_PARTY_MODULES.md, "Checking a Page preset").
|
|
6
|
+
*
|
|
7
|
+
* Verify-time only, from `@phis/ui/module/page-check`: a package runs it in its own tests over its Form
|
|
8
|
+
* definitions (`definePhiRuntimeModuleForm`), as phis-ui runs it over its own, and a Site never loads it.
|
|
9
|
+
*/
|
|
10
|
+
export function checkPhiPresetForms(forms) {
|
|
11
|
+
return [...forms].flatMap((form) => checkPhiFormDescriptorFields(form.descriptor).map((message) => ({ node: form.formId, message })));
|
|
12
|
+
}
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import type { PhiResolvedCmsPageTree } from "../types/cms";
|
|
2
|
-
import { type PhiTableProviderResourceDescriptor } from "../types/table-widget";
|
|
3
2
|
import type { PhiPresetTreeContractFinding } from "./preset-tree-contract-check";
|
|
4
3
|
import type { PhiRuntimeModuleDefinition } from "../types/cms-plugins";
|
|
4
|
+
import { type PhiBindingCheckProvider } from "./widget-binding-check";
|
|
5
5
|
/**
|
|
6
|
-
* Every
|
|
7
|
-
* (THIRD_PARTY_MODULES.md, "Checking a Page preset")
|
|
8
|
-
* (`
|
|
6
|
+
* Every bound Widget of a preset tree -- Table, Tree and record Widget -- read against the resource its
|
|
7
|
+
* Provider declares (THIRD_PARTY_MODULES.md, "Checking a Page preset"), by the same check the Builder's
|
|
8
|
+
* save runs (`checkPhiWidgetBinding`): a Table's columns, filters, sorting, counted footer and actions
|
|
9
|
+
* (`validatePhiTableWidgetBinding`) and every icon its actions and binding tools name
|
|
10
|
+
* (`isPhiIconNameKnown`), a Tree's node fields, tools, actions and drag and drop
|
|
11
|
+
* (`validatePhiTreeWidgetBinding`), a record Widget's actions (`validatePhiRecordWidgetBinding`). And one
|
|
12
|
+
* rule of the house: a Table that shows its header row ends in its footer (`presentation.footer`, the
|
|
13
|
+
* count or paging line), and a Table without a header -- one that only lays out rows or aligns columns --
|
|
14
|
+
* needs none (TABLES.md, "Footer and summary"); the rare Table with a header and nothing to count says why
|
|
15
|
+
* in `footerOmitted`. New Pages kept leaving the footer out, and nothing but a reader missing the count
|
|
16
|
+
* noticed.
|
|
9
17
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* in its own tests over every tree its presets build, beside
|
|
13
|
-
*
|
|
18
|
+
* Nothing in the browser checks a binding (owner, 2026-11-24): a live Widget trusts the config it is
|
|
19
|
+
* handed, so a binding that does not hold is a Widget that draws the wrong thing, and this check is where
|
|
20
|
+
* it is caught. A package runs it in its own tests over every tree its presets build, beside
|
|
21
|
+
* `checkPhiPresetTreeContract`, with every data Provider it ships (`dataProviders`: its Module's Provider
|
|
22
|
+
* descriptors, Table and Tree alike). A Widget on a Provider not handed over is not judged.
|
|
14
23
|
*
|
|
15
24
|
* Verify-time only, and apart from the contract check on purpose: that one also runs while a Site serves
|
|
16
|
-
* a Page,
|
|
25
|
+
* a Page, which must not pay for checks that belong where the config is made.
|
|
17
26
|
*/
|
|
18
27
|
export declare function checkPhiPresetTables(tree: PhiResolvedCmsPageTree, options: {
|
|
19
|
-
dataProviders: Iterable<
|
|
28
|
+
dataProviders: Iterable<PhiBindingCheckProvider>;
|
|
20
29
|
}): PhiPresetTreeContractFinding[];
|
|
21
|
-
/** A Table Provider as a package declares it: its key and the resources a Table binds to. */
|
|
22
|
-
export type PresetTreeTableProvider = {
|
|
23
|
-
key: string;
|
|
24
|
-
resources?: readonly PhiTableProviderResourceDescriptor[];
|
|
25
|
-
};
|
|
26
30
|
/**
|
|
27
31
|
* Every Table a Module offers to Markdown (TABLES.md, "Tables in Markdown"), checked as a Preset's Table is
|
|
28
32
|
* above: its columns against its resource, and what makes it an embed -- no editor; pinned filters and
|
|
@@ -1,58 +1,52 @@
|
|
|
1
1
|
import { PhiCmsWidgetType } from "../constants/cms-widget-types";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { validatePhiTableWidgetBinding } from "./table-widget-binding";
|
|
3
|
+
import { checkPhiWidgetBinding } from "./widget-binding-check";
|
|
4
4
|
/**
|
|
5
|
-
* Every
|
|
6
|
-
* (THIRD_PARTY_MODULES.md, "Checking a Page preset")
|
|
7
|
-
* (`
|
|
5
|
+
* Every bound Widget of a preset tree -- Table, Tree and record Widget -- read against the resource its
|
|
6
|
+
* Provider declares (THIRD_PARTY_MODULES.md, "Checking a Page preset"), by the same check the Builder's
|
|
7
|
+
* save runs (`checkPhiWidgetBinding`): a Table's columns, filters, sorting, counted footer and actions
|
|
8
|
+
* (`validatePhiTableWidgetBinding`) and every icon its actions and binding tools name
|
|
9
|
+
* (`isPhiIconNameKnown`), a Tree's node fields, tools, actions and drag and drop
|
|
10
|
+
* (`validatePhiTreeWidgetBinding`), a record Widget's actions (`validatePhiRecordWidgetBinding`). And one
|
|
11
|
+
* rule of the house: a Table that shows its header row ends in its footer (`presentation.footer`, the
|
|
12
|
+
* count or paging line), and a Table without a header -- one that only lays out rows or aligns columns --
|
|
13
|
+
* needs none (TABLES.md, "Footer and summary"); the rare Table with a header and nothing to count says why
|
|
14
|
+
* in `footerOmitted`. New Pages kept leaving the footer out, and nothing but a reader missing the count
|
|
15
|
+
* noticed.
|
|
8
16
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* in its own tests over every tree its presets build, beside
|
|
12
|
-
*
|
|
17
|
+
* Nothing in the browser checks a binding (owner, 2026-11-24): a live Widget trusts the config it is
|
|
18
|
+
* handed, so a binding that does not hold is a Widget that draws the wrong thing, and this check is where
|
|
19
|
+
* it is caught. A package runs it in its own tests over every tree its presets build, beside
|
|
20
|
+
* `checkPhiPresetTreeContract`, with every data Provider it ships (`dataProviders`: its Module's Provider
|
|
21
|
+
* descriptors, Table and Tree alike). A Widget on a Provider not handed over is not judged.
|
|
13
22
|
*
|
|
14
23
|
* Verify-time only, and apart from the contract check on purpose: that one also runs while a Site serves
|
|
15
|
-
* a Page,
|
|
24
|
+
* a Page, which must not pay for checks that belong where the config is made.
|
|
16
25
|
*/
|
|
17
26
|
export function checkPhiPresetTables(tree, options) {
|
|
18
27
|
const findings = [];
|
|
19
|
-
|
|
20
|
-
return findings;
|
|
21
|
-
}
|
|
22
|
-
function checkTables(tree, dataProviders, report) {
|
|
23
|
-
const providers = new Map([...dataProviders].map((provider) => [provider.key, provider]));
|
|
28
|
+
const providers = new Map([...options.dataProviders].map((provider) => [provider.key, provider]));
|
|
24
29
|
for (const widget of tree.contentWidgets) {
|
|
30
|
+
// The config as the preset wrote it, which is what the Widget receives: a preset states the whole shape.
|
|
31
|
+
const bindingFindings = checkPhiWidgetBinding(widget.widgetType, widget.config, providers);
|
|
32
|
+
for (const message of bindingFindings)
|
|
33
|
+
findings.push({ node: widget.id, message });
|
|
25
34
|
if (widget.widgetType !== PhiCmsWidgetType.Table)
|
|
26
35
|
continue;
|
|
27
|
-
// The config as the preset wrote it, which is what the Table receives: a preset states the whole shape.
|
|
28
36
|
const config = widget.config;
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
if (!
|
|
32
|
-
continue;
|
|
33
|
-
const resource = provider.resources?.find((candidate) => candidate.resourceKey === source.resourceKey);
|
|
34
|
-
if (!resource) {
|
|
35
|
-
report(widget.id, `Table is bound to resource "${source.resourceKey}", which "${provider.key}" does not declare.`);
|
|
37
|
+
const provider = config.source?.providerKey ? providers.get(config.source.providerKey) : undefined;
|
|
38
|
+
const declared = provider?.resources?.some((candidate) => candidate.resourceKey === config.source?.resourceKey);
|
|
39
|
+
if (!declared)
|
|
36
40
|
continue;
|
|
41
|
+
const footerOmitted = config.presentation?.footerOmitted?.trim();
|
|
42
|
+
if (config.presentation?.footer && footerOmitted) {
|
|
43
|
+
findings.push({ node: widget.id, message: "Table states a footer and `footerOmitted` beside it; a reason for leaving the footer out is for a Table without one." });
|
|
37
44
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const actions = [
|
|
41
|
-
...(config.features?.actions?.toolbar ?? []),
|
|
42
|
-
...(config.features?.actions?.row ?? []),
|
|
43
|
-
...(config.features?.actions?.bulk ?? []),
|
|
44
|
-
];
|
|
45
|
-
for (const action of actions) {
|
|
46
|
-
if (action.display !== "label" && action.icon && !isPhiIconNameKnown(action.icon.trim())) {
|
|
47
|
-
report(widget.id, `Table action "${action.key}" names the icon "${action.icon}", which PhiIcon does not know.`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
for (const tool of config.features?.tools?.bindingFields ?? []) {
|
|
51
|
-
if (tool.create?.display !== "label" && tool.create?.icon && !isPhiIconNameKnown(tool.create.icon.trim())) {
|
|
52
|
-
report(widget.id, `Table binding field "${tool.key}" names the create icon "${tool.create.icon}", which PhiIcon does not know.`);
|
|
53
|
-
}
|
|
45
|
+
else if (config.presentation?.header !== false && !config.presentation?.footer && !footerOmitted) {
|
|
46
|
+
findings.push({ node: widget.id, message: "Table shows a header and no footer: a Table with a header row ends in `presentation.footer` (TABLES.md, \"Footer and summary\"); one that only lays out rows says `header: false`, and one with a header and nothing to count says why in `footerOmitted`." });
|
|
54
47
|
}
|
|
55
48
|
}
|
|
49
|
+
return findings;
|
|
56
50
|
}
|
|
57
51
|
const hasStaticOptions = (field) => (field.options?.length ?? 0) > 0 && !field.optionsProvider;
|
|
58
52
|
/**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PhiRecordWidgetConfig } from "../types/record-widget";
|
|
2
|
+
import type { PhiTableProviderResourceDescriptor } from "../types/table-widget";
|
|
3
|
+
/**
|
|
4
|
+
* What the record Widget's actions ask of its resource, as findings --
|
|
5
|
+
* the Table's binding check (`validatePhiTableWidgetBinding`) for the one scope a record has. Each action
|
|
6
|
+
* is the resource's, of scope `row`, named once, and drawn as the danger a destructive one is. A
|
|
7
|
+
* confirmation the resource requires is not asked for here: the record on screen, named in the dialog's
|
|
8
|
+
* title, and the press beside it are that confirmation, and a `confirm` would ask a second time.
|
|
9
|
+
*/
|
|
10
|
+
export declare function validatePhiRecordWidgetBinding(config: Partial<Pick<PhiRecordWidgetConfig, "actions">>, resource: Pick<PhiTableProviderResourceDescriptor, "resourceKey" | "actions">): string[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Checked where a config is made, as the Table's binding is (`helpers/table-widget-binding.ts`): a
|
|
3
|
+
* package's preset tests (`checkPhiPresetTables`), `pnpm verify` and the Builder's save, never in the
|
|
4
|
+
* browser, so the record Widget's live Client trusts its actions.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* What the record Widget's actions ask of its resource, as findings --
|
|
8
|
+
* the Table's binding check (`validatePhiTableWidgetBinding`) for the one scope a record has. Each action
|
|
9
|
+
* is the resource's, of scope `row`, named once, and drawn as the danger a destructive one is. A
|
|
10
|
+
* confirmation the resource requires is not asked for here: the record on screen, named in the dialog's
|
|
11
|
+
* title, and the press beside it are that confirmation, and a `confirm` would ask a second time.
|
|
12
|
+
*/
|
|
13
|
+
export function validatePhiRecordWidgetBinding(config, resource) {
|
|
14
|
+
const errors = [];
|
|
15
|
+
const declared = new Map(resource.actions?.map((action) => [action.key, action]) ?? []);
|
|
16
|
+
const seen = new Set();
|
|
17
|
+
for (const action of config.actions ?? []) {
|
|
18
|
+
if (seen.has(action.key)) {
|
|
19
|
+
errors.push(`Record action "${action.key}" is configured more than once.`);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
seen.add(action.key);
|
|
23
|
+
const capability = declared.get(action.key);
|
|
24
|
+
if (!capability) {
|
|
25
|
+
errors.push(`Record action "${action.key}" is not declared by resource "${resource.resourceKey}".`);
|
|
26
|
+
}
|
|
27
|
+
else if (capability.scope !== "row") {
|
|
28
|
+
errors.push(`Record action "${action.key}" cannot run on a record: its scope is "${capability.scope}".`);
|
|
29
|
+
}
|
|
30
|
+
else if (capability.intent === "destructive" && action.mode !== "danger") {
|
|
31
|
+
errors.push(`Destructive Record action "${action.key}" requires danger presentation.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return errors;
|
|
35
|
+
}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PhiTableProviderResourceDescriptor } from "../types/table-widget";
|
|
1
|
+
import type { PhiRecordWidgetTitleFromRecord } from "../types/record-widget";
|
|
3
2
|
/**
|
|
4
3
|
* The placement's `titleFromRecord`, or null where it states none. Strict, as the Form's: no field, or a
|
|
5
4
|
* sentence without exactly one `%1`, is refused rather than read as no title.
|
|
6
5
|
*/
|
|
7
6
|
export declare function readPhiRecordWidgetTitleFromRecord(value: unknown): PhiRecordWidgetTitleFromRecord | null;
|
|
8
|
-
/**
|
|
9
|
-
* What the record Widget's actions ask of its resource, as the errors it shows instead of the record --
|
|
10
|
-
* the Table's binding check (`validatePhiTableWidgetBinding`) for the one scope a record has. Each action
|
|
11
|
-
* is the resource's, of scope `row`, named once, and drawn as the danger a destructive one is. A
|
|
12
|
-
* confirmation the resource requires is not asked for here: the record on screen, named in the dialog's
|
|
13
|
-
* title, and the press beside it are that confirmation, and a `confirm` would ask a second time.
|
|
14
|
-
*/
|
|
15
|
-
export declare function validatePhiRecordWidgetBinding(config: Pick<PhiRecordWidgetConfig, "actions">, resource: Pick<PhiTableProviderResourceDescriptor, "resourceKey" | "actions">): string[];
|