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

chore: Sync with upstream #359

Merged
merged 30 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
91dc961
bugfix: Create virtual IED does not consider multiple instances of a …
illia-solovei-s1 Dec 16, 2024
dd692a8
feat(monorepo): Add contributing guide (#1588)
michelguerin Dec 16, 2024
ce39e2b
feat: Edit api v3 (#1615)
clepski Jan 27, 2025
3aef22a
chore(main): release 0.37.0 (#1612)
github-actions[bot] Jan 31, 2025
65d6f73
chore: Raise core version to 0.1.4 (#1616)
clepski Jan 31, 2025
d3b2a0a
Feat: Programatic Plugin Activation (#1611)
trusz Feb 4, 2025
dc78329
Add decisions made for externalizing OpenSCD plugins (#1599)
david-monichi Feb 5, 2025
c39cd6c
fix: openscd forgets disabled plugins (#1618)
trusz Feb 6, 2025
101aaae
Fix: Forgetting Plugin Settnigs (#1619)
trusz Feb 6, 2025
2273c2d
feat: Attach files to release build (#1620)
salvar3nga Feb 13, 2025
cb00837
chore(main): release 0.37.1 (#1617)
github-actions[bot] Feb 17, 2025
53f24cb
feat: change release please Workflow trigger (#1624)
salvar3nga Feb 17, 2025
1e50fd9
chore: update release please version to 0.37.2 (#1627)
salvar3nga Feb 18, 2025
00c4dc0
Fix: inconsistent plugin activation behaviour caused by refactoring (…
trusz Feb 19, 2025
a3d6d2f
fix: update release please version to 0.37.2 (#1632)
salvar3nga Feb 26, 2025
06b8356
Feat: update release please action (#1635)
salvar3nga Feb 26, 2025
71ca4ff
chore(main): release 0.38.0 (#1634)
github-actions[bot] Feb 27, 2025
d2f2904
Merge remote-tracking branch 'upstream/main' into chore/sync-with-ups…
clepski Feb 27, 2025
670eedb
chore: Adjust compas layout to upstream changes
clepski Feb 28, 2025
d6faece
chore: Fix build
clepski Mar 4, 2025
a2b51a3
chore: Remove unnecessary workflow
clepski Mar 5, 2025
510329a
chore: Use ubuntu 22 build agent for workflow
clepski Mar 5, 2025
c3361f1
chore: Rename original open scd selector to avoid name collision
clepski Mar 5, 2025
6a2fef0
chore: Fix compas open
clepski Mar 5, 2025
290ff06
Merge branch 'main' into chore/sync-with-upstream
clepski Mar 6, 2025
64ab17f
chore: Fix after merge
clepski Mar 6, 2025
e3be318
chore: Raise version to 0.38.0.1
clepski Mar 6, 2025
c4a3376
fix: Fix local build by deleting snowpack cache for lit
clepski Mar 6, 2025
56328f6
chore: Comment start script
clepski Mar 6, 2025
ae8bd71
chore: Remove unused imports
clepski Mar 7, 2025
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
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHROME_PATH=
2 changes: 1 addition & 1 deletion .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
build:
name: Build
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
timeout-minutes: 45

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: pull_request

jobs:
test-and-build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/[email protected]
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ node_modules/
/lerna-debug.log

.nx/cache

# environment variables
.env
6 changes: 3 additions & 3 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packages/openscd": "0.36.0",
"packages/core": "0.1.3",
".": "0.36.0"
"packages/openscd": "0.37.0",
"packages/core": "0.1.4",
".": "0.38.0"
}
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Changelog

## [0.38.0](https://github.com/openscd/open-scd/compare/v0.37.1...v0.38.0) (2025-02-26)


### Features

* change release please Workflow trigger ([#1624](https://github.com/openscd/open-scd/issues/1624)) ([53f24cb](https://github.com/openscd/open-scd/commit/53f24cbc9b2be8407aa1420b5665d2a09e9051ea))
* update release please action ([#1635](https://github.com/openscd/open-scd/issues/1635)) ([06b8356](https://github.com/openscd/open-scd/commit/06b8356485940f2841b01293de5bea2a6fa1399d))


### Bug Fixes

* inconsistent plugin activation behaviour caused by refactoring ([#1626](https://github.com/openscd/open-scd/issues/1626)) ([00c4dc0](https://github.com/openscd/open-scd/commit/00c4dc06f6d0cf1c39e4822a5b21d650d698785e))
* update release please version to 0.37.2 ([#1632](https://github.com/openscd/open-scd/issues/1632)) ([a3d6d2f](https://github.com/openscd/open-scd/commit/a3d6d2f68952e98d62375b037b5b36bca63f325a))

## [0.37.1](https://github.com/openscd/open-scd/compare/v0.37.0...v0.37.1) (2025-02-04)


### Features

* Programatic Plugin Activation ([#1611](https://github.com/openscd/open-scd/issues/1611)) ([d3b2a0a](https://github.com/openscd/open-scd/commit/d3b2a0a7b2d08d0ce5484567ebfe6c6d4e548c5e))

## [0.37.0](https://github.com/openscd/open-scd/compare/v0.36.0...v0.37.0) (2025-01-27)


### Features

* Edit api v3 ([#1615](https://github.com/openscd/open-scd/issues/1615)) ([ce39e2b](https://github.com/openscd/open-scd/commit/ce39e2b7bfcda40659f36e40659b1efd571f2a53))
* **monorepo:** Add contributing guide ([#1588](https://github.com/openscd/open-scd/issues/1588)) ([dd692a8](https://github.com/openscd/open-scd/commit/dd692a8d9784aaf5f8509fdad5298293195d1465))

## [0.36.0](https://github.com/openscd/open-scd/compare/v0.35.0...v0.36.0) (2024-11-14)


Expand Down
190 changes: 73 additions & 117 deletions packages/core/CONTRIBUTING.md → CONTRIBUTING.md

Large diffs are not rendered by default.

116 changes: 113 additions & 3 deletions docs/core-api/edit-api.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,123 @@
# Edit Event API
# Edit Event API v2

Open SCD offers an API for editing the scd document which can be used with [Html Custom Events](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent). The main Open SCD components listens to events of the type `oscd-edit`, applies the changes to the `doc` and updates the `editCount` property.
Open SCD offers an API for editing the scd document which can be used with [Html Custom Events](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent). The main Open SCD components listens to events of the type `oscd-edit-v2`, applies the changes to the `doc` and updates the `editCount` property.

The edits to the `doc` will be done in place, e.g. the `doc` changes but will keep the same reference. If your plugin needs to react to changes in the doc, you should listen to changes in the `editCount` property.

## Event factory

Open SCD core exports a factory function for edit events, so you do not have to build them manually.

```ts
function newEditEventV2<E extends EditV2>(
edit: E,
options?: EditEventOptionsV2
): EditEventV2

type EditV2 = InsertV2 | SetAttributesV2 | SetTextContentV2 | RemoveV2 | EditV2[];

interface EditEventOptionsV2 = {
title?: string;
squash?: boolean;
createHistoryEntry?: boolean;
};
```

### EditEventOptionsV2

* `title` set a title to be shown in the history.
* `squash` squash edit with previous history entry, this is useful if you want to create multiple edits based on an user action, but need the updated `doc` before applying each edit. Defaults to `false`.
* `createHistoryEntry` decides whether a history for the `edit` should be created. Defaults to `true`.

### Insert

Insert events can be used to add new nodes or move existing nodes in the document. Since a node can only have one parent, using an insert on an existing node will replace it's previous parent with the new parent, essentially moving the node to a different position in the xml tree.

If the reference is not `null`, the node will be inserted before the reference node. The reference has to be a child node of the parent. And if the reference is `null` the node will be added as the last child of the parent.

```ts
interface InsertV2 {
parent: Node;
node: Node;
reference: Node | null;
}
```

### Remove

This event will remove the node from the document.

```ts
interface RemoveV2 {
node: Node;
}
```

### SetAttributes

Sets attributes for the element, can set both regular and namespaced attributes.

```ts
interface SetAttributesV2 {
element: Element;
attributes: Partial<Record<string, string | null>>;
attributesNS: Partial<Record<string, Partial<Record<string, string | null>>>>;
}
```

To set a namespaced attribute see the following example. Here we are setting the attribute `exa:type` for the namespace `https://example.com` to `secondary`.

```ts
const setNamespacedAttributes: SetAttributesV2 = {
element,
attributes: {},
attributesNS: {
"https://example.com": {
"exa:type": "secondary"
}
}
}
```

### SetTextContent

Sets the text content of the element, removes any other children. To remove text content you can pass `null` as value for `textContent`.

```ts
interface SetTextContentV2 {
element: Element;
textContent: string;
}
```

### Complex edits

Complex edits can be used to apply multiple edits as a single event. This will create a single entry in the history. You can create complex edit events by passing an array of edit events to the `newEditEventV2` factory function.

```ts
import { newEditEventV2 } from '@openscd/core';

const complexEditEvent = newEditEventV2([ insert, update, remove ]);

someComponent.dispatchEvent(complexEditEvent);

```

## History

All edit events with the option `createHistoryEntry` will create a history log entry and can be undone and redone through the history addon.


# Archives

## Edit Event API v1 (deprecated)

The edit event API v1 is still available and listens to events of the type `oscd-edit`.

## Event factory

Open SCD core exports a factory function for edit events, so you do not have to build them manually.

```ts
function newEditEvent<E extends Edit>(
edit: E,
Expand Down Expand Up @@ -158,7 +268,7 @@ With open SCD version **v0.36.0** and higher some editor action features are no

---

# Archives - Editor Action API (deprecated)
## Editor Action API (deprecated)

### Event factory

Expand Down
36 changes: 36 additions & 0 deletions docs/decisions/0003-extract-plugins.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ADR-0003 - Externalize OpenSCD core plugins

Date: 2024-11-19

## Status

Approved

## Context

For a better expandability we would like to extract all plugins in a new plugins repository.

## Decision

Following the architectural decision in [OpenSCD Theming](./../0001-ADR-Theming.md) we will extract all OpenSCD Core plugins to an external repository.
Doing so OpenSCD Core will be streamlined and a clean interface and structure for plugins will be provided for custom extensions.
Before extracting this plugins a shared UI-Components module will be extracted. This UI-Components provide reusable UI-Components based on [NX](https://nx.dev/) for faster development for OpenSCD Core and custom plugins. This new repository will be created as mono repository to facility the plugins development and simplify the release and deployment process.

Plugins will be moved to repository [OpenSCD official Plugins](https://github.com/openscd/oscd-official-plugins) and the release strategy is defined [here](./0004-openscd-release-and-deploy-strategy.md).
As final task the current documentation will be added with a new section `How to add new and custom OpenSCD plugins` to support developers to follow the concept.

## Consequences

- Clean Code in OpenSCD Core
- Clear architectural structure of plugins

- Building OpenSCD is more then building a simple repository
- Clear path must be defined how to extend OpenSCD with custom plugins (full software cycle till deployment)
- Release process for OpenSCD Core and OpenSCD official plugins

## Agreed procedure

- move the plugins without any components abstraction to the external plugins repository
- copy all required dependencies regardless of code duplication
- integrate the plugins as submodules within OpenSCD core in the pipeline
- later on we can extract step by step for each plugin UI-Components
32 changes: 32 additions & 0 deletions docs/decisions/0004-openscd-release-and-deployment-strategy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ADR-0004 - Technical solution for releasing and deployments

Date: 2024-11-19

## Status

Approved

## Context

Based on the [decision](./0003-extract-plugins.md) to externalize plugins in proper plugins repository a new release and deployment strategy needs to be defined.
This plugins repository is solved as mono repository.

## Decision

### Release process

Since OpenSCD is based on [NX](https://nx.dev/) the release strategy needs to rely on NX as well and must allow single releases of sub modules within this mono repository.
Such feature is provided by [NX release](https://nx.dev/recipes/nx-release) specially when using the [NX independently release feature](https://nx.dev/recipes/nx-release/release-projects-independently).

A possible release command would look like:
```
nx release --projects=plugin-1,plugin-3
```

## Consequences

- Process needs to be documented so that all developers can easily follow it
- The building of complete OpenSCD Editor, OpenSCD Core + OpenSCD plugins, depends now on two repositories
- Custom OpenSCD eg. CoMPAS OpenSCD will be cleaner and more code can be reused
- Similar Look & Feel of plugins if shared UI-Components are used
- Faster plugin development and integration into OpenSCD Core
2 changes: 1 addition & 1 deletion package-lock.json

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

5 changes: 3 additions & 2 deletions packages/compas-open-scd/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "compas-open-scd",
"version": "0.36.0-4",
"version": "0.38.0-1",
"repository": "https://github.com/openscd/open-scd.git",
"description": "OpenSCD CoMPAS Edition",
"directory": "packages/compas-open-scd",
Expand Down Expand Up @@ -71,7 +71,8 @@
"build:test": "npm run test && npm run build && cp .nojekyll build/",
"build": "npm run doc && npm run build:only && cp .nojekyll build/",
"build:only": "snowpack build && workbox generateSW workbox-config.cjs",
"start": "snowpack dev"
"__comment:start": "snowpack dev fails if the lit package is cached. I don't know why, but we have to delete it before starting",
"start": "npx rimraf node_modules/.cache/snowpack/build/[email protected] && snowpack dev"
},
"devDependencies": {
"@commitlint/cli": "^13.1.0",
Expand Down
Loading