From ddf8b12dd76f9eebe08fda65fdb2ed58974b913f Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Thu, 16 May 2024 22:02:46 +0200 Subject: [PATCH 1/3] refactor: account for requireDoc prop in editor plugins rendering Signed-off-by: Juan Munoz --- packages/openscd/src/addons/Layout.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/openscd/src/addons/Layout.ts b/packages/openscd/src/addons/Layout.ts index 2df334e75..5b2f43c6a 100644 --- a/packages/openscd/src/addons/Layout.ts +++ b/packages/openscd/src/addons/Layout.ts @@ -453,17 +453,14 @@ export class OscdLayout extends LitElement { /** Renders the enabled editor plugins and a tab bar to switch between them*/ protected renderContent(): TemplateResult { - return html` - ${this.doc - ? html` - (this.activeTab = e.detail.index)} - > - ${this.editors.map(this.renderEditorTab)} - - ${this.editors[this.activeTab]?.content? this.editors[this.activeTab].content: ``}` - : ``} - `; + const activePlugin = this.editors[this.activeTab]; + return html` + (this.activeTab = e.detail.index)} + > + ${this.editors.filter(p=> !p.requireDoc || this.doc).map(this.renderEditorTab)} + + ${activePlugin && (!activePlugin.requireDoc || this.doc)? this.editors[this.activeTab].content: ``}`; } /** Renders the landing buttons (open project and new project)*/ From c68acc79ef733a50ce41948dc6ed361955a293e2 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Thu, 16 May 2024 22:03:17 +0200 Subject: [PATCH 2/3] chore: add requireDoc prop to officialPlugins Signed-off-by: Juan Munoz --- packages/openscd/src/plugins.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/openscd/src/plugins.ts b/packages/openscd/src/plugins.ts index 50d520b0e..ade62f43a 100644 --- a/packages/openscd/src/plugins.ts +++ b/packages/openscd/src/plugins.ts @@ -5,6 +5,7 @@ export const officialPlugins = [ icon: 'developer_board', default: true, kind: 'editor', + requireDoc: true, }, { name: 'Substation', @@ -12,6 +13,7 @@ export const officialPlugins = [ icon: 'margin', default: true, kind: 'editor', + requireDoc: true, }, { name: 'Single Line Diagram', @@ -19,6 +21,7 @@ export const officialPlugins = [ icon: 'edit', default: false, kind: 'editor', + requireDoc: true, }, { name: 'Subscriber Message Binding (GOOSE)', @@ -26,6 +29,7 @@ export const officialPlugins = [ icon: 'link', default: false, kind: 'editor', + requireDoc: true, }, { name: 'Subscriber Data Binding (GOOSE)', @@ -33,6 +37,7 @@ export const officialPlugins = [ icon: 'link', default: false, kind: 'editor', + requireDoc: true, }, { name: 'Subscriber Later Binding (GOOSE)', @@ -40,6 +45,7 @@ export const officialPlugins = [ icon: 'link', default: true, kind: 'editor', + requireDoc: true, }, { name: 'Subscriber Message Binding (SMV)', @@ -47,6 +53,7 @@ export const officialPlugins = [ icon: 'link', default: false, kind: 'editor', + requireDoc: true, }, { name: 'Subscriber Data Binding (SMV)', @@ -54,6 +61,7 @@ export const officialPlugins = [ icon: 'link', default: false, kind: 'editor', + requireDoc: true, }, { name: 'Subscriber Later Binding (SMV)', @@ -61,6 +69,7 @@ export const officialPlugins = [ icon: 'link', default: true, kind: 'editor', + requireDoc: true, }, { name: 'Communication', @@ -68,6 +77,7 @@ export const officialPlugins = [ icon: 'settings_ethernet', default: true, kind: 'editor', + requireDoc: true, }, { name: '104', @@ -75,6 +85,7 @@ export const officialPlugins = [ icon: 'settings_ethernet', default: false, kind: 'editor', + requireDoc: true, }, { name: 'Templates', @@ -82,6 +93,7 @@ export const officialPlugins = [ icon: 'copy_all', default: true, kind: 'editor', + requireDoc: true, }, { name: 'Publisher', @@ -89,6 +101,7 @@ export const officialPlugins = [ icon: 'publish', default: false, kind: 'editor', + requireDoc: true, }, { name: 'Cleanup', @@ -96,6 +109,7 @@ export const officialPlugins = [ icon: 'cleaning_services', default: false, kind: 'editor', + requireDoc: true, }, { name: 'Open project', From 5873ed6a44ce3c7fcaa88662b90c7b4bed7d4460 Mon Sep 17 00:00:00 2001 From: Juan Munoz Date: Thu, 16 May 2024 23:03:58 +0200 Subject: [PATCH 3/3] ci: fixing clean script in packages/openscd Signed-off-by: Juan Munoz --- packages/openscd/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/openscd/package.json b/packages/openscd/package.json index 0073a604b..b9372646b 100644 --- a/packages/openscd/package.json +++ b/packages/openscd/package.json @@ -47,7 +47,7 @@ "@openscd/core": "*" }, "scripts": { - "clean": "rimraf build", + "clean": "rimraf dist", "lint:eslint": "eslint --ext .ts,.html . --ignore-path .gitignore", "format:eslint": "eslint --ext .ts,.html . --fix --ignore-path .gitignore", "lint:prettier": "prettier \"**/*.js\" \"**/*.ts\" --check --ignore-path .gitignore",