MCPcopy Create free account
hub / github.com/TanStack/devtools / convertPlugin

Method convertPlugin

packages/angular-devtools/src/devtools.ts:116–161  ·  view source on GitHub ↗
(
    plugin: TanStackDevtoolsAngularPlugin,
  )

Source from the content-addressed store, hash-verified

114 }
115
116 private convertPlugin(
117 plugin: TanStackDevtoolsAngularPlugin,
118 ): TanStackDevtoolsPlugin {
119 return {
120 id: plugin.id,
121 defaultOpen: plugin.defaultOpen,
122 name:
123 typeof plugin.name === 'string'
124 ? plugin.name
125 : (e, theme) => {
126 this.renderComponent(plugin.name as Type<any>, e, {
127 theme,
128 ...(plugin.inputs ?? {}),
129 })
130 },
131 render: (e, props) => {
132 if (!plugin.render) {
133 return
134 }
135
136 runInInjectionContext(this.#viewInjector, () => {
137 if (isClassConstructor<unknown>(plugin.render)) {
138 this.renderComponent(plugin.render, e, {
139 ...props,
140 ...(plugin.inputs ?? {}),
141 })
142 } else {
143 this.#renderComponentFunction(
144 plugin.render as Exclude<
145 TanStackDevtoolsAngularPluginRender,
146 Type<any> | null
147 >,
148 e,
149 {
150 ...props,
151 ...(plugin.inputs ?? {}),
152 },
153 )
154 }
155 })
156 },
157 destroy: (pluginId) => {
158 this.#destroyComponentsInContainer(`${PLUGIN_CONTAINER_ID}-${pluginId}`)
159 },
160 }
161 }
162
163 #normalizeInputs<TInputs extends Record<string, any>>(
164 inputs: Signal<TInputs> | (() => TInputs) | TInputs,

Callers 2

constructorMethod · 0.95
getPluginsMapMethod · 0.95

Calls 4

renderComponentMethod · 0.95
isClassConstructorFunction · 0.85

Tested by

no test coverage detected