d2/d2renderers/d2sketch/setup.js
Alexander Wang cbb691abe1
fmt
2025-01-15 18:33:37 -07:00

23 lines
482 B
JavaScript

const root = {
ownerDocument: {
createElementNS: (ns, tagName) => {
const children = [];
const attrs = {};
const style = {};
return {
style,
tagName,
attrs,
setAttribute: (key, value) => (attrs[key] = value),
appendChild: (node) => children.push(node),
children,
};
},
},
};
const rc = rough.svg(root, { seed: 1 });
let node;
if (typeof globalThis !== "undefined") {
globalThis.rc = rc;
}