import React, { useContext } from 'react'; import { Context } from './context.js'; // Reference https://react-typescript-cheatsheet.netlify.app/docs/hoc/intro/ export interface ShadowDomProps { insideShadowDom: boolean; shadowHost: HTMLDivElement | null; shadowRoot: ShadowRoot | null; mountedInto: HTMLDivElement | null; unmountRoot: () => void | null; } export const withShadowDom =
(WrappedComponent: React.ComponentType
) => { const displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component'; const ComponentWithShadowDom = (props: Omit
) => {
const contextProps = useContext(Context);
return