react-grab 0.0.50 → 0.0.51

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.
@@ -5308,6 +5308,43 @@ var mergeTheme = (userTheme) => {
5308
5308
  }
5309
5309
  };
5310
5310
  };
5311
+ var deepMergeTheme = (baseTheme, partialTheme) => {
5312
+ return {
5313
+ enabled: partialTheme.enabled ?? baseTheme.enabled,
5314
+ hue: partialTheme.hue ?? baseTheme.hue,
5315
+ selectionBox: {
5316
+ enabled: partialTheme.selectionBox?.enabled ?? baseTheme.selectionBox.enabled,
5317
+ color: partialTheme.selectionBox?.color ?? baseTheme.selectionBox.color,
5318
+ borderRadius: partialTheme.selectionBox?.borderRadius ?? baseTheme.selectionBox.borderRadius
5319
+ },
5320
+ dragBox: {
5321
+ enabled: partialTheme.dragBox?.enabled ?? baseTheme.dragBox.enabled,
5322
+ color: partialTheme.dragBox?.color ?? baseTheme.dragBox.color
5323
+ },
5324
+ grabbedBoxes: {
5325
+ enabled: partialTheme.grabbedBoxes?.enabled ?? baseTheme.grabbedBoxes.enabled,
5326
+ color: partialTheme.grabbedBoxes?.color ?? baseTheme.grabbedBoxes.color
5327
+ },
5328
+ elementLabel: {
5329
+ enabled: partialTheme.elementLabel?.enabled ?? baseTheme.elementLabel.enabled,
5330
+ backgroundColor: partialTheme.elementLabel?.backgroundColor ?? baseTheme.elementLabel.backgroundColor,
5331
+ textColor: partialTheme.elementLabel?.textColor ?? baseTheme.elementLabel.textColor,
5332
+ borderColor: partialTheme.elementLabel?.borderColor ?? baseTheme.elementLabel.borderColor,
5333
+ padding: partialTheme.elementLabel?.padding ?? baseTheme.elementLabel.padding,
5334
+ cursorOffset: partialTheme.elementLabel?.cursorOffset ?? baseTheme.elementLabel.cursorOffset
5335
+ },
5336
+ successLabels: {
5337
+ enabled: partialTheme.successLabels?.enabled ?? baseTheme.successLabels.enabled
5338
+ },
5339
+ crosshair: {
5340
+ enabled: partialTheme.crosshair?.enabled ?? baseTheme.crosshair.enabled,
5341
+ color: partialTheme.crosshair?.color ?? baseTheme.crosshair.color
5342
+ },
5343
+ inputOverlay: {
5344
+ enabled: partialTheme.inputOverlay?.enabled ?? baseTheme.inputOverlay.enabled
5345
+ }
5346
+ };
5347
+ };
5311
5348
 
5312
5349
  // src/core.tsx
5313
5350
  var _tmpl$9 = /* @__PURE__ */ template(`<span class="font-mono tabular-nums align-middle">1 element`);
@@ -5321,7 +5358,7 @@ var init = (rawOptions) => {
5321
5358
  allowActivationInsideInput: true,
5322
5359
  ...rawOptions
5323
5360
  };
5324
- const theme = mergeTheme(options.theme);
5361
+ const initialTheme = mergeTheme(options.theme);
5325
5362
  if (options.enabled === false || hasInited) {
5326
5363
  return {
5327
5364
  activate: () => {
@@ -5340,13 +5377,16 @@ var init = (rawOptions) => {
5340
5377
  isCopying: false,
5341
5378
  targetElement: null,
5342
5379
  dragBounds: null
5343
- })
5380
+ }),
5381
+ updateTheme: () => {
5382
+ },
5383
+ getTheme: () => initialTheme
5344
5384
  };
5345
5385
  }
5346
5386
  hasInited = true;
5347
5387
  const logIntro = () => {
5348
5388
  try {
5349
- const version = "0.0.50";
5389
+ const version = "0.0.51";
5350
5390
  const logoSvg = `<svg width="294" height="294" viewBox="0 0 294 294" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_0_3)"><mask id="mask0_0_3" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="294" height="294"><path d="M294 0H0V294H294V0Z" fill="white"/></mask><g mask="url(#mask0_0_3)"><path d="M144.599 47.4924C169.712 27.3959 194.548 20.0265 212.132 30.1797C227.847 39.2555 234.881 60.3243 231.926 89.516C231.677 92.0069 231.328 94.5423 230.94 97.1058L228.526 110.14C228.517 110.136 228.505 110.132 228.495 110.127C228.486 110.165 228.479 110.203 228.468 110.24L216.255 105.741C216.256 105.736 216.248 105.728 216.248 105.723C207.915 103.125 199.421 101.075 190.82 99.5888L190.696 99.5588L173.526 97.2648L173.511 97.2631C173.492 97.236 173.467 97.2176 173.447 97.1905C163.862 96.2064 154.233 95.7166 144.599 95.7223C134.943 95.7162 125.295 96.219 115.693 97.2286C110.075 105.033 104.859 113.118 100.063 121.453C95.2426 129.798 90.8624 138.391 86.939 147.193C90.8624 155.996 95.2426 164.588 100.063 172.933C104.866 181.302 110.099 189.417 115.741 197.245C115.749 197.245 115.758 197.246 115.766 197.247L115.752 197.27L115.745 197.283L115.754 197.296L126.501 211.013L126.574 211.089C132.136 217.767 138.126 224.075 144.507 229.974L144.609 230.082L154.572 238.287C154.539 238.319 154.506 238.35 154.472 238.38C154.485 238.392 154.499 238.402 154.513 238.412L143.846 247.482L143.827 247.497C126.56 261.128 109.472 268.745 94.8019 268.745C88.5916 268.837 82.4687 267.272 77.0657 264.208C61.3496 255.132 54.3164 234.062 57.2707 204.871C57.528 202.307 57.8806 199.694 58.2904 197.054C28.3363 185.327 9.52301 167.51 9.52301 147.193C9.52301 129.042 24.2476 112.396 50.9901 100.375C53.3443 99.3163 55.7938 98.3058 58.2904 97.3526C57.8806 94.7023 57.528 92.0803 57.2707 89.516C54.3164 60.3243 61.3496 39.2555 77.0657 30.1797C94.6494 20.0265 119.486 27.3959 144.599 47.4924ZM70.6423 201.315C70.423 202.955 70.2229 204.566 70.0704 206.168C67.6686 229.567 72.5478 246.628 83.3615 252.988L83.5176 253.062C95.0399 259.717 114.015 254.426 134.782 238.38C125.298 229.45 116.594 219.725 108.764 209.314C95.8516 207.742 83.0977 205.066 70.6423 201.315ZM80.3534 163.438C77.34 171.677 74.8666 180.104 72.9484 188.664C81.1787 191.224 89.5657 193.247 98.0572 194.724L98.4618 194.813C95.2115 189.865 92.0191 184.66 88.9311 179.378C85.8433 174.097 83.003 168.768 80.3534 163.438ZM60.759 110.203C59.234 110.839 57.7378 111.475 56.27 112.11C34.7788 121.806 22.3891 134.591 22.3891 147.193C22.3891 160.493 36.4657 174.297 60.7494 184.26C63.7439 171.581 67.8124 159.182 72.9104 147.193C67.822 135.23 63.7566 122.855 60.759 110.203ZM98.4137 99.6404C89.8078 101.145 81.3075 103.206 72.9676 105.809C74.854 114.203 77.2741 122.468 80.2132 130.554L80.3059 130.939C82.9938 125.6 85.8049 120.338 88.8834 115.008C91.9618 109.679 95.1544 104.569 98.4137 99.6404ZM94.9258 38.5215C90.9331 38.4284 86.9866 39.3955 83.4891 41.3243C72.6291 47.6015 67.6975 64.5954 70.0424 87.9446L70.0416 88.2194C70.194 89.8208 70.3941 91.4325 70.6134 93.0624C83.0737 89.3364 95.8263 86.6703 108.736 85.0924C116.57 74.6779 125.28 64.9532 134.773 56.0249C119.877 44.5087 105.895 38.5215 94.9258 38.5215ZM205.737 41.3148C202.268 39.398 198.355 38.4308 194.394 38.5099L194.29 38.512C183.321 38.512 169.34 44.4991 154.444 56.0153C163.93 64.9374 172.634 74.6557 180.462 85.064C193.375 86.6345 206.128 89.3102 218.584 93.0624C218.812 91.4325 219.003 89.8118 219.165 88.2098C221.548 64.7099 216.65 47.6164 205.737 41.3148ZM144.552 64.3097C138.104 70.2614 132.054 76.6306 126.443 83.3765C132.39 82.995 138.426 82.8046 144.552 82.8046C150.727 82.8046 156.778 83.0143 162.707 83.3765C157.08 76.6293 151.015 70.2596 144.552 64.3097Z" fill="white"/><path d="M144.598 47.4924C169.712 27.3959 194.547 20.0265 212.131 30.1797C227.847 39.2555 234.88 60.3243 231.926 89.516C231.677 92.0069 231.327 94.5423 230.941 97.1058L228.526 110.14L228.496 110.127C228.487 110.165 228.478 110.203 228.469 110.24L216.255 105.741L216.249 105.723C207.916 103.125 199.42 101.075 190.82 99.5888L190.696 99.5588L173.525 97.2648L173.511 97.263C173.492 97.236 173.468 97.2176 173.447 97.1905C163.863 96.2064 154.234 95.7166 144.598 95.7223C134.943 95.7162 125.295 96.219 115.693 97.2286C110.075 105.033 104.859 113.118 100.063 121.453C95.2426 129.798 90.8622 138.391 86.939 147.193C90.8622 155.996 95.2426 164.588 100.063 172.933C104.866 181.302 110.099 189.417 115.741 197.245L115.766 197.247L115.752 197.27L115.745 197.283L115.754 197.296L126.501 211.013L126.574 211.089C132.136 217.767 138.126 224.075 144.506 229.974L144.61 230.082L154.572 238.287C154.539 238.319 154.506 238.35 154.473 238.38L154.512 238.412L143.847 247.482L143.827 247.497C126.56 261.13 109.472 268.745 94.8018 268.745C88.5915 268.837 82.4687 267.272 77.0657 264.208C61.3496 255.132 54.3162 234.062 57.2707 204.871C57.528 202.307 57.8806 199.694 58.2904 197.054C28.3362 185.327 9.52298 167.51 9.52298 147.193C9.52298 129.042 24.2476 112.396 50.9901 100.375C53.3443 99.3163 55.7938 98.3058 58.2904 97.3526C57.8806 94.7023 57.528 92.0803 57.2707 89.516C54.3162 60.3243 61.3496 39.2555 77.0657 30.1797C94.6493 20.0265 119.486 27.3959 144.598 47.4924ZM70.6422 201.315C70.423 202.955 70.2229 204.566 70.0704 206.168C67.6686 229.567 72.5478 246.628 83.3615 252.988L83.5175 253.062C95.0399 259.717 114.015 254.426 134.782 238.38C125.298 229.45 116.594 219.725 108.764 209.314C95.8515 207.742 83.0977 205.066 70.6422 201.315ZM80.3534 163.438C77.34 171.677 74.8666 180.104 72.9484 188.664C81.1786 191.224 89.5657 193.247 98.0572 194.724L98.4618 194.813C95.2115 189.865 92.0191 184.66 88.931 179.378C85.8433 174.097 83.003 168.768 80.3534 163.438ZM60.7589 110.203C59.234 110.839 57.7378 111.475 56.2699 112.11C34.7788 121.806 22.3891 134.591 22.3891 147.193C22.3891 160.493 36.4657 174.297 60.7494 184.26C63.7439 171.581 67.8124 159.182 72.9103 147.193C67.822 135.23 63.7566 122.855 60.7589 110.203ZM98.4137 99.6404C89.8078 101.145 81.3075 103.206 72.9676 105.809C74.8539 114.203 77.2741 122.468 80.2132 130.554L80.3059 130.939C82.9938 125.6 85.8049 120.338 88.8834 115.008C91.9618 109.679 95.1544 104.569 98.4137 99.6404ZM94.9258 38.5215C90.9331 38.4284 86.9866 39.3955 83.4891 41.3243C72.629 47.6015 67.6975 64.5954 70.0424 87.9446L70.0415 88.2194C70.194 89.8208 70.3941 91.4325 70.6134 93.0624C83.0737 89.3364 95.8262 86.6703 108.736 85.0924C116.57 74.6779 125.28 64.9532 134.772 56.0249C119.877 44.5087 105.895 38.5215 94.9258 38.5215ZM205.737 41.3148C202.268 39.398 198.355 38.4308 194.394 38.5099L194.291 38.512C183.321 38.512 169.34 44.4991 154.443 56.0153C163.929 64.9374 172.634 74.6557 180.462 85.064C193.374 86.6345 206.129 89.3102 218.584 93.0624C218.813 91.4325 219.003 89.8118 219.166 88.2098C221.548 64.7099 216.65 47.6164 205.737 41.3148ZM144.551 64.3097C138.103 70.2614 132.055 76.6306 126.443 83.3765C132.389 82.995 138.427 82.8046 144.551 82.8046C150.727 82.8046 156.779 83.0143 162.707 83.3765C157.079 76.6293 151.015 70.2596 144.551 64.3097Z" fill="#FF40E0"/></g><mask id="mask1_0_3" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="102" y="84" width="161" height="162"><path d="M235.282 84.827L102.261 112.259L129.693 245.28L262.714 217.848L235.282 84.827Z" fill="white"/></mask><g mask="url(#mask1_0_3)"><path d="M136.863 129.916L213.258 141.224C220.669 142.322 222.495 152.179 215.967 155.856L187.592 171.843L184.135 204.227C183.339 211.678 173.564 213.901 169.624 207.526L129.021 141.831C125.503 136.14 130.245 128.936 136.863 129.916Z" fill="#FF40E0" stroke="#FF40E0" stroke-width="0.817337" stroke-linecap="round" stroke-linejoin="round"/></g></g><defs><clipPath id="clip0_0_3"><rect width="294" height="294" fill="white"/></clipPath></defs></svg>`;
5351
5391
  const logoDataUri = `data:image/svg+xml;base64,${btoa(logoSvg)}`;
5352
5392
  console.log(`%cReact Grab${version ? ` v${version}` : ""}%c
@@ -5368,6 +5408,7 @@ https://react-grab.com`, `background: #330039; color: #ffffff; border: 1px solid
5368
5408
  };
5369
5409
  logIntro();
5370
5410
  return createRoot((dispose2) => {
5411
+ const [theme, setTheme] = createSignal(initialTheme);
5371
5412
  const [isHoldingKeys, setIsHoldingKeys] = createSignal(false);
5372
5413
  const [mouseX, setMouseX] = createSignal(OFFSCREEN_POSITION);
5373
5414
  const [mouseY, setMouseY] = createSignal(OFFSCREEN_POSITION);
@@ -5554,12 +5595,12 @@ ${plainTextContentOnly}` : plainTextContentOnly;
5554
5595
  options.onElementSelect?.(targetElement2);
5555
5596
  } catch {
5556
5597
  }
5557
- if (theme.grabbedBoxes.enabled) {
5598
+ if (theme().grabbedBoxes.enabled) {
5558
5599
  showTemporaryGrabbedBox(createElementBounds(targetElement2), targetElement2);
5559
5600
  }
5560
5601
  await new Promise((resolve) => requestAnimationFrame(resolve));
5561
5602
  const didCopy = await tryCopyWithFallback([targetElement2], extraPrompt);
5562
- if (didCopy && theme.successLabels.enabled) {
5603
+ if (didCopy && theme().successLabels.enabled) {
5563
5604
  showTemporarySuccessLabel(extractElementTagNameForSuccess(targetElement2));
5564
5605
  }
5565
5606
  notifyElementsSelected([targetElement2]);
@@ -5572,14 +5613,14 @@ ${plainTextContentOnly}` : plainTextContentOnly;
5572
5613
  } catch {
5573
5614
  }
5574
5615
  }
5575
- if (theme.grabbedBoxes.enabled) {
5616
+ if (theme().grabbedBoxes.enabled) {
5576
5617
  for (const element of targetElements) {
5577
5618
  showTemporaryGrabbedBox(createElementBounds(element), element);
5578
5619
  }
5579
5620
  }
5580
5621
  await new Promise((resolve) => requestAnimationFrame(resolve));
5581
5622
  const didCopy = await tryCopyWithFallback(targetElements);
5582
- if (didCopy && theme.successLabels.enabled) {
5623
+ if (didCopy && theme().successLabels.enabled) {
5583
5624
  showTemporarySuccessLabel(`${targetElements.length} elements`);
5584
5625
  }
5585
5626
  notifyElementsSelected(targetElements);
@@ -6027,25 +6068,29 @@ ${plainTextContentOnly}` : plainTextContentOnly;
6027
6068
  document.body.style.cursor = "";
6028
6069
  });
6029
6070
  const rendererRoot = mountRoot(styles_default);
6030
- const selectionVisible = createMemo(() => theme.selectionBox.enabled && isRendererActive() && !isDragging() && Boolean(targetElement()));
6031
- const dragVisible = createMemo(() => theme.dragBox.enabled && isRendererActive() && isDraggingBeyondThreshold());
6071
+ const selectionVisible = createMemo(() => theme().selectionBox.enabled && isRendererActive() && !isDragging() && Boolean(targetElement()));
6072
+ const dragVisible = createMemo(() => theme().dragBox.enabled && isRendererActive() && isDraggingBeyondThreshold());
6032
6073
  const labelVariant = createMemo(() => isCopying() ? "processing" : "hover");
6033
6074
  const labelVisible = createMemo(() => {
6034
- if (!theme.elementLabel.enabled) return false;
6075
+ if (!theme().elementLabel.enabled) return false;
6035
6076
  if (isInputMode()) return false;
6036
6077
  if (isCopying()) return true;
6037
6078
  if (successLabels().length > 0) return false;
6038
6079
  return isRendererActive() && !isDragging() && Boolean(targetElement());
6039
6080
  });
6040
6081
  const progressVisible = createMemo(() => isCopying() && showProgressIndicator() && hasValidMousePosition());
6041
- const crosshairVisible = createMemo(() => theme.crosshair.enabled && isRendererActive() && !isDragging());
6042
- const inputVisible = createMemo(() => theme.inputOverlay.enabled && isInputMode());
6043
- const shouldShowGrabbedBoxes = createMemo(() => theme.grabbedBoxes.enabled);
6044
- const shouldShowSuccessLabels = createMemo(() => theme.successLabels.enabled);
6045
- if (theme.enabled) {
6046
- if (theme.hue !== 0) {
6047
- rendererRoot.style.filter = `hue-rotate(${theme.hue}deg)`;
6082
+ const crosshairVisible = createMemo(() => theme().crosshair.enabled && isRendererActive() && !isDragging());
6083
+ const inputVisible = createMemo(() => theme().inputOverlay.enabled && isInputMode());
6084
+ const shouldShowGrabbedBoxes = createMemo(() => theme().grabbedBoxes.enabled);
6085
+ const shouldShowSuccessLabels = createMemo(() => theme().successLabels.enabled);
6086
+ createEffect(on(theme, (currentTheme) => {
6087
+ if (currentTheme.hue !== 0) {
6088
+ rendererRoot.style.filter = `hue-rotate(${currentTheme.hue}deg)`;
6089
+ } else {
6090
+ rendererRoot.style.filter = "";
6048
6091
  }
6092
+ }));
6093
+ if (theme().enabled) {
6049
6094
  render(() => createComponent(ReactGrabRenderer, {
6050
6095
  get selectionVisible() {
6051
6096
  return selectionVisible();
@@ -6114,7 +6159,9 @@ ${plainTextContentOnly}` : plainTextContentOnly;
6114
6159
  onInputChange: handleInputChange,
6115
6160
  onInputSubmit: handleInputSubmit,
6116
6161
  onInputCancel: handleInputCancel,
6117
- theme
6162
+ get theme() {
6163
+ return theme();
6164
+ }
6118
6165
  }), rendererRoot);
6119
6166
  }
6120
6167
  const copyElementAPI = async (elements) => {
@@ -6164,7 +6211,13 @@ ${plainTextContentOnly}` : plainTextContentOnly;
6164
6211
  isActive: () => isActivated(),
6165
6212
  dispose: dispose2,
6166
6213
  copyElement: copyElementAPI,
6167
- getState: getStateAPI
6214
+ getState: getStateAPI,
6215
+ updateTheme: (partialTheme) => {
6216
+ const currentTheme = theme();
6217
+ const mergedTheme = deepMergeTheme(currentTheme, partialTheme);
6218
+ setTheme(mergedTheme);
6219
+ },
6220
+ getTheme: () => theme()
6168
6221
  };
6169
6222
  });
6170
6223
  };
@@ -5306,6 +5306,43 @@ var mergeTheme = (userTheme) => {
5306
5306
  }
5307
5307
  };
5308
5308
  };
5309
+ var deepMergeTheme = (baseTheme, partialTheme) => {
5310
+ return {
5311
+ enabled: partialTheme.enabled ?? baseTheme.enabled,
5312
+ hue: partialTheme.hue ?? baseTheme.hue,
5313
+ selectionBox: {
5314
+ enabled: partialTheme.selectionBox?.enabled ?? baseTheme.selectionBox.enabled,
5315
+ color: partialTheme.selectionBox?.color ?? baseTheme.selectionBox.color,
5316
+ borderRadius: partialTheme.selectionBox?.borderRadius ?? baseTheme.selectionBox.borderRadius
5317
+ },
5318
+ dragBox: {
5319
+ enabled: partialTheme.dragBox?.enabled ?? baseTheme.dragBox.enabled,
5320
+ color: partialTheme.dragBox?.color ?? baseTheme.dragBox.color
5321
+ },
5322
+ grabbedBoxes: {
5323
+ enabled: partialTheme.grabbedBoxes?.enabled ?? baseTheme.grabbedBoxes.enabled,
5324
+ color: partialTheme.grabbedBoxes?.color ?? baseTheme.grabbedBoxes.color
5325
+ },
5326
+ elementLabel: {
5327
+ enabled: partialTheme.elementLabel?.enabled ?? baseTheme.elementLabel.enabled,
5328
+ backgroundColor: partialTheme.elementLabel?.backgroundColor ?? baseTheme.elementLabel.backgroundColor,
5329
+ textColor: partialTheme.elementLabel?.textColor ?? baseTheme.elementLabel.textColor,
5330
+ borderColor: partialTheme.elementLabel?.borderColor ?? baseTheme.elementLabel.borderColor,
5331
+ padding: partialTheme.elementLabel?.padding ?? baseTheme.elementLabel.padding,
5332
+ cursorOffset: partialTheme.elementLabel?.cursorOffset ?? baseTheme.elementLabel.cursorOffset
5333
+ },
5334
+ successLabels: {
5335
+ enabled: partialTheme.successLabels?.enabled ?? baseTheme.successLabels.enabled
5336
+ },
5337
+ crosshair: {
5338
+ enabled: partialTheme.crosshair?.enabled ?? baseTheme.crosshair.enabled,
5339
+ color: partialTheme.crosshair?.color ?? baseTheme.crosshair.color
5340
+ },
5341
+ inputOverlay: {
5342
+ enabled: partialTheme.inputOverlay?.enabled ?? baseTheme.inputOverlay.enabled
5343
+ }
5344
+ };
5345
+ };
5309
5346
 
5310
5347
  // src/core.tsx
5311
5348
  var _tmpl$9 = /* @__PURE__ */ template(`<span class="font-mono tabular-nums align-middle">1 element`);
@@ -5319,7 +5356,7 @@ var init = (rawOptions) => {
5319
5356
  allowActivationInsideInput: true,
5320
5357
  ...rawOptions
5321
5358
  };
5322
- const theme = mergeTheme(options.theme);
5359
+ const initialTheme = mergeTheme(options.theme);
5323
5360
  if (options.enabled === false || hasInited) {
5324
5361
  return {
5325
5362
  activate: () => {
@@ -5338,13 +5375,16 @@ var init = (rawOptions) => {
5338
5375
  isCopying: false,
5339
5376
  targetElement: null,
5340
5377
  dragBounds: null
5341
- })
5378
+ }),
5379
+ updateTheme: () => {
5380
+ },
5381
+ getTheme: () => initialTheme
5342
5382
  };
5343
5383
  }
5344
5384
  hasInited = true;
5345
5385
  const logIntro = () => {
5346
5386
  try {
5347
- const version = "0.0.50";
5387
+ const version = "0.0.51";
5348
5388
  const logoSvg = `<svg width="294" height="294" viewBox="0 0 294 294" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_0_3)"><mask id="mask0_0_3" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="0" y="0" width="294" height="294"><path d="M294 0H0V294H294V0Z" fill="white"/></mask><g mask="url(#mask0_0_3)"><path d="M144.599 47.4924C169.712 27.3959 194.548 20.0265 212.132 30.1797C227.847 39.2555 234.881 60.3243 231.926 89.516C231.677 92.0069 231.328 94.5423 230.94 97.1058L228.526 110.14C228.517 110.136 228.505 110.132 228.495 110.127C228.486 110.165 228.479 110.203 228.468 110.24L216.255 105.741C216.256 105.736 216.248 105.728 216.248 105.723C207.915 103.125 199.421 101.075 190.82 99.5888L190.696 99.5588L173.526 97.2648L173.511 97.2631C173.492 97.236 173.467 97.2176 173.447 97.1905C163.862 96.2064 154.233 95.7166 144.599 95.7223C134.943 95.7162 125.295 96.219 115.693 97.2286C110.075 105.033 104.859 113.118 100.063 121.453C95.2426 129.798 90.8624 138.391 86.939 147.193C90.8624 155.996 95.2426 164.588 100.063 172.933C104.866 181.302 110.099 189.417 115.741 197.245C115.749 197.245 115.758 197.246 115.766 197.247L115.752 197.27L115.745 197.283L115.754 197.296L126.501 211.013L126.574 211.089C132.136 217.767 138.126 224.075 144.507 229.974L144.609 230.082L154.572 238.287C154.539 238.319 154.506 238.35 154.472 238.38C154.485 238.392 154.499 238.402 154.513 238.412L143.846 247.482L143.827 247.497C126.56 261.128 109.472 268.745 94.8019 268.745C88.5916 268.837 82.4687 267.272 77.0657 264.208C61.3496 255.132 54.3164 234.062 57.2707 204.871C57.528 202.307 57.8806 199.694 58.2904 197.054C28.3363 185.327 9.52301 167.51 9.52301 147.193C9.52301 129.042 24.2476 112.396 50.9901 100.375C53.3443 99.3163 55.7938 98.3058 58.2904 97.3526C57.8806 94.7023 57.528 92.0803 57.2707 89.516C54.3164 60.3243 61.3496 39.2555 77.0657 30.1797C94.6494 20.0265 119.486 27.3959 144.599 47.4924ZM70.6423 201.315C70.423 202.955 70.2229 204.566 70.0704 206.168C67.6686 229.567 72.5478 246.628 83.3615 252.988L83.5176 253.062C95.0399 259.717 114.015 254.426 134.782 238.38C125.298 229.45 116.594 219.725 108.764 209.314C95.8516 207.742 83.0977 205.066 70.6423 201.315ZM80.3534 163.438C77.34 171.677 74.8666 180.104 72.9484 188.664C81.1787 191.224 89.5657 193.247 98.0572 194.724L98.4618 194.813C95.2115 189.865 92.0191 184.66 88.9311 179.378C85.8433 174.097 83.003 168.768 80.3534 163.438ZM60.759 110.203C59.234 110.839 57.7378 111.475 56.27 112.11C34.7788 121.806 22.3891 134.591 22.3891 147.193C22.3891 160.493 36.4657 174.297 60.7494 184.26C63.7439 171.581 67.8124 159.182 72.9104 147.193C67.822 135.23 63.7566 122.855 60.759 110.203ZM98.4137 99.6404C89.8078 101.145 81.3075 103.206 72.9676 105.809C74.854 114.203 77.2741 122.468 80.2132 130.554L80.3059 130.939C82.9938 125.6 85.8049 120.338 88.8834 115.008C91.9618 109.679 95.1544 104.569 98.4137 99.6404ZM94.9258 38.5215C90.9331 38.4284 86.9866 39.3955 83.4891 41.3243C72.6291 47.6015 67.6975 64.5954 70.0424 87.9446L70.0416 88.2194C70.194 89.8208 70.3941 91.4325 70.6134 93.0624C83.0737 89.3364 95.8263 86.6703 108.736 85.0924C116.57 74.6779 125.28 64.9532 134.773 56.0249C119.877 44.5087 105.895 38.5215 94.9258 38.5215ZM205.737 41.3148C202.268 39.398 198.355 38.4308 194.394 38.5099L194.29 38.512C183.321 38.512 169.34 44.4991 154.444 56.0153C163.93 64.9374 172.634 74.6557 180.462 85.064C193.375 86.6345 206.128 89.3102 218.584 93.0624C218.812 91.4325 219.003 89.8118 219.165 88.2098C221.548 64.7099 216.65 47.6164 205.737 41.3148ZM144.552 64.3097C138.104 70.2614 132.054 76.6306 126.443 83.3765C132.39 82.995 138.426 82.8046 144.552 82.8046C150.727 82.8046 156.778 83.0143 162.707 83.3765C157.08 76.6293 151.015 70.2596 144.552 64.3097Z" fill="white"/><path d="M144.598 47.4924C169.712 27.3959 194.547 20.0265 212.131 30.1797C227.847 39.2555 234.88 60.3243 231.926 89.516C231.677 92.0069 231.327 94.5423 230.941 97.1058L228.526 110.14L228.496 110.127C228.487 110.165 228.478 110.203 228.469 110.24L216.255 105.741L216.249 105.723C207.916 103.125 199.42 101.075 190.82 99.5888L190.696 99.5588L173.525 97.2648L173.511 97.263C173.492 97.236 173.468 97.2176 173.447 97.1905C163.863 96.2064 154.234 95.7166 144.598 95.7223C134.943 95.7162 125.295 96.219 115.693 97.2286C110.075 105.033 104.859 113.118 100.063 121.453C95.2426 129.798 90.8622 138.391 86.939 147.193C90.8622 155.996 95.2426 164.588 100.063 172.933C104.866 181.302 110.099 189.417 115.741 197.245L115.766 197.247L115.752 197.27L115.745 197.283L115.754 197.296L126.501 211.013L126.574 211.089C132.136 217.767 138.126 224.075 144.506 229.974L144.61 230.082L154.572 238.287C154.539 238.319 154.506 238.35 154.473 238.38L154.512 238.412L143.847 247.482L143.827 247.497C126.56 261.13 109.472 268.745 94.8018 268.745C88.5915 268.837 82.4687 267.272 77.0657 264.208C61.3496 255.132 54.3162 234.062 57.2707 204.871C57.528 202.307 57.8806 199.694 58.2904 197.054C28.3362 185.327 9.52298 167.51 9.52298 147.193C9.52298 129.042 24.2476 112.396 50.9901 100.375C53.3443 99.3163 55.7938 98.3058 58.2904 97.3526C57.8806 94.7023 57.528 92.0803 57.2707 89.516C54.3162 60.3243 61.3496 39.2555 77.0657 30.1797C94.6493 20.0265 119.486 27.3959 144.598 47.4924ZM70.6422 201.315C70.423 202.955 70.2229 204.566 70.0704 206.168C67.6686 229.567 72.5478 246.628 83.3615 252.988L83.5175 253.062C95.0399 259.717 114.015 254.426 134.782 238.38C125.298 229.45 116.594 219.725 108.764 209.314C95.8515 207.742 83.0977 205.066 70.6422 201.315ZM80.3534 163.438C77.34 171.677 74.8666 180.104 72.9484 188.664C81.1786 191.224 89.5657 193.247 98.0572 194.724L98.4618 194.813C95.2115 189.865 92.0191 184.66 88.931 179.378C85.8433 174.097 83.003 168.768 80.3534 163.438ZM60.7589 110.203C59.234 110.839 57.7378 111.475 56.2699 112.11C34.7788 121.806 22.3891 134.591 22.3891 147.193C22.3891 160.493 36.4657 174.297 60.7494 184.26C63.7439 171.581 67.8124 159.182 72.9103 147.193C67.822 135.23 63.7566 122.855 60.7589 110.203ZM98.4137 99.6404C89.8078 101.145 81.3075 103.206 72.9676 105.809C74.8539 114.203 77.2741 122.468 80.2132 130.554L80.3059 130.939C82.9938 125.6 85.8049 120.338 88.8834 115.008C91.9618 109.679 95.1544 104.569 98.4137 99.6404ZM94.9258 38.5215C90.9331 38.4284 86.9866 39.3955 83.4891 41.3243C72.629 47.6015 67.6975 64.5954 70.0424 87.9446L70.0415 88.2194C70.194 89.8208 70.3941 91.4325 70.6134 93.0624C83.0737 89.3364 95.8262 86.6703 108.736 85.0924C116.57 74.6779 125.28 64.9532 134.772 56.0249C119.877 44.5087 105.895 38.5215 94.9258 38.5215ZM205.737 41.3148C202.268 39.398 198.355 38.4308 194.394 38.5099L194.291 38.512C183.321 38.512 169.34 44.4991 154.443 56.0153C163.929 64.9374 172.634 74.6557 180.462 85.064C193.374 86.6345 206.129 89.3102 218.584 93.0624C218.813 91.4325 219.003 89.8118 219.166 88.2098C221.548 64.7099 216.65 47.6164 205.737 41.3148ZM144.551 64.3097C138.103 70.2614 132.055 76.6306 126.443 83.3765C132.389 82.995 138.427 82.8046 144.551 82.8046C150.727 82.8046 156.779 83.0143 162.707 83.3765C157.079 76.6293 151.015 70.2596 144.551 64.3097Z" fill="#FF40E0"/></g><mask id="mask1_0_3" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="102" y="84" width="161" height="162"><path d="M235.282 84.827L102.261 112.259L129.693 245.28L262.714 217.848L235.282 84.827Z" fill="white"/></mask><g mask="url(#mask1_0_3)"><path d="M136.863 129.916L213.258 141.224C220.669 142.322 222.495 152.179 215.967 155.856L187.592 171.843L184.135 204.227C183.339 211.678 173.564 213.901 169.624 207.526L129.021 141.831C125.503 136.14 130.245 128.936 136.863 129.916Z" fill="#FF40E0" stroke="#FF40E0" stroke-width="0.817337" stroke-linecap="round" stroke-linejoin="round"/></g></g><defs><clipPath id="clip0_0_3"><rect width="294" height="294" fill="white"/></clipPath></defs></svg>`;
5349
5389
  const logoDataUri = `data:image/svg+xml;base64,${btoa(logoSvg)}`;
5350
5390
  console.log(`%cReact Grab${version ? ` v${version}` : ""}%c
@@ -5366,6 +5406,7 @@ https://react-grab.com`, `background: #330039; color: #ffffff; border: 1px solid
5366
5406
  };
5367
5407
  logIntro();
5368
5408
  return createRoot((dispose2) => {
5409
+ const [theme, setTheme] = createSignal(initialTheme);
5369
5410
  const [isHoldingKeys, setIsHoldingKeys] = createSignal(false);
5370
5411
  const [mouseX, setMouseX] = createSignal(OFFSCREEN_POSITION);
5371
5412
  const [mouseY, setMouseY] = createSignal(OFFSCREEN_POSITION);
@@ -5552,12 +5593,12 @@ ${plainTextContentOnly}` : plainTextContentOnly;
5552
5593
  options.onElementSelect?.(targetElement2);
5553
5594
  } catch {
5554
5595
  }
5555
- if (theme.grabbedBoxes.enabled) {
5596
+ if (theme().grabbedBoxes.enabled) {
5556
5597
  showTemporaryGrabbedBox(createElementBounds(targetElement2), targetElement2);
5557
5598
  }
5558
5599
  await new Promise((resolve) => requestAnimationFrame(resolve));
5559
5600
  const didCopy = await tryCopyWithFallback([targetElement2], extraPrompt);
5560
- if (didCopy && theme.successLabels.enabled) {
5601
+ if (didCopy && theme().successLabels.enabled) {
5561
5602
  showTemporarySuccessLabel(extractElementTagNameForSuccess(targetElement2));
5562
5603
  }
5563
5604
  notifyElementsSelected([targetElement2]);
@@ -5570,14 +5611,14 @@ ${plainTextContentOnly}` : plainTextContentOnly;
5570
5611
  } catch {
5571
5612
  }
5572
5613
  }
5573
- if (theme.grabbedBoxes.enabled) {
5614
+ if (theme().grabbedBoxes.enabled) {
5574
5615
  for (const element of targetElements) {
5575
5616
  showTemporaryGrabbedBox(createElementBounds(element), element);
5576
5617
  }
5577
5618
  }
5578
5619
  await new Promise((resolve) => requestAnimationFrame(resolve));
5579
5620
  const didCopy = await tryCopyWithFallback(targetElements);
5580
- if (didCopy && theme.successLabels.enabled) {
5621
+ if (didCopy && theme().successLabels.enabled) {
5581
5622
  showTemporarySuccessLabel(`${targetElements.length} elements`);
5582
5623
  }
5583
5624
  notifyElementsSelected(targetElements);
@@ -6025,25 +6066,29 @@ ${plainTextContentOnly}` : plainTextContentOnly;
6025
6066
  document.body.style.cursor = "";
6026
6067
  });
6027
6068
  const rendererRoot = mountRoot(styles_default);
6028
- const selectionVisible = createMemo(() => theme.selectionBox.enabled && isRendererActive() && !isDragging() && Boolean(targetElement()));
6029
- const dragVisible = createMemo(() => theme.dragBox.enabled && isRendererActive() && isDraggingBeyondThreshold());
6069
+ const selectionVisible = createMemo(() => theme().selectionBox.enabled && isRendererActive() && !isDragging() && Boolean(targetElement()));
6070
+ const dragVisible = createMemo(() => theme().dragBox.enabled && isRendererActive() && isDraggingBeyondThreshold());
6030
6071
  const labelVariant = createMemo(() => isCopying() ? "processing" : "hover");
6031
6072
  const labelVisible = createMemo(() => {
6032
- if (!theme.elementLabel.enabled) return false;
6073
+ if (!theme().elementLabel.enabled) return false;
6033
6074
  if (isInputMode()) return false;
6034
6075
  if (isCopying()) return true;
6035
6076
  if (successLabels().length > 0) return false;
6036
6077
  return isRendererActive() && !isDragging() && Boolean(targetElement());
6037
6078
  });
6038
6079
  const progressVisible = createMemo(() => isCopying() && showProgressIndicator() && hasValidMousePosition());
6039
- const crosshairVisible = createMemo(() => theme.crosshair.enabled && isRendererActive() && !isDragging());
6040
- const inputVisible = createMemo(() => theme.inputOverlay.enabled && isInputMode());
6041
- const shouldShowGrabbedBoxes = createMemo(() => theme.grabbedBoxes.enabled);
6042
- const shouldShowSuccessLabels = createMemo(() => theme.successLabels.enabled);
6043
- if (theme.enabled) {
6044
- if (theme.hue !== 0) {
6045
- rendererRoot.style.filter = `hue-rotate(${theme.hue}deg)`;
6080
+ const crosshairVisible = createMemo(() => theme().crosshair.enabled && isRendererActive() && !isDragging());
6081
+ const inputVisible = createMemo(() => theme().inputOverlay.enabled && isInputMode());
6082
+ const shouldShowGrabbedBoxes = createMemo(() => theme().grabbedBoxes.enabled);
6083
+ const shouldShowSuccessLabels = createMemo(() => theme().successLabels.enabled);
6084
+ createEffect(on(theme, (currentTheme) => {
6085
+ if (currentTheme.hue !== 0) {
6086
+ rendererRoot.style.filter = `hue-rotate(${currentTheme.hue}deg)`;
6087
+ } else {
6088
+ rendererRoot.style.filter = "";
6046
6089
  }
6090
+ }));
6091
+ if (theme().enabled) {
6047
6092
  render(() => createComponent(ReactGrabRenderer, {
6048
6093
  get selectionVisible() {
6049
6094
  return selectionVisible();
@@ -6112,7 +6157,9 @@ ${plainTextContentOnly}` : plainTextContentOnly;
6112
6157
  onInputChange: handleInputChange,
6113
6158
  onInputSubmit: handleInputSubmit,
6114
6159
  onInputCancel: handleInputCancel,
6115
- theme
6160
+ get theme() {
6161
+ return theme();
6162
+ }
6116
6163
  }), rendererRoot);
6117
6164
  }
6118
6165
  const copyElementAPI = async (elements) => {
@@ -6162,7 +6209,13 @@ ${plainTextContentOnly}` : plainTextContentOnly;
6162
6209
  isActive: () => isActivated(),
6163
6210
  dispose: dispose2,
6164
6211
  copyElement: copyElementAPI,
6165
- getState: getStateAPI
6212
+ getState: getStateAPI,
6213
+ updateTheme: (partialTheme) => {
6214
+ const currentTheme = theme();
6215
+ const mergedTheme = deepMergeTheme(currentTheme, partialTheme);
6216
+ setTheme(mergedTheme);
6217
+ },
6218
+ getTheme: () => theme()
6166
6219
  };
6167
6220
  });
6168
6221
  };
@@ -0,0 +1,272 @@
1
+ import { FiberSource } from 'bippy/source';
2
+ import 'bippy';
3
+
4
+ type DeepPartial<T> = {
5
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
6
+ };
7
+ interface Theme {
8
+ /**
9
+ * Globally toggle the entire overlay
10
+ * @default true
11
+ */
12
+ enabled?: boolean;
13
+ /**
14
+ * Base hue (0-360) used to generate colors throughout the interface using HSL color space
15
+ * @default 0
16
+ */
17
+ hue?: number;
18
+ /**
19
+ * The highlight box that appears when hovering over an element before selecting it
20
+ * @default true
21
+ */
22
+ selectionBox?: {
23
+ /**
24
+ * Whether to show the selection highlight
25
+ * @default true
26
+ */
27
+ enabled?: boolean;
28
+ /**
29
+ * The border/outline color of the selection box.
30
+ * When undefined, falls back to grab-purple (rgb(210, 57, 192)) with opacity modifiers (50% border, 8% fill).
31
+ * When set, this color is used as the base for both the border and fill with the same opacity modifiers.
32
+ * @default undefined
33
+ */
34
+ color?: string;
35
+ /**
36
+ * Rounded corners of the selection box (e.g., "4px")
37
+ * @default 0px
38
+ */
39
+ borderRadius?: string;
40
+ };
41
+ /**
42
+ * The rectangular selection area that appears when clicking and dragging to select multiple elements
43
+ * @default true
44
+ */
45
+ dragBox?: {
46
+ /**
47
+ * Whether to show the drag selection box
48
+ * @default true
49
+ */
50
+ enabled?: boolean;
51
+ /**
52
+ * The fill color and border of the drag rectangle.
53
+ * When undefined, falls back to grab-purple (rgb(210, 57, 192)) with opacity modifiers (40% border, 5% fill).
54
+ * When set, this color is used as the base for both the border and fill with the same opacity modifiers.
55
+ * @default undefined
56
+ */
57
+ color?: string;
58
+ };
59
+ /**
60
+ * Brief flash/highlight boxes that appear on elements immediately after they're successfully grabbed/copied
61
+ * @default true
62
+ */
63
+ grabbedBoxes?: {
64
+ /**
65
+ * Whether to show these success flash effects
66
+ * @default true
67
+ */
68
+ enabled?: boolean;
69
+ /**
70
+ * The color of the flash boxes.
71
+ * When undefined, falls back to grab-purple (rgb(210, 57, 192)) with opacity modifiers (100% border, 8% fill).
72
+ * When set, this color is used as the base for both the border and fill with the same opacity modifiers.
73
+ * @default undefined
74
+ */
75
+ color?: string;
76
+ };
77
+ /**
78
+ * The floating label that follows the cursor showing information about the currently hovered element
79
+ * @default true
80
+ */
81
+ elementLabel?: {
82
+ /**
83
+ * Whether to show the label
84
+ * @default true
85
+ */
86
+ enabled?: boolean;
87
+ /**
88
+ * Background color of the label box
89
+ * @default #fde7f7 (grab-pink-light)
90
+ */
91
+ backgroundColor?: string;
92
+ /**
93
+ * Color of the text inside the label
94
+ * @default #b21c8e (grab-pink)
95
+ */
96
+ textColor?: string;
97
+ /**
98
+ * Border color around the label
99
+ * @default #f7c5ec (grab-pink-border)
100
+ */
101
+ borderColor?: string;
102
+ /**
103
+ * Internal spacing of the label (e.g., "4px 8px")
104
+ * @default "2px 6px"
105
+ */
106
+ padding?: string;
107
+ /**
108
+ * Distance in pixels the label appears from the cursor
109
+ * @default 14
110
+ */
111
+ cursorOffset?: number;
112
+ };
113
+ /**
114
+ * Text labels that appear after successful operations (like "Copied!" messages)
115
+ * @default true
116
+ */
117
+ successLabels?: {
118
+ /**
119
+ * Whether to show success feedback labels
120
+ * @default true
121
+ */
122
+ enabled?: boolean;
123
+ };
124
+ /**
125
+ * The crosshair cursor overlay that helps with precise element targeting
126
+ * @default true
127
+ */
128
+ crosshair?: {
129
+ /**
130
+ * Whether to show the crosshair
131
+ * @default true
132
+ */
133
+ enabled?: boolean;
134
+ /**
135
+ * Color of the crosshair lines
136
+ * @default rgba(210, 57, 192) (grab-purple)
137
+ */
138
+ color?: string;
139
+ };
140
+ /**
141
+ * An input field overlay that can appear for text entry during selection
142
+ * @default true
143
+ */
144
+ inputOverlay?: {
145
+ /**
146
+ * Whether to show the input overlay when needed
147
+ * @default true
148
+ */
149
+ enabled?: boolean;
150
+ };
151
+ }
152
+ interface ReactGrabState {
153
+ isActive: boolean;
154
+ isDragging: boolean;
155
+ isCopying: boolean;
156
+ targetElement: Element | null;
157
+ dragBounds: DragRect | null;
158
+ }
159
+ type RenderType = "selectionBox" | "dragBox" | "grabbedBox" | "elementLabel" | "successLabel" | "crosshair" | "inputOverlay";
160
+ interface RenderData {
161
+ ref: HTMLElement | undefined;
162
+ props: Record<string, unknown>;
163
+ }
164
+ interface Options {
165
+ enabled?: boolean;
166
+ keyHoldDuration?: number;
167
+ allowActivationInsideInput?: boolean;
168
+ theme?: Theme;
169
+ onActivate?: () => void;
170
+ onDeactivate?: () => void;
171
+ onElementHover?: (element: Element) => void;
172
+ onElementSelect?: (element: Element) => void;
173
+ onDragStart?: (startX: number, startY: number) => void;
174
+ onDragEnd?: (elements: Element[], bounds: DragRect) => void;
175
+ onBeforeCopy?: (elements: Element[]) => void | Promise<void>;
176
+ onAfterCopy?: (elements: Element[], success: boolean) => void;
177
+ onCopySuccess?: (elements: Element[], content: string) => void;
178
+ onCopyError?: (error: Error) => void;
179
+ onStateChange?: (state: ReactGrabState) => void;
180
+ onRender?: (type: RenderType, data: RenderData) => void;
181
+ }
182
+ interface ReactGrabAPI {
183
+ activate: () => void;
184
+ deactivate: () => void;
185
+ toggle: () => void;
186
+ isActive: () => boolean;
187
+ dispose: () => void;
188
+ copyElement: (elements: Element | Element[]) => Promise<boolean>;
189
+ getState: () => ReactGrabState;
190
+ updateTheme: (theme: DeepPartial<Theme>) => void;
191
+ getTheme: () => Required<Theme>;
192
+ }
193
+ interface OverlayBounds {
194
+ borderRadius: string;
195
+ height: number;
196
+ transform: string;
197
+ width: number;
198
+ x: number;
199
+ y: number;
200
+ }
201
+ interface ReactGrabRendererProps {
202
+ selectionVisible?: boolean;
203
+ selectionBounds?: OverlayBounds;
204
+ dragVisible?: boolean;
205
+ dragBounds?: OverlayBounds;
206
+ grabbedBoxes?: Array<{
207
+ id: string;
208
+ bounds: OverlayBounds;
209
+ createdAt: number;
210
+ }>;
211
+ successLabels?: Array<{
212
+ id: string;
213
+ text: string;
214
+ }>;
215
+ labelVariant?: "hover" | "processing" | "success";
216
+ labelContent?: unknown;
217
+ labelX?: number;
218
+ labelY?: number;
219
+ labelVisible?: boolean;
220
+ labelZIndex?: number;
221
+ labelShowHint?: boolean;
222
+ progressVisible?: boolean;
223
+ progress?: number;
224
+ mouseX?: number;
225
+ mouseY?: number;
226
+ crosshairVisible?: boolean;
227
+ inputVisible?: boolean;
228
+ inputX?: number;
229
+ inputY?: number;
230
+ inputValue?: string;
231
+ onInputChange?: (value: string) => void;
232
+ onInputSubmit?: () => void;
233
+ onInputCancel?: () => void;
234
+ theme?: Required<Theme>;
235
+ }
236
+ interface GrabbedBox {
237
+ id: string;
238
+ bounds: OverlayBounds;
239
+ createdAt: number;
240
+ element: Element;
241
+ }
242
+ interface Rect {
243
+ left: number;
244
+ top: number;
245
+ right: number;
246
+ bottom: number;
247
+ }
248
+ interface DragRect {
249
+ x: number;
250
+ y: number;
251
+ width: number;
252
+ height: number;
253
+ }
254
+ interface Position {
255
+ left: number;
256
+ top: number;
257
+ }
258
+
259
+ declare const getNearestComponentName: (element: Element) => string | null;
260
+ interface StackFrame {
261
+ name: string;
262
+ source: FiberSource | null;
263
+ }
264
+ declare const getStack: (element: Element) => Promise<Array<StackFrame>>;
265
+ declare const formatStack: (stack: Array<StackFrame>) => string;
266
+ declare const getHTMLPreview: (element: Element) => string;
267
+
268
+ declare const DEFAULT_THEME: Required<Theme>;
269
+
270
+ declare const init: (rawOptions?: Options) => ReactGrabAPI;
271
+
272
+ export { DEFAULT_THEME as D, type GrabbedBox as G, type Options as O, type Position as P, type ReactGrabAPI as R, type Theme as T, getHTMLPreview as a, getNearestComponentName as b, type ReactGrabState as c, type RenderType as d, type RenderData as e, formatStack as f, getStack as g, type OverlayBounds as h, init as i, type DragRect as j, type Rect as k, type DeepPartial as l, type ReactGrabRendererProps as m };