Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 1596 Enable transpower publisher plugin #1598

Merged
merged 5 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 enegery tools edit events
* beause 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);
}

clepski marked this conversation as resolved.
Show resolved Hide resolved
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 {
trusz marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -394,7 +394,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
Loading