@phis/ui 0.7.7 → 0.7.8
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-form-control.js +12 -1
- package/components/forms/extended-form-field-controls.d.ts +1 -1
- package/components/forms/extended-form-field-controls.js +23 -7
- package/components/forms/form-provider-contract.d.ts +5 -0
- package/components/forms/form-provider-contract.js +9 -2
- package/components/forms/form-provider-registry.d.ts +6 -0
- 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/regions/presets/navigation-redirect.d.ts +4 -1
- package/components/regions/presets/navigation-redirect.js +6 -3
- package/components/widgets/client/shared/phi-rendered-value.js +5 -3
- package/helpers/money-amount.d.ts +7 -0
- package/helpers/money-amount.js +15 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/app/presets.js +3 -6
- 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/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 +44 -17
- 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/offered-page-catalog.d.ts +6 -0
- package/plugins/runtime-modules/builder/offered-page-catalog.js +35 -6
- package/plugins/runtime-modules/builder/persistence.d.ts +4 -1
- package/plugins/runtime-modules/builder/persistence.js +10 -3
- package/plugins/runtime-modules/core/definition.d.ts +5 -0
- package/plugins/runtime-modules/core/form-providers.d.ts +5 -0
- package/plugins/runtime-modules/core/widgets/spacer/client.js +3 -3
- 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/revisions/controller/client.js +48 -46
- package/plugins/runtime-modules/revisions/services/table.js +3 -1
- package/styles/builder-scaffold.css +7 -1
- package/styles/layout-authoring-scaffold.css +27 -0
|
@@ -11,7 +11,7 @@ import { usePhiApplicationFeedback } from "../../../../components/runtime/use-ph
|
|
|
11
11
|
import { getPhiWorkspaceCatalogSnapshot, usePhiWorkspaceCatalogValue, } from "../../../../components/workspace/catalog-store";
|
|
12
12
|
import { PHI_BUILDER_NAVIGATION_KEY_SEARCH_PARAM, PHI_BUILDER_PAGE_SEARCH_PARAM, PHI_BUILDER_REVISIONS_KIND_SEARCH_PARAM, PHI_BUILDER_REVISIONS_SCOPE_SEARCH_PARAM, PHI_BUILDER_THEME_KEY_SEARCH_PARAM, normalizePhiBuilderAreaSearchParam, normalizePhiBuilderPageSearchParam, normalizePhiBuilderRevisionsKindSearchParam, } from "../../../../helpers/cms-scope-search-params";
|
|
13
13
|
import { resolvePhiBuilderRevisionPagePath, } from "../types";
|
|
14
|
-
import { resolvePhiBuilderActivePageCatalog, resolvePhiBuilderActivePageKey, resolvePhiBuilderPageKeyFromCatalogPath, } from "../../../../helpers/cms-page-catalog";
|
|
14
|
+
import { findPhiBuilderPageKeyFromStoragePath, resolvePhiBuilderActivePageCatalog, resolvePhiBuilderActivePageKey, resolvePhiBuilderPageKeyFromCatalogPath, } from "../../../../helpers/cms-page-catalog";
|
|
15
15
|
import { PHI_REVISIONS_RUNTIME_CONTROLLER_DEFINITION, } from "../controller/definition";
|
|
16
16
|
import { resolvePhiBuilderRevisionNavScopeKey } from "../../../../helpers/cms-navigation-scope-key";
|
|
17
17
|
import { deleteCmsDraft } from "../../../../helpers/cms-draft-delete";
|
|
@@ -28,6 +28,20 @@ function PhiRevisionsControllerMount({ address, config, }) {
|
|
|
28
28
|
*/
|
|
29
29
|
const emitRoutes = useMemo(() => config.signalRoutes?.emits ?? [], [config.signalRoutes?.emits]);
|
|
30
30
|
const emitCapability = useCallback((capabilityId, value, correlationId) => dispatchPhiSignalCapability(dispatchSignal, address, emitRoutes, capabilityId, value, correlationId), [address, dispatchSignal, emitRoutes]);
|
|
31
|
+
const reportDraftStatus = useCallback((value, correlationId) => {
|
|
32
|
+
dispatchSignal({
|
|
33
|
+
scope: "area",
|
|
34
|
+
channel: "draftStatus",
|
|
35
|
+
action: "change",
|
|
36
|
+
value,
|
|
37
|
+
valueType: "json",
|
|
38
|
+
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.revisionsDraftStatus,
|
|
39
|
+
sender: address,
|
|
40
|
+
receiver: "broadcast",
|
|
41
|
+
correlationId,
|
|
42
|
+
timestamp: Date.now(),
|
|
43
|
+
});
|
|
44
|
+
}, [address, dispatchSignal]);
|
|
31
45
|
const { showMessage } = usePhiApplicationFeedback();
|
|
32
46
|
const pathname = usePhiPathname();
|
|
33
47
|
const router = useRouter();
|
|
@@ -86,6 +100,7 @@ function PhiRevisionsControllerMount({ address, config, }) {
|
|
|
86
100
|
ownerModuleId: source?.ownerModuleId,
|
|
87
101
|
presetKey: source?.presetKey,
|
|
88
102
|
});
|
|
103
|
+
reportDraftStatus({ status: "published", revisionId: null, area }, correlationId);
|
|
89
104
|
emitCapability("deleteAreaClose", null, correlationId);
|
|
90
105
|
emitCapability("historyReload", null, correlationId);
|
|
91
106
|
showMessage({ level: "success", content: `Cleared the ${area} structure back to its preset. Its Modules are kept.` });
|
|
@@ -97,7 +112,7 @@ function PhiRevisionsControllerMount({ address, config, }) {
|
|
|
97
112
|
content: error instanceof Error ? error.message : "Clearing the Area failed.",
|
|
98
113
|
});
|
|
99
114
|
}
|
|
100
|
-
}, [emitCapability, router, showMessage]);
|
|
115
|
+
}, [emitCapability, reportDraftStatus, router, showMessage]);
|
|
101
116
|
usePhiSignalListener(useCallback((signal) => {
|
|
102
117
|
if (signal.channel === "areaSelection" &&
|
|
103
118
|
signal.action === "change" &&
|
|
@@ -173,56 +188,43 @@ function PhiRevisionsControllerMount({ address, config, }) {
|
|
|
173
188
|
const payload = signal.value;
|
|
174
189
|
const action = isPhiRecord(payload.value) ? payload.value : null;
|
|
175
190
|
const key = typeof action?.key === "string" ? action.key : "";
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
valueType: "json",
|
|
208
|
-
valueSchema: PHI_SIGNAL_VALUE_SCHEMAS.revisionsDraftStatus,
|
|
209
|
-
sender: address,
|
|
210
|
-
receiver: "broadcast",
|
|
211
|
-
correlationId: signal.correlationId,
|
|
212
|
-
timestamp: Date.now(),
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
else if (key === "resetPage") {
|
|
216
|
-
showMessage({ level: "success", content: "The Page is back to its Module's preset." }, { correlationId: signal.correlationId });
|
|
217
|
-
// What stands now is the preset, which only the server knows how to build.
|
|
218
|
-
router.refresh();
|
|
191
|
+
const scope = isPhiRecord(action?.scope) ? action.scope : null;
|
|
192
|
+
const kind = normalizePhiBuilderRevisionsKindSearchParam(scope?.kind);
|
|
193
|
+
const area = scope?.area;
|
|
194
|
+
if (key === "restore" || key === "resetPage") {
|
|
195
|
+
const structural = (kind === "area" || kind === "page") && isPhiBuilderAreaKey(area);
|
|
196
|
+
let pageKey = null;
|
|
197
|
+
if (kind === "page" && isPhiBuilderAreaKey(area) && typeof scope?.path === "string") {
|
|
198
|
+
const state = getPhiWorkspaceCatalogSnapshot();
|
|
199
|
+
const pages = resolvePhiBuilderActivePageCatalog(area, state.modulePresetPagesByArea, state.customPages, state.persistedPageCatalogByArea);
|
|
200
|
+
pageKey = findPhiBuilderPageKeyFromStoragePath(area, scope.path, pages)
|
|
201
|
+
?? resolvePhiBuilderPageKeyFromCatalogPath(area, scope.path, pages);
|
|
202
|
+
}
|
|
203
|
+
reportDraftStatus({
|
|
204
|
+
status: key === "restore" ? "draft" : "published",
|
|
205
|
+
revisionId: typeof action?.restoredRevisionId === "number" ? action.restoredRevisionId : null,
|
|
206
|
+
...(kind === "navigation" ? { navKey: scope?.navKey } : {}),
|
|
207
|
+
...(kind === "theme" ? { themeKey: scope?.themeKey } : {}),
|
|
208
|
+
...(structural ? { area } : {}),
|
|
209
|
+
...(pageKey !== null ? { pageKey } : {}),
|
|
210
|
+
...(action?.areaModules === true ? { areaModules: true } : {}),
|
|
211
|
+
}, signal.correlationId);
|
|
212
|
+
if (structural) {
|
|
213
|
+
router.refresh();
|
|
214
|
+
}
|
|
215
|
+
showMessage({
|
|
216
|
+
level: "success",
|
|
217
|
+
content: key === "restore"
|
|
218
|
+
? `Restored revision #${String(action?.revisionId ?? "")}.`
|
|
219
|
+
: "The Page is back to its Module's preset.",
|
|
220
|
+
}, { correlationId: signal.correlationId });
|
|
219
221
|
}
|
|
220
222
|
else if (key === "delete")
|
|
221
223
|
showMessage({ level: "success", content: `Deleted revision #${String(action?.revisionId ?? "")}.` }, { correlationId: signal.correlationId });
|
|
222
224
|
else if (key === "deleteSelected")
|
|
223
225
|
showMessage({ level: "success", content: `Deleted ${String(action?.deletedCount ?? 0)} revisions.` }, { correlationId: signal.correlationId });
|
|
224
226
|
}
|
|
225
|
-
}, [address, deleteAreaShell,
|
|
227
|
+
}, [address, deleteAreaShell, emitCapability, pathname, reportDraftStatus, router, showMessage]), {
|
|
226
228
|
scopes: ["area", "page"],
|
|
227
229
|
channels: ["areaSelection", "bindingParams", "command", "formValues", "mutation"],
|
|
228
230
|
},
|
|
@@ -428,7 +428,7 @@ async function mutateRevision(request) {
|
|
|
428
428
|
return {
|
|
429
429
|
status: "accepted",
|
|
430
430
|
invalidation: "view",
|
|
431
|
-
value: { key: request.actionKey },
|
|
431
|
+
value: { key: request.actionKey, scope: params.scope },
|
|
432
432
|
};
|
|
433
433
|
}
|
|
434
434
|
const current = await loadRevisionHistory(params.scope, request.signal);
|
|
@@ -443,6 +443,8 @@ async function mutateRevision(request) {
|
|
|
443
443
|
key: request.actionKey,
|
|
444
444
|
revisionId,
|
|
445
445
|
restoredRevisionId: result.revisionId,
|
|
446
|
+
scope: params.scope,
|
|
447
|
+
areaModules: params.scope.kind === "area" && current.rows.some((row) => row.revisionId === revisionId && !row.sourcePreset),
|
|
446
448
|
};
|
|
447
449
|
}
|
|
448
450
|
else if (request.actionKey === "delete") {
|
|
@@ -270,6 +270,11 @@
|
|
|
270
270
|
gap: var(--phi-builder-content-body-gap);
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
:where(.phi-builder-spacer-box) {
|
|
274
|
+
min-width: 0;
|
|
275
|
+
min-height: 0;
|
|
276
|
+
}
|
|
277
|
+
|
|
273
278
|
:where(.phi-builder-spacer) {
|
|
274
279
|
position: absolute;
|
|
275
280
|
inset: 0;
|
|
@@ -280,7 +285,8 @@
|
|
|
280
285
|
gap: 8px;
|
|
281
286
|
min-width: 0;
|
|
282
287
|
min-height: 0;
|
|
283
|
-
padding: var(--phi-padding-sm);
|
|
288
|
+
padding-block: var(--phi-builder-spacer-padding-block, var(--phi-padding-sm));
|
|
289
|
+
padding-inline: var(--phi-builder-spacer-padding-inline, var(--phi-padding-sm));
|
|
284
290
|
box-sizing: border-box;
|
|
285
291
|
pointer-events: none;
|
|
286
292
|
}
|
|
@@ -385,6 +385,33 @@
|
|
|
385
385
|
height: 100%;
|
|
386
386
|
}
|
|
387
387
|
|
|
388
|
+
/* The glyph is out of flow. Its box supplies a cross-axis minimum only for an editable Flex slot. */
|
|
389
|
+
:is(
|
|
390
|
+
:where([data-layout-axis="horizontal"][data-phi-block-render-mode="editor"])
|
|
391
|
+
> .phi-layout-scaffold-slot
|
|
392
|
+
> .phi-builder-widget-scaffold
|
|
393
|
+
> .phi-builder-widget-scaffold__content
|
|
394
|
+
> *
|
|
395
|
+
> .phi-builder-spacer-box
|
|
396
|
+
) {
|
|
397
|
+
box-sizing: border-box;
|
|
398
|
+
min-height: 24px;
|
|
399
|
+
--phi-builder-spacer-padding-block: var(--phi-padding-xxs);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
:is(
|
|
403
|
+
:where([data-layout-axis="vertical"][data-phi-block-render-mode="editor"])
|
|
404
|
+
> .phi-layout-scaffold-slot
|
|
405
|
+
> .phi-builder-widget-scaffold
|
|
406
|
+
> .phi-builder-widget-scaffold__content
|
|
407
|
+
> *
|
|
408
|
+
> .phi-builder-spacer-box
|
|
409
|
+
) {
|
|
410
|
+
box-sizing: border-box;
|
|
411
|
+
min-width: 24px;
|
|
412
|
+
--phi-builder-spacer-padding-inline: var(--phi-padding-xxs);
|
|
413
|
+
}
|
|
414
|
+
|
|
388
415
|
:where(
|
|
389
416
|
[data-phi-slot-size-inline="fill"] > .phi-builder-widget-scaffold__content > .phi-widget-preview-fallback,
|
|
390
417
|
[data-phi-slot-size-inline="fixed"][data-phi-layout-explicit-width="true"] > .phi-builder-widget-scaffold__content > .phi-widget-preview-fallback
|