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(ui5-tooling-modules): support including Assets for Web Components #1112

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

petermuessig
Copy link
Member

No description provided.

To support all languages and themes, the Seamless Web Components support
need to include a reference to the respective Assets file of the dedicated
library.

The built-in solution using the optional flag includeAssets for the
pluginOptions of the webcomponents plugin can include the assets module
but this module is loaded too late and in some cases the custom theme
and the language isn't available early enough. This requires a rethink
of the OpenUI5Support module.

Manually the Assets can be included as shown in the Components.js of the
sample project:

import "@ui5/webcomponents/dist/Assets";
import "@ui5/webcomponents-fiori/dist/Assets";
@petermuessig petermuessig force-pushed the feat/modules/WebCAssets branch from 045a257 to 7296ada Compare October 30, 2024 20:22
@petermuessig petermuessig changed the title feat(ui5-tooling-modules): web components now also include assets feat(ui5-tooling-modules): support including Assets for Web Components Oct 30, 2024
@petermuessig
Copy link
Member Author

@Thodd @vladitasev

We need to re-discuss the OpenUI5Support in general. When including the Assets modules per package it comes most probably too late and then the initial theme can't be applied correctly. This also applies to the languages and all other dynamic imports.

@petermuessig petermuessig merged commit 15c3420 into main Oct 30, 2024
5 checks passed
@petermuessig petermuessig deleted the feat/modules/WebCAssets branch October 30, 2024 20:31
@Thodd
Copy link
Collaborator

Thodd commented Oct 31, 2024

We need to re-discuss the OpenUI5Support in general. When including the Assets modules per package it comes most probably too late and then the initial theme can't be applied correctly. This also applies to the languages and all other dynamic imports.

Hm I will look into this later, not sure why this would be too late 🤔
If I see this correctly, the retrofit wrappers load the OpenUI5Support from the sap/ui/webc/common/library.js.
That should be the earliest point in time, correct @vladitasev?

@petermuessig
Copy link
Member Author

It's the loading order:

webcomponents-fiori > webcomponents > webcomponents-base > OpenUI5Support
webcomponents-fiori > Assets

It's the nature of the import order we have - but we can't change that easily except of moving the OpenUI5Support initialization to a later point in time...

Today it works by manually importing the Assets in the Component.js which is also OK but it would require documentation how to include additional styles and exclude the dynamics from the preload otherwise the preload is ~10MB unzipped! 😓

vobu pushed a commit that referenced this pull request Nov 2, 2024
#1112)

To support all languages and themes, the Seamless Web Components support
need to include a reference to the respective Assets file of the dedicated
library.

The built-in solution using the optional flag includeAssets for the
pluginOptions of the webcomponents plugin can include the assets module
but this module is loaded too late and in some cases the custom theme
and the language isn't available early enough. This requires a rethink
of the OpenUI5Support module.

Manually the Assets can be included as shown in the Components.js of the
sample project:

import "@ui5/webcomponents/dist/Assets";
import "@ui5/webcomponents-fiori/dist/Assets";
marianfoo pushed a commit that referenced this pull request Nov 5, 2024
#1112)

To support all languages and themes, the Seamless Web Components support
need to include a reference to the respective Assets file of the dedicated
library.

The built-in solution using the optional flag includeAssets for the
pluginOptions of the webcomponents plugin can include the assets module
but this module is loaded too late and in some cases the custom theme
and the language isn't available early enough. This requires a rethink
of the OpenUI5Support module.

Manually the Assets can be included as shown in the Components.js of the
sample project:

import "@ui5/webcomponents/dist/Assets";
import "@ui5/webcomponents-fiori/dist/Assets";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants