MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / make

Function make

packages/studio-server/src/helpers/previewAdapter.test.ts:27–37  ·  view source on GitHub ↗

Create + append an element to body; optionally set attrs and inline styles.

(
  tag: string,
  attrs: Record<string, string> = {},
  styles: Record<string, string> = {},
)

Source from the content-addressed store, hash-verified

25
26/** Create + append an element to body; optionally set attrs and inline styles. */
27function make(
28 tag: string,
29 attrs: Record<string, string> = {},
30 styles: Record<string, string> = {},
31): HTMLElement {
32 const elem = document.createElement(tag);
33 for (const [k, v] of Object.entries(attrs)) elem.setAttribute(k, v);
34 for (const [k, v] of Object.entries(styles)) elem.style.setProperty(k, v);
35 document.body.appendChild(elem);
36 return elem;
37}
38
39function adapterWith(resolvePoint: (x: number, y: number) => Element | null) {
40 return createPreviewAdapter(document, { resolvePoint });

Callers 1

Calls 3

entriesMethod · 0.80
setPropertyMethod · 0.80
setAttributeMethod · 0.65

Tested by

no test coverage detected