export type IslandFramework = 'react' | 'svelte' | 'vue' | 'angular' | 'ember'; export type IslandHydrate = 'load' | 'idle' | 'visible' | 'none'; export type AngularIslandComponent = abstract new (...args: never[]) => object; export type IslandComponentDefinition = { component: Component; export?: string; source: string; }; export type IslandRegistryInput = Partial>>; type UnwrapIslandComponent = Component extends IslandComponentDefinition ? InnerComponent : Component; type ExtractCallableProps = Component extends (props: infer Props, ...args: never[]) => unknown ? NormalizeProps : Record; type ExtractConstructedProps = Component extends abstract new (props: infer Props, ...args: never[]) => unknown ? NormalizeProps : Record; type ExtractReactProps = ExtractCallableProps extends infer Props ? Props extends Record ? ExtractConstructedProps : Props : Record; type ExtractSvelteProps = Component extends (internals: unknown, props: infer Props, ...args: never[]) => unknown ? NormalizeProps : Component extends abstract new (options: { props?: infer Props; }, ...args: never[]) => unknown ? NormalizeProps : Record; type ReservedVueProps = 'key' | 'ref' | 'ref_for' | 'ref_key' | 'class' | 'style' | 'onVnodeBeforeMount' | 'onVnodeMounted' | 'onVnodeBeforeUpdate' | 'onVnodeUpdated' | 'onVnodeBeforeUnmount' | 'onVnodeUnmounted'; type ExtractVueProps = Component extends abstract new () => { $props: infer Props; } ? NormalizeProps> : ExtractCallableProps; type ExtractAngularProps = UnwrapIslandComponent extends { __absoluteProps?: infer Props; } ? NormalizeProps : Record; type ExtractEmberProps = UnwrapIslandComponent extends abstract new (owner: never, args: infer Args, ...rest: never[]) => unknown ? NormalizeProps : Record; type ExtractFrameworkProps = Framework extends 'react' ? ExtractReactProps> : Framework extends 'svelte' ? ExtractSvelteProps> : Framework extends 'vue' ? ExtractVueProps> : Framework extends 'angular' ? ExtractAngularProps : Framework extends 'ember' ? ExtractEmberProps : never; type NormalizeProps = Props extends Record ? Props : Record; export type IslandRegistry = T; export type InferredIslandRegistry = { [F in keyof T]: T[F] extends Record ? { [K in keyof T[F]]: NormalizeProps>; } : never; }; export type IslandRegistryFramework = Extract; export type IslandRegistryComponent> = Extract, string>; export type IslandRegistryProps, Component extends IslandRegistryComponent> = ExtractFrameworkProps[Component]> extends infer Props ? NormalizeProps : Record; export type RuntimeIslandRenderProps = { component: string; framework: IslandFramework; hydrate?: IslandHydrate; props: Record; }; export type TypedIslandRenderProps = { [Framework in IslandRegistryFramework]: { [Component in IslandRegistryComponent]: { component: Component; framework: Framework; hydrate?: IslandHydrate; props: IslandRegistryProps; }; }[IslandRegistryComponent]; }[IslandRegistryFramework]; export {};