@phis/ui 0.4.21 → 0.4.22
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 +1 -1
- package/components/controls/phi-brand-control.d.ts +4 -1
- package/components/controls/phi-brand-control.js +10 -6
- package/components/controls/phi-cascader-control.js +6 -1
- package/components/controls/phi-geometry-control.d.ts +33 -1
- package/components/controls/phi-geometry-control.js +87 -29
- package/components/controls/phi-series-chart-control.js +4 -2
- package/components/forms/form-provider-contract.d.ts +1 -0
- package/components/forms/form-provider-contract.js +1 -0
- package/components/forms/upload-form-control.js +1 -0
- package/components/layouts/clients/phi-flex-layout-client.js +23 -5
- package/components/layouts/clients/phi-grid-layout-client.js +20 -10
- package/components/layouts/clients/phi-layout-anchored-overlay.d.ts +2 -0
- package/components/layouts/clients/phi-layout-anchored-overlay.js +9 -2
- package/components/layouts/clients/phi-three-column-layout-client.js +7 -4
- package/components/layouts/layout-definitions.d.ts +16 -16
- package/components/layouts/layout-definitions.js +8 -8
- package/components/layouts/phi-base-layout.js +13 -9
- package/components/layouts/phi-layout-contract.d.ts +12 -2
- package/components/layouts/phi-layout-contract.js +30 -7
- package/components/layouts/phi-masonry-layout.d.ts +6 -0
- package/components/layouts/phi-masonry-layout.js +13 -3
- package/components/layouts/plugins/masonry-layout-plugin.js +2 -1
- package/components/media/asset-collection-runtime.d.ts +1 -6
- package/components/media/asset-collection-runtime.js +2 -93
- package/components/media/label-sets/media.js +12 -0
- package/components/media/media-folder-lock.d.ts +19 -0
- package/components/media/media-folder-lock.js +40 -0
- package/components/media/media-folder-options.d.ts +14 -2
- package/components/media/media-folder-options.js +17 -5
- package/components/media/media-widget-labels.d.ts +9 -0
- package/components/media/media-widget-labels.js +6 -0
- package/components/media/phi-area-upload-widget.js +1 -0
- package/components/media/phi-asset-folder-control.d.ts +14 -1
- package/components/media/phi-asset-folder-control.js +11 -4
- package/components/media/phi-image-preview-store.d.ts +0 -4
- package/components/media/phi-image-preview-store.js +0 -10
- package/components/media/phi-media-picker-binding.d.ts +7 -2
- package/components/media/phi-media-upload.d.ts +2 -0
- package/components/media/phi-media-upload.js +3 -0
- package/components/regions/clients/cms-region-container-client.d.ts +3 -1
- package/components/regions/clients/cms-region-container-client.js +4 -3
- package/components/regions/phi-cms-region-container.d.ts +3 -1
- package/components/regions/phi-cms-region-container.js +3 -2
- package/components/regions/phi-cms-region-shell.d.ts +9 -1
- package/components/regions/phi-cms-region-shell.js +3 -1
- package/components/regions/phi-cms-region-static.d.ts +3 -1
- package/components/regions/phi-cms-region-static.js +3 -2
- package/components/regions/presets/navigation-redirect.d.ts +2 -2
- package/components/regions/presets/navigation-redirect.js +5 -3
- package/components/shell/phi-antd-icon.d.ts +2 -0
- package/components/shell/phi-antd-icon.js +6 -0
- package/components/widgets/label-sets/geometry.js +10 -0
- package/components/widgets/label-types/geometry.d.ts +7 -0
- package/components/widgets/label-types/geometry.js +6 -0
- package/helpers/block-geometry-profiles.d.ts +67 -0
- package/helpers/block-geometry-profiles.js +105 -0
- package/helpers/cms-navigation-catalog.js +4 -2
- package/helpers/renderable-block-effects.js +16 -0
- package/package.json +1 -1
- package/plugins/runtime/phi-slot-child-frame-view.js +14 -4
- package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +42 -2
- package/plugins/runtime/slot-size-policy.d.ts +15 -0
- package/plugins/runtime/slot-size-policy.js +29 -0
- package/plugins/runtime-modules/asset/data-providers.js +3 -0
- package/plugins/runtime-modules/asset/services/collection.js +34 -0
- package/plugins/runtime-modules/asset/services/options.js +19 -2
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +9 -0
- package/plugins/runtime-modules/auth/trees/phi-auth-runtime-page-tree.js +21 -17
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/client.js +2 -0
- package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
- package/plugins/runtime-modules/builder/render-root-node-preview.server.js +2 -1
- package/plugins/runtime-modules/builder/services/navigation-table.js +3 -2
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +7 -1
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +8 -2
- package/plugins/runtime-modules/core/messaging/data-providers.js +23 -0
- package/plugins/runtime-modules/core/messaging/labels.d.ts +2 -0
- package/plugins/runtime-modules/core/messaging/labels.js +8 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.d.ts +32 -0
- package/plugins/runtime-modules/core/messaging/thread-inbox-table.js +31 -16
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +52 -6
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +8 -2
- package/plugins/runtime-modules/descriptor-compiler.js +45 -2
- package/plugins/runtime-modules/public/trees/phi-default-pub-welcome-page-tree.js +8 -14
- package/plugins/runtime-modules/search/widgets/search-box/client.d.ts +2 -1
- package/plugins/runtime-modules/search/widgets/search-box/client.js +28 -6
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +19 -2
- package/plugins/runtime-modules/threads/labels.d.ts +6 -0
- package/plugins/runtime-modules/threads/labels.js +16 -0
- package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +24 -1
- package/styles/layout.css +101 -0
- package/styles/root.css +2 -1
- package/types/cms-config.d.ts +5 -1
- package/types/cms-config.js +1 -0
- package/types/cms-module-descriptors.d.ts +17 -0
- package/types/renderable-block.d.ts +5 -0
- package/types/site-theme.d.ts +9 -1
- package/types.d.ts +1 -1
|
@@ -3,7 +3,7 @@ export declare const PHI_CONTENT_LAYOUT_DEFINITION: {
|
|
|
3
3
|
kind: "layout";
|
|
4
4
|
pluginKey: string;
|
|
5
5
|
typeKey: string;
|
|
6
|
-
slotSizePolicy: "fill";
|
|
6
|
+
slotSizePolicy: "fill-inline";
|
|
7
7
|
title: string;
|
|
8
8
|
description: string;
|
|
9
9
|
category: "structure";
|
|
@@ -34,7 +34,7 @@ export declare const PHI_FLEX_LAYOUT_DEFINITION: {
|
|
|
34
34
|
kind: "layout";
|
|
35
35
|
pluginKey: string;
|
|
36
36
|
typeKey: string;
|
|
37
|
-
slotSizePolicy: "fill";
|
|
37
|
+
slotSizePolicy: "fill-inline";
|
|
38
38
|
title: string;
|
|
39
39
|
description: string;
|
|
40
40
|
category: "structure";
|
|
@@ -96,7 +96,7 @@ export declare const PHI_FLEX_VERTICAL_LAYOUT_DEFINITION: {
|
|
|
96
96
|
kind: "layout";
|
|
97
97
|
pluginKey: string;
|
|
98
98
|
typeKey: string;
|
|
99
|
-
slotSizePolicy: "fill";
|
|
99
|
+
slotSizePolicy: "fill-inline";
|
|
100
100
|
title: string;
|
|
101
101
|
description: string;
|
|
102
102
|
category: "structure";
|
|
@@ -129,7 +129,7 @@ export declare const PHI_COLLAPSIBLE_LAYOUT_DEFINITION: {
|
|
|
129
129
|
pluginKey: string;
|
|
130
130
|
typeKey: string;
|
|
131
131
|
translatesOwnText: true;
|
|
132
|
-
slotSizePolicy: "fill";
|
|
132
|
+
slotSizePolicy: "fill-inline";
|
|
133
133
|
slotPositions: "fixed";
|
|
134
134
|
title: string;
|
|
135
135
|
description: string;
|
|
@@ -263,7 +263,7 @@ export declare const PHI_STACK_LAYOUT_DEFINITION: {
|
|
|
263
263
|
readonly horizontal: "center";
|
|
264
264
|
readonly vertical: "middle";
|
|
265
265
|
};
|
|
266
|
-
slotSizePolicy: "fill";
|
|
266
|
+
slotSizePolicy: "fill-inline";
|
|
267
267
|
title: string;
|
|
268
268
|
description: string;
|
|
269
269
|
category: "structure";
|
|
@@ -379,7 +379,7 @@ export declare const PHI_CAROUSEL_LAYOUT_DEFINITION: {
|
|
|
379
379
|
readonly horizontal: "center";
|
|
380
380
|
readonly vertical: "middle";
|
|
381
381
|
};
|
|
382
|
-
slotSizePolicy: "fill";
|
|
382
|
+
slotSizePolicy: "fill-inline";
|
|
383
383
|
title: string;
|
|
384
384
|
description: string;
|
|
385
385
|
category: "structure";
|
|
@@ -511,7 +511,7 @@ export declare const PHI_MASONRY_LAYOUT_DEFINITION: {
|
|
|
511
511
|
kind: "layout";
|
|
512
512
|
pluginKey: string;
|
|
513
513
|
typeKey: string;
|
|
514
|
-
slotSizePolicy: "fill";
|
|
514
|
+
slotSizePolicy: "fill-inline";
|
|
515
515
|
title: string;
|
|
516
516
|
description: string;
|
|
517
517
|
category: "structure";
|
|
@@ -543,7 +543,7 @@ export declare const PHI_SPLIT_CARD_LAYOUT_DEFINITION: {
|
|
|
543
543
|
readonly horizontal: "center";
|
|
544
544
|
readonly vertical: "middle";
|
|
545
545
|
};
|
|
546
|
-
slotSizePolicy: "fill";
|
|
546
|
+
slotSizePolicy: "fill-inline";
|
|
547
547
|
title: string;
|
|
548
548
|
description: string;
|
|
549
549
|
category: "structure";
|
|
@@ -702,7 +702,7 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
|
|
|
702
702
|
kind: "layout";
|
|
703
703
|
pluginKey: string;
|
|
704
704
|
typeKey: string;
|
|
705
|
-
slotSizePolicy: "fill";
|
|
705
|
+
slotSizePolicy: "fill-inline";
|
|
706
706
|
title: string;
|
|
707
707
|
description: string;
|
|
708
708
|
category: "structure";
|
|
@@ -732,7 +732,7 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
|
|
|
732
732
|
kind: "layout";
|
|
733
733
|
pluginKey: string;
|
|
734
734
|
typeKey: string;
|
|
735
|
-
slotSizePolicy: "fill";
|
|
735
|
+
slotSizePolicy: "fill-inline";
|
|
736
736
|
title: string;
|
|
737
737
|
description: string;
|
|
738
738
|
category: "structure";
|
|
@@ -793,7 +793,7 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
|
|
|
793
793
|
kind: "layout";
|
|
794
794
|
pluginKey: string;
|
|
795
795
|
typeKey: string;
|
|
796
|
-
slotSizePolicy: "fill";
|
|
796
|
+
slotSizePolicy: "fill-inline";
|
|
797
797
|
title: string;
|
|
798
798
|
description: string;
|
|
799
799
|
category: "structure";
|
|
@@ -825,7 +825,7 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
|
|
|
825
825
|
pluginKey: string;
|
|
826
826
|
typeKey: string;
|
|
827
827
|
translatesOwnText: true;
|
|
828
|
-
slotSizePolicy: "fill";
|
|
828
|
+
slotSizePolicy: "fill-inline";
|
|
829
829
|
slotPositions: "fixed";
|
|
830
830
|
title: string;
|
|
831
831
|
description: string;
|
|
@@ -958,7 +958,7 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
|
|
|
958
958
|
readonly horizontal: "center";
|
|
959
959
|
readonly vertical: "middle";
|
|
960
960
|
};
|
|
961
|
-
slotSizePolicy: "fill";
|
|
961
|
+
slotSizePolicy: "fill-inline";
|
|
962
962
|
title: string;
|
|
963
963
|
description: string;
|
|
964
964
|
category: "structure";
|
|
@@ -1073,7 +1073,7 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
|
|
|
1073
1073
|
readonly horizontal: "center";
|
|
1074
1074
|
readonly vertical: "middle";
|
|
1075
1075
|
};
|
|
1076
|
-
slotSizePolicy: "fill";
|
|
1076
|
+
slotSizePolicy: "fill-inline";
|
|
1077
1077
|
title: string;
|
|
1078
1078
|
description: string;
|
|
1079
1079
|
category: "structure";
|
|
@@ -1203,7 +1203,7 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
|
|
|
1203
1203
|
kind: "layout";
|
|
1204
1204
|
pluginKey: string;
|
|
1205
1205
|
typeKey: string;
|
|
1206
|
-
slotSizePolicy: "fill";
|
|
1206
|
+
slotSizePolicy: "fill-inline";
|
|
1207
1207
|
title: string;
|
|
1208
1208
|
description: string;
|
|
1209
1209
|
category: "structure";
|
|
@@ -1234,7 +1234,7 @@ export declare const PHI_CORE_LAYOUT_DEFINITIONS: readonly [{
|
|
|
1234
1234
|
readonly horizontal: "center";
|
|
1235
1235
|
readonly vertical: "middle";
|
|
1236
1236
|
};
|
|
1237
|
-
slotSizePolicy: "fill";
|
|
1237
|
+
slotSizePolicy: "fill-inline";
|
|
1238
1238
|
title: string;
|
|
1239
1239
|
description: string;
|
|
1240
1240
|
category: "structure";
|
|
@@ -55,7 +55,7 @@ export const PHI_CONTENT_LAYOUT_DEFINITION = {
|
|
|
55
55
|
kind: "layout",
|
|
56
56
|
pluginKey: resolvePhiCmsLayoutPluginKey("content"),
|
|
57
57
|
typeKey: "content",
|
|
58
|
-
slotSizePolicy: "fill",
|
|
58
|
+
slotSizePolicy: "fill-inline",
|
|
59
59
|
title: "Content",
|
|
60
60
|
description: "Neutral full-width content wrapper with a single default slot.",
|
|
61
61
|
category: "structure",
|
|
@@ -69,7 +69,7 @@ export const PHI_FLEX_LAYOUT_DEFINITION = {
|
|
|
69
69
|
kind: "layout",
|
|
70
70
|
pluginKey: resolvePhiCmsLayoutPluginKey("flex"),
|
|
71
71
|
typeKey: "flex",
|
|
72
|
-
slotSizePolicy: "fill",
|
|
72
|
+
slotSizePolicy: "fill-inline",
|
|
73
73
|
title: "Flex",
|
|
74
74
|
description: "Sequential slot layout, laid out in a row.",
|
|
75
75
|
category: "structure",
|
|
@@ -95,7 +95,7 @@ export const PHI_FLEX_VERTICAL_LAYOUT_DEFINITION = {
|
|
|
95
95
|
kind: "layout",
|
|
96
96
|
pluginKey: resolvePhiCmsLayoutPluginKey("flex-vertical"),
|
|
97
97
|
typeKey: "flex-vertical",
|
|
98
|
-
slotSizePolicy: "fill",
|
|
98
|
+
slotSizePolicy: "fill-inline",
|
|
99
99
|
title: "Flex Vertical",
|
|
100
100
|
description: "Sequential slot layout, laid out in a column.",
|
|
101
101
|
category: "structure",
|
|
@@ -110,7 +110,7 @@ export const PHI_COLLAPSIBLE_LAYOUT_DEFINITION = {
|
|
|
110
110
|
pluginKey: resolvePhiCmsLayoutPluginKey("collapsible"),
|
|
111
111
|
typeKey: "collapsible",
|
|
112
112
|
translatesOwnText: true,
|
|
113
|
-
slotSizePolicy: "fill",
|
|
113
|
+
slotSizePolicy: "fill-inline",
|
|
114
114
|
slotPositions: "fixed",
|
|
115
115
|
title: "Collapsible",
|
|
116
116
|
description: "Sequential multi-section layout with one collapsible header per slot.",
|
|
@@ -228,7 +228,7 @@ export const PHI_STACK_LAYOUT_DEFINITION = {
|
|
|
228
228
|
pluginKey: resolvePhiCmsLayoutPluginKey("stack"),
|
|
229
229
|
typeKey: "stack",
|
|
230
230
|
defaultAnchor: PHI_CENTRED_SLOT_DEFAULT_ANCHOR,
|
|
231
|
-
slotSizePolicy: "fill",
|
|
231
|
+
slotSizePolicy: "fill-inline",
|
|
232
232
|
title: "Stack",
|
|
233
233
|
description: "Single-active-slot layout for tabbed or step-like sections.",
|
|
234
234
|
category: "structure",
|
|
@@ -314,7 +314,7 @@ export const PHI_CAROUSEL_LAYOUT_DEFINITION = {
|
|
|
314
314
|
pluginKey: resolvePhiCmsLayoutPluginKey("carousel"),
|
|
315
315
|
typeKey: "carousel",
|
|
316
316
|
defaultAnchor: PHI_CENTRED_SLOT_DEFAULT_ANCHOR,
|
|
317
|
-
slotSizePolicy: "fill",
|
|
317
|
+
slotSizePolicy: "fill-inline",
|
|
318
318
|
title: "Carousel",
|
|
319
319
|
description: "A run of slots shown a few at a time, moving on their own or on a signal.",
|
|
320
320
|
category: "structure",
|
|
@@ -441,7 +441,7 @@ export const PHI_MASONRY_LAYOUT_DEFINITION = {
|
|
|
441
441
|
kind: "layout",
|
|
442
442
|
pluginKey: resolvePhiCmsLayoutPluginKey("masonry"),
|
|
443
443
|
typeKey: "masonry",
|
|
444
|
-
slotSizePolicy: "fill",
|
|
444
|
+
slotSizePolicy: "fill-inline",
|
|
445
445
|
title: "Masonry",
|
|
446
446
|
description: "Slots in columns at their own heights, without rows.",
|
|
447
447
|
category: "structure",
|
|
@@ -459,7 +459,7 @@ export const PHI_SPLIT_CARD_LAYOUT_DEFINITION = {
|
|
|
459
459
|
pluginKey: resolvePhiCmsLayoutPluginKey("split-card"),
|
|
460
460
|
typeKey: "split-card",
|
|
461
461
|
defaultAnchor: PHI_CENTRED_SLOT_DEFAULT_ANCHOR,
|
|
462
|
-
slotSizePolicy: "fill",
|
|
462
|
+
slotSizePolicy: "fill-inline",
|
|
463
463
|
title: "Split Card",
|
|
464
464
|
description: "Two cards on the golden ratio, one Surface for both.",
|
|
465
465
|
category: "structure",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cloneElement, isValidElement, } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { resolvePhiLayoutBox } from "./phi-layout-contract";
|
|
4
|
+
import { omitPhiBlockProfiledDeclarations } from "../../helpers/block-geometry-profiles";
|
|
4
5
|
import { resolvePhiBaseLayoutSlotStates, resolvePhiBaseLayoutChrome, } from "./phi-layout-view-model";
|
|
5
6
|
import { isPhiLayoutAuthoringRender, phiLayoutDebugLayerMarker, } from "../../helpers/layout-authoring-markers";
|
|
6
7
|
import { PhiLayoutSurfaceBox } from "./phi-layout-surface-box";
|
|
@@ -68,14 +69,15 @@ export function PhiBaseLayout({ slots, editSlotLabels, layoutKind, labelEnd, pad
|
|
|
68
69
|
paddingLeft,
|
|
69
70
|
surface,
|
|
70
71
|
});
|
|
72
|
+
const layoutBox = resolvePhiLayoutBox({
|
|
73
|
+
size,
|
|
74
|
+
minSize,
|
|
75
|
+
maxSize,
|
|
76
|
+
collapsedSizeHint,
|
|
77
|
+
visibility: resolvedVisibility,
|
|
78
|
+
});
|
|
71
79
|
const resolvedContainerStyle = {
|
|
72
|
-
...
|
|
73
|
-
size,
|
|
74
|
-
minSize,
|
|
75
|
-
maxSize,
|
|
76
|
-
collapsedSizeHint,
|
|
77
|
-
visibility: resolvedVisibility,
|
|
78
|
-
}),
|
|
80
|
+
...layoutBox.style,
|
|
79
81
|
...(resolvedZIndex == null ? {} : { zIndex: resolvedZIndex }),
|
|
80
82
|
opacity: resolvedOpacity,
|
|
81
83
|
...(resolvedMargin == null
|
|
@@ -95,5 +97,7 @@ export function PhiBaseLayout({ slots, editSlotLabels, layoutKind, labelEnd, pad
|
|
|
95
97
|
overflow: resolvedVisibility === "collapsed" ? "hidden" : undefined,
|
|
96
98
|
...style,
|
|
97
99
|
};
|
|
98
|
-
|
|
100
|
+
/* A declaration handed to the stylesheet per profile is not written inline here either, `minWidth: 0` included. */
|
|
101
|
+
const resolvedBoxStyle = omitPhiBlockProfiledDeclarations(resolvedContainerStyle, layoutBox.declarations);
|
|
102
|
+
return (_jsxs(PhiLayoutSurfaceBox, { blockId: blockId, surface: surface, ground: ground, "data-phi-block-id": blockId ?? undefined, "data-layout-kind": layoutKind, "data-phi-block-render-mode": resolvedRenderMode, "data-phi-block-visibility": resolvedVisibility, "data-phi-block-enabled": resolvedEnabled ? "true" : "false", "data-phi-block-selectable": capabilities?.selectable ? "true" : undefined, "data-phi-block-draggable": capabilities?.draggable ? "true" : undefined, "data-phi-block-hoverable": capabilities?.hoverable ? "true" : undefined, "data-phi-block-activatable": capabilities?.activatable ? "true" : undefined, "data-phi-block-focusable": capabilities?.focusable ? "true" : undefined, "data-phi-block-droppable": capabilities?.droppable ? "true" : undefined, "data-phi-block-selected": runtime?.selected ? "true" : undefined, "data-phi-block-hovered": runtime?.hovered ? "true" : undefined, "data-phi-block-dragging": runtime?.dragging ? "true" : undefined, "data-phi-block-focused": runtime?.focused ? "true" : undefined, "data-phi-block-active": runtime?.active ? "true" : undefined, "data-phi-layout-debug-layer": phiLayoutDebugLayerMarker(isAuthoringRender), "data-phi-debug-scaffold": resolvedDebugMode ? "on" : undefined, "data-phi-layout-has-explicit-layout-background": hasExplicitLayoutBackground ? "true" : "false", ...layoutBox.attributes, className: joinPhiClassNames("phi-layout", className), style: resolvedBoxStyle, children: [underlay, resolvedSlots] }));
|
|
99
103
|
}
|
|
@@ -3,6 +3,7 @@ import { type PhiAnchorWidgetPlacement } from "../controls/phi-anchor-control-co
|
|
|
3
3
|
import type { PhiRenderableBlockRenderMode, PhiRenderableBlockAnchor, PhiRenderableBlockResponsiveSize, PhiRenderableBlockSize } from "../../types";
|
|
4
4
|
import type { PhiSurface } from "../../types/surface";
|
|
5
5
|
import { type PhiRenderableBlockGeometryInput } from "../../types/renderable-block-geometry";
|
|
6
|
+
import { type PhiBlockProfileStyle } from "../../helpers/block-geometry-profiles";
|
|
6
7
|
export type PhiLayoutProps = {
|
|
7
8
|
size?: PhiRenderableBlockResponsiveSize;
|
|
8
9
|
minSize?: PhiRenderableBlockResponsiveSize;
|
|
@@ -66,8 +67,17 @@ export declare function normalizePhiCssSize(value: number | string | undefined):
|
|
|
66
67
|
* against it is dropped by the browser rather than obeyed. Whoever renders a Layout outside a frame
|
|
67
68
|
* states the fill in CSS where that frame's job is being done instead (the Builder's edit scaffold
|
|
68
69
|
* drawer, `styles/layout-authoring-scaffold.css`).
|
|
70
|
+
*
|
|
71
|
+
* A declaration that names a value per profile is handed to the stylesheet the way the frame hands it
|
|
72
|
+
* (`helpers/block-geometry-profiles.ts`): left out of `style`, written as custom properties, and named
|
|
73
|
+
* in `attributes`. `declarations` is for the caller, whose own inline values for the same keys --
|
|
74
|
+
* `minWidth: 0` -- have to be left out too, or they would beat the `@container` rule.
|
|
69
75
|
*/
|
|
70
|
-
export declare function
|
|
76
|
+
export declare function resolvePhiLayoutBox({ size, minSize, maxSize, collapsedSizeHint, visibility, }: PhiRenderableBlockGeometryInput): {
|
|
77
|
+
style: CSSProperties;
|
|
78
|
+
attributes: PhiBlockProfileStyle["attributes"];
|
|
79
|
+
declarations: PhiBlockProfileStyle["declarations"];
|
|
80
|
+
};
|
|
71
81
|
/**
|
|
72
82
|
* The Site's answer for a Layout that states no corner of its own: the surface step of the Control shape,
|
|
73
83
|
* carried on the root as `--phi-surface-radius` (THEME.md, "Control shape"). An author who stated a corner
|
|
@@ -143,7 +153,7 @@ export type PhiPlacementRole = "mirrorInline" | "pinInlineStart" | "pinInlineEnd
|
|
|
143
153
|
*/
|
|
144
154
|
export declare function resolvePhiPlacement(anchor: PhiAnchorWidgetPlacement | PhiRenderableBlockAnchor | null | undefined, role?: PhiPlacementRole): PhiPlacement;
|
|
145
155
|
/** The flex spelling, and `undefined` where the anchor said nothing, so a caller's own value stands. */
|
|
146
|
-
export declare function phiFlexPlacementWord(placement: PhiAxisPlacement | null): "center" | "flex-
|
|
156
|
+
export declare function phiFlexPlacementWord(placement: PhiAxisPlacement | null): "center" | "flex-end" | "flex-start" | undefined;
|
|
147
157
|
/** The grid spelling, and `undefined` where the anchor said nothing. */
|
|
148
158
|
export declare function phiGridPlacementWord(placement: PhiAxisPlacement | null): PhiAxisPlacement | undefined;
|
|
149
159
|
/**
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { resolvePhiAnchorWidgetPlacement, } from "../controls/phi-anchor-control-contract";
|
|
2
2
|
import { resolvePhiRenderableBlockGeometry, } from "../../types/renderable-block-geometry";
|
|
3
|
+
import { omitPhiBlockProfiledDeclarations, resolvePhiBlockProfileStyle, } from "../../helpers/block-geometry-profiles";
|
|
3
4
|
export function normalizePhiCssSize(value) {
|
|
4
5
|
if (typeof value === "number") {
|
|
5
6
|
return `${value}px`;
|
|
6
7
|
}
|
|
7
8
|
return value;
|
|
8
9
|
}
|
|
10
|
+
/** What a Layout's inner box writes where a profile states nothing: no size and no maximum of its own. */
|
|
11
|
+
const PHI_LAYOUT_BOX_UNSTATED_PROFILE_VALUES = {
|
|
12
|
+
width: "auto",
|
|
13
|
+
height: "auto",
|
|
14
|
+
"min-width": "0",
|
|
15
|
+
"min-height": "0",
|
|
16
|
+
"max-width": "none",
|
|
17
|
+
"max-height": "none",
|
|
18
|
+
};
|
|
9
19
|
/**
|
|
10
20
|
* A Layout's own inner box: what the block states, and nothing else.
|
|
11
21
|
*
|
|
@@ -17,16 +27,29 @@ export function normalizePhiCssSize(value) {
|
|
|
17
27
|
* against it is dropped by the browser rather than obeyed. Whoever renders a Layout outside a frame
|
|
18
28
|
* states the fill in CSS where that frame's job is being done instead (the Builder's edit scaffold
|
|
19
29
|
* drawer, `styles/layout-authoring-scaffold.css`).
|
|
30
|
+
*
|
|
31
|
+
* A declaration that names a value per profile is handed to the stylesheet the way the frame hands it
|
|
32
|
+
* (`helpers/block-geometry-profiles.ts`): left out of `style`, written as custom properties, and named
|
|
33
|
+
* in `attributes`. `declarations` is for the caller, whose own inline values for the same keys --
|
|
34
|
+
* `minWidth: 0` -- have to be left out too, or they would beat the `@container` rule.
|
|
20
35
|
*/
|
|
21
|
-
export function
|
|
36
|
+
export function resolvePhiLayoutBox({ size, minSize, maxSize, collapsedSizeHint, visibility, }) {
|
|
22
37
|
const geometry = resolvePhiRenderableBlockGeometry({ size, minSize, maxSize, collapsedSizeHint, visibility });
|
|
38
|
+
const profile = resolvePhiBlockProfileStyle(geometry, { unstated: PHI_LAYOUT_BOX_UNSTATED_PROFILE_VALUES });
|
|
23
39
|
return {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
style: {
|
|
41
|
+
...omitPhiBlockProfiledDeclarations({
|
|
42
|
+
...(geometry.inline.size == null ? {} : { width: geometry.inline.size.css }),
|
|
43
|
+
...(geometry.block.size == null ? {} : { height: geometry.block.size.css }),
|
|
44
|
+
...(geometry.inline.min == null ? {} : { minWidth: geometry.inline.min.css }),
|
|
45
|
+
...(geometry.inline.max == null ? {} : { maxWidth: geometry.inline.max.css }),
|
|
46
|
+
...(geometry.block.min == null ? {} : { minHeight: geometry.block.min.css }),
|
|
47
|
+
...(geometry.block.max == null ? {} : { maxHeight: geometry.block.max.css }),
|
|
48
|
+
}, profile.declarations),
|
|
49
|
+
...profile.properties,
|
|
50
|
+
},
|
|
51
|
+
attributes: profile.attributes,
|
|
52
|
+
declarations: profile.declarations,
|
|
30
53
|
};
|
|
31
54
|
}
|
|
32
55
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from "react";
|
|
2
|
+
import type { PhiAnchorWidgetPlacement } from "../controls/phi-anchor-control-contract";
|
|
2
3
|
import { type PhiBaseLayoutProps } from "./phi-base-layout";
|
|
3
4
|
import type { PhiResponsiveValue } from "../../types/responsive";
|
|
4
5
|
export type PhiMasonryLayoutProps = Omit<PhiBaseLayoutProps, "slots"> & {
|
|
@@ -7,6 +8,11 @@ export type PhiMasonryLayoutProps = Omit<PhiBaseLayoutProps, "slots"> & {
|
|
|
7
8
|
columns?: PhiResponsiveValue<number>;
|
|
8
9
|
/** The distance between children, across and down. */
|
|
9
10
|
gap?: CSSProperties["gap"];
|
|
11
|
+
/**
|
|
12
|
+
* Where a child narrower than its column stands in it. Only the inline axis: an item is as tall as
|
|
13
|
+
* its child, so there is no room on the block axis to place anything in.
|
|
14
|
+
*/
|
|
15
|
+
editSlotAnchor?: PhiAnchorWidgetPlacement | null;
|
|
10
16
|
style?: CSSProperties;
|
|
11
17
|
};
|
|
12
18
|
/**
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { normalizePhiCssSize } from "./phi-layout-contract";
|
|
2
|
+
import { normalizePhiCssSize, resolvePhiPlacement, resolvePhiSlotPlacementMargins, } from "./phi-layout-contract";
|
|
3
|
+
import { phiSlotContainerAttributes } from "../../helpers/block-geometry-profiles";
|
|
4
|
+
import { resolvePhiLayoutSlotChildSizing } from "./clients/phi-layout-anchored-overlay";
|
|
3
5
|
import { PhiBaseLayout } from "./phi-base-layout";
|
|
4
6
|
import { resolvePhiLayoutDefaults } from "../../helpers/cms-layout-defaults";
|
|
5
7
|
import { isPhiLayoutAuthoringRender, phiLayoutSlotClassName, phiLayoutSlotContentMarker, } from "../../helpers/layout-authoring-markers";
|
|
@@ -13,7 +15,15 @@ const PHI_MASONRY_LAYOUT_DEFAULTS = resolvePhiLayoutDefaults("masonry");
|
|
|
13
15
|
* (`PhiMasonryColumns`); until the browser can measure, the server's multi-column flow stands in.
|
|
14
16
|
*/
|
|
15
17
|
export function PhiMasonryLayout({ slots, ...layoutProps }) {
|
|
16
|
-
const { columns, gap = PHI_MASONRY_LAYOUT_DEFAULTS.gap, renderMode, style, layoutKind = "masonry", editSlotAction, editSlotLabels, editRenderInsertControl, } = layoutProps;
|
|
18
|
+
const { columns, gap = PHI_MASONRY_LAYOUT_DEFAULTS.gap, renderMode, style, layoutKind = "masonry", editSlotAction, editSlotLabels, editRenderInsertControl, editSlotAnchor, } = layoutProps;
|
|
19
|
+
/*
|
|
20
|
+
* The anchor as the margins a child is moved by. A slot is a block box as wide as its column, and an
|
|
21
|
+
* `intrinsic` child is `width: fit-content` in it -- a definite width, so `margin-inline: auto` places
|
|
22
|
+
* it. The block axis states `0`: the item is the child's height and has nothing over. Every slot
|
|
23
|
+
* states all four, which is what stops a Layout further up from placing this one's children.
|
|
24
|
+
*/
|
|
25
|
+
const placement = resolvePhiPlacement(editSlotAnchor);
|
|
26
|
+
const slotPlacementMargins = resolvePhiSlotPlacementMargins({ inline: placement.inline, block: null });
|
|
17
27
|
const resolvedGap = normalizePhiCssSize(gap) ?? normalizePhiCssSize(PHI_MASONRY_LAYOUT_DEFAULTS.gap) ?? "0px";
|
|
18
28
|
const isAuthoringRender = isPhiLayoutAuthoringRender(layoutProps);
|
|
19
29
|
const isEditMode = renderMode === "editor";
|
|
@@ -24,7 +34,7 @@ export function PhiMasonryLayout({ slots, ...layoutProps }) {
|
|
|
24
34
|
* column. The insert control is given the same item, so the place a Widget will appear is the place
|
|
25
35
|
* the button stands.
|
|
26
36
|
*/
|
|
27
|
-
const renderMasonryItem = (key, hasContent, content) => (_jsx("div", { className: "phi-masonry-layout__item", children: _jsx("div", { className: phiLayoutSlotClassName(isAuthoringRender), "data-phi-layout-has-content": phiLayoutSlotContentMarker(isAuthoringRender, hasContent), style: { minWidth: 0 }, children: content }) }, key));
|
|
37
|
+
const renderMasonryItem = (key, hasContent, content) => (_jsx("div", { className: "phi-masonry-layout__item", ...phiSlotContainerAttributes(hasContent && resolvePhiLayoutSlotChildSizing(content).queriesRoom), children: _jsx("div", { className: phiLayoutSlotClassName(isAuthoringRender), "data-phi-layout-has-content": phiLayoutSlotContentMarker(isAuthoringRender, hasContent), style: { minWidth: 0, ...slotPlacementMargins }, children: content }) }, key));
|
|
28
38
|
/*
|
|
29
39
|
* One insert control, at the end, drawn here rather than by the base layout.
|
|
30
40
|
*
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { parsePhiCmsMasonryLayoutConfig } from "../../../types/cms-config";
|
|
3
3
|
import { PhiMasonryLayout } from "../phi-masonry-layout";
|
|
4
|
+
import { resolvePhiLayoutAnchor } from "../phi-layout-contract";
|
|
4
5
|
import { definePhiLayoutRenderers } from "../layout-plugin-renderers";
|
|
5
6
|
import { PHI_MASONRY_LAYOUT_DEFINITION } from "../layout-definitions";
|
|
6
7
|
export const PHI_MASONRY_LAYOUT_PLUGIN = {
|
|
7
8
|
...PHI_MASONRY_LAYOUT_DEFINITION,
|
|
8
9
|
parseConfig: parsePhiCmsMasonryLayoutConfig,
|
|
9
|
-
...definePhiLayoutRenderers(({ node, config, renderSequentialSlotChildren }, renderMode) => (_jsx(PhiMasonryLayout, { blockId: node.id, layoutKind: "masonry", slots: renderSequentialSlotChildren(node), renderMode: renderMode, columns: config.columns, gap: config.gap, zIndex: config.zIndex, surface: config.surface, size: config.size, minSize: config.minSize, maxSize: config.maxSize, collapsedSizeHint: config.collapsedSizeHint, padding: config.padding, paddingTop: config.paddingTop, paddingRight: config.paddingRight, paddingBottom: config.paddingBottom, paddingLeft: config.paddingLeft, labelEnd: config.labelEnd }, `layout-${node.id}`))),
|
|
10
|
+
...definePhiLayoutRenderers(({ node, config, renderSequentialSlotChildren }, renderMode) => (_jsx(PhiMasonryLayout, { blockId: node.id, layoutKind: "masonry", slots: renderSequentialSlotChildren(node), renderMode: renderMode, columns: config.columns, gap: config.gap, editSlotAnchor: resolvePhiLayoutAnchor(config.anchor), zIndex: config.zIndex, surface: config.surface, size: config.size, minSize: config.minSize, maxSize: config.maxSize, collapsedSizeHint: config.collapsedSizeHint, padding: config.padding, paddingTop: config.paddingTop, paddingRight: config.paddingRight, paddingBottom: config.paddingBottom, paddingLeft: config.paddingLeft, labelEnd: config.labelEnd }, `layout-${node.id}`))),
|
|
10
11
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PhiCollectionProviderData, PhiCollectionProviderQuery } from "../../types/collection-provider";
|
|
2
|
-
import type { PhiProviderResourceSource } from "../../types/runtime-data-provider";
|
|
3
2
|
import { type PhiImagePreviewStoreState } from "./phi-image-preview-store";
|
|
4
3
|
export declare const PHI_ASSET_COLLECTION_DATA_SOURCE: {
|
|
5
4
|
readonly providerKey: `${string}/${string}`;
|
|
@@ -8,8 +7,4 @@ export declare const PHI_ASSET_COLLECTION_DATA_SOURCE: {
|
|
|
8
7
|
export declare function buildPhiAssetCollectionQuery(state: Pick<PhiImagePreviewStoreState, "page" | "pageSize" | "searchQuery" | "folderId" | "kind" | "presentationFlags" | "since" | "until"> & {
|
|
9
8
|
spaceAddress?: string | null;
|
|
10
9
|
}): PhiCollectionProviderQuery;
|
|
11
|
-
export declare function applyPhiAssetCollectionData(data: PhiCollectionProviderData
|
|
12
|
-
export declare function usePhiAssetCollectionRuntime(source: PhiProviderResourceSource | null, enabled?: boolean): {
|
|
13
|
-
state: PhiImagePreviewStoreState;
|
|
14
|
-
query: PhiCollectionProviderQuery;
|
|
15
|
-
};
|
|
10
|
+
export declare function applyPhiAssetCollectionData(data: PhiCollectionProviderData): void;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useEffect, useMemo } from "react";
|
|
3
2
|
import { PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS } from "../../constants/media-library-provider-keys";
|
|
4
|
-
import { usePhiCollectionProvider } from "../widgets/client/shared/phi-collection-provider";
|
|
5
|
-
import { usePhiMediaSpaceSelectionAllowed } from "./media-space-selection";
|
|
6
3
|
import { readPhiMediaAssetTiles, readPhiMediaFolders, readPhiMediaPagination, readPhiMediaSpace, readPhiMediaSpaces, } from "./phi-image-preview-data";
|
|
7
4
|
import { PHI_ASSET_CONTROLLER_STORE_KEY, } from "./asset-controller-signals";
|
|
8
|
-
import {
|
|
5
|
+
import { setPhiImagePreviewResults, } from "./phi-image-preview-store";
|
|
9
6
|
export const PHI_ASSET_COLLECTION_DATA_SOURCE = {
|
|
10
7
|
providerKey: PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.collection,
|
|
11
8
|
resourceKey: "assets",
|
|
@@ -28,100 +25,12 @@ export function buildPhiAssetCollectionQuery(state) {
|
|
|
28
25
|
},
|
|
29
26
|
};
|
|
30
27
|
}
|
|
31
|
-
export function applyPhiAssetCollectionData(data
|
|
28
|
+
export function applyPhiAssetCollectionData(data) {
|
|
32
29
|
setPhiImagePreviewResults(PHI_ASSET_CONTROLLER_STORE_KEY, {
|
|
33
30
|
activeSpace: readPhiMediaSpace(data.meta?.activeSpace),
|
|
34
31
|
spaces: readPhiMediaSpaces(data.meta?.spaces),
|
|
35
32
|
assets: readPhiMediaAssetTiles(data.items),
|
|
36
33
|
folders: readPhiMediaFolders(data.meta?.folders),
|
|
37
34
|
pagination: readPhiMediaPagination(data.meta?.pagination),
|
|
38
|
-
resolvedCollectionRequestKey,
|
|
39
35
|
});
|
|
40
36
|
}
|
|
41
|
-
export function usePhiAssetCollectionRuntime(source, enabled = true) {
|
|
42
|
-
const state = usePhiImagePreviewStore(PHI_ASSET_CONTROLLER_STORE_KEY);
|
|
43
|
-
const { provider, bindingError } = usePhiCollectionProvider(source);
|
|
44
|
-
const { presentationFlags, folderId, kind, page, pageSize, searchQuery, since, until, spaceAddress, resolvedCollectionRequestKey, } = state;
|
|
45
|
-
// Only a surface that may name a Space carries one into the query; everywhere else this stays null
|
|
46
|
-
// and the request asks for the Site Space.
|
|
47
|
-
const spaceSelectionAllowed = usePhiMediaSpaceSelectionAllowed();
|
|
48
|
-
const query = useMemo(() => buildPhiAssetCollectionQuery({
|
|
49
|
-
presentationFlags,
|
|
50
|
-
folderId,
|
|
51
|
-
kind,
|
|
52
|
-
page,
|
|
53
|
-
pageSize,
|
|
54
|
-
searchQuery,
|
|
55
|
-
since,
|
|
56
|
-
until,
|
|
57
|
-
spaceAddress: spaceSelectionAllowed ? spaceAddress : null,
|
|
58
|
-
}), [
|
|
59
|
-
presentationFlags,
|
|
60
|
-
folderId,
|
|
61
|
-
kind,
|
|
62
|
-
page,
|
|
63
|
-
pageSize,
|
|
64
|
-
searchQuery,
|
|
65
|
-
since,
|
|
66
|
-
spaceAddress,
|
|
67
|
-
spaceSelectionAllowed,
|
|
68
|
-
until,
|
|
69
|
-
]);
|
|
70
|
-
const requestKey = useMemo(() => JSON.stringify([
|
|
71
|
-
source?.providerKey ?? null,
|
|
72
|
-
source?.resourceKey ?? null,
|
|
73
|
-
source?.params ?? null,
|
|
74
|
-
query,
|
|
75
|
-
state.refreshToken,
|
|
76
|
-
]), [query, source, state.refreshToken]);
|
|
77
|
-
useEffect(() => {
|
|
78
|
-
if (!enabled) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (!source || !provider) {
|
|
82
|
-
queueMicrotask(() => {
|
|
83
|
-
setPhiImagePreviewError(PHI_ASSET_CONTROLLER_STORE_KEY, bindingError ?? "Media collection provider is unavailable.");
|
|
84
|
-
});
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (resolvedCollectionRequestKey === requestKey) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
const abortController = new AbortController();
|
|
91
|
-
queueMicrotask(() => {
|
|
92
|
-
if (!abortController.signal.aborted) {
|
|
93
|
-
setPhiImagePreviewLoading(PHI_ASSET_CONTROLLER_STORE_KEY, true);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
void provider.query({
|
|
97
|
-
resourceKey: source.resourceKey,
|
|
98
|
-
query,
|
|
99
|
-
params: source.params,
|
|
100
|
-
signal: abortController.signal,
|
|
101
|
-
}).then((data) => {
|
|
102
|
-
if (abortController.signal.aborted) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
if (data.error) {
|
|
106
|
-
setPhiImagePreviewError(PHI_ASSET_CONTROLLER_STORE_KEY, data.error);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
applyPhiAssetCollectionData(data, requestKey);
|
|
110
|
-
}
|
|
111
|
-
}).catch((error) => {
|
|
112
|
-
if (!abortController.signal.aborted) {
|
|
113
|
-
setPhiImagePreviewError(PHI_ASSET_CONTROLLER_STORE_KEY, error instanceof Error ? error.message : "Failed to load media assets.");
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
return () => abortController.abort();
|
|
117
|
-
}, [
|
|
118
|
-
bindingError,
|
|
119
|
-
enabled,
|
|
120
|
-
provider,
|
|
121
|
-
query,
|
|
122
|
-
requestKey,
|
|
123
|
-
resolvedCollectionRequestKey,
|
|
124
|
-
source,
|
|
125
|
-
]);
|
|
126
|
-
return { state, query };
|
|
127
|
-
}
|
|
@@ -9,6 +9,11 @@ const PHI_MEDIA_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
9
9
|
tool_search_placeholder: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.searchPlaceholder,
|
|
10
10
|
tool_folder_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.folderLabel,
|
|
11
11
|
tool_create_folder_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.createFolderLabel,
|
|
12
|
+
tool_folder_locked_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.folderLockedLabel,
|
|
13
|
+
tool_lock_folder_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.lockFolderLabel,
|
|
14
|
+
tool_unlock_folder_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.unlockFolderLabel,
|
|
15
|
+
tool_folder_locked_text: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.folderLockedText),
|
|
16
|
+
tool_folder_lock_failed_text: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.folderLockFailedText),
|
|
12
17
|
tool_flags_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.flagsLabel,
|
|
13
18
|
tool_flag_placeholder: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.flagPlaceholder,
|
|
14
19
|
tool_upload_toggle_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.tool.uploadToggleLabel,
|
|
@@ -38,6 +43,7 @@ const PHI_MEDIA_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
38
43
|
upload_upload_success_template: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.upload.uploadSuccessTemplate),
|
|
39
44
|
upload_upload_failed_text: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.upload.uploadFailedText),
|
|
40
45
|
upload_storage_unreachable_text: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.upload.uploadStorageUnreachableText),
|
|
46
|
+
upload_folder_locked_text: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.upload.uploadFolderLockedText),
|
|
41
47
|
upload_delete_failed_text: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.upload.deleteFailedText),
|
|
42
48
|
grid_empty_description: definePhiMessageLabel(PHI_MEDIA_WIDGET_DEFAULT_LABELS.grid.emptyDescription),
|
|
43
49
|
grid_delete_label: PHI_MEDIA_WIDGET_DEFAULT_LABELS.grid.deleteLabel,
|
|
@@ -110,6 +116,11 @@ export async function getPhiMediaWidgetLabels(options) {
|
|
|
110
116
|
searchPlaceholder: labels.tool_search_placeholder,
|
|
111
117
|
folderLabel: labels.tool_folder_label,
|
|
112
118
|
createFolderLabel: labels.tool_create_folder_label,
|
|
119
|
+
folderLockedLabel: labels.tool_folder_locked_label,
|
|
120
|
+
lockFolderLabel: labels.tool_lock_folder_label,
|
|
121
|
+
unlockFolderLabel: labels.tool_unlock_folder_label,
|
|
122
|
+
folderLockedText: labels.tool_folder_locked_text,
|
|
123
|
+
folderLockFailedText: labels.tool_folder_lock_failed_text,
|
|
113
124
|
flagsLabel: labels.tool_flags_label,
|
|
114
125
|
flagPlaceholder: labels.tool_flag_placeholder,
|
|
115
126
|
uploadToggleLabel: labels.tool_upload_toggle_label,
|
|
@@ -141,6 +152,7 @@ export async function getPhiMediaWidgetLabels(options) {
|
|
|
141
152
|
uploadSuccessTemplate: labels.upload_upload_success_template,
|
|
142
153
|
uploadFailedText: labels.upload_upload_failed_text,
|
|
143
154
|
uploadStorageUnreachableText: labels.upload_storage_unreachable_text,
|
|
155
|
+
uploadFolderLockedText: labels.upload_folder_locked_text,
|
|
144
156
|
deleteFailedText: labels.upload_delete_failed_text,
|
|
145
157
|
},
|
|
146
158
|
grid: {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PhiMediaAssetFolder } from "../../types/media";
|
|
2
|
+
/** The code Core answers a write that touches a locked Folder with (`409`). */
|
|
3
|
+
export declare const PHI_MEDIA_FOLDER_LOCKED_CODE = "media_folder_locked";
|
|
4
|
+
/**
|
|
5
|
+
* The reason the upload route gives for the same refusal. The upload path names its refusals in a
|
|
6
|
+
* vocabulary of its own (`readPhiMediaUploadErrorMessage`), and this is the word it uses for a lock.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PHI_MEDIA_UPLOAD_FOLDER_LOCKED_CODE = "folder_locked";
|
|
9
|
+
export declare function isPhiMediaFolderLocked(folder: Pick<PhiMediaAssetFolder, "flags"> | null | undefined): boolean;
|
|
10
|
+
/** Whether the Folder with this id is locked; the root and a Folder not in the list are not. */
|
|
11
|
+
export declare function isPhiMediaFolderIdLocked(folders: readonly PhiMediaAssetFolder[], folderId: number | null | undefined): boolean;
|
|
12
|
+
/** The Folder's flags with the lock set or cleared, every other flag left as it was. */
|
|
13
|
+
export declare function writePhiMediaFolderLock(flags: number, locked: boolean): number;
|
|
14
|
+
/** A refusal because a Folder is locked, carried with Core's code so a surface can read it as one. */
|
|
15
|
+
export declare class PhiMediaFolderLockedError extends Error {
|
|
16
|
+
readonly code = "media_folder_locked";
|
|
17
|
+
constructor(message?: string);
|
|
18
|
+
}
|
|
19
|
+
export declare function isPhiMediaFolderLockedError(error: unknown): boolean;
|