d2/d2renderers/d2sketch/setup.js

24 lines
482 B
JavaScript
Raw Permalink Normal View History

2022-12-21 07:43:45 +00:00
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;
2025-01-15 23:30:17 +00:00
2025-01-16 01:33:37 +00:00
if (typeof globalThis !== "undefined") {
2025-01-15 23:30:17 +00:00
globalThis.rc = rc;
}