open-scd icon indicating copy to clipboard operation
open-scd copied to clipboard

Enable the Usage of a simple OpenSCD Custom Element

Open trusz opened this issue 10 months ago • 0 comments

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:

  1. Plugging mixin: It has a feature where if your plugin's name starts with [WIP] it will disable it in the menu.
  2. Hosting mixin: The action items on the top right are hardcoded currently, and they add their own ones
  3. OpenSCD itself: They wrap the whole OpenSCD with the <compass-session></compass-session> element to provide authentication to OpenSCD
  4. Settings mixin: They disable the nsdoc upload possibility because they have their own nsdoc set up by default.
  5. 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 in 2
  • [ ] 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:

  1. create your app with any or no framework
  2. npm install @openscd/open-scd
  3. add the following html: <open-scd plugins={plugins} nsdoc-upload-disabled={true}></open-scd> where plugins is the plugins configuration that we have currently in plugins.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',
  },
  ...
]
``

trusz avatar Mar 28 '24 21:03 trusz