@phis/ui 0.5.3 → 0.5.5
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 +17 -7
- package/components/controls/phi-cascader-control.d.ts +9 -1
- package/components/controls/phi-cascader-control.js +25 -3
- package/components/controls/phi-money-control.d.ts +39 -0
- package/components/controls/phi-money-control.js +34 -0
- package/components/controls/phi-number-control.d.ts +6 -1
- package/components/controls/phi-number-control.js +3 -3
- package/components/controls/phi-options-provider.d.ts +7 -0
- package/components/controls/phi-options-provider.js +11 -0
- package/components/forms/extended-form-field-controls.d.ts +1 -0
- package/components/forms/extended-form-field-controls.js +23 -1
- package/components/forms/form-descriptor-runtime-client.js +13 -0
- package/components/forms/form-provider-contract.d.ts +43 -0
- package/components/forms/form-provider-contract.js +40 -0
- package/components/forms/money-field.d.ts +27 -0
- package/components/forms/money-field.js +78 -0
- package/components/forms/shared-form-provider-registry.js +4 -0
- package/components/layouts/clients/phi-flex-layout-client.js +17 -2
- package/components/layouts/clients/phi-layout-anchored-overlay.d.ts +2 -0
- package/components/layouts/clients/phi-layout-anchored-overlay.js +2 -0
- package/components/media/phi-media-picker-binding.js +6 -1
- package/components/media/phi-site-font-assets.js +6 -1
- package/components/motion/phi-sequence-run.d.ts +14 -1
- package/components/motion/phi-sequence-run.js +22 -3
- package/components/motion/phi-sequence-viewport.js +3 -1
- package/components/regions/presets/content-entry-editor-page-tree.js +5 -1
- package/components/regions/presets/content-entry-public-page-trees.js +2 -0
- package/components/tables/client/phi-table-binding.js +16 -3
- package/components/trees/client/phi-tree-binding.js +6 -2
- package/components/widgets/builder/stack-tabs.d.ts +2 -1
- package/components/widgets/builder/stack-tabs.js +18 -2
- package/components/widgets/client/shared/phi-collection-view-binding.js +10 -2
- package/components/widgets/client/shared/phi-rendered-value.d.ts +9 -1
- package/components/widgets/client/shared/phi-rendered-value.js +20 -1
- package/components/widgets/config/choice-shared.d.ts +1 -49
- package/components/widgets/config/choice-shared.js +0 -1
- package/components/widgets/config/stack-tabs.js +4 -3
- package/components/widgets/label-sets/gallery.js +6 -0
- package/components/widgets/label-sets/interval.d.ts +4 -0
- package/components/widgets/label-sets/interval.js +31 -0
- package/components/widgets/label-sets/record.js +6 -1
- package/components/widgets/label-sets/slot-upload.d.ts +4 -0
- package/components/widgets/label-sets/slot-upload.js +36 -0
- package/components/widgets/label-sets/table.js +6 -1
- package/components/widgets/label-types/gallery.d.ts +7 -0
- package/components/widgets/label-types/gallery.js +6 -0
- package/components/widgets/label-types/interval.d.ts +16 -0
- package/components/widgets/label-types/interval.js +21 -0
- package/components/widgets/label-types/record.d.ts +3 -0
- package/components/widgets/label-types/record.js +2 -0
- package/components/widgets/label-types/slot-upload.d.ts +24 -0
- package/components/widgets/label-types/slot-upload.js +16 -0
- package/components/widgets/label-types/table.d.ts +3 -0
- package/components/widgets/label-types/table.js +2 -0
- package/constants/record-field-kinds.d.ts +1 -1
- package/constants/record-field-kinds.js +1 -1
- package/constants/runtime-module-ownership.js +1 -0
- package/controls.d.ts +7 -0
- package/controls.js +4 -0
- package/helpers/cms-dialog.d.ts +39 -3
- package/helpers/cms-dialog.js +46 -4
- package/helpers/cms-page-catalog.d.ts +8 -0
- package/helpers/cms-page-catalog.js +18 -2
- package/helpers/cms-preset-nodes.d.ts +13 -3
- package/helpers/cms-preset-nodes.js +3 -2
- package/helpers/config-text-fields.d.ts +49 -0
- package/helpers/config-text-fields.js +122 -0
- package/helpers/money-amount.d.ts +48 -0
- package/helpers/money-amount.js +131 -0
- package/helpers/page-layout-check.js +15 -2
- package/helpers/preset-text-source-check.d.ts +22 -0
- package/helpers/preset-text-source-check.js +45 -0
- package/helpers/record-fields.d.ts +18 -5
- package/helpers/record-fields.js +38 -13
- package/helpers/text-source.d.ts +14 -5
- package/helpers/text-source.js +16 -3
- package/module-page-check.d.ts +1 -0
- package/module-page-check.js +1 -0
- package/module-records.d.ts +6 -3
- package/module-records.js +4 -2
- package/package.json +2 -2
- package/plugins/runtime/phi-slot-child-frame-view.js +1 -1
- package/plugins/runtime/slot-size-policy.d.ts +8 -2
- package/plugins/runtime/slot-size-policy.js +51 -16
- package/plugins/runtime-modules/accounting/module.d.ts +1 -1
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-page-tree.js +2 -0
- package/plugins/runtime-modules/app/module.d.ts +1 -1
- package/plugins/runtime-modules/asset/services/collection.js +1 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -2
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +3 -0
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +2 -2
- package/plugins/runtime-modules/builder/offered-page-catalog.js +3 -3
- package/plugins/runtime-modules/builder/options-providers.js +7 -0
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +17 -3
- package/plugins/runtime-modules/contracts.d.ts +1 -1
- package/plugins/runtime-modules/core/definition.d.ts +43 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +43 -0
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +6 -5
- package/plugins/runtime-modules/core/widgets/breadcrumb/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +9 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +29 -3
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +0 -1
- package/plugins/runtime-modules/core/widgets/button/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/button/plugin.js +6 -25
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +18 -2
- package/plugins/runtime-modules/core/widgets/card/config.js +16 -1
- package/plugins/runtime-modules/core/widgets/card/plugin.js +8 -10
- package/plugins/runtime-modules/core/widgets/card/server.d.ts +1 -2
- package/plugins/runtime-modules/core/widgets/card/server.js +16 -28
- package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +4 -3
- package/plugins/runtime-modules/core/widgets/cascader/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/cascader/config.d.ts +8 -2
- package/plugins/runtime-modules/core/widgets/cascader/config.js +22 -0
- package/plugins/runtime-modules/core/widgets/checkbox-group/config.d.ts +8 -2
- package/plugins/runtime-modules/core/widgets/checkbox-group/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/entry-list/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.js +3 -3
- package/plugins/runtime-modules/core/widgets/gallery/authoring.js +12 -3
- package/plugins/runtime-modules/core/widgets/gallery/client.js +10 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/image/server.js +5 -9
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/markdown-toc/server.js +3 -5
- package/plugins/runtime-modules/core/widgets/multi-select/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/quick-links/plugin.js +2 -4
- package/plugins/runtime-modules/core/widgets/quick-links/server.d.ts +2 -5
- package/plugins/runtime-modules/core/widgets/quick-links/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -2
- package/plugins/runtime-modules/core/widgets/record/config.js +4 -0
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/result/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/result/plugin.js +2 -4
- package/plugins/runtime-modules/core/widgets/result/server.d.ts +2 -3
- package/plugins/runtime-modules/core/widgets/result/server.js +11 -33
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/select-box/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +2 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/slider/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/slider/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/authoring.js +2 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/client.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/client.js +45 -24
- package/plugins/runtime-modules/core/widgets/slot-upload/config.d.ts +11 -4
- package/plugins/runtime-modules/core/widgets/slot-upload/config.js +16 -1
- package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +2 -2
- package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +8 -3
- package/plugins/runtime-modules/core/widgets/slot-upload/server.js +9 -3
- package/plugins/runtime-modules/core/widgets/spacer/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/spacer/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/steps/config.d.ts +8 -3
- package/plugins/runtime-modules/core/widgets/steps/config.js +1 -2
- package/plugins/runtime-modules/core/widgets/steps/plugin.js +6 -30
- package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +4 -1
- package/plugins/runtime-modules/core/widgets/timeline/config.d.ts +8 -1
- package/plugins/runtime-modules/core/widgets/timeline/config.js +1 -2
- package/plugins/runtime-modules/core/widgets/timeline/plugin.js +6 -37
- package/plugins/runtime-modules/descriptor-compiler.d.ts +11 -1
- package/plugins/runtime-modules/descriptor-compiler.js +49 -8
- package/plugins/runtime-modules/groups/definition.d.ts +1 -1
- package/plugins/runtime-modules/groups/forms.d.ts +18 -0
- package/plugins/runtime-modules/groups/forms.js +2 -2
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +8 -4
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -0
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -0
- package/plugins/runtime-modules/page-preset-overlays.d.ts +18 -0
- package/plugins/runtime-modules/page-preset-overlays.js +70 -0
- package/plugins/runtime-modules/public/module.d.ts +1 -1
- package/plugins/runtime-modules/public/trees/phi-default-pub-welcome-page-tree.js +1 -0
- package/plugins/runtime-modules/resolver.js +5 -0
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +5 -2
- package/plugins/runtime-modules/search/widgets/search-box/server.js +3 -5
- package/plugins/runtime-modules/search/widgets/search-results/server.js +3 -5
- package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +4 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +6 -2
- package/plugins/runtime-modules/user-management/controller/client.js +6 -1
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -3
- package/runtime-render-client.d.ts +1 -1
- package/runtime-render-client.js +2 -1
- package/server-helpers/cms-page-record.d.ts +2 -2
- package/server-helpers/cms-page-record.js +15 -5
- package/server-helpers/cms-request.js +34 -12
- package/server-helpers/cms-widget-texts.d.ts +14 -0
- package/server-helpers/cms-widget-texts.js +117 -0
- package/server-helpers/record-fields.d.ts +1 -1
- package/server-helpers/record-fields.js +1 -2
- package/server-helpers/record-samples.d.ts +4 -4
- package/server-helpers/record-samples.js +10 -2
- package/server-helpers/search-index.js +12 -3
- package/styles/root.css +6 -2
- package/types/cms-module-descriptors.d.ts +3 -0
- package/types/cms-plugins.d.ts +38 -5
- package/types/collection-provider.d.ts +7 -0
- package/types/core-widget-placements.d.ts +37 -0
- package/types/record-provider.d.ts +19 -3
- package/types/slot-size-policy.d.ts +19 -2
- package/types/table-widget.d.ts +33 -1
- package/types/table-widget.js +1 -0
- package/types/tree-widget.d.ts +7 -0
- package/types/widget-runtime.d.ts +1 -1
- package/types.d.ts +1 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PHI_TEXT_SOURCE_PRESET } from "../../../../helpers/text-source";
|
|
1
2
|
import { PHI_CMS_DEFAULT_SLOT_INDEX, } from "../../../../constants/cms-layout-types";
|
|
2
3
|
import { PhiCmsPageType } from "../../../../constants/phi-cms";
|
|
3
4
|
import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
|
|
@@ -9,7 +10,7 @@ import { createPhiSignalAddress, createPhiSignalSubcontrolAddress, PHI_SIGNAL_VA
|
|
|
9
10
|
import { createPhiUserManagementControllerAddress, PHI_USER_MANAGEMENT_CONTROLLER_INSTANCE_KEY, PHI_USER_MANAGEMENT_CONTROLLER_TYPE, } from "../controller/address";
|
|
10
11
|
import { PHI_USER_MANAGEMENT_FORM_IDS } from "../forms";
|
|
11
12
|
import { PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS, PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS, PHI_USER_MANAGEMENT_PAGE_WIDGET_IDS, } from "../addresses";
|
|
12
|
-
import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG } from "../../../../helpers/cms-dialog";
|
|
13
|
+
import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH_SINGLE_COLUMN, } from "../../../../helpers/cms-dialog";
|
|
13
14
|
import { buildPhiWidgetLabelTranslatorOptions } from "../../../../components/widgets/label-sets/runtime-options";
|
|
14
15
|
const SYNTHETIC_ADMIN_USERS_REGION_IDS = {
|
|
15
16
|
regionContent: -431,
|
|
@@ -200,8 +201,8 @@ export async function buildPhiDefaultAdminUsersPageTree({ page, runtime, }) {
|
|
|
200
201
|
},
|
|
201
202
|
}],
|
|
202
203
|
overlays: [
|
|
203
|
-
overlay(PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS.overlayCreate, PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS.layoutCreate, widgetLabels.editor.addTitle,
|
|
204
|
-
overlay(PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS.overlayEdit, PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS.layoutEdit, widgetLabels.editor.editTitle,
|
|
204
|
+
overlay(PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS.overlayCreate, PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS.layoutCreate, widgetLabels.editor.addTitle, PHI_DIALOG_WIDTH_SINGLE_COLUMN, "admin-users-create-modal", "create"),
|
|
205
|
+
overlay(PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS.overlayEdit, PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS.layoutEdit, widgetLabels.editor.editTitle, PHI_DIALOG_WIDTH_SINGLE_COLUMN, "admin-users-edit-modal", "edit"),
|
|
205
206
|
overlay(PHI_USER_MANAGEMENT_PAGE_OVERLAY_IDS.overlayHistory, PHI_USER_MANAGEMENT_PAGE_LAYOUT_IDS.layoutHistory, widgetLabels.history.title, { compact: "calc(100vw - 32px)", medium: "90vw", wide: 980 }, "admin-users-history-modal"),
|
|
206
207
|
],
|
|
207
208
|
regions: [scaffold.region],
|
|
@@ -543,6 +544,7 @@ export async function buildPhiDefaultAdminUsersPageTree({ page, runtime, }) {
|
|
|
543
544
|
label: `admin users ${mode} commands`,
|
|
544
545
|
config: {
|
|
545
546
|
key: `admin-users-${mode}-commands`,
|
|
547
|
+
textSource: PHI_TEXT_SOURCE_PRESET,
|
|
546
548
|
...PHI_DIALOG_COMMANDS_CONFIG,
|
|
547
549
|
buttons: [
|
|
548
550
|
{ key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: widgetLabels.confirm.cancel, icon: "close" },
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { PhiRuntimeModuleRenderClientHost, PhiRuntimeModuleRenderClientManifestProvider, createPhiRuntimeModuleRenderClientManifest, definePhiRuntimeModuleRenderClient, extendPhiRuntimeModuleRenderClientManifest, } from "./components/runtime/runtime-module-render-client-manifest";
|
|
2
2
|
export type { PhiRuntimeModuleRenderClient, PhiRuntimeModuleRenderClientManifest, PhiRuntimeModuleRenderClientProps, } from "./components/runtime/runtime-module-render-client-manifest";
|
|
3
|
-
export { usePhiIntlLocale } from "./components/root/phi-intl-locale";
|
|
3
|
+
export { usePhiIntlLocale, usePhiIntlTimeZone } from "./components/root/phi-intl-locale";
|
package/runtime-render-client.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { PhiRuntimeModuleRenderClientHost, PhiRuntimeModuleRenderClientManifestProvider, createPhiRuntimeModuleRenderClientManifest, definePhiRuntimeModuleRenderClient, extendPhiRuntimeModuleRenderClientManifest, } from "./components/runtime/runtime-module-render-client-manifest";
|
|
2
|
-
|
|
2
|
+
// The page's language and the Site's time zone, which a Module's own binding sends with a Provider request.
|
|
3
|
+
export { usePhiIntlLocale, usePhiIntlTimeZone } from "./components/root/phi-intl-locale";
|
|
@@ -2,7 +2,7 @@ import "server-only";
|
|
|
2
2
|
import type { PhiBlockRuntime } from "../types";
|
|
3
3
|
import type { PhiCmsRoutePresetBinding } from "../types/cms-module-descriptors";
|
|
4
4
|
import type { PhiRuntimeModuleCatalog, PhiRuntimeModuleId } from "../types/cms-plugins";
|
|
5
|
-
import type {
|
|
5
|
+
import type { PhiPageRecordBinding } from "../types/record-provider";
|
|
6
6
|
/**
|
|
7
7
|
* The record a route's Page is about, read before anything is drawn (MODULES.md, "The fields of a record,
|
|
8
8
|
* and the record a Page is about").
|
|
@@ -14,7 +14,7 @@ export type PhiCmsPageRecord = {
|
|
|
14
14
|
status: "missing";
|
|
15
15
|
} | {
|
|
16
16
|
status: "ok";
|
|
17
|
-
binding:
|
|
17
|
+
binding: PhiPageRecordBinding;
|
|
18
18
|
title: string | null;
|
|
19
19
|
description: string | null;
|
|
20
20
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
+
import { buildPhiRecordDeclarationsByKey } from "../helpers/record-fields";
|
|
2
3
|
import { readPhiPageRecordField, resolvePhiRecordFields } from "./record-fields";
|
|
3
4
|
import { resolvePhiRecordSource } from "./record-source";
|
|
4
5
|
/** What the record Providers of the active Modules offer, as a render's registry holds it. */
|
|
@@ -10,7 +11,7 @@ function buildRecordRegistry(runtimeModuleCatalog, activeModuleIds) {
|
|
|
10
11
|
return {
|
|
11
12
|
recordProviderLoadersByKey: new Map(entries.flatMap((entry) => (entry.recordProviders ?? []).map((provider) => [provider.key, provider.load]))),
|
|
12
13
|
recordFieldsLoadersByKey: new Map(entries.flatMap((entry) => (entry.recordProviders ?? []).flatMap((provider) => provider.loadFields ? [[provider.key, provider.loadFields]] : []))),
|
|
13
|
-
|
|
14
|
+
recordDeclarationsByKey: buildPhiRecordDeclarationsByKey(entries),
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
export async function resolvePhiCmsPageRecord({ binding, runtime, runtimeModuleCatalog, activeModuleIds }) {
|
|
@@ -20,12 +21,12 @@ export async function resolvePhiCmsPageRecord({ binding, runtime, runtimeModuleC
|
|
|
20
21
|
}
|
|
21
22
|
const route = `${binding.descriptor.ownerModuleId}/${binding.descriptor.presetKey}`;
|
|
22
23
|
const registry = buildRecordRegistry(runtimeModuleCatalog, activeModuleIds);
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
24
|
+
const declared = registry.recordDeclarationsByKey.get(declaration.providerKey);
|
|
25
|
+
if (!declared) {
|
|
25
26
|
throw new Error(`${route}: its page record names "${declaration.providerKey}", which is no active record Provider with declared fields.`);
|
|
26
27
|
}
|
|
27
28
|
// A Public page is rendered once for everybody, so it cannot be about what only one account may read.
|
|
28
|
-
if (
|
|
29
|
+
if (declared.audience === "viewer" && binding.descriptor.area === "public") {
|
|
29
30
|
throw new Error(`${route}: a Public route cannot be about a record of audience "viewer".`);
|
|
30
31
|
}
|
|
31
32
|
const record = {
|
|
@@ -38,5 +39,14 @@ export async function resolvePhiCmsPageRecord({ binding, runtime, runtimeModuleC
|
|
|
38
39
|
}
|
|
39
40
|
const fields = await resolvePhiRecordFields({ registry, runtime, binding: record });
|
|
40
41
|
const text = (key) => readPhiPageRecordField(fields, key, ["text"])?.value.trim() || null;
|
|
41
|
-
|
|
42
|
+
/*
|
|
43
|
+
* The Page's binding is the read's own, plus the two names the route gave. They are added after the
|
|
44
|
+
* reads and the reads were keyed by `record`, so the names are no part of what is asked or memoised.
|
|
45
|
+
*/
|
|
46
|
+
const pageBinding = {
|
|
47
|
+
...record,
|
|
48
|
+
...(declaration.titleField ? { titleField: declaration.titleField } : {}),
|
|
49
|
+
...(declaration.descriptionField ? { descriptionField: declaration.descriptionField } : {}),
|
|
50
|
+
};
|
|
51
|
+
return { status: "ok", binding: pageBinding, title: text(declaration.titleField), description: text(declaration.descriptionField) };
|
|
42
52
|
}
|
|
@@ -5,6 +5,7 @@ import { resolvePhiCmsAreaKey, resolvePhiCmsAreaMask, } from "../constants/cms-a
|
|
|
5
5
|
import { canPhiViewerAccess } from "../types/access";
|
|
6
6
|
import { compilePhiCmsActiveRouteTable, instantiatePhiCmsRoutePreset, normalizePhiCmsRoutePath, resolvePhiCmsAreaShellPresetBinding, resolvePhiCmsDescriptorCatalog, resolvePhiCmsRoutePreset, } from "../plugins/runtime-modules/descriptor-compiler";
|
|
7
7
|
import { resolvePhiRuntimeModuleIdsForArea } from "../plugins/runtime-modules/settings";
|
|
8
|
+
import { composePhiCmsPagePresetOverlays } from "../plugins/runtime-modules/page-preset-overlays";
|
|
8
9
|
import { resolvePhiCmsRoutePage } from "../plugins/runtime-modules/route-page-resolution";
|
|
9
10
|
import { PhiCmsFlags } from "../constants/phi-cms";
|
|
10
11
|
import { hasPhiFlag } from "../helpers/flags";
|
|
@@ -239,20 +240,43 @@ export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookie
|
|
|
239
240
|
const routeBinding = areaOwnedStoragePath && areaAllowed
|
|
240
241
|
? resolvePhiCmsRoutePreset(routeTable, areaOwnedStoragePath)
|
|
241
242
|
: null;
|
|
242
|
-
const
|
|
243
|
+
const presetOrigin = { instantiated: false };
|
|
244
|
+
const instantiateRoutePreset = (binding) => instantiatePhiRoutePresetPage({
|
|
245
|
+
binding,
|
|
246
|
+
requestedPath: path,
|
|
247
|
+
areaMask,
|
|
248
|
+
siteId,
|
|
249
|
+
runtime: runtimeWithAuthProvider,
|
|
250
|
+
runtimeModuleCatalog,
|
|
251
|
+
activeModuleKeys,
|
|
252
|
+
});
|
|
253
|
+
const routePage = await resolvePhiCmsRoutePage({
|
|
243
254
|
binding: routeBinding,
|
|
244
255
|
requestedPath: path,
|
|
245
256
|
loadPage: loadResolvedCmsPage,
|
|
246
|
-
instantiatePreset: (binding) =>
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
siteId,
|
|
251
|
-
runtime: runtimeWithAuthProvider,
|
|
252
|
-
runtimeModuleCatalog,
|
|
253
|
-
activeModuleKeys,
|
|
254
|
-
}),
|
|
257
|
+
instantiatePreset: (binding) => {
|
|
258
|
+
presetOrigin.instantiated = true;
|
|
259
|
+
return instantiateRoutePreset(binding);
|
|
260
|
+
},
|
|
255
261
|
});
|
|
262
|
+
const routePresetAnswered = routePage?.sourcePreset?.presetKey === routeBinding?.descriptor.presetKey
|
|
263
|
+
&& routePage?.sourcePreset?.ownerModuleId === routeBinding?.descriptor.ownerModuleId;
|
|
264
|
+
/*
|
|
265
|
+
* A stored Page that answers for the route's preset holds no copy of the Overlays the preset declares;
|
|
266
|
+
* they are laid over it here, from the preset instantiated beside it (OVERLAYS.md, "Page preset
|
|
267
|
+
* Overlays"). The instantiated preset already has them, an exact Site Page of a dynamic route is its own
|
|
268
|
+
* Page, and a lookup renders nothing.
|
|
269
|
+
*/
|
|
270
|
+
const presetOverlayPage = purpose !== "lookup" && routePage && routeBinding && routePresetAnswered
|
|
271
|
+
&& !presetOrigin.instantiated
|
|
272
|
+
? await instantiateRoutePreset(routeBinding)
|
|
273
|
+
: null;
|
|
274
|
+
const loadedPage = routePage && presetOverlayPage
|
|
275
|
+
? {
|
|
276
|
+
...routePage,
|
|
277
|
+
page: composePhiCmsPagePresetOverlays({ tree: routePage.page, presetTree: presetOverlayPage.page }),
|
|
278
|
+
}
|
|
279
|
+
: routePage;
|
|
256
280
|
/*
|
|
257
281
|
* The record the Page is about, where its route names one: read once, here, for the Module's own tree
|
|
258
282
|
* and for a stored override of it alike -- the override holds no address, only Widgets bound to the
|
|
@@ -260,8 +284,6 @@ export async function resolvePhiCmsRequest({ siteKey, locale, area, path, cookie
|
|
|
260
284
|
* names no record is no Page: a 404 while rendering, nothing for a lookup.
|
|
261
285
|
*/
|
|
262
286
|
const routeIsParametrised = routeBinding ? Object.keys(routeBinding.params).length > 0 : false;
|
|
263
|
-
const routePresetAnswered = loadedPage?.sourcePreset?.presetKey === routeBinding?.descriptor.presetKey
|
|
264
|
-
&& loadedPage?.sourcePreset?.ownerModuleId === routeBinding?.descriptor.ownerModuleId;
|
|
265
287
|
const pageRecord = loadedPage && routeBinding && routeIsParametrised && routePresetAnswered
|
|
266
288
|
? await resolvePhiCmsPageRecord({
|
|
267
289
|
binding: routeBinding,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import type { PhiBlockRuntime } from "../types";
|
|
3
|
+
import type { PhiResolvedCmsRenderableTree } from "../types/cms";
|
|
4
|
+
import type { PhiCmsRuntimeRenderRegistry, PhiCmsWidgetPluginDefinition } from "../types/cms-plugins";
|
|
5
|
+
export type PhiWidgetTextDefinition = Partial<Pick<PhiCmsWidgetPluginDefinition<unknown>, "fields" | "translatesOwnText" | "configTexts">>;
|
|
6
|
+
export type PhiWidgetTextSubject = {
|
|
7
|
+
id: string;
|
|
8
|
+
flags: number;
|
|
9
|
+
config: Record<string, unknown>;
|
|
10
|
+
definition: PhiWidgetTextDefinition | null | undefined;
|
|
11
|
+
};
|
|
12
|
+
/** Each subject's config with its words translated, keyed by id; a subject with none is not in the map. */
|
|
13
|
+
export declare function translatePhiWidgetConfigTexts(subjects: readonly PhiWidgetTextSubject[], runtime: PhiBlockRuntime): Promise<Map<string, Record<string, unknown>>>;
|
|
14
|
+
export declare function translatePhiCmsTreeWidgetTexts<TTree extends PhiResolvedCmsRenderableTree>(tree: TTree, registry: Pick<PhiCmsRuntimeRenderRegistry, "runtimeWidgetPluginsByType" | "previewWidgetPluginsByType">, runtime: PhiBlockRuntime): Promise<TTree>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { PHI_TR_CTX_WEB_UI_LABEL, PHI_TR_CTX_WEB_UI_MESSAGE } from "../gateway/tr";
|
|
3
|
+
import { PhiCmsFlags } from "../constants/phi-cms";
|
|
4
|
+
import { collectPhiConfigTexts, collectPhiDeclaredConfigTexts, writePhiConfigTexts, } from "../helpers/config-text-fields";
|
|
5
|
+
import { hasPhiFlag } from "../helpers/flags";
|
|
6
|
+
import { maskPhiTextPlaceholders, resolvePhiTextPlaceholders } from "../helpers/text-placeholders";
|
|
7
|
+
import { PHI_TEXT_SOURCE_PRESET, readPhiTextSource } from "../helpers/text-source";
|
|
8
|
+
import { trBulkForLocale, trGlobalBulkForLocale } from "./translate";
|
|
9
|
+
/**
|
|
10
|
+
* The words in Widget configs in the reader's language, translated in one pass for a page.
|
|
11
|
+
*
|
|
12
|
+
* Translating is the rule, not something each Widget remembers: which fields are text is answered by
|
|
13
|
+
* their names (`helpers/config-text-fields.ts`), a text no field edits is declared by the Widget
|
|
14
|
+
* (`configTexts`), and every Widget is handed its config with those already in the reader's language. A
|
|
15
|
+
* Widget that `translatesOwnText` is left out -- a Markdown body is parsed into units before it is
|
|
16
|
+
* translated, and its author may want it left as written, which is why only such content Widgets carry
|
|
17
|
+
* the `NoTranslate` switch. A node a Preset flagged `NoTranslate` holds words it read from a Label Set in
|
|
18
|
+
* the reader's language already: nothing of it is sent, its placeholders are only filled in.
|
|
19
|
+
*
|
|
20
|
+
* Every text is masked before it is sent and filled after (`helpers/text-placeholders.ts`): `{site.name}`
|
|
21
|
+
* never reaches a translator, and a list entry's values stand as `%1` onwards, so "Up to %1 users" is
|
|
22
|
+
* translated once for every Site.
|
|
23
|
+
*
|
|
24
|
+
* The store is whose words they are (`helpers/text-source.ts`): a Preset's go to the platform's store,
|
|
25
|
+
* an author's to the Site's. One request per store and register, whatever the number of Widgets. The
|
|
26
|
+
* search index reads a Page's words through the same pass (`server-helpers/search-index.ts`).
|
|
27
|
+
*/
|
|
28
|
+
const CTX_BY_REGISTER = {
|
|
29
|
+
label: PHI_TR_CTX_WEB_UI_LABEL,
|
|
30
|
+
message: PHI_TR_CTX_WEB_UI_MESSAGE,
|
|
31
|
+
};
|
|
32
|
+
function collectSubjectTexts(subject) {
|
|
33
|
+
const { definition } = subject;
|
|
34
|
+
if (!definition || definition.translatesOwnText)
|
|
35
|
+
return [];
|
|
36
|
+
const located = [
|
|
37
|
+
...collectPhiConfigTexts(definition.fields ?? [], subject.config),
|
|
38
|
+
...collectPhiDeclaredConfigTexts(definition.configTexts ?? [], subject.config),
|
|
39
|
+
];
|
|
40
|
+
const seen = new Set();
|
|
41
|
+
return located.filter((location) => {
|
|
42
|
+
const key = location.path.join("\u0000");
|
|
43
|
+
if (seen.has(key))
|
|
44
|
+
return false;
|
|
45
|
+
seen.add(key);
|
|
46
|
+
return true;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/** Each subject's config with its words translated, keyed by id; a subject with none is not in the map. */
|
|
50
|
+
export async function translatePhiWidgetConfigTexts(subjects, runtime) {
|
|
51
|
+
const pending = subjects
|
|
52
|
+
.map((subject) => ({
|
|
53
|
+
subject,
|
|
54
|
+
batch: readPhiTextSource(subject.config.textSource) === PHI_TEXT_SOURCE_PRESET ? "global" : "site",
|
|
55
|
+
// Filled in all the same: a value or `{year}` is not a word, and a node left as written still shows it.
|
|
56
|
+
translate: !hasPhiFlag(subject.flags, PhiCmsFlags.NoTranslate),
|
|
57
|
+
locations: collectSubjectTexts(subject).map((location) => ({
|
|
58
|
+
location,
|
|
59
|
+
masked: maskPhiTextPlaceholders(location.text, location.values?.length ?? 0),
|
|
60
|
+
})),
|
|
61
|
+
}))
|
|
62
|
+
.filter((entry) => entry.locations.length > 0);
|
|
63
|
+
const configs = new Map();
|
|
64
|
+
if (pending.length === 0)
|
|
65
|
+
return configs;
|
|
66
|
+
const batches = new Map();
|
|
67
|
+
const positions = pending.map((entry) => entry.locations.map(({ location, masked }) => {
|
|
68
|
+
if (!entry.translate)
|
|
69
|
+
return null;
|
|
70
|
+
const key = `${entry.batch}:${location.register}`;
|
|
71
|
+
let texts = batches.get(key);
|
|
72
|
+
if (!texts) {
|
|
73
|
+
texts = [];
|
|
74
|
+
batches.set(key, texts);
|
|
75
|
+
}
|
|
76
|
+
texts.push(masked.text);
|
|
77
|
+
return { key, index: texts.length - 1 };
|
|
78
|
+
}));
|
|
79
|
+
const locale = runtime.locale.current;
|
|
80
|
+
const answers = new Map(await Promise.all([...batches].map(async ([key, texts]) => {
|
|
81
|
+
const [store, register] = key.split(":");
|
|
82
|
+
const ctx = CTX_BY_REGISTER[register];
|
|
83
|
+
const translated = store === "global"
|
|
84
|
+
? await trGlobalBulkForLocale(locale, texts, ctx)
|
|
85
|
+
: await trBulkForLocale(locale, texts, ctx);
|
|
86
|
+
return [key, translated];
|
|
87
|
+
})));
|
|
88
|
+
pending.forEach((entry, entryIndex) => {
|
|
89
|
+
configs.set(entry.subject.id, writePhiConfigTexts(entry.subject.config, entry.locations.map(({ location, masked }, index) => {
|
|
90
|
+
const position = positions[entryIndex][index];
|
|
91
|
+
const translated = (position && answers.get(position.key)?.[position.index]?.trim()) || masked.text;
|
|
92
|
+
return {
|
|
93
|
+
path: location.path,
|
|
94
|
+
text: resolvePhiTextPlaceholders(translated, masked.names, runtime, location.values ?? []),
|
|
95
|
+
};
|
|
96
|
+
})));
|
|
97
|
+
});
|
|
98
|
+
return configs;
|
|
99
|
+
}
|
|
100
|
+
export async function translatePhiCmsTreeWidgetTexts(tree, registry, runtime) {
|
|
101
|
+
const configs = await translatePhiWidgetConfigTexts(tree.contentWidgets.map((widget) => ({
|
|
102
|
+
id: widget.id,
|
|
103
|
+
flags: widget.flags,
|
|
104
|
+
config: widget.config,
|
|
105
|
+
definition: registry.runtimeWidgetPluginsByType.get(widget.widgetType)
|
|
106
|
+
?? registry.previewWidgetPluginsByType.get(widget.widgetType),
|
|
107
|
+
})), runtime);
|
|
108
|
+
if (configs.size === 0)
|
|
109
|
+
return tree;
|
|
110
|
+
return {
|
|
111
|
+
...tree,
|
|
112
|
+
contentWidgets: tree.contentWidgets.map((widget) => {
|
|
113
|
+
const config = configs.get(widget.id);
|
|
114
|
+
return config ? { ...widget, config } : widget;
|
|
115
|
+
}),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -3,7 +3,7 @@ import type { PhiBlockRuntime } from "../types";
|
|
|
3
3
|
import type { PhiCmsRuntimeRenderRegistry } from "../types/cms-plugins";
|
|
4
4
|
import type { PhiRecordField, PhiRecordFieldKind } from "../types/record-provider";
|
|
5
5
|
import type { PhiRuntimeDataProviderBinding } from "../types/runtime-data-provider";
|
|
6
|
-
type PhiRecordFieldsRegistry = Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey" | "recordFieldsLoadersByKey" | "
|
|
6
|
+
type PhiRecordFieldsRegistry = Pick<PhiCmsRuntimeRenderRegistry, "recordProviderLoadersByKey" | "recordFieldsLoadersByKey" | "recordDeclarationsByKey">;
|
|
7
7
|
/**
|
|
8
8
|
* The declared fields of one record (MODULES.md, "The fields of a record, and the record a Page is about").
|
|
9
9
|
*
|
|
@@ -6,8 +6,7 @@ import { resolvePhiRecordSource } from "./record-source";
|
|
|
6
6
|
import { definePhiRequestMemoWith } from "./request-memo";
|
|
7
7
|
const resolveFields = definePhiRequestMemoWith(async (key, using) => {
|
|
8
8
|
const providerKey = key.providerKey;
|
|
9
|
-
const
|
|
10
|
-
const declared = descriptor?.kind === "record" ? descriptor.record?.fields : undefined;
|
|
9
|
+
const declared = using.registry.recordDeclarationsByKey.get(providerKey)?.fields;
|
|
11
10
|
const loadFields = using.registry.recordFieldsLoadersByKey.get(providerKey);
|
|
12
11
|
if (!declared || !loadFields) {
|
|
13
12
|
return { status: "none" };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import type { PhiBlockRuntime } from "../types";
|
|
3
3
|
import type { PhiCmsRuntimeRenderRegistry } from "../types/cms-plugins";
|
|
4
|
-
import type { PhiCmsPageRecordDescriptor } from "../types/record-provider";
|
|
5
|
-
import type { PhiRuntimeDataProviderBinding } from "../types/runtime-data-provider";
|
|
4
|
+
import type { PhiCmsPageRecordDescriptor, PhiPageRecordBinding } from "../types/record-provider";
|
|
6
5
|
type PhiRecordSamplesRegistry = Pick<PhiCmsRuntimeRenderRegistry, "recordSamplesLoadersByKey">;
|
|
7
6
|
/**
|
|
8
7
|
* The record the Builder's Preview shows a template with (MODULES.md, "The fields of a record, and the
|
|
9
8
|
* record a Page is about"): the first sample the route's record Provider offers, as the binding a Page
|
|
10
|
-
* about a record carries
|
|
9
|
+
* about a record carries -- with the route's `titleField` and `descriptionField`, so the Preview takes the
|
|
10
|
+
* same fields the live Page does.
|
|
11
11
|
*
|
|
12
12
|
* A sample's `params` are the Provider's own parameters (`{ slug: "chair" }`), not the route's, so they
|
|
13
13
|
* become the binding as they are. `null` is a Provider that offers no samples or none now, or one whose
|
|
@@ -17,5 +17,5 @@ export declare function resolvePhiPageRecordSampleBinding({ registry, runtime, p
|
|
|
17
17
|
registry: PhiRecordSamplesRegistry;
|
|
18
18
|
runtime: PhiBlockRuntime;
|
|
19
19
|
pageRecord: PhiCmsPageRecordDescriptor;
|
|
20
|
-
}): Promise<
|
|
20
|
+
}): Promise<PhiPageRecordBinding | null>;
|
|
21
21
|
export {};
|
|
@@ -4,7 +4,8 @@ import { phiRuntime } from "./phi-runtime";
|
|
|
4
4
|
/**
|
|
5
5
|
* The record the Builder's Preview shows a template with (MODULES.md, "The fields of a record, and the
|
|
6
6
|
* record a Page is about"): the first sample the route's record Provider offers, as the binding a Page
|
|
7
|
-
* about a record carries
|
|
7
|
+
* about a record carries -- with the route's `titleField` and `descriptionField`, so the Preview takes the
|
|
8
|
+
* same fields the live Page does.
|
|
8
9
|
*
|
|
9
10
|
* A sample's `params` are the Provider's own parameters (`{ slug: "chair" }`), not the route's, so they
|
|
10
11
|
* become the binding as they are. `null` is a Provider that offers no samples or none now, or one whose
|
|
@@ -26,7 +27,14 @@ export async function resolvePhiPageRecordSampleBinding({ registry, runtime, pag
|
|
|
26
27
|
runtime,
|
|
27
28
|
});
|
|
28
29
|
const sample = samples[0];
|
|
29
|
-
return sample
|
|
30
|
+
return sample
|
|
31
|
+
? {
|
|
32
|
+
providerKey: pageRecord.providerKey,
|
|
33
|
+
params: sample.params,
|
|
34
|
+
...(pageRecord.titleField ? { titleField: pageRecord.titleField } : {}),
|
|
35
|
+
...(pageRecord.descriptionField ? { descriptionField: pageRecord.descriptionField } : {}),
|
|
36
|
+
}
|
|
37
|
+
: null;
|
|
30
38
|
}
|
|
31
39
|
catch (error) {
|
|
32
40
|
logRuntimeEvent("warn", "cms.record.samples_failed", {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
+
import { translatePhiWidgetConfigTexts } from "./cms-widget-texts";
|
|
2
3
|
import { createHash } from "node:crypto";
|
|
3
4
|
import { PHI_SHARED_PACKAGE_NAME } from "../constants/package";
|
|
4
5
|
import { createPhiRuntimeModuleId } from "../constants/module-identity";
|
|
@@ -315,12 +316,20 @@ async function readDocument({ bridge, area, locale, context, path, loadPlugin, a
|
|
|
315
316
|
});
|
|
316
317
|
const lines = await runWithPhiRequestRuntime(resolved.runtime, async () => {
|
|
317
318
|
const collected = [];
|
|
318
|
-
|
|
319
|
-
|
|
319
|
+
const plugins = await Promise.all(visible.contentWidgets.map((widget) => loadPlugin(widget.widgetType)));
|
|
320
|
+
// The words as the render shows them: translated by the same pass (`server-helpers/cms-widget-texts.ts`).
|
|
321
|
+
const translatedConfigs = await translatePhiWidgetConfigTexts(visible.contentWidgets.map((widget, index) => ({
|
|
322
|
+
id: widget.id,
|
|
323
|
+
flags: widget.flags,
|
|
324
|
+
config: widget.config,
|
|
325
|
+
definition: plugins[index]?.searchText ? plugins[index] : null,
|
|
326
|
+
})), resolved.runtime);
|
|
327
|
+
for (const [index, widget] of visible.contentWidgets.entries()) {
|
|
328
|
+
const plugin = plugins[index];
|
|
320
329
|
if (!plugin?.searchText)
|
|
321
330
|
continue;
|
|
322
331
|
try {
|
|
323
|
-
const config = plugin.parseConfig(widget.config);
|
|
332
|
+
const config = plugin.parseConfig(translatedConfigs.get(widget.id) ?? widget.config);
|
|
324
333
|
collected.push(...await plugin.searchText({ widget, config, runtime: resolved.runtime }));
|
|
325
334
|
}
|
|
326
335
|
catch (error) {
|
package/styles/root.css
CHANGED
|
@@ -73,15 +73,19 @@ samp {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
:where(.phi-tab-bar.ant-tabs) {
|
|
76
|
-
height: 100%;
|
|
77
76
|
line-height: 1;
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
:where(.phi-tab-bar.ant-tabs > .ant-tabs-nav) {
|
|
81
|
-
height: 100%;
|
|
82
80
|
margin: 0;
|
|
83
81
|
}
|
|
84
82
|
|
|
83
|
+
/* Left and right placement fill the block axis (the Tab bar's `slotSizePolicy`); top and bottom are as high as their content. */
|
|
84
|
+
:where(.phi-tab-bar.ant-tabs-left, .phi-tab-bar.ant-tabs-right),
|
|
85
|
+
:where(.phi-tab-bar.ant-tabs-left > .ant-tabs-nav, .phi-tab-bar.ant-tabs-right > .ant-tabs-nav) {
|
|
86
|
+
height: 100%;
|
|
87
|
+
}
|
|
88
|
+
|
|
85
89
|
:where(.phi-tab-bar.ant-tabs > .ant-tabs-content-holder) {
|
|
86
90
|
flex: 0 0 0;
|
|
87
91
|
min-width: 0;
|
|
@@ -7,6 +7,7 @@ import type { PhiThemeFontsBlock, PhiThemeGroundBlock, PhiThemeSetBlock, PhiThem
|
|
|
7
7
|
import type { PhiViewerAccessPolicy } from "./access";
|
|
8
8
|
import type { PhiSignalRoute } from "./signals";
|
|
9
9
|
import type { PhiCmsInstanceId } from "./cms-instance-id";
|
|
10
|
+
import type { PhiRuntimeModuleFormDefinition } from "../components/forms/form-registry";
|
|
10
11
|
export type PhiRuntimeModuleId = `${string}/${string}`;
|
|
11
12
|
export type PhiCmsPresetIdentity = {
|
|
12
13
|
ownerModuleId: PhiRuntimeModuleId;
|
|
@@ -472,6 +473,8 @@ export type PhiCmsCompiledDescriptorCatalog = {
|
|
|
472
473
|
themeBlockByKey: ReadonlyMap<string, PhiCmsThemeBlockBinding>;
|
|
473
474
|
/** Each Module's source language: the one the text its descriptors ship is written in. */
|
|
474
475
|
sourceLocaleByModuleId: ReadonlyMap<PhiRuntimeModuleId, string>;
|
|
476
|
+
/** The Forms the Modules ship, by id: what the tree contract reads a dialog's Form from. */
|
|
477
|
+
formDefinitionsById: ReadonlyMap<string, PhiRuntimeModuleFormDefinition>;
|
|
475
478
|
};
|
|
476
479
|
export type PhiCmsActiveRouteTable = {
|
|
477
480
|
area: PhiCmsAreaKey;
|
package/types/cms-plugins.d.ts
CHANGED
|
@@ -116,6 +116,12 @@ export type PhiCmsConfigField = (PhiCmsConfigFieldBase & {
|
|
|
116
116
|
emptyValue?: "";
|
|
117
117
|
/** What an empty box shows: what an unset value means, such as `Auto`. Not stored. */
|
|
118
118
|
placeholder?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Whether the field holds words a reader reads, where its name answers wrongly: the name decides
|
|
121
|
+
* otherwise (`helpers/config-text-fields.ts`). `false` keeps a field called like a text from being
|
|
122
|
+
* translated; a register makes a field translated that is not called like one.
|
|
123
|
+
*/
|
|
124
|
+
text?: false | "label" | "message";
|
|
119
125
|
}) | (PhiCmsConfigFieldBase & {
|
|
120
126
|
/**
|
|
121
127
|
* One link, chosen rather than typed.
|
|
@@ -333,6 +339,17 @@ export type PhiCmsPluginLicenseState = {
|
|
|
333
339
|
features?: string[];
|
|
334
340
|
expiresAt?: string | null;
|
|
335
341
|
};
|
|
342
|
+
/**
|
|
343
|
+
* One text a Widget declares in its config beyond its fields: `config[key]`, or with `item` each entry's
|
|
344
|
+
* `config[key][].item`, whose `values` (`config[key][].<values>`) stand in its sentence as `%1` onwards
|
|
345
|
+
* and are filled after the translation, never sent with it.
|
|
346
|
+
*/
|
|
347
|
+
export type PhiCmsWidgetConfigText = {
|
|
348
|
+
key: string;
|
|
349
|
+
register: "label" | "message";
|
|
350
|
+
item?: string;
|
|
351
|
+
values?: string;
|
|
352
|
+
};
|
|
336
353
|
export type PhiCmsWidgetContentBinding = {
|
|
337
354
|
storage: "text" | "html" | "markdown" | "asset";
|
|
338
355
|
sourceField: string;
|
|
@@ -465,13 +482,21 @@ export type PhiCmsWidgetPlugin<TConfig> = {
|
|
|
465
482
|
requiredDataProviders?: readonly PhiRuntimeDataProviderKey[];
|
|
466
483
|
contentBinding?: PhiCmsWidgetContentBinding | null;
|
|
467
484
|
/**
|
|
468
|
-
* The Widget translates the text written into its own config
|
|
485
|
+
* The Widget translates the text written into its own config, and the renderer's pass
|
|
486
|
+
* (`server-helpers/cms-widget-texts.ts`) leaves it out: a content Widget, whose text is parsed before it
|
|
487
|
+
* is translated and which an author may want left as written.
|
|
469
488
|
*
|
|
470
|
-
* Turning that off is the node's `NoTranslate` flag, not a config field
|
|
471
|
-
*
|
|
472
|
-
*
|
|
489
|
+
* Turning that off is the node's `NoTranslate` flag, not a config field. A Widget that says so here
|
|
490
|
+
* gets the Inspector's switch for it; no other Widget does, for a Control's words are always
|
|
491
|
+
* translated.
|
|
473
492
|
*/
|
|
474
493
|
translatesOwnText?: true;
|
|
494
|
+
/**
|
|
495
|
+
* Texts in the config that no Inspector field edits -- a Card's title and its plan's lines are written
|
|
496
|
+
* on the canvas -- which the renderer translates beside the fields' (`server-helpers/cms-widget-texts.ts`).
|
|
497
|
+
* Fields need no entry here: their names answer it (`helpers/config-text-fields.ts`).
|
|
498
|
+
*/
|
|
499
|
+
configTexts?: readonly PhiCmsWidgetConfigText[];
|
|
475
500
|
slotSizePolicy: PhiSlotSizePolicy;
|
|
476
501
|
/**
|
|
477
502
|
* Who draws the node's Surface (`config.surface`).
|
|
@@ -538,7 +563,7 @@ export type PhiCmsWidgetSearchTextArgs<TConfig> = {
|
|
|
538
563
|
* `contentBinding` through an `"x" in plugin` branch, and a Module's `translatesOwnText` travelled on a
|
|
539
564
|
* plugin whose type did not know it.
|
|
540
565
|
*/
|
|
541
|
-
export type PhiCmsWidgetPluginDefinition<TConfig> = Pick<PhiCmsWidgetPlugin<TConfig>, "kind" | "pluginKey" | "typeKey" | "title" | "description" | "category" | "tags" | "icon" | "iconName" | "iconFamily" | "commercial" | "runtimeSignals" | "signalSubcontrols" | "requiredRuntimeControllers" | "requiredDataProviders" | "contentBinding" | "translatesOwnText" | "slotSizePolicy" | "surface" | "requiredRegionOwnership" | "defaultConfig" | "creationConfig" | "fields" | "parseConfig">;
|
|
566
|
+
export type PhiCmsWidgetPluginDefinition<TConfig> = Pick<PhiCmsWidgetPlugin<TConfig>, "kind" | "pluginKey" | "typeKey" | "title" | "description" | "category" | "tags" | "icon" | "iconName" | "iconFamily" | "commercial" | "runtimeSignals" | "signalSubcontrols" | "requiredRuntimeControllers" | "requiredDataProviders" | "contentBinding" | "translatesOwnText" | "configTexts" | "slotSizePolicy" | "surface" | "requiredRegionOwnership" | "defaultConfig" | "creationConfig" | "fields" | "parseConfig">;
|
|
542
567
|
export type PhiCmsBuilderWidgetEditorInteraction = "inert" | "authoring";
|
|
543
568
|
export type PhiCmsBuilderWidgetPlugin<TConfig> = PhiCmsWidgetPluginDefinition<TConfig> & {
|
|
544
569
|
editorInteraction?: PhiCmsBuilderWidgetEditorInteraction;
|
|
@@ -596,6 +621,14 @@ export type PhiCmsRuntimeRenderRegistry = {
|
|
|
596
621
|
recordFieldsLoadersByKey: ReadonlyMap<PhiRuntimeDataProviderKey, () => Promise<import("./record-provider").PhiRuntimeRecordFieldsReader>>;
|
|
597
622
|
/** The sample readers of the `record` Providers that offer samples, by key: what the Builder previews a template with. */
|
|
598
623
|
recordSamplesLoadersByKey: ReadonlyMap<PhiRuntimeDataProviderKey, () => Promise<import("./record-provider").PhiRuntimeRecordSamplesReader>>;
|
|
624
|
+
/**
|
|
625
|
+
* What each active Module's `record` Providers that declare fields consist of, by key: whose the record
|
|
626
|
+
* is and its declared fields. Keyed off the active set like the loaders, and apart from
|
|
627
|
+
* `dataProviderDescriptorsByKey`, which holds only what the trees make the browser mount and so never a
|
|
628
|
+
* `record` Provider.
|
|
629
|
+
*/
|
|
630
|
+
recordDeclarationsByKey: ReadonlyMap<PhiRuntimeDataProviderKey, import("./record-provider").PhiRecordDeclaration>;
|
|
631
|
+
/** The Providers the trees make the browser mount, by key; a `record` Provider is never one of them. */
|
|
599
632
|
dataProviderDescriptorsByKey: ReadonlyMap<PhiRuntimeDataProviderKey, PhiRuntimeModuleDataProviderDescriptor>;
|
|
600
633
|
formDefinitionsById: ReadonlyMap<string, PhiRuntimeModuleFormDefinition>;
|
|
601
634
|
};
|
|
@@ -81,6 +81,13 @@ export type PhiCollectionProviderQueryRequest = {
|
|
|
81
81
|
resourceKey: string;
|
|
82
82
|
query: PhiCollectionProviderQuery;
|
|
83
83
|
params?: Record<string, unknown>;
|
|
84
|
+
/**
|
|
85
|
+
* The reader's language and the Site's time zone (`usePhiIntlLocale`, `usePhiIntlTimeZone`), filled by
|
|
86
|
+
* the binding, for a Provider that writes words, amounts or dates into what it answers. Part of the
|
|
87
|
+
* binding's load key: a live language switch asks again.
|
|
88
|
+
*/
|
|
89
|
+
locale: string;
|
|
90
|
+
timeZone: string;
|
|
84
91
|
signal: AbortSignal;
|
|
85
92
|
};
|
|
86
93
|
export type PhiCollectionProviderActionRequest = {
|
|
@@ -16,6 +16,9 @@ import type { PhiMediaImageSourceConfig } from "./media";
|
|
|
16
16
|
import type { PhiViewerAccessPolicy } from "./access";
|
|
17
17
|
import type { PhiWidgetFontFamilyKey, PhiWidgetFontSizeKey } from "./site-theme";
|
|
18
18
|
import type { PhiTableQuery, PhiTableWidgetConfig, PhiTableWidgetFeatures, PhiTableWidgetPresentation } from "./table-widget";
|
|
19
|
+
import type { PhiRecordWidgetConfig, PhiRecordWidgetPresentation } from "./record-widget";
|
|
20
|
+
import type { PhiChoiceOptionsConfig, PhiChoiceValueMode } from "../components/widgets/config/choice-shared";
|
|
21
|
+
import type { PhiCmsTabBarWidgetConfig } from "../components/widgets/config/stack-tabs";
|
|
19
22
|
import type { PhiButtonVariant } from "../components/widgets/config/button-variant";
|
|
20
23
|
import type { PhiThemeGradientKey } from "../theme/phi-theme-gradients";
|
|
21
24
|
import type { PhiTextTone } from "../components/widgets/config/text-tone";
|
|
@@ -36,6 +39,11 @@ export type PhiWidgetPlacementBase = Omit<PhiRenderableBlockBase, "renderMode" |
|
|
|
36
39
|
/** Shows the Widget only while the condition holds; the renderer evaluates it for every Widget. */
|
|
37
40
|
visibleWhen?: PhiRuntimeConditionExpression;
|
|
38
41
|
signalRoutes?: PhiWidgetPlacementSignalRoutes | null;
|
|
42
|
+
/**
|
|
43
|
+
* Whose words the Widget's text is, which decides the store that translates it (`helpers/text-source.ts`):
|
|
44
|
+
* a Module's Preset states it on every Widget with text (TRANSLATIONS.md, "Widget config text").
|
|
45
|
+
*/
|
|
46
|
+
textSource?: PhiTextSource;
|
|
39
47
|
};
|
|
40
48
|
/** The routes a placement wires. Read-only lists, so a Preset can build them from shared constants. */
|
|
41
49
|
export type PhiWidgetPlacementSignalRoutes = {
|
|
@@ -164,6 +172,32 @@ export type PhiTableWidgetPlacement = PhiWidgetPlacementBase & {
|
|
|
164
172
|
fixedFilters?: PhiTableWidgetConfig["fixedFilters"];
|
|
165
173
|
source?: PhiProviderResourceSource | null;
|
|
166
174
|
};
|
|
175
|
+
/** Which row it shows arrives as a signal from a row action; the placement says how to read it. */
|
|
176
|
+
export type PhiRecordWidgetPlacement = PhiWidgetPlacementBase & {
|
|
177
|
+
source?: PhiRecordWidgetConfig["source"];
|
|
178
|
+
openActionKey?: PhiRecordWidgetConfig["openActionKey"];
|
|
179
|
+
presentation?: Partial<PhiRecordWidgetPresentation>;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Where a file goes: the Add-on, its table and the slot. What the slot takes is the Add-on's schema
|
|
183
|
+
* descriptor's answer and is not placed. Written out here rather than read off the Widget's config,
|
|
184
|
+
* because the Foundation does not import a Module, not even for a type.
|
|
185
|
+
*/
|
|
186
|
+
export type PhiSlotUploadWidgetPlacement = PhiWidgetPlacementBase & {
|
|
187
|
+
/** What the field is called where it stands; translated like every text written into a config. */
|
|
188
|
+
label?: string;
|
|
189
|
+
/** The Add-on that owns the table, by package name -- `@scope/name`. */
|
|
190
|
+
addon?: string;
|
|
191
|
+
table?: string;
|
|
192
|
+
slot?: string;
|
|
193
|
+
/** Which binding parameter carries the row; `id` where none is named. */
|
|
194
|
+
ownerParam?: string;
|
|
195
|
+
};
|
|
196
|
+
export type PhiTabBarWidgetPlacement = PhiWidgetPlacementBase & PhiControlPlacement & Partial<PhiChoiceOptionsConfig> & {
|
|
197
|
+
value?: string;
|
|
198
|
+
valueMode?: PhiChoiceValueMode;
|
|
199
|
+
placement?: PhiCmsTabBarWidgetConfig["placement"];
|
|
200
|
+
};
|
|
167
201
|
/**
|
|
168
202
|
* Whether this placement draws the form's own submit.
|
|
169
203
|
*
|
|
@@ -436,6 +470,9 @@ export type PhiCoreWidgetPlacements = {
|
|
|
436
470
|
spacer: PhiSpacerWidgetPlacement;
|
|
437
471
|
html: PhiHtmlWidgetPlacement;
|
|
438
472
|
table: PhiTableWidgetPlacement;
|
|
473
|
+
record: PhiRecordWidgetPlacement;
|
|
474
|
+
"slot-upload": PhiSlotUploadWidgetPlacement;
|
|
475
|
+
"tab-bar": PhiTabBarWidgetPlacement;
|
|
439
476
|
form: PhiFormWidgetPlacement;
|
|
440
477
|
"collection-view": PhiCollectionViewWidgetPlacement;
|
|
441
478
|
"command-toolbar": PhiCommandToolbarWidgetPlacement;
|