made-refine 0.2.8 → 0.2.9

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/index.js CHANGED
@@ -7317,15 +7317,31 @@ function useInteractionCapture(props) {
7317
7317
  }
7318
7318
  }
7319
7319
  }
7320
+ let lastMouseX = 0;
7321
+ let lastMouseY = 0;
7320
7322
  function handleMouseMove(e) {
7321
7323
  if (isStale() || isOwnUIEvent(e)) return;
7324
+ lastMouseX = e.clientX;
7325
+ lastMouseY = e.clientY;
7322
7326
  const p = propsRef.current;
7323
7327
  const elementUnder = safeElementFromPoint(e.clientX, e.clientY);
7324
7328
  p.onSetHoverHighlight(computeHoverHighlight(elementUnder, p.selectedElement));
7325
7329
  }
7330
+ function handleScroll() {
7331
+ if (isStale()) return;
7332
+ const p = propsRef.current;
7333
+ const elementUnder = safeElementFromPoint(lastMouseX, lastMouseY);
7334
+ p.onSetHoverHighlight(computeHoverHighlight(elementUnder, p.selectedElement));
7335
+ }
7336
+ function handlePointerDown(e) {
7337
+ if (isStale() || isOwnUIEvent(e)) return;
7338
+ if (e.pointerType === "mouse") e.preventDefault();
7339
+ e.stopPropagation();
7340
+ }
7326
7341
  function handleMouseDown(e) {
7327
7342
  if (isStale() || isOwnUIEvent(e)) return;
7328
7343
  e.preventDefault();
7344
+ e.stopPropagation();
7329
7345
  }
7330
7346
  function handleContextMenu(e) {
7331
7347
  if (isStale() || isOwnUIEvent(e)) return;
@@ -7337,22 +7353,26 @@ function useInteractionCapture(props) {
7337
7353
  }
7338
7354
  const cursorStyle = document.createElement("style");
7339
7355
  cursorStyle.setAttribute("data-direct-edit-cursor", "");
7340
- const cursorValue = propsRef.current.activeTool === "comment" ? "crosshair" : "default";
7356
+ const cursorValue = "default";
7341
7357
  cursorStyle.textContent = `* { cursor: ${cursorValue} !important; }`;
7342
7358
  document.head.appendChild(cursorStyle);
7359
+ window.addEventListener("pointerdown", handlePointerDown, true);
7343
7360
  window.addEventListener("click", handleClick, true);
7344
7361
  window.addEventListener("dblclick", handleDblClick, true);
7345
7362
  document.addEventListener("mousemove", handleMouseMove, true);
7346
7363
  window.addEventListener("mousedown", handleMouseDown, true);
7347
7364
  document.addEventListener("contextmenu", handleContextMenu, true);
7348
7365
  document.documentElement.addEventListener("mouseleave", handleMouseLeave);
7366
+ window.addEventListener("scroll", handleScroll, true);
7349
7367
  return () => {
7368
+ window.removeEventListener("pointerdown", handlePointerDown, true);
7350
7369
  window.removeEventListener("click", handleClick, true);
7351
7370
  window.removeEventListener("dblclick", handleDblClick, true);
7352
7371
  document.removeEventListener("mousemove", handleMouseMove, true);
7353
7372
  window.removeEventListener("mousedown", handleMouseDown, true);
7354
7373
  document.removeEventListener("contextmenu", handleContextMenu, true);
7355
7374
  document.documentElement.removeEventListener("mouseleave", handleMouseLeave);
7375
+ window.removeEventListener("scroll", handleScroll, true);
7356
7376
  cursorStyle.remove();
7357
7377
  };
7358
7378
  }, [active]);
@@ -7360,9 +7380,8 @@ function useInteractionCapture(props) {
7360
7380
  if (!active) return;
7361
7381
  const existing = document.querySelector("style[data-direct-edit-cursor]");
7362
7382
  if (!existing) return;
7363
- const cursorValue = props.activeTool === "comment" ? "crosshair" : "default";
7364
- existing.textContent = `* { cursor: ${cursorValue} !important; }`;
7365
- }, [active, props.activeTool]);
7383
+ existing.textContent = `* { cursor: default !important; }`;
7384
+ }, [active]);
7366
7385
  }
7367
7386
  function InteractionOverlay(props) {
7368
7387
  const { hoverHighlight } = props;
@@ -8385,6 +8404,11 @@ function CommentPin({
8385
8404
  flipHorizontal,
8386
8405
  onSubmit: (text) => {
8387
8406
  onUpdateText(text);
8407
+ const md = buildCommentExport(comment.locator, text, []);
8408
+ const instruction = buildExportInstruction({ hasCssEdits: false, hasTextEdits: false, hasMoves: false, hasComments: true });
8409
+ copyText(`${instruction}
8410
+
8411
+ ${md}`);
8388
8412
  },
8389
8413
  onCancel: onClose,
8390
8414
  attentionNonce,