@arpproject/recrate 0.1.32-test3 → 0.1.32-test4
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/dist/recrate.es.js +41 -7
- package/package.json +1 -1
package/dist/recrate.es.js
CHANGED
|
@@ -112476,6 +112476,7 @@ const DEFAULT_TAB_PANE_WIDTH = 240;
|
|
|
112476
112476
|
const ICON_TAB_PANE_WIDTH = 80;
|
|
112477
112477
|
const MIN_LABEL_TAB_PANE_WIDTH = 100;
|
|
112478
112478
|
const MAX_LABEL_TAB_PANE_WIDTH = 250;
|
|
112479
|
+
const AI_SCROLL_RESTORE_SUPPRESSION_MS = 2500;
|
|
112479
112480
|
const clampLabelTabPaneWidth = (width) => Math.max(MIN_LABEL_TAB_PANE_WIDTH, Math.min(MAX_LABEL_TAB_PANE_WIDTH, Math.round(width)));
|
|
112480
112481
|
const readPendingAddedProfileTabKeys = (entityId) => {
|
|
112481
112482
|
if (typeof window === "undefined") return null;
|
|
@@ -112510,6 +112511,18 @@ const clearPendingAddedProfileTabKeys = (entityId) => {
|
|
|
112510
112511
|
} catch {
|
|
112511
112512
|
}
|
|
112512
112513
|
};
|
|
112514
|
+
const buildAiApprovalNavigationKey = (entityId, approvalRecord) => {
|
|
112515
|
+
const propertyName2 = String((approvalRecord == null ? void 0 : approvalRecord.propertyName) ?? "");
|
|
112516
|
+
const operation = String((approvalRecord == null ? void 0 : approvalRecord.operation) ?? "");
|
|
112517
|
+
const timestamp = String((approvalRecord == null ? void 0 : approvalRecord.timestamp) ?? "");
|
|
112518
|
+
let previousValue = "";
|
|
112519
|
+
try {
|
|
112520
|
+
previousValue = JSON.stringify((approvalRecord == null ? void 0 : approvalRecord.previousValue) ?? null);
|
|
112521
|
+
} catch {
|
|
112522
|
+
previousValue = String((approvalRecord == null ? void 0 : approvalRecord.previousValue) ?? "");
|
|
112523
|
+
}
|
|
112524
|
+
return `${entityId}:${propertyName2}:${operation}:${timestamp}:${previousValue}`;
|
|
112525
|
+
};
|
|
112513
112526
|
const RenderEntity = forwardRef((props, ref) => {
|
|
112514
112527
|
var _a2, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
112515
112528
|
const { entity, onLoadEntity, onSaveCrate, onSaveEntityTemplate, onWarning, onError, onAddNewProfileRequest, onRemoveProfile } = props;
|
|
@@ -112561,9 +112574,14 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
112561
112574
|
const pendingAddedProfileSelectionRef = useRef(null);
|
|
112562
112575
|
const pendingAddedPropertyRef = useRef(null);
|
|
112563
112576
|
const pendingAiScrollPropertyRef = useRef(null);
|
|
112577
|
+
const aiScrollRestoreSuppressedUntilRef = useRef(0);
|
|
112564
112578
|
const lastAutoNavigatedAiApprovalRef = useRef(null);
|
|
112565
112579
|
const [tabRailScrollState, setTabRailScrollState] = useState({ canScrollUp: false, canScrollDown: false });
|
|
112566
112580
|
const debugScroll = (...args) => console.log("[recrate-scroll-debug]", ...args);
|
|
112581
|
+
const suppressAiScrollRestore = () => {
|
|
112582
|
+
aiScrollRestoreSuppressedUntilRef.current = Date.now() + AI_SCROLL_RESTORE_SUPPRESSION_MS;
|
|
112583
|
+
};
|
|
112584
|
+
const isAiScrollRestoreSuppressed = () => Date.now() < aiScrollRestoreSuppressedUntilRef.current;
|
|
112567
112585
|
const pendingAiApprovals = useMemo$1(() => getPendingEntityApprovalRecords(approvalContext == null ? void 0 : approvalContext.roCrateApproval, contextEntity == null ? void 0 : contextEntity["@id"]), [approvalContext == null ? void 0 : approvalContext.roCrateApproval, contextEntity == null ? void 0 : contextEntity["@id"]]);
|
|
112568
112586
|
const pendingAiApprovalProperties = useMemo$1(() => pendingAiApprovals.map((approvalRecord) => approvalRecord == null ? void 0 : approvalRecord.propertyName).filter((property) => typeof property === "string" && property.length > 0), [pendingAiApprovals]);
|
|
112569
112587
|
const pendingDeletedEntityReviewProperties = useMemo$1(() => getPendingDeletedEntityReversePropertiesForSource(
|
|
@@ -112924,6 +112942,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
112924
112942
|
if (!navigationRestoreReadyRef.current) return;
|
|
112925
112943
|
if (!(contextEntity == null ? void 0 : contextEntity["@id"])) return;
|
|
112926
112944
|
if (((_a3 = pendingAddedPropertyRef.current) == null ? void 0 : _a3.entityId) === contextEntity["@id"]) return;
|
|
112945
|
+
if (isAiScrollRestoreSuppressed()) return;
|
|
112927
112946
|
const viewport = activeContentRef.current;
|
|
112928
112947
|
if (!viewport) return;
|
|
112929
112948
|
const restoreTarget = ((_d2 = (_c2 = (_b2 = state.editorState.getNavigationState(contextEntity["@id"])) == null ? void 0 : _b2.tabStates) == null ? void 0 : _c2[activeTab]) == null ? void 0 : _d2.scrollTop) ?? 0;
|
|
@@ -112947,6 +112966,11 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
112947
112966
|
viewport.style.scrollBehavior = "auto";
|
|
112948
112967
|
const attemptRestore = () => {
|
|
112949
112968
|
if (cancelled) return;
|
|
112969
|
+
if (isAiScrollRestoreSuppressed()) {
|
|
112970
|
+
restoreInProgressRef.current = false;
|
|
112971
|
+
viewport.style.scrollBehavior = previousInlineScrollBehavior;
|
|
112972
|
+
return;
|
|
112973
|
+
}
|
|
112950
112974
|
attempts += 1;
|
|
112951
112975
|
const maxScrollable = Math.max(0, viewport.scrollHeight - viewport.clientHeight);
|
|
112952
112976
|
const target = Math.min(restoreTarget, maxScrollable);
|
|
@@ -112992,7 +113016,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
112992
113016
|
cancelled = true;
|
|
112993
113017
|
restoreInProgressRef.current = false;
|
|
112994
113018
|
viewport.style.scrollBehavior = previousInlineScrollBehavior;
|
|
112995
|
-
if (navigationRestoreReadyRef.current) {
|
|
113019
|
+
if (navigationRestoreReadyRef.current && !isAiScrollRestoreSuppressed()) {
|
|
112996
113020
|
captureViewContext(activeTab, viewport.scrollTop);
|
|
112997
113021
|
}
|
|
112998
113022
|
viewport.removeEventListener("scroll", handleScroll);
|
|
@@ -113005,6 +113029,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
113005
113029
|
const pendingTab = pendingRestoredTabRef.current;
|
|
113006
113030
|
if (!(contextEntity == null ? void 0 : contextEntity["@id"])) return;
|
|
113007
113031
|
if (((_a3 = pendingAddedPropertyRef.current) == null ? void 0 : _a3.entityId) === contextEntity["@id"]) return;
|
|
113032
|
+
if (isAiScrollRestoreSuppressed()) return;
|
|
113008
113033
|
if (pendingTab) {
|
|
113009
113034
|
debugScroll("restore.pending-tab", {
|
|
113010
113035
|
entityId: contextEntity["@id"],
|
|
@@ -113580,6 +113605,7 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
113580
113605
|
if (!hasFieldValue(contextEntity == null ? void 0 : contextEntity[property]) && hideEmptyFields) {
|
|
113581
113606
|
setHideEmptyFields(false);
|
|
113582
113607
|
}
|
|
113608
|
+
suppressAiScrollRestore();
|
|
113583
113609
|
pendingAiScrollPropertyRef.current = property;
|
|
113584
113610
|
const propertyTab = renderTabs ? findTabForProperty(tabs, property) : null;
|
|
113585
113611
|
if ((propertyTab == null ? void 0 : propertyTab.name) && propertyTab.name !== activeTab) {
|
|
@@ -113599,18 +113625,18 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
113599
113625
|
tabs
|
|
113600
113626
|
]);
|
|
113601
113627
|
useEffect(() => {
|
|
113602
|
-
var _a3;
|
|
113603
113628
|
const entityId = contextEntity == null ? void 0 : contextEntity["@id"];
|
|
113604
|
-
const
|
|
113629
|
+
const firstPendingApproval = pendingAiApprovals[0];
|
|
113630
|
+
const firstPendingProperty = firstPendingApproval == null ? void 0 : firstPendingApproval.propertyName;
|
|
113605
113631
|
if (!entityId || !firstPendingProperty) {
|
|
113606
113632
|
lastAutoNavigatedAiApprovalRef.current = null;
|
|
113607
113633
|
return;
|
|
113608
113634
|
}
|
|
113609
|
-
const autoNavigationKey = `${
|
|
113635
|
+
const autoNavigationKey = `${(profileManager == null ? void 0 : profileManager.$key) ?? 0}:${buildAiApprovalNavigationKey(entityId, firstPendingApproval)}`;
|
|
113610
113636
|
if (lastAutoNavigatedAiApprovalRef.current === autoNavigationKey) return;
|
|
113611
113637
|
lastAutoNavigatedAiApprovalRef.current = autoNavigationKey;
|
|
113612
113638
|
navigateToAiApproval(0);
|
|
113613
|
-
}, [contextEntity == null ? void 0 : contextEntity["@id"], navigateToAiApproval, pendingAiApprovals]);
|
|
113639
|
+
}, [contextEntity == null ? void 0 : contextEntity["@id"], navigateToAiApproval, pendingAiApprovals, profileManager == null ? void 0 : profileManager.$key]);
|
|
113614
113640
|
useEffect(() => {
|
|
113615
113641
|
const pendingProperty = pendingAiScrollPropertyRef.current;
|
|
113616
113642
|
if (!pendingProperty) return;
|
|
@@ -113621,8 +113647,16 @@ const RenderEntity = forwardRef((props, ref) => {
|
|
|
113621
113647
|
return;
|
|
113622
113648
|
}
|
|
113623
113649
|
const cancelScroll = scrollToAiApprovalProperty(pendingProperty);
|
|
113650
|
+
const captureTimer = window.setTimeout(() => {
|
|
113651
|
+
if (activeContentRef.current) {
|
|
113652
|
+
captureViewContext(activeTab, activeContentRef.current.scrollTop);
|
|
113653
|
+
}
|
|
113654
|
+
}, 350);
|
|
113624
113655
|
pendingAiScrollPropertyRef.current = null;
|
|
113625
|
-
return
|
|
113656
|
+
return () => {
|
|
113657
|
+
cancelScroll();
|
|
113658
|
+
window.clearTimeout(captureTimer);
|
|
113659
|
+
};
|
|
113626
113660
|
}, [activeTab, contextEntity == null ? void 0 : contextEntity["@id"], renderTabs, selectedAiApprovalIndex, tabs, scrollToAiApprovalProperty]);
|
|
113627
113661
|
const isEntityReference2 = (value) => Boolean(value && typeof value === "object" && typeof value["@id"] === "string");
|
|
113628
113662
|
const restoreNonCoreApprovalValue = (approvalRecord) => {
|
|
@@ -122793,7 +122827,7 @@ var EmotionCacheContext = /* @__PURE__ */ React.createContext(
|
|
|
122793
122827
|
}) : null
|
|
122794
122828
|
);
|
|
122795
122829
|
var CacheProvider = EmotionCacheContext.Provider;
|
|
122796
|
-
const version = "0.1.32-
|
|
122830
|
+
const version = "0.1.32-test4";
|
|
122797
122831
|
const pkg = {
|
|
122798
122832
|
version
|
|
122799
122833
|
};
|