File tree Expand file tree Collapse file tree
packages/devtools-utils/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11export * from './panel'
2+ export * from './plugin'
Original file line number Diff line number Diff line change 1+ import type { JSX } from "react"
2+ import type { DevtoolsPanelProps } from "./panel"
3+
4+ export function createReactPlugin ( name : string , Component : ( props : DevtoolsPanelProps ) => JSX . Element ) {
5+ function Plugin ( ) {
6+ return {
7+ name : name ,
8+ render : ( _el : HTMLElement , theme : 'light' | 'dark' ) => < Component theme = { theme } /> ,
9+ }
10+ }
11+ function NoOpPlugin ( ) {
12+ return {
13+ name : name ,
14+ render : ( _el : HTMLElement , _theme : 'light' | 'dark' ) => null ,
15+ }
16+ }
17+ return [ Plugin , NoOpPlugin ] as const
18+ }
Original file line number Diff line number Diff line change 11export * from './class'
22export * from './panel'
3+ export * from "./plugin"
Original file line number Diff line number Diff line change 1+ /** @jsxImportSource solid-js - we use Solid.js as JSX here */
2+
3+ import type { JSX } from "solid-js" ;
4+ import type { DevtoolsPanelProps } from "./panel" ;
5+
6+ export function createSolidPlugin ( name : string , Component : ( props : DevtoolsPanelProps ) => JSX . Element ) {
7+ function Plugin ( ) {
8+ return {
9+ name : name ,
10+ render : ( _el : HTMLElement , theme : 'light' | 'dark' ) => {
11+ return < Component theme = { theme } /> ;
12+ } ,
13+ }
14+ }
15+ function NoOpPlugin ( ) {
16+ return {
17+ name : name ,
18+ render : ( _el : HTMLElement , _theme : 'light' | 'dark' ) => null ,
19+ }
20+ }
21+ return [ Plugin , NoOpPlugin ] as const
22+ }
You can’t perform that action at this time.
0 commit comments