@@ -30,7 +30,7 @@ import { ActionDetail } from '@material/mwc-list';
3030
3131import { officialPlugins as builtinPlugins } from '../public/js/plugins.js' ;
3232import type { PluginSet , Plugin as CorePlugin } from '@compas-oscd/core' ;
33- import { OscdApi } from '@compas-oscd/core' ;
33+ import { OscdApi , XMLEditor } from '@compas-oscd/core' ;
3434import { classMap } from 'lit-html/directives/class-map.js' ;
3535import {
3636 newConfigurePluginEvent ,
@@ -45,6 +45,18 @@ import { languages, loader } from './translations/loader.js';
4545
4646const LNODE_LIB_DOC_ID = 'fc55c46d-c109-4ccd-bf66-9f1d0e135689' ;
4747
48+ interface MenuPluginConfig
49+ extends Omit < Plugin , 'position' | 'kind' | 'active' > {
50+ position ?: MenuPosition | number ;
51+ active ?: boolean ;
52+ }
53+
54+ interface EditorPluginConfig
55+ extends Omit < Plugin , 'position' | 'kind' | 'active' > {
56+ position ?: undefined ;
57+ active ?: boolean ;
58+ }
59+
4860/** The `<open-scd>` custom element is the main entry point of the
4961 * Open Substation Configuration Designer. */
5062@customElement ( 'open-scd' )
@@ -302,22 +314,26 @@ export class OpenSCD extends LitElement {
302314 @property ( { type : Object } ) plugins : PluginSet = { menu : [ ] , editor : [ ] } ;
303315
304316 get parsedPlugins ( ) : Plugin [ ] {
305- const menuPlugins : Plugin [ ] = this . plugins . menu . map ( plugin => {
306- let newPosition : MenuPosition | undefined =
307- plugin . position as MenuPosition ;
308- if ( typeof plugin . position === 'number' ) {
309- newPosition = undefined ;
317+ const menuPlugins : Plugin [ ] = ( this . plugins . menu as MenuPluginConfig [ ] ) . map (
318+ ( plugin : MenuPluginConfig ) : Plugin => {
319+ let newPosition : MenuPosition | undefined =
320+ plugin . position as MenuPosition ;
321+ if ( typeof plugin . position === 'number' ) {
322+ newPosition = undefined ;
323+ }
324+
325+ return {
326+ ...plugin ,
327+ position : newPosition ,
328+ kind : 'menu' as PluginKind ,
329+ active : plugin . active ?? false ,
330+ } ;
310331 }
332+ ) ;
311333
312- return {
313- ...plugin ,
314- position : newPosition ,
315- kind : 'menu' as PluginKind ,
316- active : plugin . active ?? false ,
317- } ;
318- } ) ;
319-
320- const editorPlugins : Plugin [ ] = this . plugins . editor . map ( plugin => {
334+ const editorPlugins : Plugin [ ] = (
335+ this . plugins . editor as EditorPluginConfig [ ]
336+ ) . map ( ( plugin : EditorPluginConfig ) : Plugin => {
321337 const editorPlugin : Plugin = {
322338 ...plugin ,
323339 position : undefined ,
0 commit comments