@phis/ui 0.7.8 → 0.8.0
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/controls/phi-address-control.d.ts +23 -0
- package/components/controls/phi-address-control.js +43 -0
- package/components/controls/phi-color-control.d.ts +3 -1
- package/components/controls/phi-color-control.js +2 -2
- package/components/controls/phi-country-select-control.d.ts +22 -0
- package/components/controls/phi-country-select-control.js +16 -0
- package/components/controls/phi-dialog-control.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.d.ts +1 -1
- package/components/controls/phi-drawer-control-adapter.js +5 -3
- package/components/controls/phi-drawer-control.d.ts +7 -5
- package/components/controls/phi-float-button-control.d.ts +8 -1
- package/components/controls/phi-float-button-control.js +19 -3
- package/components/controls/phi-form-control.js +52 -8
- package/components/controls/phi-modal-control-adapter.d.ts +1 -1
- package/components/controls/phi-modal-control-adapter.js +14 -37
- package/components/controls/phi-modal-control.d.ts +5 -5
- package/components/controls/phi-options-provider.d.ts +1 -0
- package/components/controls/phi-options-provider.js +1 -0
- package/components/controls/phi-overlay-control-contract.d.ts +52 -17
- package/components/controls/phi-overlay-control-contract.js +55 -30
- package/components/controls/phi-reveal-once-dialog-control.d.ts +21 -0
- package/components/controls/phi-reveal-once-dialog-control.js +52 -0
- package/components/controls/phi-reveal-once-dialog-labels.d.ts +10 -0
- package/components/controls/phi-reveal-once-dialog-labels.js +5 -0
- package/components/forms/flags-field.d.ts +22 -0
- package/components/forms/flags-field.js +58 -0
- package/components/forms/form-option-flags.d.ts +20 -0
- package/components/forms/form-option-flags.js +38 -0
- package/components/forms/form-provider-contract.d.ts +23 -0
- package/components/forms/form-provider-contract.js +36 -0
- package/components/forms/form-provider-registry.d.ts +5 -1
- package/components/forms/shared-form-provider-registry.js +13 -0
- package/components/forms/structured-field-labels.d.ts +24 -0
- package/components/forms/structured-field-labels.js +43 -0
- package/components/forms/structured-form-field-controls.d.ts +12 -0
- package/components/forms/structured-form-field-controls.js +65 -0
- package/components/overlays/phi-overlay-container-client.js +2 -2
- package/components/regions/phi-cms-region-shell.js +2 -2
- package/components/regions/presets/content-entry-editor-page-tree.js +12 -3
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +6 -2
- package/components/regions/presets/phi-settings-page-shell-tree.js +1 -1
- package/components/root/phi-root-theme-resolver.js +3 -0
- package/components/shell/phi-antd-icon.d.ts +1 -8
- package/components/shell/phi-antd-icon.js +1 -227
- package/components/shell/phi-icon-names.d.ts +19 -0
- package/components/shell/phi-icon-names.js +264 -0
- package/components/shell/phi-icon.d.ts +2 -11
- package/components/shell/phi-icon.js +4 -32
- package/components/widgets/client/shared/phi-command-buttons.d.ts +13 -2
- package/components/widgets/client/shared/phi-command-buttons.js +10 -4
- package/components/widgets/client/shared/phi-rendered-value.js +27 -3
- package/components/widgets/client/shared/phi-table-provider-refusal.d.ts +13 -0
- package/components/widgets/client/shared/phi-table-provider-refusal.js +13 -0
- package/components/widgets/config/background.d.ts +3 -2
- package/components/widgets/config/choice-shared.d.ts +10 -1
- package/components/widgets/config/choice-shared.js +8 -2
- package/components/widgets/label-sets/admin-locales.js +1 -1
- package/components/widgets/label-sets/admin-users.d.ts +2 -5
- package/components/widgets/label-sets/admin-users.js +4 -10
- package/components/widgets/label-sets/effects.js +2 -4
- package/components/widgets/label-sets/profile.d.ts +13 -0
- package/components/widgets/label-sets/profile.js +28 -0
- package/components/widgets/label-sets/search-results.js +2 -4
- package/components/widgets/label-sets/table.js +9 -0
- package/components/widgets/label-types/effects.d.ts +3 -2
- package/components/widgets/label-types/effects.js +1 -2
- package/components/widgets/label-types/search-results.d.ts +2 -2
- package/components/widgets/label-types/search-results.js +1 -2
- package/components/widgets/label-types/table.d.ts +3 -0
- package/components/widgets/label-types/table.js +2 -0
- package/components/widgets/server/builder-chrome.d.ts +4 -1
- package/components/widgets/server/builder-chrome.js +2 -2
- package/components/widgets/shared/markdown-body-client.d.ts +26 -0
- package/components/widgets/shared/markdown-body-client.js +31 -1
- package/components/widgets/shared/markdown-render.d.ts +10 -2
- package/components/widgets/shared/markdown-render.js +35 -13
- package/constants/countries.d.ts +9 -0
- package/constants/countries.js +28 -0
- package/constants/customer-file.d.ts +25 -0
- package/constants/customer-file.js +26 -0
- package/constants/record-field-kinds.d.ts +15 -0
- package/constants/record-field-kinds.js +13 -0
- package/constants/runtime-module-ownership.js +12 -0
- package/constants/runtime-render-client-types.d.ts +5 -0
- package/constants/runtime-render-client-types.js +5 -0
- package/{plugins/runtime-modules/threads/controller/address.js → constants/threads-controller-address.js} +1 -1
- package/constants.d.ts +1 -0
- package/constants.js +2 -0
- package/gateway/form-handler-request.d.ts +22 -0
- package/gateway/form-handler-request.js +40 -0
- package/gateway/label-set.d.ts +15 -2
- package/gateway/label-set.js +60 -22
- package/gateway/site-form-route.js +11 -2
- package/helpers/address-field.d.ts +43 -0
- package/helpers/address-field.js +68 -0
- package/helpers/cms-dialog.d.ts +5 -20
- package/helpers/cms-dialog.js +8 -13
- package/helpers/cms-page-catalog.d.ts +10 -0
- package/helpers/cms-page-catalog.js +19 -0
- package/helpers/cms-preset-nodes.d.ts +4 -4
- package/helpers/cms-preset-nodes.js +1 -1
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/country-names.d.ts +12 -0
- package/helpers/country-names.js +14 -0
- package/helpers/phi-metadata.d.ts +33 -1
- package/helpers/phi-metadata.js +62 -1
- package/helpers/preset-table-check.d.ts +34 -0
- package/helpers/preset-table-check.js +124 -0
- package/helpers/preset-text-source-check.d.ts +4 -1
- package/helpers/preset-text-source-check.js +6 -1
- package/helpers/preset-tree-contract-check.d.ts +3 -2
- package/helpers/preset-tree-contract-check.js +30 -5
- package/helpers/public-route-claims.d.ts +9 -1
- package/helpers/public-route-claims.js +23 -3
- package/helpers/record-fields.d.ts +1 -5
- package/helpers/record-fields.js +15 -6
- package/helpers/route-address-check.d.ts +22 -2
- package/helpers/route-address-check.js +29 -8
- package/helpers/site-address-row.d.ts +23 -0
- package/helpers/site-address-row.js +36 -0
- package/helpers/surface-style.d.ts +8 -1
- package/helpers/surface-style.js +12 -2
- package/helpers/thread-inbox-row.d.ts +20 -0
- package/helpers/thread-inbox-row.js +26 -0
- package/helpers/translation-format.d.ts +26 -0
- package/helpers/translation-format.js +31 -0
- package/module-labels.d.ts +1 -1
- package/module-labels.js +1 -1
- package/module-page-check.d.ts +1 -0
- package/module-page-check.js +1 -0
- package/module-records.d.ts +2 -2
- package/module-records.js +1 -0
- package/next/area-route.js +34 -1
- package/next/root-route.js +4 -5
- package/package.json +2 -2
- package/plugins/runtime-modules/accounting/customer-file-access.d.ts +11 -0
- package/plugins/runtime-modules/accounting/customer-file-access.js +12 -0
- package/plugins/runtime-modules/accounting/data-providers.js +1 -1
- package/plugins/runtime-modules/accounting/ids.d.ts +11 -0
- package/plugins/runtime-modules/accounting/ids.js +23 -0
- package/plugins/runtime-modules/accounting/presets.js +32 -5
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +66 -0
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +122 -0
- package/plugins/runtime-modules/accounting/trees/accounting-products-label-set.js +2 -2
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +26 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +381 -0
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-products-page-tree.js +4 -0
- package/plugins/runtime-modules/app/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/app/client-data-providers.js +9 -0
- package/plugins/runtime-modules/app/data-providers.d.ts +98 -0
- package/plugins/runtime-modules/app/data-providers.js +80 -0
- package/plugins/runtime-modules/app/definition.d.ts +131 -0
- package/plugins/runtime-modules/app/definition.js +2 -0
- package/plugins/runtime-modules/app/forms.d.ts +46 -1
- package/plugins/runtime-modules/app/forms.js +195 -1
- package/plugins/runtime-modules/app/ids.d.ts +7 -0
- package/plugins/runtime-modules/app/ids.js +8 -0
- package/plugins/runtime-modules/app/module.d.ts +131 -0
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +135 -0
- package/plugins/runtime-modules/app/services/addresses-table.js +101 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +17 -0
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +179 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +62 -0
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +108 -0
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +27 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +1 -0
- package/plugins/runtime-modules/app/trees/profile-label-set.js +3 -0
- package/plugins/runtime-modules/asset/presets.d.ts +4 -0
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +4 -2
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -2
- package/plugins/runtime-modules/auth/widgets/logout/client.d.ts +1 -1
- package/plugins/runtime-modules/auth/widgets/logout/client.js +2 -2
- package/plugins/runtime-modules/auth/widgets/security/client.d.ts +5 -1
- package/plugins/runtime-modules/auth/widgets/security/client.js +12 -10
- package/plugins/runtime-modules/avatar/overlay-tree.server.js +1 -1
- package/plugins/runtime-modules/blog/presets.d.ts +4 -0
- package/plugins/runtime-modules/builder/clients/inspector-image-field.d.ts +2 -1
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -2
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.d.ts +23 -0
- package/plugins/runtime-modules/builder/clients/metadata-table-provider-stand-ins.js +38 -0
- package/plugins/runtime-modules/builder/clients/mode-switch.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/mode-switch.js +2 -15
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +2 -0
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +2 -1
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +28 -1
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +5 -0
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +7 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +10 -1
- package/plugins/runtime-modules/builder/persistence.js +4 -0
- package/plugins/runtime-modules/builder/public-route-collisions.js +8 -3
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +33 -6
- package/plugins/runtime-modules/builder/widgets/chrome/config.d.ts +6 -4
- package/plugins/runtime-modules/builder/widgets/chrome/config.js +11 -1
- package/plugins/runtime-modules/builder/widgets/inspector-header/authoring.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.d.ts +2 -2
- package/plugins/runtime-modules/builder/widgets/mode-switch/plugin.js +1 -1
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +2 -2
- package/plugins/runtime-modules/client-manifests/app.js +3 -0
- package/plugins/runtime-modules/client-manifests/builder.js +10 -0
- package/plugins/runtime-modules/content-entry-routes.d.ts +4 -0
- package/plugins/runtime-modules/contracts.js +31 -1
- package/plugins/runtime-modules/core/definition.d.ts +23 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +23 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +0 -17
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +2 -23
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +0 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +0 -1
- package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/client.js +3 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +316 -1
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.js +4 -4
- package/plugins/runtime-modules/core/widgets/dimension/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/client.js +4 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +326 -3
- package/plugins/runtime-modules/core/widgets/float-button/config.js +5 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/length/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
- package/plugins/runtime-modules/core/widgets/markdown/server.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/markdown/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.d.ts +12 -0
- package/plugins/runtime-modules/core/widgets/markdown/table-embeds.server.js +68 -0
- package/plugins/runtime-modules/core/widgets/number-input/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +2 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +20 -5
- package/plugins/runtime-modules/core/widgets/table/config.js +6 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.d.ts +17 -0
- package/plugins/runtime-modules/core/widgets/table/reader-query.js +33 -0
- package/plugins/runtime-modules/dashboard/trees/dashboard-cards-page-tree.js +3 -1
- package/plugins/runtime-modules/descriptor-compiler.d.ts +19 -3
- package/plugins/runtime-modules/descriptor-compiler.js +44 -16
- package/plugins/runtime-modules/editor/presets.d.ts +4 -0
- package/plugins/runtime-modules/editor/trees/phi-default-editor-releases-page-tree.js +3 -1
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +5 -1
- package/plugins/runtime-modules/localization/presets.d.ts +4 -0
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -1
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +4 -2
- package/plugins/runtime-modules/news/presets.d.ts +4 -0
- package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +6 -2
- package/plugins/runtime-modules/resolver.js +17 -0
- package/plugins/runtime-modules/revisions/controller/client.js +13 -11
- package/plugins/runtime-modules/revisions/controller/draft-context-target.d.ts +25 -0
- package/plugins/runtime-modules/revisions/controller/draft-context-target.js +33 -0
- package/plugins/runtime-modules/revisions/presets.d.ts +4 -0
- package/plugins/runtime-modules/revisions/services/table.js +13 -4
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +3 -1
- package/plugins/runtime-modules/search/widgets/search-results/client.js +4 -2
- package/plugins/runtime-modules/theme/presets.d.ts +4 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +76 -4
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +3 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +2 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +19 -7
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/definition.js +1 -1
- package/plugins/runtime-modules/threads/data-providers.d.ts +115 -2
- package/plugins/runtime-modules/threads/data-providers.js +85 -0
- package/plugins/runtime-modules/threads/definition.d.ts +115 -2
- package/plugins/runtime-modules/threads/definition.js +1 -1
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +3 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +192 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.js +164 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +5 -3
- package/plugins/runtime-modules/user-management/client-data-providers.js +5 -0
- package/plugins/runtime-modules/user-management/data-providers.d.ts +159 -0
- package/plugins/runtime-modules/user-management/data-providers.js +101 -3
- package/plugins/runtime-modules/user-management/definition.d.ts +159 -0
- package/plugins/runtime-modules/user-management/ids.d.ts +9 -0
- package/plugins/runtime-modules/user-management/ids.js +9 -0
- package/plugins/runtime-modules/user-management/presets.js +17 -1
- package/plugins/runtime-modules/user-management/services/users-access-table.d.ts +378 -0
- package/plugins/runtime-modules/user-management/services/users-access-table.js +132 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +86 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +118 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.d.ts +20 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +166 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +19 -18
- package/server-helpers/cms-page-record.d.ts +9 -1
- package/server-helpers/cms-page-record.js +11 -1
- package/server-helpers/cms-request.js +8 -5
- package/server-helpers/link-preview-image.d.ts +30 -0
- package/server-helpers/link-preview-image.js +57 -0
- package/server-helpers/search-text.js +3 -0
- package/server-helpers.d.ts +1 -1
- package/server-helpers.js +1 -1
- package/styles/shell.css +30 -6
- package/theme/phi-theme-composition.js +9 -0
- package/theme/phi-theme-inverse-ground.d.ts +39 -0
- package/theme/phi-theme-inverse-ground.js +103 -0
- package/theme/phi-theme-tokens.d.ts +2 -1
- package/theme/phi-theme-tokens.js +2 -0
- package/types/cms-module-descriptors.d.ts +14 -0
- package/types/cms-overlay.d.ts +13 -6
- package/types/cms-overlay.js +6 -22
- package/types/cms-plugins.d.ts +14 -2
- package/types/cms.d.ts +10 -0
- package/types/core-widget-placements.d.ts +3 -3
- package/types/link-preview.d.ts +19 -0
- package/types/link-preview.js +19 -0
- package/types/record-provider.d.ts +22 -1
- package/types/site-theme.d.ts +27 -0
- package/types/table-embed.d.ts +48 -0
- package/types/table-embed.js +1 -0
- package/types/table-widget.d.ts +14 -0
- package/types/widget-runtime.d.ts +3 -0
- package/types.d.ts +1 -0
- /package/{plugins/runtime-modules/threads/controller/address.d.ts → constants/threads-controller-address.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "server-only";
|
|
2
2
|
import { PHI_TR_CTX_WEB_UI_LABEL } from "../../../gateway/tr";
|
|
3
|
-
import { definePhiLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../gateway/label-set";
|
|
3
|
+
import { definePhiCountLabel, definePhiLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../gateway/label-set";
|
|
4
4
|
import { PHI_EFFECTS_WIDGET_DEFAULT_LABELS, } from "../label-types/effects";
|
|
5
5
|
const PHI_EFFECTS_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
6
6
|
key: "widget:effects",
|
|
@@ -19,8 +19,7 @@ const PHI_EFFECTS_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
19
19
|
description_transitions: definePhiMessageLabel(PHI_EFFECTS_WIDGET_DEFAULT_LABELS.descriptions.transitions),
|
|
20
20
|
description_viewport_effects: definePhiMessageLabel(PHI_EFFECTS_WIDGET_DEFAULT_LABELS.descriptions.viewportEffects),
|
|
21
21
|
status_off: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.status.off,
|
|
22
|
-
status_configured: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.status.configured,
|
|
23
|
-
status_configured_plural: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.status.configuredPlural,
|
|
22
|
+
status_configured: definePhiCountLabel(PHI_EFFECTS_WIDGET_DEFAULT_LABELS.status.configured),
|
|
24
23
|
field_amount: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.fields.amount,
|
|
25
24
|
field_trigger: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.fields.trigger,
|
|
26
25
|
field_once: PHI_EFFECTS_WIDGET_DEFAULT_LABELS.fields.once,
|
|
@@ -123,7 +122,6 @@ export async function getPhiEffectsWidgetLabels(options) {
|
|
|
123
122
|
status: {
|
|
124
123
|
off: labels.status_off,
|
|
125
124
|
configured: labels.status_configured,
|
|
126
|
-
configuredPlural: labels.status_configured_plural,
|
|
127
125
|
},
|
|
128
126
|
fields: {
|
|
129
127
|
amount: labels.field_amount,
|
|
@@ -127,3 +127,16 @@ export declare function getPhiProfilePasswordFormLabels(options: PhiGlobalTransl
|
|
|
127
127
|
successText: string;
|
|
128
128
|
};
|
|
129
129
|
}>;
|
|
130
|
+
export declare function getPhiProfilePhoneWidgetLabels(options: PhiGlobalTranslatorOptions): Promise<{
|
|
131
|
+
fields: {
|
|
132
|
+
phone: string;
|
|
133
|
+
mobile: string;
|
|
134
|
+
};
|
|
135
|
+
phoneInvalid: string;
|
|
136
|
+
tooLong: string;
|
|
137
|
+
submitLabel: string;
|
|
138
|
+
feedback: {
|
|
139
|
+
successTitle: string;
|
|
140
|
+
successText: string;
|
|
141
|
+
};
|
|
142
|
+
}>;
|
|
@@ -44,6 +44,24 @@ const PHI_PROFILE_NAME_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
44
44
|
success_text: definePhiMessageLabel("Your profile details have been saved."),
|
|
45
45
|
},
|
|
46
46
|
});
|
|
47
|
+
/*
|
|
48
|
+
* The two numbers beside the name: a business telephone and a mobile, each as the person writes it. Core
|
|
49
|
+
* keeps them on the profile, so they are the same on every Site, and a person without a name yet is
|
|
50
|
+
* asked for one first (409), which is why they stand in the name's panel.
|
|
51
|
+
*/
|
|
52
|
+
const PHI_PROFILE_PHONE_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
53
|
+
key: "widget:profile-phone",
|
|
54
|
+
ctx: PHI_TR_CTX_WEB_UI_LABEL,
|
|
55
|
+
labels: {
|
|
56
|
+
phone_label: "Business phone",
|
|
57
|
+
mobile_label: "Mobile",
|
|
58
|
+
phone_invalid: "Enter a telephone number.",
|
|
59
|
+
too_long: "At most 64 characters.",
|
|
60
|
+
submit_label: "Save",
|
|
61
|
+
success_title: "Numbers updated",
|
|
62
|
+
success_text: definePhiMessageLabel("Your telephone numbers have been saved."),
|
|
63
|
+
},
|
|
64
|
+
});
|
|
47
65
|
const PHI_PROFILE_OVERVIEW_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
48
66
|
key: "widget:profile-overview",
|
|
49
67
|
ctx: PHI_TR_CTX_WEB_UI_LABEL,
|
|
@@ -244,3 +262,13 @@ export async function getPhiProfilePasswordFormLabels(options) {
|
|
|
244
262
|
feedback: labels.feedback,
|
|
245
263
|
};
|
|
246
264
|
}
|
|
265
|
+
export async function getPhiProfilePhoneWidgetLabels(options) {
|
|
266
|
+
const labels = await getPhiLabelSet(options, PHI_PROFILE_PHONE_WIDGET_LABEL_SET);
|
|
267
|
+
return {
|
|
268
|
+
fields: { phone: labels.phone_label, mobile: labels.mobile_label },
|
|
269
|
+
phoneInvalid: labels.phone_invalid,
|
|
270
|
+
tooLong: labels.too_long,
|
|
271
|
+
submitLabel: labels.submit_label,
|
|
272
|
+
feedback: { successTitle: labels.success_title, successText: labels.success_text },
|
|
273
|
+
};
|
|
274
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
-
import { definePhiLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../gateway/label-set";
|
|
2
|
+
import { definePhiCountLabel, definePhiLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../gateway/label-set";
|
|
3
3
|
import { PHI_TR_CTX_WEB_UI_LABEL, } from "../../../gateway/tr";
|
|
4
4
|
import { PHI_SEARCH_RESULTS_WIDGET_DEFAULT_LABELS, } from "../label-types/search-results";
|
|
5
5
|
/**
|
|
@@ -11,8 +11,7 @@ const PHI_SEARCH_RESULTS_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
11
11
|
ctx: PHI_TR_CTX_WEB_UI_LABEL,
|
|
12
12
|
labels: {
|
|
13
13
|
heading: PHI_SEARCH_RESULTS_WIDGET_DEFAULT_LABELS.heading,
|
|
14
|
-
count: PHI_SEARCH_RESULTS_WIDGET_DEFAULT_LABELS.count,
|
|
15
|
-
count_one: PHI_SEARCH_RESULTS_WIDGET_DEFAULT_LABELS.countOne,
|
|
14
|
+
count: definePhiCountLabel(PHI_SEARCH_RESULTS_WIDGET_DEFAULT_LABELS.count),
|
|
16
15
|
empty: definePhiMessageLabel(PHI_SEARCH_RESULTS_WIDGET_DEFAULT_LABELS.empty),
|
|
17
16
|
short: definePhiMessageLabel(PHI_SEARCH_RESULTS_WIDGET_DEFAULT_LABELS.short),
|
|
18
17
|
idle: definePhiMessageLabel(PHI_SEARCH_RESULTS_WIDGET_DEFAULT_LABELS.idle),
|
|
@@ -25,7 +24,6 @@ export async function getPhiSearchResultsWidgetLabels(options) {
|
|
|
25
24
|
return {
|
|
26
25
|
heading: labels.heading,
|
|
27
26
|
count: labels.count,
|
|
28
|
-
countOne: labels.count_one,
|
|
29
27
|
empty: labels.empty,
|
|
30
28
|
short: labels.short,
|
|
31
29
|
idle: labels.idle,
|
|
@@ -26,6 +26,10 @@ const PHI_TABLE_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
26
26
|
drag_row: "Drag row",
|
|
27
27
|
move_row_up: "Move row up",
|
|
28
28
|
move_row_down: "Move row down",
|
|
29
|
+
// The Dialog that shows an action's value once.
|
|
30
|
+
reveal_copy_and_close: "Copy and close",
|
|
31
|
+
reveal_close: "Close",
|
|
32
|
+
reveal_copy_failed: definePhiMessageLabel("The value could not be copied. Select it and copy it by hand before closing."),
|
|
29
33
|
// The Core `table` form field's words where its config names none (`table-field-labels.ts`).
|
|
30
34
|
form_add: PHI_FORM_TABLE_DEFAULT_LABELS.add,
|
|
31
35
|
form_remove: PHI_FORM_TABLE_DEFAULT_LABELS.remove,
|
|
@@ -57,6 +61,11 @@ export async function getPhiTableWidgetLabels(options) {
|
|
|
57
61
|
moveRowUp: labels.move_row_up,
|
|
58
62
|
moveRowDown: labels.move_row_down,
|
|
59
63
|
interval,
|
|
64
|
+
reveal: {
|
|
65
|
+
copyAndClose: labels.reveal_copy_and_close,
|
|
66
|
+
close: labels.reveal_close,
|
|
67
|
+
copyFailed: labels.reveal_copy_failed,
|
|
68
|
+
},
|
|
60
69
|
};
|
|
61
70
|
}
|
|
62
71
|
/** The Core `table` form field's add, remove and empty words, which the Form Widget hands to the field. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PhiCountLabel } from "../../../helpers/translation-format";
|
|
1
2
|
export type PhiEffectsWidgetLabels = {
|
|
2
3
|
modalTitle: string;
|
|
3
4
|
openEditor: string;
|
|
@@ -18,8 +19,8 @@ export type PhiEffectsWidgetLabels = {
|
|
|
18
19
|
};
|
|
19
20
|
status: {
|
|
20
21
|
off: string;
|
|
21
|
-
configured
|
|
22
|
-
|
|
22
|
+
/** `%1` is how many are configured. */
|
|
23
|
+
configured: PhiCountLabel;
|
|
23
24
|
};
|
|
24
25
|
fields: {
|
|
25
26
|
amount: string;
|
|
@@ -17,8 +17,7 @@ export const PHI_EFFECTS_WIDGET_DEFAULT_LABELS = {
|
|
|
17
17
|
},
|
|
18
18
|
status: {
|
|
19
19
|
off: "Off",
|
|
20
|
-
configured: "1 configured",
|
|
21
|
-
configuredPlural: "{count} configured",
|
|
20
|
+
configured: { one: "%1 configured", other: "%1 configured" },
|
|
22
21
|
},
|
|
23
22
|
fields: {
|
|
24
23
|
amount: "Amount",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { PhiCountLabel } from "../../../helpers/translation-format";
|
|
1
2
|
export type PhiSearchResultsWidgetLabels = {
|
|
2
3
|
/** `%1` is the query. */
|
|
3
4
|
heading: string;
|
|
4
5
|
/** `%1` is how many Pages matched in all. */
|
|
5
|
-
count:
|
|
6
|
-
countOne: string;
|
|
6
|
+
count: PhiCountLabel;
|
|
7
7
|
/** `%1` is the query. */
|
|
8
8
|
empty: string;
|
|
9
9
|
/** `%1` is how many characters a query needs. */
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export const PHI_SEARCH_RESULTS_WIDGET_DEFAULT_LABELS = {
|
|
2
2
|
heading: "Results for “%1”",
|
|
3
|
-
count: "%1 pages",
|
|
4
|
-
countOne: "1 page",
|
|
3
|
+
count: { one: "%1 page", other: "%1 pages" },
|
|
5
4
|
empty: "Nothing found for “%1”.",
|
|
6
5
|
short: "Type at least %1 characters.",
|
|
7
6
|
idle: "Enter what you are looking for.",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type PhiIntervalLabels } from "./interval";
|
|
2
|
+
import { type PhiRevealOnceDialogLabels } from "../../controls/phi-reveal-once-dialog-labels";
|
|
2
3
|
export type PhiTableWidgetLabels = {
|
|
3
4
|
search: string;
|
|
4
5
|
reset: string;
|
|
@@ -20,6 +21,8 @@ export type PhiTableWidgetLabels = {
|
|
|
20
21
|
moveRowDown: string;
|
|
21
22
|
/** The words of the `interval` renderer, from their own Label Set. */
|
|
22
23
|
interval: PhiIntervalLabels;
|
|
24
|
+
/** The buttons of the Dialog that shows an action's value once (`reveal`). */
|
|
25
|
+
reveal: PhiRevealOnceDialogLabels;
|
|
23
26
|
};
|
|
24
27
|
export declare const PHI_TABLE_WIDGET_DEFAULT_LABELS: PhiTableWidgetLabels;
|
|
25
28
|
export declare function formatPhiTableWidgetLabel(template: string, value: string | number): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PHI_INTERVAL_DEFAULT_LABELS } from "./interval";
|
|
2
|
+
import { PHI_REVEAL_ONCE_DIALOG_DEFAULT_LABELS, } from "../../controls/phi-reveal-once-dialog-labels";
|
|
2
3
|
export const PHI_TABLE_WIDGET_DEFAULT_LABELS = {
|
|
3
4
|
search: "Search",
|
|
4
5
|
reset: "Reset",
|
|
@@ -19,6 +20,7 @@ export const PHI_TABLE_WIDGET_DEFAULT_LABELS = {
|
|
|
19
20
|
moveRowUp: "Move row up",
|
|
20
21
|
moveRowDown: "Move row down",
|
|
21
22
|
interval: PHI_INTERVAL_DEFAULT_LABELS,
|
|
23
|
+
reveal: PHI_REVEAL_ONCE_DIALOG_DEFAULT_LABELS,
|
|
22
24
|
};
|
|
23
25
|
export function formatPhiTableWidgetLabel(template, value) {
|
|
24
26
|
return template.replace("%1", String(value));
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { PhiBlockRuntime } from "../../../types";
|
|
2
|
+
import type { PhiSignalRouteSet } from "../../../types/signals";
|
|
2
3
|
export type PhiBuilderChromeWidgetProps = {
|
|
3
4
|
runtime: Pick<PhiBlockRuntime, "locale">;
|
|
4
5
|
disabled?: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare function PhiBuilderModeSwitchWidget({ runtime, disabled, }: PhiBuilderChromeWidgetProps
|
|
7
|
+
export declare function PhiBuilderModeSwitchWidget({ runtime, disabled, signalRoutes, }: PhiBuilderChromeWidgetProps & {
|
|
8
|
+
signalRoutes?: PhiSignalRouteSet | null;
|
|
9
|
+
}): Promise<import("react").JSX.Element>;
|
|
@@ -6,7 +6,7 @@ import { buildPhiWidgetLabelTranslatorOptions } from "../label-sets/runtime-opti
|
|
|
6
6
|
async function getLabels(runtime) {
|
|
7
7
|
return getPhiBuilderChromeWidgetLabels(buildPhiWidgetLabelTranslatorOptions(runtime));
|
|
8
8
|
}
|
|
9
|
-
export async function PhiBuilderModeSwitchWidget({ runtime, disabled, }) {
|
|
9
|
+
export async function PhiBuilderModeSwitchWidget({ runtime, disabled, signalRoutes, }) {
|
|
10
10
|
const labels = await getLabels(runtime);
|
|
11
|
-
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiRuntimeRenderClientType.BuilderModeSwitch, componentProps: { disabled, labels } }));
|
|
11
|
+
return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiRuntimeRenderClientType.BuilderModeSwitch, componentProps: { disabled, labels, signalRoutes: signalRoutes ?? null } }));
|
|
12
12
|
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
1
2
|
import type { PhiClientBlockBaseProps } from "../../../types";
|
|
2
3
|
import type { PhiCodeToken } from "./markdown-code-tokens";
|
|
3
4
|
import type { PhiMarkdownImageFloat, PhiMarkdownTextAlign } from "../../../types/core-widget-placements";
|
|
4
5
|
import { type PhiSpacingScaleKey } from "../config/spacing-options";
|
|
5
6
|
import type { PhiMarkdownTocHeading } from "../../../types/markdown";
|
|
7
|
+
import type { PhiTableWidgetConfig } from "../../../types/table-widget";
|
|
8
|
+
import type { PhiTableWidgetLabels } from "../label-types/table";
|
|
9
|
+
import type { PhiRenderableBlockRenderMode } from "../../../types/renderable-block";
|
|
6
10
|
import { type PhiMarkdownFoldSections } from "./markdown-sections";
|
|
7
11
|
import type { PhiImagePresentation } from "../../media/image-presentation";
|
|
8
12
|
import { type PhiMarkdownFigureFloat, type PhiMarkdownImageFloatWidth } from "./markdown-image-vocabulary";
|
|
@@ -101,6 +105,24 @@ export type PhiMarkdownBlock = {
|
|
|
101
105
|
} | {
|
|
102
106
|
kind: "image";
|
|
103
107
|
image: PhiMarkdownFigure;
|
|
108
|
+
} | ({
|
|
109
|
+
kind: "table_embed";
|
|
110
|
+
} & PhiMarkdownTableEmbed);
|
|
111
|
+
/**
|
|
112
|
+
* A Table a Module offers, standing on its own in the text (``), resolved on
|
|
113
|
+
* the server (TABLES.md, "Tables in Markdown"): the Table Widget's config and words, or nothing where the
|
|
114
|
+
* embed was refused.
|
|
115
|
+
*/
|
|
116
|
+
export type PhiMarkdownTableEmbed = {
|
|
117
|
+
/** The picture's alt text, translated as the text is: the Table's title when it is drawn. */
|
|
118
|
+
caption: string;
|
|
119
|
+
table: {
|
|
120
|
+
config: PhiTableWidgetConfig;
|
|
121
|
+
labels: PhiTableWidgetLabels;
|
|
122
|
+
renderMode: PhiRenderableBlockRenderMode;
|
|
123
|
+
} | null;
|
|
124
|
+
/** Why it was refused, for the author; set only where the text is authored, never live. */
|
|
125
|
+
notice: string | null;
|
|
104
126
|
};
|
|
105
127
|
export type PhiMarkdownWidgetClientProps = PhiClientBlockBaseProps<
|
|
106
128
|
/** The label above the text, translated on the server. */
|
|
@@ -127,3 +149,7 @@ export type PhiMarkdownWidgetClientProps = PhiClientBlockBaseProps<
|
|
|
127
149
|
headingOffset?: number;
|
|
128
150
|
}>;
|
|
129
151
|
export declare function PhiMarkdownWidgetClient({ config, labels }: PhiMarkdownWidgetClientProps): import("react").JSX.Element | null;
|
|
152
|
+
export declare function PhiMarkdownTableEmbedBlock({ embed, spacing, }: {
|
|
153
|
+
embed: PhiMarkdownTableEmbed;
|
|
154
|
+
spacing: Pick<CSSProperties, "marginBlockStart" | "marginBlockEnd">;
|
|
155
|
+
}): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { Fragment, useEffect, useMemo, useState } from "react";
|
|
4
4
|
import dynamic from "next/dynamic";
|
|
5
5
|
import { PhiProtectedMailText } from "../../navigation/use-phi-protected-mail";
|
|
@@ -14,6 +14,9 @@ import { PhiPlainTable } from "../../tables/phi-plain-table";
|
|
|
14
14
|
import { PhiTypographyControl } from "../../controls/phi-typography-control";
|
|
15
15
|
import { PhiDividerControl } from "../../controls/phi-divider-control";
|
|
16
16
|
import { PhiBulletListControl } from "../../controls/phi-bullet-list-control";
|
|
17
|
+
import { PhiRuntimeModuleRenderClientHost } from "../../runtime/runtime-module-render-client-manifest";
|
|
18
|
+
import { PhiCmsWidgetType } from "../../../constants/cms-widget-types";
|
|
19
|
+
import { PHI_TABLE_PROVIDER_REFUSED_CODE } from "../client/shared/phi-table-provider-refusal";
|
|
17
20
|
import { resolvePhiMarkdownFoldLevel, splitPhiMarkdownSegments, } from "./markdown-sections";
|
|
18
21
|
import { resolvePhiMarkdownFigureSizes, } from "./markdown-image-vocabulary";
|
|
19
22
|
import { resolvePhiBulletListStyle, } from "./bullet-list-vocabulary";
|
|
@@ -144,6 +147,8 @@ function renderBlocks(blocks, token, paragraphStyle, headingStyle, lists, atStar
|
|
|
144
147
|
}) }) }, key));
|
|
145
148
|
case "divider":
|
|
146
149
|
return _jsx(PhiDividerControl, { style: { margin: 0 } }, key);
|
|
150
|
+
case "table_embed":
|
|
151
|
+
return (_jsx(PhiMarkdownTableEmbedBlock, { embed: block, spacing: { marginBlockStart: paragraphBlockStyle.marginBlockStart, marginBlockEnd: paragraphBlockStyle.marginBlockEnd } }, key));
|
|
147
152
|
case "table":
|
|
148
153
|
/*
|
|
149
154
|
* A plain table, not the Table Control: Markdown only shows rows, and the Control's editors,
|
|
@@ -275,3 +280,28 @@ function PhiMarkdownFigureBlock({ figure }) {
|
|
|
275
280
|
const ownRatio = presentation.width && presentation.height ? `${presentation.width} / ${presentation.height}` : undefined;
|
|
276
281
|
return (_jsx("figure", { className: `phi-markdown-figure phi-markdown-figure--float-${figure.float} phi-markdown-figure--width-${figure.floatWidth}`, children: _jsx("div", { className: "phi-markdown-figure__frame", style: { aspectRatio: figure.aspectRatio ?? ownRatio }, children: _jsx(PhiImageControl, { presentation: presentation, source: "asset", alt: figure.alt, title: figure.title, blurDataUrl: figure.blurDataUrl, optimizable: figure.optimizable, sizes: resolvePhiMarkdownFigureSizes(figure.float, figure.floatWidth), style: { width: "100%", height: "100%" }, imageStyle: { width: "100%", height: "100%" } }) }) }));
|
|
277
282
|
}
|
|
283
|
+
/*
|
|
284
|
+
* An embedded Table: the Table Widget's own Render Client, by its type in the Area's manifest, which loads it
|
|
285
|
+
* with `next/dynamic` where one is drawn -- the Table's code is in no chunk of the Markdown Widget, and a
|
|
286
|
+
* text without an embed never asks for it. Refused, the caption stands as a paragraph, with the reason
|
|
287
|
+
* beneath it where the text is authored.
|
|
288
|
+
*/
|
|
289
|
+
export function PhiMarkdownTableEmbedBlock({ embed, spacing, }) {
|
|
290
|
+
/*
|
|
291
|
+
* The caption is the Table's title, so a Table that cannot draw takes it along: live, a failed read --
|
|
292
|
+
* a viewer the Provider refuses -- draws nothing at all. The Table says so in its state, and the caption
|
|
293
|
+
* then stands as the paragraph it is everywhere else. A refused read the Provider explains is no such
|
|
294
|
+
* failure: that Table draws itself, title and all.
|
|
295
|
+
*/
|
|
296
|
+
const [tableFailed, setTableFailed] = useState(false);
|
|
297
|
+
const componentProps = useMemo(() => embed.table
|
|
298
|
+
? {
|
|
299
|
+
...embed.table,
|
|
300
|
+
onStateChange: (state) => setTableFailed(state.errorCode != null && state.errorCode !== PHI_TABLE_PROVIDER_REFUSED_CODE),
|
|
301
|
+
}
|
|
302
|
+
: null, [embed.table]);
|
|
303
|
+
if (componentProps) {
|
|
304
|
+
return (_jsxs("figure", { className: "phi-markdown-table-embed", style: { margin: 0, minWidth: 0, ...spacing }, children: [tableFailed && embed.caption ? (_jsx(PhiTypographyControl, { presentation: "paragraph", style: { margin: 0 }, children: embed.caption })) : null, _jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Table, componentProps: componentProps })] }));
|
|
305
|
+
}
|
|
306
|
+
return (_jsxs(_Fragment, { children: [embed.caption ? (_jsx(PhiTypographyControl, { presentation: "paragraph", style: { margin: 0, ...spacing }, children: embed.caption })) : null, embed.notice ? (_jsx(PhiTypographyControl, { presentation: "paragraph", type: "warning", style: { margin: 0, ...spacing }, children: embed.notice })) : null] }));
|
|
307
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { PhiBlockRuntime, PhiRenderableBlockRenderMode } from "../../../types";
|
|
2
2
|
import type { PhiCmsResolvedContent } from "../../../types/cms";
|
|
3
3
|
import type { PhiMarkdownTocHeading } from "../../../types/markdown";
|
|
4
|
-
import type { PhiMarkdownBlock } from "./markdown-body-client";
|
|
4
|
+
import type { PhiMarkdownBlock, PhiMarkdownTableEmbed } from "./markdown-body-client";
|
|
5
5
|
import type { PhiMarkdownImageFloat } from "../../../types/core-widget-placements";
|
|
6
6
|
import { type PhiMarkdownImageAspectRatio, type PhiMarkdownImageFloatWidth } from "./markdown-image-vocabulary";
|
|
7
|
+
import type { PhiTableEmbedReference } from "../../../types/table-embed";
|
|
7
8
|
/**
|
|
8
9
|
* Where Markdown comes from and how it is turned into blocks: inline text, a stored content field, or a
|
|
9
10
|
* document fetched by URL, translated or not, with heading ids under a prefix of its own.
|
|
@@ -39,6 +40,11 @@ export type PhiMarkdownSourceConfig = {
|
|
|
39
40
|
imageFloat?: PhiMarkdownImageFloat;
|
|
40
41
|
imageFloatWidth?: PhiMarkdownImageFloatWidth;
|
|
41
42
|
};
|
|
43
|
+
/** Who draws a text's Table embeds (TABLES.md); absent, each is its caption. */
|
|
44
|
+
export type PhiMarkdownTableEmbedResolver = (embeds: readonly {
|
|
45
|
+
caption: string;
|
|
46
|
+
reference: PhiTableEmbedReference;
|
|
47
|
+
}[]) => Promise<readonly PhiMarkdownTableEmbed[]>;
|
|
42
48
|
export type MarkdownRenderData = {
|
|
43
49
|
blocks: PhiMarkdownBlock[];
|
|
44
50
|
headings: PhiMarkdownTocHeading[];
|
|
@@ -51,7 +57,9 @@ type ResolvedMarkdownSource = {
|
|
|
51
57
|
message: string;
|
|
52
58
|
};
|
|
53
59
|
export declare function resolveMarkdownSource(config: PhiMarkdownSourceConfig | undefined, publicUrl: string | null | undefined): Promise<ResolvedMarkdownSource>;
|
|
54
|
-
export declare function resolveMarkdownRenderData(config: PhiMarkdownSourceConfig | undefined, runtime?: Pick<PhiBlockRuntime, "site" | "locale" | "area" | "viewer"
|
|
60
|
+
export declare function resolveMarkdownRenderData(config: PhiMarkdownSourceConfig | undefined, runtime?: Pick<PhiBlockRuntime, "site" | "locale" | "area" | "viewer">, options?: {
|
|
61
|
+
tableEmbeds?: PhiMarkdownTableEmbedResolver;
|
|
62
|
+
}): Promise<MarkdownRenderData | {
|
|
55
63
|
error: string;
|
|
56
64
|
}>;
|
|
57
65
|
export {};
|
|
@@ -113,6 +113,7 @@ async function projectInternalMarkdownNodes(tree, runtime) {
|
|
|
113
113
|
const pageReferences = [];
|
|
114
114
|
const assetIds = [];
|
|
115
115
|
const figures = new Map();
|
|
116
|
+
const embeds = new Map();
|
|
116
117
|
const collect = (nodes) => {
|
|
117
118
|
for (const node of nodes ?? []) {
|
|
118
119
|
if (node.type === "link" || node.type === "image") {
|
|
@@ -127,8 +128,8 @@ async function projectInternalMarkdownNodes(tree, runtime) {
|
|
|
127
128
|
};
|
|
128
129
|
collect(tree.children);
|
|
129
130
|
const resolved = await resolvePhiWidgetInternalReferences({ runtime, pageReferences, assetIds });
|
|
130
|
-
const project = (nodes) => (nodes ?? []).flatMap((node) => {
|
|
131
|
-
const children = project(node.children);
|
|
131
|
+
const project = (nodes, lone = false) => (nodes ?? []).flatMap((node) => {
|
|
132
|
+
const children = project(node.children, node.type === "paragraph" && node.children?.filter((child) => child.value?.trim() !== "").length === 1);
|
|
132
133
|
if (node.type === "link") {
|
|
133
134
|
const reference = readPhiInternalReference(node.url);
|
|
134
135
|
if (reference?.kind === "page") {
|
|
@@ -140,6 +141,15 @@ async function projectInternalMarkdownNodes(tree, runtime) {
|
|
|
140
141
|
return [{ ...node, children }];
|
|
141
142
|
}
|
|
142
143
|
if (node.type === "image") {
|
|
144
|
+
// A Module's Table (TABLES.md): alone in a paragraph it keeps an address, as a figure does; else its caption.
|
|
145
|
+
const table = node.url?.trim().match(/^phis:table\/([^?]*)\??(.*)$/su);
|
|
146
|
+
if (table && !lone)
|
|
147
|
+
return [{ type: "text", value: node.alt ?? "" }];
|
|
148
|
+
if (table) {
|
|
149
|
+
const src = `phi-table-embed:${embeds.size}`;
|
|
150
|
+
embeds.set(src, { embedKey: table[1], params: [...new URLSearchParams(table[2])] });
|
|
151
|
+
return [{ ...node, url: src, children }];
|
|
152
|
+
}
|
|
143
153
|
const address = readPhiMarkdownImageAddress(node.url ?? "");
|
|
144
154
|
const reference = readPhiInternalReference(address.reference);
|
|
145
155
|
if (reference?.kind === "asset") {
|
|
@@ -166,26 +176,32 @@ async function projectInternalMarkdownNodes(tree, runtime) {
|
|
|
166
176
|
return [{ ...node, ...(node.children ? { children } : {}) }];
|
|
167
177
|
});
|
|
168
178
|
tree.children = project(tree.children);
|
|
169
|
-
return figures;
|
|
179
|
+
return { figures, embeds };
|
|
170
180
|
}
|
|
171
181
|
/*
|
|
172
182
|
* A paragraph that is one Media picture and nothing else is a figure: a block of its own, drawn by the
|
|
173
183
|
* house's picture Control -- optimised, sized, its box reserved and its corners the Theme's. A picture in
|
|
174
|
-
* the middle of a sentence, or one on somebody else's server, stays the plain picture it was.
|
|
184
|
+
* the middle of a sentence, or one on somebody else's server, stays the plain picture it was. A lone embed is a Table.
|
|
175
185
|
*/
|
|
176
|
-
function promoteMarkdownFigures(blocks, figures, defaults) {
|
|
177
|
-
if (figures.size === 0)
|
|
186
|
+
function promoteMarkdownFigures(blocks, figures, defaults, embeds, found) {
|
|
187
|
+
if (figures.size + embeds.size === 0)
|
|
178
188
|
return blocks;
|
|
179
189
|
return blocks.map((block) => {
|
|
180
190
|
if (block.kind === "blockquote")
|
|
181
|
-
return { ...block, children: promoteMarkdownFigures(block.children, figures, defaults) };
|
|
191
|
+
return { ...block, children: promoteMarkdownFigures(block.children, figures, defaults, embeds, found) };
|
|
182
192
|
if (block.kind === "list")
|
|
183
|
-
return { ...block, items: block.items.map((item) => promoteMarkdownFigures(item, figures, defaults)) };
|
|
193
|
+
return { ...block, items: block.items.map((item) => promoteMarkdownFigures(item, figures, defaults, embeds, found)) };
|
|
184
194
|
if (block.kind !== "paragraph")
|
|
185
195
|
return block;
|
|
186
196
|
const content = block.inlines.filter((inline) => !(inline.kind === "text" && !inline.text.trim()));
|
|
187
197
|
const only = content.length === 1 ? content[0] : null;
|
|
188
198
|
const source = only?.kind === "image" ? figures.get(only.src) : undefined;
|
|
199
|
+
const reference = only?.kind === "image" ? embeds.get(only.src) : undefined;
|
|
200
|
+
if (only?.kind === "image" && reference) {
|
|
201
|
+
const embed = { kind: "table_embed", caption: only.alt.trim(), table: null, notice: null };
|
|
202
|
+
found.push([embed, reference]);
|
|
203
|
+
return embed;
|
|
204
|
+
}
|
|
189
205
|
if (!only || only.kind !== "image" || !source)
|
|
190
206
|
return block;
|
|
191
207
|
return { kind: "image", image: buildMarkdownFigure(only, source, defaults) };
|
|
@@ -459,7 +475,7 @@ export async function resolveMarkdownSource(config, publicUrl) {
|
|
|
459
475
|
const resolvedMarkdown = config.resolvedContent?.textFields.markdown?.source?.trim() ?? "";
|
|
460
476
|
return { ok: true, markdown: resolvedMarkdown || inlineMarkdown };
|
|
461
477
|
}
|
|
462
|
-
export async function resolveMarkdownRenderData(config, runtime) {
|
|
478
|
+
export async function resolveMarkdownRenderData(config, runtime, options = {}) {
|
|
463
479
|
const resolvedSource = await resolveMarkdownSource(config, runtime?.site.publicUrl);
|
|
464
480
|
if (!resolvedSource.ok) {
|
|
465
481
|
return { error: resolvedSource.message };
|
|
@@ -491,9 +507,9 @@ export async function resolveMarkdownRenderData(config, runtime) {
|
|
|
491
507
|
...(config?.imageAspectRatio ? { aspectRatio: config.imageAspectRatio } : {}),
|
|
492
508
|
...(config?.imageFloat ? { float: config.imageFloat } : {}),
|
|
493
509
|
...(config?.imageFloatWidth ? { floatWidth: config.imageFloatWidth } : {}),
|
|
494
|
-
});
|
|
510
|
+
}, options.tableEmbeds);
|
|
495
511
|
}
|
|
496
|
-
async function resolveMarkdownRenderDataFromSource(markdown, translate, headingIdPrefix, sourceLocale, sourceMode = "inline", sourceUrl = null, runtime, extent = "document", headingOffset = 0, imageDefaults = {}) {
|
|
512
|
+
async function resolveMarkdownRenderDataFromSource(markdown, translate, headingIdPrefix, sourceLocale, sourceMode = "inline", sourceUrl = null, runtime, extent = "document", headingOffset = 0, imageDefaults = {}, tableEmbeds) {
|
|
497
513
|
const tree = parseMarkdown(markdown);
|
|
498
514
|
if (extent === "first-paragraph") {
|
|
499
515
|
// Cut by the parser's own reading, never by blank lines: a fence or a list may hold those too.
|
|
@@ -501,11 +517,12 @@ async function resolveMarkdownRenderDataFromSource(markdown, translate, headingI
|
|
|
501
517
|
tree.children = paragraph ? [paragraph] : [];
|
|
502
518
|
}
|
|
503
519
|
let figures = new Map();
|
|
520
|
+
let embeds = new Map();
|
|
504
521
|
if (sourceMode === "url" && sourceUrl) {
|
|
505
522
|
tree.children = projectExternalMarkdownNodes(tree.children, sourceUrl);
|
|
506
523
|
}
|
|
507
524
|
else if (runtime) {
|
|
508
|
-
figures = await projectInternalMarkdownNodes(tree, runtime);
|
|
525
|
+
({ figures, embeds } = await projectInternalMarkdownNodes(tree, runtime));
|
|
509
526
|
}
|
|
510
527
|
const context = {
|
|
511
528
|
sourceLines: markdown.split(/\r?\n/),
|
|
@@ -515,7 +532,12 @@ async function resolveMarkdownRenderDataFromSource(markdown, translate, headingI
|
|
|
515
532
|
headingOffset,
|
|
516
533
|
};
|
|
517
534
|
const inlineMap = await buildMarkdownInlineMap(tree, translate, sourceLocale, runtime?.locale.current, runtime);
|
|
518
|
-
const
|
|
535
|
+
const found = [];
|
|
536
|
+
const blocks = promoteMarkdownFigures(protectMarkdownMail(mapBlockNodes(tree.children, context, inlineMap)), figures, imageDefaults, embeds, found);
|
|
537
|
+
if (found.length > 0 && tableEmbeds) {
|
|
538
|
+
const answers = await tableEmbeds(found.map(([block, reference]) => ({ caption: block.caption, reference })));
|
|
539
|
+
found.forEach(([block], index) => Object.assign(block, answers[index]));
|
|
540
|
+
}
|
|
519
541
|
return { blocks, headings: context.headings };
|
|
520
542
|
}
|
|
521
543
|
/*
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every country and territory of ISO 3166-1 by its alpha-2 code (249, in code order), as the `country` and
|
|
3
|
+
* `address` Form fields offer them and as phis-server stores an address's country (`PhisSiteAddress.country`).
|
|
4
|
+
* Names are not kept here: a field shows each in the reader's language through `Intl.DisplayNames`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PHI_ISO_3166_ALPHA2_CODES: readonly ["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"];
|
|
7
|
+
export type PhiCountryCode = (typeof PHI_ISO_3166_ALPHA2_CODES)[number];
|
|
8
|
+
/** The code as stored -- two capital letters of ISO 3166-1 alpha-2 -- or null for anything else. */
|
|
9
|
+
export declare function readPhiCountryCode(value: unknown): PhiCountryCode | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every country and territory of ISO 3166-1 by its alpha-2 code (249, in code order), as the `country` and
|
|
3
|
+
* `address` Form fields offer them and as phis-server stores an address's country (`PhisSiteAddress.country`).
|
|
4
|
+
* Names are not kept here: a field shows each in the reader's language through `Intl.DisplayNames`.
|
|
5
|
+
*/
|
|
6
|
+
export const PHI_ISO_3166_ALPHA2_CODES = [
|
|
7
|
+
"AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ",
|
|
8
|
+
"BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS",
|
|
9
|
+
"BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN",
|
|
10
|
+
"CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE",
|
|
11
|
+
"EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF",
|
|
12
|
+
"GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM",
|
|
13
|
+
"HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM",
|
|
14
|
+
"JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC",
|
|
15
|
+
"LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK",
|
|
16
|
+
"ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA",
|
|
17
|
+
"NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG",
|
|
18
|
+
"PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW",
|
|
19
|
+
"SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS",
|
|
20
|
+
"ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO",
|
|
21
|
+
"TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI",
|
|
22
|
+
"VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW",
|
|
23
|
+
];
|
|
24
|
+
const PHI_COUNTRY_CODE_SET = new Set(PHI_ISO_3166_ALPHA2_CODES);
|
|
25
|
+
/** The code as stored -- two capital letters of ISO 3166-1 alpha-2 -- or null for anything else. */
|
|
26
|
+
export function readPhiCountryCode(value) {
|
|
27
|
+
return typeof value === "string" && PHI_COUNTRY_CODE_SET.has(value) ? value : null;
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Staff's customer file on one member (phis-server `GET /api/site/members/{userId}/file`) as a Foundation
|
|
3
|
+
* contract, on the terms of `thread-library-provider-keys.ts`: the conversations Module answers the Table
|
|
4
|
+
* Provider (`constants/runtime-module-ownership.ts`), and a Page of another Module binds it by these names
|
|
5
|
+
* without importing the conversations Module -- the Accounting Module's customer file does, and a Module
|
|
6
|
+
* offering its own file over the same Core route (Support's, for a Supporter) does the same. Whether
|
|
7
|
+
* anything answers the key is decided by the installation: the conversations Module must be active in the
|
|
8
|
+
* Area the Page stands in.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PHI_CUSTOMER_FILE_DATA_PROVIDER_KEYS: {
|
|
11
|
+
readonly table: `${string}/${string}`;
|
|
12
|
+
};
|
|
13
|
+
/** The Provider's three resources, each one answer of the same route read for one member. */
|
|
14
|
+
export declare const PHI_CUSTOMER_FILE_RESOURCE_KEYS: {
|
|
15
|
+
readonly person: "person";
|
|
16
|
+
readonly addresses: "addresses";
|
|
17
|
+
readonly threads: "threads";
|
|
18
|
+
};
|
|
19
|
+
/** The binding param a customer file Page writes the file's own subject into, already in the reader's language. */
|
|
20
|
+
export declare const PHI_CUSTOMER_FILE_SUBJECT_PARAM = "fileSubject";
|
|
21
|
+
/**
|
|
22
|
+
* The binding param a customer file Page writes its sentence for the reader's own file into, already in the
|
|
23
|
+
* reader's language: Core refuses that file (`403`), and each Table says this where its rows would be.
|
|
24
|
+
*/
|
|
25
|
+
export declare const PHI_CUSTOMER_FILE_OWN_FILE_PARAM = "ownFileNotice";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createPhiSharedRuntimeDataProviderKey } from "./runtime-data-provider-key";
|
|
2
|
+
/**
|
|
3
|
+
* Staff's customer file on one member (phis-server `GET /api/site/members/{userId}/file`) as a Foundation
|
|
4
|
+
* contract, on the terms of `thread-library-provider-keys.ts`: the conversations Module answers the Table
|
|
5
|
+
* Provider (`constants/runtime-module-ownership.ts`), and a Page of another Module binds it by these names
|
|
6
|
+
* without importing the conversations Module -- the Accounting Module's customer file does, and a Module
|
|
7
|
+
* offering its own file over the same Core route (Support's, for a Supporter) does the same. Whether
|
|
8
|
+
* anything answers the key is decided by the installation: the conversations Module must be active in the
|
|
9
|
+
* Area the Page stands in.
|
|
10
|
+
*/
|
|
11
|
+
export const PHI_CUSTOMER_FILE_DATA_PROVIDER_KEYS = {
|
|
12
|
+
table: createPhiSharedRuntimeDataProviderKey("tables", "threads-customer-file"),
|
|
13
|
+
};
|
|
14
|
+
/** The Provider's three resources, each one answer of the same route read for one member. */
|
|
15
|
+
export const PHI_CUSTOMER_FILE_RESOURCE_KEYS = {
|
|
16
|
+
person: "person",
|
|
17
|
+
addresses: "addresses",
|
|
18
|
+
threads: "threads",
|
|
19
|
+
};
|
|
20
|
+
/** The binding param a customer file Page writes the file's own subject into, already in the reader's language. */
|
|
21
|
+
export const PHI_CUSTOMER_FILE_SUBJECT_PARAM = "fileSubject";
|
|
22
|
+
/**
|
|
23
|
+
* The binding param a customer file Page writes its sentence for the reader's own file into, already in the
|
|
24
|
+
* reader's language: Core refuses that file (`403`), and each Table says this where its rows would be.
|
|
25
|
+
*/
|
|
26
|
+
export const PHI_CUSTOMER_FILE_OWN_FILE_PARAM = "ownFileNotice";
|
|
@@ -4,3 +4,18 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const PHI_RECORD_FIELD_KINDS: readonly ["text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "money", "link"];
|
|
6
6
|
export type PhiRecordFieldKind = (typeof PHI_RECORD_FIELD_KINDS)[number];
|
|
7
|
+
/**
|
|
8
|
+
* The kinds a line of text can show: a text as it is, a number, a date and an amount of money in the
|
|
9
|
+
* page's language (`formatPhiRecordFieldText`, `helpers/record-fields.ts`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const PHI_RECORD_TEXT_FIELD_KINDS: readonly ["text", "number", "date", "money"];
|
|
12
|
+
/**
|
|
13
|
+
* Bits of a `markdown` field's `flags` (`PhiRecordMarkdown`). `Translated`: the text already is in the
|
|
14
|
+
* page's language, a person's translation, and is drawn as written; without it the text is source text in
|
|
15
|
+
* its `sourceLocale`, and the Markdown Widget translates it (TRANSLATIONS.md, "The Markdown unit format").
|
|
16
|
+
*/
|
|
17
|
+
export declare const PhiRecordMarkdownFlag: {
|
|
18
|
+
readonly Translated: number;
|
|
19
|
+
};
|
|
20
|
+
/** Every bit `PhiRecordMarkdownFlag` names; `flags` with any other bit make no markdown field. */
|
|
21
|
+
export declare const PHI_RECORD_MARKDOWN_KNOWN_FLAGS: number;
|