Function
createSveltePlugin
(
name: string,
component: Component<TComponentProps>,
)
Source from the content-addressed store, hash-verified
| 1 | import NoOp from './NoOp.svelte' |
| 2 | import type { Component } from 'svelte' |
| 3 | |
| 4 | export function createSveltePlugin< |
| 5 | TComponentProps extends Record<string, any>, |
| 6 | >({ |
| 7 | Component, |
| 8 | ...config |
| 9 | }: { |
| 10 | name: string |
| 11 | id?: string |
| 12 | defaultOpen?: boolean |
| 13 | Component: Component<TComponentProps> |
| 14 | }) { |
| 15 | function Plugin(props?: TComponentProps) { |
| 16 | return { |
| 17 | ...config, |
| 18 | component: Component, |
| 19 | props, |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | function NoOpPlugin(props?: TComponentProps) { |
| 24 | return { |
| 25 | ...config, |
| 26 | component: NoOp, |
| 27 | props, |
Tested by
no test coverage detected