@contentstack/live-preview-utils 3.3.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/legacy/common/inIframe.cjs +15 -2
- package/dist/legacy/common/inIframe.cjs.map +1 -1
- package/dist/legacy/common/inIframe.d.cts +2 -1
- package/dist/legacy/common/inIframe.d.ts +2 -1
- package/dist/legacy/common/inIframe.js +13 -1
- package/dist/legacy/common/inIframe.js.map +1 -1
- package/dist/legacy/light-sdk.cjs +1 -1
- package/dist/legacy/light-sdk.js +1 -1
- package/dist/legacy/livePreview/editButton/editButton.cjs +1 -1
- package/dist/legacy/livePreview/editButton/editButton.cjs.map +1 -1
- package/dist/legacy/livePreview/editButton/editButton.js +2 -2
- package/dist/legacy/livePreview/editButton/editButton.js.map +1 -1
- package/dist/legacy/livePreview/eventManager/livePreviewEventManager.cjs +7 -2
- package/dist/legacy/livePreview/eventManager/livePreviewEventManager.cjs.map +1 -1
- package/dist/legacy/livePreview/eventManager/livePreviewEventManager.js +7 -2
- package/dist/legacy/livePreview/eventManager/livePreviewEventManager.js.map +1 -1
- package/dist/legacy/livePreview/eventManager/postMessageEvent.hooks.cjs +44 -8
- package/dist/legacy/livePreview/eventManager/postMessageEvent.hooks.cjs.map +1 -1
- package/dist/legacy/livePreview/eventManager/postMessageEvent.hooks.js +47 -9
- package/dist/legacy/livePreview/eventManager/postMessageEvent.hooks.js.map +1 -1
- package/dist/legacy/livePreview/eventManager/types/livePreviewPostMessageEvent.type.cjs +15 -0
- package/dist/legacy/livePreview/eventManager/types/livePreviewPostMessageEvent.type.cjs.map +1 -1
- package/dist/legacy/livePreview/eventManager/types/livePreviewPostMessageEvent.type.d.cts +11 -1
- package/dist/legacy/livePreview/eventManager/types/livePreviewPostMessageEvent.type.d.ts +11 -1
- package/dist/legacy/livePreview/eventManager/types/livePreviewPostMessageEvent.type.js +10 -0
- package/dist/legacy/livePreview/eventManager/types/livePreviewPostMessageEvent.type.js.map +1 -1
- package/dist/legacy/preview/contentstack-live-preview-HOC.cjs +1 -1
- package/dist/legacy/preview/contentstack-live-preview-HOC.js +1 -1
- package/dist/legacy/utils/addLivePreviewQueryTags.cjs +7 -1
- package/dist/legacy/utils/addLivePreviewQueryTags.cjs.map +1 -1
- package/dist/legacy/utils/addLivePreviewQueryTags.js +7 -1
- package/dist/legacy/utils/addLivePreviewQueryTags.js.map +1 -1
- package/dist/legacy/utils/index.cjs +8 -4
- package/dist/legacy/utils/index.cjs.map +1 -1
- package/dist/legacy/utils/index.js +8 -4
- package/dist/legacy/utils/index.js.map +1 -1
- package/dist/legacy/visualBuilder/components/FieldLocationAppList.cjs +186 -0
- package/dist/legacy/visualBuilder/components/FieldLocationAppList.cjs.map +1 -0
- package/dist/legacy/visualBuilder/components/FieldLocationAppList.d.cts +35 -0
- package/dist/legacy/visualBuilder/components/FieldLocationAppList.d.ts +35 -0
- package/dist/legacy/visualBuilder/components/FieldLocationAppList.js +153 -0
- package/dist/legacy/visualBuilder/components/FieldLocationAppList.js.map +1 -0
- package/dist/legacy/visualBuilder/components/FieldLocationIcon.cjs +125 -0
- package/dist/legacy/visualBuilder/components/FieldLocationIcon.cjs.map +1 -0
- package/dist/legacy/visualBuilder/components/FieldLocationIcon.d.cts +13 -0
- package/dist/legacy/visualBuilder/components/FieldLocationIcon.d.ts +13 -0
- package/dist/legacy/visualBuilder/components/FieldLocationIcon.js +92 -0
- package/dist/legacy/visualBuilder/components/FieldLocationIcon.js.map +1 -0
- package/dist/legacy/visualBuilder/components/FieldToolbar.cjs +185 -117
- package/dist/legacy/visualBuilder/components/FieldToolbar.cjs.map +1 -1
- package/dist/legacy/visualBuilder/components/FieldToolbar.d.cts +3 -1
- package/dist/legacy/visualBuilder/components/FieldToolbar.d.ts +3 -1
- package/dist/legacy/visualBuilder/components/FieldToolbar.js +186 -118
- package/dist/legacy/visualBuilder/components/FieldToolbar.js.map +1 -1
- package/dist/legacy/visualBuilder/components/emptyBlock.cjs +26 -5
- package/dist/legacy/visualBuilder/components/emptyBlock.cjs.map +1 -1
- package/dist/legacy/visualBuilder/components/emptyBlock.js +26 -5
- package/dist/legacy/visualBuilder/components/emptyBlock.js.map +1 -1
- package/dist/legacy/visualBuilder/components/fieldLabelWrapper.cjs +6 -4
- package/dist/legacy/visualBuilder/components/fieldLabelWrapper.cjs.map +1 -1
- package/dist/legacy/visualBuilder/components/fieldLabelWrapper.js +6 -4
- package/dist/legacy/visualBuilder/components/fieldLabelWrapper.js.map +1 -1
- package/dist/legacy/visualBuilder/components/icons/EmptyAppIcon.cjs +78 -0
- package/dist/legacy/visualBuilder/components/icons/EmptyAppIcon.cjs.map +1 -0
- package/dist/legacy/visualBuilder/components/icons/EmptyAppIcon.d.cts +9 -0
- package/dist/legacy/visualBuilder/components/icons/EmptyAppIcon.d.ts +9 -0
- package/dist/legacy/visualBuilder/components/icons/EmptyAppIcon.js +53 -0
- package/dist/legacy/visualBuilder/components/icons/EmptyAppIcon.js.map +1 -0
- package/dist/legacy/visualBuilder/components/icons/index.cjs +19 -0
- package/dist/legacy/visualBuilder/components/icons/index.cjs.map +1 -1
- package/dist/legacy/visualBuilder/components/icons/index.d.cts +2 -1
- package/dist/legacy/visualBuilder/components/icons/index.d.ts +2 -1
- package/dist/legacy/visualBuilder/components/icons/index.js +18 -0
- package/dist/legacy/visualBuilder/components/icons/index.js.map +1 -1
- package/dist/legacy/visualBuilder/generators/generateToolbar.cjs +8 -5
- package/dist/legacy/visualBuilder/generators/generateToolbar.cjs.map +1 -1
- package/dist/legacy/visualBuilder/generators/generateToolbar.js +8 -5
- package/dist/legacy/visualBuilder/generators/generateToolbar.js.map +1 -1
- package/dist/legacy/visualBuilder/index.cjs +11 -1
- package/dist/legacy/visualBuilder/index.cjs.map +1 -1
- package/dist/legacy/visualBuilder/index.js +11 -1
- package/dist/legacy/visualBuilder/index.js.map +1 -1
- package/dist/legacy/visualBuilder/listeners/mouseClick.cjs +16 -17
- package/dist/legacy/visualBuilder/listeners/mouseClick.cjs.map +1 -1
- package/dist/legacy/visualBuilder/listeners/mouseClick.js +16 -17
- package/dist/legacy/visualBuilder/listeners/mouseClick.js.map +1 -1
- package/dist/legacy/visualBuilder/listeners/mouseHover.cjs +67 -59
- package/dist/legacy/visualBuilder/listeners/mouseHover.cjs.map +1 -1
- package/dist/legacy/visualBuilder/listeners/mouseHover.js +67 -59
- package/dist/legacy/visualBuilder/listeners/mouseHover.js.map +1 -1
- package/dist/legacy/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.cjs +72 -0
- package/dist/legacy/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.cjs.map +1 -0
- package/dist/legacy/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.d.cts +14 -0
- package/dist/legacy/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.d.ts +14 -0
- package/dist/legacy/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.js +49 -0
- package/dist/legacy/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.js.map +1 -0
- package/dist/legacy/visualBuilder/utils/getEntryPermissions.cjs +2 -1
- package/dist/legacy/visualBuilder/utils/getEntryPermissions.cjs.map +1 -1
- package/dist/legacy/visualBuilder/utils/getEntryPermissions.js +2 -1
- package/dist/legacy/visualBuilder/utils/getEntryPermissions.js.map +1 -1
- package/dist/legacy/visualBuilder/utils/getWorkflowStageDetails.cjs +79 -0
- package/dist/legacy/visualBuilder/utils/getWorkflowStageDetails.cjs.map +1 -0
- package/dist/legacy/visualBuilder/utils/getWorkflowStageDetails.d.cts +18 -0
- package/dist/legacy/visualBuilder/utils/getWorkflowStageDetails.d.ts +18 -0
- package/dist/legacy/visualBuilder/utils/getWorkflowStageDetails.js +46 -0
- package/dist/legacy/visualBuilder/utils/getWorkflowStageDetails.js.map +1 -0
- package/dist/legacy/visualBuilder/utils/handleIndividualFields.cjs +4 -3
- package/dist/legacy/visualBuilder/utils/handleIndividualFields.cjs.map +1 -1
- package/dist/legacy/visualBuilder/utils/handleIndividualFields.js +4 -3
- package/dist/legacy/visualBuilder/utils/handleIndividualFields.js.map +1 -1
- package/dist/legacy/visualBuilder/utils/isFieldDisabled.cjs +43 -14
- package/dist/legacy/visualBuilder/utils/isFieldDisabled.cjs.map +1 -1
- package/dist/legacy/visualBuilder/utils/isFieldDisabled.d.cts +3 -12
- package/dist/legacy/visualBuilder/utils/isFieldDisabled.d.ts +3 -12
- package/dist/legacy/visualBuilder/utils/isFieldDisabled.js +43 -14
- package/dist/legacy/visualBuilder/utils/isFieldDisabled.js.map +1 -1
- package/dist/legacy/visualBuilder/utils/types/postMessage.types.cjs +5 -0
- package/dist/legacy/visualBuilder/utils/types/postMessage.types.cjs.map +1 -1
- package/dist/legacy/visualBuilder/utils/types/postMessage.types.d.cts +6 -1
- package/dist/legacy/visualBuilder/utils/types/postMessage.types.d.ts +6 -1
- package/dist/legacy/visualBuilder/utils/types/postMessage.types.js +5 -0
- package/dist/legacy/visualBuilder/utils/types/postMessage.types.js.map +1 -1
- package/dist/legacy/visualBuilder/utils/updateFocussedState.cjs +6 -4
- package/dist/legacy/visualBuilder/utils/updateFocussedState.cjs.map +1 -1
- package/dist/legacy/visualBuilder/utils/updateFocussedState.js +6 -4
- package/dist/legacy/visualBuilder/utils/updateFocussedState.js.map +1 -1
- package/dist/legacy/visualBuilder/visualBuilder.style.cjs +118 -3
- package/dist/legacy/visualBuilder/visualBuilder.style.cjs.map +1 -1
- package/dist/legacy/visualBuilder/visualBuilder.style.d.cts +18 -0
- package/dist/legacy/visualBuilder/visualBuilder.style.d.ts +18 -0
- package/dist/legacy/visualBuilder/visualBuilder.style.js +118 -3
- package/dist/legacy/visualBuilder/visualBuilder.style.js.map +1 -1
- package/dist/modern/common/inIframe.cjs +15 -2
- package/dist/modern/common/inIframe.cjs.map +1 -1
- package/dist/modern/common/inIframe.d.cts +2 -1
- package/dist/modern/common/inIframe.d.ts +2 -1
- package/dist/modern/common/inIframe.js +13 -1
- package/dist/modern/common/inIframe.js.map +1 -1
- package/dist/modern/light-sdk.cjs +1 -1
- package/dist/modern/light-sdk.js +1 -1
- package/dist/modern/livePreview/editButton/editButton.cjs +1 -1
- package/dist/modern/livePreview/editButton/editButton.cjs.map +1 -1
- package/dist/modern/livePreview/editButton/editButton.js +2 -2
- package/dist/modern/livePreview/editButton/editButton.js.map +1 -1
- package/dist/modern/livePreview/eventManager/livePreviewEventManager.cjs +7 -2
- package/dist/modern/livePreview/eventManager/livePreviewEventManager.cjs.map +1 -1
- package/dist/modern/livePreview/eventManager/livePreviewEventManager.js +7 -2
- package/dist/modern/livePreview/eventManager/livePreviewEventManager.js.map +1 -1
- package/dist/modern/livePreview/eventManager/postMessageEvent.hooks.cjs +43 -8
- package/dist/modern/livePreview/eventManager/postMessageEvent.hooks.cjs.map +1 -1
- package/dist/modern/livePreview/eventManager/postMessageEvent.hooks.js +46 -9
- package/dist/modern/livePreview/eventManager/postMessageEvent.hooks.js.map +1 -1
- package/dist/modern/livePreview/eventManager/types/livePreviewPostMessageEvent.type.cjs +15 -0
- package/dist/modern/livePreview/eventManager/types/livePreviewPostMessageEvent.type.cjs.map +1 -1
- package/dist/modern/livePreview/eventManager/types/livePreviewPostMessageEvent.type.d.cts +11 -1
- package/dist/modern/livePreview/eventManager/types/livePreviewPostMessageEvent.type.d.ts +11 -1
- package/dist/modern/livePreview/eventManager/types/livePreviewPostMessageEvent.type.js +10 -0
- package/dist/modern/livePreview/eventManager/types/livePreviewPostMessageEvent.type.js.map +1 -1
- package/dist/modern/preview/contentstack-live-preview-HOC.cjs +1 -1
- package/dist/modern/preview/contentstack-live-preview-HOC.js +1 -1
- package/dist/modern/utils/addLivePreviewQueryTags.cjs +7 -1
- package/dist/modern/utils/addLivePreviewQueryTags.cjs.map +1 -1
- package/dist/modern/utils/addLivePreviewQueryTags.js +7 -1
- package/dist/modern/utils/addLivePreviewQueryTags.js.map +1 -1
- package/dist/modern/utils/index.cjs +8 -4
- package/dist/modern/utils/index.cjs.map +1 -1
- package/dist/modern/utils/index.js +8 -4
- package/dist/modern/utils/index.js.map +1 -1
- package/dist/modern/visualBuilder/components/FieldLocationAppList.cjs +185 -0
- package/dist/modern/visualBuilder/components/FieldLocationAppList.cjs.map +1 -0
- package/dist/modern/visualBuilder/components/FieldLocationAppList.d.cts +35 -0
- package/dist/modern/visualBuilder/components/FieldLocationAppList.d.ts +35 -0
- package/dist/modern/visualBuilder/components/FieldLocationAppList.js +152 -0
- package/dist/modern/visualBuilder/components/FieldLocationAppList.js.map +1 -0
- package/dist/modern/visualBuilder/components/FieldLocationIcon.cjs +123 -0
- package/dist/modern/visualBuilder/components/FieldLocationIcon.cjs.map +1 -0
- package/dist/modern/visualBuilder/components/FieldLocationIcon.d.cts +13 -0
- package/dist/modern/visualBuilder/components/FieldLocationIcon.d.ts +13 -0
- package/dist/modern/visualBuilder/components/FieldLocationIcon.js +90 -0
- package/dist/modern/visualBuilder/components/FieldLocationIcon.js.map +1 -0
- package/dist/modern/visualBuilder/components/FieldToolbar.cjs +184 -117
- package/dist/modern/visualBuilder/components/FieldToolbar.cjs.map +1 -1
- package/dist/modern/visualBuilder/components/FieldToolbar.d.cts +3 -1
- package/dist/modern/visualBuilder/components/FieldToolbar.d.ts +3 -1
- package/dist/modern/visualBuilder/components/FieldToolbar.js +185 -118
- package/dist/modern/visualBuilder/components/FieldToolbar.js.map +1 -1
- package/dist/modern/visualBuilder/components/emptyBlock.cjs +26 -5
- package/dist/modern/visualBuilder/components/emptyBlock.cjs.map +1 -1
- package/dist/modern/visualBuilder/components/emptyBlock.js +26 -5
- package/dist/modern/visualBuilder/components/emptyBlock.js.map +1 -1
- package/dist/modern/visualBuilder/components/fieldLabelWrapper.cjs +6 -4
- package/dist/modern/visualBuilder/components/fieldLabelWrapper.cjs.map +1 -1
- package/dist/modern/visualBuilder/components/fieldLabelWrapper.js +6 -4
- package/dist/modern/visualBuilder/components/fieldLabelWrapper.js.map +1 -1
- package/dist/modern/visualBuilder/components/icons/EmptyAppIcon.cjs +78 -0
- package/dist/modern/visualBuilder/components/icons/EmptyAppIcon.cjs.map +1 -0
- package/dist/modern/visualBuilder/components/icons/EmptyAppIcon.d.cts +9 -0
- package/dist/modern/visualBuilder/components/icons/EmptyAppIcon.d.ts +9 -0
- package/dist/modern/visualBuilder/components/icons/EmptyAppIcon.js +53 -0
- package/dist/modern/visualBuilder/components/icons/EmptyAppIcon.js.map +1 -0
- package/dist/modern/visualBuilder/components/icons/index.cjs +19 -0
- package/dist/modern/visualBuilder/components/icons/index.cjs.map +1 -1
- package/dist/modern/visualBuilder/components/icons/index.d.cts +2 -1
- package/dist/modern/visualBuilder/components/icons/index.d.ts +2 -1
- package/dist/modern/visualBuilder/components/icons/index.js +18 -0
- package/dist/modern/visualBuilder/components/icons/index.js.map +1 -1
- package/dist/modern/visualBuilder/generators/generateToolbar.cjs +8 -5
- package/dist/modern/visualBuilder/generators/generateToolbar.cjs.map +1 -1
- package/dist/modern/visualBuilder/generators/generateToolbar.js +8 -5
- package/dist/modern/visualBuilder/generators/generateToolbar.js.map +1 -1
- package/dist/modern/visualBuilder/index.cjs +10 -0
- package/dist/modern/visualBuilder/index.cjs.map +1 -1
- package/dist/modern/visualBuilder/index.js +10 -0
- package/dist/modern/visualBuilder/index.js.map +1 -1
- package/dist/modern/visualBuilder/listeners/mouseClick.cjs +16 -17
- package/dist/modern/visualBuilder/listeners/mouseClick.cjs.map +1 -1
- package/dist/modern/visualBuilder/listeners/mouseClick.js +16 -17
- package/dist/modern/visualBuilder/listeners/mouseClick.js.map +1 -1
- package/dist/modern/visualBuilder/listeners/mouseHover.cjs +67 -59
- package/dist/modern/visualBuilder/listeners/mouseHover.cjs.map +1 -1
- package/dist/modern/visualBuilder/listeners/mouseHover.js +67 -59
- package/dist/modern/visualBuilder/listeners/mouseHover.js.map +1 -1
- package/dist/modern/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.cjs +72 -0
- package/dist/modern/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.cjs.map +1 -0
- package/dist/modern/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.d.cts +14 -0
- package/dist/modern/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.d.ts +14 -0
- package/dist/modern/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.js +49 -0
- package/dist/modern/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.js.map +1 -0
- package/dist/modern/visualBuilder/utils/getEntryPermissions.cjs +2 -1
- package/dist/modern/visualBuilder/utils/getEntryPermissions.cjs.map +1 -1
- package/dist/modern/visualBuilder/utils/getEntryPermissions.js +2 -1
- package/dist/modern/visualBuilder/utils/getEntryPermissions.js.map +1 -1
- package/dist/modern/visualBuilder/utils/getWorkflowStageDetails.cjs +78 -0
- package/dist/modern/visualBuilder/utils/getWorkflowStageDetails.cjs.map +1 -0
- package/dist/modern/visualBuilder/utils/getWorkflowStageDetails.d.cts +18 -0
- package/dist/modern/visualBuilder/utils/getWorkflowStageDetails.d.ts +18 -0
- package/dist/modern/visualBuilder/utils/getWorkflowStageDetails.js +45 -0
- package/dist/modern/visualBuilder/utils/getWorkflowStageDetails.js.map +1 -0
- package/dist/modern/visualBuilder/utils/handleIndividualFields.cjs +4 -3
- package/dist/modern/visualBuilder/utils/handleIndividualFields.cjs.map +1 -1
- package/dist/modern/visualBuilder/utils/handleIndividualFields.js +4 -3
- package/dist/modern/visualBuilder/utils/handleIndividualFields.js.map +1 -1
- package/dist/modern/visualBuilder/utils/isFieldDisabled.cjs +42 -13
- package/dist/modern/visualBuilder/utils/isFieldDisabled.cjs.map +1 -1
- package/dist/modern/visualBuilder/utils/isFieldDisabled.d.cts +3 -12
- package/dist/modern/visualBuilder/utils/isFieldDisabled.d.ts +3 -12
- package/dist/modern/visualBuilder/utils/isFieldDisabled.js +42 -13
- package/dist/modern/visualBuilder/utils/isFieldDisabled.js.map +1 -1
- package/dist/modern/visualBuilder/utils/types/postMessage.types.cjs +5 -0
- package/dist/modern/visualBuilder/utils/types/postMessage.types.cjs.map +1 -1
- package/dist/modern/visualBuilder/utils/types/postMessage.types.d.cts +6 -1
- package/dist/modern/visualBuilder/utils/types/postMessage.types.d.ts +6 -1
- package/dist/modern/visualBuilder/utils/types/postMessage.types.js +5 -0
- package/dist/modern/visualBuilder/utils/types/postMessage.types.js.map +1 -1
- package/dist/modern/visualBuilder/utils/updateFocussedState.cjs +6 -4
- package/dist/modern/visualBuilder/utils/updateFocussedState.cjs.map +1 -1
- package/dist/modern/visualBuilder/utils/updateFocussedState.js +6 -4
- package/dist/modern/visualBuilder/utils/updateFocussedState.js.map +1 -1
- package/dist/modern/visualBuilder/visualBuilder.style.cjs +118 -3
- package/dist/modern/visualBuilder/visualBuilder.style.cjs.map +1 -1
- package/dist/modern/visualBuilder/visualBuilder.style.d.cts +18 -0
- package/dist/modern/visualBuilder/visualBuilder.style.d.ts +18 -0
- package/dist/modern/visualBuilder/visualBuilder.style.js +118 -3
- package/dist/modern/visualBuilder/visualBuilder.style.js.map +1 -1
- package/package.json +1 -1
|
@@ -50,8 +50,8 @@ var import_visualBuilder = require("../visualBuilder.style.cjs");
|
|
|
50
50
|
var import__2 = require("../../index.cjs");
|
|
51
51
|
var import_configManager = __toESM(require("../../configManager/configManager.cjs"), 1);
|
|
52
52
|
var import_generateThread = require("../generators/generateThread.cjs");
|
|
53
|
-
var import_getEntryPermissionsCached = require("../utils/getEntryPermissionsCached.cjs");
|
|
54
53
|
var import_generateToolbar = require("../generators/generateToolbar.cjs");
|
|
54
|
+
var import_fetchEntryPermissionsAndStageDetails = require("../utils/fetchEntryPermissionsAndStageDetails.cjs");
|
|
55
55
|
var config = import_configManager.default.get();
|
|
56
56
|
function resetCustomCursor(customCursor) {
|
|
57
57
|
if (customCursor) {
|
|
@@ -76,38 +76,38 @@ function handleCursorPosition(event, customCursor) {
|
|
|
76
76
|
customCursor.style.top = `${mouseY}px`;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
function addOutline(params) {
|
|
79
|
+
async function addOutline(params) {
|
|
80
80
|
if (!params) {
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
|
-
const {
|
|
83
|
+
const {
|
|
84
|
+
editableElement,
|
|
85
|
+
eventDetails,
|
|
86
|
+
content_type_uid,
|
|
87
|
+
fieldPath,
|
|
88
|
+
fieldMetadata,
|
|
89
|
+
fieldDisabled
|
|
90
|
+
} = params;
|
|
84
91
|
if (!editableElement) return;
|
|
85
92
|
(0, import_generateHoverOutline.addHoverOutline)(editableElement, fieldDisabled);
|
|
86
|
-
import_fieldSchemaMap.FieldSchemaMap.getFieldSchema(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const { isDisabled: fieldDisabled2 } = (0, import_isFieldDisabled.isFieldDisabled)(
|
|
103
|
-
fieldSchema,
|
|
104
|
-
eventDetails,
|
|
105
|
-
entryAcl
|
|
106
|
-
);
|
|
107
|
-
(0, import_generateHoverOutline.addHoverOutline)(editableElement, fieldDisabled2);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
93
|
+
const fieldSchema = await import_fieldSchemaMap.FieldSchemaMap.getFieldSchema(
|
|
94
|
+
content_type_uid,
|
|
95
|
+
fieldPath
|
|
96
|
+
);
|
|
97
|
+
if (!fieldSchema) return;
|
|
98
|
+
const { acl: entryAcl, workflowStage: entryWorkflowStageDetails } = await (0, import_fetchEntryPermissionsAndStageDetails.fetchEntryPermissionsAndStageDetails)({
|
|
99
|
+
entryUid: fieldMetadata.entry_uid,
|
|
100
|
+
contentTypeUid: fieldMetadata.content_type_uid,
|
|
101
|
+
locale: fieldMetadata.locale,
|
|
102
|
+
variantUid: fieldMetadata.variant
|
|
103
|
+
});
|
|
104
|
+
const { isDisabled } = (0, import_isFieldDisabled.isFieldDisabled)(
|
|
105
|
+
fieldSchema,
|
|
106
|
+
eventDetails,
|
|
107
|
+
entryAcl,
|
|
108
|
+
entryWorkflowStageDetails
|
|
110
109
|
);
|
|
110
|
+
(0, import_generateHoverOutline.addHoverOutline)(editableElement, fieldDisabled || isDisabled);
|
|
111
111
|
}
|
|
112
112
|
var debouncedAddOutline = (0, import_lodash_es.debounce)(addOutline, 50, { trailing: true });
|
|
113
113
|
var showOutline = (params) => debouncedAddOutline(params);
|
|
@@ -172,6 +172,9 @@ function isContentEditable(target) {
|
|
|
172
172
|
function isFieldPathDropdown(target) {
|
|
173
173
|
return target.classList.contains("visual-builder__focused-toolbar__field-label-wrapper") || target.classList.contains("visual-builder__focused-toolbar__field-label-wrapper__current-field");
|
|
174
174
|
}
|
|
175
|
+
function isFieldPathParent(target) {
|
|
176
|
+
return target.classList.contains("visual-builder__focused-toolbar__field-label-wrapper__parent-field");
|
|
177
|
+
}
|
|
175
178
|
var throttledMouseHover = (0, import_lodash_es.throttle)(async (params) => {
|
|
176
179
|
const eventDetails = (0, import_getCsDataOfElement.getCsDataOfElement)(params.event);
|
|
177
180
|
const eventTarget = params.event.target;
|
|
@@ -185,7 +188,7 @@ var throttledMouseHover = (0, import_lodash_es.throttle)(async (params) => {
|
|
|
185
188
|
hideCustomCursor(params.customCursor);
|
|
186
189
|
return;
|
|
187
190
|
}
|
|
188
|
-
if (eventTarget && isFieldPathDropdown(eventTarget)) {
|
|
191
|
+
if (eventTarget && (isFieldPathDropdown(eventTarget) || isFieldPathParent(eventTarget))) {
|
|
189
192
|
params.customCursor && hideCustomCursor(params.customCursor);
|
|
190
193
|
showOutline();
|
|
191
194
|
showHoverToolbar({
|
|
@@ -255,37 +258,10 @@ var throttledMouseHover = (0, import_lodash_es.throttle)(async (params) => {
|
|
|
255
258
|
customCursor: params.customCursor
|
|
256
259
|
});
|
|
257
260
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
(0, import_getEntryPermissionsCached.getEntryPermissionsCached)({
|
|
263
|
-
entryUid: fieldMetadata.entry_uid,
|
|
264
|
-
contentTypeUid: fieldMetadata.content_type_uid,
|
|
265
|
-
locale: fieldMetadata.locale
|
|
266
|
-
}).then((data) => {
|
|
267
|
-
entryAcl = data;
|
|
268
|
-
}).catch((error) => {
|
|
269
|
-
console.error(
|
|
270
|
-
"[Visual Builder] Error retrieving entry permissions:",
|
|
271
|
-
error
|
|
272
|
-
);
|
|
273
|
-
}).finally(() => {
|
|
274
|
-
if (!params.customCursor) return;
|
|
275
|
-
const { isDisabled: fieldDisabled } = (0, import_isFieldDisabled.isFieldDisabled)(
|
|
276
|
-
fieldSchema,
|
|
277
|
-
eventDetails,
|
|
278
|
-
entryAcl
|
|
279
|
-
);
|
|
280
|
-
const fieldType = (0, import_getFieldType.getFieldType)(fieldSchema);
|
|
281
|
-
(0, import_generateCustomCursor.generateCustomCursor)({
|
|
282
|
-
fieldType,
|
|
283
|
-
customCursor: params.customCursor,
|
|
284
|
-
fieldDisabled
|
|
285
|
-
});
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
);
|
|
261
|
+
generateCursor({
|
|
262
|
+
eventDetails,
|
|
263
|
+
customCursor: params.customCursor
|
|
264
|
+
});
|
|
289
265
|
handleCursorPosition(params.event, params.customCursor);
|
|
290
266
|
showCustomCursor(params.customCursor);
|
|
291
267
|
}
|
|
@@ -314,6 +290,38 @@ var throttledMouseHover = (0, import_lodash_es.throttle)(async (params) => {
|
|
|
314
290
|
}
|
|
315
291
|
import__.VisualBuilder.VisualBuilderGlobalState.value.previousHoveredTargetDOM = editableElement;
|
|
316
292
|
}, 10);
|
|
293
|
+
async function generateCursor({
|
|
294
|
+
eventDetails,
|
|
295
|
+
customCursor
|
|
296
|
+
}) {
|
|
297
|
+
if (!customCursor) return;
|
|
298
|
+
const { fieldMetadata } = eventDetails;
|
|
299
|
+
const fieldSchema = await import_fieldSchemaMap.FieldSchemaMap.getFieldSchema(
|
|
300
|
+
fieldMetadata.content_type_uid,
|
|
301
|
+
fieldMetadata.fieldPath
|
|
302
|
+
);
|
|
303
|
+
if (!fieldSchema) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const { acl: entryAcl, workflowStage: entryWorkflowStageDetails } = await (0, import_fetchEntryPermissionsAndStageDetails.fetchEntryPermissionsAndStageDetails)({
|
|
307
|
+
entryUid: fieldMetadata.entry_uid,
|
|
308
|
+
contentTypeUid: fieldMetadata.content_type_uid,
|
|
309
|
+
locale: fieldMetadata.locale,
|
|
310
|
+
variantUid: fieldMetadata.variant
|
|
311
|
+
});
|
|
312
|
+
const { isDisabled: fieldDisabled } = (0, import_isFieldDisabled.isFieldDisabled)(
|
|
313
|
+
fieldSchema,
|
|
314
|
+
eventDetails,
|
|
315
|
+
entryAcl,
|
|
316
|
+
entryWorkflowStageDetails
|
|
317
|
+
);
|
|
318
|
+
const fieldType = (0, import_getFieldType.getFieldType)(fieldSchema);
|
|
319
|
+
(0, import_generateCustomCursor.generateCustomCursor)({
|
|
320
|
+
fieldType,
|
|
321
|
+
customCursor,
|
|
322
|
+
fieldDisabled
|
|
323
|
+
});
|
|
324
|
+
}
|
|
317
325
|
var handleMouseHover = async (params) => await throttledMouseHover(params);
|
|
318
326
|
var mouseHover_default = handleMouseHover;
|
|
319
327
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/visualBuilder/listeners/mouseHover.ts"],"sourcesContent":["import { debounce, throttle } from \"lodash-es\";\nimport { getCsDataOfElement } from \"../utils/getCsDataOfElement\";\nimport { removeAddInstanceButtons } from \"../utils/multipleElementAddButton\";\nimport { generateCustomCursor } from \"../generators/generateCustomCursor\";\nimport { FieldSchemaMap } from \"../utils/fieldSchemaMap\";\nimport { isFieldDisabled } from \"../utils/isFieldDisabled\";\nimport { getFieldType } from \"../utils/getFieldType\";\n\nimport EventListenerHandlerParams from \"./types\";\nimport { VisualBuilder } from \"..\";\nimport { addHoverOutline } from \"../generators/generateHoverOutline\";\nimport { visualBuilderStyles } from \"../visualBuilder.style\";\nimport { VB_EmptyBlockParentClass } from \"../..\";\nimport Config from \"../../configManager/configManager\";\nimport { isCollabThread } from \"../generators/generateThread\";\nimport { getEntryPermissionsCached } from \"../utils/getEntryPermissionsCached\";\nimport { EntryPermissions } from \"../utils/getEntryPermissions\";\nimport visualBuilderPostMessage from \"../utils/visualBuilderPostMessage\";\nimport { VisualBuilderPostMessageEvents } from \"../utils/types/postMessage.types\";\nimport { HandleBuilderInteractionParams } from \"./mouseClick\";\nimport { appendFieldPathDropdown, removeFieldToolbar } from \"../generators/generateToolbar\";\nimport { VisualBuilderCslpEventDetails } from \"../types/visualBuilder.types\";\nimport { CslpData } from \"../../cslp/types/cslp.types\";\n\nconst config = Config.get();\nexport interface HandleMouseHoverParams\n extends Pick<\n EventListenerHandlerParams,\n \"event\" | \"overlayWrapper\" | \"visualBuilderContainer\" | \"focusedToolbar\" | \"resizeObserver\"\n > {\n customCursor: HTMLDivElement | null;\n}\n\ninterface AddOutlineParams {\n editableElement: Element;\n eventDetails: VisualBuilderCslpEventDetails;\n content_type_uid: string;\n fieldPath: string;\n fieldDisabled?: boolean;\n fieldMetadata: CslpData;\n}\n\nfunction resetCustomCursor(customCursor: HTMLDivElement | null): void {\n if (customCursor) {\n generateCustomCursor({\n fieldType: \"empty\",\n customCursor: customCursor,\n });\n }\n}\n\nfunction collabCustomCursor(customCursor: HTMLDivElement | null): void {\n if (!customCursor) return;\n\n generateCustomCursor({\n fieldType: \"discussion\",\n customCursor: customCursor,\n });\n}\n\nfunction handleCursorPosition(\n event: MouseEvent,\n customCursor: HTMLDivElement | null\n): void {\n if (customCursor) {\n const mouseY = event.clientY;\n const mouseX = event.clientX;\n\n customCursor.style.left = `${mouseX}px`;\n customCursor.style.top = `${mouseY}px`;\n }\n}\n\nfunction addOutline(params?: AddOutlineParams): void {\n if(!params) {\n return;\n }\n const { editableElement, eventDetails, content_type_uid, fieldPath, fieldMetadata, fieldDisabled } = params;\n if (!editableElement) return;\n addHoverOutline(editableElement as HTMLElement, fieldDisabled);\n FieldSchemaMap.getFieldSchema(content_type_uid, fieldPath).then(\n (fieldSchema) => {\n let entryAcl: EntryPermissions | undefined;\n if (!fieldSchema) return;\n getEntryPermissionsCached({\n entryUid: fieldMetadata.entry_uid,\n contentTypeUid: fieldMetadata.content_type_uid,\n locale: fieldMetadata.locale,\n })\n .then((data) => {\n entryAcl = data;\n })\n .catch((error) => {\n console.error(\n \"[Visual Builder] Error retrieving entry permissions:\",\n error\n );\n })\n .finally(() => {\n const { isDisabled: fieldDisabled } =\n isFieldDisabled(\n fieldSchema,\n eventDetails,\n entryAcl\n );\n addHoverOutline(editableElement, fieldDisabled);\n });\n }\n );\n}\n\nconst debouncedAddOutline = debounce(addOutline, 50, { trailing: true });\nconst showOutline = (params?: AddOutlineParams): void => debouncedAddOutline(params);\n\nfunction hideDefaultCursor(): void {\n if (\n document?.body &&\n !document.body.classList.contains(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n )\n )\n document.body.classList.add(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n );\n}\n\nfunction showDefaultCursor(): void {\n if (\n document?.body &&\n document.body.classList.contains(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n )\n )\n document.body.classList.remove(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n );\n}\n\nexport function hideHoverOutline(\n visualBuilderContainer: HTMLDivElement | null\n): void {\n if (!visualBuilderContainer) {\n return;\n }\n const hoverOutline = visualBuilderContainer.querySelector(\n \".visual-builder__hover-outline\"\n );\n if (!hoverOutline) {\n return;\n }\n hoverOutline.classList.add(\n visualBuilderStyles()[\"visual-builder__hover-outline--hidden\"]\n );\n}\n\nexport function hideCustomCursor(customCursor: HTMLDivElement | null): void {\n showDefaultCursor();\n customCursor?.classList.remove(\"visible\");\n}\n\nexport function showCustomCursor(customCursor: HTMLDivElement | null): void {\n hideDefaultCursor();\n if (\n config.collab.enable &&\n (!config.collab.isFeedbackMode || config.collab.pauseFeedback)\n )\n return;\n customCursor?.classList.add(\"visible\");\n}\n\nconst debouncedRenderHoverToolbar = debounce(async (params: HandleBuilderInteractionParams) => {\n const eventDetails = getCsDataOfElement(params.event);\n if (\n !eventDetails ||\n !params.overlayWrapper ||\n !params.visualBuilderContainer ||\n !params.focusedToolbar\n ) {\n return;\n }\n\n appendFieldPathDropdown(eventDetails, params.focusedToolbar, {\n isHover: true\n });\n}, 50, { trailing: true });\n\nexport const showHoverToolbar = async (params: HandleBuilderInteractionParams) => await debouncedRenderHoverToolbar(params);\n\nfunction isOverlay(target: HTMLElement): boolean {\n return target.classList.contains(\"visual-builder__overlay\");\n}\n\nfunction isContentEditable(target: HTMLElement): boolean {\n if (target.hasAttribute(\"contenteditable\"))\n return target.getAttribute(\"contenteditable\") === \"true\";\n return false;\n}\n\nfunction isFieldPathDropdown(target: HTMLElement): boolean {\n return target.classList.contains(\"visual-builder__focused-toolbar__field-label-wrapper\") || target.classList.contains(\"visual-builder__focused-toolbar__field-label-wrapper__current-field\");\n}\n\nconst throttledMouseHover = throttle(async (params: HandleMouseHoverParams) => {\n const eventDetails = getCsDataOfElement(params.event);\n const eventTarget = params.event.target as HTMLElement | null;\n\n if (config?.collab.enable && config?.collab.pauseFeedback) {\n hideCustomCursor(params.customCursor);\n return;\n }\n if (!eventDetails) {\n if (\n eventTarget &&\n (isOverlay(eventTarget) ||\n isContentEditable(eventTarget) ||\n isCollabThread(eventTarget))\n ) {\n handleCursorPosition(params.event, params.customCursor);\n hideCustomCursor(params.customCursor);\n return;\n }\n if(\n eventTarget &&\n isFieldPathDropdown(eventTarget)\n ) {\n params.customCursor && hideCustomCursor(params.customCursor);\n showOutline();\n showHoverToolbar({\n event: params.event,\n overlayWrapper: params.overlayWrapper,\n visualBuilderContainer: params.visualBuilderContainer,\n previousSelectedEditableDOM:\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM,\n focusedToolbar: params.focusedToolbar,\n resizeObserver: params.resizeObserver,\n });\n }\n if (!config?.collab.enable) {\n resetCustomCursor(params.customCursor);\n }\n removeAddInstanceButtons({\n eventTarget: params.event.target,\n visualBuilderContainer: params.visualBuilderContainer,\n overlayWrapper: params.overlayWrapper,\n });\n handleCursorPosition(params.event, params.customCursor);\n if (config?.collab.enable && config?.collab.isFeedbackMode) {\n showCustomCursor(params.customCursor);\n collabCustomCursor(params.customCursor);\n }\n return;\n }\n\n const { editableElement, fieldMetadata } = eventDetails;\n const { content_type_uid, fieldPath } = fieldMetadata;\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM &&\n VisualBuilder.VisualBuilderGlobalState.value.previousSelectedEditableDOM.isSameNode(\n editableElement\n )\n ) {\n hideCustomCursor(params.customCursor);\n return;\n }\n\n if (params.customCursor) {\n const elementUnderCursor = document.elementFromPoint(\n params.event.clientX,\n params.event.clientY\n );\n if (elementUnderCursor) {\n if (\n elementUnderCursor.nodeName === \"A\" ||\n elementUnderCursor.nodeName === \"BUTTON\"\n ) {\n elementUnderCursor.classList.add(\n visualBuilderStyles()[\"visual-builder__no-cursor-style\"]\n );\n }\n }\n\n if (config?.collab.enable && config?.collab.isFeedbackMode) {\n collabCustomCursor(params.customCursor);\n handleCursorPosition(params.event, params.customCursor);\n showCustomCursor(params.customCursor);\n return;\n } else if (\n config?.collab.enable &&\n !config?.collab.isFeedbackMode\n ) {\n hideCustomCursor(params.customCursor);\n return;\n }\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousHoveredTargetDOM !== editableElement\n ) {\n resetCustomCursor(params.customCursor);\n removeAddInstanceButtons({\n eventTarget: params.event.target,\n visualBuilderContainer: params.visualBuilderContainer,\n overlayWrapper: params.overlayWrapper,\n });\n }\n\n if (!FieldSchemaMap.hasFieldSchema(content_type_uid, fieldPath)) {\n generateCustomCursor({\n fieldType: \"loading\",\n customCursor: params.customCursor,\n });\n }\n\n /**\n * We called it seperately inside the code block to ensure that\n * the code will not wait for the promise to resolve.\n * If we get a cache miss, we will send a message to the iframe\n * without blocking the code.\n */\n FieldSchemaMap.getFieldSchema(content_type_uid, fieldPath).then(\n (fieldSchema) => {\n if (!fieldSchema) return;\n\n let entryAcl: EntryPermissions | undefined;\n getEntryPermissionsCached({\n entryUid: fieldMetadata.entry_uid,\n contentTypeUid: fieldMetadata.content_type_uid,\n locale: fieldMetadata.locale,\n })\n .then((data) => {\n entryAcl = data;\n })\n .catch((error) => {\n console.error(\n \"[Visual Builder] Error retrieving entry permissions:\",\n error\n );\n })\n .finally(() => {\n if (!params.customCursor) return;\n const { isDisabled: fieldDisabled } =\n isFieldDisabled(\n fieldSchema,\n eventDetails,\n entryAcl\n );\n const fieldType = getFieldType(fieldSchema);\n generateCustomCursor({\n fieldType,\n customCursor: params.customCursor,\n fieldDisabled,\n });\n });\n }\n );\n\n handleCursorPosition(params.event, params.customCursor);\n showCustomCursor(params.customCursor);\n }\n\n if (\n !editableElement.classList.contains(VB_EmptyBlockParentClass) &&\n !editableElement.classList.contains(\"visual-builder__empty-block\")\n ) {\n showOutline({\n editableElement,\n eventDetails,\n content_type_uid,\n fieldPath,\n fieldMetadata,\n });\n const isFocussed= VisualBuilder.VisualBuilderGlobalState.value.isFocussed;\n if(!isFocussed) {\n showHoverToolbar({\n event: params.event,\n overlayWrapper: params.overlayWrapper,\n visualBuilderContainer: params.visualBuilderContainer,\n previousSelectedEditableDOM:\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM,\n focusedToolbar: params.focusedToolbar,\n resizeObserver: params.resizeObserver,\n });\n }\n }\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousHoveredTargetDOM === editableElement\n ) {\n return;\n }\n\n VisualBuilder.VisualBuilderGlobalState.value.previousHoveredTargetDOM =\n editableElement;\n}, 10);\n\nconst handleMouseHover = async (params: HandleMouseHoverParams): Promise<void> => await throttledMouseHover(params);\n\nexport default handleMouseHover;\n"],"mappings":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;AAC/D,QAAG,CAAC,YAAY;AACZ,uBAAiB;AAAA,QACjB,OAAO,OAAO;AAAA,QACd,gBAAgB,OAAO;AAAA,QACvB,wBAAwB,OAAO;AAAA,QAC/B,6BACI,uBAAc,yBAAyB,MAClC;AAAA,QACL,gBAAgB,OAAO;AAAA,QACvB,gBAAgB,OAAO;AAAA,MAC3B,CAAC;AAAA,IACL;AAAA,EACJ;AAEA,MACI,uBAAc,yBAAyB,MAClC,6BAA6B,iBACpC;AACE;AAAA,EACJ;AAEA,yBAAc,yBAAyB,MAAM,2BACzC;AACR,GAAG,EAAE;AAEL,IAAM,mBAAmB,OAAO,WAAkD,MAAM,oBAAoB,MAAM;AAElH,IAAO,qBAAQ;","names":["import__","Config","fieldDisabled"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/visualBuilder/listeners/mouseHover.ts"],"sourcesContent":["import { debounce, throttle } from \"lodash-es\";\nimport { getCsDataOfElement } from \"../utils/getCsDataOfElement\";\nimport { removeAddInstanceButtons } from \"../utils/multipleElementAddButton\";\nimport { generateCustomCursor } from \"../generators/generateCustomCursor\";\nimport { FieldSchemaMap } from \"../utils/fieldSchemaMap\";\nimport { isFieldDisabled } from \"../utils/isFieldDisabled\";\nimport { getFieldType } from \"../utils/getFieldType\";\n\nimport EventListenerHandlerParams from \"./types\";\nimport { VisualBuilder } from \"..\";\nimport { addHoverOutline } from \"../generators/generateHoverOutline\";\nimport { visualBuilderStyles } from \"../visualBuilder.style\";\nimport { VB_EmptyBlockParentClass } from \"../..\";\nimport Config from \"../../configManager/configManager\";\nimport { isCollabThread } from \"../generators/generateThread\";\nimport { HandleBuilderInteractionParams } from \"./mouseClick\";\nimport { appendFieldPathDropdown } from \"../generators/generateToolbar\";\nimport { VisualBuilderCslpEventDetails } from \"../types/visualBuilder.types\";\nimport { CslpData } from \"../../cslp/types/cslp.types\";\nimport { fetchEntryPermissionsAndStageDetails } from \"../utils/fetchEntryPermissionsAndStageDetails\";\n\nconst config = Config.get();\nexport interface HandleMouseHoverParams\n extends Pick<\n EventListenerHandlerParams,\n \"event\" | \"overlayWrapper\" | \"visualBuilderContainer\" | \"focusedToolbar\" | \"resizeObserver\"\n > {\n customCursor: HTMLDivElement | null;\n}\n\ninterface AddOutlineParams {\n editableElement: Element;\n eventDetails: VisualBuilderCslpEventDetails;\n content_type_uid: string;\n fieldPath: string;\n fieldDisabled?: boolean;\n fieldMetadata: CslpData;\n}\n\nfunction resetCustomCursor(customCursor: HTMLDivElement | null): void {\n if (customCursor) {\n generateCustomCursor({\n fieldType: \"empty\",\n customCursor: customCursor,\n });\n }\n}\n\nfunction collabCustomCursor(customCursor: HTMLDivElement | null): void {\n if (!customCursor) return;\n\n generateCustomCursor({\n fieldType: \"discussion\",\n customCursor: customCursor,\n });\n}\n\nfunction handleCursorPosition(\n event: MouseEvent,\n customCursor: HTMLDivElement | null\n): void {\n if (customCursor) {\n const mouseY = event.clientY;\n const mouseX = event.clientX;\n\n customCursor.style.left = `${mouseX}px`;\n customCursor.style.top = `${mouseY}px`;\n }\n}\n\nasync function addOutline(params?: AddOutlineParams): Promise<void> {\n if (!params) {\n return;\n }\n const {\n editableElement,\n eventDetails,\n content_type_uid,\n fieldPath,\n fieldMetadata,\n fieldDisabled,\n } = params;\n if (!editableElement) return;\n addHoverOutline(editableElement as HTMLElement, fieldDisabled);\n const fieldSchema = await FieldSchemaMap.getFieldSchema(\n content_type_uid,\n fieldPath\n );\n if (!fieldSchema) return;\n const { acl: entryAcl, workflowStage: entryWorkflowStageDetails } =\n await fetchEntryPermissionsAndStageDetails({\n entryUid: fieldMetadata.entry_uid,\n contentTypeUid: fieldMetadata.content_type_uid,\n locale: fieldMetadata.locale,\n variantUid: fieldMetadata.variant,\n });\n const { isDisabled } = isFieldDisabled(\n fieldSchema,\n eventDetails,\n entryAcl,\n entryWorkflowStageDetails\n );\n addHoverOutline(editableElement, fieldDisabled || isDisabled);\n}\n\nconst debouncedAddOutline = debounce(addOutline, 50, { trailing: true });\nconst showOutline = (params?: AddOutlineParams): Promise<void> | undefined => debouncedAddOutline(params);\n\nfunction hideDefaultCursor(): void {\n if (\n document?.body &&\n !document.body.classList.contains(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n )\n )\n document.body.classList.add(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n );\n}\n\nfunction showDefaultCursor(): void {\n if (\n document?.body &&\n document.body.classList.contains(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n )\n )\n document.body.classList.remove(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n );\n}\n\nexport function hideHoverOutline(\n visualBuilderContainer: HTMLDivElement | null\n): void {\n if (!visualBuilderContainer) {\n return;\n }\n const hoverOutline = visualBuilderContainer.querySelector(\n \".visual-builder__hover-outline\"\n );\n if (!hoverOutline) {\n return;\n }\n hoverOutline.classList.add(\n visualBuilderStyles()[\"visual-builder__hover-outline--hidden\"]\n );\n}\n\nexport function hideCustomCursor(customCursor: HTMLDivElement | null): void {\n showDefaultCursor();\n customCursor?.classList.remove(\"visible\");\n}\n\nexport function showCustomCursor(customCursor: HTMLDivElement | null): void {\n hideDefaultCursor();\n if (\n config.collab.enable &&\n (!config.collab.isFeedbackMode || config.collab.pauseFeedback)\n )\n return;\n customCursor?.classList.add(\"visible\");\n}\n\nconst debouncedRenderHoverToolbar = debounce(async (params: HandleBuilderInteractionParams) => {\n const eventDetails = getCsDataOfElement(params.event);\n if (\n !eventDetails ||\n !params.overlayWrapper ||\n !params.visualBuilderContainer ||\n !params.focusedToolbar\n ) {\n return;\n }\n\n appendFieldPathDropdown(eventDetails, params.focusedToolbar, {\n isHover: true\n });\n}, 50, { trailing: true });\n\nexport const showHoverToolbar = async (params: HandleBuilderInteractionParams) => await debouncedRenderHoverToolbar(params);\n\nfunction isOverlay(target: HTMLElement): boolean {\n return target.classList.contains(\"visual-builder__overlay\");\n}\n\nfunction isContentEditable(target: HTMLElement): boolean {\n if (target.hasAttribute(\"contenteditable\"))\n return target.getAttribute(\"contenteditable\") === \"true\";\n return false;\n}\n\nfunction isFieldPathDropdown(target: HTMLElement): boolean {\n return target.classList.contains(\"visual-builder__focused-toolbar__field-label-wrapper\") || target.classList.contains(\"visual-builder__focused-toolbar__field-label-wrapper__current-field\");\n}\n\nfunction isFieldPathParent(target: HTMLElement): boolean {\n return target.classList.contains(\"visual-builder__focused-toolbar__field-label-wrapper__parent-field\");\n}\n\nconst throttledMouseHover = throttle(async (params: HandleMouseHoverParams) => {\n const eventDetails = getCsDataOfElement(params.event);\n const eventTarget = params.event.target as HTMLElement | null;\n\n if (config?.collab.enable && config?.collab.pauseFeedback) {\n hideCustomCursor(params.customCursor);\n return;\n }\n if (!eventDetails) {\n if (\n eventTarget &&\n (isOverlay(eventTarget) ||\n isContentEditable(eventTarget) ||\n isCollabThread(eventTarget))\n ) {\n handleCursorPosition(params.event, params.customCursor);\n hideCustomCursor(params.customCursor);\n return;\n }\n if (\n eventTarget &&\n (isFieldPathDropdown(eventTarget) || isFieldPathParent(eventTarget))\n ) {\n params.customCursor && hideCustomCursor(params.customCursor);\n showOutline();\n showHoverToolbar({\n event: params.event,\n overlayWrapper: params.overlayWrapper,\n visualBuilderContainer: params.visualBuilderContainer,\n previousSelectedEditableDOM:\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM,\n focusedToolbar: params.focusedToolbar,\n resizeObserver: params.resizeObserver,\n });\n }\n if (!config?.collab.enable) {\n resetCustomCursor(params.customCursor);\n }\n removeAddInstanceButtons({\n eventTarget: params.event.target,\n visualBuilderContainer: params.visualBuilderContainer,\n overlayWrapper: params.overlayWrapper,\n });\n handleCursorPosition(params.event, params.customCursor);\n if (config?.collab.enable && config?.collab.isFeedbackMode) {\n showCustomCursor(params.customCursor);\n collabCustomCursor(params.customCursor);\n }\n return;\n }\n\n const { editableElement, fieldMetadata } = eventDetails;\n const { content_type_uid, fieldPath } = fieldMetadata;\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM &&\n VisualBuilder.VisualBuilderGlobalState.value.previousSelectedEditableDOM.isSameNode(\n editableElement\n )\n ) {\n hideCustomCursor(params.customCursor);\n return;\n }\n\n if (params.customCursor) {\n const elementUnderCursor = document.elementFromPoint(\n params.event.clientX,\n params.event.clientY\n );\n if (elementUnderCursor) {\n if (\n elementUnderCursor.nodeName === \"A\" ||\n elementUnderCursor.nodeName === \"BUTTON\"\n ) {\n elementUnderCursor.classList.add(\n visualBuilderStyles()[\"visual-builder__no-cursor-style\"]\n );\n }\n }\n\n if (config?.collab.enable && config?.collab.isFeedbackMode) {\n collabCustomCursor(params.customCursor);\n handleCursorPosition(params.event, params.customCursor);\n showCustomCursor(params.customCursor);\n return;\n } else if (config?.collab.enable && !config?.collab.isFeedbackMode) {\n hideCustomCursor(params.customCursor);\n return;\n }\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousHoveredTargetDOM !== editableElement\n ) {\n resetCustomCursor(params.customCursor);\n removeAddInstanceButtons({\n eventTarget: params.event.target,\n visualBuilderContainer: params.visualBuilderContainer,\n overlayWrapper: params.overlayWrapper,\n });\n }\n\n if (!FieldSchemaMap.hasFieldSchema(content_type_uid, fieldPath)) {\n generateCustomCursor({\n fieldType: \"loading\",\n customCursor: params.customCursor,\n });\n }\n\n // we can generate the cursor asynchronously\n generateCursor({\n eventDetails,\n customCursor: params.customCursor,\n });\n\n handleCursorPosition(params.event, params.customCursor);\n showCustomCursor(params.customCursor);\n }\n\n if (\n !editableElement.classList.contains(VB_EmptyBlockParentClass) &&\n !editableElement.classList.contains(\"visual-builder__empty-block\")\n ) {\n showOutline({\n editableElement,\n eventDetails,\n content_type_uid,\n fieldPath,\n fieldMetadata,\n });\n const isFocussed= VisualBuilder.VisualBuilderGlobalState.value.isFocussed;\n if(!isFocussed) {\n showHoverToolbar({\n event: params.event,\n overlayWrapper: params.overlayWrapper,\n visualBuilderContainer: params.visualBuilderContainer,\n previousSelectedEditableDOM:\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM,\n focusedToolbar: params.focusedToolbar,\n resizeObserver: params.resizeObserver,\n });\n }\n }\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousHoveredTargetDOM === editableElement\n ) {\n return;\n }\n\n VisualBuilder.VisualBuilderGlobalState.value.previousHoveredTargetDOM =\n editableElement;\n}, 10);\n\nasync function generateCursor({\n eventDetails,\n customCursor,\n}: {\n eventDetails: VisualBuilderCslpEventDetails;\n customCursor: HTMLDivElement | null;\n}) {\n if (!customCursor) return;\n const { fieldMetadata } = eventDetails;\n const fieldSchema = await FieldSchemaMap.getFieldSchema(\n fieldMetadata.content_type_uid,\n fieldMetadata.fieldPath\n );\n if (!fieldSchema) {\n return;\n }\n const { acl: entryAcl, workflowStage: entryWorkflowStageDetails } =\n await fetchEntryPermissionsAndStageDetails({\n entryUid: fieldMetadata.entry_uid,\n contentTypeUid: fieldMetadata.content_type_uid,\n locale: fieldMetadata.locale,\n variantUid: fieldMetadata.variant,\n });\n const { isDisabled: fieldDisabled } = isFieldDisabled(\n fieldSchema,\n eventDetails,\n entryAcl,\n entryWorkflowStageDetails\n );\n const fieldType = getFieldType(fieldSchema);\n generateCustomCursor({\n fieldType,\n customCursor,\n fieldDisabled,\n });\n}\n\nconst handleMouseHover = async (\n params: HandleMouseHoverParams\n): Promise<void> => await throttledMouseHover(params);\n\nexport default handleMouseHover;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAmC;AACnC,gCAAmC;AACnC,sCAAyC;AACzC,kCAAqC;AACrC,4BAA+B;AAC/B,6BAAgC;AAChC,0BAA6B;AAG7B,eAA8B;AAC9B,kCAAgC;AAChC,2BAAoC;AACpC,IAAAA,YAAyC;AACzC,2BAAmB;AACnB,4BAA+B;AAE/B,6BAAwC;AAGxC,kDAAqD;AAErD,IAAM,SAAS,qBAAAC,QAAO,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jB;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC;AACL;AAEA,IAAM,mBAAmB,OACrB,WACgB,MAAM,oBAAoB,MAAM;AAEpD,IAAO,qBAAQ;","names":["import__","Config"]}
|
|
@@ -14,8 +14,8 @@ import { visualBuilderStyles } from "../visualBuilder.style.js";
|
|
|
14
14
|
import { VB_EmptyBlockParentClass } from "../../index.js";
|
|
15
15
|
import Config from "../../configManager/configManager.js";
|
|
16
16
|
import { isCollabThread } from "../generators/generateThread.js";
|
|
17
|
-
import { getEntryPermissionsCached } from "../utils/getEntryPermissionsCached.js";
|
|
18
17
|
import { appendFieldPathDropdown } from "../generators/generateToolbar.js";
|
|
18
|
+
import { fetchEntryPermissionsAndStageDetails } from "../utils/fetchEntryPermissionsAndStageDetails.js";
|
|
19
19
|
var config = Config.get();
|
|
20
20
|
function resetCustomCursor(customCursor) {
|
|
21
21
|
if (customCursor) {
|
|
@@ -40,38 +40,38 @@ function handleCursorPosition(event, customCursor) {
|
|
|
40
40
|
customCursor.style.top = `${mouseY}px`;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
function addOutline(params) {
|
|
43
|
+
async function addOutline(params) {
|
|
44
44
|
if (!params) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
const {
|
|
47
|
+
const {
|
|
48
|
+
editableElement,
|
|
49
|
+
eventDetails,
|
|
50
|
+
content_type_uid,
|
|
51
|
+
fieldPath,
|
|
52
|
+
fieldMetadata,
|
|
53
|
+
fieldDisabled
|
|
54
|
+
} = params;
|
|
48
55
|
if (!editableElement) return;
|
|
49
56
|
addHoverOutline(editableElement, fieldDisabled);
|
|
50
|
-
FieldSchemaMap.getFieldSchema(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const { isDisabled: fieldDisabled2 } = isFieldDisabled(
|
|
67
|
-
fieldSchema,
|
|
68
|
-
eventDetails,
|
|
69
|
-
entryAcl
|
|
70
|
-
);
|
|
71
|
-
addHoverOutline(editableElement, fieldDisabled2);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
57
|
+
const fieldSchema = await FieldSchemaMap.getFieldSchema(
|
|
58
|
+
content_type_uid,
|
|
59
|
+
fieldPath
|
|
60
|
+
);
|
|
61
|
+
if (!fieldSchema) return;
|
|
62
|
+
const { acl: entryAcl, workflowStage: entryWorkflowStageDetails } = await fetchEntryPermissionsAndStageDetails({
|
|
63
|
+
entryUid: fieldMetadata.entry_uid,
|
|
64
|
+
contentTypeUid: fieldMetadata.content_type_uid,
|
|
65
|
+
locale: fieldMetadata.locale,
|
|
66
|
+
variantUid: fieldMetadata.variant
|
|
67
|
+
});
|
|
68
|
+
const { isDisabled } = isFieldDisabled(
|
|
69
|
+
fieldSchema,
|
|
70
|
+
eventDetails,
|
|
71
|
+
entryAcl,
|
|
72
|
+
entryWorkflowStageDetails
|
|
74
73
|
);
|
|
74
|
+
addHoverOutline(editableElement, fieldDisabled || isDisabled);
|
|
75
75
|
}
|
|
76
76
|
var debouncedAddOutline = debounce(addOutline, 50, { trailing: true });
|
|
77
77
|
var showOutline = (params) => debouncedAddOutline(params);
|
|
@@ -136,6 +136,9 @@ function isContentEditable(target) {
|
|
|
136
136
|
function isFieldPathDropdown(target) {
|
|
137
137
|
return target.classList.contains("visual-builder__focused-toolbar__field-label-wrapper") || target.classList.contains("visual-builder__focused-toolbar__field-label-wrapper__current-field");
|
|
138
138
|
}
|
|
139
|
+
function isFieldPathParent(target) {
|
|
140
|
+
return target.classList.contains("visual-builder__focused-toolbar__field-label-wrapper__parent-field");
|
|
141
|
+
}
|
|
139
142
|
var throttledMouseHover = throttle(async (params) => {
|
|
140
143
|
const eventDetails = getCsDataOfElement(params.event);
|
|
141
144
|
const eventTarget = params.event.target;
|
|
@@ -149,7 +152,7 @@ var throttledMouseHover = throttle(async (params) => {
|
|
|
149
152
|
hideCustomCursor(params.customCursor);
|
|
150
153
|
return;
|
|
151
154
|
}
|
|
152
|
-
if (eventTarget && isFieldPathDropdown(eventTarget)) {
|
|
155
|
+
if (eventTarget && (isFieldPathDropdown(eventTarget) || isFieldPathParent(eventTarget))) {
|
|
153
156
|
params.customCursor && hideCustomCursor(params.customCursor);
|
|
154
157
|
showOutline();
|
|
155
158
|
showHoverToolbar({
|
|
@@ -219,37 +222,10 @@ var throttledMouseHover = throttle(async (params) => {
|
|
|
219
222
|
customCursor: params.customCursor
|
|
220
223
|
});
|
|
221
224
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
getEntryPermissionsCached({
|
|
227
|
-
entryUid: fieldMetadata.entry_uid,
|
|
228
|
-
contentTypeUid: fieldMetadata.content_type_uid,
|
|
229
|
-
locale: fieldMetadata.locale
|
|
230
|
-
}).then((data) => {
|
|
231
|
-
entryAcl = data;
|
|
232
|
-
}).catch((error) => {
|
|
233
|
-
console.error(
|
|
234
|
-
"[Visual Builder] Error retrieving entry permissions:",
|
|
235
|
-
error
|
|
236
|
-
);
|
|
237
|
-
}).finally(() => {
|
|
238
|
-
if (!params.customCursor) return;
|
|
239
|
-
const { isDisabled: fieldDisabled } = isFieldDisabled(
|
|
240
|
-
fieldSchema,
|
|
241
|
-
eventDetails,
|
|
242
|
-
entryAcl
|
|
243
|
-
);
|
|
244
|
-
const fieldType = getFieldType(fieldSchema);
|
|
245
|
-
generateCustomCursor({
|
|
246
|
-
fieldType,
|
|
247
|
-
customCursor: params.customCursor,
|
|
248
|
-
fieldDisabled
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
);
|
|
225
|
+
generateCursor({
|
|
226
|
+
eventDetails,
|
|
227
|
+
customCursor: params.customCursor
|
|
228
|
+
});
|
|
253
229
|
handleCursorPosition(params.event, params.customCursor);
|
|
254
230
|
showCustomCursor(params.customCursor);
|
|
255
231
|
}
|
|
@@ -278,6 +254,38 @@ var throttledMouseHover = throttle(async (params) => {
|
|
|
278
254
|
}
|
|
279
255
|
VisualBuilder.VisualBuilderGlobalState.value.previousHoveredTargetDOM = editableElement;
|
|
280
256
|
}, 10);
|
|
257
|
+
async function generateCursor({
|
|
258
|
+
eventDetails,
|
|
259
|
+
customCursor
|
|
260
|
+
}) {
|
|
261
|
+
if (!customCursor) return;
|
|
262
|
+
const { fieldMetadata } = eventDetails;
|
|
263
|
+
const fieldSchema = await FieldSchemaMap.getFieldSchema(
|
|
264
|
+
fieldMetadata.content_type_uid,
|
|
265
|
+
fieldMetadata.fieldPath
|
|
266
|
+
);
|
|
267
|
+
if (!fieldSchema) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const { acl: entryAcl, workflowStage: entryWorkflowStageDetails } = await fetchEntryPermissionsAndStageDetails({
|
|
271
|
+
entryUid: fieldMetadata.entry_uid,
|
|
272
|
+
contentTypeUid: fieldMetadata.content_type_uid,
|
|
273
|
+
locale: fieldMetadata.locale,
|
|
274
|
+
variantUid: fieldMetadata.variant
|
|
275
|
+
});
|
|
276
|
+
const { isDisabled: fieldDisabled } = isFieldDisabled(
|
|
277
|
+
fieldSchema,
|
|
278
|
+
eventDetails,
|
|
279
|
+
entryAcl,
|
|
280
|
+
entryWorkflowStageDetails
|
|
281
|
+
);
|
|
282
|
+
const fieldType = getFieldType(fieldSchema);
|
|
283
|
+
generateCustomCursor({
|
|
284
|
+
fieldType,
|
|
285
|
+
customCursor,
|
|
286
|
+
fieldDisabled
|
|
287
|
+
});
|
|
288
|
+
}
|
|
281
289
|
var handleMouseHover = async (params) => await throttledMouseHover(params);
|
|
282
290
|
var mouseHover_default = handleMouseHover;
|
|
283
291
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/visualBuilder/listeners/mouseHover.ts"],"sourcesContent":["import { debounce, throttle } from \"lodash-es\";\nimport { getCsDataOfElement } from \"../utils/getCsDataOfElement\";\nimport { removeAddInstanceButtons } from \"../utils/multipleElementAddButton\";\nimport { generateCustomCursor } from \"../generators/generateCustomCursor\";\nimport { FieldSchemaMap } from \"../utils/fieldSchemaMap\";\nimport { isFieldDisabled } from \"../utils/isFieldDisabled\";\nimport { getFieldType } from \"../utils/getFieldType\";\n\nimport EventListenerHandlerParams from \"./types\";\nimport { VisualBuilder } from \"..\";\nimport { addHoverOutline } from \"../generators/generateHoverOutline\";\nimport { visualBuilderStyles } from \"../visualBuilder.style\";\nimport { VB_EmptyBlockParentClass } from \"../..\";\nimport Config from \"../../configManager/configManager\";\nimport { isCollabThread } from \"../generators/generateThread\";\nimport { getEntryPermissionsCached } from \"../utils/getEntryPermissionsCached\";\nimport { EntryPermissions } from \"../utils/getEntryPermissions\";\nimport visualBuilderPostMessage from \"../utils/visualBuilderPostMessage\";\nimport { VisualBuilderPostMessageEvents } from \"../utils/types/postMessage.types\";\nimport { HandleBuilderInteractionParams } from \"./mouseClick\";\nimport { appendFieldPathDropdown, removeFieldToolbar } from \"../generators/generateToolbar\";\nimport { VisualBuilderCslpEventDetails } from \"../types/visualBuilder.types\";\nimport { CslpData } from \"../../cslp/types/cslp.types\";\n\nconst config = Config.get();\nexport interface HandleMouseHoverParams\n extends Pick<\n EventListenerHandlerParams,\n \"event\" | \"overlayWrapper\" | \"visualBuilderContainer\" | \"focusedToolbar\" | \"resizeObserver\"\n > {\n customCursor: HTMLDivElement | null;\n}\n\ninterface AddOutlineParams {\n editableElement: Element;\n eventDetails: VisualBuilderCslpEventDetails;\n content_type_uid: string;\n fieldPath: string;\n fieldDisabled?: boolean;\n fieldMetadata: CslpData;\n}\n\nfunction resetCustomCursor(customCursor: HTMLDivElement | null): void {\n if (customCursor) {\n generateCustomCursor({\n fieldType: \"empty\",\n customCursor: customCursor,\n });\n }\n}\n\nfunction collabCustomCursor(customCursor: HTMLDivElement | null): void {\n if (!customCursor) return;\n\n generateCustomCursor({\n fieldType: \"discussion\",\n customCursor: customCursor,\n });\n}\n\nfunction handleCursorPosition(\n event: MouseEvent,\n customCursor: HTMLDivElement | null\n): void {\n if (customCursor) {\n const mouseY = event.clientY;\n const mouseX = event.clientX;\n\n customCursor.style.left = `${mouseX}px`;\n customCursor.style.top = `${mouseY}px`;\n }\n}\n\nfunction addOutline(params?: AddOutlineParams): void {\n if(!params) {\n return;\n }\n const { editableElement, eventDetails, content_type_uid, fieldPath, fieldMetadata, fieldDisabled } = params;\n if (!editableElement) return;\n addHoverOutline(editableElement as HTMLElement, fieldDisabled);\n FieldSchemaMap.getFieldSchema(content_type_uid, fieldPath).then(\n (fieldSchema) => {\n let entryAcl: EntryPermissions | undefined;\n if (!fieldSchema) return;\n getEntryPermissionsCached({\n entryUid: fieldMetadata.entry_uid,\n contentTypeUid: fieldMetadata.content_type_uid,\n locale: fieldMetadata.locale,\n })\n .then((data) => {\n entryAcl = data;\n })\n .catch((error) => {\n console.error(\n \"[Visual Builder] Error retrieving entry permissions:\",\n error\n );\n })\n .finally(() => {\n const { isDisabled: fieldDisabled } =\n isFieldDisabled(\n fieldSchema,\n eventDetails,\n entryAcl\n );\n addHoverOutline(editableElement, fieldDisabled);\n });\n }\n );\n}\n\nconst debouncedAddOutline = debounce(addOutline, 50, { trailing: true });\nconst showOutline = (params?: AddOutlineParams): void => debouncedAddOutline(params);\n\nfunction hideDefaultCursor(): void {\n if (\n document?.body &&\n !document.body.classList.contains(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n )\n )\n document.body.classList.add(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n );\n}\n\nfunction showDefaultCursor(): void {\n if (\n document?.body &&\n document.body.classList.contains(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n )\n )\n document.body.classList.remove(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n );\n}\n\nexport function hideHoverOutline(\n visualBuilderContainer: HTMLDivElement | null\n): void {\n if (!visualBuilderContainer) {\n return;\n }\n const hoverOutline = visualBuilderContainer.querySelector(\n \".visual-builder__hover-outline\"\n );\n if (!hoverOutline) {\n return;\n }\n hoverOutline.classList.add(\n visualBuilderStyles()[\"visual-builder__hover-outline--hidden\"]\n );\n}\n\nexport function hideCustomCursor(customCursor: HTMLDivElement | null): void {\n showDefaultCursor();\n customCursor?.classList.remove(\"visible\");\n}\n\nexport function showCustomCursor(customCursor: HTMLDivElement | null): void {\n hideDefaultCursor();\n if (\n config.collab.enable &&\n (!config.collab.isFeedbackMode || config.collab.pauseFeedback)\n )\n return;\n customCursor?.classList.add(\"visible\");\n}\n\nconst debouncedRenderHoverToolbar = debounce(async (params: HandleBuilderInteractionParams) => {\n const eventDetails = getCsDataOfElement(params.event);\n if (\n !eventDetails ||\n !params.overlayWrapper ||\n !params.visualBuilderContainer ||\n !params.focusedToolbar\n ) {\n return;\n }\n\n appendFieldPathDropdown(eventDetails, params.focusedToolbar, {\n isHover: true\n });\n}, 50, { trailing: true });\n\nexport const showHoverToolbar = async (params: HandleBuilderInteractionParams) => await debouncedRenderHoverToolbar(params);\n\nfunction isOverlay(target: HTMLElement): boolean {\n return target.classList.contains(\"visual-builder__overlay\");\n}\n\nfunction isContentEditable(target: HTMLElement): boolean {\n if (target.hasAttribute(\"contenteditable\"))\n return target.getAttribute(\"contenteditable\") === \"true\";\n return false;\n}\n\nfunction isFieldPathDropdown(target: HTMLElement): boolean {\n return target.classList.contains(\"visual-builder__focused-toolbar__field-label-wrapper\") || target.classList.contains(\"visual-builder__focused-toolbar__field-label-wrapper__current-field\");\n}\n\nconst throttledMouseHover = throttle(async (params: HandleMouseHoverParams) => {\n const eventDetails = getCsDataOfElement(params.event);\n const eventTarget = params.event.target as HTMLElement | null;\n\n if (config?.collab.enable && config?.collab.pauseFeedback) {\n hideCustomCursor(params.customCursor);\n return;\n }\n if (!eventDetails) {\n if (\n eventTarget &&\n (isOverlay(eventTarget) ||\n isContentEditable(eventTarget) ||\n isCollabThread(eventTarget))\n ) {\n handleCursorPosition(params.event, params.customCursor);\n hideCustomCursor(params.customCursor);\n return;\n }\n if(\n eventTarget &&\n isFieldPathDropdown(eventTarget)\n ) {\n params.customCursor && hideCustomCursor(params.customCursor);\n showOutline();\n showHoverToolbar({\n event: params.event,\n overlayWrapper: params.overlayWrapper,\n visualBuilderContainer: params.visualBuilderContainer,\n previousSelectedEditableDOM:\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM,\n focusedToolbar: params.focusedToolbar,\n resizeObserver: params.resizeObserver,\n });\n }\n if (!config?.collab.enable) {\n resetCustomCursor(params.customCursor);\n }\n removeAddInstanceButtons({\n eventTarget: params.event.target,\n visualBuilderContainer: params.visualBuilderContainer,\n overlayWrapper: params.overlayWrapper,\n });\n handleCursorPosition(params.event, params.customCursor);\n if (config?.collab.enable && config?.collab.isFeedbackMode) {\n showCustomCursor(params.customCursor);\n collabCustomCursor(params.customCursor);\n }\n return;\n }\n\n const { editableElement, fieldMetadata } = eventDetails;\n const { content_type_uid, fieldPath } = fieldMetadata;\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM &&\n VisualBuilder.VisualBuilderGlobalState.value.previousSelectedEditableDOM.isSameNode(\n editableElement\n )\n ) {\n hideCustomCursor(params.customCursor);\n return;\n }\n\n if (params.customCursor) {\n const elementUnderCursor = document.elementFromPoint(\n params.event.clientX,\n params.event.clientY\n );\n if (elementUnderCursor) {\n if (\n elementUnderCursor.nodeName === \"A\" ||\n elementUnderCursor.nodeName === \"BUTTON\"\n ) {\n elementUnderCursor.classList.add(\n visualBuilderStyles()[\"visual-builder__no-cursor-style\"]\n );\n }\n }\n\n if (config?.collab.enable && config?.collab.isFeedbackMode) {\n collabCustomCursor(params.customCursor);\n handleCursorPosition(params.event, params.customCursor);\n showCustomCursor(params.customCursor);\n return;\n } else if (\n config?.collab.enable &&\n !config?.collab.isFeedbackMode\n ) {\n hideCustomCursor(params.customCursor);\n return;\n }\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousHoveredTargetDOM !== editableElement\n ) {\n resetCustomCursor(params.customCursor);\n removeAddInstanceButtons({\n eventTarget: params.event.target,\n visualBuilderContainer: params.visualBuilderContainer,\n overlayWrapper: params.overlayWrapper,\n });\n }\n\n if (!FieldSchemaMap.hasFieldSchema(content_type_uid, fieldPath)) {\n generateCustomCursor({\n fieldType: \"loading\",\n customCursor: params.customCursor,\n });\n }\n\n /**\n * We called it seperately inside the code block to ensure that\n * the code will not wait for the promise to resolve.\n * If we get a cache miss, we will send a message to the iframe\n * without blocking the code.\n */\n FieldSchemaMap.getFieldSchema(content_type_uid, fieldPath).then(\n (fieldSchema) => {\n if (!fieldSchema) return;\n\n let entryAcl: EntryPermissions | undefined;\n getEntryPermissionsCached({\n entryUid: fieldMetadata.entry_uid,\n contentTypeUid: fieldMetadata.content_type_uid,\n locale: fieldMetadata.locale,\n })\n .then((data) => {\n entryAcl = data;\n })\n .catch((error) => {\n console.error(\n \"[Visual Builder] Error retrieving entry permissions:\",\n error\n );\n })\n .finally(() => {\n if (!params.customCursor) return;\n const { isDisabled: fieldDisabled } =\n isFieldDisabled(\n fieldSchema,\n eventDetails,\n entryAcl\n );\n const fieldType = getFieldType(fieldSchema);\n generateCustomCursor({\n fieldType,\n customCursor: params.customCursor,\n fieldDisabled,\n });\n });\n }\n );\n\n handleCursorPosition(params.event, params.customCursor);\n showCustomCursor(params.customCursor);\n }\n\n if (\n !editableElement.classList.contains(VB_EmptyBlockParentClass) &&\n !editableElement.classList.contains(\"visual-builder__empty-block\")\n ) {\n showOutline({\n editableElement,\n eventDetails,\n content_type_uid,\n fieldPath,\n fieldMetadata,\n });\n const isFocussed= VisualBuilder.VisualBuilderGlobalState.value.isFocussed;\n if(!isFocussed) {\n showHoverToolbar({\n event: params.event,\n overlayWrapper: params.overlayWrapper,\n visualBuilderContainer: params.visualBuilderContainer,\n previousSelectedEditableDOM:\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM,\n focusedToolbar: params.focusedToolbar,\n resizeObserver: params.resizeObserver,\n });\n }\n }\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousHoveredTargetDOM === editableElement\n ) {\n return;\n }\n\n VisualBuilder.VisualBuilderGlobalState.value.previousHoveredTargetDOM =\n editableElement;\n}, 10);\n\nconst handleMouseHover = async (params: HandleMouseHoverParams): Promise<void> => await throttledMouseHover(params);\n\nexport default handleMouseHover;\n"],"mappings":";;;AAAA,SAAS,UAAU,gBAAgB;AACnC,SAAS,0BAA0B;AACnC,SAAS,gCAAgC;AACzC,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAG7B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,gCAAgC;AACzC,OAAO,YAAY;AACnB,SAAS,sBAAsB;AAC/B,SAAS,iCAAiC;AAK1C,SAAS,+BAAmD;AAI5D,IAAM,SAAS,OAAO,IAAI;AAkB1B,SAAS,kBAAkB,cAA2C;AAClE,MAAI,cAAc;AACd,yBAAqB;AAAA,MACjB,WAAW;AAAA,MACX;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;AAEA,SAAS,mBAAmB,cAA2C;AACnE,MAAI,CAAC,aAAc;AAEnB,uBAAqB;AAAA,IACjB,WAAW;AAAA,IACX;AAAA,EACJ,CAAC;AACL;AAEA,SAAS,qBACL,OACA,cACI;AACJ,MAAI,cAAc;AACd,UAAM,SAAS,MAAM;AACrB,UAAM,SAAS,MAAM;AAErB,iBAAa,MAAM,OAAO,GAAG,MAAM;AACnC,iBAAa,MAAM,MAAM,GAAG,MAAM;AAAA,EACtC;AACJ;AAEA,SAAS,WAAW,QAAiC;AACjD,MAAG,CAAC,QAAQ;AACR;AAAA,EACJ;AACA,QAAM,EAAE,iBAAiB,cAAc,kBAAkB,WAAW,eAAe,cAAc,IAAI;AACrG,MAAI,CAAC,gBAA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AO,OAAO,OAAO,YAAY;AACtD,qBAAiB,OAAO,YAAY;AAAA,EACxC;AAEA,MACI,CAAC,gBAAgB,UAAU,SAAS,wBAAwB,KAC5D,CAAC,gBAAgB,UAAU,SAAS,6BAA6B,GACnE;AACE,gBAAY;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACJ,CAAC;AACD,UAAM,aAAY,cAAc,yBAAyB,MAAM;AAC/D,QAAG,CAAC,YAAY;AACZ,uBAAiB;AAAA,QACjB,OAAO,OAAO;AAAA,QACd,gBAAgB,OAAO;AAAA,QACvB,wBAAwB,OAAO;AAAA,QAC/B,6BACI,cAAc,yBAAyB,MAClC;AAAA,QACL,gBAAgB,OAAO;AAAA,QACvB,gBAAgB,OAAO;AAAA,MAC3B,CAAC;AAAA,IACL;AAAA,EACJ;AAEA,MACI,cAAc,yBAAyB,MAClC,6BAA6B,iBACpC;AACE;AAAA,EACJ;AAEA,gBAAc,yBAAyB,MAAM,2BACzC;AACR,GAAG,EAAE;AAEL,IAAM,mBAAmB,OAAO,WAAkD,MAAM,oBAAoB,MAAM;AAElH,IAAO,qBAAQ;","names":["fieldDisabled"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/visualBuilder/listeners/mouseHover.ts"],"sourcesContent":["import { debounce, throttle } from \"lodash-es\";\nimport { getCsDataOfElement } from \"../utils/getCsDataOfElement\";\nimport { removeAddInstanceButtons } from \"../utils/multipleElementAddButton\";\nimport { generateCustomCursor } from \"../generators/generateCustomCursor\";\nimport { FieldSchemaMap } from \"../utils/fieldSchemaMap\";\nimport { isFieldDisabled } from \"../utils/isFieldDisabled\";\nimport { getFieldType } from \"../utils/getFieldType\";\n\nimport EventListenerHandlerParams from \"./types\";\nimport { VisualBuilder } from \"..\";\nimport { addHoverOutline } from \"../generators/generateHoverOutline\";\nimport { visualBuilderStyles } from \"../visualBuilder.style\";\nimport { VB_EmptyBlockParentClass } from \"../..\";\nimport Config from \"../../configManager/configManager\";\nimport { isCollabThread } from \"../generators/generateThread\";\nimport { HandleBuilderInteractionParams } from \"./mouseClick\";\nimport { appendFieldPathDropdown } from \"../generators/generateToolbar\";\nimport { VisualBuilderCslpEventDetails } from \"../types/visualBuilder.types\";\nimport { CslpData } from \"../../cslp/types/cslp.types\";\nimport { fetchEntryPermissionsAndStageDetails } from \"../utils/fetchEntryPermissionsAndStageDetails\";\n\nconst config = Config.get();\nexport interface HandleMouseHoverParams\n extends Pick<\n EventListenerHandlerParams,\n \"event\" | \"overlayWrapper\" | \"visualBuilderContainer\" | \"focusedToolbar\" | \"resizeObserver\"\n > {\n customCursor: HTMLDivElement | null;\n}\n\ninterface AddOutlineParams {\n editableElement: Element;\n eventDetails: VisualBuilderCslpEventDetails;\n content_type_uid: string;\n fieldPath: string;\n fieldDisabled?: boolean;\n fieldMetadata: CslpData;\n}\n\nfunction resetCustomCursor(customCursor: HTMLDivElement | null): void {\n if (customCursor) {\n generateCustomCursor({\n fieldType: \"empty\",\n customCursor: customCursor,\n });\n }\n}\n\nfunction collabCustomCursor(customCursor: HTMLDivElement | null): void {\n if (!customCursor) return;\n\n generateCustomCursor({\n fieldType: \"discussion\",\n customCursor: customCursor,\n });\n}\n\nfunction handleCursorPosition(\n event: MouseEvent,\n customCursor: HTMLDivElement | null\n): void {\n if (customCursor) {\n const mouseY = event.clientY;\n const mouseX = event.clientX;\n\n customCursor.style.left = `${mouseX}px`;\n customCursor.style.top = `${mouseY}px`;\n }\n}\n\nasync function addOutline(params?: AddOutlineParams): Promise<void> {\n if (!params) {\n return;\n }\n const {\n editableElement,\n eventDetails,\n content_type_uid,\n fieldPath,\n fieldMetadata,\n fieldDisabled,\n } = params;\n if (!editableElement) return;\n addHoverOutline(editableElement as HTMLElement, fieldDisabled);\n const fieldSchema = await FieldSchemaMap.getFieldSchema(\n content_type_uid,\n fieldPath\n );\n if (!fieldSchema) return;\n const { acl: entryAcl, workflowStage: entryWorkflowStageDetails } =\n await fetchEntryPermissionsAndStageDetails({\n entryUid: fieldMetadata.entry_uid,\n contentTypeUid: fieldMetadata.content_type_uid,\n locale: fieldMetadata.locale,\n variantUid: fieldMetadata.variant,\n });\n const { isDisabled } = isFieldDisabled(\n fieldSchema,\n eventDetails,\n entryAcl,\n entryWorkflowStageDetails\n );\n addHoverOutline(editableElement, fieldDisabled || isDisabled);\n}\n\nconst debouncedAddOutline = debounce(addOutline, 50, { trailing: true });\nconst showOutline = (params?: AddOutlineParams): Promise<void> | undefined => debouncedAddOutline(params);\n\nfunction hideDefaultCursor(): void {\n if (\n document?.body &&\n !document.body.classList.contains(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n )\n )\n document.body.classList.add(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n );\n}\n\nfunction showDefaultCursor(): void {\n if (\n document?.body &&\n document.body.classList.contains(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n )\n )\n document.body.classList.remove(\n visualBuilderStyles()[\"visual-builder__default-cursor--disabled\"]\n );\n}\n\nexport function hideHoverOutline(\n visualBuilderContainer: HTMLDivElement | null\n): void {\n if (!visualBuilderContainer) {\n return;\n }\n const hoverOutline = visualBuilderContainer.querySelector(\n \".visual-builder__hover-outline\"\n );\n if (!hoverOutline) {\n return;\n }\n hoverOutline.classList.add(\n visualBuilderStyles()[\"visual-builder__hover-outline--hidden\"]\n );\n}\n\nexport function hideCustomCursor(customCursor: HTMLDivElement | null): void {\n showDefaultCursor();\n customCursor?.classList.remove(\"visible\");\n}\n\nexport function showCustomCursor(customCursor: HTMLDivElement | null): void {\n hideDefaultCursor();\n if (\n config.collab.enable &&\n (!config.collab.isFeedbackMode || config.collab.pauseFeedback)\n )\n return;\n customCursor?.classList.add(\"visible\");\n}\n\nconst debouncedRenderHoverToolbar = debounce(async (params: HandleBuilderInteractionParams) => {\n const eventDetails = getCsDataOfElement(params.event);\n if (\n !eventDetails ||\n !params.overlayWrapper ||\n !params.visualBuilderContainer ||\n !params.focusedToolbar\n ) {\n return;\n }\n\n appendFieldPathDropdown(eventDetails, params.focusedToolbar, {\n isHover: true\n });\n}, 50, { trailing: true });\n\nexport const showHoverToolbar = async (params: HandleBuilderInteractionParams) => await debouncedRenderHoverToolbar(params);\n\nfunction isOverlay(target: HTMLElement): boolean {\n return target.classList.contains(\"visual-builder__overlay\");\n}\n\nfunction isContentEditable(target: HTMLElement): boolean {\n if (target.hasAttribute(\"contenteditable\"))\n return target.getAttribute(\"contenteditable\") === \"true\";\n return false;\n}\n\nfunction isFieldPathDropdown(target: HTMLElement): boolean {\n return target.classList.contains(\"visual-builder__focused-toolbar__field-label-wrapper\") || target.classList.contains(\"visual-builder__focused-toolbar__field-label-wrapper__current-field\");\n}\n\nfunction isFieldPathParent(target: HTMLElement): boolean {\n return target.classList.contains(\"visual-builder__focused-toolbar__field-label-wrapper__parent-field\");\n}\n\nconst throttledMouseHover = throttle(async (params: HandleMouseHoverParams) => {\n const eventDetails = getCsDataOfElement(params.event);\n const eventTarget = params.event.target as HTMLElement | null;\n\n if (config?.collab.enable && config?.collab.pauseFeedback) {\n hideCustomCursor(params.customCursor);\n return;\n }\n if (!eventDetails) {\n if (\n eventTarget &&\n (isOverlay(eventTarget) ||\n isContentEditable(eventTarget) ||\n isCollabThread(eventTarget))\n ) {\n handleCursorPosition(params.event, params.customCursor);\n hideCustomCursor(params.customCursor);\n return;\n }\n if (\n eventTarget &&\n (isFieldPathDropdown(eventTarget) || isFieldPathParent(eventTarget))\n ) {\n params.customCursor && hideCustomCursor(params.customCursor);\n showOutline();\n showHoverToolbar({\n event: params.event,\n overlayWrapper: params.overlayWrapper,\n visualBuilderContainer: params.visualBuilderContainer,\n previousSelectedEditableDOM:\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM,\n focusedToolbar: params.focusedToolbar,\n resizeObserver: params.resizeObserver,\n });\n }\n if (!config?.collab.enable) {\n resetCustomCursor(params.customCursor);\n }\n removeAddInstanceButtons({\n eventTarget: params.event.target,\n visualBuilderContainer: params.visualBuilderContainer,\n overlayWrapper: params.overlayWrapper,\n });\n handleCursorPosition(params.event, params.customCursor);\n if (config?.collab.enable && config?.collab.isFeedbackMode) {\n showCustomCursor(params.customCursor);\n collabCustomCursor(params.customCursor);\n }\n return;\n }\n\n const { editableElement, fieldMetadata } = eventDetails;\n const { content_type_uid, fieldPath } = fieldMetadata;\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM &&\n VisualBuilder.VisualBuilderGlobalState.value.previousSelectedEditableDOM.isSameNode(\n editableElement\n )\n ) {\n hideCustomCursor(params.customCursor);\n return;\n }\n\n if (params.customCursor) {\n const elementUnderCursor = document.elementFromPoint(\n params.event.clientX,\n params.event.clientY\n );\n if (elementUnderCursor) {\n if (\n elementUnderCursor.nodeName === \"A\" ||\n elementUnderCursor.nodeName === \"BUTTON\"\n ) {\n elementUnderCursor.classList.add(\n visualBuilderStyles()[\"visual-builder__no-cursor-style\"]\n );\n }\n }\n\n if (config?.collab.enable && config?.collab.isFeedbackMode) {\n collabCustomCursor(params.customCursor);\n handleCursorPosition(params.event, params.customCursor);\n showCustomCursor(params.customCursor);\n return;\n } else if (config?.collab.enable && !config?.collab.isFeedbackMode) {\n hideCustomCursor(params.customCursor);\n return;\n }\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousHoveredTargetDOM !== editableElement\n ) {\n resetCustomCursor(params.customCursor);\n removeAddInstanceButtons({\n eventTarget: params.event.target,\n visualBuilderContainer: params.visualBuilderContainer,\n overlayWrapper: params.overlayWrapper,\n });\n }\n\n if (!FieldSchemaMap.hasFieldSchema(content_type_uid, fieldPath)) {\n generateCustomCursor({\n fieldType: \"loading\",\n customCursor: params.customCursor,\n });\n }\n\n // we can generate the cursor asynchronously\n generateCursor({\n eventDetails,\n customCursor: params.customCursor,\n });\n\n handleCursorPosition(params.event, params.customCursor);\n showCustomCursor(params.customCursor);\n }\n\n if (\n !editableElement.classList.contains(VB_EmptyBlockParentClass) &&\n !editableElement.classList.contains(\"visual-builder__empty-block\")\n ) {\n showOutline({\n editableElement,\n eventDetails,\n content_type_uid,\n fieldPath,\n fieldMetadata,\n });\n const isFocussed= VisualBuilder.VisualBuilderGlobalState.value.isFocussed;\n if(!isFocussed) {\n showHoverToolbar({\n event: params.event,\n overlayWrapper: params.overlayWrapper,\n visualBuilderContainer: params.visualBuilderContainer,\n previousSelectedEditableDOM:\n VisualBuilder.VisualBuilderGlobalState.value\n .previousSelectedEditableDOM,\n focusedToolbar: params.focusedToolbar,\n resizeObserver: params.resizeObserver,\n });\n }\n }\n\n if (\n VisualBuilder.VisualBuilderGlobalState.value\n .previousHoveredTargetDOM === editableElement\n ) {\n return;\n }\n\n VisualBuilder.VisualBuilderGlobalState.value.previousHoveredTargetDOM =\n editableElement;\n}, 10);\n\nasync function generateCursor({\n eventDetails,\n customCursor,\n}: {\n eventDetails: VisualBuilderCslpEventDetails;\n customCursor: HTMLDivElement | null;\n}) {\n if (!customCursor) return;\n const { fieldMetadata } = eventDetails;\n const fieldSchema = await FieldSchemaMap.getFieldSchema(\n fieldMetadata.content_type_uid,\n fieldMetadata.fieldPath\n );\n if (!fieldSchema) {\n return;\n }\n const { acl: entryAcl, workflowStage: entryWorkflowStageDetails } =\n await fetchEntryPermissionsAndStageDetails({\n entryUid: fieldMetadata.entry_uid,\n contentTypeUid: fieldMetadata.content_type_uid,\n locale: fieldMetadata.locale,\n variantUid: fieldMetadata.variant,\n });\n const { isDisabled: fieldDisabled } = isFieldDisabled(\n fieldSchema,\n eventDetails,\n entryAcl,\n entryWorkflowStageDetails\n );\n const fieldType = getFieldType(fieldSchema);\n generateCustomCursor({\n fieldType,\n customCursor,\n fieldDisabled,\n });\n}\n\nconst handleMouseHover = async (\n params: HandleMouseHoverParams\n): Promise<void> => await throttledMouseHover(params);\n\nexport default handleMouseHover;\n"],"mappings":";;;AAAA,SAAS,UAAU,gBAAgB;AACnC,SAAS,0BAA0B;AACnC,SAAS,gCAAgC;AACzC,SAAS,4B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A,IACxB,gBAAgB,cAAc;AAAA,IAC9B,QAAQ,cAAc;AAAA,IACtB,YAAY,cAAc;AAAA,EAC9B,CAAC;AACL,QAAM,EAAE,YAAY,cAAc,IAAI;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACA,QAAM,YAAY,aAAa,WAAW;AAC1C,uBAAqB;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC;AACL;AAEA,IAAM,mBAAmB,OACrB,WACgB,MAAM,oBAAoB,MAAM;AAEpD,IAAO,qBAAQ;","names":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.ts
|
|
21
|
+
var fetchEntryPermissionsAndStageDetails_exports = {};
|
|
22
|
+
__export(fetchEntryPermissionsAndStageDetails_exports, {
|
|
23
|
+
fetchEntryPermissionsAndStageDetails: () => fetchEntryPermissionsAndStageDetails
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(fetchEntryPermissionsAndStageDetails_exports);
|
|
26
|
+
var import_getEntryPermissionsCached = require("./getEntryPermissionsCached.cjs");
|
|
27
|
+
var import_getWorkflowStageDetails = require("./getWorkflowStageDetails.cjs");
|
|
28
|
+
async function fetchEntryPermissionsAndStageDetails({
|
|
29
|
+
entryUid,
|
|
30
|
+
contentTypeUid,
|
|
31
|
+
locale,
|
|
32
|
+
variantUid
|
|
33
|
+
}) {
|
|
34
|
+
const entryAclPromise = (0, import_getEntryPermissionsCached.getEntryPermissionsCached)({
|
|
35
|
+
entryUid,
|
|
36
|
+
contentTypeUid,
|
|
37
|
+
locale
|
|
38
|
+
});
|
|
39
|
+
const entryWorkflowStageDetailsPromise = (0, import_getWorkflowStageDetails.getWorkflowStageDetails)({
|
|
40
|
+
entryUid,
|
|
41
|
+
contentTypeUid,
|
|
42
|
+
locale,
|
|
43
|
+
variantUid
|
|
44
|
+
});
|
|
45
|
+
const results = await Promise.allSettled([
|
|
46
|
+
entryAclPromise,
|
|
47
|
+
entryWorkflowStageDetailsPromise
|
|
48
|
+
]);
|
|
49
|
+
if (results[0].status === "rejected") {
|
|
50
|
+
console.debug(
|
|
51
|
+
"[Visual Builder] Error retrieving entry permissions",
|
|
52
|
+
results[0].reason
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
if (results[1].status === "rejected") {
|
|
56
|
+
console.debug(
|
|
57
|
+
"[Visual Builder] Error retrieving entry stage details",
|
|
58
|
+
results[1].reason
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
const acl = results[0].status === "fulfilled" ? results[0].value : void 0;
|
|
62
|
+
const workflowStage = results[1].status === "fulfilled" ? results[1].value : void 0;
|
|
63
|
+
return {
|
|
64
|
+
acl,
|
|
65
|
+
workflowStage
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
+
0 && (module.exports = {
|
|
70
|
+
fetchEntryPermissionsAndStageDetails
|
|
71
|
+
});
|
|
72
|
+
//# sourceMappingURL=fetchEntryPermissionsAndStageDetails.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.ts"],"sourcesContent":["import { getEntryPermissionsCached } from \"./getEntryPermissionsCached\";\nimport { getWorkflowStageDetails } from \"./getWorkflowStageDetails\";\n\nexport async function fetchEntryPermissionsAndStageDetails({\n entryUid,\n contentTypeUid,\n locale,\n variantUid,\n}: {\n entryUid: string;\n contentTypeUid: string;\n locale: string;\n variantUid?: string | undefined;\n}) {\n const entryAclPromise = getEntryPermissionsCached({\n entryUid,\n contentTypeUid,\n locale,\n });\n const entryWorkflowStageDetailsPromise = getWorkflowStageDetails({\n entryUid,\n contentTypeUid,\n locale,\n variantUid,\n });\n const results = await Promise.allSettled([\n entryAclPromise,\n entryWorkflowStageDetailsPromise,\n ]);\n if (results[0].status === \"rejected\") {\n console.debug(\n \"[Visual Builder] Error retrieving entry permissions\",\n results[0].reason\n );\n }\n if (results[1].status === \"rejected\") {\n console.debug(\n \"[Visual Builder] Error retrieving entry stage details\",\n results[1].reason\n );\n }\n const acl =\n results[0].status === \"fulfilled\" ? results[0].value : undefined;\n const workflowStage =\n results[1].status === \"fulfilled\" ? results[1].value : undefined;\n return {\n acl,\n workflowStage,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAA0C;AAC1C,qCAAwC;AAExC,eAAsB,qCAAqC;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,GAKG;AACC,QAAM,sBAAkB,4DAA0B;AAAA,IAC9C;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC;AACD,QAAM,uCAAmC,wDAAwB;AAAA,IAC7D;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC;AACD,QAAM,UAAU,MAAM,QAAQ,WAAW;AAAA,IACrC;AAAA,IACA;AAAA,EACJ,CAAC;AACD,MAAI,QAAQ,CAAC,EAAE,WAAW,YAAY;AAClC,YAAQ;AAAA,MACJ;AAAA,MACA,QAAQ,CAAC,EAAE;AAAA,IACf;AAAA,EACJ;AACA,MAAI,QAAQ,CAAC,EAAE,WAAW,YAAY;AAClC,YAAQ;AAAA,MACJ;AAAA,MACA,QAAQ,CAAC,EAAE;AAAA,IACf;AAAA,EACJ;AACA,QAAM,MACF,QAAQ,CAAC,EAAE,WAAW,cAAc,QAAQ,CAAC,EAAE,QAAQ;AAC3D,QAAM,gBACF,QAAQ,CAAC,EAAE,WAAW,cAAc,QAAQ,CAAC,EAAE,QAAQ;AAC3D,SAAO;AAAA,IACH;AAAA,IACA;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WorkflowStageDetails } from './getWorkflowStageDetails.cjs';
|
|
2
|
+
import { EntryPermissions } from './getEntryPermissions.cjs';
|
|
3
|
+
|
|
4
|
+
declare function fetchEntryPermissionsAndStageDetails({ entryUid, contentTypeUid, locale, variantUid, }: {
|
|
5
|
+
entryUid: string;
|
|
6
|
+
contentTypeUid: string;
|
|
7
|
+
locale: string;
|
|
8
|
+
variantUid?: string | undefined;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
acl: EntryPermissions | undefined;
|
|
11
|
+
workflowStage: WorkflowStageDetails | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export { fetchEntryPermissionsAndStageDetails };
|