@the-portland-company/shell 0.61.1 → 0.62.1
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/app-chrome.cjs +18 -10
- package/dist/app-chrome.cjs.map +1 -1
- package/dist/app-chrome.js +1 -1
- package/dist/{chunk-G5DXKB3R.js → chunk-CFSA73PR.js} +20 -12
- package/dist/chunk-CFSA73PR.js.map +1 -0
- package/dist/native.cjs +18 -10
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-G5DXKB3R.js.map +0 -1
package/dist/app-chrome.cjs
CHANGED
|
@@ -1388,36 +1388,44 @@ function currentChromeTheme() {
|
|
|
1388
1388
|
}
|
|
1389
1389
|
var SPEC_OVERLAY_ROOT_ATTR = "data-spec-overlay-root";
|
|
1390
1390
|
async function captureMyView(status, orgId, orgName) {
|
|
1391
|
-
const {
|
|
1391
|
+
const { domToCanvas } = await import('modern-screenshot');
|
|
1392
1392
|
const w = window.innerWidth;
|
|
1393
1393
|
const h = window.innerHeight;
|
|
1394
1394
|
const theme = currentChromeTheme();
|
|
1395
1395
|
const bg = getComputedStyle(document.body).backgroundColor || (theme === "dark" ? "#0b0b0c" : "#ffffff");
|
|
1396
|
-
const
|
|
1396
|
+
const full = await domToCanvas(document.body, {
|
|
1397
1397
|
width: w,
|
|
1398
1398
|
height: h,
|
|
1399
1399
|
scale: 1,
|
|
1400
1400
|
backgroundColor: bg,
|
|
1401
|
-
type: "image/png",
|
|
1402
1401
|
// Cross-origin images that refuse CORS render blank instead of failing.
|
|
1403
1402
|
fetch: { requestInit: { mode: "cors", credentials: "omit" }, placeholderImage: "" },
|
|
1404
|
-
|
|
1403
|
+
// Drop the Spec drawer and everything fixed (sidebar, toasts, popovers):
|
|
1404
|
+
// the design is the page body only, so chrome would only add noise.
|
|
1405
|
+
filter: (node) => !(node instanceof Element) || !node.hasAttribute(SPEC_OVERLAY_ROOT_ATTR) && getComputedStyle(node).position !== "fixed",
|
|
1405
1406
|
style: { transform: `translate(${-window.scrollX}px, ${-window.scrollY}px)` }
|
|
1406
1407
|
});
|
|
1407
|
-
|
|
1408
|
-
let
|
|
1409
|
-
const el = status.live_selector ? document.querySelector(status.live_selector) : null;
|
|
1408
|
+
const el = (status.live_selector ? document.querySelector(status.live_selector) : null) ?? document.querySelector("[data-shell-content]");
|
|
1409
|
+
let region = { x: 0, y: 0, width: w, height: h };
|
|
1410
1410
|
if (el) {
|
|
1411
1411
|
const r = el.getBoundingClientRect();
|
|
1412
1412
|
const x = Math.max(0, Math.round(r.left));
|
|
1413
1413
|
const y = Math.max(0, Math.round(r.top));
|
|
1414
|
-
|
|
1414
|
+
region = { x, y, width: Math.min(w - x, Math.round(r.width)), height: Math.min(h - y, Math.round(r.height)) };
|
|
1415
1415
|
}
|
|
1416
|
+
const out = document.createElement("canvas");
|
|
1417
|
+
out.width = region.width;
|
|
1418
|
+
out.height = region.height;
|
|
1419
|
+
const ctx = out.getContext("2d");
|
|
1420
|
+
if (!ctx) throw new Error("page raster failed");
|
|
1421
|
+
ctx.drawImage(full, region.x, region.y, region.width, region.height, 0, 0, region.width, region.height);
|
|
1422
|
+
const blob = await new Promise((resolve) => out.toBlob(resolve, "image/png"));
|
|
1423
|
+
if (!blob) throw new Error("page raster failed");
|
|
1416
1424
|
const form = new FormData();
|
|
1417
1425
|
form.append("image", blob, "live.png");
|
|
1418
1426
|
form.append(
|
|
1419
1427
|
"meta",
|
|
1420
|
-
JSON.stringify({ url: window.location.href, theme, org_id: orgId ?? null, org_name: orgName ?? null, crop })
|
|
1428
|
+
JSON.stringify({ url: window.location.href, theme, org_id: orgId ?? null, org_name: orgName ?? null, crop: null })
|
|
1421
1429
|
);
|
|
1422
1430
|
const res = await fetch(status.capture_url ?? `${SPECS_ORIGIN}/api/overlay/capture`, {
|
|
1423
1431
|
method: "POST",
|
|
@@ -3321,7 +3329,7 @@ function NavAppShell({
|
|
|
3321
3329
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lg:pl-[240px]", children: [
|
|
3322
3330
|
/* @__PURE__ */ jsxRuntime.jsx(NavTopBar, { ...topBar, onOpenNav: () => setNavOpen(true), navOpen }),
|
|
3323
3331
|
betaBanner ? /* @__PURE__ */ jsxRuntime.jsx(NavBetaBanner, { ...betaBanner }) : null,
|
|
3324
|
-
contentWrapper === "bare" ? children : /* @__PURE__ */ jsxRuntime.jsx("main", { className: "px-6 py-7", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto max-w-7xl", children }) })
|
|
3332
|
+
contentWrapper === "bare" ? /* @__PURE__ */ jsxRuntime.jsx("div", { "data-shell-content": "", children }) : /* @__PURE__ */ jsxRuntime.jsx("main", { "data-shell-content": "", className: "px-6 py-7", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto max-w-7xl", children }) })
|
|
3325
3333
|
] })
|
|
3326
3334
|
]
|
|
3327
3335
|
}
|