Skip to content

Commit c805497

Browse files
committed
chore: update @compas-oscd/core to version 0.1.23 and adjust plugin configurations
1 parent cf1b2fd commit c805497

File tree

3 files changed

+36
-20
lines changed

3 files changed

+36
-20
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compas-open-scd/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"module": "open-scd.js",
1919
"type": "module",
2020
"dependencies": {
21-
"@compas-oscd/core": "^0.1.21",
21+
"@compas-oscd/core": "^0.1.23",
2222
"@compas-oscd/xml": "^0.0.1",
2323
"@material/mwc-dialog": "0.22.1",
2424
"@material/mwc-drawer": "0.22.1",

packages/compas-open-scd/src/open-scd.ts

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { ActionDetail } from '@material/mwc-list';
3030

3131
import { officialPlugins as builtinPlugins } from '../public/js/plugins.js';
3232
import type { PluginSet, Plugin as CorePlugin } from '@compas-oscd/core';
33-
import { OscdApi } from '@compas-oscd/core';
33+
import { OscdApi, XMLEditor } from '@compas-oscd/core';
3434
import { classMap } from 'lit-html/directives/class-map.js';
3535
import {
3636
newConfigurePluginEvent,
@@ -45,6 +45,18 @@ import { languages, loader } from './translations/loader.js';
4545

4646
const 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

Comments
 (0)