import { RootFragment } from './lib';
import { ComponentType } from 'preact';
export declare type InitialProps = {
[x: string]: any;
};
export declare type Island
= {
/**
* A WeakMap that yields the mutation observers associated with a particular root. Used for cleaning up observers
* on destroy.
*/
_rootsToObservers: WeakMap;
/**
* An array of the root fragments (a fake DOM element) containing one or more
* DOM nodes, which can then be passed as the `parent` argument to Preact's `render()` method.
*/
_roots: RootFragment[];
/**
* A reference to the executed script that called `createIsland`. This is used for listening to prop
* changes on that script and causing rerenders of the island.
*/
_executedScript: HTMLOrSVGScriptElement | null;
/**
* Renders the created island at the given selector. Calling multiple times appends elements at the given selectors.
*/
render: (props: {
/**
* A query selector target to create the widget. This is ignored if inline is passed or if a `data-mount-in` attribute
* is appended onto the executed script.
*
* @example '[data-island="widget"]'
*/
selector?: string;
/**
* If true, removes all children of the element before rendering the component.
*
* @default false
*
* @example
* ```html
*
*
some other content
*
some other content
*
some other content
*
* ```
*
* // turns into
*
* ```html
*
* ```
*
* // turns into
*
* ```html
* your-widget
* ```
*/
replace?: boolean;
/**
* Renders the widget at the current position of the script in the HTML document.
*
* @default false
*
* @example
* ```html
*
*
some content here
*
*
some content here
*
* ```
*
* // turns into
*
* ```html
*
*
some content here
*
*
your widget
*
some content here
*
* ```
*/
inline?: boolean;
/**
* Initial props to pass to the component. These props do not cause updates to the island if changed. Use `createIsland().rerender` instead.
*/
initialProps?: Partial;
/**
* A valid selector to a script tag located in the HTML document with a type of either `text/props` or `application/json`
* containing props to pass into the component. If there are multiple scripts found with the selector, all props are merged with
* the last script found taking priority.
*/
propsSelector?: string;
/**
* Passed in if using for web components
*/
elementName?: string;
}) => void;
/**
* Contains the current props used to render the island.
*/
props: P;
/**
* Triggers a rerenders of the island with the new props given.
*/
rerender: (props: P) => void;
/**
* Destroys all instances of the island on the page and disconnects any associated observers.
*/
destroy: () => void;
};
export declare const createIsland:
(widget: ComponentType
) => Island
;