Skip to content

Commit

Permalink
feat: enable transpower publisher plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
clepski authored Dec 3, 2024
1 parent ddcd5fc commit 3697c38
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 2 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
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);
}
2 changes: 1 addition & 1 deletion packages/openscd/src/addons/Layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,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
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

0 comments on commit 3697c38

Please sign in to comment.