open-scd
open-scd copied to clipboard
Enable the Usage of a simple OpenSCD Custom Element
The CoMPAS team would like to remove the fork and instead of it, use a configurable distribution. We identified the following overwrites in the CoMPAS fork:
- Plugging mixin: It has a feature where if your plugin's name starts with
[WIP]
it will disable it in the menu. - Hosting mixin: The action items on the top right are hardcoded currently, and they add their own ones
- OpenSCD itself: They wrap the whole OpenSCD with the
<compass-session></compass-session>
element to provide authentication to OpenSCD - Settings mixin: They disable the nsdoc upload possibility because they have their own nsdoc set up by default.
- History mixin: They add the capability of editing elements from the diagnostic window for easier error fixing.
Our Approach
We have talked through a few possibilities and tried to come up with the least invasive solution that still does not lead down a path that we cannot support or it is hard to undo.
For the current issues mentioned above we came up with the following solutions (a summary):
- [x]
1
Plugging mixin: the overwrite won't be needed because it was just a temporary solution - [ ]
2
#1481 - [ ]
3
OpenSCD itself: the logic will be moved to the same plugin that will be used in2
- [ ]
4
#1482 - [ ]
5
#1484 - [ ]
6
#1483
The Expected Result
When we are finished with the above mentioned point we expect that the CoMPAS project can install open-scd from npm and configure it to their needs. To be more specific we imagine the following steps:
- create your app with any or no framework
-
npm install @openscd/open-scd
- add the following html:
<open-scd plugins={plugins} nsdoc-upload-disabled={true}></open-scd>
whereplugins
is the plugins configuration that we have currently inplugins.js
The CoMPAS Authentication plugin will be configured something along these lines:
const plugins = [
...
{
name: 'CoMPAS',
src: 'https//.../compass-session.js',
icon: '...',
default: true,
kind: 'menu',
requireDoc: false,
position: 'actionItem',
},
...
]
``