@phis/ui 0.4.2 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-layout-renderer.js +4 -3
- package/components/cms/phi-cms-page-render-scope.d.ts +4 -5
- package/components/cms/phi-cms-page-render-scope.js +43 -22
- package/components/cms/phi-cms-render-diagnostic-client.js +7 -3
- package/components/cms/phi-cms-render-error-boundary.js +2 -1
- package/components/controls/phi-bullet-list-control.js +31 -2
- package/components/controls/phi-ribbon-control.d.ts +29 -0
- package/components/controls/phi-ribbon-control.js +53 -0
- package/components/controls/phi-table-control.d.ts +3 -0
- package/components/controls/phi-table-control.js +13 -1
- package/components/controls/phi-tree-control.js +3 -3
- package/components/forms/shared-form-provider-registry.js +1 -4
- package/components/media/asset-collection-runtime.js +6 -16
- package/components/media/media-font-metrics.d.ts +3 -0
- package/components/media/media-font-metrics.js +43 -0
- package/components/media/phi-area-upload-widget.js +53 -97
- package/components/media/phi-image-preview-data.d.ts +13 -0
- package/components/media/phi-image-preview-data.js +184 -9
- package/components/media/phi-media-picker-binding.js +16 -13
- package/components/media/phi-media-upload.d.ts +15 -8
- package/components/media/phi-media-upload.js +18 -9
- package/components/media/phi-site-font-assets.js +7 -8
- package/components/overlays/phi-overlay-container-client.js +16 -1
- package/components/regions/presets/phi-settings-page-shell-tree.js +48 -1
- package/components/runtime/runtime-controller-materialization.js +12 -1
- package/components/state/scoped-state-store.js +20 -3
- package/components/tables/client/phi-table-binding.d.ts +2 -1
- package/components/tables/client/phi-table-binding.js +45 -21
- package/components/trees/client/phi-tree-binding.js +19 -11
- package/components/widgets/client/bullet-list-entries-editor.d.ts +26 -0
- package/components/widgets/client/bullet-list-entries-editor.js +103 -0
- package/components/widgets/config/choice-shared.js +12 -13
- package/components/widgets/config/command-buttons.d.ts +5 -1
- package/components/widgets/config/command-buttons.js +38 -81
- package/components/widgets/config/control-signal-config.d.ts +3 -1
- package/components/widgets/config/control-signal-config.js +19 -17
- package/components/widgets/config/image-source-parser.d.ts +1 -0
- package/components/widgets/config/image-source-parser.js +7 -8
- package/components/widgets/config/mask.d.ts +6 -1
- package/components/widgets/config/mask.js +24 -1
- package/components/widgets/config/parser-primitives.js +72 -0
- package/components/widgets/config/stack-tabs.d.ts +1 -1
- package/components/widgets/config/stack-tabs.js +2 -3
- package/components/widgets/config/strict-config-reader.d.ts +40 -0
- package/components/widgets/config/strict-config-reader.js +174 -0
- package/components/widgets/label-sets/effects.js +2 -0
- package/components/widgets/label-types/effects.d.ts +1 -0
- package/components/widgets/label-types/effects.js +1 -0
- package/components/widgets/navigation-descriptor-resolver.server.js +20 -8
- package/components/widgets/shared/bullet-list-vocabulary.d.ts +17 -1
- package/components/widgets/shared/bullet-list-vocabulary.js +19 -2
- package/components/widgets/shared/card-body-client.d.ts +16 -4
- package/components/widgets/shared/card-body-client.js +81 -24
- package/components/widgets/shared/card-vocabulary.d.ts +21 -4
- package/components/widgets/shared/card-vocabulary.js +28 -2
- package/components/widgets/signals/control-signal-capabilities.d.ts +0 -18
- package/components/widgets/signals/control-signal-capabilities.js +10 -22
- package/components/workspace/catalog-store.d.ts +4 -3
- package/components/workspace/catalog-store.js +6 -5
- package/gateway/dashboard-cards-route.js +1 -0
- package/gateway/internal-references.d.ts +6 -1
- package/gateway/internal-references.js +48 -23
- package/gateway/site-cms-write-validation.d.ts +9 -0
- package/gateway/site-cms-write-validation.js +78 -0
- package/gateway/site-proxy.js +19 -3
- package/helpers/renderable-block-serialization.js +1 -1
- package/next/config.d.mts +3 -0
- package/next/config.mjs +28 -1
- package/package.json +2 -2
- package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +5 -1
- package/plugins/runtime-modules/accounting/presets.d.ts +9 -0
- package/plugins/runtime-modules/accounting/presets.js +37 -0
- package/plugins/runtime-modules/accounting/server.d.ts +1 -4
- package/plugins/runtime-modules/accounting/server.js +4 -7
- package/plugins/runtime-modules/app/presets.d.ts +18 -0
- package/plugins/runtime-modules/app/presets.js +67 -0
- package/plugins/runtime-modules/app/server.d.ts +1 -4
- package/plugins/runtime-modules/app/server.js +4 -7
- package/plugins/runtime-modules/asset/controller/runtime.js +2 -2
- package/plugins/runtime-modules/asset/services/collection.js +9 -1
- package/plugins/runtime-modules/asset/services/options.js +2 -2
- package/plugins/runtime-modules/builder/area-settings-answer.js +2 -1
- package/plugins/runtime-modules/builder/authoring-canvas.js +6 -6
- package/plugins/runtime-modules/builder/cards.js +3 -5
- package/plugins/runtime-modules/builder/clients/builder-region-overrides.js +3 -3
- package/plugins/runtime-modules/builder/clients/canvas-widget.js +15 -54
- package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +5 -34
- package/plugins/runtime-modules/builder/clients/inspector-link-target-field.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +8 -8
- package/plugins/runtime-modules/builder/clients/inspector-title.js +6 -6
- package/plugins/runtime-modules/builder/clients/layout-inspector.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/layout-inspector.js +11 -25
- package/plugins/runtime-modules/builder/clients/mode-switch.js +1 -1
- package/plugins/runtime-modules/builder/clients/pages-header.js +11 -11
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +1 -1
- package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
- package/plugins/runtime-modules/builder/clients/shells-workspace.js +15 -31
- package/plugins/runtime-modules/builder/clients/structure-canvas.js +1 -1
- package/plugins/runtime-modules/builder/clients/use-region-draft-hydration.d.ts +26 -0
- package/plugins/runtime-modules/builder/clients/use-region-draft-hydration.js +36 -0
- package/plugins/runtime-modules/builder/clients/widget-effects-editor.js +1 -1
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +1 -0
- package/plugins/runtime-modules/builder/clients/workspace-scope-boundary.js +2 -2
- package/plugins/runtime-modules/builder/cms-instance-allocator.js +8 -28
- package/plugins/runtime-modules/builder/controller/client.d.ts +0 -15
- package/plugins/runtime-modules/builder/controller/definition.d.ts +0 -15
- package/plugins/runtime-modules/builder/controller/definition.js +0 -8
- package/plugins/runtime-modules/builder/controller/draft-command-controller.d.ts +1 -2
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +11 -30
- package/plugins/runtime-modules/builder/controller/draft-status-controller.js +15 -2
- package/plugins/runtime-modules/builder/controller/inspector-controller.d.ts +1 -2
- package/plugins/runtime-modules/builder/controller/inspector-controller.js +4 -7
- package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -2
- package/plugins/runtime-modules/builder/controller/page-controller.js +16 -68
- package/plugins/runtime-modules/builder/controller/server-definition.d.ts +0 -15
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.d.ts +2 -5
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +6 -50
- package/plugins/runtime-modules/builder/controller/workspace-controller.d.ts +2 -3
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +89 -153
- package/plugins/runtime-modules/builder/data-providers.d.ts +1 -0
- package/plugins/runtime-modules/builder/data-providers.js +1 -0
- package/plugins/runtime-modules/builder/definition.d.ts +1 -0
- package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +64 -30
- package/plugins/runtime-modules/builder/developer-workspace-store.js +255 -61
- package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +1 -1
- package/plugins/runtime-modules/builder/history.d.ts +3 -1
- package/plugins/runtime-modules/builder/options-providers.js +3 -2
- package/plugins/runtime-modules/builder/page-catalog-client.js +19 -7
- package/plugins/runtime-modules/builder/page-meta-form.js +1 -0
- package/plugins/runtime-modules/builder/page-references-provider.js +1 -1
- package/plugins/runtime-modules/builder/persistence.js +33 -69
- package/plugins/runtime-modules/builder/public-route-collisions.d.ts +2 -2
- package/plugins/runtime-modules/builder/public-route-collisions.js +6 -19
- package/plugins/runtime-modules/builder/render-root-node-preview.server.js +20 -3
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +3 -3
- package/plugins/runtime-modules/builder/runtime-module-selection.d.ts +2 -12
- package/plugins/runtime-modules/builder/runtime-module-selection.js +16 -42
- package/plugins/runtime-modules/builder/services/navigation-table.js +9 -15
- package/plugins/runtime-modules/builder/services/page-source-tree.js +8 -8
- package/plugins/runtime-modules/builder/services/runtime-modules-table.js +10 -10
- package/plugins/runtime-modules/builder/services/signal-routes-table.js +3 -3
- package/plugins/runtime-modules/builder/signal-route-selection.d.ts +1 -2
- package/plugins/runtime-modules/builder/signal-route-selection.js +2 -2
- package/plugins/runtime-modules/builder/signal-wiring-options.js +3 -2
- package/plugins/runtime-modules/builder/structure-dnd.js +8 -61
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +13 -10
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +12 -18
- package/plugins/runtime-modules/builder/workspace-catalog-actions.d.ts +55 -0
- package/plugins/runtime-modules/builder/workspace-catalog-actions.js +142 -0
- package/plugins/runtime-modules/client-manifests/common.js +1 -1
- package/plugins/runtime-modules/{runtime-calendar-adapters.js → core/calendar-adapters.js} +2 -2
- package/plugins/runtime-modules/{client-calendar-adapters/core.js → core/client-calendar-adapters.js} +1 -1
- package/plugins/runtime-modules/core/content-entries/table.js +1 -1
- package/plugins/runtime-modules/core/data-providers.d.ts +3 -0
- package/plugins/runtime-modules/core/data-providers.js +2 -1
- package/plugins/runtime-modules/core/definition.d.ts +3 -0
- package/plugins/runtime-modules/core/definition.js +1 -1
- package/plugins/runtime-modules/core/messaging/data-providers.d.ts +1 -0
- package/plugins/runtime-modules/core/messaging/data-providers.js +1 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +1 -1
- package/plugins/runtime-modules/core/server.js +1 -1
- package/plugins/runtime-modules/core/themes.d.ts +44 -0
- package/plugins/runtime-modules/core/themes.js +12 -0
- package/plugins/runtime-modules/core/widgets/card/collection-view-binding.js +25 -9
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +296 -254
- package/plugins/runtime-modules/core/widgets/card/config.js +52 -3
- package/plugins/runtime-modules/core/widgets/card/editor.js +30 -3
- package/plugins/runtime-modules/core/widgets/card/server.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/card/server.js +31 -3
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +7 -6
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +9 -2
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -25
- package/plugins/runtime-modules/core/widgets/description/editor.js +4 -61
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -25
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -25
- package/plugins/runtime-modules/core/widgets/image/config.js +2 -2
- package/plugins/runtime-modules/core/widgets/markdown/editor.js +2 -3
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +4 -25
- package/plugins/runtime-modules/core/widgets/result/config.js +2 -0
- package/plugins/runtime-modules/core/widgets/result/server.js +25 -19
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -25
- package/plugins/runtime-modules/core/widgets/slot-upload/client.js +11 -2
- package/plugins/runtime-modules/core/widgets/table/client.js +8 -4
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -83
- package/plugins/runtime-modules/core/widgets/table/config.js +302 -452
- package/plugins/runtime-modules/core/widgets/tree/config.js +5 -2
- package/plugins/runtime-modules/dashboard/card-rows.d.ts +5 -0
- package/plugins/runtime-modules/dashboard/card-rows.js +59 -0
- package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +4 -6
- package/plugins/runtime-modules/dashboard/services/collection.js +17 -7
- package/plugins/runtime-modules/groups/data-providers.d.ts +2 -0
- package/plugins/runtime-modules/groups/data-providers.js +3 -3
- package/plugins/runtime-modules/groups/definition.d.ts +2 -0
- package/plugins/runtime-modules/localization/data-providers.d.ts +3 -0
- package/plugins/runtime-modules/localization/data-providers.js +2 -0
- package/plugins/runtime-modules/localization/definition.d.ts +3 -0
- package/plugins/runtime-modules/localization/services/table.js +3 -7
- package/plugins/runtime-modules/observability/data-providers.d.ts +1 -0
- package/plugins/runtime-modules/observability/data-providers.js +1 -0
- package/plugins/runtime-modules/observability/definition.d.ts +1 -0
- package/plugins/runtime-modules/observability/module.d.ts +1 -0
- package/plugins/runtime-modules/observability/services/table.js +1 -1
- package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +2 -105
- package/plugins/runtime-modules/public/presets.d.ts +115 -0
- package/plugins/runtime-modules/{area-base-presets.js → public/presets.js} +19 -119
- package/plugins/runtime-modules/public/server.d.ts +1 -4
- package/plugins/runtime-modules/public/server.js +4 -7
- package/plugins/runtime-modules/public/trees/phi-default-pub-error-page-tree.js +7 -8
- package/plugins/runtime-modules/public-base-page-references.d.ts +1 -1
- package/plugins/runtime-modules/public-base-page-references.js +1 -1
- package/plugins/runtime-modules/revisions/controller/client.js +11 -11
- package/plugins/runtime-modules/revisions/services/table.js +3 -3
- package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +22 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.d.ts +2 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +93 -58
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +2 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +23 -22
- package/plugins/runtime-modules/theme/widgets/brand-controls/plugin.js +1 -1
- package/plugins/runtime-modules/theme-descriptors.js +1 -1
- package/plugins/runtime-modules/user-management/data-providers.d.ts +2 -0
- package/plugins/runtime-modules/user-management/data-providers.js +1 -0
- package/plugins/runtime-modules/user-management/definition.d.ts +2 -0
- package/styles/control-shape.css +11 -11
- package/styles/controls.css +3 -3
- package/styles/layout.css +16 -7
- package/types/cms-config.js +142 -185
- package/types/cms-plugins.d.ts +4 -11
- package/types/core-widget-placements.d.ts +14 -3
- package/types/dashboard-cards.d.ts +9 -0
- package/types/media.d.ts +0 -3
- package/types/renderable-block.d.ts +6 -1
- package/types/table-widget.d.ts +9 -0
- package/types/table-widget.js +20 -0
- package/types.d.ts +1 -1
- package/widget-config.d.ts +2 -0
- package/widget-config.js +6 -0
- package/plugins/runtime-modules/area-base-presets.d.ts +0 -139
- /package/plugins/runtime-modules/{runtime-calendar-adapters.d.ts → core/calendar-adapters.d.ts} +0 -0
- /package/plugins/runtime-modules/{client-calendar-adapters/core.d.ts → core/client-calendar-adapters.d.ts} +0 -0
|
@@ -1,52 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createPhiSignalRouteKey, readPhiSignalRouteSet, PHI_SIGNAL_VALUE_SCHEMAS, } from "../../../../types/signals";
|
|
3
|
-
import {
|
|
3
|
+
import { getPhiDeveloperBuilderStateSnapshot } from "../developer-workspace-store";
|
|
4
4
|
import { getPhiDeveloperSelectedSignalRoutes } from "../signal-route-selection";
|
|
5
5
|
import { phiSignalCapabilitiesMatch, resolvePhiBuilderReceiverSignalEndpoints, resolvePhiBuilderSelectedSignalEndpoints, } from "../signal-wiring-options";
|
|
6
|
-
const EMPTY_SESSION = {
|
|
7
|
-
senderAddress: null,
|
|
8
|
-
senderCapabilityId: null,
|
|
9
|
-
receiverAddress: null,
|
|
10
|
-
receiverCapabilityId: null,
|
|
11
|
-
fieldKey: null,
|
|
12
|
-
};
|
|
13
|
-
function readOptionalString(value) {
|
|
14
|
-
return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
|
|
15
|
-
}
|
|
16
|
-
export function patchPhiBuilderSignalWiringSession(defaultArea, values) {
|
|
17
|
-
builderWorkspaceStore.patch(defaultArea, (current) => {
|
|
18
|
-
const senderAddress = readOptionalString(values.senderAddress) ?? current.signalWiring.senderAddress;
|
|
19
|
-
// A cascade only holds if the values below the one that moved are dropped: keeping a capability that
|
|
20
|
-
// belongs to the previous endpoint would build a route the runtime silently ignores.
|
|
21
|
-
const senderChanged = senderAddress !== current.signalWiring.senderAddress;
|
|
22
|
-
const senderCapabilityId = senderChanged
|
|
23
|
-
? null
|
|
24
|
-
: readOptionalString(values.senderCapabilityId) ?? current.signalWiring.senderCapabilityId;
|
|
25
|
-
const capabilityChanged = senderCapabilityId !== current.signalWiring.senderCapabilityId;
|
|
26
|
-
const receiverAddress = senderChanged || capabilityChanged
|
|
27
|
-
? null
|
|
28
|
-
: readOptionalString(values.receiverAddress) ?? current.signalWiring.receiverAddress;
|
|
29
|
-
const receiverChanged = receiverAddress !== current.signalWiring.receiverAddress;
|
|
30
|
-
return {
|
|
31
|
-
...current,
|
|
32
|
-
signalWiring: {
|
|
33
|
-
senderAddress,
|
|
34
|
-
senderCapabilityId,
|
|
35
|
-
receiverAddress,
|
|
36
|
-
receiverCapabilityId: senderChanged || capabilityChanged || receiverChanged
|
|
37
|
-
? null
|
|
38
|
-
: readOptionalString(values.receiverCapabilityId) ?? current.signalWiring.receiverCapabilityId,
|
|
39
|
-
// The field belongs to the receiver's input, so it falls with everything above it.
|
|
40
|
-
fieldKey: senderChanged || capabilityChanged || receiverChanged
|
|
41
|
-
? null
|
|
42
|
-
: readOptionalString(values.fieldKey) ?? current.signalWiring.fieldKey,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
export function resetPhiBuilderSignalWiringSession(defaultArea) {
|
|
48
|
-
builderWorkspaceStore.patch(defaultArea, (current) => ({ ...current, signalWiring: { ...EMPTY_SESSION } }));
|
|
49
|
-
}
|
|
50
6
|
function routesAreEquivalent(left, right) {
|
|
51
7
|
return left.capabilityId === right.capabilityId && left.scope === right.scope &&
|
|
52
8
|
left.channel === right.channel && left.action === right.action && left.valueType === right.valueType &&
|
|
@@ -61,8 +17,8 @@ function routesAreEquivalent(left, right) {
|
|
|
61
17
|
* selection change, and a route whose value the receiver cannot read is worse than no route at all --
|
|
62
18
|
* nothing reports it at runtime.
|
|
63
19
|
*/
|
|
64
|
-
export function resolvePhiBuilderSignalWiringRoutes(
|
|
65
|
-
const state = getPhiDeveloperBuilderStateSnapshot(
|
|
20
|
+
export function resolvePhiBuilderSignalWiringRoutes() {
|
|
21
|
+
const state = getPhiDeveloperBuilderStateSnapshot();
|
|
66
22
|
const session = state.signalWiring;
|
|
67
23
|
if (!session.senderAddress || !session.senderCapabilityId || !session.receiverAddress || !session.receiverCapabilityId) {
|
|
68
24
|
return { kind: "incomplete" };
|
|
@@ -95,7 +51,7 @@ export function resolvePhiBuilderSignalWiringRoutes(defaultArea) {
|
|
|
95
51
|
receiver: receiver.address,
|
|
96
52
|
...(wantsFieldKey && session.fieldKey ? { fieldKey: session.fieldKey } : {}),
|
|
97
53
|
};
|
|
98
|
-
const current = getPhiDeveloperSelectedSignalRoutes(
|
|
54
|
+
const current = getPhiDeveloperSelectedSignalRoutes() ?? {};
|
|
99
55
|
if ([...(current.emits ?? []), ...(current.listens ?? [])].some((candidate) => routesAreEquivalent(candidate, route))) {
|
|
100
56
|
return { kind: "duplicate" };
|
|
101
57
|
}
|
|
@@ -112,8 +68,8 @@ export function resolvePhiBuilderSignalWiringRoutes(defaultArea) {
|
|
|
112
68
|
* so its rows come straight from the draft config rather than from a staged copy. Removing therefore
|
|
113
69
|
* writes to the same place Apply does, and the Table is reloaded afterwards.
|
|
114
70
|
*/
|
|
115
|
-
export function resolvePhiBuilderSignalWiringRoutesWithout(
|
|
116
|
-
const current = getPhiDeveloperSelectedSignalRoutes(
|
|
71
|
+
export function resolvePhiBuilderSignalWiringRoutesWithout(routeKey) {
|
|
72
|
+
const current = getPhiDeveloperSelectedSignalRoutes() ?? {};
|
|
117
73
|
const emits = (current.emits ?? []).filter((route) => route.routeKey !== routeKey);
|
|
118
74
|
const listens = (current.listens ?? []).filter((route) => route.routeKey !== routeKey);
|
|
119
75
|
if (emits.length === (current.emits ?? []).length && listens.length === (current.listens ?? []).length) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PhiSignalRouteSet } from "../../../../types/signals";
|
|
2
2
|
import type { PhiRuntimeModuleDefinition, PhiRuntimeModuleId } from "../../../../types/cms-plugins";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PhiDeveloperBuilderRegionDraft } from "../developer-workspace-types";
|
|
4
4
|
import type { PhiAreaRootRoute, PhiAreaMeta } from "../../../../helpers/cms-area-config";
|
|
5
5
|
import type { PhiWorkspaceCatalogState } from "../../../../components/workspace/catalog-state";
|
|
6
6
|
import { type PhiBuilderPageMetaPresentationLabels } from "../controller/definition";
|
|
@@ -8,7 +8,6 @@ import type { PhiCmsTreeControllerSettings } from "../../../../types/cms";
|
|
|
8
8
|
import { type PhiHistoryLabels } from "../../../../components/widgets/label-types/history";
|
|
9
9
|
export type { PhiBuilderPageRegionKey, PhiBuilderRegionKey, PhiBuilderShellRegionKey, } from "../region-keys";
|
|
10
10
|
export type PhiDeveloperBuilderWorkspaceControllerProps = {
|
|
11
|
-
defaultArea?: PhiDeveloperBuilderArea;
|
|
12
11
|
shellPresetDraftsByArea?: Record<string, Record<string, PhiDeveloperBuilderRegionDraft>>;
|
|
13
12
|
runtimeModuleDefinitions?: readonly PhiRuntimeModuleDefinition[];
|
|
14
13
|
runtimeModuleIdsByArea?: Record<string, PhiRuntimeModuleId[]>;
|
|
@@ -27,4 +26,4 @@ export type PhiDeveloperBuilderWorkspaceControllerProps = {
|
|
|
27
26
|
historyLabels: PhiHistoryLabels;
|
|
28
27
|
signalRoutes?: PhiSignalRouteSet | null;
|
|
29
28
|
};
|
|
30
|
-
export declare function PhiDeveloperBuilderWorkspaceController({
|
|
29
|
+
export declare function PhiDeveloperBuilderWorkspaceController({ shellPresetDraftsByArea, runtimeModuleDefinitions, runtimeModuleIdsByArea, modulePresetPagesByArea, areaPresetSourcesByArea, navigationSurfacesByArea, unresolvedModuleIdsByArea, serverUnavailableModules, publicRouteClaims, publicRoutePaths, areaRootRoutesByArea, areaMetaByArea, areaControllerSettingsByArea, pageMetaLabels, historyLabels, signalRoutes, }: PhiDeveloperBuilderWorkspaceControllerProps): import("react").JSX.Element;
|
|
@@ -22,7 +22,7 @@ import { isPhiBuilderAreaKey, resolvePhiBuilderAreaAsCmsArea, } from "../../../.
|
|
|
22
22
|
import { resolvePhiRuntimeAreaDefinition } from "../../../../plugins/runtime-modules/area-definitions";
|
|
23
23
|
import { resolvePhiBuilderNavigationWidgetNavKey } from "../navigation-widget-runtime";
|
|
24
24
|
import { parsePhiBuilderNavigationScopeKey } from "../../../../helpers/cms-navigation-catalog";
|
|
25
|
-
import {
|
|
25
|
+
import { patchPhiBuilderSignalWiringSession, resetPhiBuilderSignalWiringSession, openPhiBuilderPage, openPhiBuilderPageInOpenArea, openPhiBuilderPagesPanel, selectPhiBuilderPageNode, setPhiBuilderCommandWorkspace, setPhiBuilderDebugScaffold, setPhiBuilderInspectorOpen, setPhiBuilderMode, usePhiDeveloperBuilderWorkspaceState, completePhiDeveloperBuilderEffectsEditor, normalizePhiDeveloperBuilderArea as normalizeBuilderArea, previewPhiDeveloperBuilderEffects, selectPhiDeveloperBuilderNode, usePhiDeveloperRegionDraft, getPhiDeveloperBuilderStateSnapshot, getPhiDeveloperRegionDraftsSnapshot, readPhiBuilderEffectiveAreaRootRoute, setPhiDeveloperBuilderAreaRootRoutes, setPhiDeveloperBuilderAreaMetaBaseline, setPhiDeveloperBuilderAreaControllerSettings, readPhiBuilderEffectiveAreaMeta, closePhiBuilderModuleDeactivationRequest, closePhiBuilderPublicRouteCollisionRequest, } from "../developer-workspace-store";
|
|
26
26
|
import {} from "../options-providers";
|
|
27
27
|
import { PHI_AREA_META_PUBLIC_DEFAULTS } from "../../../../helpers/cms-area-config";
|
|
28
28
|
import { getPhiBuilderRegionDraftKey } from "../region-keys";
|
|
@@ -31,7 +31,7 @@ import { getDefaultRegionDraft } from "../developer-region-drafts";
|
|
|
31
31
|
import { isPhiAreaScopedBuilderPage, isPhiDebugScaffoldBuilderPage, readPhiDeveloperBuilderWorkspaceKey, resolvePhiDeveloperBuilderCommandWorkspace, resolvePhiDeveloperBuilderRouteScope, } from "../route-scope";
|
|
32
32
|
import { usePhiDeveloperBuilderPreviewModeController, } from "./preview-controller";
|
|
33
33
|
import { runPhiDeveloperBuilderInspectorAction } from "./inspector-controller";
|
|
34
|
-
import {
|
|
34
|
+
import { resolvePhiBuilderSignalWiringRoutes, resolvePhiBuilderSignalWiringRoutesWithout, } from "./signal-wiring-controller";
|
|
35
35
|
import { readPhiTableActionSignalValue } from "../../../../types/table-signal-values";
|
|
36
36
|
import { usePhiBuilderPageController } from "./page-controller";
|
|
37
37
|
import { PHI_BUILDER_AREA_LANDING_PAGE_EMPTY, PHI_BUILDER_AREA_ROOT_ROUTE_AUTOMATIC, PHI_BUILDER_AREA_ROOT_ROUTE_LANDING, } from "../area-settings-values";
|
|
@@ -41,9 +41,9 @@ import { usePhiBuilderDraftCommandController, } from "./draft-command-controller
|
|
|
41
41
|
import { usePhiBuilderDraftStatusController } from "./draft-status-controller";
|
|
42
42
|
import { applyPhiDeveloperBuilderSiderLeftMode, } from "./region-controller";
|
|
43
43
|
import { createPhiBuilderHistoryContext, phiBuilderHistory, } from "../history";
|
|
44
|
-
import { applyPhiBuilderRuntimeModuleSelectionChange, applyPhiBuilderRuntimeModuleSelectionChanges,
|
|
44
|
+
import { applyPhiBuilderRuntimeModuleSelectionChange, applyPhiBuilderRuntimeModuleSelectionChanges, } from "../runtime-module-selection";
|
|
45
45
|
import { applyPhiBuilderPublicRouteAssignments, findPhiBuilderPublicRouteAnswerProblem, } from "../public-route-collisions";
|
|
46
|
-
import {
|
|
46
|
+
import { applyPhiWorkspaceCatalogPreload, setPhiWorkspaceActiveCatalogs, storePhiWorkspacePersistedPages, } from "../workspace-catalog-actions";
|
|
47
47
|
import { PHI_BUILDER_PAGE_META_DEFAULT_PRESENTATION_LABELS, resolvePhiBuilderEffectsCapabilityId, } from "../controller/definition";
|
|
48
48
|
import { formatPhiHistoryTooltip, } from "../../../../components/widgets/label-types/history";
|
|
49
49
|
const EMPTY_RUNTIME_MODULE_IDS_BY_AREA = {};
|
|
@@ -122,7 +122,7 @@ function filterBuilderModuleCatalogs(modulePresetPagesByArea, navigationSurfaces
|
|
|
122
122
|
navigationSurfacesByArea: filteredNavigation,
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
-
function usePhiDeveloperBuilderWorkspaceController(
|
|
125
|
+
function usePhiDeveloperBuilderWorkspaceController(options) {
|
|
126
126
|
const { showMessage } = usePhiApplicationFeedback();
|
|
127
127
|
const dispatchSignal = usePhiSignalDispatcher();
|
|
128
128
|
const effectsWorkflowCorrelationRef = useRef(null);
|
|
@@ -139,7 +139,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
139
139
|
*/
|
|
140
140
|
const emitRoutes = useMemo(() => signalRoutes?.emits ?? [], [signalRoutes?.emits]);
|
|
141
141
|
const emitCapability = useCallback((capabilityId, value, correlationId) => dispatchPhiSignalCapability(dispatchSignal, createPhiBuilderControllerAddress(), emitRoutes, capabilityId, value, correlationId), [dispatchSignal, emitRoutes]);
|
|
142
|
-
const state = usePhiDeveloperBuilderWorkspaceState(
|
|
142
|
+
const state = usePhiDeveloperBuilderWorkspaceState();
|
|
143
143
|
const router = useRouter();
|
|
144
144
|
const pathname = usePhiPathname();
|
|
145
145
|
const searchParams = useSearchParams();
|
|
@@ -164,7 +164,6 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
164
164
|
const effectiveNavKey = resolvePhiBuilderNavigationWidgetNavKey(null, searchParams.get(PHI_BUILDER_NAVIGATION_KEY_SEARCH_PARAM), effectiveArea);
|
|
165
165
|
const { emitPageTitleInputValue, navigateToBuilderPage, openPageMetaDialog, pageMetaDialog, } = usePhiBuilderPageController({
|
|
166
166
|
emitCapability,
|
|
167
|
-
defaultArea,
|
|
168
167
|
effectiveArea,
|
|
169
168
|
effectivePageKey,
|
|
170
169
|
pageMetaLabels,
|
|
@@ -178,7 +177,6 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
178
177
|
state,
|
|
179
178
|
});
|
|
180
179
|
const { confirmResetPage, runBuilderCommand, confirmDialog } = usePhiBuilderDraftCommandController({
|
|
181
|
-
defaultArea,
|
|
182
180
|
effectiveArea,
|
|
183
181
|
effectiveNavKey,
|
|
184
182
|
effectivePageKey,
|
|
@@ -243,13 +241,13 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
243
241
|
}
|
|
244
242
|
openedSignalWiringCorrelationRef.current = request.correlationId;
|
|
245
243
|
// A wiring session belongs to the block it was opened on, so it starts empty every time.
|
|
246
|
-
resetPhiBuilderSignalWiringSession(
|
|
244
|
+
resetPhiBuilderSignalWiringSession();
|
|
247
245
|
emitCapability("signalWiringReset", null, request.correlationId);
|
|
248
246
|
// The Table is mounted eagerly with the overlay, so its rows may still belong to the block wired
|
|
249
247
|
// last time; opening on a new one has to ask for them again.
|
|
250
248
|
emitCapability("signalWiringRoutesReload", null, request.correlationId);
|
|
251
249
|
queueMicrotask(() => emitCapability("signalWiringOpen", null, request.correlationId));
|
|
252
|
-
}, [
|
|
250
|
+
}, [emitCapability, state.signalWiringRequest]);
|
|
253
251
|
useEffect(() => {
|
|
254
252
|
const request = state.effectsEditorRequest;
|
|
255
253
|
if (!request || initializedEffectsCorrelationRef.current === request.correlationId)
|
|
@@ -431,61 +429,32 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
431
429
|
* it lives in the Foundation so that revisions, and later the Editor, can read it without going
|
|
432
430
|
* through here.
|
|
433
431
|
*/
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
...(current.runtimeModuleIdsByArea ?? {}),
|
|
455
|
-
};
|
|
456
|
-
for (const [area, moduleIds] of Object.entries(runtimeModuleIdsByArea)) {
|
|
457
|
-
const builderArea = normalizeBuilderArea(area);
|
|
458
|
-
if (!areRuntimeModuleIdsEqual(nextModuleIdsByArea[builderArea], moduleIds)) {
|
|
459
|
-
nextModuleIdsByArea[builderArea] = moduleIds;
|
|
460
|
-
changed = true;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
if (initialPageChanged) {
|
|
464
|
-
// The selected node follows the page, and that selection is Builder tool state.
|
|
465
|
-
builderWorkspaceStore.patch(defaultArea, (tool) => ({
|
|
466
|
-
...tool,
|
|
467
|
-
nodeKey: `page:${initialPageKey}`,
|
|
468
|
-
}));
|
|
469
|
-
}
|
|
470
|
-
return changed || definitionsChanged || modulePresetPagesChanged || areaPresetSourcesChanged || navigationSurfacesChanged || unresolvedModuleIdsChanged || serverUnavailableModulesChanged || publicRouteClaimsChanged || publicRoutePathsChanged || catalogHydrationChanged || initialPageChanged
|
|
471
|
-
? {
|
|
472
|
-
...current,
|
|
473
|
-
...(initialPageChanged ? { pageKey: initialPageKey } : {}),
|
|
474
|
-
runtimeModuleDefinitions: [...runtimeModuleDefinitions],
|
|
475
|
-
runtimeModuleIdsByArea: nextModuleIdsByArea,
|
|
476
|
-
catalogHydrated: true,
|
|
477
|
-
modulePresetPagesByArea: activePreloadCatalogs.modulePresetPagesByArea,
|
|
478
|
-
areaPresetSourcesByArea,
|
|
479
|
-
navigationSurfacesByArea: activePreloadCatalogs.navigationSurfacesByArea,
|
|
480
|
-
unresolvedModuleIdsByArea,
|
|
481
|
-
serverUnavailableModules,
|
|
482
|
-
publicRouteClaims,
|
|
483
|
-
...(publicRoutePathsChanged ? { publicRoutePaths } : {}),
|
|
484
|
-
}
|
|
485
|
-
: current;
|
|
432
|
+
const openedPageKey = applyPhiWorkspaceCatalogPreload({
|
|
433
|
+
runtimeModuleDefinitions,
|
|
434
|
+
runtimeModuleIdsByArea,
|
|
435
|
+
areaPresetSourcesByArea,
|
|
436
|
+
unresolvedModuleIdsByArea,
|
|
437
|
+
serverUnavailableModules,
|
|
438
|
+
publicRouteClaims,
|
|
439
|
+
publicRoutePaths,
|
|
440
|
+
activeCatalogs: activePreloadCatalogs,
|
|
441
|
+
keys: {
|
|
442
|
+
runtimeModuleDefinitions: runtimeModuleDefinitionsPreloadKey,
|
|
443
|
+
modulePresetPagesByArea: modulePresetPagesPreloadKey,
|
|
444
|
+
areaPresetSourcesByArea: areaPresetSourcesPreloadKey,
|
|
445
|
+
navigationSurfacesByArea: navigationSurfacesPreloadKey,
|
|
446
|
+
unresolvedModuleIdsByArea: unresolvedModuleIdsPreloadKey,
|
|
447
|
+
publicRouteClaims: publicRouteClaimsPreloadKey,
|
|
448
|
+
serverUnavailableModules: serverUnavailableModulesPreloadKey,
|
|
449
|
+
publicRoutePaths: publicRoutePathsPreloadKey,
|
|
450
|
+
},
|
|
451
|
+
normalizeArea: normalizeBuilderArea,
|
|
486
452
|
});
|
|
453
|
+
if (openedPageKey != null) {
|
|
454
|
+
// The selected node follows the page, and that selection is Builder tool state.
|
|
455
|
+
selectPhiBuilderPageNode(openedPageKey);
|
|
456
|
+
}
|
|
487
457
|
}, [
|
|
488
|
-
defaultArea,
|
|
489
458
|
runtimeModuleDefinitions,
|
|
490
459
|
runtimeModuleDefinitionsPreloadKey,
|
|
491
460
|
runtimeModuleIdsByArea,
|
|
@@ -517,17 +486,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
517
486
|
.then((pages) => {
|
|
518
487
|
if (cancelled)
|
|
519
488
|
return;
|
|
520
|
-
|
|
521
|
-
...current,
|
|
522
|
-
persistedPageCatalogByArea: {
|
|
523
|
-
...current.persistedPageCatalogByArea,
|
|
524
|
-
[effectiveArea]: pages,
|
|
525
|
-
},
|
|
526
|
-
pageCatalogHydratedByArea: {
|
|
527
|
-
...current.pageCatalogHydratedByArea,
|
|
528
|
-
[effectiveArea]: true,
|
|
529
|
-
},
|
|
530
|
-
}));
|
|
489
|
+
storePhiWorkspacePersistedPages(effectiveArea, pages);
|
|
531
490
|
})
|
|
532
491
|
.catch((error) => {
|
|
533
492
|
if (!cancelled) {
|
|
@@ -541,7 +500,6 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
541
500
|
cancelled = true;
|
|
542
501
|
};
|
|
543
502
|
}, [
|
|
544
|
-
defaultArea,
|
|
545
503
|
effectiveArea,
|
|
546
504
|
isBuilderWorkspace,
|
|
547
505
|
showMessage,
|
|
@@ -551,23 +509,13 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
551
509
|
const currentRuntimeModuleIdsKey = JSON.stringify(currentRuntimeModuleIdsByArea);
|
|
552
510
|
useEffect(() => {
|
|
553
511
|
const activeCatalogs = filterBuilderModuleCatalogs(modulePresetPagesByArea, navigationSurfacesByArea, currentRuntimeModuleIdsByArea, runtimeModuleDefinitions);
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
JSON.stringify(current.navigationSurfacesByArea) ===
|
|
558
|
-
JSON.stringify(activeCatalogs.navigationSurfacesByArea)) {
|
|
559
|
-
return current;
|
|
560
|
-
}
|
|
561
|
-
return {
|
|
562
|
-
...current,
|
|
563
|
-
modulePresetPagesByArea: activeCatalogs.modulePresetPagesByArea,
|
|
564
|
-
navigationSurfacesByArea: activeCatalogs.navigationSurfacesByArea,
|
|
565
|
-
};
|
|
512
|
+
setPhiWorkspaceActiveCatalogs({
|
|
513
|
+
modulePresetPagesByArea: activeCatalogs.modulePresetPagesByArea,
|
|
514
|
+
navigationSurfacesByArea: activeCatalogs.navigationSurfacesByArea,
|
|
566
515
|
});
|
|
567
516
|
}, [
|
|
568
517
|
currentRuntimeModuleIdsByArea,
|
|
569
518
|
currentRuntimeModuleIdsKey,
|
|
570
|
-
defaultArea,
|
|
571
519
|
modulePresetPagesByArea,
|
|
572
520
|
navigationSurfacesByArea,
|
|
573
521
|
runtimeModuleDefinitions,
|
|
@@ -594,10 +542,15 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
594
542
|
if (builderWorkspaceKey !== "shells") {
|
|
595
543
|
return;
|
|
596
544
|
}
|
|
545
|
+
/*
|
|
546
|
+
* The switch's own change is not told back to it -- once. The note is consumed whatever this run
|
|
547
|
+
* finds: kept until it matched, it outlived a change of Area, and on the way back it matched again
|
|
548
|
+
* and swallowed the very report that would have set the switch to this Area's draft.
|
|
549
|
+
*/
|
|
597
550
|
const handledSiderLayout = handledSiderLayoutRef.current;
|
|
551
|
+
handledSiderLayoutRef.current = null;
|
|
598
552
|
if (handledSiderLayout?.draftKey === siderLeftDraftKey &&
|
|
599
553
|
handledSiderLayout.fullHeight === siderLeftFullHeight) {
|
|
600
|
-
handledSiderLayoutRef.current = null;
|
|
601
554
|
return;
|
|
602
555
|
}
|
|
603
556
|
dispatchSignal({
|
|
@@ -621,11 +574,8 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
621
574
|
if (state.commandWorkspace === commandWorkspace) {
|
|
622
575
|
return;
|
|
623
576
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
commandWorkspace,
|
|
627
|
-
}));
|
|
628
|
-
}, [commandWorkspace, defaultArea, state.commandWorkspace]);
|
|
577
|
+
setPhiBuilderCommandWorkspace(commandWorkspace);
|
|
578
|
+
}, [commandWorkspace, state.commandWorkspace]);
|
|
629
579
|
useEffect(() => {
|
|
630
580
|
if (commandWorkspace !== "structure" &&
|
|
631
581
|
commandWorkspace !== "pages" &&
|
|
@@ -668,11 +618,8 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
668
618
|
if (state.builderMode === nextBuilderMode) {
|
|
669
619
|
return;
|
|
670
620
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
builderMode: nextBuilderMode,
|
|
674
|
-
}));
|
|
675
|
-
}, [defaultArea, hasPreviewSnapshot, isBuilderWorkspace, isNavigationWorkspace, state.builderMode]);
|
|
621
|
+
setPhiBuilderMode(nextBuilderMode);
|
|
622
|
+
}, [hasPreviewSnapshot, isBuilderWorkspace, isNavigationWorkspace, state.builderMode]);
|
|
676
623
|
/*
|
|
677
624
|
* The workspace, narrowed to what deciding the offered Pages actually reads.
|
|
678
625
|
*
|
|
@@ -749,14 +696,8 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
749
696
|
if (nextArea === state.area && nextPageKey === state.pageKey) {
|
|
750
697
|
return;
|
|
751
698
|
}
|
|
752
|
-
|
|
753
|
-
...current,
|
|
754
|
-
area: nextArea,
|
|
755
|
-
pageKey: nextPageKey,
|
|
756
|
-
}));
|
|
757
|
-
builderWorkspaceStore.patch(defaultArea, (current) => resetPhiBuilderSelectionToPage(current, nextPageKey));
|
|
699
|
+
openPhiBuilderPage(nextArea, nextPageKey);
|
|
758
700
|
}, [
|
|
759
|
-
defaultArea,
|
|
760
701
|
isBuilderWorkspace,
|
|
761
702
|
offeredCatalogState,
|
|
762
703
|
pathname,
|
|
@@ -796,7 +737,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
796
737
|
const finishEffectsEditor = (correlationId, effects) => {
|
|
797
738
|
if (!effectsRequest || effectsRequest.correlationId !== correlationId)
|
|
798
739
|
return;
|
|
799
|
-
completePhiDeveloperBuilderEffectsEditor(
|
|
740
|
+
completePhiDeveloperBuilderEffectsEditor(effectsRequest, effects);
|
|
800
741
|
initializedEffectsCorrelationRef.current = null;
|
|
801
742
|
};
|
|
802
743
|
/*
|
|
@@ -815,7 +756,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
815
756
|
const live = readPhiRuntimeFormValuesSignalValue(signal.value);
|
|
816
757
|
if (!live)
|
|
817
758
|
return;
|
|
818
|
-
previewPhiDeveloperBuilderEffects(
|
|
759
|
+
previewPhiDeveloperBuilderEffects(effectsRequest.correlationId, {
|
|
819
760
|
...effectsRequest.effects,
|
|
820
761
|
opacity: readPhiBuilderEffectsOpacity(live.values),
|
|
821
762
|
});
|
|
@@ -841,12 +782,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
841
782
|
router.replace(`${pathname}?${nextSearchParams.toString()}`, { scroll: false });
|
|
842
783
|
}
|
|
843
784
|
else {
|
|
844
|
-
|
|
845
|
-
...current,
|
|
846
|
-
area: nextArea,
|
|
847
|
-
pageKey: nextPageKey,
|
|
848
|
-
}));
|
|
849
|
-
builderWorkspaceStore.patch(defaultArea, (current) => resetPhiBuilderSelectionToPage(current, nextPageKey));
|
|
785
|
+
openPhiBuilderPage(nextArea, nextPageKey);
|
|
850
786
|
}
|
|
851
787
|
return;
|
|
852
788
|
}
|
|
@@ -864,10 +800,10 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
864
800
|
area,
|
|
865
801
|
selectedIds: (state.runtimeModuleIdsByArea?.[area] ?? [])
|
|
866
802
|
.filter((moduleId) => moduleId !== request.moduleId),
|
|
867
|
-
}))
|
|
803
|
+
})));
|
|
868
804
|
emitCapability("modulesTableReload", null, signal.correlationId);
|
|
869
805
|
}
|
|
870
|
-
closePhiBuilderModuleDeactivationRequest(
|
|
806
|
+
closePhiBuilderModuleDeactivationRequest();
|
|
871
807
|
return;
|
|
872
808
|
}
|
|
873
809
|
/*
|
|
@@ -881,7 +817,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
881
817
|
signal.action === "change" &&
|
|
882
818
|
signal.value === false) {
|
|
883
819
|
if (state.publicRouteCollisionRequest) {
|
|
884
|
-
closePhiBuilderPublicRouteCollisionRequest(
|
|
820
|
+
closePhiBuilderPublicRouteCollisionRequest();
|
|
885
821
|
}
|
|
886
822
|
return;
|
|
887
823
|
}
|
|
@@ -902,7 +838,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
902
838
|
return;
|
|
903
839
|
}
|
|
904
840
|
if (signal.value === "cancel") {
|
|
905
|
-
closePhiBuilderPublicRouteCollisionRequest(
|
|
841
|
+
closePhiBuilderPublicRouteCollisionRequest();
|
|
906
842
|
return;
|
|
907
843
|
}
|
|
908
844
|
if (signal.value !== "assign") {
|
|
@@ -913,12 +849,12 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
913
849
|
showMessage({ level: "error", content: rejection }, { correlationId: signal.correlationId });
|
|
914
850
|
return;
|
|
915
851
|
}
|
|
916
|
-
applyPhiBuilderPublicRouteAssignments(
|
|
852
|
+
applyPhiBuilderPublicRouteAssignments(request);
|
|
917
853
|
applyPhiBuilderRuntimeModuleSelectionChanges(request.areas.map((area) => ({
|
|
918
854
|
area,
|
|
919
855
|
selectedIds: [...(state.runtimeModuleIdsByArea?.[area] ?? []), request.moduleId],
|
|
920
|
-
}))
|
|
921
|
-
closePhiBuilderPublicRouteCollisionRequest(
|
|
856
|
+
})));
|
|
857
|
+
closePhiBuilderPublicRouteCollisionRequest();
|
|
922
858
|
emitCapability("modulesTableReload", null, signal.correlationId);
|
|
923
859
|
return;
|
|
924
860
|
}
|
|
@@ -931,7 +867,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
931
867
|
const binding = readPhiTableBindingParamsSignalValue(signal.value);
|
|
932
868
|
const navKey = typeof binding?.params.navKey === "string" ? binding.params.navKey : null;
|
|
933
869
|
const parsed = parsePhiBuilderNavigationScopeKey(navKey);
|
|
934
|
-
const current = getPhiDeveloperBuilderStateSnapshot(
|
|
870
|
+
const current = getPhiDeveloperBuilderStateSnapshot();
|
|
935
871
|
const cmsArea = resolvePhiBuilderAreaAsCmsArea(current.area);
|
|
936
872
|
const normalizedNavKey = parsed ? `${parsed.area}:${parsed.key}` : null;
|
|
937
873
|
if (!parsed || parsed.area !== cmsArea ||
|
|
@@ -981,11 +917,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
981
917
|
return;
|
|
982
918
|
}
|
|
983
919
|
emitPageTitleInputValue(nextPageKey);
|
|
984
|
-
|
|
985
|
-
...current,
|
|
986
|
-
pageKey: nextPageKey,
|
|
987
|
-
}));
|
|
988
|
-
builderWorkspaceStore.patch(defaultArea, (current) => resetPhiBuilderSelectionToPage(current, nextPageKey, { closePages: true }));
|
|
920
|
+
openPhiBuilderPageInOpenArea(nextPageKey, { closePages: true });
|
|
989
921
|
return;
|
|
990
922
|
}
|
|
991
923
|
const builderControllerReceiver = createPhiBuilderControllerAddress();
|
|
@@ -1020,7 +952,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1020
952
|
return;
|
|
1021
953
|
}
|
|
1022
954
|
try {
|
|
1023
|
-
applyPhiBuilderRuntimeModuleSelectionChange(effectiveArea, selectedIds
|
|
955
|
+
applyPhiBuilderRuntimeModuleSelectionChange(effectiveArea, selectedIds);
|
|
1024
956
|
}
|
|
1025
957
|
catch (error) {
|
|
1026
958
|
showMessage({ level: "error", content: error instanceof Error ? error.message : "Invalid runtime module selection." }, { correlationId: signal.correlationId });
|
|
@@ -1060,10 +992,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1060
992
|
if (nextDebugScaffold == null) {
|
|
1061
993
|
return;
|
|
1062
994
|
}
|
|
1063
|
-
|
|
1064
|
-
...current,
|
|
1065
|
-
debugScaffold: nextDebugScaffold,
|
|
1066
|
-
}));
|
|
995
|
+
setPhiBuilderDebugScaffold(nextDebugScaffold);
|
|
1067
996
|
return;
|
|
1068
997
|
}
|
|
1069
998
|
if (addressedHere && signal.channel === "selection" && signal.action === "change") {
|
|
@@ -1074,24 +1003,31 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1074
1003
|
}
|
|
1075
1004
|
let nextNodeKey = next.nodeKey;
|
|
1076
1005
|
let nextNodeId = readPhiCmsInstanceId(next.nodeId);
|
|
1077
|
-
|
|
1006
|
+
/*
|
|
1007
|
+
* A selection names the Area and Page its node is on, or the open ones. A node on another Area or
|
|
1008
|
+
* Page is not on the canvas and cannot be selected; opening that Page is the URL's business, not a
|
|
1009
|
+
* selection's. The selection used to write both into the tool store, where the catalog's values
|
|
1010
|
+
* always won, so the node was selected on a Page that was not open.
|
|
1011
|
+
*/
|
|
1012
|
+
const openState = getPhiDeveloperBuilderStateSnapshot();
|
|
1013
|
+
if ((typeof next.area === "string" && next.area !== openState.area) ||
|
|
1014
|
+
(typeof next.pageKey === "string" && next.pageKey !== openState.pageKey)) {
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1078
1017
|
/*
|
|
1079
1018
|
* A Layout named only by its Region is that Region's root Layout, read from its draft. A sender that
|
|
1080
1019
|
* cannot know a Site's node ids -- a Tour step showing the Layout Inspector -- names it this way. A
|
|
1081
1020
|
* Region without a root Layout selects nothing.
|
|
1082
1021
|
*/
|
|
1083
1022
|
if (next.nodeKind === "layout" && nextNodeId == null && typeof next.regionKey === "string") {
|
|
1084
|
-
const
|
|
1085
|
-
const rootNode = getPhiDeveloperRegionDraftsSnapshot()[getPhiBuilderRegionDraftKey(typeof next.area === "string" ? next.area : current.area, next.regionKey, nextPageKey ?? current.pageKey)]?.rootNode;
|
|
1023
|
+
const rootNode = getPhiDeveloperRegionDraftsSnapshot()[getPhiBuilderRegionDraftKey(openState.area, next.regionKey, openState.pageKey)]?.rootNode;
|
|
1086
1024
|
if (!rootNode) {
|
|
1087
1025
|
return;
|
|
1088
1026
|
}
|
|
1089
1027
|
nextNodeId = rootNode.id;
|
|
1090
1028
|
nextNodeKey = rootNode.widgetType;
|
|
1091
1029
|
}
|
|
1092
|
-
selectPhiDeveloperBuilderNode(
|
|
1093
|
-
...(typeof next.area === "string" ? { area: next.area } : {}),
|
|
1094
|
-
...(nextPageKey ? { pageKey: nextPageKey } : {}),
|
|
1030
|
+
selectPhiDeveloperBuilderNode({
|
|
1095
1031
|
nodeKey: nextNodeKey,
|
|
1096
1032
|
nodeId: nextNodeId,
|
|
1097
1033
|
nodeKind: next.nodeKind,
|
|
@@ -1253,7 +1189,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1253
1189
|
return;
|
|
1254
1190
|
}
|
|
1255
1191
|
if (addressedHere && signal.channel === "command" && signal.action === "activate" && signal.value === "pagesOpen") {
|
|
1256
|
-
|
|
1192
|
+
openPhiBuilderPagesPanel();
|
|
1257
1193
|
return;
|
|
1258
1194
|
}
|
|
1259
1195
|
if (signal.receiver === createPhiBuilderControllerAddress() && signal.channel === "effects") {
|
|
@@ -1297,7 +1233,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1297
1233
|
signal.valueSchema === PHI_SIGNAL_VALUE_SCHEMAS.formValues) {
|
|
1298
1234
|
const submitted = readPhiRuntimeFormValuesSignalValue(signal.value);
|
|
1299
1235
|
if (submitted)
|
|
1300
|
-
patchPhiBuilderSignalWiringSession(
|
|
1236
|
+
patchPhiBuilderSignalWiringSession(submitted.values);
|
|
1301
1237
|
return;
|
|
1302
1238
|
}
|
|
1303
1239
|
if (signal.receiver === createPhiBuilderControllerAddress() &&
|
|
@@ -1308,11 +1244,11 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1308
1244
|
if (tableAction?.actionKey !== "delete" || typeof tableAction.rowIdentity !== "string") {
|
|
1309
1245
|
return;
|
|
1310
1246
|
}
|
|
1311
|
-
const routes = resolvePhiBuilderSignalWiringRoutesWithout(
|
|
1247
|
+
const routes = resolvePhiBuilderSignalWiringRoutesWithout(tableAction.rowIdentity);
|
|
1312
1248
|
if (!routes)
|
|
1313
1249
|
return;
|
|
1314
|
-
const routeState = getPhiDeveloperBuilderStateSnapshot(
|
|
1315
|
-
runPhiDeveloperBuilderInspectorAction(
|
|
1250
|
+
const routeState = getPhiDeveloperBuilderStateSnapshot();
|
|
1251
|
+
runPhiDeveloperBuilderInspectorAction(routeState.nodeKind === "layout"
|
|
1316
1252
|
? { kind: "patchSelectedLayoutConfig", patch: { signalRoutes: routes } }
|
|
1317
1253
|
: { kind: "patchSelectedWidgetConfig", patch: { signalRoutes: routes } });
|
|
1318
1254
|
emitCapability("signalWiringRoutesReload", null, signal.correlationId);
|
|
@@ -1338,7 +1274,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1338
1274
|
if (!isCloseRequest) {
|
|
1339
1275
|
return;
|
|
1340
1276
|
}
|
|
1341
|
-
resetPhiBuilderSignalWiringSession(
|
|
1277
|
+
resetPhiBuilderSignalWiringSession();
|
|
1342
1278
|
emitCapability("signalWiringReset", null, signal.correlationId);
|
|
1343
1279
|
emitCapability("signalWiringClose", null, signal.correlationId);
|
|
1344
1280
|
return;
|
|
@@ -1350,15 +1286,15 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1350
1286
|
const submitted = readPhiRuntimeFormValuesSignalValue(signal.value);
|
|
1351
1287
|
if (!submitted)
|
|
1352
1288
|
return;
|
|
1353
|
-
patchPhiBuilderSignalWiringSession(
|
|
1354
|
-
const result = resolvePhiBuilderSignalWiringRoutes(
|
|
1289
|
+
patchPhiBuilderSignalWiringSession(submitted.values);
|
|
1290
|
+
const result = resolvePhiBuilderSignalWiringRoutes();
|
|
1355
1291
|
if (result.kind !== "applied")
|
|
1356
1292
|
return;
|
|
1357
|
-
const wiringState = getPhiDeveloperBuilderStateSnapshot(
|
|
1358
|
-
runPhiDeveloperBuilderInspectorAction(
|
|
1293
|
+
const wiringState = getPhiDeveloperBuilderStateSnapshot();
|
|
1294
|
+
runPhiDeveloperBuilderInspectorAction(wiringState.nodeKind === "layout"
|
|
1359
1295
|
? { kind: "patchSelectedLayoutConfig", patch: { signalRoutes: result.routes } }
|
|
1360
1296
|
: { kind: "patchSelectedWidgetConfig", patch: { signalRoutes: result.routes } });
|
|
1361
|
-
resetPhiBuilderSignalWiringSession(
|
|
1297
|
+
resetPhiBuilderSignalWiringSession();
|
|
1362
1298
|
emitCapability("signalWiringClose", null, signal.correlationId);
|
|
1363
1299
|
return;
|
|
1364
1300
|
}
|
|
@@ -1425,7 +1361,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1425
1361
|
*/
|
|
1426
1362
|
phiBuilderHistory.endGesture();
|
|
1427
1363
|
}
|
|
1428
|
-
|
|
1364
|
+
setPhiBuilderInspectorOpen(signal.value);
|
|
1429
1365
|
return;
|
|
1430
1366
|
}
|
|
1431
1367
|
if (signal.channel === "inspector" && signal.action === "change") {
|
|
@@ -1436,7 +1372,7 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1436
1372
|
}
|
|
1437
1373
|
const action = readPhiBuilderInspectorAction(signal.value);
|
|
1438
1374
|
if (action) {
|
|
1439
|
-
runPhiDeveloperBuilderInspectorAction(
|
|
1375
|
+
runPhiDeveloperBuilderInspectorAction(action);
|
|
1440
1376
|
}
|
|
1441
1377
|
return;
|
|
1442
1378
|
}
|
|
@@ -1484,8 +1420,8 @@ function usePhiDeveloperBuilderWorkspaceController(defaultArea, options) {
|
|
|
1484
1420
|
*/
|
|
1485
1421
|
return _jsxs(_Fragment, { children: [pageMetaDialog, confirmDialog] });
|
|
1486
1422
|
}
|
|
1487
|
-
export function PhiDeveloperBuilderWorkspaceController({
|
|
1488
|
-
const controller = usePhiDeveloperBuilderWorkspaceController(
|
|
1423
|
+
export function PhiDeveloperBuilderWorkspaceController({ shellPresetDraftsByArea = {}, runtimeModuleDefinitions = [], runtimeModuleIdsByArea = {}, modulePresetPagesByArea = EMPTY_MODULE_PRESET_PAGES_BY_AREA, areaPresetSourcesByArea = {}, 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, }) {
|
|
1424
|
+
const controller = usePhiDeveloperBuilderWorkspaceController({
|
|
1489
1425
|
shellPresetDraftsByArea,
|
|
1490
1426
|
runtimeModuleDefinitions,
|
|
1491
1427
|
runtimeModuleIdsByArea,
|