@nuniapp/widget 0.1.4 → 0.1.5

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,4 +1,4 @@
1
- import { i as LIMITS, n as MASK_ATTRIBUTE, t as CAPTURE_MARK } from "./mark-BeysEAHp.js";
1
+ import { i as LIMITS, n as MASK_ATTRIBUTE, t as CAPTURE_MARK } from "./mark-B8wojiFu.js";
2
2
  "p".charCodeAt(0);
3
3
  "H".charCodeAt(0);
4
4
  "Y".charCodeAt(0);
@@ -1166,14 +1166,14 @@ function frameFor(el) {
1166
1166
  * stays inside it there; `display: flow-root` gives that same layout. The
1167
1167
  * frame's style attribute is restored exactly afterwards.
1168
1168
  */
1169
- function isolatedLayout(frame, el) {
1169
+ function isolatedLayout(frame, el, focus) {
1170
1170
  const { display } = getComputedStyle(frame);
1171
1171
  const isolate = display === "block" || display === "list-item";
1172
1172
  const before = frame.getAttribute("style");
1173
1173
  if (isolate) frame.setAttribute("style", `${before ? `${before};` : ""}display: flow-root !important`);
1174
1174
  try {
1175
1175
  const box = frame.getBoundingClientRect();
1176
- const target = el.getBoundingClientRect();
1176
+ const target = focus?.() ?? el.getBoundingClientRect();
1177
1177
  const want = around(target);
1178
1178
  return {
1179
1179
  box,
@@ -1228,7 +1228,7 @@ function toBlob(canvas, type, quality) {
1228
1228
  }
1229
1229
  const captureScreenshot = async (el, options) => {
1230
1230
  const frame = frameFor(el);
1231
- const { box, target, masks, crop } = isolatedLayout(frame, el);
1231
+ const { box, target, masks, crop } = isolatedLayout(frame, el, options.focus);
1232
1232
  const cropW = crop.right - crop.left;
1233
1233
  const cropH = crop.bottom - crop.top;
1234
1234
  if (cropW < 1 || cropH < 1) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuniapp/widget",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Pin comments to anything on your site. Talk it through with your team.",
5
5
  "license": "MIT",
6
6
  "type": "module",