orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
511 stars 220 forks source link

Baseline updates do not include XBL components #6352

Closed ebruchez closed 1 month ago

ebruchez commented 1 month ago

We have the notion of:

When a page loads, we call outputCSSResources().

So, upon loading the page, the baseline assets are not properly handled?

The updated assets with assets.baseline.updates are used upon loading, but only the .css and .js parts, not the .xbl parts.

Concrete issue: setup fb baseline updates for Form Builder to include fr:section, in case there is no form loaded initially.

Can we make it so that baselineStyles handles this?

Where XFormsAssetsBuilder.updateAssets is used:

Found while @obruchez worked on #3414.

ebruchez commented 1 month ago

So the way we compute baseline updates is quite unclear.

We have a global BindingLoader, which handles the index of bindings. This also keeps track of a global CSS/JS baseline based on:

We also have a global non-XBL baseline, which is based on:

Finally, we have a system of updates that are not global, but specified by form, using oxf.xforms.assets.baseline.updates, passed as static property to forms by Form Runner, reading other properties such as:

Those update properties achieve the following:

We could also remove XBL by direct binding QName, but we don't have any use case currently.

A given form should create a form-specific (but typically shared amongst all Form Runner forms) baseline of resources by combining all of the above:

One problem is that the global XBL baseline is currently returned as CSS/JS by path, so if you say for example to remove with -fr:code-mirror, what should the logic be? For example you don't want to remove global files, let's say if an XBL component includes foo.css, and that is not specific to that component. Well, for now, we could just support not removing from the baseline by direct binding QName.

ebruchez commented 1 month ago

We shouldn't have what's in the XBL library (oxf.xforms.xbl.library) in the baseline. This should just be a mechanism to look up XBL bindings.

Looking at the code, this seems to be correct: getUpToDateLibraryAndBaseline() gets the baseline bindings only, and then load the corresponding AbstractBindings, and then gathers the CSS/JS paths.

We could store instead a mapping direct QName → paths. This would make it easier to build the final baseline.