Skip to content

Commit ef202b8

Browse files
committed
feat: add plugin interface (shell constraint to APIs)
1 parent 9bdf5f1 commit ef202b8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Plugin.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { EditV2 } from './editv2.js';
2+
import { Transactor } from './Transactor.js';
3+
4+
/**
5+
* OpenSCD core communicates the data necessary for editing SCL documents by setting the
6+
* following [properties](https://developer.mozilla.org/en-US/docs/Glossary/Property/JavaScript) on
7+
* the plugin's [DOM Element](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement)
8+
*
9+
* @property docs - A map of document names to their loaded XMLDocument instances.
10+
* @property doc - The XMLDocument currently being edited, if any.
11+
* @property docName - The name of the currently edited document, if any.
12+
* @property docsState - changes value when the document is modified or documents are added/removed.
13+
* @property locale - The end user's selected locale.
14+
*/
15+
export interface Plugin {
16+
editor: Transactor<EditV2>;
17+
docs: Record<string, XMLDocument>;
18+
doc?: XMLDocument; // the document currently being edited
19+
docName?: string; // the current doc's name
20+
docsState: unknown; // current doc's state indicator
21+
locale: string; // the end user's chosen locale
22+
}

0 commit comments

Comments
 (0)