@@ -41,6 +41,10 @@ import {
41
41
} from '@openscd/open-scd/src/plugin.events.js' ;
42
42
import { newLogEvent } from '@openscd/core/foundation/deprecated/history.js' ;
43
43
import packageJson from '../package.json' ;
44
+ import { CompasSclDataService } from './compas-services/CompasSclDataService.js' ;
45
+ import { createLogEvent } from './compas-services/foundation.js' ;
46
+
47
+ const LNODE_LIB_DOC_ID = '3942f511-7d87-4482-bff9-056a98c6ce15' ;
44
48
45
49
/** The `<open-scd>` custom element is the main entry point of the
46
50
* Open Substation Configuration Designer. */
@@ -127,6 +131,18 @@ export class OpenSCD extends LitElement {
127
131
if ( src . startsWith ( 'blob:' ) ) URL . revokeObjectURL ( src ) ;
128
132
}
129
133
134
+ /** Loads the LNodeTypeDB.ssd document from the CompasSclDataService */
135
+ private async loadLNodeLib ( e : CustomEvent ) : Promise < void > {
136
+ const doc = await CompasSclDataService ( )
137
+ . getSclDocument ( this , 'SSD' , LNODE_LIB_DOC_ID )
138
+ . catch ( reason => createLogEvent ( this , reason ) ) ;
139
+ if ( doc instanceof Document ) {
140
+ e . detail . callback ( doc ) ;
141
+ } else {
142
+ e . detail . callback ( undefined ) ;
143
+ }
144
+ }
145
+
130
146
/**
131
147
*
132
148
* @deprecated Use `handleConfigurationPluginEvent` instead
@@ -434,6 +450,7 @@ export class OpenSCD extends LitElement {
434
450
validator : plugin . kind === 'validator' ,
435
451
editor : plugin . kind === 'editor' ,
436
452
} ) } "
453
+ @request-libdoc=${ ( e : CustomEvent ) => this . loadLNodeLib ( e ) }
437
454
></${ tag } >` ;
438
455
} ,
439
456
} ;
0 commit comments