import { h , render , toChildArray } from 'preact' ; import type { FunctionComponent as Component } from 'preact' ; import type { Props , Slots } from './types' ; import { onDispose } from './hydration' ; export default function createIsland ( component , id , el , props , slots ) { render ( createElement ( component , props , slots ) , el ) ; if ( import . meta . env . DISPOSE_ISLANDS ) onDispose ( id , ( ) => render ( null , el ) ) ; if ( import . meta . env . DEV ) ( window as any ) . __ILE_DEVTOOLS__ ?. onHydration ( { id , el , props , slots , component , framework : 'preact' } ) ; } /**
 * Preact doesn't have an equivalent for createStaticVNode.
 */ const IslandContent = ( props ) => { return h ( 'iles-content' , { dangerouslySetInnerHTML : { __html : props . content } } ) ; } ; IslandContent . shouldComponentUpdate = ( ) => false ; export function createElement ( component , props , slots ) { const content = slots ?. default ; const children = content ? toChildArray ( h ( IslandContent , { content } ) ) : null ; return h ( component , props , children ) ; }