Skip to content

Commit

Permalink
Merge pull request #254 from com-pas/release_compas-open-scd_with_v0-…
Browse files Browse the repository at this point in the history
…33-0

chore: merging v0.33.0 from open-scd into compas-open-scd
  • Loading branch information
juancho0202 committed Jun 22, 2023
2 parents 1148b2e + 2e8b8a1 commit 117d51c
Show file tree
Hide file tree
Showing 104 changed files with 1,534 additions and 422 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [0.33.0](https://github.com/openscd/open-scd/compare/v0.32.0...v0.33.0) (2023-06-22)


### Features

* **openscd:** Move progress indicator beneath plugin tabs ([#1181](https://github.com/openscd/open-scd/issues/1181)) ([a7a7081](https://github.com/openscd/open-scd/commits/a7a7081a32ee14998d0ead75ffb89ba2726631f8)), closes [#1178](https://github.com/openscd/open-scd/issues/1178)


### Bug Fixes

* **editing:** use editCount property for change propagation ([#1233](https://github.com/openscd/open-scd/issues/1233)) ([548f63b](https://github.com/openscd/open-scd/commits/548f63b5b35dac6772230004e6ca7859cf3337b8))
* escaped symbols in regex patterns ([#1266](https://github.com/openscd/open-scd/issues/1266)) ([de2dd0d](https://github.com/openscd/open-scd/commits/de2dd0dc2351c8feb6a70da62e43640334df571b))
* goose subscription reflects state incorrectly ([#1261](https://github.com/openscd/open-scd/issues/1261)) ([4440bff](https://github.com/openscd/open-scd/commits/4440bff63c0ebe816a9fdc25f8af6da1ca6645f4))

## [0.31.0](https://github.com/openscd/open-scd/compare/v0.30.0...v0.31.0) (2023-05-02)


Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
"purpose": "maskable"
}
],
"version": "0.31.0"
"version": "0.33.0"
}
83 changes: 2 additions & 81 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "open-scd",
"version": "0.31.0",
"version": "0.33.0",
"repository": "https://github.com/openscd/open-scd.git",
"description": "A bottom-up substation configuration designer for projects described using SCL `IEC 61850-6` Edition 2 or greater.",
"keywords": [
Expand All @@ -17,7 +17,6 @@
"module": "open-scd.js",
"type": "module",
"dependencies": {
"@material/mwc-circular-progress-four-color": "0.22.1",
"@material/mwc-dialog": "0.22.1",
"@material/mwc-drawer": "0.22.1",
"@material/mwc-fab": "0.22.1",
Expand Down
10 changes: 0 additions & 10 deletions src/Editing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,16 +424,6 @@ export function Editing<TBase extends LitElementConstructor>(Base: TBase) {

if (!this.doc) return;

const newDoc = document.implementation.createDocument(
this.doc.lookupNamespaceURI(''),
this.doc.documentElement.tagName,
this.doc.doctype
);

// change the document object reference to enable reactive updates
newDoc.documentElement.replaceWith(this.doc.documentElement);
this.doc = newDoc;

await this.updateComplete;
this.dispatchEvent(newValidateEvent());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Hosting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export function Hosting<
wrapFocus
@action=${(ae: CustomEvent<ActionDetail>) => {
//FIXME: dirty hack to be fixed in open-scd-core
// if clause not neccassary when oscd... compenents in open-scd not list
// if clause not necessary when oscd... components in open-scd not list
if (ae.target instanceof List)
(<MenuItem>(
this.menu.filter(
Expand Down
24 changes: 12 additions & 12 deletions src/Logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function getPluginName(src: string): string {
* A mixin adding a `history` property to any `LitElement`, in which
* incoming [[`LogEvent`]]s are logged.
*
* For [[`EditorAction`]] entries, also sets `currentAction` to the index of
* For [[`EditorAction`]] entries, also sets `editCount` to the index of
* the committed action, allowing the user to go to `previousAction` with
* `undo()` if `canUndo` and to go to `nextAction` with `redo()` if `canRedo`.
*
Expand All @@ -79,7 +79,7 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
history: LogEntry[] = [];
/** Index of the last [[`EditorAction`]] applied. */
@property({ type: Number })
currentAction = -1;
editCount = -1;
@property()
diagnoses = new Map<string, IssueDetail[]>();
@internalProperty()
Expand All @@ -93,7 +93,7 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
@query('#issue') issueUI!: Snackbar;

get canUndo(): boolean {
return this.currentAction >= 0;
return this.editCount >= 0;
}
get canRedo(): boolean {
return this.nextAction >= 0;
Expand All @@ -102,15 +102,15 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
get previousAction(): number {
if (!this.canUndo) return -1;
return this.history
.slice(0, this.currentAction)
.slice(0, this.editCount)
.map(entry => (entry.kind == 'action' ? true : false))
.lastIndexOf(true);
}
get nextAction(): number {
let index = this.history
.slice(this.currentAction + 1)
.slice(this.editCount + 1)
.findIndex(entry => entry.kind == 'action');
if (index >= 0) index += this.currentAction + 1;
if (index >= 0) index += this.editCount + 1;
return index;
}

Expand All @@ -129,25 +129,25 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
if (!this.canUndo) return false;
this.dispatchEvent(
newActionEvent(
invert((<CommitEntry>this.history[this.currentAction]).action)
invert((<CommitEntry>this.history[this.editCount]).action)
)
);
this.currentAction = this.previousAction;
this.editCount = this.previousAction;
return true;
}
redo(): boolean {
if (!this.canRedo) return false;
this.dispatchEvent(
newActionEvent((<CommitEntry>this.history[this.nextAction]).action)
);
this.currentAction = this.nextAction;
this.editCount = this.nextAction;
return true;
}

private onLog(le: LogEvent): void {
if (le.detail.kind === 'reset') {
this.history = [];
this.currentAction = -1;
this.editCount = -1;
return;
}

Expand All @@ -160,7 +160,7 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
if (entry.action.derived) return;
entry.action.derived = true;
if (this.nextAction !== -1) this.history.splice(this.nextAction);
this.currentAction = this.history.length;
this.editCount = this.history.length;
}

this.history.push(entry);
Expand Down Expand Up @@ -210,7 +210,7 @@ export function Logging<TBase extends LitElementConstructor>(Base: TBase) {
class="${entry.kind}"
graphic="icon"
?twoline=${!!entry.message}
?activated=${this.currentAction == history.length - index - 1}
?activated=${this.editCount == history.length - index - 1}
>
<span>
<!-- FIXME: replace tt with mwc-chip asap -->
Expand Down
9 changes: 5 additions & 4 deletions src/Plugging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { ifImplemented, Mixin } from './foundation.js';
import { EditingElement } from './Editing.js';
import { officialPlugins } from '../public/js/plugins.js';
import { Nsdoc } from './foundation/nsdoc.js';

import { LoggingElement } from './Logging.js';
const pluginTags = new Map<string, string>();
/**
* Hashes `uri` using cyrb64 analogous to
Expand Down Expand Up @@ -176,9 +176,9 @@ const loadedPlugins = new Set<string>();
/** Mixin that manages Plugins in `localStorage` */
export type PluggingElement = Mixin<typeof Plugging>;

export function Plugging<TBase extends new (...args: any[]) => EditingElement>(
Base: TBase
) {
export function Plugging<
TBase extends new (...args: any[]) => EditingElement & LoggingElement
>(Base: TBase) {
class PluggingElement extends Base {
// DIRTY HACK: will refactored with open-scd-core
nsdoc!: Nsdoc;
Expand Down Expand Up @@ -289,6 +289,7 @@ export function Plugging<TBase extends new (...args: any[]) => EditingElement>(
content: staticTagHtml`<${tag}
.doc=${this.doc}
.docName=${this.docName}
.editCount=${this.editCount}
.docId=${this.docId}
.pluginId=${plugin.src}
.nsdoc=${this.nsdoc}
Expand Down
6 changes: 3 additions & 3 deletions src/Waiting.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { html, property, TemplateResult } from 'lit-element';

import '@material/mwc-circular-progress-four-color';
import '@material/mwc-linear-progress';

import {
LitElementConstructor,
Expand Down Expand Up @@ -41,10 +41,10 @@ export function Waiting<TBase extends LitElementConstructor>(Base: TBase) {

render(): TemplateResult {
return html`${ifImplemented(super.render())}
<mwc-circular-progress-four-color
<mwc-linear-progress
.closed=${!this.waiting}
indeterminate
></mwc-circular-progress-four-color>`;
></mwc-linear-progress>`;
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/compas/Compasing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { html, query, state, TemplateResult } from 'lit-element';
import { html, query, state, property, TemplateResult } from 'lit-element';

import { Mixin } from '../foundation.js';
import { EditingElement } from '../Editing.js';
Expand Down Expand Up @@ -49,6 +49,9 @@ export function Compasing<TBase extends new (...args: any[]) => EditingElement>(
@state()
private expiredSessionMessage: number = 15 * 60 * 1000;

@property({ type: Number })
editCount = -1;

@query('compas-session-expiring-dialog')
private expiringDialogElement!: CompasSessionExpiringDialogElement;

Expand Down Expand Up @@ -145,6 +148,7 @@ export function Compasing<TBase extends new (...args: any[]) => EditingElement>(
<compas-session-expired-dialog
.expiredSessionMessage="${this.expiredSessionMessage}"
.doc="${this.doc}"
.editCount=${this.editCount}
.docName="${this.docName}"
>
</compas-session-expired-dialog>
Expand Down
8 changes: 5 additions & 3 deletions src/editors/Cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ export default class Cleanup extends LitElement {
/** The document being edited as provided to plugins by [[`OpenSCD`]]. */
@property()
doc!: XMLDocument;
@property({ type: Number })
editCount = -1;

render(): TemplateResult {
return html`
<div class="cleanup">
<cleanup-datasets .doc=${this.doc}></cleanup-datasets>
<cleanup-control-blocks .doc=${this.doc}></cleanup-control-blocks>
<cleanup-data-types .doc=${this.doc}></cleanup-data-types>
<cleanup-datasets .editCount=${this.editCount} .doc=${this.doc}></cleanup-datasets>
<cleanup-control-blocks .editCount=${this.editCount} .doc=${this.doc}></cleanup-control-blocks>
<cleanup-data-types .editCount=${this.editCount} .doc=${this.doc}></cleanup-data-types>
</div>
`;
}
Expand Down
Loading

0 comments on commit 117d51c

Please sign in to comment.