Interface Dynamic<Component, Config>
interface Dynamic<
Component extends SvelteComponent = SvelteComponent,
Config extends
{
ContextOmit?: keyof NonNullable<Config["ContextShape"]>;
ContextShape?: { [key: string]: any };
PropsOmit?: keyof ComponentProps<Component>;
} = { ContextOmit: never; ContextShape: {}; PropsOmit: never },
> {
anchor?: Element;
class: new (
options: ComponentConstructorOptions<ComponentProps<Component>>,
) => Component;
context?: NarrowContextObject<Config> | NarrowContextFunction<Config>;
intro?: boolean;
props?:
| Partial<Omit<ComponentProps<Component>, Config["PropsOmit"]>>
| NarrowPropsFunction<Component, Config>;
target?: Element | Document | ShadowRoot;
}
Component extends SvelteComponent = SvelteComponent,
Config extends
{
ContextOmit?: keyof NonNullable<Config["ContextShape"]>;
ContextShape?: { [key: string]: any };
PropsOmit?: keyof ComponentProps<Component>;
} = { ContextOmit: never; ContextShape: {}; PropsOmit: never },
> {
anchor?: Element;
class: new (
options: ComponentConstructorOptions<ComponentProps<Component>>,
) => Component;
context?: NarrowContextObject<Config> | NarrowContextFunction<Config>;
intro?: boolean;
props?:
| Partial<Omit<ComponentProps<Component>, Config["PropsOmit"]>>
| NarrowPropsFunction<Component, Config>;
target?: Element | Document | ShadowRoot;
}
Type Parameters
- Component extends SvelteComponent = SvelteComponent
A specific component to narrow the allowed
class
andprops
. - Config extends {
ContextOmit?: keyof NonNullable<Config["ContextShape"]>;
ContextShape?: { [key: string]: any };
PropsOmit?: keyof ComponentProps<Component>;
} = { ContextOmit: never; ContextShape: {}; PropsOmit: never }Additional options to omit properties from allowed in
context
orprops
.
Properties
Optional
anchor
A child of target
to render the component immediately before.
class
The Svelte component class / constructor function.
Optional
context
The root-level additional data to add to the context passed to the component.
Optional
intro
intro?: boolean
If true, will play transitions on initial render, rather than waiting for subsequent state changes.
Optional
props
props?:
| Partial<Omit<ComponentProps<Component>, Config["PropsOmit"]>>
| NarrowPropsFunction<Component, Config>
| Partial<Omit<ComponentProps<Component>, Config["PropsOmit"]>>
| NarrowPropsFunction<Component, Config>
Props to pass to the component. You may define props as an object
or a function returning an object
.
Optional
target
The target to render component to. By default, document.body
is used as the target if not otherwise
defined.
Provides the TRL / client side configuration object to load a Svelte component that is suitable to use with TJSSvelte.API.Config.parseConfig.
Defines a dynamic config that allows the
context
andprops
properties to also be defined as a function that returns an object of properties to respectively load into given component. This can be useful when defining a config in a static context where it is helpful to pass an instance /this
reference when definingcontext
andprops
.See Config.Embed or Config.Standard that narrows the type accepted for
context
andprops
to just anobject
.