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.mjs CHANGED
@@ -7237,15 +7237,31 @@ function useInteractionCapture(props) {
7237
7237
  }
7238
7238
  }
7239
7239
  }
7240
+ let lastMouseX = 0;
7241
+ let lastMouseY = 0;
7240
7242
  function handleMouseMove(e) {
7241
7243
  if (isStale() || isOwnUIEvent(e)) return;
7244
+ lastMouseX = e.clientX;
7245
+ lastMouseY = e.clientY;
7242
7246
  const p = propsRef.current;
7243
7247
  const elementUnder = safeElementFromPoint(e.clientX, e.clientY);
7244
7248
  p.onSetHoverHighlight(computeHoverHighlight(elementUnder, p.selectedElement));
7245
7249
  }
7250
+ function handleScroll() {
7251
+ if (isStale()) return;
7252
+ const p = propsRef.current;
7253
+ const elementUnder = safeElementFromPoint(lastMouseX, lastMouseY);
7254
+ p.onSetHoverHighlight(computeHoverHighlight(elementUnder, p.selectedElement));
7255
+ }
7256
+ function handlePointerDown(e) {
7257
+ if (isStale() || isOwnUIEvent(e)) return;
7258
+ if (e.pointerType === "mouse") e.preventDefault();
7259
+ e.stopPropagation();
7260
+ }
7246
7261
  function handleMouseDown(e) {
7247
7262
  if (isStale() || isOwnUIEvent(e)) return;
7248
7263
  e.preventDefault();
7264
+ e.stopPropagation();
7249
7265
  }
7250
7266
  function handleContextMenu(e) {
7251
7267
  if (isStale() || isOwnUIEvent(e)) return;
@@ -7257,22 +7273,26 @@ function useInteractionCapture(props) {
7257
7273
  }
7258
7274
  const cursorStyle = document.createElement("style");
7259
7275
  cursorStyle.setAttribute("data-direct-edit-cursor", "");
7260
- const cursorValue = propsRef.current.activeTool === "comment" ? "crosshair" : "default";
7276
+ const cursorValue = "default";
7261
7277
  cursorStyle.textContent = `* { cursor: ${cursorValue} !important; }`;
7262
7278
  document.head.appendChild(cursorStyle);
7279
+ window.addEventListener("pointerdown", handlePointerDown, true);
7263
7280
  window.addEventListener("click", handleClick, true);
7264
7281
  window.addEventListener("dblclick", handleDblClick, true);
7265
7282
  document.addEventListener("mousemove", handleMouseMove, true);
7266
7283
  window.addEventListener("mousedown", handleMouseDown, true);
7267
7284
  document.addEventListener("contextmenu", handleContextMenu, true);
7268
7285
  document.documentElement.addEventListener("mouseleave", handleMouseLeave);
7286
+ window.addEventListener("scroll", handleScroll, true);
7269
7287
  return () => {
7288
+ window.removeEventListener("pointerdown", handlePointerDown, true);
7270
7289
  window.removeEventListener("click", handleClick, true);
7271
7290
  window.removeEventListener("dblclick", handleDblClick, true);
7272
7291
  document.removeEventListener("mousemove", handleMouseMove, true);
7273
7292
  window.removeEventListener("mousedown", handleMouseDown, true);
7274
7293
  document.removeEventListener("contextmenu", handleContextMenu, true);
7275
7294
  document.documentElement.removeEventListener("mouseleave", handleMouseLeave);
7295
+ window.removeEventListener("scroll", handleScroll, true);
7276
7296
  cursorStyle.remove();
7277
7297
  };
7278
7298
  }, [active]);
@@ -7280,9 +7300,8 @@ function useInteractionCapture(props) {
7280
7300
  if (!active) return;
7281
7301
  const existing = document.querySelector("style[data-direct-edit-cursor]");
7282
7302
  if (!existing) return;
7283
- const cursorValue = props.activeTool === "comment" ? "crosshair" : "default";
7284
- existing.textContent = `* { cursor: ${cursorValue} !important; }`;
7285
- }, [active, props.activeTool]);
7303
+ existing.textContent = `* { cursor: default !important; }`;
7304
+ }, [active]);
7286
7305
  }
7287
7306
  function InteractionOverlay(props) {
7288
7307
  const { hoverHighlight } = props;
@@ -8305,6 +8324,11 @@ function CommentPin({
8305
8324
  flipHorizontal,
8306
8325
  onSubmit: (text) => {
8307
8326
  onUpdateText(text);
8327
+ const md = buildCommentExport(comment.locator, text, []);
8328
+ const instruction = buildExportInstruction({ hasCssEdits: false, hasTextEdits: false, hasMoves: false, hasComments: true });
8329
+ copyText(`${instruction}
8330
+
8331
+ ${md}`);
8308
8332
  },
8309
8333
  onCancel: onClose,
8310
8334
  attentionNonce,