Skip to content

Commit

Permalink
Merge branch 'main' into release-please--branches--main--components--…
Browse files Browse the repository at this point in the history
…openscd-monorepo
  • Loading branch information
clepski authored Dec 4, 2024
2 parents 5b90cb5 + 267935f commit db5581f
Show file tree
Hide file tree
Showing 10 changed files with 3,190 additions and 3,107 deletions.
2 changes: 2 additions & 0 deletions packages/distribution/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
<!-- Original URL from Google: https://fonts.googleapis.com/css?family=Material+Icons+Outlined&display=block -->
<link href="%PUBLIC_URL%/public/google/icons/material-icons-outlined.css"
rel="stylesheet">
<link href="%PUBLIC_URL%/public/google/icons/material-symbols-outlined.css"
rel="stylesheet">
<link href="%PUBLIC_URL%/public/css/normalize.css"
rel="stylesheet">
<link rel="manifest"
Expand Down
2 changes: 1 addition & 1 deletion packages/distribution/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
"purpose": "maskable"
}
],
"version": "0.33.0"
"version": "0.36.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* fallback */
@font-face {
font-family: 'Material Symbols Outlined';
font-style: normal;
font-weight: 400;
font-display: block;
src: url(material-symbols-outlined.woff2) format('woff2');
}

.material-symbols-outlined {
font-family: 'Material Symbols Outlined';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-webkit-font-feature-settings: 'liga';
-webkit-font-smoothing: antialiased;
}
Binary file not shown.
21 changes: 20 additions & 1 deletion packages/openscd/src/addons/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ export class OscdEditor extends LitElement {
}

async handleEditEvent(event: EditEvent) {
/**
* This is a compatibility fix for plugins based on open energy tools edit events
* because their edit event look slightly different
* see https://github.com/OpenEnergyTools/open-scd-core/blob/main/foundation/edit-event-v1.ts for details
*/
if (isOpenEnergyEditEvent(event)) {
event = convertOpenEnergyEditEventToEditEvent(event);
}

const edit = event.detail.edit;
const undoEdit = handleEdit(edit);

Expand Down Expand Up @@ -244,4 +253,14 @@ function handleRemove({ node }: Remove): Insert | [] {
reference,
};
return [];
}
}

function isOpenEnergyEditEvent(event: CustomEvent<unknown>): boolean {
const eventDetail = event.detail as Edit;
return isComplex(eventDetail) || isInsert(eventDetail) || isUpdate(eventDetail) || isRemove(eventDetail);
}

function convertOpenEnergyEditEventToEditEvent(event: CustomEvent<unknown>): EditEvent {
const eventDetail = event.detail as Edit;
return newEditEvent(eventDetail);
}
12 changes: 8 additions & 4 deletions packages/openscd/src/addons/Layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ export class OscdLayout extends LitElement {

render(): TemplateResult {
return html`
<slot></slot>
${this.renderHeader()} ${this.renderAside()} ${this.renderContent()}
${this.renderLanding()} ${this.renderPlugging()}
<div
@open-plugin-download=${() => this.pluginDownloadUI.show()}
>
<slot></slot>
${this.renderHeader()} ${this.renderAside()} ${this.renderContent()}
${this.renderLanding()} ${this.renderPlugging()}
</div>
`;
}

Expand Down Expand Up @@ -394,7 +398,7 @@ export class OscdLayout extends LitElement {
}

private renderEditorTab({ name, icon }: Plugin): TemplateResult {
return html`<mwc-tab label=${get(name)} icon=${icon || 'edit'}> </mwc-tab>`;
return html`<mwc-tab label=${name} icon=${icon || 'edit'}> </mwc-tab>`;
}

/** Renders top bar which features icon buttons for undo, redo, log, scl history and diagnostics*/
Expand Down
7 changes: 6 additions & 1 deletion packages/openscd/src/foundation/nsdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ export interface Nsdoc {

const [nsd72, nsd73, nsd74, nsd81] = await Promise.all([iec6185072, iec6185073, iec6185074, iec6185081]);

let nsdoc72: Document | undefined = undefined;
let nsdoc73: Document | undefined = undefined;
let nsdoc74: Document | undefined = undefined;
let nsdoc81: Document | undefined = undefined;

/**
* Initialize the full Nsdoc object.
* @returns A fully initialized Nsdoc object for wizards/editors to use.
*/
export function initializeNsdoc(): Nsdoc {
const [nsdoc72, nsdoc73, nsdoc74, nsdoc81] = [
[nsdoc72, nsdoc73, nsdoc74, nsdoc81] = [
localStorage.getItem('IEC 61850-7-2') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-7-2')!, 'application/xml') : undefined,
localStorage.getItem('IEC 61850-7-3') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-7-3')!, 'application/xml') : undefined,
localStorage.getItem('IEC 61850-7-4') ? new DOMParser().parseFromString(localStorage.getItem('IEC 61850-7-4')!, 'application/xml') : undefined,
Expand Down
16 changes: 16 additions & 0 deletions packages/openscd/src/themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@ export function getTheme(theme: Settings['theme']): TemplateResult {
--mdc-dialog-heading-ink-color: var(--base00);
--mdc-icon-font: 'Material Icons Outlined';
--oscd-primary: var(--oscd-theme-primary, var(--cyan));
--oscd-secondary: var(--oscd-theme-secondary, var(--violet));
--oscd-error: var(--oscd-theme-error, var(--red));
--oscd-base03: var(--oscd-theme-base03, var(--base03));
--oscd-base02: var(--oscd-theme-base02, var(--base02));
--oscd-base01: var(--oscd-theme-base01, var(--base01));
--oscd-base00: var(--oscd-theme-base00, var(--base00));
--oscd-base0: var(--oscd-theme-base0, var(--base0));
--oscd-base1: var(--oscd-theme-base1, var(--base1));
--oscd-base2: var(--oscd-theme-base2, var(--base2));
--oscd-base3: var(--oscd-theme-base3, var(--base3));
--oscd-text-font: var(--oscd-theme-text-font, 'Roboto');
--oscd-icon-font: var(--oscd-theme-icon-font, 'Material Icons');
}
.mdc-drawer span.mdc-drawer__title {
Expand Down
Loading

0 comments on commit db5581f

Please sign in to comment.