-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
392 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Plugin, PluginKind } from './plugin.js'; | ||
|
||
/** | ||
* The configure plugin event allows the plugin to request that OpenSCD core add, remove, or reconfigure a plugin. | ||
*/ | ||
export type ConfigurePluginDetail = { | ||
name: string; | ||
// The API describes only 'menu' and 'editor' kinds b | ||
// but we still use the 'validator' too, so I just use the type PluginKind | ||
kind: PluginKind; | ||
config: Plugin | null; | ||
}; | ||
|
||
export type ConfigurePluginEvent = CustomEvent<ConfigurePluginDetail>; | ||
|
||
/** | ||
* The combination of name and kind uniquely identifies the plugin to be configured. | ||
* If config is null, the plugin is removed. Otherwise, the plugin is added or reconfigured. | ||
*/ | ||
export function newConfigurePluginEvent(name: string, kind: PluginKind, config: Plugin | null): ConfigurePluginEvent { | ||
return new CustomEvent<ConfigurePluginDetail>('oscd-configure-plugin', { | ||
bubbles: true, | ||
composed: true, | ||
detail: { name, kind, config }, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { TemplateResult } from 'lit-element'; | ||
|
||
export type Plugin = { | ||
name: string; | ||
src: string; | ||
icon?: string; | ||
default?: boolean; | ||
kind: PluginKind; | ||
requireDoc?: boolean; | ||
position?: MenuPosition; | ||
installed: boolean; | ||
official?: boolean; | ||
content?: TemplateResult; | ||
}; | ||
|
||
export type InstalledOfficialPlugin = { | ||
src: string; | ||
official: true; | ||
installed: boolean; | ||
}; | ||
|
||
|
||
export type PluginKind = 'editor' | 'menu' | 'validator'; | ||
export const menuPosition = ['top', 'middle', 'bottom'] as const; | ||
export type MenuPosition = (typeof menuPosition)[number]; |
Oops, something went wrong.