Skip to content

Commit

Permalink
[2537] Split the sirius-web frontend package
Browse files Browse the repository at this point in the history
Bug: #2537
Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
  • Loading branch information
AxelRICHARD authored and sbegaudeau committed Nov 15, 2023
1 parent 04c119d commit 639fe06
Show file tree
Hide file tree
Showing 116 changed files with 4,234 additions and 4,387 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [ADR-112] Provide only valid view descriptions to the renderer
- [ADR-113] Add support for multiple IObjectService
- [ADR-114] Add support for multiple IEditService
- [ADR-115] Split the Sirius Web frontend

=== Breaking changes

Expand Down Expand Up @@ -54,6 +55,19 @@ Add the attribute `displayHeaderSeparator` to the graphql API.
image:doc/screenshots/compartmentWithHeaderWithoutSeparator.png[Compartment with header without separator,30%]
- https://github.com/eclipse-sirius/sirius-web/issues/2255[#2255] [diagram] The properties `widthComputationExpression` and `heightComputationExpression` have been removed from `NodeStyleDescription`.
From now on, use the `defaultWidthExpression` and `defaultHeightExpression` properties from `NodeDescription`.
- https://github.com/eclipse-sirius/sirius-web/issues/2537[#2537] [sirius-web] `sirius-web` frontend package has been split in two: `sirius-web` and `sirius-web-application`.
The package `sirius-web` now depends on `sirius-web-application`.
A new component `SiriusWebApplication` has been added.
Developers who want to create a `sirius-web` frontend should use this component as their root component.
The API of this component will change over time in order to provide additional capabilities.
API breaks should be expected.
+
Another component, named `Views` has also been added.
This component will allow developers to customize some parts of the Sirius Web views.
It will currently provide the ability to customize the application icon and application menu.
The API of this component will also change over time so API breaks should be expected in the upcoming releases.
+
This new package and those new components are the first part of our work to make Sirius Web more reusable.

=== Dependency update

Expand Down
73 changes: 73 additions & 0 deletions doc/adrs/115_split_sirius_web_frontend.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
= ADR-115 - Split Sirius Web frontend

== Context

Developers want to have an off-the-shelf Sirius Web frontend.
They do not want to have to fork everything to create a similar user interface.

The `sirius-web` frontend package contains a lot of things, some are relevant for everybody and some are specific to the Sirius Web example.
Developers who want to create a Sirius Web based application may not want all these things.
On the other hand, they want to customize some existing parts of Sirius Web.

== Decision

We will split the `sirius-web` frontend package in two distinct packages: `sirius-web` and `sirius-web-application`.
The `sirius-web-application` will thus encapsulate most of what is currently known as the Sirius Web frontend.
Some parts of this package will configurable.
It will depend on the feedback we receive from developers in the future.

As a first step, the package `sirius-web-application` will only export the new `SiriusWebApplication` and `Views` components.
The new components are described below:

=== SiriusWebApplication

The `SiriusWebApplication` will require the `http` server URL et `ws` server URL to work.
Using this component, one could retrieve all the Sirius Web frontend.

This component will also let developers change the theme of the application.
If no theme is provided, then the default existing Sirius Web theme will be used.
It will thus be possible to start a Sirius Web based frontend using only the following code:

[source,ts]
----
ReactDOM.render(
<SiriusWebApplication
httpOrigin="http://localhost:8080"
wsOrigin="ws://localhost:8080" />
};
----


=== Views

The new `Views` component will allow to optionally configure some view-related concerns.
It will thus give the ability to change the application icon or the navigation bar menu.
If no application icon or navigation bar menu are provided, then the default existing Sirius Web application icon or navigation bar menu will be used.

[source,ts]
----
const CustomIcon = () => <div>Icon</div>
const CustomMenu = () => <div>Menu</div>
ReactDOM.render(
<SiriusWebApplication
httpOrigin="http://localhost:8080"
wsOrigin="ws://localhost:8080">
<Views applicationIcon={<CustomIcon />} applicationBarMenu={<CustomMenu />} />
</SiriusWebApplication>
};
----

`Views` is just the first component used to describe part of the customization of a Sirius Web application.
Additional customization will be performed in the future by using other child components.
`SiriusWebApplication#children` will thus be the entry point of any customization of the Sirius Web application.


== Status

Approved

== Consequences

The `sirius-web` frontend package will have a new dependency, the `sirius-web-application` package.
The index of `sirius-web` will thus use the component `<SiriusWebApplication />`.

0 comments on commit 639fe06

Please sign in to comment.