@insitue/sdk 0.4.3 → 0.4.4

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mountCaptureOnly
3
- } from "./chunk-3XYBNSL6.js";
3
+ } from "./chunk-GT7TT3G7.js";
4
4
  export {
5
5
  mountCaptureOnly
6
6
  };
@@ -2106,14 +2106,30 @@ async function buildBundle(sel) {
2106
2106
  let screenshot;
2107
2107
  let screenshotUnavailable;
2108
2108
  if (el instanceof HTMLElement || el instanceof SVGElement) {
2109
+ const pickedRect = el.getBoundingClientRect();
2109
2110
  const context = findContextAncestor(el);
2110
- const cr = context.getBoundingClientRect();
2111
- const cropRect = new DOMRect(
2112
- Math.max(0, cr.x),
2113
- Math.max(0, cr.y),
2114
- Math.min(window.innerWidth, cr.right) - Math.max(0, cr.x),
2115
- Math.min(window.innerHeight, cr.bottom) - Math.max(0, cr.y)
2111
+ const ar = context.getBoundingClientRect();
2112
+ const MIN_W = 420;
2113
+ const MIN_H = 140;
2114
+ const cropW = Math.min(
2115
+ window.innerWidth,
2116
+ Math.max(MIN_W, ar.width, pickedRect.width)
2116
2117
  );
2118
+ const cropH = Math.min(
2119
+ window.innerHeight,
2120
+ Math.max(MIN_H, ar.height, pickedRect.height)
2121
+ );
2122
+ const pickedCx = pickedRect.x + pickedRect.width / 2;
2123
+ const pickedCy = pickedRect.y + pickedRect.height / 2;
2124
+ const cropX = Math.max(
2125
+ 0,
2126
+ Math.min(window.innerWidth - cropW, pickedCx - cropW / 2)
2127
+ );
2128
+ const cropY = Math.max(
2129
+ 0,
2130
+ Math.min(window.innerHeight - cropH, pickedCy - cropH / 2)
2131
+ );
2132
+ const cropRect = new DOMRect(cropX, cropY, cropW, cropH);
2117
2133
  const orig = {
2118
2134
  outline: el.style.outline,
2119
2135
  outlineOffset: el.style.outlineOffset
@@ -2920,8 +2936,8 @@ function CaptureApp(props) {
2920
2936
  k("span", {}, isDev ? "InSitue Dev \xB7 pick + describe \u2192 CLI" : ""),
2921
2937
  k(
2922
2938
  "span",
2923
- { title: `@insitue/sdk@${"0.4.3"}` },
2924
- `InSitue \xB7 v${"0.4.3"}`
2939
+ { title: `@insitue/sdk@${"0.4.4"}` },
2940
+ `InSitue \xB7 v${"0.4.4"}`
2925
2941
  )
2926
2942
  ]
2927
2943
  )
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mountCaptureOnly
3
- } from "./chunk-3XYBNSL6.js";
3
+ } from "./chunk-GT7TT3G7.js";
4
4
 
5
5
  // src/InSitue.tsx
6
6
  import { useEffect } from "react";
@@ -54,7 +54,7 @@ function InSitue({ port }) {
54
54
  }
55
55
 
56
56
  // src/index.ts
57
- var SDK_VERSION = "0.4.3";
57
+ var SDK_VERSION = "0.4.4";
58
58
  export {
59
59
  InSitue,
60
60
  InSitueCapture,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insitue/sdk",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "description": "InSitue capture SDK — drop one snippet into your deployed app; your users point at a bug, InSitue opens a verified pull request.",
5
5
  "license": "MIT",
6
6
  "type": "module",