@phis/ui 0.7.7 → 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 +64 -9
- 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/extended-form-field-controls.d.ts +1 -1
- package/components/forms/extended-form-field-controls.js +23 -7
- 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 +28 -0
- package/components/forms/form-provider-contract.js +45 -2
- package/components/forms/form-provider-registry.d.ts +11 -1
- package/components/forms/money-field-currency-key.d.ts +6 -0
- package/components/forms/money-field-currency-key.js +14 -0
- package/components/forms/money-field.d.ts +26 -3
- package/components/forms/money-field.js +54 -4
- 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/navigation-redirect.d.ts +4 -1
- package/components/regions/presets/navigation-redirect.js +6 -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 +32 -6
- 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/money-amount.d.ts +7 -0
- package/helpers/money-amount.js +15 -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/presets.js +3 -6
- 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-area-preset-tree.d.ts +3 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-area-preset-tree.js +4 -7
- 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/client.d.ts +5 -5
- package/plugins/runtime-modules/builder/controller/client.js +2 -1
- package/plugins/runtime-modules/builder/controller/definition.d.ts +4 -4
- package/plugins/runtime-modules/builder/controller/definition.js +7 -0
- package/plugins/runtime-modules/builder/controller/draft-command-controller.d.ts +3 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +2 -1
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +72 -18
- package/plugins/runtime-modules/builder/controller/server-definition.d.ts +4 -4
- package/plugins/runtime-modules/builder/controller/workspace-controller.d.ts +3 -1
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +8 -10
- package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +10 -0
- package/plugins/runtime-modules/builder/developer-workspace-store.js +35 -1
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +5 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +6 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.js +35 -6
- 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.d.ts +4 -1
- package/plugins/runtime-modules/builder/persistence.js +14 -3
- 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 +28 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +28 -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/spacer/client.js +3 -3
- 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/phi-default-site-area-preset-tree.js +46 -39
- package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
- package/plugins/runtime-modules/preset-contracts/pub-area.js +1 -0
- package/plugins/runtime-modules/resolver.js +17 -0
- package/plugins/runtime-modules/revisions/controller/client.js +50 -46
- 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 +16 -5
- 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/builder-scaffold.css +7 -1
- package/styles/layout-authoring-scaffold.css +27 -0
- 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,11 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../types/signals";
|
|
4
|
+
import { readPhiDraftStatusSignalValue } from "../../../../types/draft-status";
|
|
5
|
+
import { isPhiBuilderAreaKey } from "../../../../constants/cms-areas";
|
|
6
|
+
import { isPhiRecord } from "../../../../helpers/is-record";
|
|
4
7
|
import { usePhiSignalDispatcher, usePhiSignalListener } from "../../../../components/runtime/runtime-signal-bus";
|
|
8
|
+
import { usePhiApplicationFeedback } from "../../../../components/runtime/use-phi-application-feedback";
|
|
5
9
|
import { resolvePhiBuilderCmsStoragePath } from "../../../../helpers/cms-paths";
|
|
6
|
-
import { resolvePhiBuilderActivePageCatalog, resolvePhiBuilderPagePresetSource, } from "../../../../helpers/cms-page-catalog";
|
|
10
|
+
import { findPhiPageNodePath, resolvePhiBuilderActivePageCatalog, resolvePhiBuilderPagePresetSource, } from "../../../../helpers/cms-page-catalog";
|
|
7
11
|
import { createPhiBuilderControllerAddress } from "../controller/address";
|
|
8
12
|
import { createPhiBuilderHistoryContext, phiBuilderHistory } from "../history";
|
|
13
|
+
import { clearPhiBuilderDraftAllocation, getPhiBuilderDraftContextGeneration, invalidatePhiBuilderDraftContext, } from "../developer-workspace-store";
|
|
14
|
+
import { createPhiBuilderDraftAllocationKey } from "../draft-allocation-key";
|
|
15
|
+
import { loadPhiBuilderPersistedPageCatalog } from "../page-catalog-client";
|
|
16
|
+
import { storePhiWorkspacePersistedPages } from "../workspace-catalog-actions";
|
|
9
17
|
const PHI_BUILDER_NO_DRAFT_HISTORY_CONTEXT = "draft-status:none";
|
|
10
18
|
function resolveTarget(workspace, area, pageKey, navKey, state) {
|
|
11
19
|
if (workspace === "navigation") {
|
|
@@ -20,6 +28,16 @@ function resolveTarget(workspace, area, pageKey, navKey, state) {
|
|
|
20
28
|
return null;
|
|
21
29
|
}
|
|
22
30
|
const pages = resolvePhiBuilderActivePageCatalog(area, state.modulePresetPagesByArea, state.customPages, state.persistedPageCatalogByArea);
|
|
31
|
+
/*
|
|
32
|
+
* A Page key the Area's catalog does not hold yet is a moment, like the catalog not being hydrated:
|
|
33
|
+
* opened as `/builder/phis/ui/pages?phiBuilderArea=app`, the server stands on the Area's root, which
|
|
34
|
+
* the client's catalog leaves out while it forwards, and the workspace moves to an offered Page right
|
|
35
|
+
* after. Asking the catalog for the storage path of that key threw during render and took the whole
|
|
36
|
+
* Builder down with a 500.
|
|
37
|
+
*/
|
|
38
|
+
if (!findPhiPageNodePath(pages, pageKey)) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
23
41
|
const storagePath = resolvePhiBuilderCmsStoragePath(area, pageKey, pages);
|
|
24
42
|
/*
|
|
25
43
|
* Addressed the way a save addresses it: a Module Page by its preset identity, which survives a
|
|
@@ -83,21 +101,25 @@ function resolveTarget(workspace, area, pageKey, navKey, state) {
|
|
|
83
101
|
*/
|
|
84
102
|
export function usePhiBuilderDraftStatusController({ commandWorkspace, effectiveArea, effectiveNavKey, effectivePageKey, state, }) {
|
|
85
103
|
const dispatchSignal = usePhiSignalDispatcher();
|
|
104
|
+
const { showMessage } = usePhiApplicationFeedback();
|
|
86
105
|
const target = resolveTarget(commandWorkspace, effectiveArea, effectivePageKey, effectiveNavKey, state);
|
|
87
106
|
const targetUrl = target?.url ?? null;
|
|
88
107
|
const subject = target?.subject ?? null;
|
|
89
108
|
const historyContext = target?.historyContext ?? null;
|
|
109
|
+
const requestKey = targetUrl === null || historyContext === null
|
|
110
|
+
? null
|
|
111
|
+
: `${targetUrl}:${getPhiBuilderDraftContextGeneration(historyContext)}`;
|
|
90
112
|
const [stored, setStored] = useState(null);
|
|
91
113
|
/*
|
|
92
114
|
* The history head each target was last saved or first read at. The status is read again whenever the
|
|
93
115
|
* target changes -- an Area switched away from and back -- and taking the head at that moment called
|
|
94
116
|
* every edit made before it saved: back on an Area with an unsaved edit, the badge said "Published".
|
|
95
|
-
* A target keeps
|
|
117
|
+
* A target keeps its saved head until a revision action replaces that editing context.
|
|
96
118
|
*/
|
|
97
119
|
const savedHeadsRef = useRef(new Map());
|
|
98
120
|
const historyHead = phiBuilderHistory.useHead(historyContext ?? PHI_BUILDER_NO_DRAFT_HISTORY_CONTEXT);
|
|
99
121
|
useEffect(() => {
|
|
100
|
-
if (targetUrl === null) {
|
|
122
|
+
if (targetUrl === null || requestKey === null || historyContext === null) {
|
|
101
123
|
return;
|
|
102
124
|
}
|
|
103
125
|
let cancelled = false;
|
|
@@ -105,16 +127,11 @@ export function usePhiBuilderDraftStatusController({ commandWorkspace, effective
|
|
|
105
127
|
if (cancelled) {
|
|
106
128
|
return;
|
|
107
129
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
savedHeadsRef.current.set(targetUrl, historyContext === null ? null : phiBuilderHistory.getHead(historyContext));
|
|
114
|
-
}
|
|
115
|
-
return savedHeadsRef.current.get(targetUrl);
|
|
116
|
-
})(),
|
|
117
|
-
});
|
|
130
|
+
const saved = savedHeadsRef.current.get(targetUrl);
|
|
131
|
+
const savedHead = saved?.requestKey === requestKey ? saved.head
|
|
132
|
+
: saved ? null : phiBuilderHistory.getHead(historyContext);
|
|
133
|
+
savedHeadsRef.current.set(targetUrl, { requestKey, head: savedHead });
|
|
134
|
+
setStored({ requestKey, ...next, savedHead });
|
|
118
135
|
};
|
|
119
136
|
void fetch(targetUrl, { method: "GET", cache: "no-store" })
|
|
120
137
|
.then(async (response) => {
|
|
@@ -140,8 +157,8 @@ export function usePhiBuilderDraftStatusController({ commandWorkspace, effective
|
|
|
140
157
|
return () => {
|
|
141
158
|
cancelled = true;
|
|
142
159
|
};
|
|
143
|
-
}, [historyContext, targetUrl]);
|
|
144
|
-
const current = stored === null || stored.requestKey !==
|
|
160
|
+
}, [historyContext, requestKey, targetUrl]);
|
|
161
|
+
const current = stored === null || stored.requestKey !== requestKey || subject === null
|
|
145
162
|
? null
|
|
146
163
|
: stored.status === "error"
|
|
147
164
|
? { status: "error", revisionId: null, subject, error: stored.error }
|
|
@@ -169,6 +186,43 @@ export function usePhiBuilderDraftStatusController({ commandWorkspace, effective
|
|
|
169
186
|
}
|
|
170
187
|
}, [emitTo, serialized]);
|
|
171
188
|
usePhiSignalListener((signal) => {
|
|
189
|
+
if (signal.scope === "area" &&
|
|
190
|
+
signal.channel === "draftStatus" &&
|
|
191
|
+
signal.action === "change" &&
|
|
192
|
+
signal.valueSchema === PHI_SIGNAL_VALUE_SCHEMAS.revisionsDraftStatus &&
|
|
193
|
+
signal.receiver === "broadcast" &&
|
|
194
|
+
signal.sender !== createPhiBuilderControllerAddress() &&
|
|
195
|
+
isPhiRecord(signal.value)) {
|
|
196
|
+
// Revisions names the exact draft it replaced. Ordinary status messages describe the canvas.
|
|
197
|
+
const { area, pageKey, areaModules } = signal.value;
|
|
198
|
+
const status = readPhiDraftStatusSignalValue(signal.value)?.status;
|
|
199
|
+
if (!isPhiBuilderAreaKey(area) || (status !== "draft" && status !== "published")) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (areaModules === true) {
|
|
203
|
+
clearPhiBuilderDraftAllocation(createPhiBuilderDraftAllocationKey(area, "", "modules"));
|
|
204
|
+
}
|
|
205
|
+
else if (typeof pageKey === "string") {
|
|
206
|
+
invalidatePhiBuilderDraftContext({ workspace: "pages", area, pageKey });
|
|
207
|
+
/*
|
|
208
|
+
* The Page's entry in the Area's catalog -- its scope id, pointers, deletion and pending path --
|
|
209
|
+
* is the server's as well: a reset deletes the scope, a restore moves its working draft. The
|
|
210
|
+
* catalog is read once per Area, so it is read again here, or Pages keeps the replaced entry.
|
|
211
|
+
*/
|
|
212
|
+
void loadPhiBuilderPersistedPageCatalog(area, { refresh: true })
|
|
213
|
+
.then((pages) => storePhiWorkspacePersistedPages(area, pages))
|
|
214
|
+
.catch((error) => {
|
|
215
|
+
showMessage({
|
|
216
|
+
level: "error",
|
|
217
|
+
content: error instanceof Error ? error.message : "Failed to load page catalog.",
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
invalidatePhiBuilderDraftContext({ workspace: "structure", area });
|
|
223
|
+
}
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
172
226
|
if (signal.scope !== "area" ||
|
|
173
227
|
signal.channel !== "draftStatus" ||
|
|
174
228
|
signal.action !== "activate" ||
|
|
@@ -192,12 +246,12 @@ export function usePhiBuilderDraftStatusController({ commandWorkspace, effective
|
|
|
192
246
|
}), [historyContext]);
|
|
193
247
|
/** A save or publish of the workspace on screen: the state it stored, and the head it was taken at. */
|
|
194
248
|
function reportSaved(status, revisionId, savedAt) {
|
|
195
|
-
if (targetUrl === null) {
|
|
249
|
+
if (targetUrl === null || requestKey === null) {
|
|
196
250
|
return;
|
|
197
251
|
}
|
|
198
|
-
savedHeadsRef.current.set(targetUrl, savedAt.head);
|
|
252
|
+
savedHeadsRef.current.set(targetUrl, { requestKey, head: savedAt.head });
|
|
199
253
|
setStored({
|
|
200
|
-
requestKey
|
|
254
|
+
requestKey,
|
|
201
255
|
status,
|
|
202
256
|
revisionId,
|
|
203
257
|
error: null,
|
|
@@ -84,14 +84,14 @@ export declare const PHI_BUILDER_RUNTIME_CONTROLLER_SERVER_DEFINITION: {
|
|
|
84
84
|
id: string;
|
|
85
85
|
channel: string;
|
|
86
86
|
action: "change";
|
|
87
|
-
valueType: "
|
|
88
|
-
valueSchema
|
|
87
|
+
valueType: "json";
|
|
88
|
+
valueSchema: `${string}/signals/${string}`;
|
|
89
89
|
} | {
|
|
90
90
|
id: string;
|
|
91
91
|
channel: string;
|
|
92
92
|
action: "change";
|
|
93
|
-
valueType: "
|
|
94
|
-
valueSchema
|
|
93
|
+
valueType: "string";
|
|
94
|
+
valueSchema?: undefined;
|
|
95
95
|
} | {
|
|
96
96
|
id: string;
|
|
97
97
|
channel: string;
|
|
@@ -5,9 +5,11 @@ import type { PhiAreaRootRoute, PhiAreaMeta } from "../../../../helpers/cms-area
|
|
|
5
5
|
import type { PhiWorkspaceCatalogState } from "../../../../components/workspace/catalog-state";
|
|
6
6
|
import { type PhiBuilderPageMetaPresentationLabels } from "../controller/definition";
|
|
7
7
|
import type { PhiCmsTreeControllerSettings } from "../../../../types/cms";
|
|
8
|
+
import type { PhiAccessViewer } from "../../../../types/access";
|
|
8
9
|
import { type PhiHistoryLabels } from "../../../../components/widgets/label-types/history";
|
|
9
10
|
export type { PhiBuilderPageRegionKey, PhiBuilderRegionKey, PhiBuilderShellRegionKey, } from "../region-keys";
|
|
10
11
|
export type PhiDeveloperBuilderWorkspaceControllerProps = {
|
|
12
|
+
viewer: PhiAccessViewer;
|
|
11
13
|
shellPresetDraftsByArea?: Record<string, Record<string, PhiDeveloperBuilderRegionDraft>>;
|
|
12
14
|
runtimeModuleDefinitions?: readonly PhiRuntimeModuleDefinition[];
|
|
13
15
|
runtimeModuleIdsByArea?: Record<string, PhiRuntimeModuleId[]>;
|
|
@@ -27,4 +29,4 @@ export type PhiDeveloperBuilderWorkspaceControllerProps = {
|
|
|
27
29
|
historyLabels: PhiHistoryLabels;
|
|
28
30
|
signalRoutes?: PhiSignalRouteSet | null;
|
|
29
31
|
};
|
|
30
|
-
export declare function PhiDeveloperBuilderWorkspaceController({ shellPresetDraftsByArea, runtimeModuleDefinitions, runtimeModuleIdsByArea, modulePresetPagesByArea, areaPresetSourcesByArea, areaShellsByArea, navigationSurfacesByArea, unresolvedModuleIdsByArea, serverUnavailableModules, publicRouteClaims, publicRoutePaths, areaRootRoutesByArea, areaMetaByArea, areaControllerSettingsByArea, pageMetaLabels, historyLabels, signalRoutes, }: PhiDeveloperBuilderWorkspaceControllerProps): import("react").JSX.Element;
|
|
32
|
+
export declare function PhiDeveloperBuilderWorkspaceController({ viewer, shellPresetDraftsByArea, runtimeModuleDefinitions, runtimeModuleIdsByArea, modulePresetPagesByArea, areaPresetSourcesByArea, areaShellsByArea, navigationSurfacesByArea, unresolvedModuleIdsByArea, serverUnavailableModules, publicRouteClaims, publicRoutePaths, areaRootRoutesByArea, areaMetaByArea, areaControllerSettingsByArea, pageMetaLabels, historyLabels, signalRoutes, }: PhiDeveloperBuilderWorkspaceControllerProps): import("react").JSX.Element;
|
|
@@ -130,7 +130,7 @@ function usePhiDeveloperBuilderWorkspaceController(options) {
|
|
|
130
130
|
const effectsWorkflowCorrelationRef = useRef(null);
|
|
131
131
|
const initializedEffectsCorrelationRef = useRef(null);
|
|
132
132
|
const effectsFormSubmissionRef = useRef(null);
|
|
133
|
-
const { shellPresetDraftsByArea = {}, runtimeModuleDefinitions = [], runtimeModuleIdsByArea = {}, modulePresetPagesByArea = EMPTY_MODULE_PRESET_PAGES_BY_AREA, areaPresetSourcesByArea = {}, areaShellsByArea = EMPTY_AREA_SHELLS, navigationSurfacesByArea = {}, unresolvedModuleIdsByArea = EMPTY_RUNTIME_MODULE_IDS_BY_AREA, serverUnavailableModules = EMPTY_SERVER_UNAVAILABLE_MODULES, publicRouteClaims = EMPTY_PUBLIC_ROUTE_CLAIMS, publicRoutePaths = EMPTY_PUBLIC_ROUTE_PATHS, areaRootRoutesByArea = EMPTY_AREA_ROOT_ROUTES, areaMetaByArea = EMPTY_AREA_META, areaControllerSettingsByArea = EMPTY_AREA_CONTROLLER_SETTINGS, pageMetaLabels = PHI_BUILDER_PAGE_META_DEFAULT_PRESENTATION_LABELS, historyLabels, signalRoutes = null, } = options;
|
|
133
|
+
const { viewer, shellPresetDraftsByArea = {}, runtimeModuleDefinitions = [], runtimeModuleIdsByArea = {}, modulePresetPagesByArea = EMPTY_MODULE_PRESET_PAGES_BY_AREA, areaPresetSourcesByArea = {}, areaShellsByArea = EMPTY_AREA_SHELLS, navigationSurfacesByArea = {}, unresolvedModuleIdsByArea = EMPTY_RUNTIME_MODULE_IDS_BY_AREA, serverUnavailableModules = EMPTY_SERVER_UNAVAILABLE_MODULES, publicRouteClaims = EMPTY_PUBLIC_ROUTE_CLAIMS, publicRoutePaths = EMPTY_PUBLIC_ROUTE_PATHS, areaRootRoutesByArea = EMPTY_AREA_ROOT_ROUTES, areaMetaByArea = EMPTY_AREA_META, areaControllerSettingsByArea = EMPTY_AREA_CONTROLLER_SETTINGS, pageMetaLabels = PHI_BUILDER_PAGE_META_DEFAULT_PRESENTATION_LABELS, historyLabels, signalRoutes = null, } = options;
|
|
134
134
|
/*
|
|
135
135
|
* One declared output, delivered through every route written for it.
|
|
136
136
|
*
|
|
@@ -187,6 +187,7 @@ function usePhiDeveloperBuilderWorkspaceController(options) {
|
|
|
187
187
|
hasUnsavedChanges,
|
|
188
188
|
reportSaved,
|
|
189
189
|
state,
|
|
190
|
+
viewer,
|
|
190
191
|
historyLabels,
|
|
191
192
|
});
|
|
192
193
|
const currentRuntimeModuleIdsByArea = state.runtimeModuleIdsByArea ?? EMPTY_RUNTIME_MODULE_IDS_BY_AREA;
|
|
@@ -211,24 +212,20 @@ function usePhiDeveloperBuilderWorkspaceController(options) {
|
|
|
211
212
|
const publicRouteClaimsPreloadKey = useMemo(() => JSON.stringify(publicRouteClaims), [publicRouteClaims]);
|
|
212
213
|
const serverUnavailableModulesPreloadKey = useMemo(() => JSON.stringify(serverUnavailableModules), [serverUnavailableModules]);
|
|
213
214
|
const publicRoutePathsPreloadKey = useMemo(() => JSON.stringify(publicRoutePaths), [publicRoutePaths]);
|
|
214
|
-
const areaRootRoutesPreloadKey = useMemo(() => JSON.stringify(areaRootRoutesByArea), [areaRootRoutesByArea]);
|
|
215
215
|
/*
|
|
216
216
|
* The Areas' root routes, handed to every workspace rather than to /shells alone.
|
|
217
217
|
*
|
|
218
218
|
* It is a baseline and not a draft: /pages reads it to leave `/` out of its page selector while the
|
|
219
|
-
* root forwards
|
|
219
|
+
* root forwards. A save can update the client baseline between preloads, so a fresh server answer
|
|
220
|
+
* must be applied even when its content matches the answer the Controller received before that save.
|
|
220
221
|
*/
|
|
221
222
|
useEffect(() => {
|
|
222
223
|
setPhiDeveloperBuilderAreaRootRoutes(areaRootRoutesByArea);
|
|
223
|
-
|
|
224
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
225
|
-
}, [areaRootRoutesPreloadKey]);
|
|
224
|
+
}, [areaRootRoutesByArea]);
|
|
226
225
|
// What the Areas said about being found, read from the same revision and set the same way.
|
|
227
|
-
const areaMetaPreloadKey = useMemo(() => JSON.stringify(areaMetaByArea), [areaMetaByArea]);
|
|
228
226
|
useEffect(() => {
|
|
229
227
|
setPhiDeveloperBuilderAreaMetaBaseline(areaMetaByArea);
|
|
230
|
-
|
|
231
|
-
}, [areaMetaPreloadKey]);
|
|
228
|
+
}, [areaMetaByArea]);
|
|
232
229
|
// What each Shell tells its Controllers, carried into every save that states the Shell whole.
|
|
233
230
|
const areaControllerSettingsPreloadKey = useMemo(() => JSON.stringify(areaControllerSettingsByArea), [areaControllerSettingsByArea]);
|
|
234
231
|
useEffect(() => {
|
|
@@ -1444,8 +1441,9 @@ function usePhiDeveloperBuilderWorkspaceController(options) {
|
|
|
1444
1441
|
*/
|
|
1445
1442
|
return _jsxs(_Fragment, { children: [pageMetaDialog, confirmDialog] });
|
|
1446
1443
|
}
|
|
1447
|
-
export function PhiDeveloperBuilderWorkspaceController({ shellPresetDraftsByArea = {}, runtimeModuleDefinitions = [], runtimeModuleIdsByArea = {}, modulePresetPagesByArea = EMPTY_MODULE_PRESET_PAGES_BY_AREA, areaPresetSourcesByArea = {}, areaShellsByArea = EMPTY_AREA_SHELLS, navigationSurfacesByArea = {}, unresolvedModuleIdsByArea = EMPTY_RUNTIME_MODULE_IDS_BY_AREA, serverUnavailableModules = EMPTY_SERVER_UNAVAILABLE_MODULES, publicRouteClaims = EMPTY_PUBLIC_ROUTE_CLAIMS, publicRoutePaths = EMPTY_PUBLIC_ROUTE_PATHS, areaRootRoutesByArea = EMPTY_AREA_ROOT_ROUTES, areaMetaByArea = EMPTY_AREA_META, areaControllerSettingsByArea = EMPTY_AREA_CONTROLLER_SETTINGS, pageMetaLabels = PHI_BUILDER_PAGE_META_DEFAULT_PRESENTATION_LABELS, historyLabels, signalRoutes = null, }) {
|
|
1444
|
+
export function PhiDeveloperBuilderWorkspaceController({ viewer, shellPresetDraftsByArea = {}, runtimeModuleDefinitions = [], runtimeModuleIdsByArea = {}, modulePresetPagesByArea = EMPTY_MODULE_PRESET_PAGES_BY_AREA, areaPresetSourcesByArea = {}, areaShellsByArea = EMPTY_AREA_SHELLS, navigationSurfacesByArea = {}, unresolvedModuleIdsByArea = EMPTY_RUNTIME_MODULE_IDS_BY_AREA, serverUnavailableModules = EMPTY_SERVER_UNAVAILABLE_MODULES, publicRouteClaims = EMPTY_PUBLIC_ROUTE_CLAIMS, publicRoutePaths = EMPTY_PUBLIC_ROUTE_PATHS, areaRootRoutesByArea = EMPTY_AREA_ROOT_ROUTES, areaMetaByArea = EMPTY_AREA_META, areaControllerSettingsByArea = EMPTY_AREA_CONTROLLER_SETTINGS, pageMetaLabels = PHI_BUILDER_PAGE_META_DEFAULT_PRESENTATION_LABELS, historyLabels, signalRoutes = null, }) {
|
|
1448
1445
|
const controller = usePhiDeveloperBuilderWorkspaceController({
|
|
1446
|
+
viewer,
|
|
1449
1447
|
shellPresetDraftsByArea,
|
|
1450
1448
|
runtimeModuleDefinitions,
|
|
1451
1449
|
runtimeModuleIdsByArea,
|
|
@@ -55,6 +55,7 @@ export type PhiDeveloperBuilderNodeSelection = {
|
|
|
55
55
|
openWiring?: boolean;
|
|
56
56
|
};
|
|
57
57
|
export declare function selectPhiDeveloperBuilderNode(selection: PhiDeveloperBuilderNodeSelection): void;
|
|
58
|
+
export declare function getPhiBuilderDraftContextGeneration(context: string): number;
|
|
58
59
|
export declare function patchPhiDeveloperBuilderState(next: Partial<Pick<PhiDeveloperBuilderState, "pickerWidgetCategoryFilters">>): void;
|
|
59
60
|
type PhiBuilderRegionDraftMutationOptions = {
|
|
60
61
|
history?: PhiBuilderHistoryRecording | null;
|
|
@@ -199,6 +200,15 @@ export declare function resetPhiBuilderSignalWiringSession(): void;
|
|
|
199
200
|
*/
|
|
200
201
|
export declare function storePhiBuilderDraftAllocation(allocationKey: string, saved: PhiDeveloperBuilderDraftAllocation): void;
|
|
201
202
|
export declare function clearPhiBuilderDraftAllocation(allocationKey: string): void;
|
|
203
|
+
/** A successful revision action supersedes the canvas and undo history of just that draft. */
|
|
204
|
+
export declare function invalidatePhiBuilderDraftContext(scope: {
|
|
205
|
+
workspace: "structure";
|
|
206
|
+
area: PhiDeveloperBuilderArea;
|
|
207
|
+
} | {
|
|
208
|
+
workspace: "pages";
|
|
209
|
+
area: PhiDeveloperBuilderArea;
|
|
210
|
+
pageKey: string;
|
|
211
|
+
}): void;
|
|
202
212
|
/** Takes the next node sequence of a Draft, answering the allocation it was taken from. */
|
|
203
213
|
export declare function takePhiBuilderDraftNodeSequence(allocationKey: string): PhiDeveloperBuilderDraftAllocation;
|
|
204
214
|
/**
|
|
@@ -6,7 +6,9 @@ import { createPhiSignalCorrelationId } from "../../../components/runtime/runtim
|
|
|
6
6
|
import { useRef, useSyncExternalStore } from "react";
|
|
7
7
|
import { createPhiPluginStateStore } from "../../../components/state/plugin-state-store";
|
|
8
8
|
import { phiWorkspaceCatalogStore, } from "../../../components/workspace/catalog-store";
|
|
9
|
-
import { phiBuilderHistory } from "./history";
|
|
9
|
+
import { createPhiBuilderHistoryContext, phiBuilderHistory } from "./history";
|
|
10
|
+
import { createPhiBuilderDraftAllocationKey } from "./draft-allocation-key";
|
|
11
|
+
import { getPhiBuilderPageDraftKey, getPhiBuilderRegionDraftKey, PHI_BUILDER_PAGE_REGION_KEYS, PHI_BUILDER_SHELL_REGION_KEYS, } from "./region-keys";
|
|
10
12
|
import { openPhiWorkspacePage, restorePhiWorkspaceCatalog, setPhiWorkspacePageKey, } from "./workspace-catalog-actions";
|
|
11
13
|
export function normalizePhiDeveloperBuilderArea(scopeKey) {
|
|
12
14
|
return isPhiBuilderAreaKey(scopeKey) ? scopeKey : "public";
|
|
@@ -204,6 +206,10 @@ export function selectPhiDeveloperBuilderNode(selection) {
|
|
|
204
206
|
}));
|
|
205
207
|
}
|
|
206
208
|
const builderRegionDraftStore = createPhiPluginStateStore("@phis/ui/developer-region-drafts", () => ({}));
|
|
209
|
+
const builderDraftContextGenerations = new Map();
|
|
210
|
+
export function getPhiBuilderDraftContextGeneration(context) {
|
|
211
|
+
return builderDraftContextGenerations.get(context) ?? 0;
|
|
212
|
+
}
|
|
207
213
|
export function patchPhiDeveloperBuilderState(next) {
|
|
208
214
|
builderWorkspaceStore.patch(PHI_WORKSPACE_CATALOG_SCOPE, (current) => ({
|
|
209
215
|
...current,
|
|
@@ -813,6 +819,34 @@ export function clearPhiBuilderDraftAllocation(allocationKey) {
|
|
|
813
819
|
return { ...current, draftAllocations };
|
|
814
820
|
});
|
|
815
821
|
}
|
|
822
|
+
/** A successful revision action supersedes the canvas and undo history of just that draft. */
|
|
823
|
+
export function invalidatePhiBuilderDraftContext(scope) {
|
|
824
|
+
const { area, workspace } = scope;
|
|
825
|
+
const context = createPhiBuilderHistoryContext(scope);
|
|
826
|
+
builderDraftContextGenerations.set(context, getPhiBuilderDraftContextGeneration(context) + 1);
|
|
827
|
+
const pageKey = workspace === "pages" ? scope.pageKey : null;
|
|
828
|
+
const regions = workspace === "pages" ? PHI_BUILDER_PAGE_REGION_KEYS : PHI_BUILDER_SHELL_REGION_KEYS;
|
|
829
|
+
restorePhiDeveloperRegionDrafts(Object.fromEntries(regions.map((region) => [getPhiBuilderRegionDraftKey(area, region, pageKey), null])));
|
|
830
|
+
if (pageKey === null) {
|
|
831
|
+
setPhiDeveloperBuilderAreaRootRoute(area, undefined);
|
|
832
|
+
restorePhiDeveloperBuilderAreaMeta(area, undefined);
|
|
833
|
+
}
|
|
834
|
+
else {
|
|
835
|
+
const metaKey = getPhiBuilderPageDraftKey(area, "page_meta", pageKey);
|
|
836
|
+
const deleteKey = getPhiBuilderPageDraftKey(area, "page_delete", pageKey);
|
|
837
|
+
builderWorkspaceStore.patch(PHI_WORKSPACE_CATALOG_SCOPE, (current) => {
|
|
838
|
+
const pageMetaDrafts = { ...current.pageMetaDrafts };
|
|
839
|
+
const deletedPageDrafts = { ...current.deletedPageDrafts };
|
|
840
|
+
const pageControllerSettings = { ...current.pageControllerSettings };
|
|
841
|
+
delete pageMetaDrafts[metaKey];
|
|
842
|
+
delete deletedPageDrafts[deleteKey];
|
|
843
|
+
delete pageControllerSettings[metaKey];
|
|
844
|
+
return { ...current, pageMetaDrafts, deletedPageDrafts, pageControllerSettings };
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
clearPhiBuilderDraftAllocation(createPhiBuilderDraftAllocationKey(area, pageKey ?? "", workspace === "pages" ? "page" : "area"));
|
|
848
|
+
phiBuilderHistory.clear(context);
|
|
849
|
+
}
|
|
816
850
|
/** Takes the next node sequence of a Draft, answering the allocation it was taken from. */
|
|
817
851
|
export function takePhiBuilderDraftNodeSequence(allocationKey) {
|
|
818
852
|
const allocation = builderWorkspaceStore.getSnapshot(PHI_WORKSPACE_CATALOG_SCOPE).draftAllocations[allocationKey];
|
|
@@ -48,6 +48,11 @@ export type PhiDeveloperBuilderPageMetaDraft = {
|
|
|
48
48
|
* why it is resolved apart from them at save time.
|
|
49
49
|
*/
|
|
50
50
|
index?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The picture a link to the Page shows, as the Page holds it (`page.layoutConfig.shareImage`). No
|
|
53
|
+
* dialog field edits it yet; it is carried from the Page into its next save so a save keeps it.
|
|
54
|
+
*/
|
|
55
|
+
shareImage?: import("../../../types/link-preview").PhiShareImage | null;
|
|
51
56
|
};
|
|
52
57
|
export type PhiDeveloperBuilderDraftAllocation = {
|
|
53
58
|
revisionId: number;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type PhiBuilderPageCatalogArea, type PhiPresetPageNode } from "../../../helpers/cms-page-catalog";
|
|
2
|
+
import { type PhiAccessViewer } from "../../../types/access";
|
|
2
3
|
import type { PhiDeveloperBuilderWorkspaceState } from "./developer-workspace-types";
|
|
3
4
|
/**
|
|
4
5
|
* The part of the workspace this reads, named rather than taken whole.
|
|
@@ -61,6 +62,11 @@ export declare function resolvePhiBuilderOfferedPageKey(state: PhiBuilderOffered
|
|
|
61
62
|
pages: PhiPresetPageNode[];
|
|
62
63
|
pageKey: string | null;
|
|
63
64
|
};
|
|
65
|
+
/** The shell is drawn on the Page its Area leads to, below the landing at `/`. */
|
|
66
|
+
export declare function resolvePhiBuilderShellPreviewPage(state: PhiBuilderOfferedCatalogState, area: PhiBuilderPageCatalogArea, viewer: PhiAccessViewer): {
|
|
67
|
+
pages: PhiPresetPageNode[];
|
|
68
|
+
pageKey: string | null;
|
|
69
|
+
};
|
|
64
70
|
/**
|
|
65
71
|
* Whether the open Page is a root the Builder has taken over to construct itself.
|
|
66
72
|
*
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
|
|
3
|
+
import { isPhiCmsErrorPagePath } from "../../../constants/cms-error-pages";
|
|
3
4
|
import { choosePhiAreaRootApplicant, resolvePhiAreaLandingSelection, } from "../../../helpers/cms-area-config";
|
|
4
|
-
import { findPhiBuilderPageKeyFromStoragePath, normalizePhiBuilderCmsCatalogPath, resolvePhiBuilderActivePageCatalog, resolvePhiBuilderActivePageKey, resolvePhiBuilderRequestedPageKey, resolvePhiBuilderPageKeyFromCatalogPath, } from "../../../helpers/cms-page-catalog";
|
|
5
|
+
import { findPhiBuilderPageKeyFromStoragePath, findPhiPageNodePath, normalizePhiBuilderCmsCatalogPath, resolvePhiBuilderActivePageCatalog, resolvePhiBuilderActivePageKey, resolvePhiBuilderRequestedPageKey, resolvePhiBuilderPageKeyFromCatalogPath, } from "../../../helpers/cms-page-catalog";
|
|
5
6
|
import { findFirstPhiCmsNavigationLinkPath } from "../../../components/regions/presets/navigation-redirect";
|
|
7
|
+
import { canPhiViewerAccess } from "../../../types/access";
|
|
6
8
|
import { resolvePhiRuntimeAreaDefinition } from "../area-definitions";
|
|
7
9
|
import { resolvePhiAreaRootRouteNavKey } from "../area-root-route";
|
|
8
10
|
import { listPhiAlwaysActiveRuntimeModuleIds } from "../settings";
|
|
@@ -210,17 +212,44 @@ export function resolvePhiBuilderOfferedPageKey(state, area, requestedPageKey) {
|
|
|
210
212
|
if (requested) {
|
|
211
213
|
return { pages, pageKey: requested };
|
|
212
214
|
}
|
|
213
|
-
const rootRoute = readPhiBuilderStoredAreaRootRoute(state, area);
|
|
214
|
-
const forwardTargetKey = rootRoute?.mode === "redirect"
|
|
215
|
-
? findPageKeyByReference(pages, rootRoute.targetLinkTarget.reference)
|
|
216
|
-
: null;
|
|
217
215
|
return {
|
|
218
216
|
pages,
|
|
219
|
-
pageKey:
|
|
217
|
+
pageKey: findAreaForwardTargetPageKey(state, area, pages)
|
|
220
218
|
?? findAreaNavigationEntryPageKey(state, area, pages)
|
|
221
219
|
?? resolvePhiBuilderActivePageKey(null, pages),
|
|
222
220
|
};
|
|
223
221
|
}
|
|
222
|
+
function findAreaForwardTargetPageKey(state, area, pages) {
|
|
223
|
+
const rootRoute = readPhiBuilderStoredAreaRootRoute(state, area);
|
|
224
|
+
return rootRoute?.mode === "redirect"
|
|
225
|
+
? findPageKeyByReference(pages, rootRoute.targetLinkTarget.reference)
|
|
226
|
+
: null;
|
|
227
|
+
}
|
|
228
|
+
/** The shell is drawn on the Page its Area leads to, below the landing at `/`. */
|
|
229
|
+
export function resolvePhiBuilderShellPreviewPage(state, area, viewer) {
|
|
230
|
+
const pages = resolvePhiBuilderOfferedPageCatalog(state, area);
|
|
231
|
+
const isPreviewablePage = (key) => {
|
|
232
|
+
const page = key ? findPhiPageNodePath(pages, key)?.at(-1) : null;
|
|
233
|
+
if (!page?.storagePath || page.tombstoned || page.routeParameter) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
const path = normalizePhiBuilderCmsCatalogPath(page.storagePath);
|
|
237
|
+
return path !== "/" && !isPhiCmsErrorPagePath(path);
|
|
238
|
+
};
|
|
239
|
+
const forwardTargetKey = findAreaForwardTargetPageKey(state, area, pages);
|
|
240
|
+
if (isPreviewablePage(forwardTargetKey)) {
|
|
241
|
+
return { pages, pageKey: forwardTargetKey };
|
|
242
|
+
}
|
|
243
|
+
// Public has its Home entry in the header. Staff and App Area roots follow their own sidebar.
|
|
244
|
+
const navKey = area === "public" ? "public:header" : resolvePhiAreaRootRouteNavKey(resolvePhiBuilderAreaAsCmsArea(area));
|
|
245
|
+
const surface = state.navigationSurfacesByArea[area]?.find((candidate) => candidate.navKey === navKey);
|
|
246
|
+
const findPageKey = (path) => findPhiBuilderPageKeyFromStoragePath(area, path, pages);
|
|
247
|
+
const path = findFirstPhiCmsNavigationLinkPath(surface?.items ?? [], "/", {
|
|
248
|
+
isVisible: (item) => canPhiViewerAccess(viewer, item.accessPolicy),
|
|
249
|
+
acceptsPath: (candidate) => isPreviewablePage(findPageKey(candidate)),
|
|
250
|
+
});
|
|
251
|
+
return { pages, pageKey: path ? findPageKey(path) : null };
|
|
252
|
+
}
|
|
224
253
|
/**
|
|
225
254
|
* Where a root that forwards on its own actually lands.
|
|
226
255
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
+
import { type PhiShareImage } from "../../../types/link-preview";
|
|
2
3
|
import type { PhiBlockRuntime } from "../../../types/widget-runtime";
|
|
3
4
|
import type { PhiRuntimeModuleCatalog } from "../../../types";
|
|
4
5
|
import type { PhiCmsPageRecordDescriptor } from "../../../types/record-provider";
|
|
@@ -29,6 +30,12 @@ export type PhiBuilderPageMeta = {
|
|
|
29
30
|
* Carried into the Page's next save, which states the tree whole.
|
|
30
31
|
*/
|
|
31
32
|
controllerSettings: PhiCmsTreeControllerSettings;
|
|
33
|
+
/**
|
|
34
|
+
* The picture a link to the Page shows (`page.layoutConfig.shareImage`), from the same chain. No dialog
|
|
35
|
+
* field states it yet -- a preset, a Module or an agent does -- so it is carried into the next save, which
|
|
36
|
+
* states the Page's config whole.
|
|
37
|
+
*/
|
|
38
|
+
shareImage: PhiShareImage | null;
|
|
32
39
|
};
|
|
33
40
|
/**
|
|
34
41
|
* The record a route preset's Page is about, for the Page the Builder is on: `null` for a Page that is no
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "server-only";
|
|
2
|
+
import { PHI_PAGE_SHARE_IMAGE_CONFIG_KEY, readPhiShareImage } from "../../../types/link-preview";
|
|
2
3
|
import { applyPhiPresetTreeCurrentContent } from "../../../server-helpers/cms-bound-content";
|
|
3
4
|
import { cache } from "react";
|
|
4
5
|
import { cookies } from "next/headers";
|
|
@@ -294,6 +295,7 @@ async function buildPageMetaForScope(runtime, area, pageKey, runtimeModuleCatalo
|
|
|
294
295
|
isDeleted: draftPage.page.page.status === PhiCmsStatus.Deleted,
|
|
295
296
|
index: readPageIndexFlag(draftPage.page.page.flags),
|
|
296
297
|
controllerSettings: draftPage.page.controllerSettings ?? [],
|
|
298
|
+
shareImage: readPageShareImage(draftPage.page.page),
|
|
297
299
|
};
|
|
298
300
|
}
|
|
299
301
|
if (draftPage?.page) {
|
|
@@ -303,6 +305,7 @@ async function buildPageMetaForScope(runtime, area, pageKey, runtimeModuleCatalo
|
|
|
303
305
|
isDeleted: draftPage.page.page.status === PhiCmsStatus.Deleted,
|
|
304
306
|
index: readPageIndexFlag(draftPage.page.page.flags),
|
|
305
307
|
controllerSettings: draftPage.page.controllerSettings ?? [],
|
|
308
|
+
shareImage: readPageShareImage(draftPage.page.page),
|
|
306
309
|
};
|
|
307
310
|
}
|
|
308
311
|
if (resolvedPage?.page?.pageMeta) {
|
|
@@ -312,6 +315,7 @@ async function buildPageMetaForScope(runtime, area, pageKey, runtimeModuleCatalo
|
|
|
312
315
|
isDeleted: resolvedPage.page.page.status === PhiCmsStatus.Deleted,
|
|
313
316
|
index: readPageIndexFlag(resolvedPage.page.page.flags),
|
|
314
317
|
controllerSettings: resolvedPage.page.controllerSettings ?? [],
|
|
318
|
+
shareImage: readPageShareImage(resolvedPage.page.page),
|
|
315
319
|
};
|
|
316
320
|
}
|
|
317
321
|
const presetTree = presetResolution
|
|
@@ -336,16 +340,21 @@ async function buildPageMetaForScope(runtime, area, pageKey, runtimeModuleCatalo
|
|
|
336
340
|
* the first source that holds titles, and a resolved Page without them still holds the tree.
|
|
337
341
|
*/
|
|
338
342
|
const controllerSettings = resolvedPage?.page?.controllerSettings ?? presetTree?.controllerSettings ?? [];
|
|
343
|
+
const shareImage = readPageShareImage(resolvedPage?.page?.page ?? presetTree?.page);
|
|
339
344
|
if (!presetTree?.pageMeta) {
|
|
340
|
-
return { title: null, description: null, index: presetIndex, controllerSettings };
|
|
345
|
+
return { title: null, description: null, index: presetIndex, controllerSettings, shareImage };
|
|
341
346
|
}
|
|
342
347
|
return {
|
|
343
348
|
title: presetTree.pageMeta.title?.value ?? null,
|
|
344
349
|
description: presetTree.pageMeta.description?.value ?? null,
|
|
345
350
|
index: presetIndex,
|
|
346
351
|
controllerSettings,
|
|
352
|
+
shareImage,
|
|
347
353
|
};
|
|
348
354
|
}
|
|
355
|
+
function readPageShareImage(page) {
|
|
356
|
+
return readPhiShareImage(page?.layoutConfig?.[PHI_PAGE_SHARE_IMAGE_CONFIG_KEY]);
|
|
357
|
+
}
|
|
349
358
|
function readPageIndexFlag(flags) {
|
|
350
359
|
return !hasPhiFlag(flags, PhiCmsFlags.NoIndex);
|
|
351
360
|
}
|
|
@@ -2,6 +2,8 @@ import type { PhiCmsContentWidgetNode, PhiCmsLayoutNode } from "../../../types/c
|
|
|
2
2
|
import { type PhiCmsInstanceId } from "../../../types/cms-instance-id";
|
|
3
3
|
import type { PhiDeveloperBuilderArea, PhiDeveloperBuilderRegionDraft, PhiDeveloperBuilderWorkspaceState } from "./developer-workspace-types";
|
|
4
4
|
import type { PhiCmsWidgetContentBinding } from "../../../types/cms-plugins";
|
|
5
|
+
import type { PhiAccessViewer } from "../../../types/access";
|
|
6
|
+
import { type PhiBuilderOfferedCatalogState } from "./offered-page-catalog";
|
|
5
7
|
import { type PhiPresetPageNode } from "../../../helpers/cms-page-catalog";
|
|
6
8
|
import type { PhiCmsPresetIdentity, PhiCmsPresetSource } from "../../../types/cms-module-descriptors";
|
|
7
9
|
import type { PhiBuilderPluginMeta, PhiBuilderWidgetMeta } from "../../../types/builder";
|
|
@@ -132,7 +134,8 @@ export declare function createPhiDeveloperBuilderPageDraft(input: {
|
|
|
132
134
|
nextNodeSequence: number;
|
|
133
135
|
previewHref: string | null;
|
|
134
136
|
}>;
|
|
135
|
-
export declare function previewPhiDeveloperBuilderDraft(state: Pick<PhiDeveloperBuilderWorkspaceState, "area" | "pageKey" | "
|
|
137
|
+
export declare function previewPhiDeveloperBuilderDraft(state: Pick<PhiDeveloperBuilderWorkspaceState, "area" | "pageKey" | "areaPresetSourcesByArea"> & PhiBuilderOfferedCatalogState, workspaceKind: PhiDeveloperBuilderWorkspaceKind, options: {
|
|
138
|
+
viewer: PhiAccessViewer;
|
|
136
139
|
pathname?: string | null;
|
|
137
140
|
scope?: {
|
|
138
141
|
area: PhiDeveloperBuilderArea;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { phiAreaPath } from "../../../helpers/locale";
|
|
3
3
|
import { resolvePhiBuilderAreaAsCmsArea, resolvePhiBuilderAreaMask } from "../../../constants/cms-areas";
|
|
4
4
|
import { PhiCmsFlags, PhiCmsStatus } from "../../../constants/phi-cms";
|
|
5
|
+
import { PHI_PAGE_SHARE_IMAGE_CONFIG_KEY } from "../../../types/link-preview";
|
|
5
6
|
import { readPhiCmsInstanceId } from "../../../types/cms-instance-id";
|
|
6
7
|
import { getPhiBuilderPageDraftKey, getPhiBuilderRegionDraftKey, PHI_BUILDER_PAGE_REGION_KEYS, PHI_BUILDER_SHELL_REGION_KEYS, } from "./region-keys";
|
|
7
8
|
import { getPhiBuilderDefaultRegionDraft } from "./region-defaults";
|
|
@@ -10,6 +11,7 @@ import { stripPhiResolvedAssetProjections } from "../../../components/media/imag
|
|
|
10
11
|
import { resolvePhiBuilderCmsStoragePath } from "../../../helpers/cms-paths";
|
|
11
12
|
import { resolvePhiCmsWidgetContentBindingForConfig } from "../../../helpers/cms-content-binding";
|
|
12
13
|
import { resolvePhiCmsRegionType } from "../../../helpers/cms-region-keys";
|
|
14
|
+
import { resolvePhiBuilderShellPreviewPage } from "./offered-page-catalog";
|
|
13
15
|
import { resolvePhiAuthUiProviderModuleId, resolvePhiDeclaredMediaSpaces, resolvePhiDeclaredSeeds, isPhiRuntimeModuleSelectable, resolvePhiDeclaredThreadKinds, resolvePhiRuntimeModuleIdsForArea, } from "../../../plugins/runtime-modules/settings";
|
|
14
16
|
import { createPhiBuilderDraftAllocationKey } from "./draft-allocation-key";
|
|
15
17
|
import { clearPhiBuilderDraftAllocation, storePhiBuilderDraftAllocation, commitPhiDeveloperBuilderAreaConfig, readPhiBuilderEffectiveAreaRootRoute, readPhiBuilderEffectiveAreaMeta, } from "./developer-workspace-store";
|
|
@@ -525,6 +527,8 @@ export async function savePhiDeveloperBuilderDraft(state, regionDrafts, workspac
|
|
|
525
527
|
const currentPagePresetSource = resolvePhiBuilderPagePresetSource(pageKey, pages);
|
|
526
528
|
const currentAreaPresetSource = state.areaPresetSourcesByArea[area] ?? null;
|
|
527
529
|
const pageMetaDraft = state.pageMetaDrafts?.[getPhiBuilderPageDraftKey(area, "page_meta", pageKey)] ?? null;
|
|
530
|
+
// The Page's config beside its Regions: the share picture it holds travels with every save.
|
|
531
|
+
const pageShareImage = pageMetaDraft?.shareImage ? { [PHI_PAGE_SHARE_IMAGE_CONFIG_KEY]: pageMetaDraft.shareImage } : {};
|
|
528
532
|
/*
|
|
529
533
|
* The Page flags travel apart from the rest of the meta draft: the titles become translated
|
|
530
534
|
* messages and this is a column on the row, so the payload splits them even though the dialog
|
|
@@ -630,6 +634,7 @@ export async function savePhiDeveloperBuilderDraft(state, regionDrafts, workspac
|
|
|
630
634
|
drawerRightRootLayoutNodeId: pageRootIds.drawer_right ?? null,
|
|
631
635
|
layoutConfig: {
|
|
632
636
|
pageRegionConfigs,
|
|
637
|
+
...pageShareImage,
|
|
633
638
|
},
|
|
634
639
|
},
|
|
635
640
|
overlays: [],
|
|
@@ -783,9 +788,15 @@ export async function createPhiDeveloperBuilderPageDraft(input) {
|
|
|
783
788
|
};
|
|
784
789
|
}
|
|
785
790
|
export async function previewPhiDeveloperBuilderDraft(state, workspaceKind, options) {
|
|
786
|
-
const area = options
|
|
787
|
-
const
|
|
788
|
-
|
|
791
|
+
const area = options.scope?.area ?? state.area;
|
|
792
|
+
const shellPreview = workspaceKind === "structure"
|
|
793
|
+
? resolvePhiBuilderShellPreviewPage(state, area, options.viewer)
|
|
794
|
+
: null;
|
|
795
|
+
if (shellPreview?.pageKey === null) {
|
|
796
|
+
throw new Error(`No linked page in the ${area} Area is available for the shell preview.`);
|
|
797
|
+
}
|
|
798
|
+
const pageKey = shellPreview?.pageKey ?? options.scope?.pageKey ?? state.pageKey;
|
|
799
|
+
const pages = shellPreview?.pages ?? resolvePhiBuilderActivePageCatalog(area, state.modulePresetPagesByArea, state.customPages, state.persistedPageCatalogByArea);
|
|
789
800
|
const pagePresetSource = resolvePhiBuilderPagePresetSource(pageKey, pages);
|
|
790
801
|
const areaPresetSource = state.areaPresetSourcesByArea[area] ?? null;
|
|
791
802
|
const draft = workspaceKind === "structure"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { buildPhiRuntimeModulePackageRoutePrefix } from "../../../helpers/runtime-module-route-path";
|
|
2
2
|
import { buildPhiPublicRouteAddressMap, findPhiPublicRoutePathCollisions, } from "../../../helpers/public-route-claims";
|
|
3
3
|
import { isPhiAssignablePublicRoutePath, } from "../../../helpers/cms-area-config";
|
|
4
|
+
import { isPhiRouteAddressBeneath } from "../../../helpers/route-address-check";
|
|
4
5
|
import { assignPhiWorkspacePublicRoutePaths } from "./workspace-catalog-actions";
|
|
5
6
|
import { listPhiAlwaysActiveRuntimeModuleIds } from "../settings";
|
|
6
7
|
import { markPhiBuilderModuleAreasDirty } from "./developer-workspace-store";
|
|
@@ -53,12 +54,14 @@ function buildPhiBuilderPublicAddressMap(state, options) {
|
|
|
53
54
|
*/
|
|
54
55
|
function suggestPhiPublicRoutePath(moduleId, declaredPath, taken) {
|
|
55
56
|
const namespaced = `${buildPhiRuntimeModulePackageRoutePrefix(moduleId)}${declaredPath}`;
|
|
56
|
-
|
|
57
|
+
// Free, and neither beneath nor above an address another holds.
|
|
58
|
+
const free = (candidate) => !taken.has(candidate) && ![...taken.keys()].some((held) => isPhiRouteAddressBeneath(held, candidate) || isPhiRouteAddressBeneath(candidate, held));
|
|
59
|
+
if (free(namespaced)) {
|
|
57
60
|
return namespaced;
|
|
58
61
|
}
|
|
59
62
|
for (let attempt = 2; attempt < 20; attempt += 1) {
|
|
60
63
|
const candidate = `${namespaced}-${attempt}`;
|
|
61
|
-
if (
|
|
64
|
+
if (free(candidate)) {
|
|
62
65
|
return candidate;
|
|
63
66
|
}
|
|
64
67
|
}
|
|
@@ -93,7 +96,9 @@ export function resolvePhiBuilderPublicRouteCollisionAnswers(state, moduleId) {
|
|
|
93
96
|
presetKey: collision.claim.presetKey,
|
|
94
97
|
title: collision.claim.title,
|
|
95
98
|
declaredPath: collision.path,
|
|
96
|
-
heldBy:
|
|
99
|
+
heldBy: collision.relation === "same"
|
|
100
|
+
? describePhiPublicRouteAddressHolder(collision.heldBy, moduleTitles)
|
|
101
|
+
: `${describePhiPublicRouteAddressHolder(collision.heldBy, moduleTitles)} (${collision.heldPath})`,
|
|
97
102
|
published: collision.heldBy.kind === "page" ? collision.heldBy.published : collision.heldBy.claim.live === true,
|
|
98
103
|
path,
|
|
99
104
|
};
|
package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js
CHANGED
|
@@ -140,7 +140,7 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
|
|
|
140
140
|
config: {
|
|
141
141
|
title: null,
|
|
142
142
|
placement: "right",
|
|
143
|
-
size: 377,
|
|
143
|
+
size: { width: 377 },
|
|
144
144
|
mountPolicy: "lazy-keep",
|
|
145
145
|
surface: { background: { base: { kind: "none" }, filter: "glass" } },
|
|
146
146
|
mask: { appearance: "transparent" },
|
|
@@ -531,6 +531,8 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
|
|
|
531
531
|
// it the Form instance the overlay waits for before it opens.
|
|
532
532
|
slotIndex: 1,
|
|
533
533
|
sortOrder: 0,
|
|
534
|
+
// The Builder's Label Set, translated already.
|
|
535
|
+
flags: PhiCmsFlags.NoTranslate,
|
|
534
536
|
label: "Signal routes",
|
|
535
537
|
config: {
|
|
536
538
|
/*
|