react-grab 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GYJRJR7H.js → chunk-H7IR3CM4.js} +28 -28
- package/dist/{chunk-A4P2NQ77.cjs → chunk-RL275Y6D.cjs} +28 -28
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.global.js +32 -32
- package/dist/index.js +1 -1
- package/dist/react.cjs +77 -20
- package/dist/react.js +77 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {i}from'./chunk-
|
|
1
|
+
import {i}from'./chunk-H7IR3CM4.js';export{f as DEFAULT_THEME,g as commentPlugin,c as formatElementInfo,e as generateSnippet,b as getStack,i as init,a as isInstrumentationActive,h as openPlugin}from'./chunk-H7IR3CM4.js';/**
|
|
2
2
|
* @license MIT
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2025 Aiden Bai
|
package/dist/react.cjs
CHANGED
|
@@ -2152,7 +2152,7 @@ var VERSION, VIEWPORT_MARGIN_PX, OFFSCREEN_POSITION, SELECTION_LERP_FACTOR, FEED
|
|
|
2152
2152
|
var init_constants = __esm({
|
|
2153
2153
|
"src/constants.ts"() {
|
|
2154
2154
|
"use strict";
|
|
2155
|
-
VERSION = "0.1.
|
|
2155
|
+
VERSION = "0.1.22";
|
|
2156
2156
|
VIEWPORT_MARGIN_PX = 8;
|
|
2157
2157
|
OFFSCREEN_POSITION = -1e3;
|
|
2158
2158
|
SELECTION_LERP_FACTOR = 0.95;
|
|
@@ -3927,7 +3927,7 @@ var init_truncate_string = __esm({
|
|
|
3927
3927
|
});
|
|
3928
3928
|
|
|
3929
3929
|
// src/core/context.ts
|
|
3930
|
-
var NON_COMPONENT_PREFIXES, NEXT_INTERNAL_COMPONENT_NAMES, REACT_INTERNAL_COMPONENT_NAMES, cachedIsNextProject, checkIsNextProject, checkIsInternalComponentName, checkIsSourceComponentName, SERVER_COMPONENT_URL_PREFIXES, isServerComponentUrl, devirtualizeServerUrl, symbolicateServerFrames, extractServerFramesFromDebugStack, enrichServerFrameLocations, stackCache, fetchStackForElement, getStack, getNearestComponentName, resolveSourceFromStack, isUsefulComponentName, getComponentDisplayName, hasSourceFiles, getComponentNamesFromFiber, formatStackContext, getStackContext, getElementContext, getFallbackContext, truncateAttrValue, formatPriorityAttrs, getHTMLPreview;
|
|
3930
|
+
var NON_COMPONENT_PREFIXES, NEXT_INTERNAL_COMPONENT_NAMES, REACT_INTERNAL_COMPONENT_NAMES, cachedIsNextProject, checkIsNextProject, checkIsInternalComponentName, checkIsSourceComponentName, SERVER_COMPONENT_URL_PREFIXES, isServerComponentUrl, devirtualizeServerUrl, symbolicateServerFrames, extractServerFramesFromDebugStack, enrichServerFrameLocations, findNearestFiberElement, stackCache, fetchStackForElement, getStack, getNearestComponentName, resolveSourceFromStack, isUsefulComponentName, getComponentDisplayName, hasSourceFiles, getComponentNamesFromFiber, formatStackContext, getStackContext, getElementContext, getFallbackContext, truncateAttrValue, formatPriorityAttrs, getHTMLPreview;
|
|
3931
3931
|
var init_context = __esm({
|
|
3932
3932
|
"src/core/context.ts"() {
|
|
3933
3933
|
"use strict";
|
|
@@ -4118,6 +4118,15 @@ var init_context = __esm({
|
|
|
4118
4118
|
};
|
|
4119
4119
|
});
|
|
4120
4120
|
};
|
|
4121
|
+
findNearestFiberElement = (element) => {
|
|
4122
|
+
if (!Ee()) return element;
|
|
4123
|
+
let current = element;
|
|
4124
|
+
while (current) {
|
|
4125
|
+
if (Pe(current)) return current;
|
|
4126
|
+
current = current.parentElement;
|
|
4127
|
+
}
|
|
4128
|
+
return element;
|
|
4129
|
+
};
|
|
4121
4130
|
stackCache = /* @__PURE__ */ new WeakMap();
|
|
4122
4131
|
fetchStackForElement = async (element) => {
|
|
4123
4132
|
try {
|
|
@@ -4135,10 +4144,11 @@ var init_context = __esm({
|
|
|
4135
4144
|
};
|
|
4136
4145
|
getStack = (element) => {
|
|
4137
4146
|
if (!Ee()) return Promise.resolve([]);
|
|
4138
|
-
const
|
|
4147
|
+
const resolvedElement = findNearestFiberElement(element);
|
|
4148
|
+
const cached = stackCache.get(resolvedElement);
|
|
4139
4149
|
if (cached) return cached;
|
|
4140
|
-
const promise = fetchStackForElement(
|
|
4141
|
-
stackCache.set(
|
|
4150
|
+
const promise = fetchStackForElement(resolvedElement);
|
|
4151
|
+
stackCache.set(resolvedElement, promise);
|
|
4142
4152
|
return promise;
|
|
4143
4153
|
};
|
|
4144
4154
|
getNearestComponentName = async (element) => {
|
|
@@ -4174,7 +4184,8 @@ var init_context = __esm({
|
|
|
4174
4184
|
};
|
|
4175
4185
|
getComponentDisplayName = (element) => {
|
|
4176
4186
|
if (!Ee()) return null;
|
|
4177
|
-
const
|
|
4187
|
+
const resolvedElement = findNearestFiberElement(element);
|
|
4188
|
+
const fiber = Pe(resolvedElement);
|
|
4178
4189
|
if (!fiber) return null;
|
|
4179
4190
|
let currentFiber = fiber.return;
|
|
4180
4191
|
while (currentFiber) {
|
|
@@ -4261,12 +4272,13 @@ var init_context = __esm({
|
|
|
4261
4272
|
return "";
|
|
4262
4273
|
};
|
|
4263
4274
|
getElementContext = async (element, options = {}) => {
|
|
4264
|
-
const
|
|
4265
|
-
const
|
|
4275
|
+
const resolvedElement = findNearestFiberElement(element);
|
|
4276
|
+
const html = getHTMLPreview(resolvedElement);
|
|
4277
|
+
const stackContext = await getStackContext(resolvedElement, options);
|
|
4266
4278
|
if (stackContext) {
|
|
4267
4279
|
return `${html}${stackContext}`;
|
|
4268
4280
|
}
|
|
4269
|
-
return getFallbackContext(
|
|
4281
|
+
return getFallbackContext(resolvedElement);
|
|
4270
4282
|
};
|
|
4271
4283
|
getFallbackContext = (element) => {
|
|
4272
4284
|
const tagName = getTagName(element);
|
|
@@ -8660,8 +8672,8 @@ var init_selection_label = __esm({
|
|
|
8660
8672
|
computedArrowPosition: null
|
|
8661
8673
|
};
|
|
8662
8674
|
}
|
|
8663
|
-
const viewportWidth = window.innerWidth;
|
|
8664
|
-
const viewportHeight = window.innerHeight;
|
|
8675
|
+
const viewportWidth = window.visualViewport?.width ?? window.innerWidth;
|
|
8676
|
+
const viewportHeight = window.visualViewport?.height ?? window.innerHeight;
|
|
8665
8677
|
const isSelectionVisibleInViewport = bounds.x + bounds.width > 0 && bounds.x < viewportWidth && bounds.y + bounds.height > 0 && bounds.y < viewportHeight;
|
|
8666
8678
|
if (!isSelectionVisibleInViewport) {
|
|
8667
8679
|
return {
|
|
@@ -9378,7 +9390,7 @@ var init_safe_polygon = __esm({
|
|
|
9378
9390
|
});
|
|
9379
9391
|
|
|
9380
9392
|
// src/utils/freeze-updates.ts
|
|
9381
|
-
var isUpdatesPaused, getOrCache, patchedDispatchers, wrappedDispatchCache, wrappedStartTransitionCache, pendingStoreCallbacks, pendingTransitionCallbacks, pendingStateUpdates, pausedQueueStates, pausedContextStates, renderersWithPatchedDispatcher, typedFiberRoots, getFiberRoot, collectFiberRoots, mergePendingChains, pauseHookQueue, resumeHookQueue, pauseContextDependency, resumeContextDependency, forEachHookQueue, forEachContextDependency, traverseFibers, pauseFiber, resumeFiber, patchDispatcher, installDispatcherPatching, scheduleReactUpdate, invokeCallbacks, initializeFreezeSupport, freezeUpdates;
|
|
9393
|
+
var isUpdatesPaused, getOrCache, patchedDispatchers, wrappedDispatchCache, wrappedStartTransitionCache, pendingStoreCallbacks, pendingTransitionCallbacks, pendingStateUpdates, pausedQueueStates, pausedContextStates, renderersWithPatchedDispatcher, typedFiberRoots, getFiberRoot, collectFiberRoots, mergePendingChains, pauseHookQueue, extractActionsFromChain, resumeHookQueue, pauseContextDependency, resumeContextDependency, forEachHookQueue, forEachContextDependency, traverseFibers, pauseFiber, resumeFiber, patchDispatcher, installDispatcherPatching, scheduleReactUpdate, invokeCallbacks, initializeFreezeSupport, freezeUpdates;
|
|
9382
9394
|
var init_freeze_updates = __esm({
|
|
9383
9395
|
"src/utils/freeze-updates.ts"() {
|
|
9384
9396
|
"use strict";
|
|
@@ -9470,26 +9482,42 @@ var init_freeze_updates = __esm({
|
|
|
9470
9482
|
Object.defineProperty(queue, "pending", {
|
|
9471
9483
|
configurable: true,
|
|
9472
9484
|
enumerable: true,
|
|
9473
|
-
get: () => isUpdatesPaused ?
|
|
9485
|
+
get: () => isUpdatesPaused ? null : currentPendingValue,
|
|
9474
9486
|
set: (newValue) => {
|
|
9475
9487
|
if (isUpdatesPaused) {
|
|
9476
|
-
|
|
9488
|
+
if (newValue !== null) {
|
|
9489
|
+
pauseState.bufferedPending = mergePendingChains(
|
|
9490
|
+
pauseState.bufferedPending ?? null,
|
|
9491
|
+
newValue
|
|
9492
|
+
);
|
|
9493
|
+
}
|
|
9494
|
+
return;
|
|
9477
9495
|
}
|
|
9478
9496
|
currentPendingValue = newValue;
|
|
9479
9497
|
}
|
|
9480
9498
|
});
|
|
9481
9499
|
pausedQueueStates.set(queue, pauseState);
|
|
9482
9500
|
};
|
|
9501
|
+
extractActionsFromChain = (pending) => {
|
|
9502
|
+
if (!pending) return [];
|
|
9503
|
+
const actions = [];
|
|
9504
|
+
const first = pending.next;
|
|
9505
|
+
if (!first) return [];
|
|
9506
|
+
let current = first;
|
|
9507
|
+
do {
|
|
9508
|
+
if (current) {
|
|
9509
|
+
actions.push(current.action);
|
|
9510
|
+
current = current.next;
|
|
9511
|
+
}
|
|
9512
|
+
} while (current && current !== first);
|
|
9513
|
+
return actions;
|
|
9514
|
+
};
|
|
9483
9515
|
resumeHookQueue = (queue) => {
|
|
9484
9516
|
const pauseState = pausedQueueStates.get(queue);
|
|
9485
9517
|
if (!pauseState) return;
|
|
9486
9518
|
if (pauseState.originalGetSnapshot) {
|
|
9487
9519
|
queue.getSnapshot = pauseState.originalGetSnapshot;
|
|
9488
9520
|
}
|
|
9489
|
-
const mergedPending = mergePendingChains(
|
|
9490
|
-
pauseState.pendingValueAtPause ?? null,
|
|
9491
|
-
pauseState.bufferedPending ?? null
|
|
9492
|
-
);
|
|
9493
9521
|
if (pauseState.originalPendingDescriptor) {
|
|
9494
9522
|
Object.defineProperty(
|
|
9495
9523
|
queue,
|
|
@@ -9499,7 +9527,19 @@ var init_freeze_updates = __esm({
|
|
|
9499
9527
|
} else {
|
|
9500
9528
|
delete queue.pending;
|
|
9501
9529
|
}
|
|
9502
|
-
queue.pending =
|
|
9530
|
+
queue.pending = null;
|
|
9531
|
+
const dispatch = queue.dispatch;
|
|
9532
|
+
if (typeof dispatch === "function") {
|
|
9533
|
+
const pendingActions = extractActionsFromChain(
|
|
9534
|
+
pauseState.pendingValueAtPause ?? null
|
|
9535
|
+
);
|
|
9536
|
+
const bufferedActions = extractActionsFromChain(
|
|
9537
|
+
pauseState.bufferedPending ?? null
|
|
9538
|
+
);
|
|
9539
|
+
for (const action of [...pendingActions, ...bufferedActions]) {
|
|
9540
|
+
pendingStateUpdates.push(() => dispatch(action));
|
|
9541
|
+
}
|
|
9542
|
+
}
|
|
9503
9543
|
pausedQueueStates.delete(queue);
|
|
9504
9544
|
};
|
|
9505
9545
|
pauseContextDependency = (contextDependency) => {
|
|
@@ -15418,7 +15458,7 @@ var init_log_intro = __esm({
|
|
|
15418
15458
|
init_is_extension_context();
|
|
15419
15459
|
logIntro = () => {
|
|
15420
15460
|
try {
|
|
15421
|
-
const version = "0.1.
|
|
15461
|
+
const version = "0.1.22";
|
|
15422
15462
|
const logoDataUri = `data:image/svg+xml;base64,${btoa(LOGO_SVG)}`;
|
|
15423
15463
|
console.log(
|
|
15424
15464
|
`%cReact Grab${version ? ` v${version}` : ""}%c
|
|
@@ -17818,8 +17858,13 @@ var init_core = __esm({
|
|
|
17818
17858
|
if (!event.isPrimary) return;
|
|
17819
17859
|
if (isEventFromOverlay(event, "data-react-grab-ignore-events")) return;
|
|
17820
17860
|
if (store.contextMenuPosition !== null) return;
|
|
17861
|
+
const isActive = isRendererActive() || isCopying() || isDragging();
|
|
17821
17862
|
const hasModifierKeyHeld = event.metaKey || event.ctrlKey;
|
|
17822
17863
|
handlePointerUp(event.clientX, event.clientY, hasModifierKeyHeld);
|
|
17864
|
+
if (isActive) {
|
|
17865
|
+
event.preventDefault();
|
|
17866
|
+
event.stopImmediatePropagation();
|
|
17867
|
+
}
|
|
17823
17868
|
}, {
|
|
17824
17869
|
capture: true
|
|
17825
17870
|
});
|
|
@@ -17936,6 +17981,18 @@ var init_core = __esm({
|
|
|
17936
17981
|
previousViewportHeight = currentViewportHeight;
|
|
17937
17982
|
handleViewportChange();
|
|
17938
17983
|
});
|
|
17984
|
+
const visualViewport = window.visualViewport;
|
|
17985
|
+
if (visualViewport) {
|
|
17986
|
+
const {
|
|
17987
|
+
signal
|
|
17988
|
+
} = eventListenerManager;
|
|
17989
|
+
visualViewport.addEventListener("resize", handleViewportChange, {
|
|
17990
|
+
signal
|
|
17991
|
+
});
|
|
17992
|
+
visualViewport.addEventListener("scroll", handleViewportChange, {
|
|
17993
|
+
signal
|
|
17994
|
+
});
|
|
17995
|
+
}
|
|
17939
17996
|
let boundsRecalcIntervalId = null;
|
|
17940
17997
|
let viewportChangeFrameId = null;
|
|
17941
17998
|
const startBoundsRecalcIntervalIfNeeded = () => {
|
package/dist/react.js
CHANGED
|
@@ -2140,7 +2140,7 @@ var VERSION, VIEWPORT_MARGIN_PX, OFFSCREEN_POSITION, SELECTION_LERP_FACTOR, FEED
|
|
|
2140
2140
|
var init_constants = __esm({
|
|
2141
2141
|
"src/constants.ts"() {
|
|
2142
2142
|
"use strict";
|
|
2143
|
-
VERSION = "0.1.
|
|
2143
|
+
VERSION = "0.1.22";
|
|
2144
2144
|
VIEWPORT_MARGIN_PX = 8;
|
|
2145
2145
|
OFFSCREEN_POSITION = -1e3;
|
|
2146
2146
|
SELECTION_LERP_FACTOR = 0.95;
|
|
@@ -3915,7 +3915,7 @@ var init_truncate_string = __esm({
|
|
|
3915
3915
|
});
|
|
3916
3916
|
|
|
3917
3917
|
// src/core/context.ts
|
|
3918
|
-
var NON_COMPONENT_PREFIXES, NEXT_INTERNAL_COMPONENT_NAMES, REACT_INTERNAL_COMPONENT_NAMES, cachedIsNextProject, checkIsNextProject, checkIsInternalComponentName, checkIsSourceComponentName, SERVER_COMPONENT_URL_PREFIXES, isServerComponentUrl, devirtualizeServerUrl, symbolicateServerFrames, extractServerFramesFromDebugStack, enrichServerFrameLocations, stackCache, fetchStackForElement, getStack, getNearestComponentName, resolveSourceFromStack, isUsefulComponentName, getComponentDisplayName, hasSourceFiles, getComponentNamesFromFiber, formatStackContext, getStackContext, getElementContext, getFallbackContext, truncateAttrValue, formatPriorityAttrs, getHTMLPreview;
|
|
3918
|
+
var NON_COMPONENT_PREFIXES, NEXT_INTERNAL_COMPONENT_NAMES, REACT_INTERNAL_COMPONENT_NAMES, cachedIsNextProject, checkIsNextProject, checkIsInternalComponentName, checkIsSourceComponentName, SERVER_COMPONENT_URL_PREFIXES, isServerComponentUrl, devirtualizeServerUrl, symbolicateServerFrames, extractServerFramesFromDebugStack, enrichServerFrameLocations, findNearestFiberElement, stackCache, fetchStackForElement, getStack, getNearestComponentName, resolveSourceFromStack, isUsefulComponentName, getComponentDisplayName, hasSourceFiles, getComponentNamesFromFiber, formatStackContext, getStackContext, getElementContext, getFallbackContext, truncateAttrValue, formatPriorityAttrs, getHTMLPreview;
|
|
3919
3919
|
var init_context = __esm({
|
|
3920
3920
|
"src/core/context.ts"() {
|
|
3921
3921
|
"use strict";
|
|
@@ -4106,6 +4106,15 @@ var init_context = __esm({
|
|
|
4106
4106
|
};
|
|
4107
4107
|
});
|
|
4108
4108
|
};
|
|
4109
|
+
findNearestFiberElement = (element) => {
|
|
4110
|
+
if (!Ee()) return element;
|
|
4111
|
+
let current = element;
|
|
4112
|
+
while (current) {
|
|
4113
|
+
if (Pe(current)) return current;
|
|
4114
|
+
current = current.parentElement;
|
|
4115
|
+
}
|
|
4116
|
+
return element;
|
|
4117
|
+
};
|
|
4109
4118
|
stackCache = /* @__PURE__ */ new WeakMap();
|
|
4110
4119
|
fetchStackForElement = async (element) => {
|
|
4111
4120
|
try {
|
|
@@ -4123,10 +4132,11 @@ var init_context = __esm({
|
|
|
4123
4132
|
};
|
|
4124
4133
|
getStack = (element) => {
|
|
4125
4134
|
if (!Ee()) return Promise.resolve([]);
|
|
4126
|
-
const
|
|
4135
|
+
const resolvedElement = findNearestFiberElement(element);
|
|
4136
|
+
const cached = stackCache.get(resolvedElement);
|
|
4127
4137
|
if (cached) return cached;
|
|
4128
|
-
const promise = fetchStackForElement(
|
|
4129
|
-
stackCache.set(
|
|
4138
|
+
const promise = fetchStackForElement(resolvedElement);
|
|
4139
|
+
stackCache.set(resolvedElement, promise);
|
|
4130
4140
|
return promise;
|
|
4131
4141
|
};
|
|
4132
4142
|
getNearestComponentName = async (element) => {
|
|
@@ -4162,7 +4172,8 @@ var init_context = __esm({
|
|
|
4162
4172
|
};
|
|
4163
4173
|
getComponentDisplayName = (element) => {
|
|
4164
4174
|
if (!Ee()) return null;
|
|
4165
|
-
const
|
|
4175
|
+
const resolvedElement = findNearestFiberElement(element);
|
|
4176
|
+
const fiber = Pe(resolvedElement);
|
|
4166
4177
|
if (!fiber) return null;
|
|
4167
4178
|
let currentFiber = fiber.return;
|
|
4168
4179
|
while (currentFiber) {
|
|
@@ -4249,12 +4260,13 @@ var init_context = __esm({
|
|
|
4249
4260
|
return "";
|
|
4250
4261
|
};
|
|
4251
4262
|
getElementContext = async (element, options = {}) => {
|
|
4252
|
-
const
|
|
4253
|
-
const
|
|
4263
|
+
const resolvedElement = findNearestFiberElement(element);
|
|
4264
|
+
const html = getHTMLPreview(resolvedElement);
|
|
4265
|
+
const stackContext = await getStackContext(resolvedElement, options);
|
|
4254
4266
|
if (stackContext) {
|
|
4255
4267
|
return `${html}${stackContext}`;
|
|
4256
4268
|
}
|
|
4257
|
-
return getFallbackContext(
|
|
4269
|
+
return getFallbackContext(resolvedElement);
|
|
4258
4270
|
};
|
|
4259
4271
|
getFallbackContext = (element) => {
|
|
4260
4272
|
const tagName = getTagName(element);
|
|
@@ -8648,8 +8660,8 @@ var init_selection_label = __esm({
|
|
|
8648
8660
|
computedArrowPosition: null
|
|
8649
8661
|
};
|
|
8650
8662
|
}
|
|
8651
|
-
const viewportWidth = window.innerWidth;
|
|
8652
|
-
const viewportHeight = window.innerHeight;
|
|
8663
|
+
const viewportWidth = window.visualViewport?.width ?? window.innerWidth;
|
|
8664
|
+
const viewportHeight = window.visualViewport?.height ?? window.innerHeight;
|
|
8653
8665
|
const isSelectionVisibleInViewport = bounds.x + bounds.width > 0 && bounds.x < viewportWidth && bounds.y + bounds.height > 0 && bounds.y < viewportHeight;
|
|
8654
8666
|
if (!isSelectionVisibleInViewport) {
|
|
8655
8667
|
return {
|
|
@@ -9366,7 +9378,7 @@ var init_safe_polygon = __esm({
|
|
|
9366
9378
|
});
|
|
9367
9379
|
|
|
9368
9380
|
// src/utils/freeze-updates.ts
|
|
9369
|
-
var isUpdatesPaused, getOrCache, patchedDispatchers, wrappedDispatchCache, wrappedStartTransitionCache, pendingStoreCallbacks, pendingTransitionCallbacks, pendingStateUpdates, pausedQueueStates, pausedContextStates, renderersWithPatchedDispatcher, typedFiberRoots, getFiberRoot, collectFiberRoots, mergePendingChains, pauseHookQueue, resumeHookQueue, pauseContextDependency, resumeContextDependency, forEachHookQueue, forEachContextDependency, traverseFibers, pauseFiber, resumeFiber, patchDispatcher, installDispatcherPatching, scheduleReactUpdate, invokeCallbacks, initializeFreezeSupport, freezeUpdates;
|
|
9381
|
+
var isUpdatesPaused, getOrCache, patchedDispatchers, wrappedDispatchCache, wrappedStartTransitionCache, pendingStoreCallbacks, pendingTransitionCallbacks, pendingStateUpdates, pausedQueueStates, pausedContextStates, renderersWithPatchedDispatcher, typedFiberRoots, getFiberRoot, collectFiberRoots, mergePendingChains, pauseHookQueue, extractActionsFromChain, resumeHookQueue, pauseContextDependency, resumeContextDependency, forEachHookQueue, forEachContextDependency, traverseFibers, pauseFiber, resumeFiber, patchDispatcher, installDispatcherPatching, scheduleReactUpdate, invokeCallbacks, initializeFreezeSupport, freezeUpdates;
|
|
9370
9382
|
var init_freeze_updates = __esm({
|
|
9371
9383
|
"src/utils/freeze-updates.ts"() {
|
|
9372
9384
|
"use strict";
|
|
@@ -9458,26 +9470,42 @@ var init_freeze_updates = __esm({
|
|
|
9458
9470
|
Object.defineProperty(queue, "pending", {
|
|
9459
9471
|
configurable: true,
|
|
9460
9472
|
enumerable: true,
|
|
9461
|
-
get: () => isUpdatesPaused ?
|
|
9473
|
+
get: () => isUpdatesPaused ? null : currentPendingValue,
|
|
9462
9474
|
set: (newValue) => {
|
|
9463
9475
|
if (isUpdatesPaused) {
|
|
9464
|
-
|
|
9476
|
+
if (newValue !== null) {
|
|
9477
|
+
pauseState.bufferedPending = mergePendingChains(
|
|
9478
|
+
pauseState.bufferedPending ?? null,
|
|
9479
|
+
newValue
|
|
9480
|
+
);
|
|
9481
|
+
}
|
|
9482
|
+
return;
|
|
9465
9483
|
}
|
|
9466
9484
|
currentPendingValue = newValue;
|
|
9467
9485
|
}
|
|
9468
9486
|
});
|
|
9469
9487
|
pausedQueueStates.set(queue, pauseState);
|
|
9470
9488
|
};
|
|
9489
|
+
extractActionsFromChain = (pending) => {
|
|
9490
|
+
if (!pending) return [];
|
|
9491
|
+
const actions = [];
|
|
9492
|
+
const first = pending.next;
|
|
9493
|
+
if (!first) return [];
|
|
9494
|
+
let current = first;
|
|
9495
|
+
do {
|
|
9496
|
+
if (current) {
|
|
9497
|
+
actions.push(current.action);
|
|
9498
|
+
current = current.next;
|
|
9499
|
+
}
|
|
9500
|
+
} while (current && current !== first);
|
|
9501
|
+
return actions;
|
|
9502
|
+
};
|
|
9471
9503
|
resumeHookQueue = (queue) => {
|
|
9472
9504
|
const pauseState = pausedQueueStates.get(queue);
|
|
9473
9505
|
if (!pauseState) return;
|
|
9474
9506
|
if (pauseState.originalGetSnapshot) {
|
|
9475
9507
|
queue.getSnapshot = pauseState.originalGetSnapshot;
|
|
9476
9508
|
}
|
|
9477
|
-
const mergedPending = mergePendingChains(
|
|
9478
|
-
pauseState.pendingValueAtPause ?? null,
|
|
9479
|
-
pauseState.bufferedPending ?? null
|
|
9480
|
-
);
|
|
9481
9509
|
if (pauseState.originalPendingDescriptor) {
|
|
9482
9510
|
Object.defineProperty(
|
|
9483
9511
|
queue,
|
|
@@ -9487,7 +9515,19 @@ var init_freeze_updates = __esm({
|
|
|
9487
9515
|
} else {
|
|
9488
9516
|
delete queue.pending;
|
|
9489
9517
|
}
|
|
9490
|
-
queue.pending =
|
|
9518
|
+
queue.pending = null;
|
|
9519
|
+
const dispatch = queue.dispatch;
|
|
9520
|
+
if (typeof dispatch === "function") {
|
|
9521
|
+
const pendingActions = extractActionsFromChain(
|
|
9522
|
+
pauseState.pendingValueAtPause ?? null
|
|
9523
|
+
);
|
|
9524
|
+
const bufferedActions = extractActionsFromChain(
|
|
9525
|
+
pauseState.bufferedPending ?? null
|
|
9526
|
+
);
|
|
9527
|
+
for (const action of [...pendingActions, ...bufferedActions]) {
|
|
9528
|
+
pendingStateUpdates.push(() => dispatch(action));
|
|
9529
|
+
}
|
|
9530
|
+
}
|
|
9491
9531
|
pausedQueueStates.delete(queue);
|
|
9492
9532
|
};
|
|
9493
9533
|
pauseContextDependency = (contextDependency) => {
|
|
@@ -15406,7 +15446,7 @@ var init_log_intro = __esm({
|
|
|
15406
15446
|
init_is_extension_context();
|
|
15407
15447
|
logIntro = () => {
|
|
15408
15448
|
try {
|
|
15409
|
-
const version = "0.1.
|
|
15449
|
+
const version = "0.1.22";
|
|
15410
15450
|
const logoDataUri = `data:image/svg+xml;base64,${btoa(LOGO_SVG)}`;
|
|
15411
15451
|
console.log(
|
|
15412
15452
|
`%cReact Grab${version ? ` v${version}` : ""}%c
|
|
@@ -17806,8 +17846,13 @@ var init_core = __esm({
|
|
|
17806
17846
|
if (!event.isPrimary) return;
|
|
17807
17847
|
if (isEventFromOverlay(event, "data-react-grab-ignore-events")) return;
|
|
17808
17848
|
if (store.contextMenuPosition !== null) return;
|
|
17849
|
+
const isActive = isRendererActive() || isCopying() || isDragging();
|
|
17809
17850
|
const hasModifierKeyHeld = event.metaKey || event.ctrlKey;
|
|
17810
17851
|
handlePointerUp(event.clientX, event.clientY, hasModifierKeyHeld);
|
|
17852
|
+
if (isActive) {
|
|
17853
|
+
event.preventDefault();
|
|
17854
|
+
event.stopImmediatePropagation();
|
|
17855
|
+
}
|
|
17811
17856
|
}, {
|
|
17812
17857
|
capture: true
|
|
17813
17858
|
});
|
|
@@ -17924,6 +17969,18 @@ var init_core = __esm({
|
|
|
17924
17969
|
previousViewportHeight = currentViewportHeight;
|
|
17925
17970
|
handleViewportChange();
|
|
17926
17971
|
});
|
|
17972
|
+
const visualViewport = window.visualViewport;
|
|
17973
|
+
if (visualViewport) {
|
|
17974
|
+
const {
|
|
17975
|
+
signal
|
|
17976
|
+
} = eventListenerManager;
|
|
17977
|
+
visualViewport.addEventListener("resize", handleViewportChange, {
|
|
17978
|
+
signal
|
|
17979
|
+
});
|
|
17980
|
+
visualViewport.addEventListener("scroll", handleViewportChange, {
|
|
17981
|
+
signal
|
|
17982
|
+
});
|
|
17983
|
+
}
|
|
17927
17984
|
let boundsRecalcIntervalId = null;
|
|
17928
17985
|
let viewportChangeFrameId = null;
|
|
17929
17986
|
const startBoundsRecalcIntervalIfNeeded = () => {
|