ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
49 lines (48 loc) • 1.13 kB
JavaScript
import { n } from "./chunk-Y2CYZVJY-0JxdZxki.js";
var c = 1;
function i() {
if (!(typeof globalThis > "u"))
return globalThis;
}
n(i, "getCaptureGlobal");
function p() {
return !!i()?.mermaidCaptureSizes;
}
n(p, "shouldCaptureSizes");
function u() {
return typeof location > "u" ? "browser-dev" : `${location.pathname}${location.search}`;
}
n(u, "capturedFromLocation");
function d(o, r) {
const t = i();
if (!t) return;
const e = r.node(), s = ((e && "ownerSVGElement" in e ? e.ownerSVGElement : null) ?? e)?.id ?? "(unknown)";
t.mermaidCapturedSizes ??= [];
const a = {
svgId: s,
sizes: o
};
t.mermaidCapturedSizes.push(a), t.mermaidLastCapturedSizes = a;
}
n(d, "emitCapturedSizes");
function m(o, r) {
const t = [];
for (const e of r.nodes)
e.isGroup || t.push({
id: e.id,
width: e.width ?? 0,
height: e.height ?? 0
});
t.length !== 0 && d({
metadata: {
captureVersion: c,
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
capturedFrom: u()
},
nodes: t
}, o);
}
n(m, "captureNodeSizes");
export {
m as captureNodeSizes
};