@nuniapp/widget 0.1.4 → 0.1.6
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/README.md +7 -1
- package/dist/index.d.ts +143 -1
- package/dist/index.js +2272 -324
- package/dist/{mark-BeysEAHp.js → mark-B8wojiFu.js} +25 -1
- package/dist/nuni-screenshot.global.js +2 -2
- package/dist/nuni.global.js +177 -8
- package/dist/{screenshot-B2x2-nI_.js → screenshot-DcJ_SzKF.js} +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as LIMITS, n as MASK_ATTRIBUTE, t as CAPTURE_MARK } from "./mark-
|
|
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;
|